"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.VK_FORMAT_ASTC_6x6_SRGB_BLOCK = exports.VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT = exports.VK_FORMAT_ASTC_6x5_UNORM_BLOCK = exports.VK_FORMAT_ASTC_6x5_SRGB_BLOCK = exports.VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT = exports.VK_FORMAT_ASTC_5x5_UNORM_BLOCK = exports.VK_FORMAT_ASTC_5x5_SRGB_BLOCK = exports.VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT = exports.VK_FORMAT_ASTC_5x4_UNORM_BLOCK = exports.VK_FORMAT_ASTC_5x4_SRGB_BLOCK = exports.VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT = exports.VK_FORMAT_ASTC_4x4_UNORM_BLOCK = exports.VK_FORMAT_ASTC_4x4_SRGB_BLOCK = exports.VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT = exports.VK_FORMAT_ASTC_12x12_UNORM_BLOCK = exports.VK_FORMAT_ASTC_12x12_SRGB_BLOCK = exports.VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT = exports.VK_FORMAT_ASTC_12x10_UNORM_BLOCK = exports.VK_FORMAT_ASTC_12x10_SRGB_BLOCK = exports.VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT = exports.VK_FORMAT_ASTC_10x8_UNORM_BLOCK = exports.VK_FORMAT_ASTC_10x8_SRGB_BLOCK = exports.VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT = exports.VK_FORMAT_ASTC_10x6_UNORM_BLOCK = exports.VK_FORMAT_ASTC_10x6_SRGB_BLOCK = exports.VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT = exports.VK_FORMAT_ASTC_10x5_UNORM_BLOCK = exports.VK_FORMAT_ASTC_10x5_SRGB_BLOCK = exports.VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT = exports.VK_FORMAT_ASTC_10x10_UNORM_BLOCK = exports.VK_FORMAT_ASTC_10x10_SRGB_BLOCK = exports.VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT = exports.VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT = exports.VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT = exports.VK_FORMAT_A2R10G10B10_UNORM_PACK32 = exports.VK_FORMAT_A2R10G10B10_UINT_PACK32 = exports.VK_FORMAT_A2R10G10B10_SNORM_PACK32 = exports.VK_FORMAT_A2R10G10B10_SINT_PACK32 = exports.VK_FORMAT_A2B10G10R10_UNORM_PACK32 = exports.VK_FORMAT_A2B10G10R10_UINT_PACK32 = exports.VK_FORMAT_A2B10G10R10_SNORM_PACK32 = exports.VK_FORMAT_A2B10G10R10_SINT_PACK32 = exports.VK_FORMAT_A1R5G5B5_UNORM_PACK16 = exports.KTX2Container = exports.KHR_SUPERCOMPRESSION_ZSTD = exports.KHR_SUPERCOMPRESSION_ZLIB = exports.KHR_SUPERCOMPRESSION_NONE = exports.KHR_SUPERCOMPRESSION_BASISLZ = exports.KHR_DF_VERSION = exports.KHR_DF_VENDORID_KHRONOS = exports.KHR_DF_TRANSFER_UNSPECIFIED = exports.KHR_DF_TRANSFER_ST240 = exports.KHR_DF_TRANSFER_SRGB = exports.KHR_DF_TRANSFER_SLOG2 = exports.KHR_DF_TRANSFER_SLOG = exports.KHR_DF_TRANSFER_PQ_OETF = exports.KHR_DF_TRANSFER_PQ_EOTF = exports.KHR_DF_TRANSFER_PAL_OETF = exports.KHR_DF_TRANSFER_PAL625_EOTF = exports.KHR_DF_TRANSFER_NTSC = exports.KHR_DF_TRANSFER_LINEAR = exports.KHR_DF_TRANSFER_ITU = exports.KHR_DF_TRANSFER_HLG_OETF = exports.KHR_DF_TRANSFER_HLG_EOTF = exports.KHR_DF_TRANSFER_DCIP3 = exports.KHR_DF_TRANSFER_BT1886 = exports.KHR_DF_TRANSFER_ADOBERGB = exports.KHR_DF_TRANSFER_ACESCCT = exports.KHR_DF_TRANSFER_ACESCC = exports.KHR_DF_SAMPLE_DATATYPE_SIGNED = exports.KHR_DF_SAMPLE_DATATYPE_LINEAR = exports.KHR_DF_SAMPLE_DATATYPE_FLOAT = exports.KHR_DF_SAMPLE_DATATYPE_EXPONENT = exports.KHR_DF_PRIMARIES_UNSPECIFIED = exports.KHR_DF_PRIMARIES_PAL525 = exports.KHR_DF_PRIMARIES_NTSC1953 = exports.KHR_DF_PRIMARIES_DISPLAYP3 = exports.KHR_DF_PRIMARIES_CIEXYZ = exports.KHR_DF_PRIMARIES_BT709 = exports.KHR_DF_PRIMARIES_BT601_SMPTE = exports.KHR_DF_PRIMARIES_BT601_EBU = exports.KHR_DF_PRIMARIES_BT2020 = exports.KHR_DF_PRIMARIES_ADOBERGB = exports.KHR_DF_PRIMARIES_ACESCC = exports.KHR_DF_PRIMARIES_ACES = exports.KHR_DF_MODEL_UNSPECIFIED = exports.KHR_DF_MODEL_RGBSDA = exports.KHR_DF_MODEL_ETC2 = exports.KHR_DF_MODEL_ETC1S = exports.KHR_DF_MODEL_ETC1 = exports.KHR_DF_MODEL_ASTC = exports.KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT = exports.KHR_DF_FLAG_ALPHA_STRAIGHT = exports.KHR_DF_FLAG_ALPHA_PREMULTIPLIED = exports.KHR_DF_CHANNEL_RGBSDA_STENCIL = exports.KHR_DF_CHANNEL_RGBSDA_RED = exports.KHR_DF_CHANNEL_RGBSDA_GREEN = exports.KHR_DF_CHANNEL_RGBSDA_DEPTH = exports.KHR_DF_CHANNEL_RGBSDA_BLUE = exports.KHR_DF_CHANNEL_RGBSDA_ALPHA = void 0;
exports.VK_FORMAT_R32G32B32_UINT = exports.VK_FORMAT_R32G32B32_SINT = exports.VK_FORMAT_R32G32B32_SFLOAT = exports.VK_FORMAT_R32G32B32A32_UINT = exports.VK_FORMAT_R32G32B32A32_SINT = exports.VK_FORMAT_R32G32B32A32_SFLOAT = exports.VK_FORMAT_R16_UNORM = exports.VK_FORMAT_R16_UINT = exports.VK_FORMAT_R16_SNORM = exports.VK_FORMAT_R16_SINT = exports.VK_FORMAT_R16_SFLOAT = exports.VK_FORMAT_R16G16_UNORM = exports.VK_FORMAT_R16G16_UINT = exports.VK_FORMAT_R16G16_SNORM = exports.VK_FORMAT_R16G16_SINT = exports.VK_FORMAT_R16G16_SFLOAT = exports.VK_FORMAT_R16G16B16_UNORM = exports.VK_FORMAT_R16G16B16_UINT = exports.VK_FORMAT_R16G16B16_SNORM = exports.VK_FORMAT_R16G16B16_SINT = exports.VK_FORMAT_R16G16B16_SFLOAT = exports.VK_FORMAT_R16G16B16A16_UNORM = exports.VK_FORMAT_R16G16B16A16_UINT = exports.VK_FORMAT_R16G16B16A16_SNORM = exports.VK_FORMAT_R16G16B16A16_SINT = exports.VK_FORMAT_R16G16B16A16_SFLOAT = exports.VK_FORMAT_R12X4_UNORM_PACK16 = exports.VK_FORMAT_R12X4G12X4_UNORM_2PACK16 = exports.VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16 = exports.VK_FORMAT_R10X6_UNORM_PACK16 = exports.VK_FORMAT_R10X6G10X6_UNORM_2PACK16 = exports.VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16 = exports.VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = exports.VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = exports.VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = exports.VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = exports.VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = exports.VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = exports.VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = exports.VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = exports.VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16 = exports.VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16 = exports.VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = exports.VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = exports.VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = exports.VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = exports.VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = exports.VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = exports.VK_FORMAT_EAC_R11_UNORM_BLOCK = exports.VK_FORMAT_EAC_R11_SNORM_BLOCK = exports.VK_FORMAT_EAC_R11G11_UNORM_BLOCK = exports.VK_FORMAT_EAC_R11G11_SNORM_BLOCK = exports.VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = exports.VK_FORMAT_D32_SFLOAT_S8_UINT = exports.VK_FORMAT_D32_SFLOAT = exports.VK_FORMAT_D24_UNORM_S8_UINT = exports.VK_FORMAT_D16_UNORM_S8_UINT = exports.VK_FORMAT_D16_UNORM = exports.VK_FORMAT_BC7_UNORM_BLOCK = exports.VK_FORMAT_BC7_SRGB_BLOCK = exports.VK_FORMAT_BC6H_UFLOAT_BLOCK = exports.VK_FORMAT_BC6H_SFLOAT_BLOCK = exports.VK_FORMAT_BC5_UNORM_BLOCK = exports.VK_FORMAT_BC5_SNORM_BLOCK = exports.VK_FORMAT_BC4_UNORM_BLOCK = exports.VK_FORMAT_BC4_SNORM_BLOCK = exports.VK_FORMAT_BC3_UNORM_BLOCK = exports.VK_FORMAT_BC3_SRGB_BLOCK = exports.VK_FORMAT_BC2_UNORM_BLOCK = exports.VK_FORMAT_BC2_SRGB_BLOCK = exports.VK_FORMAT_BC1_RGB_UNORM_BLOCK = exports.VK_FORMAT_BC1_RGB_SRGB_BLOCK = exports.VK_FORMAT_BC1_RGBA_UNORM_BLOCK = exports.VK_FORMAT_BC1_RGBA_SRGB_BLOCK = exports.VK_FORMAT_B8G8R8_UNORM = exports.VK_FORMAT_B8G8R8_UINT = exports.VK_FORMAT_B8G8R8_SRGB = exports.VK_FORMAT_B8G8R8_SNORM = exports.VK_FORMAT_B8G8R8_SINT = exports.VK_FORMAT_B8G8R8A8_UNORM = exports.VK_FORMAT_B8G8R8A8_UINT = exports.VK_FORMAT_B8G8R8A8_SRGB = exports.VK_FORMAT_B8G8R8A8_SNORM = exports.VK_FORMAT_B8G8R8A8_SINT = exports.VK_FORMAT_B5G6R5_UNORM_PACK16 = exports.VK_FORMAT_B5G5R5A1_UNORM_PACK16 = exports.VK_FORMAT_B4G4R4A4_UNORM_PACK16 = exports.VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16 = exports.VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 = exports.VK_FORMAT_B10G11R11_UFLOAT_PACK32 = exports.VK_FORMAT_ASTC_8x8_UNORM_BLOCK = exports.VK_FORMAT_ASTC_8x8_SRGB_BLOCK = exports.VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT = exports.VK_FORMAT_ASTC_8x6_UNORM_BLOCK = exports.VK_FORMAT_ASTC_8x6_SRGB_BLOCK = exports.VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT = exports.VK_FORMAT_ASTC_8x5_UNORM_BLOCK = exports.VK_FORMAT_ASTC_8x5_SRGB_BLOCK = exports.VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT = exports.VK_FORMAT_ASTC_6x6_UNORM_BLOCK = void 0;
exports.VK_FORMAT_X8_D24_UNORM_PACK32 = exports.VK_FORMAT_UNDEFINED = exports.VK_FORMAT_S8_UINT = exports.VK_FORMAT_R8_UNORM = exports.VK_FORMAT_R8_UINT = exports.VK_FORMAT_R8_SRGB = exports.VK_FORMAT_R8_SNORM = exports.VK_FORMAT_R8_SINT = exports.VK_FORMAT_R8G8_UNORM = exports.VK_FORMAT_R8G8_UINT = exports.VK_FORMAT_R8G8_SRGB = exports.VK_FORMAT_R8G8_SNORM = exports.VK_FORMAT_R8G8_SINT = exports.VK_FORMAT_R8G8B8_UNORM = exports.VK_FORMAT_R8G8B8_UINT = exports.VK_FORMAT_R8G8B8_SRGB = exports.VK_FORMAT_R8G8B8_SNORM = exports.VK_FORMAT_R8G8B8_SINT = exports.VK_FORMAT_R8G8B8A8_UNORM = exports.VK_FORMAT_R8G8B8A8_UINT = exports.VK_FORMAT_R8G8B8A8_SRGB = exports.VK_FORMAT_R8G8B8A8_SNORM = exports.VK_FORMAT_R8G8B8A8_SINT = exports.VK_FORMAT_R64_UINT = exports.VK_FORMAT_R64_SINT = exports.VK_FORMAT_R64_SFLOAT = exports.VK_FORMAT_R64G64_UINT = exports.VK_FORMAT_R64G64_SINT = exports.VK_FORMAT_R64G64_SFLOAT = exports.VK_FORMAT_R64G64B64_UINT = exports.VK_FORMAT_R64G64B64_SINT = exports.VK_FORMAT_R64G64B64_SFLOAT = exports.VK_FORMAT_R64G64B64A64_UINT = exports.VK_FORMAT_R64G64B64A64_SINT = exports.VK_FORMAT_R64G64B64A64_SFLOAT = exports.VK_FORMAT_R5G6B5_UNORM_PACK16 = exports.VK_FORMAT_R5G5B5A1_UNORM_PACK16 = exports.VK_FORMAT_R4G4_UNORM_PACK8 = exports.VK_FORMAT_R4G4B4A4_UNORM_PACK16 = exports.VK_FORMAT_R32_UINT = exports.VK_FORMAT_R32_SINT = exports.VK_FORMAT_R32_SFLOAT = exports.VK_FORMAT_R32G32_UINT = exports.VK_FORMAT_R32G32_SINT = exports.VK_FORMAT_R32G32_SFLOAT = void 0;
exports.read = Pi;
exports.write = Mi;
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e11) { throw _e11; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e12) { didErr = true; err = _e12; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
var t = 0,
  e = 1,
  n = 2,
  i = 3,
  s = 0,
  a = 0,
  r = 2,
  o = 0,
  l = 1,
  f = 160,
  U = 161,
  c = 162,
  h = 163,
  _ = 0,
  p = 1,
  g = 0,
  y = 1,
  x = 2,
  u = 3,
  b = 4,
  d = 5,
  m = 6,
  w = 7,
  D = 8,
  B = 9,
  L = 10,
  A = 11,
  k = 12,
  v = 13,
  S = 14,
  I = 15,
  O = 16,
  T = 17,
  V = 18,
  E = 0,
  F = 1,
  P = 2,
  C = 3,
  z = 4,
  M = 5,
  W = 6,
  N = 7,
  H = 8,
  K = 9,
  X = 10,
  j = 11,
  R = 0,
  Y = 1,
  q = 2,
  G = 13,
  J = 14,
  Q = 15,
  Z = 128,
  $ = 64,
  tt = 32,
  et = 16,
  nt = 0,
  it = 1,
  st = 2,
  at = 3,
  rt = 4,
  ot = 5,
  lt = 6,
  ft = 7,
  Ut = 8,
  ct = 9,
  ht = 10,
  _t = 13,
  pt = 14,
  gt = 15,
  yt = 16,
  xt = 17,
  ut = 20,
  bt = 21,
  dt = 22,
  mt = 23,
  wt = 24,
  Dt = 27,
  Bt = 28,
  Lt = 29,
  At = 30,
  kt = 31,
  vt = 34,
  St = 35,
  It = 36,
  Ot = 37,
  Tt = 38,
  Vt = 41,
  Et = 42,
  Ft = 43,
  Pt = 44,
  Ct = 45,
  zt = 48,
  Mt = 49,
  Wt = 50,
  Nt = 58,
  Ht = 59,
  Kt = 62,
  Xt = 63,
  jt = 64,
  Rt = 65,
  Yt = 68,
  qt = 69,
  Gt = 70,
  Jt = 71,
  Qt = 74,
  Zt = 75,
  $t = 76,
  te = 77,
  ee = 78,
  ne = 81,
  ie = 82,
  se = 83,
  ae = 84,
  re = 85,
  oe = 88,
  le = 89,
  fe = 90,
  Ue = 91,
  ce = 92,
  he = 95,
  _e = 96,
  pe = 97,
  ge = 98,
  ye = 99,
  xe = 100,
  ue = 101,
  be = 102,
  de = 103,
  me = 104,
  we = 105,
  De = 106,
  Be = 107,
  Le = 108,
  Ae = 109,
  ke = 110,
  ve = 111,
  Se = 112,
  Ie = 113,
  Oe = 114,
  Te = 115,
  Ve = 116,
  Ee = 117,
  Fe = 118,
  Pe = 119,
  Ce = 120,
  ze = 121,
  Me = 122,
  We = 123,
  Ne = 124,
  He = 125,
  Ke = 126,
  Xe = 127,
  je = 128,
  Re = 129,
  Ye = 130,
  qe = 131,
  Ge = 132,
  Je = 133,
  Qe = 134,
  Ze = 135,
  $e = 136,
  tn = 137,
  en = 138,
  nn = 139,
  sn = 140,
  an = 141,
  rn = 142,
  on = 143,
  ln = 144,
  fn = 145,
  Un = 146,
  cn = 147,
  hn = 148,
  _n = 149,
  pn = 150,
  gn = 151,
  yn = 152,
  xn = 153,
  un = 154,
  bn = 155,
  dn = 156,
  mn = 157,
  wn = 158,
  Dn = 159,
  Bn = 160,
  Ln = 161,
  An = 162,
  kn = 163,
  vn = 164,
  Sn = 165,
  In = 166,
  On = 167,
  Tn = 168,
  Vn = 169,
  En = 170,
  Fn = 171,
  Pn = 172,
  Cn = 173,
  zn = 174,
  Mn = 175,
  Wn = 176,
  Nn = 177,
  Hn = 178,
  Kn = 179,
  Xn = 180,
  jn = 181,
  Rn = 182,
  Yn = 183,
  qn = 184,
  Gn = 1000156007,
  Jn = 1000156008,
  Qn = 1000156009,
  Zn = 1000156010,
  $n = 1000156011,
  ti = 1000156017,
  ei = 1000156018,
  ni = 1000156019,
  ii = 1000156020,
  si = 1000156021,
  ai = 1000054e3,
  ri = 1000054001,
  oi = 1000054002,
  li = 1000054003,
  fi = 1000054004,
  Ui = 1000054005,
  ci = 1000054006,
  hi = 1000054007,
  _i = 1000066e3,
  pi = 1000066001,
  gi = 1000066002,
  yi = 1000066003,
  xi = 1000066004,
  ui = 1000066005,
  bi = 1000066006,
  di = 1000066007,
  mi = 1000066008,
  wi = 1000066009,
  Di = 1000066010,
  Bi = 1000066011,
  Li = 1000066012,
  Ai = 1000066013,
  ki = 100034e4,
  vi = 1000340001;
exports.VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT = vi;
exports.VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT = ki;
exports.VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT = Ai;
exports.VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT = Li;
exports.VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT = Bi;
exports.VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT = Di;
exports.VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT = wi;
exports.VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT = mi;
exports.VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT = di;
exports.VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT = bi;
exports.VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT = ui;
exports.VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT = xi;
exports.VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT = yi;
exports.VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT = gi;
exports.VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT = pi;
exports.VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT = _i;
exports.VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = hi;
exports.VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = ci;
exports.VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = Ui;
exports.VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = fi;
exports.VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = li;
exports.VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = oi;
exports.VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = ri;
exports.VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = ai;
exports.VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16 = si;
exports.VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16 = ii;
exports.VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16 = ni;
exports.VK_FORMAT_R12X4G12X4_UNORM_2PACK16 = ei;
exports.VK_FORMAT_R12X4_UNORM_PACK16 = ti;
exports.VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 = $n;
exports.VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16 = Zn;
exports.VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16 = Qn;
exports.VK_FORMAT_R10X6G10X6_UNORM_2PACK16 = Jn;
exports.VK_FORMAT_R10X6_UNORM_PACK16 = Gn;
exports.VK_FORMAT_ASTC_12x12_SRGB_BLOCK = qn;
exports.VK_FORMAT_ASTC_12x12_UNORM_BLOCK = Yn;
exports.VK_FORMAT_ASTC_12x10_SRGB_BLOCK = Rn;
exports.VK_FORMAT_ASTC_12x10_UNORM_BLOCK = jn;
exports.VK_FORMAT_ASTC_10x10_SRGB_BLOCK = Xn;
exports.VK_FORMAT_ASTC_10x10_UNORM_BLOCK = Kn;
exports.VK_FORMAT_ASTC_10x8_SRGB_BLOCK = Hn;
exports.VK_FORMAT_ASTC_10x8_UNORM_BLOCK = Nn;
exports.VK_FORMAT_ASTC_10x6_SRGB_BLOCK = Wn;
exports.VK_FORMAT_ASTC_10x6_UNORM_BLOCK = Mn;
exports.VK_FORMAT_ASTC_10x5_SRGB_BLOCK = zn;
exports.VK_FORMAT_ASTC_10x5_UNORM_BLOCK = Cn;
exports.VK_FORMAT_ASTC_8x8_SRGB_BLOCK = Pn;
exports.VK_FORMAT_ASTC_8x8_UNORM_BLOCK = Fn;
exports.VK_FORMAT_ASTC_8x6_SRGB_BLOCK = En;
exports.VK_FORMAT_ASTC_8x6_UNORM_BLOCK = Vn;
exports.VK_FORMAT_ASTC_8x5_SRGB_BLOCK = Tn;
exports.VK_FORMAT_ASTC_8x5_UNORM_BLOCK = On;
exports.VK_FORMAT_ASTC_6x6_SRGB_BLOCK = In;
exports.VK_FORMAT_ASTC_6x6_UNORM_BLOCK = Sn;
exports.VK_FORMAT_ASTC_6x5_SRGB_BLOCK = vn;
exports.VK_FORMAT_ASTC_6x5_UNORM_BLOCK = kn;
exports.VK_FORMAT_ASTC_5x5_SRGB_BLOCK = An;
exports.VK_FORMAT_ASTC_5x5_UNORM_BLOCK = Ln;
exports.VK_FORMAT_ASTC_5x4_SRGB_BLOCK = Bn;
exports.VK_FORMAT_ASTC_5x4_UNORM_BLOCK = Dn;
exports.VK_FORMAT_ASTC_4x4_SRGB_BLOCK = wn;
exports.VK_FORMAT_ASTC_4x4_UNORM_BLOCK = mn;
exports.VK_FORMAT_EAC_R11G11_SNORM_BLOCK = dn;
exports.VK_FORMAT_EAC_R11G11_UNORM_BLOCK = bn;
exports.VK_FORMAT_EAC_R11_SNORM_BLOCK = un;
exports.VK_FORMAT_EAC_R11_UNORM_BLOCK = xn;
exports.VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = yn;
exports.VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = gn;
exports.VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = pn;
exports.VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = _n;
exports.VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = hn;
exports.VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = cn;
exports.VK_FORMAT_BC7_SRGB_BLOCK = Un;
exports.VK_FORMAT_BC7_UNORM_BLOCK = fn;
exports.VK_FORMAT_BC6H_SFLOAT_BLOCK = ln;
exports.VK_FORMAT_BC6H_UFLOAT_BLOCK = on;
exports.VK_FORMAT_BC5_SNORM_BLOCK = rn;
exports.VK_FORMAT_BC5_UNORM_BLOCK = an;
exports.VK_FORMAT_BC4_SNORM_BLOCK = sn;
exports.VK_FORMAT_BC4_UNORM_BLOCK = nn;
exports.VK_FORMAT_BC3_SRGB_BLOCK = en;
exports.VK_FORMAT_BC3_UNORM_BLOCK = tn;
exports.VK_FORMAT_BC2_SRGB_BLOCK = $e;
exports.VK_FORMAT_BC2_UNORM_BLOCK = Ze;
exports.VK_FORMAT_BC1_RGBA_SRGB_BLOCK = Qe;
exports.VK_FORMAT_BC1_RGBA_UNORM_BLOCK = Je;
exports.VK_FORMAT_BC1_RGB_SRGB_BLOCK = Ge;
exports.VK_FORMAT_BC1_RGB_UNORM_BLOCK = qe;
exports.VK_FORMAT_D32_SFLOAT_S8_UINT = Ye;
exports.VK_FORMAT_D24_UNORM_S8_UINT = Re;
exports.VK_FORMAT_D16_UNORM_S8_UINT = je;
exports.VK_FORMAT_S8_UINT = Xe;
exports.VK_FORMAT_D32_SFLOAT = Ke;
exports.VK_FORMAT_X8_D24_UNORM_PACK32 = He;
exports.VK_FORMAT_D16_UNORM = Ne;
exports.VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = We;
exports.VK_FORMAT_B10G11R11_UFLOAT_PACK32 = Me;
exports.VK_FORMAT_R64G64B64A64_SFLOAT = ze;
exports.VK_FORMAT_R64G64B64A64_SINT = Ce;
exports.VK_FORMAT_R64G64B64A64_UINT = Pe;
exports.VK_FORMAT_R64G64B64_SFLOAT = Fe;
exports.VK_FORMAT_R64G64B64_SINT = Ee;
exports.VK_FORMAT_R64G64B64_UINT = Ve;
exports.VK_FORMAT_R64G64_SFLOAT = Te;
exports.VK_FORMAT_R64G64_SINT = Oe;
exports.VK_FORMAT_R64G64_UINT = Ie;
exports.VK_FORMAT_R64_SFLOAT = Se;
exports.VK_FORMAT_R64_SINT = ve;
exports.VK_FORMAT_R64_UINT = ke;
exports.VK_FORMAT_R32G32B32A32_SFLOAT = Ae;
exports.VK_FORMAT_R32G32B32A32_SINT = Le;
exports.VK_FORMAT_R32G32B32A32_UINT = Be;
exports.VK_FORMAT_R32G32B32_SFLOAT = De;
exports.VK_FORMAT_R32G32B32_SINT = we;
exports.VK_FORMAT_R32G32B32_UINT = me;
exports.VK_FORMAT_R32G32_SFLOAT = de;
exports.VK_FORMAT_R32G32_SINT = be;
exports.VK_FORMAT_R32G32_UINT = ue;
exports.VK_FORMAT_R32_SFLOAT = xe;
exports.VK_FORMAT_R32_SINT = ye;
exports.VK_FORMAT_R32_UINT = ge;
exports.VK_FORMAT_R16G16B16A16_SFLOAT = pe;
exports.VK_FORMAT_R16G16B16A16_SINT = _e;
exports.VK_FORMAT_R16G16B16A16_UINT = he;
exports.VK_FORMAT_R16G16B16A16_SNORM = ce;
exports.VK_FORMAT_R16G16B16A16_UNORM = Ue;
exports.VK_FORMAT_R16G16B16_SFLOAT = fe;
exports.VK_FORMAT_R16G16B16_SINT = le;
exports.VK_FORMAT_R16G16B16_UINT = oe;
exports.VK_FORMAT_R16G16B16_SNORM = re;
exports.VK_FORMAT_R16G16B16_UNORM = ae;
exports.VK_FORMAT_R16G16_SFLOAT = se;
exports.VK_FORMAT_R16G16_SINT = ie;
exports.VK_FORMAT_R16G16_UINT = ne;
exports.VK_FORMAT_R16G16_SNORM = ee;
exports.VK_FORMAT_R16G16_UNORM = te;
exports.VK_FORMAT_R16_SFLOAT = $t;
exports.VK_FORMAT_R16_SINT = Zt;
exports.VK_FORMAT_R16_UINT = Qt;
exports.VK_FORMAT_R16_SNORM = Jt;
exports.VK_FORMAT_R16_UNORM = Gt;
exports.VK_FORMAT_A2B10G10R10_SINT_PACK32 = qt;
exports.VK_FORMAT_A2B10G10R10_UINT_PACK32 = Yt;
exports.VK_FORMAT_A2B10G10R10_SNORM_PACK32 = Rt;
exports.VK_FORMAT_A2B10G10R10_UNORM_PACK32 = jt;
exports.VK_FORMAT_A2R10G10B10_SINT_PACK32 = Xt;
exports.VK_FORMAT_A2R10G10B10_UINT_PACK32 = Kt;
exports.VK_FORMAT_A2R10G10B10_SNORM_PACK32 = Ht;
exports.VK_FORMAT_A2R10G10B10_UNORM_PACK32 = Nt;
exports.VK_FORMAT_B8G8R8A8_SRGB = Wt;
exports.VK_FORMAT_B8G8R8A8_SINT = Mt;
exports.VK_FORMAT_B8G8R8A8_UINT = zt;
exports.VK_FORMAT_B8G8R8A8_SNORM = Ct;
exports.VK_FORMAT_B8G8R8A8_UNORM = Pt;
exports.VK_FORMAT_R8G8B8A8_SRGB = Ft;
exports.VK_FORMAT_R8G8B8A8_SINT = Et;
exports.VK_FORMAT_R8G8B8A8_UINT = Vt;
exports.VK_FORMAT_R8G8B8A8_SNORM = Tt;
exports.VK_FORMAT_R8G8B8A8_UNORM = Ot;
exports.VK_FORMAT_B8G8R8_SRGB = It;
exports.VK_FORMAT_B8G8R8_SINT = St;
exports.VK_FORMAT_B8G8R8_UINT = vt;
exports.VK_FORMAT_B8G8R8_SNORM = kt;
exports.VK_FORMAT_B8G8R8_UNORM = At;
exports.VK_FORMAT_R8G8B8_SRGB = Lt;
exports.VK_FORMAT_R8G8B8_SINT = Bt;
exports.VK_FORMAT_R8G8B8_UINT = Dt;
exports.VK_FORMAT_R8G8B8_SNORM = wt;
exports.VK_FORMAT_R8G8B8_UNORM = mt;
exports.VK_FORMAT_R8G8_SRGB = dt;
exports.VK_FORMAT_R8G8_SINT = bt;
exports.VK_FORMAT_R8G8_UINT = ut;
exports.VK_FORMAT_R8G8_SNORM = xt;
exports.VK_FORMAT_R8G8_UNORM = yt;
exports.VK_FORMAT_R8_SRGB = gt;
exports.VK_FORMAT_R8_SINT = pt;
exports.VK_FORMAT_R8_UINT = _t;
exports.VK_FORMAT_R8_SNORM = ht;
exports.VK_FORMAT_R8_UNORM = ct;
exports.VK_FORMAT_A1R5G5B5_UNORM_PACK16 = Ut;
exports.VK_FORMAT_B5G5R5A1_UNORM_PACK16 = ft;
exports.VK_FORMAT_R5G5B5A1_UNORM_PACK16 = lt;
exports.VK_FORMAT_B5G6R5_UNORM_PACK16 = ot;
exports.VK_FORMAT_R5G6B5_UNORM_PACK16 = rt;
exports.VK_FORMAT_B4G4R4A4_UNORM_PACK16 = at;
exports.VK_FORMAT_R4G4B4A4_UNORM_PACK16 = st;
exports.VK_FORMAT_R4G4_UNORM_PACK8 = it;
exports.VK_FORMAT_UNDEFINED = nt;
exports.KHR_DF_SAMPLE_DATATYPE_LINEAR = et;
exports.KHR_DF_SAMPLE_DATATYPE_EXPONENT = tt;
exports.KHR_DF_SAMPLE_DATATYPE_SIGNED = $;
exports.KHR_DF_SAMPLE_DATATYPE_FLOAT = Z;
exports.KHR_DF_CHANNEL_RGBSDA_ALPHA = Q;
exports.KHR_DF_CHANNEL_RGBSDA_DEPTH = J;
exports.KHR_DF_CHANNEL_RGBSDA_STENCIL = G;
exports.KHR_DF_CHANNEL_RGBSDA_BLUE = q;
exports.KHR_DF_CHANNEL_RGBSDA_GREEN = Y;
exports.KHR_DF_CHANNEL_RGBSDA_RED = R;
exports.KHR_DF_PRIMARIES_ADOBERGB = j;
exports.KHR_DF_PRIMARIES_DISPLAYP3 = X;
exports.KHR_DF_PRIMARIES_PAL525 = K;
exports.KHR_DF_PRIMARIES_NTSC1953 = H;
exports.KHR_DF_PRIMARIES_ACESCC = N;
exports.KHR_DF_PRIMARIES_ACES = W;
exports.KHR_DF_PRIMARIES_CIEXYZ = M;
exports.KHR_DF_PRIMARIES_BT2020 = z;
exports.KHR_DF_PRIMARIES_BT601_SMPTE = C;
exports.KHR_DF_PRIMARIES_BT601_EBU = P;
exports.KHR_DF_PRIMARIES_BT709 = F;
exports.KHR_DF_PRIMARIES_UNSPECIFIED = E;
exports.KHR_DF_TRANSFER_ADOBERGB = V;
exports.KHR_DF_TRANSFER_ACESCCT = T;
exports.KHR_DF_TRANSFER_ACESCC = O;
exports.KHR_DF_TRANSFER_ST240 = I;
exports.KHR_DF_TRANSFER_PAL625_EOTF = S;
exports.KHR_DF_TRANSFER_PAL_OETF = v;
exports.KHR_DF_TRANSFER_DCIP3 = k;
exports.KHR_DF_TRANSFER_PQ_OETF = A;
exports.KHR_DF_TRANSFER_PQ_EOTF = L;
exports.KHR_DF_TRANSFER_HLG_EOTF = B;
exports.KHR_DF_TRANSFER_HLG_OETF = D;
exports.KHR_DF_TRANSFER_BT1886 = w;
exports.KHR_DF_TRANSFER_SLOG2 = m;
exports.KHR_DF_TRANSFER_SLOG = d;
exports.KHR_DF_TRANSFER_NTSC = b;
exports.KHR_DF_TRANSFER_ITU = u;
exports.KHR_DF_TRANSFER_SRGB = x;
exports.KHR_DF_TRANSFER_LINEAR = y;
exports.KHR_DF_TRANSFER_UNSPECIFIED = g;
exports.KHR_DF_FLAG_ALPHA_PREMULTIPLIED = p;
exports.KHR_DF_FLAG_ALPHA_STRAIGHT = _;
exports.KHR_DF_MODEL_ETC1S = h;
exports.KHR_DF_MODEL_ASTC = c;
exports.KHR_DF_MODEL_ETC2 = U;
exports.KHR_DF_MODEL_ETC1 = f;
exports.KHR_DF_MODEL_RGBSDA = l;
exports.KHR_DF_MODEL_UNSPECIFIED = o;
exports.KHR_DF_VERSION = r;
exports.KHR_DF_VENDORID_KHRONOS = a;
exports.KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT = s;
exports.KHR_SUPERCOMPRESSION_ZLIB = i;
exports.KHR_SUPERCOMPRESSION_ZSTD = n;
exports.KHR_SUPERCOMPRESSION_BASISLZ = e;
exports.KHR_SUPERCOMPRESSION_NONE = t;
var Si = /*#__PURE__*/(0, _createClass2["default"])(function Si() {
  (0, _classCallCheck2["default"])(this, Si);
  this.vkFormat = 0, this.typeSize = 1, this.pixelWidth = 0, this.pixelHeight = 0, this.pixelDepth = 0, this.layerCount = 0, this.faceCount = 1, this.supercompressionScheme = 0, this.levels = [], this.dataFormatDescriptor = [{
    vendorId: 0,
    descriptorType: 0,
    descriptorBlockSize: 0,
    versionNumber: 2,
    colorModel: 0,
    colorPrimaries: 1,
    transferFunction: 2,
    flags: 0,
    texelBlockDimension: [0, 0, 0, 0],
    bytesPlane: [0, 0, 0, 0, 0, 0, 0, 0],
    samples: []
  }], this.keyValue = {}, this.globalData = null;
});
exports.KTX2Container = Si;
var Ii = /*#__PURE__*/function () {
  function Ii(t, e, n, i) {
    (0, _classCallCheck2["default"])(this, Ii);
    this._dataView = new DataView(t.buffer, t.byteOffset + e, n), this._littleEndian = i, this._offset = 0;
  }
  (0, _createClass2["default"])(Ii, [{
    key: "_nextUint8",
    value: function _nextUint8() {
      var t = this._dataView.getUint8(this._offset);
      return this._offset += 1, t;
    }
  }, {
    key: "_nextUint16",
    value: function _nextUint16() {
      var t = this._dataView.getUint16(this._offset, this._littleEndian);
      return this._offset += 2, t;
    }
  }, {
    key: "_nextUint32",
    value: function _nextUint32() {
      var t = this._dataView.getUint32(this._offset, this._littleEndian);
      return this._offset += 4, t;
    }
  }, {
    key: "_nextUint64",
    value: function _nextUint64() {
      var t = this._dataView.getUint32(this._offset, this._littleEndian) + Math.pow(2, 32) * this._dataView.getUint32(this._offset + 4, this._littleEndian);
      return this._offset += 8, t;
    }
  }, {
    key: "_nextInt32",
    value: function _nextInt32() {
      var t = this._dataView.getInt32(this._offset, this._littleEndian);
      return this._offset += 4, t;
    }
  }, {
    key: "_skip",
    value: function _skip(t) {
      return this._offset += t, this;
    }
  }, {
    key: "_scan",
    value: function _scan(t) {
      var e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
      var n = this._offset;
      var i = 0;
      for (; this._dataView.getUint8(this._offset) !== e && i < t;) i++, this._offset++;
      return i < t && this._offset++, new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + n, i);
    }
  }]);
  return Ii;
}();
var Oi = new Uint8Array([0]),
  Ti = [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10];
