shadow$provide.module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$sources$CubeTextureSource = function(global, require, module, exports) {
  var warn = require("module$node_modules$pixi_DOT_js$lib$utils$logging$warn");
  global = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$sources$TextureSource");
  "use strict";
  class CubeTextureSource extends global.TextureSource {
    constructor(options) {
      const {faces, ...rest} = options;
      CubeTextureSource._validateFaces(faces);
      options = faces.right;
      const derivedResolution = options.resolution, derivedFormat = options.format, derivedAlphaMode = options.alphaMode, ignoredKeys = ["resolution", "format", "alphaMode", "dimensions", "viewDimension"].filter(key => void 0 !== rest[key]);
      ignoredKeys.length && warn.warn(`[CubeTextureSource] Ignoring option(s) [${ignoredKeys.join(", ")}]; these are derived from face sources.`);
      super({...rest, resource:faces, width:options.width, height:options.height, dimensions:"2d", viewDimension:"cube", arrayLayerCount:6, resolution:derivedResolution, format:derivedFormat, alphaMode:derivedAlphaMode});
      this.uploadMethodId = "cube";
      this.faces = faces;
      for (const key of Object.keys(faces)) {
        options = faces[key], options.on("update", this._onFaceUpdate, this), options.on("resize", this._onFaceResize, this), options.on("unload", this._onFaceUpdate, this);
      }
    }
    destroy() {
      const faces = this.faces;
      if (faces) {
        for (const key of Object.keys(faces)) {
          const face = faces[key];
          face.off("update", this._onFaceUpdate, this);
          face.off("resize", this._onFaceResize, this);
          face.off("unload", this._onFaceUpdate, this);
        }
      }
      super.destroy();
    }
    _onFaceUpdate() {
      this.emit("update", this);
    }
    _onFaceResize(face) {
      CubeTextureSource._validateFaces(this.faces);
      this.resize(face.width, face.height, face.resolution);
    }
    static _validateFaces(faces) {
      if (!(faces.right && faces.left && faces.top && faces.bottom && faces.front && faces.back)) {
        throw Error("[CubeTextureSource] Requires { left, right, top, bottom, front, back } faces.");
      }
      var first = faces.right;
      const expectedPixelWidth = first.pixelWidth, expectedPixelHeight = first.pixelHeight, expectedFormat = first.format, expectedAlphaMode = first.alphaMode;
      first = first.resolution;
      for (const key of Object.keys(faces)) {
        const face = faces[key];
        if (face.pixelWidth !== expectedPixelWidth || face.pixelHeight !== expectedPixelHeight) {
          throw Error(`[CubeTextureSource] Face '${String(key)}' has a different size. All faces must match.`);
        }
        if (face.format !== expectedFormat) {
          throw Error(`[CubeTextureSource] Face '${String(key)}' has a different format. All faces must match.`);
        }
        if (face.alphaMode !== expectedAlphaMode) {
          throw Error(`[CubeTextureSource] Face '${String(key)}' has a different alphaMode. All faces must match.`);
        }
        if (face.resolution !== first) {
          throw Error(`[CubeTextureSource] Face '${String(key)}' has a different resolution. All faces must match.`);
        }
      }
    }
  }
  exports.CubeTextureSource = CubeTextureSource;
};

//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$sources$CubeTextureSource.js.map
