/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as e}from"tslib";import{ClonableMixin as t}from"../../core/Clonable.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import o from"../../core/Logger.js";import{property as s,cast as i,subclass as a}from"../../core/accessorSupport/decorators.js";import{ensureClass as l}from"../../core/accessorSupport/ensureType.js";import p from"./MeshMaterial.js";import m from"./MeshMaterialMetallicRoughness.js";import{castArray as n,writeTypedArray as c}from"./meshProperties.js";var u;let g=u=class extends(t(r)){static from(e){return l(u,e)}constructor(e){super(e),this.material=null,this.name=void 0,this.shading="source",this.trustSourceNormals=!1}get faces(){return this._get("faces")??null}set faces(e){const t={loggerTag:".faces=",stride:3};this._set("faces",n(e,Uint32Array,[Uint16Array],t,o.getLogger(this)))}castMaterial(e){return l(e&&"object"==typeof e&&("metallic"in e||"roughness"in e||"metallicRoughnessTexture"in e)?m:p,e)}get memoryUsage(){let e=0;return null!=this.faces&&(e+=this.faces.byteLength),null!=this.material&&(e+=this.material.memoryUsage),e}};e([s({json:{write:c}})],g.prototype,"faces",null),e([s({type:p,json:{write:!0}})],g.prototype,"material",void 0),e([i("material")],g.prototype,"castMaterial",null),e([s({json:{write:!0}})],g.prototype,"name",void 0),e([s({type:String,json:{write:!0}})],g.prototype,"shading",void 0),e([s({type:Boolean})],g.prototype,"trustSourceNormals",void 0),g=u=e([a("esri.geometry.support.MeshComponent")],g);export{g as default};