function Vi(t) {
  return "undefined" != typeof TextEncoder ? new TextEncoder().encode(t) : Buffer.from(t);
}
function Ei(t) {
  return "undefined" != typeof TextDecoder ? new TextDecoder().decode(t) : Buffer.from(t).toString("utf8");
}
function Fi(t) {
  var e = 0;
  var _iterator = _createForOfIteratorHelper(t),
    _step;
  try {
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      var _n2 = _step.value;
      e += _n2.byteLength;
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }
  var n = new Uint8Array(e);
  var i = 0;
  var _iterator2 = _createForOfIteratorHelper(t),
    _step2;
  try {
    for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
      var _e2 = _step2.value;
      n.set(new Uint8Array(_e2), i), i += _e2.byteLength;
    }
  } catch (err) {
    _iterator2.e(err);
  } finally {
    _iterator2.f();
  }
  return n;
}
function Pi(t) {
  var e = new Uint8Array(t.buffer, t.byteOffset, Ti.length);
  if (e[0] !== Ti[0] || e[1] !== Ti[1] || e[2] !== Ti[2] || e[3] !== Ti[3] || e[4] !== Ti[4] || e[5] !== Ti[5] || e[6] !== Ti[6] || e[7] !== Ti[7] || e[8] !== Ti[8] || e[9] !== Ti[9] || e[10] !== Ti[10] || e[11] !== Ti[11]) throw new Error("Missing KTX 2.0 identifier.");
  var n = new Si(),
    i = 17 * Uint32Array.BYTES_PER_ELEMENT,
    s = new Ii(t, Ti.length, i, !0);
  n.vkFormat = s._nextUint32(), n.typeSize = s._nextUint32(), n.pixelWidth = s._nextUint32(), n.pixelHeight = s._nextUint32(), n.pixelDepth = s._nextUint32(), n.layerCount = s._nextUint32(), n.faceCount = s._nextUint32();
  var a = s._nextUint32();
  n.supercompressionScheme = s._nextUint32();
  var r = s._nextUint32(),
    o = s._nextUint32(),
    l = s._nextUint32(),
    f = s._nextUint32(),
    U = s._nextUint64(),
    c = s._nextUint64(),
    h = new Ii(t, Ti.length + i, 3 * a * 8, !0);
  for (var _e3 = 0; _e3 < a; _e3++) n.levels.push({
    levelData: new Uint8Array(t.buffer, t.byteOffset + h._nextUint64(), h._nextUint64()),
    uncompressedByteLength: h._nextUint64()
  });
  var _ = new Ii(t, r, o, !0),
    p = {
      vendorId: _._skip(4)._nextUint16(),
      descriptorType: _._nextUint16(),
      versionNumber: _._nextUint16(),
      descriptorBlockSize: _._nextUint16(),
      colorModel: _._nextUint8(),
      colorPrimaries: _._nextUint8(),
      transferFunction: _._nextUint8(),
      flags: _._nextUint8(),
      texelBlockDimension: [_._nextUint8(), _._nextUint8(), _._nextUint8(), _._nextUint8()],
      bytesPlane: [_._nextUint8(), _._nextUint8(), _._nextUint8(), _._nextUint8(), _._nextUint8(), _._nextUint8(), _._nextUint8(), _._nextUint8()],
      samples: []
    },
    g = (p.descriptorBlockSize / 4 - 6) / 4;
  for (var _t2 = 0; _t2 < g; _t2++) {
    var _e4 = {
      bitOffset: _._nextUint16(),
      bitLength: _._nextUint8(),
      channelType: _._nextUint8(),
      samplePosition: [_._nextUint8(), _._nextUint8(), _._nextUint8(), _._nextUint8()],
      sampleLower: -Infinity,
      sampleUpper: Infinity
    };
    64 & _e4.channelType ? (_e4.sampleLower = _._nextInt32(), _e4.sampleUpper = _._nextInt32()) : (_e4.sampleLower = _._nextUint32(), _e4.sampleUpper = _._nextUint32()), p.samples[_t2] = _e4;
  }
  n.dataFormatDescriptor.length = 0, n.dataFormatDescriptor.push(p);
  var y = new Ii(t, l, f, !0);
  for (; y._offset < f;) {
    var _t3 = y._nextUint32(),
      _e5 = y._scan(_t3),
      _i2 = Ei(_e5),
      _s = y._scan(_t3 - _e5.byteLength);
    n.keyValue[_i2] = _i2.match(/^ktx/i) ? Ei(_s) : _s, y._offset % 4 && y._skip(4 - y._offset % 4);
  }
  if (c <= 0) return n;
  var x = new Ii(t, U, c, !0),
    u = x._nextUint16(),
    b = x._nextUint16(),
    d = x._nextUint32(),
    m = x._nextUint32(),
    w = x._nextUint32(),
    D = x._nextUint32(),
    B = [];
  for (var _t4 = 0; _t4 < a; _t4++) B.push({
    imageFlags: x._nextUint32(),
    rgbSliceByteOffset: x._nextUint32(),
    rgbSliceByteLength: x._nextUint32(),
    alphaSliceByteOffset: x._nextUint32(),
    alphaSliceByteLength: x._nextUint32()
  });
  var L = U + x._offset,
    A = L + d,
    k = A + m,
    S = new Uint8Array(t.buffer, t.byteOffset + L, d),
    I = new Uint8Array(t.buffer, t.byteOffset + A, m),
    O = new Uint8Array(t.buffer, t.byteOffset + k, w),
    T = new Uint8Array(t.buffer, t.byteOffset + (k + w), D);
  return n.globalData = {
    endpointCount: u,
    selectorCount: b,
    imageDescs: B,
    endpointsData: S,
    selectorsData: I,
    tablesData: O,
    extendedData: T
  }, n;
}
function Ci() {
  return (Ci = Object.assign || function (t) {
    for (var e = 1; e < arguments.length; e++) {
      var n = arguments[e];
      for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
    }
    return t;
  }).apply(this, arguments);
}
var zi = {
  keepWriter: !1
};
function Mi(t) {
  var e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  e = Ci({}, zi, e);
  var n = new ArrayBuffer(0);
  if (t.globalData) {
    var _e6 = new ArrayBuffer(20 + 5 * t.globalData.imageDescs.length * 4),
      _i3 = new DataView(_e6);
    _i3.setUint16(0, t.globalData.endpointCount, !0), _i3.setUint16(2, t.globalData.selectorCount, !0), _i3.setUint32(4, t.globalData.endpointsData.byteLength, !0), _i3.setUint32(8, t.globalData.selectorsData.byteLength, !0), _i3.setUint32(12, t.globalData.tablesData.byteLength, !0), _i3.setUint32(16, t.globalData.extendedData.byteLength, !0);
    for (var _e7 = 0; _e7 < t.globalData.imageDescs.length; _e7++) {
      var _n3 = t.globalData.imageDescs[_e7];
      _i3.setUint32(20 + 5 * _e7 * 4 + 0, _n3.imageFlags, !0), _i3.setUint32(20 + 5 * _e7 * 4 + 4, _n3.rgbSliceByteOffset, !0), _i3.setUint32(20 + 5 * _e7 * 4 + 8, _n3.rgbSliceByteLength, !0), _i3.setUint32(20 + 5 * _e7 * 4 + 12, _n3.alphaSliceByteOffset, !0), _i3.setUint32(20 + 5 * _e7 * 4 + 16, _n3.alphaSliceByteLength, !0);
    }
    n = Fi([_e6, t.globalData.endpointsData, t.globalData.selectorsData, t.globalData.tablesData, t.globalData.extendedData]);
  }
  var i = [];
  var s = t.keyValue;
  e.keepWriter || (s = Ci({}, t.keyValue, {
    KTXwriter: "KTX-Parse v0.3.1"
  }));
  for (var _t5 in s) {
    var _e8 = s[_t5],
      _n4 = Vi(_t5),
      _a = "string" == typeof _e8 ? Vi(_e8) : _e8,
      _r = _n4.byteLength + 1 + _a.byteLength + 1,
      _o = _r % 4 ? 4 - _r % 4 : 0;
    i.push(Fi([new Uint32Array([_r]), _n4, Oi, _a, Oi, new Uint8Array(_o).fill(0)]));
  }
  var a = Fi(i);
  if (1 !== t.dataFormatDescriptor.length || 0 !== t.dataFormatDescriptor[0].descriptorType) throw new Error("Only BASICFORMAT Data Format Descriptor output supported.");
  var r = t.dataFormatDescriptor[0],
    o = new ArrayBuffer(28 + 16 * r.samples.length),
    l = new DataView(o),
    f = 24 + 16 * r.samples.length;
  if (l.setUint32(0, o.byteLength, !0), l.setUint16(4, r.vendorId, !0), l.setUint16(6, r.descriptorType, !0), l.setUint16(8, r.versionNumber, !0), l.setUint16(10, f, !0), l.setUint8(12, r.colorModel), l.setUint8(13, r.colorPrimaries), l.setUint8(14, r.transferFunction), l.setUint8(15, r.flags), !Array.isArray(r.texelBlockDimension)) throw new Error("texelBlockDimension is now an array. For dimensionality `d`, set `d - 1`.");
  l.setUint8(16, r.texelBlockDimension[0]), l.setUint8(17, r.texelBlockDimension[1]), l.setUint8(18, r.texelBlockDimension[2]), l.setUint8(19, r.texelBlockDimension[3]);
  for (var _t6 = 0; _t6 < 8; _t6++) l.setUint8(20 + _t6, r.bytesPlane[_t6]);
  for (var _t7 = 0; _t7 < r.samples.length; _t7++) {
    var _e9 = r.samples[_t7],
      _n5 = 28 + 16 * _t7;
    if (_e9.channelID) throw new Error("channelID has been renamed to channelType.");
    l.setUint16(_n5 + 0, _e9.bitOffset, !0), l.setUint8(_n5 + 2, _e9.bitLength), l.setUint8(_n5 + 3, _e9.channelType), l.setUint8(_n5 + 4, _e9.samplePosition[0]), l.setUint8(_n5 + 5, _e9.samplePosition[1]), l.setUint8(_n5 + 6, _e9.samplePosition[2]), l.setUint8(_n5 + 7, _e9.samplePosition[3]), 64 & _e9.channelType ? (l.setInt32(_n5 + 8, _e9.sampleLower, !0), l.setInt32(_n5 + 12, _e9.sampleUpper, !0)) : (l.setUint32(_n5 + 8, _e9.sampleLower, !0), l.setUint32(_n5 + 12, _e9.sampleUpper, !0));
  }
  var U = Ti.length + 68 + 3 * t.levels.length * 8,
    c = U + o.byteLength;
  var h = n.byteLength > 0 ? c + a.byteLength : 0;
  h % 8 && (h += 8 - h % 8);
  var _ = [],
    p = new DataView(new ArrayBuffer(3 * t.levels.length * 8));
  var g = (h || c + a.byteLength) + n.byteLength;
  for (var _e10 = 0; _e10 < t.levels.length; _e10++) {
    var _n6 = t.levels[_e10];
    _.push(_n6.levelData), p.setBigUint64(24 * _e10 + 0, BigInt(g), !0), p.setBigUint64(24 * _e10 + 8, BigInt(_n6.levelData.byteLength), !0), p.setBigUint64(24 * _e10 + 16, BigInt(_n6.uncompressedByteLength), !0), g += _n6.levelData.byteLength;
  }
  var y = new ArrayBuffer(68),
    x = new DataView(y);
  return x.setUint32(0, t.vkFormat, !0), x.setUint32(4, t.typeSize, !0), x.setUint32(8, t.pixelWidth, !0), x.setUint32(12, t.pixelHeight, !0), x.setUint32(16, t.pixelDepth, !0), x.setUint32(20, t.layerCount, !0), x.setUint32(24, t.faceCount, !0), x.setUint32(28, t.levels.length, !0), x.setUint32(32, t.supercompressionScheme, !0), x.setUint32(36, U, !0), x.setUint32(40, o.byteLength, !0), x.setUint32(44, c, !0), x.setUint32(48, a.byteLength, !0), x.setBigUint64(52, BigInt(n.byteLength > 0 ? h : 0), !0), x.setBigUint64(60, BigInt(n.byteLength), !0), new Uint8Array(Fi([new Uint8Array(Ti).buffer, y, p.buffer, o, a, h > 0 ? new ArrayBuffer(h - (c + a.byteLength)) : new ArrayBuffer(0), n].concat(_)));
}