2 lines
45 KiB
JavaScript
2 lines
45 KiB
JavaScript
import{A as u,B as h,fr as Wt,a9 as kt,a8 as zt,C as k,a6 as he,dD as qe,lf as Ht,a7 as Le,bS as Vt,ey as pt,z as y,ea as z,bb as D,s as P,ik as Bt,iE as L,aW as Gt,gM as Xt,fm as Ne,lg as Fe,ab as Ue,f8 as Zt,bT as b,cQ as ue,cT as Se,eY as ht,_ as xe,aC as We,aH as I,d4 as Yt,lh as Jt,kp as qt,g$ as Kt,h0 as Qt,hV as en,V as tn,T as nn,j5 as ft,j7 as ve,cv as ke,cu as rn,iC as on,iD as sn,jb as mt,cS as gt,fq as an,i8 as ln,eo as cn,D as un,aI as pn,li as hn,lj as fn,E as mn,f as gn,K as dn,bU as yn,i6 as wn,gF as Ke}from"./index-b5c8f851.js";import{I as dt,o as Re,r as Me,D as xn,U as vn,L as yt,h as ze,j as He,R as Ve,O as Be,_ as Ge,v as Xe,B as $n,a as Ze,N as ne,b as bn,l as _e,w as An,p as Ee,g as Tn}from"./georeference-f533c6ae.js";import{m as wt}from"./MeshGeoreferencedRelativeVertexSpace-7e8894cd.js";import{a as Sn,e as Rn,t as xt,m as $e}from"./MeshLocalVertexSpace-702f1ae9.js";import{i as Mn}from"./earcut-d423749e.js";import{t as vt}from"./Indices-8bd7636c.js";import{e as Qe}from"./deduplicate-d84e5ef3.js";import{b as Fn,o as jn,X as Dn}from"./plane-66dd48d1.js";import"./triangle-f93283ef.js";import{e as $t}from"./mat4f64-1413b4a7.js";import"./basicInterfaces-11f56cb3.js";import"./VertexAttribute-0e674613.js";import{u as et,y as Ln,h as _n,o as En,i as Cn}from"./External-7e16e2e2.js";import{c as Ye}from"./spatialReferenceEllipsoidUtils-bc18a3f3.js";var Y;const je=new WeakMap;let On=0,E=Y=class extends he{constructor(e){super(e),this.wrap="repeat"}get url(){return this._get("url")||null}set url(e){this._set("url",e),e&&this._set("data",null)}get data(){return this._get("data")||null}set data(e){this._set("data",e),e&&this._set("url",null)}writeData(e,t,n,r){if(e instanceof HTMLImageElement){const o={type:"image-element",src:qe(e.src,r),crossOrigin:e.crossOrigin};t[n]=o}else if(e instanceof HTMLCanvasElement){const o=e.getContext("2d").getImageData(0,0,e.width,e.height),s={type:"canvas-element",imageData:this._encodeImageData(o)};t[n]=s}else if(e instanceof HTMLVideoElement){const o={type:"video-element",src:qe(e.src,r),autoplay:e.autoplay,loop:e.loop,muted:e.muted,crossOrigin:e.crossOrigin,preload:e.preload};t[n]=o}else if(e instanceof ImageData){const o={type:"image-data",imageData:this._encodeImageData(e)};t[n]=o}}readData(e){switch(e.type){case"image-element":{const t=new Image;return t.src=e.src,t.crossOrigin=e.crossOrigin,t}case"canvas-element":{const t=this._decodeImageData(e.imageData),n=document.createElement("canvas");return n.width=t.width,n.height=t.height,n.getContext("2d").putImageData(t,0,0),n}case"image-data":return this._decodeImageData(e.imageData);case"video-element":{const t=document.createElement("video");return t.src=e.src,t.crossOrigin=e.crossOrigin,t.autoplay=e.autoplay,t.loop=e.loop,t.muted=e.muted,t.preload=e.preload,t}default:return}}get transparent(){const e=this.data,t=this.url;if(e instanceof HTMLCanvasElement)return this._imageDataContainsTransparent(e.getContext("2d").getImageData(0,0,e.width,e.height));if(e instanceof ImageData)return this._imageDataContainsTransparent(e);if(t){const n=t.substr(t.length-4,4).toLowerCase(),r=t.substr(0,15).toLocaleLowerCase();if(n===".png"||r==="data:image/png;")return!0}return!1}set transparent(e){this._overrideIfSome("transparent",e)}get contentHash(){const e=typeof this.wrap=="string"?this.wrap:typeof this.wrap=="object"?`${this.wrap.horizontal}/${this.wrap.vertical}`:"",t=(n="")=>`d:${n},t:${this.transparent},w:${e}`;return this.url!=null?t(this.url):this.data!=null?this.data instanceof HTMLImageElement||this.data instanceof HTMLVideoElement?t(this.data.src):(je.has(this.data)||je.set(this.data,++On),t(je.get(this.data))):t()}get memoryUsage(){let e=0;if(e+=this.url!=null?this.url.length:0,this.data!=null){const t=this.data;"data"in t?e+=t.data.byteLength:t instanceof HTMLImageElement?e+=t.naturalWidth*t.naturalHeight*3:t instanceof HTMLCanvasElement&&(e+=t.width*t.height*3)}return e}clone(){const e={url:this.url,data:this.data,wrap:this._cloneWrap()};return new Y(e)}cloneWithDeduplication(e){const t=e.get(this);if(t)return t;const n=this.clone();return e.set(this,n),n}_cloneWrap(){return typeof this.wrap=="string"?this.wrap:{horizontal:this.wrap.horizontal,vertical:this.wrap.vertical}}_encodeImageData(e){let t="";for(let n=0;n<e.data.length;n++)t+=String.fromCharCode(e.data[n]);return{data:btoa(t),width:e.width,height:e.height}}_decodeImageData(e){const t=atob(e.data),n=new Uint8ClampedArray(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return Ht(n,e.width,e.height)}_imageDataContainsTransparent(e){for(let t=3;t<e.data.length;t+=4)if(e.data[t]!==255)return!0;return!1}static from(e){return typeof e=="string"?new Y({url:e}):e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof ImageData||e instanceof HTMLVideoElement?new Y({data:e}):Le(Y,e)}};u([h({type:String,json:{write:Wt}})],E.prototype,"url",null),u([h({json:{write:{overridePolicy(){return{enabled:!this.url}}}}}),h()],E.prototype,"data",null),u([kt("data")],E.prototype,"writeData",null),u([zt("data")],E.prototype,"readData",null),u([h({type:Boolean,json:{write:{overridePolicy(){return{enabled:this._isOverridden("transparent")}}}}})],E.prototype,"transparent",null),u([h({json:{write:!0}})],E.prototype,"wrap",void 0),u([h({readOnly:!0})],E.prototype,"contentHash",null),E=Y=u([k("esri.geometry.support.MeshTexture")],E);const le=E;let J=class extends Vt(he){constructor(t){super(t),this.offset=[0,0],this.rotation=0,this.scale=[1,1]}};u([h({type:[Number],nonNullable:!0,json:{write:!0}})],J.prototype,"offset",void 0),u([h({type:Number,nonNullable:!0,json:{write:!0}})],J.prototype,"rotation",void 0),u([h({type:[Number],nonNullable:!0,json:{write:!0}})],J.prototype,"scale",void 0),J=u([k("esri.geometry.support.MeshTextureTransform")],J);const ce=J;var Ce;let j=Ce=class extends he{constructor(e){super(e),this.color=null,this.colorTexture=null,this.colorTextureTransform=null,this.normalTexture=void 0,this.normalTextureTransform=void 0,this.alphaMode="auto",this.alphaCutoff=.5,this.doubleSided=!0}clone(){return this.cloneWithDeduplication(null,new Map)}cloneWithDeduplication(e,t){const n=e!=null?e.get(this):null;if(n)return n;const r=new Ce(this.clonePropertiesWithDeduplication(t));return e!=null&&e.set(this,r),r}clonePropertiesWithDeduplication(e){var t,n,r,o;return{color:this.color!=null?this.color.clone():null,colorTexture:(t=this.colorTexture)==null?void 0:t.cloneWithDeduplication(e),normalTexture:(n=this.normalTexture)==null?void 0:n.cloneWithDeduplication(e),alphaMode:this.alphaMode,alphaCutoff:this.alphaCutoff,doubleSided:this.doubleSided,colorTextureTransform:(r=this.colorTextureTransform)==null?void 0:r.clone(),normalTextureTransform:(o=this.normalTextureTransform)==null?void 0:o.clone()}}get memoryUsage(){return this.getMemoryUsage()}getMemoryUsage(){let e=0;return e+=this.color!=null?16:0,this.colorTexture!=null&&(e+=this.colorTexture.memoryUsage),e+=this.colorTextureTransform!=null?20:0,this.normalTexture!=null&&(e+=this.normalTexture.memoryUsage),e+=this.normalTextureTransform!=null?20:0,e}};u([h({type:pt,json:{write:!0}})],j.prototype,"color",void 0),u([h({type:le,json:{write:!0}})],j.prototype,"colorTexture",void 0),u([h({type:ce,json:{write:!0}})],j.prototype,"colorTextureTransform",void 0),u([h({type:le,json:{write:!0}})],j.prototype,"normalTexture",void 0),u([h({type:ce,json:{write:!0}})],j.prototype,"normalTextureTransform",void 0),u([h({nonNullable:!0,json:{write:!0}})],j.prototype,"alphaMode",void 0),u([h({nonNullable:!0,json:{write:!0}})],j.prototype,"alphaCutoff",void 0),u([h({nonNullable:!0,json:{write:!0}})],j.prototype,"doubleSided",void 0),j=Ce=u([k("esri.geometry.support.MeshMaterial")],j);const Je=j;var Oe;let F=Oe=class extends Je{constructor(e){super(e),this.emissiveColor=null,this.emissiveTexture=null,this.emissiveTextureTransform=void 0,this.occlusionTexture=null,this.occlusionTextureTransform=void 0,this.metallic=1,this.roughness=1,this.metallicRoughnessTexture=null,this.metallicRoughnessTextureTransform=void 0}clone(){return this.cloneWithDeduplication(null,new Map)}cloneWithDeduplication(e,t){const n=e!=null?e.get(this):null;if(n)return n;const r=new Oe(this.clonePropertiesWithDeduplication(t));return e!=null&&e.set(this,r),r}getMemoryUsage(){let e=super.getMemoryUsage();return e+=this.emissiveColor!=null?16:0,this.emissiveTexture!=null&&(e+=this.emissiveTexture.memoryUsage),e+=this.emissiveTextureTransform!=null?20:0,this.occlusionTexture!=null&&(e+=this.occlusionTexture.memoryUsage),e+=this.occlusionTextureTransform!=null?20:0,this.metallicRoughnessTexture!=null&&(e+=this.metallicRoughnessTexture.memoryUsage),e+=this.metallicRoughnessTextureTransform!=null?20:0,e}clonePropertiesWithDeduplication(e){var t,n,r,o,s,i,l;return{...super.clonePropertiesWithDeduplication(e),emissiveColor:(t=this.emissiveColor)==null?void 0:t.clone(),emissiveTexture:(n=this.emissiveTexture)==null?void 0:n.cloneWithDeduplication(e),emissiveTextureTransform:(r=this.emissiveTextureTransform)==null?void 0:r.clone(),occlusionTexture:(o=this.occlusionTexture)==null?void 0:o.cloneWithDeduplication(e),occlusionTextureTransform:(s=this.occlusionTextureTransform)==null?void 0:s.clone(),metallic:this.metallic,roughness:this.roughness,metallicRoughnessTexture:(i=this.metallicRoughnessTexture)==null?void 0:i.cloneWithDeduplication(e),metallicRoughnessTextureTransform:(l=this.metallicRoughnessTextureTransform)==null?void 0:l.clone()}}};u([h({type:pt,json:{write:!0}})],F.prototype,"emissiveColor",void 0),u([h({type:le,json:{write:!0}})],F.prototype,"emissiveTexture",void 0),u([h({type:ce,json:{write:!0}})],F.prototype,"emissiveTextureTransform",void 0),u([h({type:le,json:{write:!0}})],F.prototype,"occlusionTexture",void 0),u([h({type:ce,json:{write:!0}})],F.prototype,"occlusionTextureTransform",void 0),u([h({type:Number,nonNullable:!0,json:{write:!0},range:{min:0,max:1}})],F.prototype,"metallic",void 0),u([h({type:Number,nonNullable:!0,json:{write:!0},range:{min:0,max:1}})],F.prototype,"roughness",void 0),u([h({type:le,json:{write:!0}})],F.prototype,"metallicRoughnessTexture",void 0),u([h({type:ce,json:{write:!0}})],F.prototype,"metallicRoughnessTextureTransform",void 0),F=Oe=u([k("esri.geometry.support.MeshMaterialMetallicRoughness")],F);const Pn=F;var ye;const bt="esri.geometry.support.MeshVertexAttributes",V=y.getLogger(bt);let T=ye=class extends he{constructor(e){super(e),this.color=null,this.position=new Float64Array(0),this.uv=null,this.normal=null,this.tangent=null}castColor(e){return q(e,Uint8Array,[Uint8ClampedArray],{loggerTag:".color=",stride:4},V)}castPosition(e){return e&&e instanceof Float32Array&&V.warn(".position=","Setting position attribute from a Float32Array may cause precision problems. Consider storing data in a Float64Array or a regular number array"),q(e,Float64Array,[Float32Array],{loggerTag:".position=",stride:3},V)}castUv(e){return q(e,Float32Array,[Float64Array],{loggerTag:".uv=",stride:2},V)}castNormal(e){return q(e,Float32Array,[Float64Array],{loggerTag:".normal=",stride:3},V)}castTangent(e){return q(e,Float32Array,[Float64Array],{loggerTag:".tangent=",stride:4},V)}clone(){const e={position:D(this.position),uv:D(this.uv),normal:D(this.normal),tangent:D(this.tangent),color:D(this.color)};return new ye(e)}clonePositional(){const e={position:D(this.position),normal:D(this.normal),tangent:D(this.tangent),uv:this.uv,color:this.color};return new ye(e)}get memoryUsage(){let e=0;return e+=this.position.byteLength,this.uv!=null&&(e+=this.uv.byteLength),this.normal!=null&&(e+=this.normal.byteLength),this.tangent!=null&&(e+=this.tangent.byteLength),this.color!=null&&(e+=this.color.byteLength),e}};function De(e,t,n,r){const{loggerTag:o,stride:s}=t;return e.length%s!=0?(r.error(o,`Invalid array length, expected a multiple of ${s}`),new n([])):e}function q(e,t,n,r,o){if(!e)return e;if(e instanceof t)return De(e,r,t,o);for(const s of n)if(e instanceof s)return De(new t(e),r,t,o);if(Array.isArray(e))return De(new t(e),r,t,o);{const s=n.map(i=>`'${i.name}'`);return o.error(`Failed to set property, expected one of ${s}, but got ${e.constructor.name}`),new t([])}}function oe(e,t,n){t[n]=In(e)}function In(e){const t=new Array(e.length);for(let n=0;n<e.length;n++)t[n]=e[n];return t}u([h({json:{write:oe}})],T.prototype,"color",void 0),u([z("color")],T.prototype,"castColor",null),u([h({nonNullable:!0,json:{write:oe}})],T.prototype,"position",void 0),u([z("position")],T.prototype,"castPosition",null),u([h({json:{write:oe}})],T.prototype,"uv",void 0),u([z("uv")],T.prototype,"castUv",null),u([h({json:{write:oe}})],T.prototype,"normal",void 0),u([z("normal")],T.prototype,"castNormal",null),u([h({json:{write:oe}})],T.prototype,"tangent",void 0),u([z("tangent")],T.prototype,"castTangent",null),T=ye=u([k(bt)],T);var ae;const At="esri.geometry.support.MeshComponent",Nn=y.getLogger(At);let C=ae=class extends he{static from(e){return Le(ae,e)}constructor(e){super(e),this.faces=null,this.material=null,this.name=void 0,this.shading="source",this.trustSourceNormals=!1}castFaces(e){return q(e,Uint32Array,[Uint16Array],{loggerTag:".faces=",stride:3},Nn)}castMaterial(e){return Le(e&&typeof e=="object"&&("metallic"in e||"roughness"in e||"metallicRoughnessTexture"in e)?Pn:Je,e)}clone(){return new ae({faces:D(this.faces),shading:this.shading,material:D(this.material),trustSourceNormals:this.trustSourceNormals,name:this.name})}cloneWithDeduplication(e,t){const n={faces:D(this.faces),shading:this.shading,material:this.material?this.material.cloneWithDeduplication(e,t):null,trustSourceNormals:this.trustSourceNormals,name:this.name};return new ae(n)}get memoryUsage(){let e=0;return this.faces!=null&&(e+=this.faces.byteLength),this.material!=null&&(e+=this.material.memoryUsage),e}};u([h({json:{write:!0}})],C.prototype,"faces",void 0),u([z("faces")],C.prototype,"castFaces",null),u([h({type:Je,json:{write:!0}})],C.prototype,"material",void 0),u([z("material")],C.prototype,"castMaterial",null),u([h()],C.prototype,"name",void 0),u([h({type:String,json:{write:!0}})],C.prototype,"shading",void 0),u([h({type:Boolean})],C.prototype,"trustSourceNormals",void 0),C=ae=u([k(At)],C);const re=C;let se=class extends P{constructor(){super("mesh-not-loaded","Mesh must be loaded before applying operations")}},Un=class extends P{constructor(){super("component-not-found","Provided component is not part of the list of components")}};class Wn extends P{constructor(){super("invalid-polygon","expected polygon to be a Polygon instance")}}class B extends P{constructor(){super("invalid-input:location","Expected location to be a Point instance")}}class kn extends P{constructor(){super("invalid-input:no-layer","A layer is needed to convert the files")}}let zn=class extends P{constructor(){super("invalid-input:no-model","No supported model found")}},Hn=class extends P{constructor(){super("invalid-input:multiple-models","Multiple supported models found")}};function Vn(e,t,n,r){const o=(i=>!Array.isArray(i[0]))(t)?(i,l)=>t[3*i+l]:(i,l)=>t[i][l],s=r?Gt(r)/Xt(r):1;return Dn(e,(i,l)=>Ne(i,o(l,0)*s,o(l,1)*s,o(l,2)),n)}function Bn(e,t,n){const r=Vn(tt,e,t,n)?jn(tt):[0,0,1];return Math.abs(r[2])>Math.cos(Bt(80))?L.Z:Math.abs(r[1])>Math.abs(r[0])?L.Y:L.X}const tt=Fn();function Gn(e){const t=Zn(e.rings,e.hasZ,be.CCW_IS_HOLE,e.spatialReference),n=new Array;let r=0,o=0;for(const l of t.polygons){const c=l.count,a=l.index,p=Sn(t.position,3*a,3*c),f=l.holeIndices.map(g=>g-a),m=vt(Mn(p,f,3));n.push({position:p,faces:m}),r+=p.length,o+=m.length}const s=Xn(n,r,o),i=Array.isArray(s.position)?Qe(s.position,3,{originalIndices:s.faces}):Qe(s.position.buffer,6,{originalIndices:s.faces});return s.position=Rn(new Float64Array(i.buffer)),s.faces=i.indices,s}function Xn(e,t,n){if(e.length===1)return e[0];const r=xt(t),o=new Array(n);let s=0,i=0,l=0;for(const c of e){for(let a=0;a<c.position.length;a++)r[s++]=c.position[a];for(const a of c.faces)o[i++]=a+l;l=s/3}return{position:r,faces:vt(o)}}function Zn(e,t,n,r){const o=e.length,s=new Array(o),i=new Array(o),l=new Array(o);let c=0,a=0,p=0,f=0;for(let x=0;x<o;++x)f+=e[x].length;const m=xt(3*f);let g=0;for(let x=o-1;x>=0;x--){const d=e[x],S=n===be.CCW_IS_HOLE&&Yn(d,t,r);if(S&&o!==1)s[c++]=d;else{let _=d.length;for(let w=0;w<c;++w)_+=s[w].length;const $={index:g,pathLengths:new Array(c+1),count:_,holeIndices:new Array(c)};$.pathLengths[0]=d.length,d.length>0&&(l[p++]={index:g,count:d.length}),g=S?fe(d,d.length-1,-1,m,g,d.length,t):fe(d,0,1,m,g,d.length,t);for(let w=0;w<c;++w){const R=s[w];$.holeIndices[w]=g,$.pathLengths[w+1]=R.length,R.length>0&&(l[p++]={index:g,count:R.length}),g=fe(R,0,1,m,g,R.length,t)}c=0,$.count>0&&(i[a++]=$)}}for(let x=0;x<c;++x){const d=s[x];d.length>0&&(l[p++]={index:g,count:d.length}),g=fe(d,0,1,m,g,d.length,t)}return i.length=a,l.length=p,{position:m,polygons:i,outlines:l}}function fe(e,t,n,r,o,s,i){o*=3;for(let l=0;l<s;++l){const c=e[t];r[o++]=c[0],r[o++]=c[1],r[o++]=i?c[2]:0,t+=n}return o/3}function Yn(e,t,n){if(t){const r=e.length-1,o=Bn(e,r,n);if(o===L.X)return!Fe(e,L.Y,L.Z);if(o===L.Y)return!Fe(e,L.X,L.Z)}return!Fe(e,L.X,L.Y)}var be;(function(e){e[e.NONE=0]="NONE",e[e.CCW_IS_HOLE=1]="CCW_IS_HOLE"})(be||(be={}));function Jn({xmin:e,xmax:t,ymin:n,ymax:r,zmin:o,zmax:s},i,l,c){o??(o=0),s??(s=0),nt??(nt=new Float64Array(24));const a=nt;return a[0]=e,a[1]=n,a[2]=o,a[3]=e,a[4]=r,a[5]=o,a[6]=t,a[7]=r,a[8]=o,a[9]=t,a[10]=n,a[11]=o,a[12]=e,a[13]=n,a[14]=s,a[15]=e,a[16]=r,a[17]=s,a[18]=t,a[19]=r,a[20]=s,a[21]=t,a[22]=n,a[23]=s,dt({positions:a,transform:i,vertexSpace:l,inSpatialReference:c,outSpatialReference:c,outPositions:a}),we(a,c)}let nt=null;function we(e,t){let n=1/0,r=1/0,o=1/0,s=-1/0,i=-1/0,l=-1/0;const c=e.length;let a=0;for(;a<c;){const p=e[a++],f=e[a++],m=e[a++];n=Math.min(n,p),r=Math.min(r,f),o=Math.min(o,m),s=Math.max(s,p),i=Math.max(i,f),l=Math.max(l,m)}return new Ue({xmin:n,ymin:r,zmin:o,xmax:s,ymax:i,zmax:l,spatialReference:t})}function O(e,t,n,r=0){me[0]=e.x,me[1]=e.y;const o=e.z;return me[2]=o!==void 0?o:r,Zt(me,e.spatialReference,0,t,n,0,1)}const me=b(),pe="esri.geometry.support.meshUtils.centerAt";function qn(e,t,n){var s;if(!((s=e.vertexAttributes)!=null&&s.position))return;const{vertexSpace:r}=e,o=(n==null?void 0:n.origin)??e.origin;r.isRelative?(Re(r,pe,n),Kn(e,t,o)):Me(e.spatialReference,n)?Qn(e,t,o):er(e,t,o)}function Kn(e,t,n){const{vertexSpace:r}=e;if(!r.isRelative)return;const o=St,s=Tt;if(!O(t,s,e.spatialReference))return void y.getLogger(pe).error(`Failed to project centerAt location (wkid:${t.spatialReference.wkid}) to mesh spatial reference (wkid:${e.spatialReference.wkid}). Projection may be possible after calling projection.load().`);if(!O(n,o,e.spatialReference)){const c=e.origin;o[0]=c.x,o[1]=c.y,o[2]=c.z,y.getLogger(pe).error(`Failed to project specified origin (wkid:${n.spatialReference.wkid}) to mesh spatial reference (wkid:${e.spatialReference.wkid}). Projection may be possible after calling projection.load().`)}const i=ue(nr,s,o),l=r.origin;r.origin=Se(b(),l,i)}function Qn(e,t,n){const r=xn(e.vertexAttributes,n,{geographic:!0}),{position:o,normal:s,tangent:i}=vn(r,t,{geographic:!0});e.vertexAttributes.position=o,e.vertexAttributes.normal=s,e.vertexAttributes.tangent=i,e.vertexAttributesChanged()}function er(e,t,n){const r=St,o=Tt;if(O(t,o,e.spatialReference)){if(!O(n,r,e.spatialReference)){const s=e.origin;r[0]=s.x,r[1]=s.y,r[2]=s.z,y.getLogger(pe).error(`Failed to project specified origin (wkid:${n.spatialReference.wkid}) to mesh spatial reference (wkid:${e.spatialReference.wkid}). Projection may be possible after calling projection.load().`)}tr(e.vertexAttributes.position,o,r),e.vertexAttributesChanged()}else y.getLogger(pe).error(`Failed to project centerAt location (wkid:${t.spatialReference.wkid}) to mesh spatial reference (wkid:${e.spatialReference.wkid}). Projection may be possible after calling projection.load().`)}function tr(e,t,n){if(e)for(let r=0;r<e.length;r+=3)for(let o=0;o<3;o++)e[r+o]+=t[o]-n[o]}const Tt=b(),St=b(),nr=b();async function rr(e,t,n){const{source:r}=t,{loadGLTFMesh:o}=await ht(xe(()=>import("./loadGLTFMesh-ea0baf04.js"),["assets/loadGLTFMesh-ea0baf04.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/BufferView-db785e2d.js","assets/vec32-567858f4.js","assets/DefaultMaterial_COLOR_GAMMA-830e6516.js","assets/mat4f64-1413b4a7.js","assets/enums-bdecffa2.js","assets/quat-59e6d063.js","assets/quatf64-3363c48e.js","assets/resourceUtils-908c2b28.js","assets/basicInterfaces-11f56cb3.js","assets/Indices-8bd7636c.js","assets/types-1305598a.js","assets/georeference-f533c6ae.js","assets/spatialReferenceEllipsoidUtils-bc18a3f3.js","assets/MeshLocalVertexSpace-702f1ae9.js","assets/MeshGeoreferencedRelativeVertexSpace-7e8894cd.js","assets/earcut-d423749e.js","assets/deduplicate-d84e5ef3.js","assets/plane-66dd48d1.js","assets/sphere-5667aa69.js","assets/ByteSizeUnit-d4757d40.js","assets/triangle-f93283ef.js","assets/lineSegment-95273d56.js","assets/VertexAttribute-0e674613.js","assets/External-7e16e2e2.js"]),n),s=await sr(r,n);We(n);const i=o(new I({x:0,y:0,z:0,spatialReference:e.spatialReference}),s.url,{resolveFile:or(s),requestFile:void 0,useTransform:!0,signal:n==null?void 0:n.signal,expectedType:s.type});i.then(()=>s.dispose(),()=>s.dispose());const{vertexAttributes:l,components:c}=await i;e.vertexAttributes=l,e.components=c}function or(e){const t=Yt(e.url);return n=>{const r=Jt(n,t,t),o=r?r.replace(/^ *\.\//,""):null;return(o?e.files.get(o):null)??n}}async function sr(e,t){if(Array.isArray(e)){if(!e.length)throw new P("mesh-load-external:missing-assets","There must be at least one file to load");return e[0]instanceof File?ar(e):lr(e,t)}return Rt(e)}async function ir(e,t){const{parts:n,assetMimeType:r,assetName:o}=e;if(n.length===1)return new Ae(n[0].partUrl);const s=await e.toBlob(t);return We(t),Ae.fromBlob(s,Lt(o,r))}function Rt(e){return Ae.fromBlob(e,Lt(e.name,e.type))}function ar(e){return jt(e.map(t=>({name:t.name,mimeType:t.type,source:Rt(t)})))}async function lr(e,t){const n=await qt(e.map(async r=>{const o=await ir(r);return We(t),{name:r.assetName,mimeType:r.assetMimeType,source:o}}));if(Kt(t))throw n.forEach(r=>r.source.dispose()),Qt();return jt(n)}const Mt=/^model\/gltf\+json$/,Ft=/^model\/gltf-binary$/,Pe=/\.gltf$/i,cr=/\.glb$/i;function jt(e){const t=new Map;let n,r=null;for(const{name:o,mimeType:s,source:i}of e)r===null&&(Mt.test(s)||Pe.test(o)?(r=i.url,n="gltf"):(Ft.test(s)||cr.test(o))&&(r=i.url,n="glb")),t.set(o,i.url),i.files.forEach((l,c)=>t.set(c,l));if(r==null)throw new P("mesh-load-external:missing-files","Missing files to load external mesh source");return new Ae(r,()=>e.forEach(({source:o})=>o.dispose()),t,n)}let Ae=class Dt{constructor(t,n=()=>{},r=new Map,o){this.url=t,this.dispose=n,this.files=r,this.type=o}static fromBlob(t,n){const r=URL.createObjectURL(t);return new Dt(r,()=>URL.revokeObjectURL(r),void 0,n)}};function Lt(e,t){return Mt.test(t)||Pe.test(e)?"gltf":Ft.test(t)||Pe.test(e)?"glb":void 0}let W=class extends en{constructor(){super(),this.externalSources=new tn,this._explicitDisplaySource=null,this.addHandles(nn(()=>this.externalSources,"after-remove",({item:e})=>{e===this._explicitDisplaySource&&(this._explicitDisplaySource=null)},{sync:!0,onListenerRemove:()=>this._explicitDisplaySource=null}))}get displaySource(){return this._explicitDisplaySource??this._implicitDisplaySource}set displaySource(e){if(e!=null&&!et(e))throw new Error("Cannot use this source for display: it is not in a supported format.");this._explicitDisplaySource=e,e&&this.externalSources.every(t=>!Ln(t,e))&&this.externalSources.add(e)}clearSources(){this.externalSources.removeAll()}getExternalSourcesOnService(e){return this.externalSources.items.filter(t=>_n(t,e))}get _implicitDisplaySource(){return this.externalSources.find(et)}};u([h()],W.prototype,"externalSources",void 0),u([h()],W.prototype,"displaySource",null),u([h()],W.prototype,"_implicitDisplaySource",null),u([h()],W.prototype,"_explicitDisplaySource",void 0),W=u([k("esri.geometry.support.meshUtils.Metadata")],W);const ur="esri.geometry.support.meshUtils.offset";function pr(e,t,n){var o;if(!((o=e.vertexAttributes)!=null&&o.position))return;const{vertexSpace:r}=e;r.isRelative?(Re(r,ur,n),hr(r,t)):Me(e.spatialReference,n)?fr(e,t):mr(e,t)}function hr(e,t){const n=e.origin;e.origin=Se(b(),n,t)}function fr(e,t){const n=e.spatialReference,r=e.vertexAttributes.position,o=e.vertexAttributes.normal,s=e.vertexAttributes.tangent,i=new Float64Array(r.length),l=o!=null?new Float32Array(o.length):null,c=s!=null?new Float32Array(s.length):null,a=e.extent.center,p=gr;yt(n,[a.x,a.y,a.z],rt,Ye(n)),ft(ot,rt),ve(p,t,ot),ze(r,n,i),o!=null&&l!=null&&He(o,r,i,n,l),s!=null&&c!=null&&Ve(s,r,i,n,c),_t(i,p),Be(i,r,n),o!=null&&l!=null&&Ge(l,r,i,n,o),s!=null&&c!=null&&Xe(c,r,i,n,s),e.vertexAttributesChanged()}function mr(e,t){_t(e.vertexAttributes.position,t),e.vertexAttributesChanged()}function _t(e,t){if(e)for(let n=0;n<e.length;n+=3)for(let r=0;r<3;r++)e[n+r]+=t[r]}const gr=b(),rt=$t(),ot=ke();function dr(){const{faceDescriptions:e,faceVertexOffsets:t,uvScales:n}=Tr,r=4*e.length,o=new Float64Array(3*r),s=new Float32Array(3*r),i=new Float32Array(2*r),l=new Uint32Array(2*e.length*3);let c=0,a=0,p=0,f=0;for(let m=0;m<e.length;m++){const g=e[m],x=c/3;for(const S of t)l[f++]=x+S;const d=g.corners;for(let S=0;S<4;S++){const _=d[S];let $=0;i[p++]=.25*n[S][0]+g.uvOrigin[0],i[p++]=g.uvOrigin[1]-.25*n[S][1];for(let w=0;w<3;w++)g.axis[w]!==0?(o[c++]=.5*g.axis[w],s[a++]=g.axis[w]):(o[c++]=.5*_[$++],s[a++]=0)}}return{position:o,normal:s,uv:i,faces:l}}function yr(e,t){const n=e.components[0],r=n.faces,o=Sr[t],s=6*o,i=new Array(6),l=new Array(r.length-6);let c=0,a=0;for(let p=0;p<r.length;p++)p>=s&&p<s+6?i[c++]=r[p]:l[a++]=r[p];if(e.vertexAttributes.uv!=null){const p=new Float32Array(e.vertexAttributes.uv),f=4*o*2,m=[0,1,1,1,1,0,0,0];for(let g=0;g<m.length;g++)p[f+g]=m[g];e.vertexAttributes.uv=p}return e.components=[new re({faces:i,material:n.material}),new re({faces:l})],e}function wr(e=0){const t=Math.round(8*2**e),n=2*t,r=(t-1)*(n+1)+2*n,o=new Float64Array(3*r),s=new Float32Array(3*r),i=new Float32Array(2*r),l=new Uint32Array(3*((t-1)*n*2));let c=0,a=0,p=0,f=0;for(let m=0;m<=t;m++){const g=m/t*Math.PI+.5*Math.PI,x=Math.cos(g),d=Math.sin(g);v[2]=d;const S=m===0||m===t,_=S?n-1:n;for(let $=0;$<=_;$++){const w=$/_*2*Math.PI;v[0]=-Math.sin(w)*x,v[1]=Math.cos(w)*x;for(let R=0;R<3;R++)o[c]=.5*v[R],s[c]=v[R],++c;i[a++]=($+(S?.5:0))/n,i[a++]=m/t,m!==0&&$!==n&&(m!==t&&(l[p++]=f,l[p++]=f+1,l[p++]=f-n),m!==1&&(l[p++]=f,l[p++]=f-n,l[p++]=f-n-1)),f++}}return{position:o,normal:s,uv:i,faces:l}}function xr(e=0){const n=Math.round(16*2**e),r=(5-1)*(n+1)+2*n,o=new Float64Array(3*r),s=new Float32Array(3*r),i=new Float32Array(2*r),l=new Uint32Array(3*(4*n));let c=0,a=0,p=0,f=0,m=0;for(let g=0;g<=5;g++){const x=g===0||g===5,d=g<=1||g>=5-1,S=g===2||g===4,_=x?n-1:n;for(let $=0;$<=_;$++){const w=$/_*2*Math.PI,R=x?0:.5;v[0]=R*Math.sin(w),v[1]=R*-Math.cos(w),v[2]=g<=2?.5:-.5;for(let H=0;H<3;H++)o[c++]=v[H],s[a++]=d?H===2?g<=1?1:-1:0:H===2?0:v[H]/R;i[p++]=($+(x?.5:0))/n,i[p++]=g<=1?1*g/3:g<=3?1*(g-2)/3+1/3:1*(g-4)/3+2/3,S||g===0||$===n||(g!==5&&(l[f++]=m,l[f++]=m+1,l[f++]=m-n),g!==1&&(l[f++]=m,l[f++]=m-n,l[f++]=m-n-1)),m++}}return{position:o,normal:s,uv:i,faces:l}}function vr(e,t){const n=typeof t=="number"?t:t!=null?t.width:1,r=typeof t=="number"?t:t!=null?t.height:1;switch(e){case"up":case"down":return{width:n,depth:r};case"north":case"south":return{width:n,height:r};case"east":case"west":return{depth:n,height:r}}}function $r(e){const t=ie.facingAxisOrderSwap[e],n=ie.position,r=ie.normal,o=new Float64Array(n.length),s=new Float32Array(r.length);let i=0;for(let l=0;l<4;l++){const c=i;for(let a=0;a<3;a++){const p=t[a],f=Math.abs(p)-1,m=p>=0?1:-1;o[i]=n[c+f]*m,s[i]=r[c+f]*m,i++}}return{position:o,normal:s,uv:new Float32Array(ie.uv),faces:new Uint32Array(ie.faces),isPlane:!0}}const G=1,X=2,Z=3,ie={position:[-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0],normal:[0,0,1,0,0,1,0,0,1,0,0,1],uv:[0,1,1,1,1,0,0,0],faces:[0,1,2,0,2,3],facingAxisOrderSwap:{east:[Z,G,X],west:[-Z,-G,X],north:[-G,Z,X],south:[G,-Z,X],up:[G,X,Z],down:[G,-X,-Z]}};function ge(e,t,n){e.isPlane||br(e),Ar(e,n==null?void 0:n.size);const{vertexAttributes:r,vertexSpace:o,transform:s}=$n(e,t,n);return{vertexAttributes:new T({...r,uv:e.uv}),vertexSpace:o,transform:s,components:[new re({faces:e.faces,material:(n==null?void 0:n.material)||null})],spatialReference:t.spatialReference}}function br(e){for(let t=0;t<e.position.length;t+=3)e.position[t+2]+=.5}function Ar(e,t){if(t==null)return;const n=typeof t=="number"?[t,t,t]:[t.width!=null?t.width:1,t.depth!=null?t.depth:1,t.height!=null?t.height:1];N[0]=n[0],N[4]=n[1],N[8]=n[2];for(let r=0;r<e.position.length;r+=3){for(let o=0;o<3;o++)v[o]=e.position[r+o];ve(v,v,N);for(let o=0;o<3;o++)e.position[r+o]=v[o]}if(n[0]!==n[1]||n[1]!==n[2]){N[0]=1/n[0],N[4]=1/n[1],N[8]=1/n[2];for(let r=0;r<e.normal.length;r+=3){for(let o=0;o<3;o++)v[o]=e.normal[r+o];ve(v,v,N),rn(v,v);for(let o=0;o<3;o++)e.normal[r+o]=v[o]}}}const Tr={faceDescriptions:[{axis:[0,-1,0],uvOrigin:[0,.625],corners:[[-1,-1],[1,-1],[1,1],[-1,1]]},{axis:[1,0,0],uvOrigin:[.25,.625],corners:[[-1,-1],[1,-1],[1,1],[-1,1]]},{axis:[0,1,0],uvOrigin:[.5,.625],corners:[[1,-1],[-1,-1],[-1,1],[1,1]]},{axis:[-1,0,0],uvOrigin:[.75,.625],corners:[[1,-1],[-1,-1],[-1,1],[1,1]]},{axis:[0,0,1],uvOrigin:[0,.375],corners:[[-1,-1],[1,-1],[1,1],[-1,1]]},{axis:[0,0,-1],uvOrigin:[0,.875],corners:[[-1,1],[1,1],[1,-1],[-1,-1]]}],uvScales:[[0,0],[1,0],[1,1],[0,1]],faceVertexOffsets:[0,1,2,0,2,3]},Sr={south:0,east:1,north:2,west:3,up:4,down:5},v=b(),N=ke(),Et="esri.geometry.support.meshUtils.rotate";function Rr(e,t,n){var s;if(!((s=e.vertexAttributes)!=null&&s.position)||t[3]===0)return;const{spatialReference:r,vertexSpace:o}=e;if(o.isRelative){Re(o,Et,n);const i=(n==null?void 0:n.origin)??e.origin;e.transform??(e.transform=new ne),Mr(e.transform,o,t,i)}else{const i=(n==null?void 0:n.origin)??e.origin;Me(r,n)?Fr(e,t,i):jr(e,t,i)}}function Mr(e,t,n,r){const o=t.origin,s=Ne(K,r.x,r.y,r.z??0),i=ue(K,s,o);e.applyLocalInverse(i,st),e.rotation=bn(e.rotation,n,Ze()),e.applyLocalInverse(i,i),ue(i,i,st),e.translation=Se(b(),e.translation,i)}function Fr(e,t,n){const r=e.spatialReference,o=Ye(r),s=Ct;O(n,s,o)||O(e.origin,s,o);const i=e.vertexAttributes.position,l=e.vertexAttributes.normal,c=e.vertexAttributes.tangent,a=new Float64Array(i.length),p=l!=null?new Float32Array(l.length):null,f=c!=null?new Float32Array(c.length):null;yt(o,s,Te,o),ft(at,Te);const m=it;ve(_e(it),_e(t),at),m[3]=t[3],ze(i,r,a),l!=null&&p!=null&&He(l,i,a,r,p),c!=null&&f!=null&&Ve(c,i,a,r,f),ee(a,m,3,s),Be(a,i,r),l!=null&&p!=null&&(ee(p,m,3),Ge(p,i,a,r,l)),c!=null&&f!=null&&(ee(f,m,4),Xe(f,i,a,r,c)),e.vertexAttributesChanged()}function jr(e,t,n){const r=Ct;if(!O(n,r,e.spatialReference)){const o=e.origin;r[0]=o.x,r[1]=o.y,r[2]=o.z,y.getLogger(Et).error(`Failed to project specified origin (wkid:${n.spatialReference.wkid}) to mesh spatial reference (wkid:${e.spatialReference.wkid}). Projection may be possible after calling projection.load().`)}ee(e.vertexAttributes.position,t,3,r),ee(e.vertexAttributes.normal,t,3),ee(e.vertexAttributes.tangent,t,4),e.vertexAttributesChanged()}function ee(e,t,n,r=mt){if(e!=null){on(Te,An(t),_e(t));for(let o=0;o<e.length;o+=n){for(let s=0;s<3;s++)K[s]=e[o+s]-r[s];sn(K,K,Te);for(let s=0;s<3;s++)e[o+s]=K[s]+r[s]}}}const K=b(),st=b(),it=Ze(),Te=$t(),at=ke(),Ct=b(),Ot="esri.geometry.support.meshUtils.scale";function Dr(e,t,n){var s;if(!((s=e.vertexAttributes)!=null&&s.position))return;const{spatialReference:r,vertexSpace:o}=e;if(o.isRelative){Re(o,Ot,n);const i=(n==null?void 0:n.origin)??e.origin;e.transform??(e.transform=new ne),Lr(e.transform,o,t,i)}else{const i=Me(r,n),l=(n==null?void 0:n.origin)??e.origin;i?_r(e,t,l):Er(e,t,l)}}function Lr(e,t,n,r){const o=t.origin,s=Ne(Q,r.x,r.y,r.z),i=ue(Q,s,o);e.applyLocalInverse(i,lt);const l=gt(b(),e.scale,n);e.scale=l,e.applyLocalInverse(i,i),ue(i,i,lt),e.translation=Se(b(),e.translation,i)}function _r(e,t,n){const r=e.spatialReference,o=Ye(r),s=It;O(n,s,o)||O(e.origin,s,o);const i=e.vertexAttributes.position,l=e.vertexAttributes.normal,c=e.vertexAttributes.tangent,a=new Float64Array(i.length),p=l!=null?new Float32Array(l.length):null,f=c!=null?new Float32Array(c.length):null;ze(i,r,a),l!=null&&p!=null&&He(l,i,a,r,p),c!=null&&f!=null&&Ve(c,i,a,r,f),Pt(a,t,s),Be(a,i,r),l!=null&&p!=null&&Ge(p,i,a,r,l),c!=null&&f!=null&&Xe(f,i,a,r,c),e.vertexAttributesChanged()}function Er(e,t,n){const r=It;if(!O(n,r,e.spatialReference)){const o=e.origin;r[0]=o.x,r[1]=o.y,r[2]=o.z,y.getLogger(Ot).error(`Failed to project specified origin (wkid:${n.spatialReference.wkid}) to mesh spatial reference (wkid:${e.spatialReference.wkid}). Projection may be possible after calling projection.load().`)}Pt(e.vertexAttributes.position,t,r),e.vertexAttributesChanged()}function Pt(e,t,n=mt){if(e)for(let r=0;r<e.length;r+=3){for(let o=0;o<3;o++)Q[o]=e[r+o]-n[o];gt(Q,Q,t);for(let o=0;o<3;o++)e[r+o]=Q[o]+n[o]}}const Q=b(),lt=b(),It=b();async function Cr(e){const t=[];for(const n of e)n.name.toLowerCase().endsWith(".zip")?t.push(Or(n)):t.push(Promise.resolve(n));return(await Promise.all(t)).flat()}async function Or(e){const{BlobReader:t,ZipReader:n,BlobWriter:r}=await xe(()=>import("./zipjs-wrapper-4f68a823.js"),[]),o=[];return(await new n(new t(e)).getEntries()).forEach(i=>{var a;if(i.directory||/^__MACOS/i.test(i.filename))return;const l=new r,c=(a=i.getData)==null?void 0:a.call(i,l).then(p=>new File([p],i.filename));c&&o.push(c)}),Promise.all(o)}var M;const U="esri.geometry.Mesh",Pr={base:null,key:"type",defaultKeyValue:"georeferenced",typeMap:{georeferenced:Ee,"georeferenced-relative":wt,local:$e}};let A=M=class extends an.LoadableMixin(ln(cn)){constructor(e){super(e),this.components=null,this.vertexSpace=new Ee,this.transform=null,this.metadata=new W,this.hasZ=!0,this.hasM=!1,this.vertexAttributes=new T,this.type="mesh"}initialize(){(this.metadata.externalSources.length===0||this.vertexAttributes.position.length)&&(this.loadStatus="loaded"),this.when(()=>{this.addHandles(un(()=>{var e;return{vertexAttributes:this.vertexAttributes,components:(e=this.components)==null?void 0:e.map(t=>t.clone())}},()=>this._clearSources(),{once:!0,sync:!0}))})}get hasExtent(){var e;return this.loaded?this.vertexAttributes.position.length>0&&(!this.components||this.components.length>0):((e=this.metadata.displaySource)==null?void 0:e.extent)!=null}get _transformedExtent(){const{components:e,spatialReference:t,vertexAttributes:n,vertexSpace:r}=this,o=n.position;if(o.length===0||e&&e.length===0)return new Ue({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0,spatialReference:t});if(r.type==="local"){const{_untransformedExtent:s,transform:i}=this;return Jn(s,i,r,t)}if(r.type==="georeferenced-relative"){const{transform:s}=this,i=dt({positions:o,transform:s,vertexSpace:r,inSpatialReference:t,outSpatialReference:t});return we(i,t)}return we(o,t)}get _untransformedExtent(){return we(this.vertexAttributes.position,this.spatialReference)}get anchor(){const{vertexSpace:e}=this;if(e.isRelative)return e.getOriginPoint(this.spatialReference);const{center:t,zmin:n}=this._transformedExtent;return new I({x:t.x,y:t.y,z:n,spatialReference:this.spatialReference})}get origin(){const{vertexSpace:e}=this;return e.isRelative?e.getOriginPoint(this.spatialReference):this._transformedExtent.center}get extent(){var e,t;return this.loaded||((t=(e=this.metadata)==null?void 0:e.displaySource)==null?void 0:t.extent)==null?this._transformedExtent:this.metadata.displaySource.extent.clone()}addComponent(e){if(!this.loaded)return y.getLogger(this).error("addComponent()",new se().message);this.components||(this.components=[]),this.components.push(re.from(e)),this.notifyChange("components")}removeComponent(e){if(!this.loaded)return y.getLogger(this).error("removeComponent()",new se().message);if(this.components){const t=this.components.indexOf(e);if(t!==-1)return this.components.splice(t,1),void this.notifyChange("components")}y.getLogger(this).error("removeComponent()",new Un().message)}rotate(e,t,n,r){return Tn(e,t,n,ct),Rr(this,ct,r),this}offset(e,t,n,r){return this.loaded?(de[0]=e,de[1]=t,de[2]=n,pr(this,de,r),this):(y.getLogger(this).error("offset()",new se().message),this)}scale(e,t){return this.loaded?(Dr(this,e,t),this):(y.getLogger(this).error("scale()",new se().message),this)}centerAt(e,t){return this.loaded?(qn(this,e,t),this):(y.getLogger(this).error("centerAt()",new se().message),this)}load(e){const{metadata:{displaySource:t}}=this;return t&&this.addResolvingPromise(rr(this,t,e)),Promise.resolve(this)}addExternalSources(e){this.metadata.externalSources.addMany(e)}updateDisplaySource(e){this.metadata.displaySource=e}clone(){return this.cloneWithVertexSpace(this.vertexSpace.clone())}cloneWithVertexSpace(e){var r;let t=null;if(this.components){const o=new Map,s=new Map;t=this.components.map(i=>i.cloneWithDeduplication(o,s))}const n={components:t,spatialReference:this.spatialReference,vertexAttributes:this.vertexAttributes.clone(),vertexSpace:e,transform:((r=this.transform)==null?void 0:r.clone())??null,metadata:this.metadata.clone()};return new M(n)}cloneShallow(){return new M({components:this.components,spatialReference:this.spatialReference,vertexAttributes:this.vertexAttributes,vertexSpace:this.vertexSpace.clone(),transform:this.transform,metadata:this.metadata})}vertexAttributesChanged(){this.notifyChange("vertexAttributes")}async toBinaryGLTF(e){const t=xe(()=>import("./gltfexport-64d48c46.js"),["assets/gltfexport-64d48c46.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/mat4f64-1413b4a7.js","assets/quat-59e6d063.js","assets/quatf64-3363c48e.js","assets/MeshGeoreferencedRelativeVertexSpace-7e8894cd.js","assets/georeference-f533c6ae.js","assets/spatialReferenceEllipsoidUtils-bc18a3f3.js","assets/MeshLocalVertexSpace-702f1ae9.js","assets/vec32-567858f4.js","assets/BufferView-db785e2d.js","assets/enums-bdecffa2.js","assets/imageutils-c59aa434.js","assets/resourceUtils-908c2b28.js","assets/basicInterfaces-11f56cb3.js","assets/earcut-d423749e.js","assets/Indices-8bd7636c.js","assets/deduplicate-d84e5ef3.js","assets/plane-66dd48d1.js","assets/sphere-5667aa69.js","assets/ByteSizeUnit-d4757d40.js","assets/triangle-f93283ef.js","assets/lineSegment-95273d56.js","assets/VertexAttribute-0e674613.js","assets/External-7e16e2e2.js"]),n=this.load(),r=await Promise.all([t,n]),{toBinaryGLTF:o}=r[0];return o(this,e)}get memoryUsage(){let e=0;if(e+=this.vertexAttributes.memoryUsage,this.components!=null)for(const t of this.components)e+=t.memoryUsage;return e}_clearSources(){this.metadata.clearSources()}static createBox(e,t){if(!(e instanceof I))return y.getLogger(U).error(".createBox()",new B().message),null;const n=new M(ge(dr(),e,t));return t!=null&&t.imageFace&&t.imageFace!=="all"?yr(n,t.imageFace):n}static createSphere(e,t){return e instanceof I?new M(ge(wr((t==null?void 0:t.densificationFactor)||0),e,t)):(y.getLogger(U).error(".createSphere()",new B().message),null)}static createCylinder(e,t){return e instanceof I?new M(ge(xr((t==null?void 0:t.densificationFactor)||0),e,t)):(y.getLogger(U).error(".createCylinder()",new B().message),null)}static createPlane(e,t){if(!(e instanceof I))return y.getLogger(U).error(".createPlane()",new B().message),null;const n=(t==null?void 0:t.facing)??"up",r=vr(n,t==null?void 0:t.size);return new M(ge($r(n),e,{...t,size:r}))}static createFromPolygon(e,t){if(!(e instanceof pn))return y.getLogger(U).error(".createFromPolygon()",new Wn().message),null;const n=Gn(e);return new M({vertexAttributes:new T({position:n.position}),components:[new re({faces:n.faces,shading:"flat",material:(t==null?void 0:t.material)??null})],spatialReference:e.spatialReference,vertexSpace:new Ee})}static async createFromGLTF(e,t,n){if(!(e instanceof I)){const o=new B;throw y.getLogger(U).error(".createfromGLTF()",o.message),o}const{loadGLTFMesh:r}=await ht(xe(()=>import("./loadGLTFMesh-ea0baf04.js"),["assets/loadGLTFMesh-ea0baf04.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/BufferView-db785e2d.js","assets/vec32-567858f4.js","assets/DefaultMaterial_COLOR_GAMMA-830e6516.js","assets/mat4f64-1413b4a7.js","assets/enums-bdecffa2.js","assets/quat-59e6d063.js","assets/quatf64-3363c48e.js","assets/resourceUtils-908c2b28.js","assets/basicInterfaces-11f56cb3.js","assets/Indices-8bd7636c.js","assets/types-1305598a.js","assets/georeference-f533c6ae.js","assets/spatialReferenceEllipsoidUtils-bc18a3f3.js","assets/MeshLocalVertexSpace-702f1ae9.js","assets/MeshGeoreferencedRelativeVertexSpace-7e8894cd.js","assets/earcut-d423749e.js","assets/deduplicate-d84e5ef3.js","assets/plane-66dd48d1.js","assets/sphere-5667aa69.js","assets/ByteSizeUnit-d4757d40.js","assets/triangle-f93283ef.js","assets/lineSegment-95273d56.js","assets/VertexAttribute-0e674613.js","assets/External-7e16e2e2.js"]),n);return new M(await r(e,t,n))}static async createFromFiles(e,t,n){const r=a=>y.getLogger(U).error(".createFromFiles()",a.message);if(!(e instanceof I)){const a=new B;throw r(a),a}const o=n==null?void 0:n.layer;if(!o){const a=new kn;throw r(a),a}const s=await M.extractAndFilterFiles(t,o),i=s.reduce((a,p)=>hn(o.infoFor3D,p)?a+1:a,0);if(i===0){const a=new zn;throw r(a),a}if(i>1){const a=new Hn;throw r(a),a}const l=M.createWithExternalSource(e,s),[c]=await o.uploadAssets([l],n);return c}static async extractAndFilterFiles(e,t){const n=t==null?void 0:t.infoFor3D;return n?(await Cr(e)).filter(r=>fn(n,r)):e}static createWithExternalSource(e,t,n){var m;const r=(n==null?void 0:n.extent)??null,{x:o,y:s,z:i,spatialReference:l}=e,c=((m=n==null?void 0:n.transform)==null?void 0:m.clone())??new ne,a=(n==null?void 0:n.vertexSpace)??new $e({origin:[o,s,i??0]}),p={source:t,extent:r},f=new W;return f.externalSources.push(p),new M({metadata:f,transform:c,vertexSpace:a,spatialReference:l})}static createIncomplete(e,t){var a;const{x:n,y:r,z:o,spatialReference:s}=e,i=((a=t==null?void 0:t.transform)==null?void 0:a.clone())??new ne,l=(t==null?void 0:t.vertexSpace)??new $e({origin:[n,r,o??0]}),c=new M({transform:i,vertexSpace:l,spatialReference:s});return c.addResolvingPromise(Promise.reject(new P("mesh-incomplete","Mesh resources are not complete"))),c}};u([h({type:[re],json:{write:!0}})],A.prototype,"components",void 0),u([h({nonNullable:!0,types:Pr,constructOnly:!0,json:{write:!0}})],A.prototype,"vertexSpace",void 0),u([h({type:ne,json:{write:!0}})],A.prototype,"transform",void 0),u([h({constructOnly:!0})],A.prototype,"metadata",void 0),u([h()],A.prototype,"hasExtent",null),u([h()],A.prototype,"_transformedExtent",null),u([h()],A.prototype,"_untransformedExtent",null),u([h()],A.prototype,"anchor",null),u([h()],A.prototype,"origin",null),u([h({readOnly:!0,json:{read:!1}})],A.prototype,"extent",null),u([h({readOnly:!0,json:{read:!1,write:!0,default:!0}})],A.prototype,"hasZ",void 0),u([h({readOnly:!0,json:{read:!1,write:!0,default:!1}})],A.prototype,"hasM",void 0),u([h({type:T,nonNullable:!0,json:{write:!0}})],A.prototype,"vertexAttributes",void 0),A=M=u([k(U)],A);const de=b(),ct=Ze(),ut=A,Ie=()=>y.getLogger("esri.rest.support.meshFeatureSet");function Ir(e,t,n){const r=n.features;n.features=[],delete n.geometryType;const o=mn.fromJSON(n);if(o.geometryType="mesh",!n.assetMaps)return o;const s=Ut(t,n.assetMaps),i=e.sourceSpatialReference??gn.WGS84,l=n.globalIdFieldName,{outFields:c}=e,a=c!=null&&c.length>0?Nr(c.includes("*")?null:new Set(c)):()=>({});for(const p of r){const f=Nt(p,l,i,t,s);f!=null&&o.features.push(new dn({geometry:f,attributes:a(p)}))}return o}function Nr(e){return({attributes:t})=>{if(!t)return{};if(!e)return t;for(const n in t)e.has(n)||delete t[n];return t}}function Nt(e,t,n,r,o){const s=e.attributes[t],i=o.get(s);if(i==null)return Ie().error("mesh-feature-set:asset-not-found","Service returned a feature which was not found in the asset map",e),null;if(!e.geometry)return Ie().error("mesh-feature-set:no-geometry","Service returned a feature without geometry",e),null;const{originPoint:l,originVector:c}=Ur(e,n,r),a=Ue.fromJSON(e.geometry);a.spatialReference=n;const p=Wr(e.attributes,r),f=i.projectVertices?new wt({origin:c}):new $e({origin:c}),m=kr(i);return m?ut.createWithExternalSource(l,m,{extent:a,transform:p,vertexSpace:f}):ut.createIncomplete(l,{extent:a,transform:p,vertexSpace:f})}function Ur({attributes:e},t,{transformFieldRoles:n}){const r=e[n.originX],o=e[n.originY],s=e[n.originZ];return{originPoint:new I({x:r,y:o,z:s,spatialReference:t}),originVector:yn(r,o,s)}}function Wr(e,{transformFieldRoles:t}){return new ne({translation:[e[t.translationX],-e[t.translationZ],e[t.translationY]],rotationAxis:[e[t.rotationX],-e[t.rotationZ],e[t.rotationY]],rotationAngle:e[t.rotationDeg],scale:[e[t.scaleX],e[t.scaleZ],e[t.scaleY]]})}var te;function Ut(e,t){const n=new Map;for(const r of t){const o=r.parentGlobalId;if(o==null)continue;const s=r.assetName,i=r.assetType,l=r.assetHash,c=r.assetURL,a=r.conversionStatus,p=r.seqNo,f=wn(i,e.supportedFormats);if(!f){Ie().error("mesh-feature-set:unknown-format",`Service returned an asset of type ${i}, but it does not list it as a supported type`);continue}const m=Ke(n,o,()=>({projectVertices:Hr(r.flags).projectVertices,files:new Map}));Ke(m.files,s,()=>({name:s,type:i,mimeType:f,status:zr(a),parts:[]})).parts[p]={hash:l,url:c}}return n}function kr(e){const t=Array.from(e.files.values()),n=new Array;for(const r of t){if(r.status!==te.COMPLETED)return null;const o=new Array;for(const s of r.parts){if(!s)return null;o.push(new En(s.url,s.hash))}n.push(new Cn(r.name,r.mimeType,o))}return n}function zr(e){switch(e){case"COMPLETED":case"SUBMITTED":return te.COMPLETED;case"INPROGRESS":return te.PENDING;default:return te.FAILED}}function Hr(e){return{projectVertices:e.includes("PROJECT_VERTICES")}}(function(e){e[e.FAILED=0]="FAILED",e[e.PENDING=1]="PENDING",e[e.COMPLETED=2]="COMPLETED"})(te||(te={}));const co=Object.freeze(Object.defineProperty({__proto__:null,assetMapFromAssetMapsJSON:Ut,extractMesh:Nt,meshFeatureSetFromJSON:Ir},Symbol.toStringTag,{value:"Module"}));export{ce as a,co as b,Pn as c,re as g,le as m,T as p};
|