@arcgis/core 4.28.0-next.20230712 → 4.28.0-next.20230713
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/08ee2bd914867fd2cbd5.js +1 -0
- package/assets/esri/core/workers/chunks/{4f92fd5167e22c602e8a.js → 169b04f05f5c875c5083.js} +1 -1
- package/assets/esri/core/workers/chunks/55109f141c9f120833f6.js +1 -0
- package/assets/esri/core/workers/chunks/8c5a8c1dfb086069bb06.js +1 -0
- package/assets/esri/core/workers/chunks/{f156387d6c645b18a8dd.js → b2a0e3e1dfccda7ed12e.js} +1 -1
- package/assets/esri/core/workers/chunks/d4881b238c8a93390cde.js +1 -0
- package/assets/esri/core/workers/chunks/dcb004dfba27335c7c3c.js +1 -0
- package/assets/esri/core/workers/chunks/{ad38aede3ec854191511.js → f6e24113643784bc6731.js} +1 -1
- package/assets/esri/core/workers/chunks/{3a0e2535f6cdb2e65667.js → fb610982b1366cdbc0c3.js} +1 -1
- package/assets/esri/core/workers/chunks/{5583921a498172edd5ac.js → fcab431f13b4a9f92dbf.js} +1 -1
- package/core/Collection.js +1 -1
- package/core/accessorSupport/ensureType.js +1 -1
- package/core/accessorSupport/set.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
- package/layers/support/rasterDatasets/multipartParser.js +1 -1
- package/layers/support/wmtsUtils.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/support/LaserLineRenderer.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +17 -21
- package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
- package/views/3d/webgl-engine/lib/GLMaterials.js +1 -1
- package/views/3d/webgl-engine/lib/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/stippleTextureRepository.js +1 -1
- package/widgets/ElevationProfile/support/ProfileGenerationError.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/assets/esri/core/workers/chunks/00b023cb63f23bc074b8.js +0 -1
- package/assets/esri/core/workers/chunks/1e413a44b35bfecbfa59.js +0 -1
- package/assets/esri/core/workers/chunks/71c029f95cb4666ae207.js +0 -1
- package/assets/esri/core/workers/chunks/c9ef45225947ccc2bd4c.js +0 -1
- package/assets/esri/core/workers/chunks/dda6fab95d50c1215808.js +0 -1
|
@@ -282,7 +282,7 @@ return fallOffFunction(vv, vn, 0.1);
|
|
|
282
282
|
|
|
283
283
|
occlusionBlurred = b / w_total;
|
|
284
284
|
}
|
|
285
|
-
`),e}const p=Object.freeze(Object.defineProperty({__proto__:null,build:f},Symbol.toStringTag,{value:"Module"}))},14682:(e,t,r)=>{function i(){const e=new Float32Array(9);return e[0]=1,e[4]=1,e[8]=1,e}function o(e,t,r,i,o,n,a,s,l){const c=new Float32Array(9);return c[0]=e,c[1]=t,c[2]=r,c[3]=i,c[4]=o,c[5]=n,c[6]=a,c[7]=s,c[8]=l,c}r.d(t,{c:()=>i,f:()=>o}),Object.freeze(Object.defineProperty({__proto__:null,clone:function(e){const t=new Float32Array(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},create:i,createView:function(e,t){return new Float32Array(e,t,9)},fromValues:o},Symbol.toStringTag,{value:"Module"}))},1265:(e,t,r)=>{function i(){return new Float32Array(2)}function o(e,t){const r=new Float32Array(2);return r[0]=e,r[1]=t,r}function n(){return i()}function a(){return o(1,1)}function s(){return o(1,0)}function l(){return o(0,1)}r.d(t,{O:()=>d,Z:()=>c,c:()=>i,f:()=>o});const c=n(),d=a(),u=s(),h=l();Object.freeze(Object.defineProperty({__proto__:null,ONES:d,UNIT_X:u,UNIT_Y:h,ZEROS:c,clone:function(e){const t=new Float32Array(2);return t[0]=e[0],t[1]=e[1],t},create:i,createView:function(e,t){return new Float32Array(e,t,2)},fromValues:o,ones:a,unitX:s,unitY:l,zeros:n},Symbol.toStringTag,{value:"Module"}))},20773:(e,t,r)=>{r.d(t,{a:()=>s,b:()=>a,c:()=>o,d:()=>d,e:()=>l,n:()=>u,s:()=>c,t:()=>n});var i=r(72220);function o(e,t,r){n(e.typedBuffer,t.typedBuffer,r,e.typedBufferStride,t.typedBufferStride)}function n(e,t,r,o=3,n=o){if(e.length/o!==Math.ceil(t.length/n))return i.c.error("source and destination buffers need to have the same number of elements"),e;const a=e.length/o,s=r[0],l=r[1],c=r[2],d=r[4],u=r[5],h=r[6],m=r[8],f=r[9],p=r[10],g=r[12],v=r[13],_=r[14];let T=0,x=0;for(let r=0;r<a;r++){const r=t[T],i=t[T+1],a=t[T+2];e[x]=s*r+d*i+m*a+g,e[x+1]=l*r+u*i+f*a+v,e[x+2]=c*r+h*i+p*a+_,T+=n,x+=o}return e}function a(e,t,r){s(e.typedBuffer,t.typedBuffer,r,e.typedBufferStride,t.typedBufferStride)}function s(e,t,r,o=3,n=o){if(e.length/o!==Math.ceil(t.length/n))return void i.c.error("source and destination buffers need to have the same number of elements");const a=e.length/o,s=r[0],l=r[1],c=r[2],d=r[3],u=r[4],h=r[5],m=r[6],f=r[7],p=r[8];let g=0,v=0;for(let r=0;r<a;r++){const r=t[g],i=t[g+1],a=t[g+2];e[v]=s*r+d*i+m*a,e[v+1]=l*r+u*i+f*a,e[v+2]=c*r+h*i+p*a,g+=n,v+=o}}function l(e,t,r){c(e.typedBuffer,t,r,e.typedBufferStride)}function c(e,t,r,i=3){const o=Math.min(e.length/i,t.count),n=t.typedBuffer,a=t.typedBufferStride;let s=0,l=0;for(let t=0;t<o;t++)e[l]=r*n[s],e[l+1]=r*n[s+1],e[l+2]=r*n[s+2],s+=a,l+=i}function d(e,t){u(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)}function u(e,t,r=3,i=r){const o=Math.min(e.length/r,t.length/i);let n=0,a=0;for(let s=0;s<o;s++){const o=t[n],s=t[n+1],l=t[n+2],c=o*o+s*s+l*l;if(c>0){const t=1/Math.sqrt(c);e[a]=t*o,e[a+1]=t*s,e[a+2]=t*l}n+=i,a+=r}}Object.freeze(Object.defineProperty({__proto__:null,normalize:u,normalizeView:d,scale:c,scaleView:l,shiftRight:function(e,t,r){const i=Math.min(e.count,t.count),o=e.typedBuffer,n=e.typedBufferStride,a=t.typedBuffer,s=t.typedBufferStride;let l=0,c=0;for(let e=0;e<i;e++)o[c]=a[l]>>r,o[c+1]=a[l+1]>>r,o[c+2]=a[l+2]>>r,l+=s,c+=n},transformMat3:s,transformMat3View:a,transformMat4:n,transformMat4View:o},Symbol.toStringTag,{value:"Module"}))},23670:(e,t,r)=>{r.d(t,{G:()=>o});var i=r(20102);let o=class{constructor(e,t,r=""){this.major=e,this.minor=t,this._context=r}lessThan(e,t){return this.major<e||e===this.major&&this.minor<t}since(e,t){return!this.lessThan(e,t)}validate(e){if(this.major!==e.major){const t=this._context&&this._context+":",r=this._context&&this._context+" ";throw new i.Z(t+"unsupported-version",`Required major ${r}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:e})}}clone(){return new o(this.major,this.minor,this._context)}static parse(e,t=""){const[r,n]=e.split("."),a=/^\s*\d+\s*$/;if(!r||!r.match||!a.test(r))throw new i.Z((t&&t+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:e});if(!n||!n.match||!a.test(n))throw new i.Z((t&&t+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:e});const s=parseInt(r,10),l=parseInt(n,10);return new o(s,l,t)}}},43090:(e,t,r)=>{function i(e){return 32+e.length}function o(e){if(!e)return 0;let t=l;for(const r in e)if(e.hasOwnProperty(r)){const o=e[r];switch(typeof o){case"string":t+=i(o);break;case"number":t+=16;break;case"boolean":t+=4}}return t}function n(e){if(!e)return 0;if(Array.isArray(e))return function(e){const t=e.length;if(0===t||"number"==typeof e[0])return 32+8*t;let r=c;for(let i=0;i<t;i++)r+=a(e[i]);return r}(e);let t=l;for(const r in e)e.hasOwnProperty(r)&&(t+=a(e[r]));return t}function a(e){switch(typeof e){case"object":return n(e);case"string":return i(e);case"number":return 16;case"boolean":return 4;default:return 8}}function s(e,t){return c+e.length*t}r.d(t,{Ul:()=>n,do:()=>s,f2:()=>o});const l=32,c=32},32243:(e,t,r)=>{function i(e){return e=e||globalThis.location.hostname,c.some((t=>null!=e?.match(t)))}function o(e,t){return e&&(t=t||globalThis.location.hostname)?null!=t.match(n)||null!=t.match(s)?e.replace("static.arcgis.com","staticdev.arcgis.com"):null!=t.match(a)||null!=t.match(l)?e.replace("static.arcgis.com","staticqa.arcgis.com"):e:e}r.d(t,{XO:()=>i,pJ:()=>o});const n=/^devext.arcgis.com$/,a=/^qaext.arcgis.com$/,s=/^[\w-]*\.mapsdevext.arcgis.com$/,l=/^[\w-]*\.mapsqa.arcgis.com$/,c=[/^([\w-]*\.)?[\w-]*\.zrh-dev-local.esri.com$/,n,a,/^jsapps.esri.com$/,s,l]},72220:(e,t,r)=>{r.d(t,{c:()=>i});const i=r(92604).Z.getLogger("esri.views.3d.support.buffer.math")},16996:(e,t,r)=>{r.d(t,{Ue:()=>l,nF:()=>d,zk:()=>c});var i=r(22021),o=r(22807),n=r(17896),a=r(65617),s=r(12981);function l(e){return e?{origin:(0,a.a)(e.origin),vector:(0,a.a)(e.vector)}:{origin:(0,a.c)(),vector:(0,a.c)()}}function c(e,t,r=l()){return(0,n.c)(r.origin,e),(0,n.b)(r.vector,t,e),r}function d(e,t,r){return function(e,t,r,o,a){const{vector:l,origin:c}=e,d=(0,n.b)(s.WM.get(),t,c),u=(0,n.e)(l,d)/(0,n.p)(l);return(0,n.g)(a,l,(0,i.uZ)(u,0,1)),(0,n.a)(a,a,e.origin)}(e,t,0,0,r)}(0,a.c)(),(0,a.c)(),new o.x((()=>l()))},10007:(e,t,r)=>{r.d(t,{fetch:()=>Wt});var i=r(32243),o=r(21787),n=r(46521),a=r(52138),s=r(13598),l=r(17896),c=r(65617),d=r(60437),u=r(1533);function h(e,t=!1){return e<=u.DB?t?new Array(e).fill(0):new Array(e):new Float32Array(e)}var m=r(56481),f=r(20773),p=r(11077),g=r(10816),v=r(56067),_=r(75488),T=r(40270),x=r(91695),b=r(91911),E=r(15317),A=r(14682),S=r(1265);function w(e){if(null==e)return null;const t=null!=e.offset?e.offset:S.Z,r=null!=e.rotation?e.rotation:0,i=null!=e.scale?e.scale:S.O,n=(0,A.f)(1,0,0,0,1,0,t[0],t[1],1),a=(0,A.f)(Math.cos(r),-Math.sin(r),0,Math.sin(r),Math.cos(r),0,0,0,1),s=(0,A.f)(i[0],0,0,0,i[1],0,0,0,1),l=(0,A.c)();return(0,o.m)(l,a,s),(0,o.m)(l,n,l),l}class R{constructor(){this.geometries=new Array,this.materials=new Array,this.textures=new Array}}class C{constructor(e,t,r){this.name=e,this.lodThreshold=t,this.pivotOffset=r,this.stageResources=new R,this.numberOfVertices=0}}var y=r(3172),O=r(66643),M=r(43090),P=r(20102),I=r(92604);class N{constructor(){this._outer=new Map}clear(){this._outer.clear()}get empty(){return 0===this._outer.size}get(e,t){return this._outer.get(e)?.get(t)}set(e,t,r){const i=this._outer.get(e);i?i.set(t,r):this._outer.set(e,new Map([[t,r]]))}delete(e,t){const r=this._outer.get(e);r&&(r.delete(t),0===r.size&&this._outer.delete(e))}forEach(e){this._outer.forEach(((t,r)=>e(t,r)))}}var L=r(95330),D=r(23670);async function F(e,t){const{data:r}=await(0,y.default)(e,{responseType:"image",...t});return r}var H=r(51417),B=r(47026),U=r(22631),G=r(80442),V=r(32448),z=r(70586),W=r(17452),k=r(85958),$=r(99880);let j;var X,q;(q=X||(X={}))[q.ETC1_RGB=0]="ETC1_RGB",q[q.ETC2_RGBA=1]="ETC2_RGBA",q[q.BC1_RGB=2]="BC1_RGB",q[q.BC3_RGBA=3]="BC3_RGBA",q[q.BC4_R=4]="BC4_R",q[q.BC5_RG=5]="BC5_RG",q[q.BC7_M6_RGB=6]="BC7_M6_RGB",q[q.BC7_M5_RGBA=7]="BC7_M5_RGBA",q[q.PVRTC1_4_RGB=8]="PVRTC1_4_RGB",q[q.PVRTC1_4_RGBA=9]="PVRTC1_4_RGBA",q[q.ASTC_4x4_RGBA=10]="ASTC_4x4_RGBA",q[q.ATC_RGB=11]="ATC_RGB",q[q.ATC_RGBA=12]="ATC_RGBA",q[q.FXT1_RGB=17]="FXT1_RGB",q[q.PVRTC2_4_RGB=18]="PVRTC2_4_RGB",q[q.PVRTC2_4_RGBA=19]="PVRTC2_4_RGBA",q[q.ETC2_EAC_R11=20]="ETC2_EAC_R11",q[q.ETC2_EAC_RG11=21]="ETC2_EAC_RG11",q[q.RGBA32=13]="RGBA32",q[q.RGB565=14]="RGB565",q[q.BGR565=15]="BGR565",q[q.RGBA4444=16]="RGBA4444";var J=r(35371),Z=r(57088),Y=r(45762);let K=null,Q=null;async function ee(){return null==Q&&(Q=function(){if(null==j){const e=e=>(0,$.V)(`esri/libs/basisu/${e}`);j=r.e(1421).then(r.bind(r,21421)).then((e=>e.b)).then((({default:t})=>t({locateFile:e}).then((e=>(e.initializeBasis(),delete e.then,e)))))}return j}(),K=await Q),Q}function te(e,t,r,i,o){const n=(0,Y.RG)(t?J.q_.COMPRESSED_RGBA8_ETC2_EAC:J.q_.COMPRESSED_RGB8_ETC2),a=o&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*n*a)}function re(e){return e.getNumImages()>=1&&!e.isUASTC()}function ie(e){return e.getFaces()>=1&&e.isETC1S()}function oe(e,t,r,i,o,n,a,s){const{compressedTextureETC:l,compressedTextureS3TC:c}=e.capabilities,[d,u]=l?i?[X.ETC2_RGBA,J.q_.COMPRESSED_RGBA8_ETC2_EAC]:[X.ETC1_RGB,J.q_.COMPRESSED_RGB8_ETC2]:c?i?[X.BC3_RGBA,J.q_.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[X.BC1_RGB,J.q_.COMPRESSED_RGB_S3TC_DXT1_EXT]:[X.RGBA32,J.VI.RGBA],h=t.hasMipmap?r:Math.min(1,r),m=[];for(let e=0;e<h;e++)m.push(new Uint8Array(a(e,d))),s(e,d,m[e]);return t.internalFormat=u,t.hasMipmap=m.length>1,t.samplingMode=t.hasMipmap?J.cw.LINEAR_MIPMAP_LINEAR:J.cw.LINEAR,t.width=o,t.height=n,new Z.x(e,t,{type:"compressed",levels:m})}var ne=r(17662),ae=r(4726);const se=I.Z.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil");function le(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}const ce=le("DXT1"),de=le("DXT3"),ue=le("DXT5");var he,me,fe=r(11726),pe=r(47859);class ge extends ne.c{constructor(e,t){super(),this._data=e,this.type=ae.U.Texture,this._glTexture=null,this._loadingPromise=null,this._loadingController=null,this.events=new V.Z,this.parameters=t||{},this.parameters.mipmap=!1!==this.parameters.mipmap,this.parameters.noUnpackFlip=this.parameters.noUnpackFlip||!1,this.parameters.preMultiplyAlpha=this.parameters.preMultiplyAlpha||!1,this.parameters.wrap=this.parameters.wrap||{s:J.e8.REPEAT,t:J.e8.REPEAT},this._startPreload(e)}_startPreload(e){null!=e&&(e instanceof HTMLVideoElement?this._startPreloadVideoElement(e):e instanceof HTMLImageElement&&this._startPreloadImageElement(e))}_startPreloadVideoElement(e){if(!((0,W.jc)(e.src)||"auto"===e.preload&&e.crossOrigin)){e.preload="auto",e.crossOrigin="anonymous";const t=!e.paused;if(e.src=e.src,t&&e.autoplay){const t=()=>{e.removeEventListener("canplay",t),e.play()};e.addEventListener("canplay",t)}}}_startPreloadImageElement(e){(0,W.HK)(e.src)||(0,W.jc)(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}dispose(){this._data=void 0}_createDescriptor(e){const t=new pe.X;return t.wrapMode=this.parameters.wrap??J.e8.REPEAT,t.flipped=!this.parameters.noUnpackFlip,t.samplingMode=this.parameters.mipmap?J.cw.LINEAR_MIPMAP_LINEAR:J.cw.LINEAR,t.hasMipmap=!!this.parameters.mipmap,t.preMultiplyAlpha=!!this.parameters.preMultiplyAlpha,t.maxAnisotropy=this.parameters.maxAnisotropy??(this.parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t}get glTexture(){return this._glTexture}get memoryEstimate(){return this._glTexture?.gpuMemoryUsage||function(e,t){if(null==e)return 0;if((0,u.eP)(e)||(0,u.lq)(e))return t.encoding===B.Ti.KTX2_ENCODING?function(e,t){if(null==K)return e.byteLength;const r=new K.KTX2File(new Uint8Array(e)),i=ie(r)?te(r.getLevels(),r.getHasAlpha(),r.getWidth(),r.getHeight(),t):0;return r.close(),r.delete(),i}(e,!!t.mipmap):t.encoding===B.Ti.BASIS_ENCODING?function(e,t){if(null==K)return e.byteLength;const r=new K.BasisFile(new Uint8Array(e)),i=re(r)?te(r.getNumLevels(0),r.getHasAlpha(),r.getImageWidth(0,0),r.getImageHeight(0,0),t):0;return r.close(),r.delete(),i}(e,!!t.mipmap):e.byteLength;const{width:r,height:i}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?ve(e):t;return(t.mipmap?4/3:1)*r*i*(t.components||4)||0}(this._data,this.parameters)}load(e){if(null!=this._glTexture)return this._glTexture;if(this._loadingPromise)return this._loadingPromise;const t=this._data;return null==t?(this._glTexture=new Z.x(e,this._createDescriptor(e),null),this._glTexture):"string"==typeof t?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):((0,u.eP)(t)||(0,u.lq)(t))&&this.parameters.encoding===B.Ti.DDS_ENCODING?(this._data=void 0,this._loadFromDDSData(e,t)):((0,u.eP)(t)||(0,u.lq)(t))&&this.parameters.encoding===B.Ti.KTX2_ENCODING?(this._data=void 0,this._loadFromKTX2(e,t)):((0,u.eP)(t)||(0,u.lq)(t))&&this.parameters.encoding===B.Ti.BASIS_ENCODING?(this._data=void 0,this._loadFromBasis(e,t)):(0,u.lq)(t)?this._loadFromPixelData(e,t):(0,u.eP)(t)?this._loadFromPixelData(e,new Uint8Array(t)):null}get requiresFrameUpdates(){return this._data instanceof HTMLVideoElement}frameUpdate(e){return this._data instanceof HTMLVideoElement&&null!=this._glTexture?this._data.readyState<he.HAVE_CURRENT_DATA||e===this._data.currentTime?e:(this._glTexture.setData(this._data),this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this.parameters.updateCallback&&this.parameters.updateCallback(),this._data.currentTime):e}_loadFromDDSData(e,t){return this._glTexture=function(e,t,r){const i=function(e,t){const r=new Int32Array(e,0,31);if(542327876!==r[0])return se.error("Invalid magic number in DDS header"),null;if(!(4&r[20]))return se.error("Unsupported format, must contain a FourCC code"),null;const i=r[21];let o,n;switch(i){case ce:o=8,n=J.q_.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case de:o=16,n=J.q_.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case ue:o=16,n=J.q_.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return se.error("Unsupported FourCC code:",function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)}(i)),null}let a=1,s=r[4],l=r[3];0==(3&s)&&0==(3&l)||(se.warn("Rounding up compressed texture size to nearest multiple of 4."),s=s+3&-4,l=l+3&-4);const c=s,d=l;let u,h;131072&r[2]&&!1!==t&&(a=Math.max(1,r[7]));let m=r[1]+4;const f=[];for(let t=0;t<a;++t)h=(s+3>>2)*(l+3>>2)*o,u=new Uint8Array(e,m,h),f.push(u),m+=h,s=Math.max(1,s>>1),l=Math.max(1,l>>1);return{textureData:{type:"compressed",levels:f},internalFormat:n,width:c,height:d}}(r,t.hasMipmap??!1);if(null==i)throw new Error("DDS texture data is null");const{textureData:o,internalFormat:n,width:a,height:s}=i;return t.samplingMode=o.levels.length>1?J.cw.LINEAR_MIPMAP_LINEAR:J.cw.LINEAR,t.hasMipmap=o.levels.length>1,t.internalFormat=n,t.width=a,t.height=s,new Z.x(e,t,o)}(e,this._createDescriptor(e),t),this._glTexture}_loadFromKTX2(e,t){return this._loadAsync((()=>async function(e,t,r){null==K&&(K=await ee());const i=new K.KTX2File(new Uint8Array(r));if(!ie(i))return null;i.startTranscoding();const o=oe(e,t,i.getLevels(),i.getHasAlpha(),i.getWidth(),i.getHeight(),((e,t)=>i.getImageTranscodedSizeInBytes(e,0,0,t)),((e,t,r)=>i.transcodeImage(r,e,0,0,t,0,-1,-1)));return i.close(),i.delete(),o}(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromBasis(e,t){return this._loadAsync((()=>async function(e,t,r){null==K&&(K=await ee());const i=new K.BasisFile(new Uint8Array(r));if(!re(i))return null;i.startTranscoding();const o=oe(e,t,i.getNumLevels(0),i.getHasAlpha(),i.getImageWidth(0,0),i.getImageHeight(0,0),((e,t)=>i.getImageTranscodedSizeInBytes(0,e,t)),((e,t,r)=>i.transcodeImage(r,0,e,t,0,0)));return i.close(),i.delete(),o}(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromPixelData(e,t){(0,fe.hu)(this.parameters.width>0&&this.parameters.height>0);const r=this._createDescriptor(e);return r.pixelFormat=1===this.parameters.components?J.VI.LUMINANCE:3===this.parameters.components?J.VI.RGB:J.VI.RGBA,r.width=this.parameters.width??0,r.height=this.parameters.height??0,this._glTexture=new Z.x(e,r,t),this._glTexture}_loadFromURL(e,t){return this._loadAsync((async r=>{const i=await F(t,{signal:r});return(0,L.k_)(r),this._loadFromImage(e,i)}))}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync((async r=>{const i=await(0,k.fY)(t,t.src,!1,r);return(0,L.k_)(r),this._loadFromImage(e,i)}))}_loadFromVideoElement(e,t){return t.readyState>=he.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(e,t){return this._loadAsync((r=>new Promise(((i,o)=>{const n=()=>{t.removeEventListener("loadeddata",a),t.removeEventListener("error",s),(0,z.hw)(l)},a=()=>{t.readyState>=he.HAVE_CURRENT_DATA&&(n(),i(this._loadFromImage(e,t)))},s=e=>{n(),o(e||new P.Z("Failed to load video"))};t.addEventListener("loadeddata",a),t.addEventListener("error",s);const l=(0,L.fu)(r,(()=>s((0,L.zE)())))}))))}_loadFromImage(e,t){const r=ve(t);this.parameters.width=r.width,this.parameters.height=r.height;const i=this._createDescriptor(e);return i.pixelFormat=3===this.parameters.components?J.VI.RGB:J.VI.RGBA,i.width=r.width,i.height=r.height,this._glTexture=new Z.x(e,i,t),this._glTexture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const i=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null)};return r.then(i,i),r}unload(){if(this._glTexture=(0,z.M2)(this._glTexture),null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}}function ve(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}(me=he||(he={}))[me.HAVE_NOTHING=0]="HAVE_NOTHING",me[me.HAVE_METADATA=1]="HAVE_METADATA",me[me.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",me[me.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",me[me.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA";var _e=r(35065),Te=r(64822),xe=r(65576),be=r(55039),Ee=r(60624),Ae=r(19419),Se=r(85504),we=r(60537),Re=r(82791),Ce=r(93144),ye=r(27097);const Oe=(0,ye.wK)(J.zi.SRC_ALPHA,J.zi.ONE,J.zi.ONE_MINUS_SRC_ALPHA,J.zi.ONE_MINUS_SRC_ALPHA),Me=(0,ye.if)(J.zi.ONE,J.zi.ONE),Pe=(0,ye.if)(J.zi.ZERO,J.zi.ONE_MINUS_SRC_ALPHA);function Ie(e){return e===Ce.A.FrontFace?null:e===Ce.A.Alpha?Pe:Me}const Ne={factor:-1,units:-2};function Le(e,t=J.wb.LESS){return e===Ce.A.NONE||e===Ce.A.FrontFace?t:J.wb.LEQUAL}var De;!function(e){e[e.INTEGRATED_MESH=0]="INTEGRATED_MESH",e[e.OPAQUE_TERRAIN=1]="OPAQUE_TERRAIN",e[e.OPAQUE_MATERIAL=2]="OPAQUE_MATERIAL",e[e.TRANSPARENT_MATERIAL=3]="TRANSPARENT_MATERIAL",e[e.TRANSPARENT_TERRAIN=4]="TRANSPARENT_TERRAIN",e[e.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL=5]="TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL",e[e.OCCLUDED_TERRAIN=6]="OCCLUDED_TERRAIN",e[e.OCCLUDER_MATERIAL=7]="OCCLUDER_MATERIAL",e[e.TRANSPARENT_OCCLUDER_MATERIAL=8]="TRANSPARENT_OCCLUDER_MATERIAL",e[e.OCCLUSION_PIXELS=9]="OCCLUSION_PIXELS",e[e.ANTIALIASING=10]="ANTIALIASING",e[e.POSTPROCESSING_ENVIRONMENT_OPAQUE=11]="POSTPROCESSING_ENVIRONMENT_OPAQUE",e[e.POSTPROCESSING_ENVIRONMENT_TRANSPARENT=12]="POSTPROCESSING_ENVIRONMENT_TRANSPARENT",e[e.LASERLINES=13]="LASERLINES",e[e.LASERLINES_CONTRAST_CONTROL=14]="LASERLINES_CONTRAST_CONTROL",e[e.HUD_MATERIAL=15]="HUD_MATERIAL",e[e.LABEL_MATERIAL=16]="LABEL_MATERIAL",e[e.LINE_CALLOUTS=17]="LINE_CALLOUTS",e[e.LINE_CALLOUTS_HUD_DEPTH=18]="LINE_CALLOUTS_HUD_DEPTH",e[e.DRAPED_MATERIAL=19]="DRAPED_MATERIAL",e[e.DRAPED_WATER=20]="DRAPED_WATER",e[e.VOXEL=21]="VOXEL",e[e.MAX_SLOTS=22]="MAX_SLOTS"}(De||(De={}));var Fe=r(8310),He=r(87951);const Be=new class{constructor(e=0){this.offset=e,this.sphere=(0,Fe.c)(),this.tmpVertex=(0,c.c)()}applyToVertex(e,t,r){const i=this.objectTransform.transform,o=(0,l.s)(Ue,e,t,r),n=(0,l.m)(o,o,i),a=this.offset/(0,l.l)(n);(0,l.q)(n,n,n,a);const s=this.objectTransform.inverse;return(0,l.m)(this.tmpVertex,n,s),this.tmpVertex}applyToMinMax(e,t){const r=this.offset/(0,l.l)(e);(0,l.q)(e,e,e,r);const i=this.offset/(0,l.l)(t);(0,l.q)(t,t,t,i)}applyToAabb(e){const t=this.offset/Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]+=e[0]*t,e[1]+=e[1]*t,e[2]+=e[2]*t;const r=this.offset/Math.sqrt(e[3]*e[3]+e[4]*e[4]+e[5]*e[5]);return e[3]+=e[3]*r,e[4]+=e[4]*r,e[5]+=e[5]*r,e}applyToBoundingSphere(e){const t=(0,l.l)(e),r=this.offset/t;return(0,l.q)(this.sphere,e,e,r),this.sphere[3]=e[3]+e[3]*this.offset/t,this.sphere}};new class{constructor(e=0){this.componentLocalOriginLength=0,this._tmpVertex=(0,c.c)(),this._mbs=(0,Fe.c)(),this._obb=(0,He.Ue)(),this._totalOffset=0,this._offset=0,this._resetOffset(e)}_resetOffset(e){this._offset=e,this._totalOffset=e}set offset(e){this._resetOffset(e)}get offset(){return this._offset}set componentOffset(e){this._totalOffset=this._offset+e}set localOrigin(e){this.componentLocalOriginLength=(0,l.l)(e)}applyToVertex(e,t,r){const i=(0,l.s)(Ue,e,t,r),o=(0,l.s)(Ge,e,t,r+this.componentLocalOriginLength),n=this._totalOffset/(0,l.l)(o);return(0,l.q)(this._tmpVertex,i,o,n),this._tmpVertex}applyToAabb(e){const t=(0,l.s)(Ue,e[0],e[1],e[2]+this.componentLocalOriginLength),r=(0,l.s)(Ge,e[3],e[4],e[5]+this.componentLocalOriginLength),i=(0,l.r)(Ve,t),o=(0,l.r)(ze,r),n=(0,l.u)(We,t),a=(0,l.u)(ke,r),s=(0,l.v)($e,n,a);s[0]=i[0]*o[0]<0?0:s[0],s[1]=i[1]*o[1]<0?0:s[1],s[2]=i[2]*o[2]<0?0:s[2];const c=(0,l.l)(s);if(c<this._totalOffset)return e[0]-=t[0]<0?this._totalOffset:0,e[1]-=t[1]<0?this._totalOffset:0,e[2]-=t[2]<0?this._totalOffset:0,e[3]+=r[0]>0?this._totalOffset:0,e[4]+=r[1]>0?this._totalOffset:0,e[5]+=r[2]>0?this._totalOffset:0,e;const d=(0,l.w)($e,n,a),u=(0,l.l)(d),h=this._totalOffset/u,m=this._totalOffset/c;return e[0]+=t[0]*(t[0]>0?h:m),e[1]+=t[1]*(t[1]>0?h:m),e[2]+=t[2]*(t[2]>0?h:m),e[3]+=r[0]*(r[0]<0?h:m),e[4]+=r[1]*(r[1]<0?h:m),e[5]+=r[2]*(r[2]<0?h:m),e}applyToMbs(e){const t=(0,l.l)(e),r=this._totalOffset/t;return(0,l.q)(this._mbs,e,e,r),this._mbs[3]=e[3]+e[3]*this._totalOffset/t,this._mbs}applyToObb(e){return(0,He.gI)(e,this._totalOffset,this._totalOffset,Te.JY.Global,this._obb),this._obb}},new class{constructor(e=0){this.offset=e,this.tmpVertex=(0,c.c)()}applyToVertex(e,t,r){const i=(0,l.s)(Ue,e,t,r),o=(0,l.a)(Ge,i,this.localOrigin),n=this.offset/(0,l.l)(o);return(0,l.q)(this.tmpVertex,i,o,n),this.tmpVertex}applyToAabb(e){const t=Ve,r=ze,i=We;for(let o=0;o<3;++o)t[o]=e[0+o]+this.localOrigin[o],r[o]=e[3+o]+this.localOrigin[o],i[o]=t[o];const o=this.applyToVertex(t[0],t[1],t[2]);for(let t=0;t<3;++t)e[t]=o[t],e[t+3]=o[t];const n=t=>{const r=this.applyToVertex(t[0],t[1],t[2]);for(let t=0;t<3;++t)e[t]=Math.min(e[t],r[t]),e[t+3]=Math.max(e[t+3],r[t])};for(let e=1;e<8;++e){for(let o=0;o<3;++o)i[o]=0==(e&1<<o)?t[o]:r[o];n(i)}let a=0;for(let e=0;e<3;++e)t[e]*r[e]<0&&(a|=1<<e);if(0!==a&&7!==a)for(let e=0;e<8;++e)if(0==(a&e)){for(let o=0;o<3;++o)i[o]=0!=(a&1<<o)?0:0!=(e&1<<o)?t[o]:r[o];n(i)}for(let t=0;t<3;++t)e[t]-=this.localOrigin[t],e[t+3]-=this.localOrigin[t];return e}};const Ue=(0,c.c)(),Ge=(0,c.c)(),Ve=(0,c.c)(),ze=(0,c.c)(),We=(0,c.c)(),ke=(0,c.c)(),$e=(0,c.c)();function je(e,t,r,i){const o=r.typedBuffer,n=r.typedBufferStride,a=e.length;i*=n;for(let r=0;r<a;++r){const a=2*e[r];o[i]=t[a],o[i+1]=t[a+1],i+=n}}function Xe(e,t,r,i,o){const n=r.typedBuffer,a=r.typedBufferStride,s=e.length;if(i*=a,null==o||1===o)for(let r=0;r<s;++r){const o=3*e[r];n[i]=t[o],n[i+1]=t[o+1],n[i+2]=t[o+2],i+=a}else for(let r=0;r<s;++r){const s=3*e[r];for(let e=0;e<o;++e)n[i]=t[s],n[i+1]=t[s+1],n[i+2]=t[s+2],i+=a}}function qe(e,t,r,i,o=1){const n=r.typedBuffer,a=r.typedBufferStride,s=e.length;if(i*=a,1===o)for(let r=0;r<s;++r){const o=4*e[r];n[i]=t[o],n[i+1]=t[o+1],n[i+2]=t[o+2],n[i+3]=t[o+3],i+=a}else for(let r=0;r<s;++r){const s=4*e[r];for(let e=0;e<o;++e)n[i]=t[s],n[i+1]=t[s+1],n[i+2]=t[s+2],n[i+3]=t[s+3],i+=a}}function Je(e,t,r,i,o=1){const n=t.typedBuffer,a=t.typedBufferStride;if(i*=a,1===o)for(let t=0;t<r;++t)n[i]=e[0],n[i+1]=e[1],n[i+2]=e[2],n[i+3]=e[3],i+=a;else for(let t=0;t<r;++t)for(let t=0;t<o;++t)n[i]=e[0],n[i+1]=e[1],n[i+2]=e[2],n[i+3]=e[3],i+=a}function Ze(e,t,r,i,o,n,s){switch(e){case _e.T.POSITION:{(0,fe.hu)(3===t.size);const o=n.getField(e,m.ct);(0,fe.hu)(!!o,`No buffer view for ${e}`),o&&function(e,t,r,i,o,n=1){if(!r)return void Xe(e,t,i,o,n);const s=i.typedBuffer,l=i.typedBufferStride,c=e.length,d=r[0],u=r[1],h=r[2],m=r[4],f=r[5],p=r[6],g=r[8],v=r[9],_=r[10],T=r[12],x=r[13],b=r[14];o*=l;let E=0,A=0,S=0;const w=(0,a.y)(r)?e=>{E=t[e]+T,A=t[e+1]+x,S=t[e+2]+b}:e=>{const r=t[e],i=t[e+1],o=t[e+2];E=d*r+m*i+g*o+T,A=u*r+f*i+v*o+x,S=h*r+p*i+_*o+b};if(1===n)for(let t=0;t<c;++t)w(3*e[t]),s[o]=E,s[o+1]=A,s[o+2]=S,o+=l;else for(let t=0;t<c;++t){w(3*e[t]);for(let e=0;e<n;++e)s[o]=E,s[o+1]=A,s[o+2]=S,o+=l}}(r,t.data,i,o,s);break}case _e.T.NORMAL:{(0,fe.hu)(3===t.size);const i=n.getField(e,m.ct);(0,fe.hu)(!!i,`No buffer view for ${e}`),i&&function(e,t,r,i,o,n=1){if(!r)return void Xe(e,t,i,o,n);const s=r,l=i.typedBuffer,c=i.typedBufferStride,d=e.length,u=s[0],h=s[1],m=s[2],f=s[4],p=s[5],g=s[6],v=s[8],_=s[9],T=s[10],x=!(0,a.z)(s),b=1e-6,E=1-b;o*=c;let A=0,S=0,w=0;const R=(0,a.y)(s)?e=>{A=t[e],S=t[e+1],w=t[e+2]}:e=>{const r=t[e],i=t[e+1],o=t[e+2];A=u*r+f*i+v*o,S=h*r+p*i+_*o,w=m*r+g*i+T*o};if(1===n)if(x)for(let t=0;t<d;++t){R(3*e[t]);const r=A*A+S*S+w*w;if(r<E&&r>b){const e=1/Math.sqrt(r);l[o]=A*e,l[o+1]=S*e,l[o+2]=w*e}else l[o]=A,l[o+1]=S,l[o+2]=w;o+=c}else for(let t=0;t<d;++t)R(3*e[t]),l[o]=A,l[o+1]=S,l[o+2]=w,o+=c;else for(let t=0;t<d;++t){if(R(3*e[t]),x){const e=A*A+S*S+w*w;if(e<E&&e>b){const t=1/Math.sqrt(e);A*=t,S*=t,w*=t}}for(let e=0;e<n;++e)l[o]=A,l[o+1]=S,l[o+2]=w,o+=c}}(r,t.data,o,i,s);break}case _e.T.NORMALCOMPRESSED:{(0,fe.hu)(2===t.size);const i=n.getField(e,m.or);(0,fe.hu)(!!i,`No buffer view for ${e}`),i&&je(r,t.data,i,s);break}case _e.T.UV0:{(0,fe.hu)(2===t.size);const i=n.getField(e,m.Eu);(0,fe.hu)(!!i,`No buffer view for ${e}`),i&&je(r,t.data,i,s);break}case _e.T.COLOR:case _e.T.SYMBOLCOLOR:{const i=n.getField(e,m.mc);(0,fe.hu)(!!i,`No buffer view for ${e}`),(0,fe.hu)(3===t.size||4===t.size),!i||3!==t.size&&4!==t.size||function(e,t,r,i,o,n=1){const a=i.typedBuffer,s=i.typedBufferStride,l=e.length;if(o*=s,r!==t.length||4!==r)if(1!==n)if(4!==r)for(let r=0;r<l;++r){const i=3*e[r];for(let e=0;e<n;++e)a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=255,o+=s}else for(let r=0;r<l;++r){const i=4*e[r];for(let e=0;e<n;++e)a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=t[i+3],o+=s}else{if(4===r){for(let r=0;r<l;++r){const i=4*e[r];a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=t[i+3],o+=s}return}for(let r=0;r<l;++r){const i=3*e[r];a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=255,o+=s}}else{a[o]=t[0],a[o+1]=t[1],a[o+2]=t[2],a[o+3]=t[3];const e=new Uint32Array(i.typedBuffer.buffer,i.start),r=s/4,c=e[o/=4];o+=r;const d=l*n;for(let t=1;t<d;++t)e[o]=c,o+=r}}(r,t.data,t.size,i,s);break}case _e.T.COLORFEATUREATTRIBUTE:{const i=n.getField(e,m.ly);(0,fe.hu)(!!i,`No buffer view for ${e}`),(0,fe.hu)(1===t.size),i&&1===t.size&&function(e,t,r,i){const o=r.typedBuffer,n=r.typedBufferStride,a=e.length,s=t[0];i*=n;for(let e=0;e<a;++e)o[i]=s,i+=n}(r,t.data,i,s);break}case _e.T.TANGENT:{(0,fe.hu)(4===t.size);const i=n.getField(e,m.ek);(0,fe.hu)(!!i,`No buffer view for ${e}`),i&&function(e,t,r,i,o,n=1){if(!r)return void qe(e,t,i,o,n);const s=r,l=i.typedBuffer,c=i.typedBufferStride,d=e.length,u=s[0],h=s[1],m=s[2],f=s[4],p=s[5],g=s[6],v=s[8],_=s[9],T=s[10],x=!(0,a.z)(s),b=1e-6,E=1-b;if(o*=c,1===n)for(let r=0;r<d;++r){const i=4*e[r],n=t[i],a=t[i+1],s=t[i+2],d=t[i+3];let A=u*n+f*a+v*s,S=h*n+p*a+_*s,w=m*n+g*a+T*s;if(x){const e=A*A+S*S+w*w;if(e<E&&e>b){const t=1/Math.sqrt(e);A*=t,S*=t,w*=t}}l[o]=A,l[o+1]=S,l[o+2]=w,l[o+3]=d,o+=c}else for(let r=0;r<d;++r){const i=4*e[r],a=t[i],s=t[i+1],d=t[i+2],A=t[i+3];let S=u*a+f*s+v*d,w=h*a+p*s+_*d,R=m*a+g*s+T*d;if(x){const e=S*S+w*w+R*R;if(e<E&&e>b){const t=1/Math.sqrt(e);S*=t,w*=t,R*=t}}for(let e=0;e<n;++e)l[o]=S,l[o+1]=w,l[o+2]=R,l[o+3]=A,o+=c}}(r,t.data,o,i,s);break}case _e.T.PROFILERIGHT:case _e.T.PROFILEUP:case _e.T.PROFILEVERTEXANDNORMAL:case _e.T.FEATUREVALUE:{(0,fe.hu)(4===t.size);const i=n.getField(e,m.ek);(0,fe.hu)(!!i,`No buffer view for ${e}`),i&&qe(r,t.data,i,s)}}}class Ye{constructor(e){this.vertexBufferLayout=e}elementCount(e){return e.indices.get(_e.T.POSITION).length}write(e,t,r,i,o){!function(e,t,r,i,o,n){for(const a of t.fields.keys()){const t=e.vertexAttributes.get(a),s=e.indices.get(a);if(t&&s)Ze(a,t,s,r,i,o,n);else if(a===_e.T.OBJECTANDLAYERIDCOLOR&&null!=e.objectAndLayerIdColor){const t=e.indices.get(_e.T.POSITION);if((0,fe.hu)(!!t,`No buffer view for ${a}`),t){const r=t.length,i=o.getField(a,m.mc);Je(e.objectAndLayerIdColor,i,r,n)}}}}(r,this.vertexBufferLayout,e,t,i,o)}}var Ke=r(57790),Qe=r(88669),et=r(135),tt=r(15719),rt=r(96310),it=r(78869),ot=r(14589),nt=r(83475),at=r(59377);J.wb.LESS,J.wb.ALWAYS;const st={mask:255},lt={function:{func:J.wb.ALWAYS,ref:B.hU.OutlineVisualElementMask,mask:B.hU.OutlineVisualElementMask},operation:{fail:J.xS.KEEP,zFail:J.xS.KEEP,zPass:J.xS.ZERO}},ct={function:{func:J.wb.ALWAYS,ref:B.hU.OutlineVisualElementMask,mask:B.hU.OutlineVisualElementMask},operation:{fail:J.xS.KEEP,zFail:J.xS.KEEP,zPass:J.xS.REPLACE}};J.wb.EQUAL,B.hU.OutlineVisualElementMask,B.hU.OutlineVisualElementMask,J.xS.KEEP,J.xS.KEEP,J.xS.KEEP,J.wb.NOTEQUAL,B.hU.OutlineVisualElementMask,B.hU.OutlineVisualElementMask,J.xS.KEEP,J.xS.KEEP,J.xS.KEEP;const dt=[1,1,.5],ut=[0,.6,.2],ht=[0,1,.2];var mt=r(32078);class ft extends tt.d4{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=(0,c.g)(dt),this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=B.Vr.Back,this.isInstanced=!1,this.hasInstancedColor=!1,this.emissiveFactor=(0,c.f)(0,0,0),this.instancedDoublePrecision=!1,this.normalType=Ee.r.Attribute,this.receiveSSAO=!0,this.receiveShadows=!0,this.castShadows=!0,this.shadowMappingEnabled=!1,this.ambient=(0,c.f)(.2,.2,.2),this.diffuse=(0,c.f)(.8,.8,.8),this.externalColor=(0,Qe.f)(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=(0,c.c)(),this.hasSlicePlane=!1,this.hasSliceHighlight=!0,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.modelTransformation=null,this.transparent=!1,this.writeDepth=!0,this.customDepthTest=B.Gv.Less,this.textureAlphaMode=B.JJ.Blend,this.textureAlphaCutoff=rt.F,this.textureAlphaPremultiplied=!1,this.hasOccludees=!1,this.renderOccluded=Re.yD.Occlude,this.isDecoration=!1}}class pt extends ot.A{initializeConfiguration(e,t){t.spherical=e.viewingMode===Te.JY.Global,t.doublePrecisionRequiresObfuscation=e.rctx.driverTest.doublePrecisionRequiresObfuscation.result,t.textureCoordinateType=t.hasColorTexture||t.hasMetallicRoughnessTexture||t.hasEmissionTexture||t.hasOcclusionTexture||t.hasNormalTexture?et.N.Default:et.N.None,t.objectAndLayerIdColorInstanced=t.instanced}initializeProgram(e){return this._initializeProgram(e,pt.shader)}_initializeProgram(e,t){return new at.$(e.rctx,t.get().build(this.configuration),nt.i)}_convertDepthTestFunction(e){return e===B.Gv.Lequal?J.wb.LEQUAL:J.wb.LESS}_makePipeline(e,t){const r=this.configuration,i=e===Ce.A.NONE,o=e===Ce.A.FrontFace;return(0,ye.sm)({blending:r.output!==be.H.Color&&r.output!==be.H.Alpha||!r.transparent?null:i?Oe:Ie(e),culling:gt(r)?(0,ye.zp)(r.cullFace):null,depthTest:{func:Le(e,this._convertDepthTestFunction(r.customDepthTest))},depthWrite:(i||o)&&r.writeDepth?ye.LZ:null,colorWrite:ye.BK,stencilWrite:r.hasOccludees?st:null,stencilTest:r.hasOccludees?t?ct:lt:null,polygonOffset:i||o?null:(n=r.enableOffset,n?Ne:null)});var n}initializePipeline(){return this._occludeePipelineState=this._makePipeline(this.configuration.transparencyPassType,!0),this._makePipeline(this.configuration.transparencyPassType,!1)}getPipelineState(e,t){return t?this._occludeePipelineState:super.getPipelineState(e,t)}}function gt(e){return e.cullFace!==B.Vr.None||!e.hasSlicePlane&&!e.transparent&&!e.doubleSidedMode}pt.shader=new it.J(mt.D,(()=>r.e(9291).then(r.bind(r,79291))));var vt=r(43697),_t=r(51354),Tt=r(47624),xt=r(67498);class bt extends Tt.PO{}(0,vt._)([(0,_t.o)({constValue:!0})],bt.prototype,"hasSliceHighlight",void 0),(0,vt._)([(0,_t.o)({constValue:!1})],bt.prototype,"hasSliceInVertexProgram",void 0),(0,vt._)([(0,_t.o)({constValue:xt.P.Pass})],bt.prototype,"pbrTextureBindType",void 0);class Et extends bt{constructor(){super(...arguments),this.output=be.H.Color,this.alphaDiscardMode=B.JJ.Opaque,this.doubleSidedMode=Ae.q.None,this.pbrMode=Se.f7.Disabled,this.cullFace=B.Vr.None,this.transparencyPassType=Ce.A.NONE,this.normalType=Ee.r.Attribute,this.textureCoordinateType=et.N.None,this.customDepthTest=B.Gv.Less,this.spherical=!1,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.hasVerticalOffset=!1,this.hasSlicePlane=!1,this.hasSliceHighlight=!0,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasEmissionTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasScreenSizePerspective=!1,this.hasVertexTangents=!1,this.hasOccludees=!1,this.multipassEnabled=!1,this.hasModelTransformation=!1,this.offsetBackfaces=!1,this.vvSize=!1,this.vvColor=!1,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.textureAlphaPremultiplied=!1,this.instanced=!1,this.instancedColor=!1,this.objectAndLayerIdColorInstanced=!1,this.instancedDoublePrecision=!1,this.doublePrecisionRequiresObfuscation=!1,this.writeDepth=!0,this.transparent=!1,this.enableOffset=!0,this.cullAboveGround=!1,this.snowCover=!1,this.hasColorTextureTransform=!1,this.hasEmissionTextureTransform=!1,this.hasNormalTextureTransform=!1,this.hasOcclusionTextureTransform=!1,this.hasMetallicRoughnessTextureTransform=!1}}(0,vt._)([(0,_t.o)({count:be.H.COUNT})],Et.prototype,"output",void 0),(0,vt._)([(0,_t.o)({count:B.JJ.COUNT})],Et.prototype,"alphaDiscardMode",void 0),(0,vt._)([(0,_t.o)({count:Ae.q.COUNT})],Et.prototype,"doubleSidedMode",void 0),(0,vt._)([(0,_t.o)({count:Se.f7.COUNT})],Et.prototype,"pbrMode",void 0),(0,vt._)([(0,_t.o)({count:B.Vr.COUNT})],Et.prototype,"cullFace",void 0),(0,vt._)([(0,_t.o)({count:Ce.A.COUNT})],Et.prototype,"transparencyPassType",void 0),(0,vt._)([(0,_t.o)({count:Ee.r.COUNT})],Et.prototype,"normalType",void 0),(0,vt._)([(0,_t.o)({count:et.N.COUNT})],Et.prototype,"textureCoordinateType",void 0),(0,vt._)([(0,_t.o)({count:B.Gv.COUNT})],Et.prototype,"customDepthTest",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"spherical",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasVertexColors",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasSymbolColors",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasVerticalOffset",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasSlicePlane",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasSliceHighlight",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasColorTexture",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasMetallicRoughnessTexture",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasEmissionTexture",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasOcclusionTexture",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasNormalTexture",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasScreenSizePerspective",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasVertexTangents",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasOccludees",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"multipassEnabled",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasModelTransformation",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"offsetBackfaces",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"vvSize",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"vvColor",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"receiveShadows",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"receiveAmbientOcclusion",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"textureAlphaPremultiplied",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"instanced",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"instancedColor",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"objectAndLayerIdColorInstanced",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"instancedDoublePrecision",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"doublePrecisionRequiresObfuscation",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"writeDepth",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"transparent",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"enableOffset",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"cullAboveGround",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"snowCover",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasColorTextureTransform",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasEmissionTextureTransform",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasNormalTextureTransform",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasOcclusionTextureTransform",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasMetallicRoughnessTextureTransform",void 0),(0,vt._)([(0,_t.o)({constValue:!0})],Et.prototype,"hasVvInstancing",void 0),(0,vt._)([(0,_t.o)({constValue:!1})],Et.prototype,"useCustomDTRExponentForWater",void 0),(0,vt._)([(0,_t.o)({constValue:!1})],Et.prototype,"supportsTextureAtlas",void 0),(0,vt._)([(0,_t.o)({constValue:!0})],Et.prototype,"useFillLights",void 0);var At=r(41846);class St extends pt{initializeConfiguration(e,t){super.initializeConfiguration(e,t),t.hasMetallicRoughnessTexture=!1,t.hasEmissionTexture=!1,t.hasOcclusionTexture=!1,t.hasNormalTexture=!1,t.hasModelTransformation=!1,t.normalType=Ee.r.Attribute,t.doubleSidedMode=Ae.q.WindingOrder,t.hasVertexTangents=!1}initializeProgram(e){return this._initializeProgram(e,St.shader)}}St.shader=new it.J(At.R,(()=>r.e(8096).then(r.bind(r,38096))));class wt extends Re.F5{constructor(e){super(e,Ct),this.supportsEdges=!0,this._configuration=new Et,this._vertexBufferLayout=function(e){const t=(0,xe.U$)().vec3f(_e.T.POSITION);return e.normalType===Ee.r.Compressed?t.vec2i16(_e.T.NORMALCOMPRESSED,{glNormalized:!0}):t.vec3f(_e.T.NORMAL),e.hasVertexTangents&&t.vec4f(_e.T.TANGENT),(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&t.vec2f(_e.T.UV0),e.hasVertexColors&&t.vec4u8(_e.T.COLOR),e.hasSymbolColors&&t.vec4u8(_e.T.SYMBOLCOLOR),(0,G.Z)("enable-feature:objectAndLayerId-rendering")&&t.vec4u8(_e.T.OBJECTANDLAYERIDCOLOR),t}(this.parameters)}isVisibleForOutput(e){return e!==be.H.Shadow&&e!==be.H.ShadowExcludeHighlight&&e!==be.H.ShadowHighlight||this.parameters.castShadows}isVisible(){const e=this.parameters;if(!super.isVisible()||0===e.layerOpacity)return!1;const{hasInstancedColor:t,hasVertexColors:r,hasSymbolColors:i,vvColor:o}=e,n="replace"===e.colorMixMode,a=e.opacity>0,s=e.externalColor&&e.externalColor[3]>0,l=t||o||i;return r&&l?n||a:r?n?s:a:l?n||a:n?s:a}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasNormalTexture=!!this.parameters.normalTextureId,this._configuration.hasColorTexture=!!this.parameters.textureId,this._configuration.hasVertexTangents=this.parameters.hasVertexTangents,this._configuration.instanced=this.parameters.isInstanced,this._configuration.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasSliceHighlight=this.parameters.hasSliceHighlight,this._configuration.alphaDiscardMode=this.parameters.textureAlphaMode,this._configuration.normalType=this.parameters.normalType,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,null!=this.parameters.customDepthTest&&(this._configuration.customDepthTest=this.parameters.customDepthTest),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?B.Vr.None:this.parameters.cullFace,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.hasModelTransformation=null!=this.parameters.modelTransformation,e!==be.H.Color&&e!==be.H.Alpha||(this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this._configuration.doubleSidedMode=Ae.q.WindingOrder:this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?Ae.q.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?Ae.q.WindingOrder:Ae.q.None,this._configuration.instancedColor=this.parameters.hasInstancedColor,this._configuration.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this._configuration.receiveAmbientOcclusion=!!t.ssaoHelper.active&&this.parameters.receiveSSAO,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this._configuration.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?Se.f7.Schematic:Se.f7.Normal:Se.f7.Disabled,this._configuration.hasMetallicRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this._configuration.hasEmissionTexture=!!this.parameters.emissiveTextureId,this._configuration.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<5e5,this._configuration.snowCover=this.hasSnowCover(t),this._configuration.hasColorTextureTransform=!!this.parameters.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!this.parameters.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!this.parameters.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!this.parameters.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!this.parameters.metallicRoughnessTextureTransformMatrix),this._configuration}hasSnowCover(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}intersect(e,t,r,i,o,n){if(null!=this.parameters.verticalOffset){const e=r.camera;(0,l.s)(Nt,t[12],t[13],t[14]);let n=null;switch(r.viewingMode){case Te.JY.Global:n=(0,l.n)(Pt,Nt);break;case Te.JY.Local:n=(0,l.c)(Pt,Mt)}let a=0;const s=(0,l.b)(Lt,Nt,e.eye),c=(0,l.l)(s),d=(0,l.g)(s,s,1/c);let u=null;this.parameters.screenSizePerspective&&(u=(0,l.e)(n,d)),a+=(0,Ke.Hx)(e,c,this.parameters.verticalOffset,u??0,this.parameters.screenSizePerspective),(0,l.g)(n,n,a),(0,l.t)(It,n,r.transform.inverseRotation),i=(0,l.b)(yt,i,It),o=(0,l.b)(Ot,o,It)}(0,Ke.Bw)(e,r,i,o,function(e){return null!=e?(Be.offset=e,Be):null}(r.verticalOffset),n)}requiresSlot(e,t){return!(t!==be.H.Color&&t!==be.H.Alpha&&t!==be.H.Depth&&t!==be.H.Normal&&t!==be.H.Shadow&&t!==be.H.ShadowHighlight&&t!==be.H.ShadowExcludeHighlight&&t!==be.H.Highlight&&t!==be.H.ObjectAndLayerIdColor||e!==(this.parameters.transparent?this.parameters.writeDepth?De.TRANSPARENT_MATERIAL:De.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:De.OPAQUE_MATERIAL)&&e!==De.DRAPED_MATERIAL)}createGLMaterial(e){return new Rt(e)}createBufferWriter(){return new Ye(this._vertexBufferLayout)}}class Rt extends we.F{constructor(e){super({...e,...e.material.parameters})}_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMap.enabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output!==be.H.Color&&this._output!==be.H.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e));const t=this._material.parameters;this.updateTexture(t.textureId);const r=e.camera.viewInverseTransposeMatrix;return(0,l.s)(t.origin,r[3],r[7],r[11]),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(t.treeRendering?St:pt,e)}}const Ct=new class extends ft{constructor(){super(...arguments),this.initTextureTransparent=!1,this.treeRendering=!1,this.hasVertexTangents=!1}},yt=(0,c.c)(),Ot=(0,c.c)(),Mt=(0,c.f)(0,0,1),Pt=(0,c.c)(),It=(0,c.c)(),Nt=(0,c.c)(),Lt=(0,c.c)(),Dt=I.Z.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");function Ft(e){throw new P.Z("",`Request for object resource failed: ${e}`)}function Ht(e){const t=e.params,r=t.topology;let i=!0;switch(t.vertexAttributes||(Dt.warn("Geometry must specify vertex attributes"),i=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const r in t.vertexAttributes){const t=e[r];t&&t.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(Dt.warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),i=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(Dt.warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),i=!1)):(Dt.warn(`Indexed geometry does not specify face indices for '${r}' attribute`),i=!1)}}else Dt.warn("Indexed geometries must specify faces"),i=!1;break}default:Dt.warn(`Unsupported topology '${r}'`),i=!1}e.params.material||(Dt.warn("Geometry requires material"),i=!1);const o=e.params.vertexAttributes;for(const e in o)o[e].values||(Dt.warn("Geometries with externally defined attributes are not yet supported"),i=!1);return i}function Bt(e){const t=(0,d.cS)();return e.forEach((e=>{const r=e.boundingInfo;null!=r&&((0,d.pp)(t,r.bbMin),(0,d.pp)(t,r.bbMax))})),t}function Ut(e){switch(e){case"mask":return B.JJ.Mask;case"maskAndTransparency":return B.JJ.MaskBlend;case"none":return B.JJ.Opaque;default:return B.JJ.Blend}}function Gt(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const Vt=new D.G(1,2,"wosr");var zt=r(57758);async function Wt(e,t){const r=function(e){const t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);return t?{fileType:"gltf",url:t[1],specifiedLodIndex:null!=t[4]?Number(t[4]):null}:e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}((0,i.pJ)(e));if("wosr"===r.fileType){const e=await(t.cache?t.cache.loadWOSR(r.url,t):async function(e,t){const r=await async function(e,t){const r=null!=t&&t.streamDataRequester;if(r)return async function(e,t,r){const i=await(0,O.q6)(t.request(e,"json",r));if(!0===i.ok)return i.value;(0,L.r9)(i.error),Ft(i.error.details.url)}(e,r,t);const i=await(0,O.q6)((0,y.default)(e,t));if(!0===i.ok)return i.value.data;(0,L.r9)(i.error),Ft(i.error)}(e,t),i=await async function(e,t){const r=new Array;for(const i in e){const o=e[i],n=o.images[0].data;if(!n){Dt.warn("Externally referenced texture data is not yet supported");continue}const a=o.encoding+";base64,"+n,s="/textureDefinitions/"+i,l="rgba"===o.channels?o.alphaChannelUsage||"transparency":"none",c={noUnpackFlip:!0,wrap:{s:J.e8.REPEAT,t:J.e8.REPEAT},preMultiplyAlpha:Ut(l)!==B.JJ.Opaque},d=null!=t&&t.disableTextures?Promise.resolve(null):F(a,t);r.push(d.then((e=>({refId:s,image:e,parameters:c,alphaChannelUsage:l}))))}const i=await Promise.all(r),o={};for(const e of i)o[e.refId]=e;return o}(r.textureDefinitions??{},t);let o=0;for(const e in i)if(i.hasOwnProperty(e)){const t=i[e];o+=t?.image?t.image.width*t.image.height*4:0}return{resource:r,textures:i,size:o+(0,M.Ul)(r)}}(r.url,t)),{engineResources:i,referenceBoundingBox:o}=function(e,t){const r=new Array,i=new Array,o=new Array,n=new N,a=e.resource,s=D.G.parse(a.version||"1.0","wosr");Vt.validate(s);const l=a.model.name,d=a.model.geometries,u=a.materialDefinitions??{},h=e.textures;let m=0;const f=new Map;for(let e=0;e<d.length;e++){const a=d[e];if(!Ht(a))continue;const s=Gt(a),l=a.params.vertexAttributes,p=[];for(const e in l){const t=l[e],r=t.values;p.push([e,new H.a(r,t.valuesPerElement,!0)])}const g=[];if("PerAttributeArray"!==a.params.topology){const e=a.params.faces;for(const t in e)g.push([t,e[t].values])}const v=s.texture,_=h&&h[v];if(_&&!f.has(v)){const{image:e,parameters:t}=_,r=new ge(e,t);i.push(r),f.set(v,r)}const T=f.get(v),x=T?T.id:void 0,b=s.material;let E=n.get(b,v);if(null==E){const e=u[b.substring(b.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=_&&_.alphaChannelUsage,i=e.transparency>0||"transparency"===r||"maskAndTransparency"===r,o=_?Ut(_.alphaChannelUsage):void 0,a={ambient:(0,c.g)(e.diffuse),diffuse:(0,c.g)(e.diffuse),opacity:1-(e.transparency||0),transparent:i,textureAlphaMode:o,textureAlphaCutoff:.33,textureId:x,initTextureTransparent:!0,doubleSided:!0,cullFace:B.Vr.None,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:_?.parameters.preMultiplyAlpha??!1};null!=t&&t.materialParamsMixin&&Object.assign(a,t.materialParamsMixin),E=new wt(a),n.set(b,v,E)}o.push(E);const A=new U.Z(E,p,g);m+=g.find((e=>e[0]===_e.T.POSITION))?.[1].length??0,r.push(A)}return{engineResources:[{name:l,stageResources:{textures:i,materials:o,geometries:r},pivotOffset:a.model.pivotOffset,numberOfVertices:m,lodThreshold:null}],referenceBoundingBox:Bt(r)}}(e,t);return{lods:i,referenceBoundingBox:o,isEsriSymbolResource:!1,isWosr:!0}}const n=await(t.cache?t.cache.loadGLTF(r.url,t,!!t.usePBR):(0,x.Q)(new T.C(t.streamDataRequester),r.url,t,t.usePBR)),u=n.model.meta?.ESRI_proxyEllipsoid,A=n.meta.isEsriSymbolResource&&null!=u&&n.meta.uri.includes("/RealisticTrees/");A&&!n.customMeta.esriTreeRendering&&(n.customMeta.esriTreeRendering=!0,function(e,t){for(let r=0;r<e.model.lods.length;++r){const i=e.model.lods[r];for(const o of i.parts){const i=o.attributes.normal;if(null==i)return;const n=o.attributes.position,d=n.count,u=(0,c.c)(),h=(0,c.c)(),f=(0,c.c)(),p=new Uint8Array(4*d),g=new Float64Array(3*d),v=(0,a.a)((0,s.c)(),o.transform);let _=0,T=0;for(let a=0;a<d;a++){n.getVec(a,h),i.getVec(a,u),(0,l.m)(h,h,o.transform),(0,l.b)(f,h,t.center),(0,l.E)(f,f,t.radius);const s=f[2],c=(0,l.l)(f),d=Math.min(.45+.55*c*c,1);(0,l.E)(f,f,t.radius),null!==v&&(0,l.m)(f,f,v),(0,l.n)(f,f),r+1!==e.model.lods.length&&e.model.lods.length>1&&(0,l.h)(f,f,u,s>-1?.2:Math.min(-4*s-3.8,1)),g[_]=f[0],g[_+1]=f[1],g[_+2]=f[2],_+=3,p[T]=255*d,p[T+1]=255*d,p[T+2]=255*d,p[T+3]=255,T+=4}o.attributes.normal=new m.ct(g),o.attributes.color=new m.mc(p)}}}(n,u));const S=!!t.usePBR,R=n.meta.isEsriSymbolResource?{usePBR:S,isSchematic:!1,treeRendering:A,mrrFactors:[...ht]}:{usePBR:S,isSchematic:!1,treeRendering:!1,mrrFactors:[...dt]},P={...t.materialParamsMixin,treeRendering:A},{engineResources:I,referenceBoundingBox:G}=function(e,t,r,i){const n=e.model,a=new Array,s=new Map,u=new Map,T=n.lods.length,x=(0,d.cS)();return n.lods.forEach(((e,A)=>{const S=!0===i.skipHighLods&&(T>1&&0===A||T>3&&1===A)||!1===i.skipHighLods&&null!=i.singleLodIndex&&A!==i.singleLodIndex;if(S&&0!==A)return;const R=new C(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach((e=>{const i=S?new wt({}):function(e,t,r,i,o,n,a){const s=t.material+(t.attributes.normal?"_normal":"")+(t.attributes.color?"_color":"")+(t.attributes.texCoord0?"_texCoord0":"")+(t.attributes.tangent?"_tangent":""),d=e.materials.get(t.material),u=null!=t.attributes.texCoord0,h=null!=t.attributes.normal;if(null==d)return null;const m=function(e){switch(e){case"BLEND":return B.JJ.Blend;case"MASK":return B.JJ.Mask;case"OPAQUE":case null:case void 0:return B.JJ.Opaque}}(d.alphaMode);if(!n.has(s)){if(u){const t=(t,r=!1)=>{if(null!=t&&!a.has(t)){const i=e.textures.get(t);if(null!=i){const e=i.data;a.set(t,new ge((0,E.$A)(e)?e.data:e,{...i.parameters,preMultiplyAlpha:!(0,E.$A)(e)&&r,encoding:(0,E.$A)(e)&&null!=e.encoding?e.encoding:void 0}))}}};t(d.textureColor,m!==B.JJ.Opaque),t(d.textureNormal),t(d.textureOcclusion),t(d.textureEmissive),t(d.textureMetallicRoughness)}const r=d.color[0]**(1/zt.K),f=d.color[1]**(1/zt.K),p=d.color[2]**(1/zt.K),g=d.emissiveFactor[0]**(1/zt.K),v=d.emissiveFactor[1]**(1/zt.K),_=d.emissiveFactor[2]**(1/zt.K),T=null!=d.textureColor&&u?a.get(d.textureColor):null,x=function({normalTexture:e,metallicRoughnessTexture:t,metallicFactor:r,roughnessFactor:i,emissiveTexture:o,emissiveFactor:n,occlusionTexture:a}){return null==e&&null==t&&null==o&&(null==n||(0,l.k)(n,c.Z))&&null==a&&(null==i||1===i)&&(null==r||1===r||0===r)}({normalTexture:d.textureNormal,metallicRoughnessTexture:d.textureMetallicRoughness,metallicFactor:d.metallicFactor,roughnessFactor:d.roughnessFactor,emissiveTexture:d.textureEmissive,emissiveFactor:d.emissiveFactor,occlusionTexture:d.textureOcclusion});n.set(s,new wt({...i,transparent:m===B.JJ.Blend,customDepthTest:B.Gv.Lequal,textureAlphaMode:m,textureAlphaCutoff:d.alphaCutoff,diffuse:[r,f,p],ambient:[r,f,p],opacity:d.opacity,doubleSided:d.doubleSided,doubleSidedType:"winding-order",cullFace:d.doubleSided?B.Vr.None:B.Vr.Back,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:h?Ee.r.Attribute:Ee.r.ScreenDerivative,castShadows:!0,receiveSSAO:!0,textureId:null!=T?T.id:void 0,colorMixMode:d.colorMixMode,normalTextureId:null!=d.textureNormal&&u?a.get(d.textureNormal).id:void 0,textureAlphaPremultiplied:null!=T&&!!T.parameters.preMultiplyAlpha,occlusionTextureId:null!=d.textureOcclusion&&u?a.get(d.textureOcclusion).id:void 0,emissiveTextureId:null!=d.textureEmissive&&u?a.get(d.textureEmissive).id:void 0,metallicRoughnessTextureId:null!=d.textureMetallicRoughness&&u?a.get(d.textureMetallicRoughness).id:void 0,emissiveFactor:[g,v,_],mrrFactors:x?[...ut]:[d.metallicFactor,d.roughnessFactor,i.mrrFactors[2]],isSchematic:x,colorTextureTransformMatrix:w(d.colorTextureTransform),normalTextureTransformMatrix:w(d.normalTextureTransform),occlusionTextureTransformMatrix:w(d.occlusionTextureTransform),emissiveTextureTransformMatrix:w(d.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:w(d.metallicRoughnessTextureTransform),...o}))}const f=n.get(s);if(r.stageResources.materials.push(f),u){const e=e=>{null!=e&&r.stageResources.textures.push(a.get(e))};e(d.textureColor),e(d.textureNormal),e(d.textureOcclusion),e(d.textureEmissive),e(d.textureMetallicRoughness)}return f}(n,e,R,t,r,s,u),{geometry:a,vertexCount:T}=function(e,t){const r=e.attributes.position.count,i=(0,b.p)(e.indices||r,e.primitiveType),n=h(3*r),{typedBuffer:a,typedBufferStride:s}=e.attributes.position;(0,f.t)(n,a,e.transform,3,s);const l=[[_e.T.POSITION,new H.a(n,3,!0)]],c=[[_e.T.POSITION,i]];if(null!=e.attributes.normal){const t=h(3*r),{typedBuffer:n,typedBufferStride:a}=e.attributes.normal;(0,o.d)(kt,e.transform),(0,f.a)(t,n,kt,3,a),l.push([_e.T.NORMAL,new H.a(t,3,!0)]),c.push([_e.T.NORMAL,i])}if(null!=e.attributes.tangent){const t=h(4*r),{typedBuffer:n,typedBufferStride:a}=e.attributes.tangent;(0,o.d)(kt,e.transform),(0,p.t)(t,n,kt,4,a),l.push([_e.T.TANGENT,new H.a(t,4,!0)]),c.push([_e.T.TANGENT,i])}if(null!=e.attributes.texCoord0){const t=h(2*r),{typedBuffer:o,typedBufferStride:n}=e.attributes.texCoord0;(0,g.n)(t,o,2,n),l.push([_e.T.UV0,new H.a(t,2,!0)]),c.push([_e.T.UV0,i])}if(null!=e.attributes.color){const t=new Uint8Array(4*r);4===e.attributes.color.elementCount?e.attributes.color instanceof m.ek?(0,p.s)(t,e.attributes.color,255):e.attributes.color instanceof m.mc?(0,_.c)(t,e.attributes.color):e.attributes.color instanceof m.v6&&(0,p.s)(t,e.attributes.color,1/256):(t.fill(255),e.attributes.color instanceof m.ct?(0,f.s)(t,e.attributes.color,255,4):e.attributes.color instanceof m.ne?(0,v.c)(t,e.attributes.color.typedBuffer,4,e.attributes.color.typedBufferStride):e.attributes.color instanceof m.mw&&(0,f.s)(t,e.attributes.color,1/256,4)),l.push([_e.T.COLOR,new H.a(t,4,!0)]),c.push([_e.T.COLOR,i])}return{geometry:new U.Z(t,l,c),vertexCount:r}}(e,null!=i?i:new wt({})),C=a.boundingInfo;null!=C&&0===A&&((0,d.pp)(x,C.bbMin),(0,d.pp)(x,C.bbMax)),null!=i&&(R.stageResources.geometries.push(a),R.numberOfVertices+=T)})),S||a.push(R)})),{engineResources:a,referenceBoundingBox:x}}(n,R,P,t.skipHighLods&&null==r.specifiedLodIndex?{skipHighLods:!0}:{skipHighLods:!1,singleLodIndex:r.specifiedLodIndex});return{lods:I,referenceBoundingBox:G,isEsriSymbolResource:n.meta.isEsriSymbolResource,isWosr:!1}}const kt=(0,n.c)()},1391:(e,t,r)=>{r.d(t,{Zu:()=>l,bA:()=>c,qj:()=>d});var i=r(55039),o=r(2095),n=r(19693),a=r(74709);function s(e){e.varyings.add("linearDepth","float")}function l(e){e.vertex.uniforms.add(new n.A("nearFar",((e,t)=>t.camera.nearFar)))}function c(e){e.vertex.code.add(a.H`float calculateLinearDepth(vec2 nearFar,float z) {
|
|
285
|
+
`),e}const p=Object.freeze(Object.defineProperty({__proto__:null,build:f},Symbol.toStringTag,{value:"Module"}))},14682:(e,t,r)=>{function i(){const e=new Float32Array(9);return e[0]=1,e[4]=1,e[8]=1,e}function o(e,t,r,i,o,n,a,s,l){const c=new Float32Array(9);return c[0]=e,c[1]=t,c[2]=r,c[3]=i,c[4]=o,c[5]=n,c[6]=a,c[7]=s,c[8]=l,c}r.d(t,{c:()=>i,f:()=>o}),Object.freeze(Object.defineProperty({__proto__:null,clone:function(e){const t=new Float32Array(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},create:i,createView:function(e,t){return new Float32Array(e,t,9)},fromValues:o},Symbol.toStringTag,{value:"Module"}))},1265:(e,t,r)=>{function i(){return new Float32Array(2)}function o(e,t){const r=new Float32Array(2);return r[0]=e,r[1]=t,r}function n(){return i()}function a(){return o(1,1)}function s(){return o(1,0)}function l(){return o(0,1)}r.d(t,{O:()=>d,Z:()=>c,c:()=>i,f:()=>o});const c=n(),d=a(),u=s(),h=l();Object.freeze(Object.defineProperty({__proto__:null,ONES:d,UNIT_X:u,UNIT_Y:h,ZEROS:c,clone:function(e){const t=new Float32Array(2);return t[0]=e[0],t[1]=e[1],t},create:i,createView:function(e,t){return new Float32Array(e,t,2)},fromValues:o,ones:a,unitX:s,unitY:l,zeros:n},Symbol.toStringTag,{value:"Module"}))},20773:(e,t,r)=>{r.d(t,{a:()=>s,b:()=>a,c:()=>o,d:()=>d,e:()=>l,n:()=>u,s:()=>c,t:()=>n});var i=r(72220);function o(e,t,r){n(e.typedBuffer,t.typedBuffer,r,e.typedBufferStride,t.typedBufferStride)}function n(e,t,r,o=3,n=o){if(e.length/o!==Math.ceil(t.length/n))return i.c.error("source and destination buffers need to have the same number of elements"),e;const a=e.length/o,s=r[0],l=r[1],c=r[2],d=r[4],u=r[5],h=r[6],m=r[8],f=r[9],p=r[10],g=r[12],v=r[13],_=r[14];let T=0,x=0;for(let r=0;r<a;r++){const r=t[T],i=t[T+1],a=t[T+2];e[x]=s*r+d*i+m*a+g,e[x+1]=l*r+u*i+f*a+v,e[x+2]=c*r+h*i+p*a+_,T+=n,x+=o}return e}function a(e,t,r){s(e.typedBuffer,t.typedBuffer,r,e.typedBufferStride,t.typedBufferStride)}function s(e,t,r,o=3,n=o){if(e.length/o!==Math.ceil(t.length/n))return void i.c.error("source and destination buffers need to have the same number of elements");const a=e.length/o,s=r[0],l=r[1],c=r[2],d=r[3],u=r[4],h=r[5],m=r[6],f=r[7],p=r[8];let g=0,v=0;for(let r=0;r<a;r++){const r=t[g],i=t[g+1],a=t[g+2];e[v]=s*r+d*i+m*a,e[v+1]=l*r+u*i+f*a,e[v+2]=c*r+h*i+p*a,g+=n,v+=o}}function l(e,t,r){c(e.typedBuffer,t,r,e.typedBufferStride)}function c(e,t,r,i=3){const o=Math.min(e.length/i,t.count),n=t.typedBuffer,a=t.typedBufferStride;let s=0,l=0;for(let t=0;t<o;t++)e[l]=r*n[s],e[l+1]=r*n[s+1],e[l+2]=r*n[s+2],s+=a,l+=i}function d(e,t){u(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)}function u(e,t,r=3,i=r){const o=Math.min(e.length/r,t.length/i);let n=0,a=0;for(let s=0;s<o;s++){const o=t[n],s=t[n+1],l=t[n+2],c=o*o+s*s+l*l;if(c>0){const t=1/Math.sqrt(c);e[a]=t*o,e[a+1]=t*s,e[a+2]=t*l}n+=i,a+=r}}Object.freeze(Object.defineProperty({__proto__:null,normalize:u,normalizeView:d,scale:c,scaleView:l,shiftRight:function(e,t,r){const i=Math.min(e.count,t.count),o=e.typedBuffer,n=e.typedBufferStride,a=t.typedBuffer,s=t.typedBufferStride;let l=0,c=0;for(let e=0;e<i;e++)o[c]=a[l]>>r,o[c+1]=a[l+1]>>r,o[c+2]=a[l+2]>>r,l+=s,c+=n},transformMat3:s,transformMat3View:a,transformMat4:n,transformMat4View:o},Symbol.toStringTag,{value:"Module"}))},23670:(e,t,r)=>{r.d(t,{G:()=>o});var i=r(20102);let o=class{constructor(e,t,r=""){this.major=e,this.minor=t,this._context=r}lessThan(e,t){return this.major<e||e===this.major&&this.minor<t}since(e,t){return!this.lessThan(e,t)}validate(e){if(this.major!==e.major){const t=this._context&&this._context+":",r=this._context&&this._context+" ";throw new i.Z(t+"unsupported-version",`Required major ${r}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:e})}}clone(){return new o(this.major,this.minor,this._context)}static parse(e,t=""){const[r,n]=e.split("."),a=/^\s*\d+\s*$/;if(!r||!r.match||!a.test(r))throw new i.Z((t&&t+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:e});if(!n||!n.match||!a.test(n))throw new i.Z((t&&t+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:e});const s=parseInt(r,10),l=parseInt(n,10);return new o(s,l,t)}}},43090:(e,t,r)=>{function i(e){return 32+e.length}function o(e){if(!e)return 0;let t=l;for(const r in e)if(e.hasOwnProperty(r)){const o=e[r];switch(typeof o){case"string":t+=i(o);break;case"number":t+=16;break;case"boolean":t+=4}}return t}function n(e){if(!e)return 0;if(Array.isArray(e))return function(e){const t=e.length;if(0===t||"number"==typeof e[0])return 32+8*t;let r=c;for(let i=0;i<t;i++)r+=a(e[i]);return r}(e);let t=l;for(const r in e)e.hasOwnProperty(r)&&(t+=a(e[r]));return t}function a(e){switch(typeof e){case"object":return n(e);case"string":return i(e);case"number":return 16;case"boolean":return 4;default:return 8}}function s(e,t){return c+e.length*t}r.d(t,{Ul:()=>n,do:()=>s,f2:()=>o});const l=32,c=32},32243:(e,t,r)=>{function i(e){return e=e||globalThis.location.hostname,c.some((t=>null!=e?.match(t)))}function o(e,t){return e&&(t=t||globalThis.location.hostname)?null!=t.match(n)||null!=t.match(s)?e.replace("static.arcgis.com","staticdev.arcgis.com"):null!=t.match(a)||null!=t.match(l)?e.replace("static.arcgis.com","staticqa.arcgis.com"):e:e}r.d(t,{XO:()=>i,pJ:()=>o});const n=/^devext.arcgis.com$/,a=/^qaext.arcgis.com$/,s=/^[\w-]*\.mapsdevext.arcgis.com$/,l=/^[\w-]*\.mapsqa.arcgis.com$/,c=[/^([\w-]*\.)?[\w-]*\.zrh-dev-local.esri.com$/,n,a,/^jsapps.esri.com$/,s,l]},72220:(e,t,r)=>{r.d(t,{c:()=>i});const i=r(92604).Z.getLogger("esri.views.3d.support.buffer.math")},16996:(e,t,r)=>{r.d(t,{Ue:()=>l,nF:()=>d,zk:()=>c});var i=r(22021),o=r(22807),n=r(17896),a=r(65617),s=r(12981);function l(e){return e?{origin:(0,a.a)(e.origin),vector:(0,a.a)(e.vector)}:{origin:(0,a.c)(),vector:(0,a.c)()}}function c(e,t,r=l()){return(0,n.c)(r.origin,e),(0,n.b)(r.vector,t,e),r}function d(e,t,r){return function(e,t,r,o,a){const{vector:l,origin:c}=e,d=(0,n.b)(s.WM.get(),t,c),u=(0,n.e)(l,d)/(0,n.p)(l);return(0,n.g)(a,l,(0,i.uZ)(u,0,1)),(0,n.a)(a,a,e.origin)}(e,t,0,0,r)}(0,a.c)(),(0,a.c)(),new o.x((()=>l()))},10007:(e,t,r)=>{r.d(t,{fetch:()=>Wt});var i=r(32243),o=r(21787),n=r(46521),a=r(52138),s=r(13598),l=r(17896),c=r(65617),d=r(60437),u=r(1533);function h(e,t=!1){return e<=u.DB?t?new Array(e).fill(0):new Array(e):new Float32Array(e)}var m=r(56481),f=r(20773),p=r(11077),g=r(10816),v=r(56067),_=r(75488),T=r(40270),x=r(91695),b=r(91911),E=r(15317),A=r(14682),S=r(1265);function w(e){if(null==e)return null;const t=null!=e.offset?e.offset:S.Z,r=null!=e.rotation?e.rotation:0,i=null!=e.scale?e.scale:S.O,n=(0,A.f)(1,0,0,0,1,0,t[0],t[1],1),a=(0,A.f)(Math.cos(r),-Math.sin(r),0,Math.sin(r),Math.cos(r),0,0,0,1),s=(0,A.f)(i[0],0,0,0,i[1],0,0,0,1),l=(0,A.c)();return(0,o.m)(l,a,s),(0,o.m)(l,n,l),l}class R{constructor(){this.geometries=new Array,this.materials=new Array,this.textures=new Array}}class C{constructor(e,t,r){this.name=e,this.lodThreshold=t,this.pivotOffset=r,this.stageResources=new R,this.numberOfVertices=0}}var y=r(3172),O=r(66643),M=r(43090),P=r(20102),I=r(92604);class N{constructor(){this._outer=new Map}clear(){this._outer.clear()}get empty(){return 0===this._outer.size}get(e,t){return this._outer.get(e)?.get(t)}set(e,t,r){const i=this._outer.get(e);i?i.set(t,r):this._outer.set(e,new Map([[t,r]]))}delete(e,t){const r=this._outer.get(e);r&&(r.delete(t),0===r.size&&this._outer.delete(e))}forEach(e){this._outer.forEach(((t,r)=>e(t,r)))}}var L=r(95330),D=r(23670);async function F(e,t){const{data:r}=await(0,y.default)(e,{responseType:"image",...t});return r}var H=r(51417),B=r(47026),U=r(22631),G=r(80442),V=r(32448),z=r(70586),W=r(17452),k=r(85958),$=r(99880);let j;var X,q;(q=X||(X={}))[q.ETC1_RGB=0]="ETC1_RGB",q[q.ETC2_RGBA=1]="ETC2_RGBA",q[q.BC1_RGB=2]="BC1_RGB",q[q.BC3_RGBA=3]="BC3_RGBA",q[q.BC4_R=4]="BC4_R",q[q.BC5_RG=5]="BC5_RG",q[q.BC7_M6_RGB=6]="BC7_M6_RGB",q[q.BC7_M5_RGBA=7]="BC7_M5_RGBA",q[q.PVRTC1_4_RGB=8]="PVRTC1_4_RGB",q[q.PVRTC1_4_RGBA=9]="PVRTC1_4_RGBA",q[q.ASTC_4x4_RGBA=10]="ASTC_4x4_RGBA",q[q.ATC_RGB=11]="ATC_RGB",q[q.ATC_RGBA=12]="ATC_RGBA",q[q.FXT1_RGB=17]="FXT1_RGB",q[q.PVRTC2_4_RGB=18]="PVRTC2_4_RGB",q[q.PVRTC2_4_RGBA=19]="PVRTC2_4_RGBA",q[q.ETC2_EAC_R11=20]="ETC2_EAC_R11",q[q.ETC2_EAC_RG11=21]="ETC2_EAC_RG11",q[q.RGBA32=13]="RGBA32",q[q.RGB565=14]="RGB565",q[q.BGR565=15]="BGR565",q[q.RGBA4444=16]="RGBA4444";var J=r(35371),Z=r(57088),Y=r(45762);let K=null,Q=null;async function ee(){return null==Q&&(Q=function(){if(null==j){const e=e=>(0,$.V)(`esri/libs/basisu/${e}`);j=r.e(1421).then(r.bind(r,21421)).then((e=>e.b)).then((({default:t})=>t({locateFile:e}).then((e=>(e.initializeBasis(),delete e.then,e)))))}return j}(),K=await Q),Q}function te(e,t,r,i,o){const n=(0,Y.RG)(t?J.q_.COMPRESSED_RGBA8_ETC2_EAC:J.q_.COMPRESSED_RGB8_ETC2),a=o&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*n*a)}function re(e){return e.getNumImages()>=1&&!e.isUASTC()}function ie(e){return e.getFaces()>=1&&e.isETC1S()}function oe(e,t,r,i,o,n,a,s){const{compressedTextureETC:l,compressedTextureS3TC:c}=e.capabilities,[d,u]=l?i?[X.ETC2_RGBA,J.q_.COMPRESSED_RGBA8_ETC2_EAC]:[X.ETC1_RGB,J.q_.COMPRESSED_RGB8_ETC2]:c?i?[X.BC3_RGBA,J.q_.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[X.BC1_RGB,J.q_.COMPRESSED_RGB_S3TC_DXT1_EXT]:[X.RGBA32,J.VI.RGBA],h=t.hasMipmap?r:Math.min(1,r),m=[];for(let e=0;e<h;e++)m.push(new Uint8Array(a(e,d))),s(e,d,m[e]);return t.internalFormat=u,t.hasMipmap=m.length>1,t.samplingMode=t.hasMipmap?J.cw.LINEAR_MIPMAP_LINEAR:J.cw.LINEAR,t.width=o,t.height=n,new Z.x(e,t,{type:"compressed",levels:m})}var ne=r(17662),ae=r(4726);const se=I.Z.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil");function le(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}const ce=le("DXT1"),de=le("DXT3"),ue=le("DXT5");var he,me,fe=r(11726),pe=r(47859);class ge extends ne.c{constructor(e,t){super(),this._data=e,this.type=ae.U.Texture,this._glTexture=null,this._loadingPromise=null,this._loadingController=null,this.events=new V.Z,this.parameters=t||{},this.parameters.mipmap=!1!==this.parameters.mipmap,this.parameters.noUnpackFlip=this.parameters.noUnpackFlip||!1,this.parameters.preMultiplyAlpha=this.parameters.preMultiplyAlpha||!1,this.parameters.wrap=this.parameters.wrap||{s:J.e8.REPEAT,t:J.e8.REPEAT},this._startPreload(e)}_startPreload(e){null!=e&&(e instanceof HTMLVideoElement?this._startPreloadVideoElement(e):e instanceof HTMLImageElement&&this._startPreloadImageElement(e))}_startPreloadVideoElement(e){if(!((0,W.jc)(e.src)||"auto"===e.preload&&e.crossOrigin)){e.preload="auto",e.crossOrigin="anonymous";const t=!e.paused;if(e.src=e.src,t&&e.autoplay){const t=()=>{e.removeEventListener("canplay",t),e.play()};e.addEventListener("canplay",t)}}}_startPreloadImageElement(e){(0,W.HK)(e.src)||(0,W.jc)(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}dispose(){this._data=void 0}_createDescriptor(e){const t=new pe.X;return t.wrapMode=this.parameters.wrap??J.e8.REPEAT,t.flipped=!this.parameters.noUnpackFlip,t.samplingMode=this.parameters.mipmap?J.cw.LINEAR_MIPMAP_LINEAR:J.cw.LINEAR,t.hasMipmap=!!this.parameters.mipmap,t.preMultiplyAlpha=!!this.parameters.preMultiplyAlpha,t.maxAnisotropy=this.parameters.maxAnisotropy??(this.parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t}get glTexture(){return this._glTexture}get memoryEstimate(){return this._glTexture?.gpuMemoryUsage||function(e,t){if(null==e)return 0;if((0,u.eP)(e)||(0,u.lq)(e))return t.encoding===B.Ti.KTX2_ENCODING?function(e,t){if(null==K)return e.byteLength;const r=new K.KTX2File(new Uint8Array(e)),i=ie(r)?te(r.getLevels(),r.getHasAlpha(),r.getWidth(),r.getHeight(),t):0;return r.close(),r.delete(),i}(e,!!t.mipmap):t.encoding===B.Ti.BASIS_ENCODING?function(e,t){if(null==K)return e.byteLength;const r=new K.BasisFile(new Uint8Array(e)),i=re(r)?te(r.getNumLevels(0),r.getHasAlpha(),r.getImageWidth(0,0),r.getImageHeight(0,0),t):0;return r.close(),r.delete(),i}(e,!!t.mipmap):e.byteLength;const{width:r,height:i}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?ve(e):t;return(t.mipmap?4/3:1)*r*i*(t.components||4)||0}(this._data,this.parameters)}load(e){if(null!=this._glTexture)return this._glTexture;if(this._loadingPromise)return this._loadingPromise;const t=this._data;return null==t?(this._glTexture=new Z.x(e,this._createDescriptor(e),null),this._glTexture):"string"==typeof t?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):((0,u.eP)(t)||(0,u.lq)(t))&&this.parameters.encoding===B.Ti.DDS_ENCODING?(this._data=void 0,this._loadFromDDSData(e,t)):((0,u.eP)(t)||(0,u.lq)(t))&&this.parameters.encoding===B.Ti.KTX2_ENCODING?(this._data=void 0,this._loadFromKTX2(e,t)):((0,u.eP)(t)||(0,u.lq)(t))&&this.parameters.encoding===B.Ti.BASIS_ENCODING?(this._data=void 0,this._loadFromBasis(e,t)):(0,u.lq)(t)?this._loadFromPixelData(e,t):(0,u.eP)(t)?this._loadFromPixelData(e,new Uint8Array(t)):null}get requiresFrameUpdates(){return this._data instanceof HTMLVideoElement}frameUpdate(e){return this._data instanceof HTMLVideoElement&&null!=this._glTexture?this._data.readyState<he.HAVE_CURRENT_DATA||e===this._data.currentTime?e:(this._glTexture.setData(this._data),this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this.parameters.updateCallback&&this.parameters.updateCallback(),this._data.currentTime):e}_loadFromDDSData(e,t){return this._glTexture=function(e,t,r){const i=function(e,t){const r=new Int32Array(e,0,31);if(542327876!==r[0])return se.error("Invalid magic number in DDS header"),null;if(!(4&r[20]))return se.error("Unsupported format, must contain a FourCC code"),null;const i=r[21];let o,n;switch(i){case ce:o=8,n=J.q_.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case de:o=16,n=J.q_.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case ue:o=16,n=J.q_.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return se.error("Unsupported FourCC code:",function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)}(i)),null}let a=1,s=r[4],l=r[3];0==(3&s)&&0==(3&l)||(se.warn("Rounding up compressed texture size to nearest multiple of 4."),s=s+3&-4,l=l+3&-4);const c=s,d=l;let u,h;131072&r[2]&&!1!==t&&(a=Math.max(1,r[7]));let m=r[1]+4;const f=[];for(let t=0;t<a;++t)h=(s+3>>2)*(l+3>>2)*o,u=new Uint8Array(e,m,h),f.push(u),m+=h,s=Math.max(1,s>>1),l=Math.max(1,l>>1);return{textureData:{type:"compressed",levels:f},internalFormat:n,width:c,height:d}}(r,t.hasMipmap??!1);if(null==i)throw new Error("DDS texture data is null");const{textureData:o,internalFormat:n,width:a,height:s}=i;return t.samplingMode=o.levels.length>1?J.cw.LINEAR_MIPMAP_LINEAR:J.cw.LINEAR,t.hasMipmap=o.levels.length>1,t.internalFormat=n,t.width=a,t.height=s,new Z.x(e,t,o)}(e,this._createDescriptor(e),t),this._glTexture}_loadFromKTX2(e,t){return this._loadAsync((()=>async function(e,t,r){null==K&&(K=await ee());const i=new K.KTX2File(new Uint8Array(r));if(!ie(i))return null;i.startTranscoding();const o=oe(e,t,i.getLevels(),i.getHasAlpha(),i.getWidth(),i.getHeight(),((e,t)=>i.getImageTranscodedSizeInBytes(e,0,0,t)),((e,t,r)=>i.transcodeImage(r,e,0,0,t,0,-1,-1)));return i.close(),i.delete(),o}(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromBasis(e,t){return this._loadAsync((()=>async function(e,t,r){null==K&&(K=await ee());const i=new K.BasisFile(new Uint8Array(r));if(!re(i))return null;i.startTranscoding();const o=oe(e,t,i.getNumLevels(0),i.getHasAlpha(),i.getImageWidth(0,0),i.getImageHeight(0,0),((e,t)=>i.getImageTranscodedSizeInBytes(0,e,t)),((e,t,r)=>i.transcodeImage(r,0,e,t,0,0)));return i.close(),i.delete(),o}(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromPixelData(e,t){(0,fe.hu)(this.parameters.width>0&&this.parameters.height>0);const r=this._createDescriptor(e);return r.pixelFormat=1===this.parameters.components?J.VI.LUMINANCE:3===this.parameters.components?J.VI.RGB:J.VI.RGBA,r.width=this.parameters.width??0,r.height=this.parameters.height??0,this._glTexture=new Z.x(e,r,t),this._glTexture}_loadFromURL(e,t){return this._loadAsync((async r=>{const i=await F(t,{signal:r});return(0,L.k_)(r),this._loadFromImage(e,i)}))}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync((async r=>{const i=await(0,k.fY)(t,t.src,!1,r);return(0,L.k_)(r),this._loadFromImage(e,i)}))}_loadFromVideoElement(e,t){return t.readyState>=he.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(e,t){return this._loadAsync((r=>new Promise(((i,o)=>{const n=()=>{t.removeEventListener("loadeddata",a),t.removeEventListener("error",s),(0,z.hw)(l)},a=()=>{t.readyState>=he.HAVE_CURRENT_DATA&&(n(),i(this._loadFromImage(e,t)))},s=e=>{n(),o(e||new P.Z("Failed to load video"))};t.addEventListener("loadeddata",a),t.addEventListener("error",s);const l=(0,L.fu)(r,(()=>s((0,L.zE)())))}))))}_loadFromImage(e,t){const r=ve(t);this.parameters.width=r.width,this.parameters.height=r.height;const i=this._createDescriptor(e);return i.pixelFormat=3===this.parameters.components?J.VI.RGB:J.VI.RGBA,i.width=r.width,i.height=r.height,this._glTexture=new Z.x(e,i,t),this._glTexture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const i=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null)};return r.then(i,i),r}unload(){if(this._glTexture=(0,z.M2)(this._glTexture),null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}}function ve(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}(me=he||(he={}))[me.HAVE_NOTHING=0]="HAVE_NOTHING",me[me.HAVE_METADATA=1]="HAVE_METADATA",me[me.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",me[me.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",me[me.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA";var _e=r(35065),Te=r(64822),xe=r(65576),be=r(55039),Ee=r(60624),Ae=r(19419),Se=r(85504),we=r(60537),Re=r(82791),Ce=r(93144),ye=r(27097);const Oe=(0,ye.wK)(J.zi.SRC_ALPHA,J.zi.ONE,J.zi.ONE_MINUS_SRC_ALPHA,J.zi.ONE_MINUS_SRC_ALPHA),Me=(0,ye.if)(J.zi.ONE,J.zi.ONE),Pe=(0,ye.if)(J.zi.ZERO,J.zi.ONE_MINUS_SRC_ALPHA);function Ie(e){return e===Ce.A.FrontFace?null:e===Ce.A.Alpha?Pe:Me}const Ne={factor:-1,units:-2};function Le(e,t=J.wb.LESS){return e===Ce.A.NONE||e===Ce.A.FrontFace?t:J.wb.LEQUAL}var De;!function(e){e[e.INTEGRATED_MESH=0]="INTEGRATED_MESH",e[e.OPAQUE_TERRAIN=1]="OPAQUE_TERRAIN",e[e.OPAQUE_MATERIAL=2]="OPAQUE_MATERIAL",e[e.TRANSPARENT_MATERIAL=3]="TRANSPARENT_MATERIAL",e[e.TRANSPARENT_TERRAIN=4]="TRANSPARENT_TERRAIN",e[e.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL=5]="TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL",e[e.OCCLUDED_TERRAIN=6]="OCCLUDED_TERRAIN",e[e.OCCLUDER_MATERIAL=7]="OCCLUDER_MATERIAL",e[e.TRANSPARENT_OCCLUDER_MATERIAL=8]="TRANSPARENT_OCCLUDER_MATERIAL",e[e.OCCLUSION_PIXELS=9]="OCCLUSION_PIXELS",e[e.ANTIALIASING=10]="ANTIALIASING",e[e.POSTPROCESSING_ENVIRONMENT_OPAQUE=11]="POSTPROCESSING_ENVIRONMENT_OPAQUE",e[e.POSTPROCESSING_ENVIRONMENT_TRANSPARENT=12]="POSTPROCESSING_ENVIRONMENT_TRANSPARENT",e[e.LASERLINES=13]="LASERLINES",e[e.LASERLINES_CONTRAST_CONTROL=14]="LASERLINES_CONTRAST_CONTROL",e[e.HUD_MATERIAL=15]="HUD_MATERIAL",e[e.LABEL_MATERIAL=16]="LABEL_MATERIAL",e[e.LINE_CALLOUTS=17]="LINE_CALLOUTS",e[e.LINE_CALLOUTS_HUD_DEPTH=18]="LINE_CALLOUTS_HUD_DEPTH",e[e.DRAPED_MATERIAL=19]="DRAPED_MATERIAL",e[e.DRAPED_WATER=20]="DRAPED_WATER",e[e.VOXEL=21]="VOXEL",e[e.MAX_SLOTS=22]="MAX_SLOTS"}(De||(De={}));var Fe=r(8310),He=r(87951);const Be=new class{constructor(e=0){this.offset=e,this.sphere=(0,Fe.c)(),this.tmpVertex=(0,c.c)()}applyToVertex(e,t,r){const i=this.objectTransform.transform,o=(0,l.s)(Ue,e,t,r),n=(0,l.m)(o,o,i),a=this.offset/(0,l.l)(n);(0,l.q)(n,n,n,a);const s=this.objectTransform.inverse;return(0,l.m)(this.tmpVertex,n,s),this.tmpVertex}applyToMinMax(e,t){const r=this.offset/(0,l.l)(e);(0,l.q)(e,e,e,r);const i=this.offset/(0,l.l)(t);(0,l.q)(t,t,t,i)}applyToAabb(e){const t=this.offset/Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]+=e[0]*t,e[1]+=e[1]*t,e[2]+=e[2]*t;const r=this.offset/Math.sqrt(e[3]*e[3]+e[4]*e[4]+e[5]*e[5]);return e[3]+=e[3]*r,e[4]+=e[4]*r,e[5]+=e[5]*r,e}applyToBoundingSphere(e){const t=(0,l.l)(e),r=this.offset/t;return(0,l.q)(this.sphere,e,e,r),this.sphere[3]=e[3]+e[3]*this.offset/t,this.sphere}};new class{constructor(e=0){this.componentLocalOriginLength=0,this._tmpVertex=(0,c.c)(),this._mbs=(0,Fe.c)(),this._obb=(0,He.Ue)(),this._totalOffset=0,this._offset=0,this._resetOffset(e)}_resetOffset(e){this._offset=e,this._totalOffset=e}set offset(e){this._resetOffset(e)}get offset(){return this._offset}set componentOffset(e){this._totalOffset=this._offset+e}set localOrigin(e){this.componentLocalOriginLength=(0,l.l)(e)}applyToVertex(e,t,r){const i=(0,l.s)(Ue,e,t,r),o=(0,l.s)(Ge,e,t,r+this.componentLocalOriginLength),n=this._totalOffset/(0,l.l)(o);return(0,l.q)(this._tmpVertex,i,o,n),this._tmpVertex}applyToAabb(e){const t=(0,l.s)(Ue,e[0],e[1],e[2]+this.componentLocalOriginLength),r=(0,l.s)(Ge,e[3],e[4],e[5]+this.componentLocalOriginLength),i=(0,l.r)(Ve,t),o=(0,l.r)(ze,r),n=(0,l.u)(We,t),a=(0,l.u)(ke,r),s=(0,l.v)($e,n,a);s[0]=i[0]*o[0]<0?0:s[0],s[1]=i[1]*o[1]<0?0:s[1],s[2]=i[2]*o[2]<0?0:s[2];const c=(0,l.l)(s);if(c<this._totalOffset)return e[0]-=t[0]<0?this._totalOffset:0,e[1]-=t[1]<0?this._totalOffset:0,e[2]-=t[2]<0?this._totalOffset:0,e[3]+=r[0]>0?this._totalOffset:0,e[4]+=r[1]>0?this._totalOffset:0,e[5]+=r[2]>0?this._totalOffset:0,e;const d=(0,l.w)($e,n,a),u=(0,l.l)(d),h=this._totalOffset/u,m=this._totalOffset/c;return e[0]+=t[0]*(t[0]>0?h:m),e[1]+=t[1]*(t[1]>0?h:m),e[2]+=t[2]*(t[2]>0?h:m),e[3]+=r[0]*(r[0]<0?h:m),e[4]+=r[1]*(r[1]<0?h:m),e[5]+=r[2]*(r[2]<0?h:m),e}applyToMbs(e){const t=(0,l.l)(e),r=this._totalOffset/t;return(0,l.q)(this._mbs,e,e,r),this._mbs[3]=e[3]+e[3]*this._totalOffset/t,this._mbs}applyToObb(e){return(0,He.gI)(e,this._totalOffset,this._totalOffset,Te.JY.Global,this._obb),this._obb}},new class{constructor(e=0){this.offset=e,this.tmpVertex=(0,c.c)()}applyToVertex(e,t,r){const i=(0,l.s)(Ue,e,t,r),o=(0,l.a)(Ge,i,this.localOrigin),n=this.offset/(0,l.l)(o);return(0,l.q)(this.tmpVertex,i,o,n),this.tmpVertex}applyToAabb(e){const t=Ve,r=ze,i=We;for(let o=0;o<3;++o)t[o]=e[0+o]+this.localOrigin[o],r[o]=e[3+o]+this.localOrigin[o],i[o]=t[o];const o=this.applyToVertex(t[0],t[1],t[2]);for(let t=0;t<3;++t)e[t]=o[t],e[t+3]=o[t];const n=t=>{const r=this.applyToVertex(t[0],t[1],t[2]);for(let t=0;t<3;++t)e[t]=Math.min(e[t],r[t]),e[t+3]=Math.max(e[t+3],r[t])};for(let e=1;e<8;++e){for(let o=0;o<3;++o)i[o]=0==(e&1<<o)?t[o]:r[o];n(i)}let a=0;for(let e=0;e<3;++e)t[e]*r[e]<0&&(a|=1<<e);if(0!==a&&7!==a)for(let e=0;e<8;++e)if(0==(a&e)){for(let o=0;o<3;++o)i[o]=0!=(a&1<<o)?0:0!=(e&1<<o)?t[o]:r[o];n(i)}for(let t=0;t<3;++t)e[t]-=this.localOrigin[t],e[t+3]-=this.localOrigin[t];return e}};const Ue=(0,c.c)(),Ge=(0,c.c)(),Ve=(0,c.c)(),ze=(0,c.c)(),We=(0,c.c)(),ke=(0,c.c)(),$e=(0,c.c)();function je(e,t,r,i){const o=r.typedBuffer,n=r.typedBufferStride,a=e.length;i*=n;for(let r=0;r<a;++r){const a=2*e[r];o[i]=t[a],o[i+1]=t[a+1],i+=n}}function Xe(e,t,r,i,o){const n=r.typedBuffer,a=r.typedBufferStride,s=e.length;if(i*=a,null==o||1===o)for(let r=0;r<s;++r){const o=3*e[r];n[i]=t[o],n[i+1]=t[o+1],n[i+2]=t[o+2],i+=a}else for(let r=0;r<s;++r){const s=3*e[r];for(let e=0;e<o;++e)n[i]=t[s],n[i+1]=t[s+1],n[i+2]=t[s+2],i+=a}}function qe(e,t,r,i,o=1){const n=r.typedBuffer,a=r.typedBufferStride,s=e.length;if(i*=a,1===o)for(let r=0;r<s;++r){const o=4*e[r];n[i]=t[o],n[i+1]=t[o+1],n[i+2]=t[o+2],n[i+3]=t[o+3],i+=a}else for(let r=0;r<s;++r){const s=4*e[r];for(let e=0;e<o;++e)n[i]=t[s],n[i+1]=t[s+1],n[i+2]=t[s+2],n[i+3]=t[s+3],i+=a}}function Je(e,t,r,i,o=1){const n=t.typedBuffer,a=t.typedBufferStride;if(i*=a,1===o)for(let t=0;t<r;++t)n[i]=e[0],n[i+1]=e[1],n[i+2]=e[2],n[i+3]=e[3],i+=a;else for(let t=0;t<r;++t)for(let t=0;t<o;++t)n[i]=e[0],n[i+1]=e[1],n[i+2]=e[2],n[i+3]=e[3],i+=a}function Ze(e,t,r,i,o,n,s){switch(e){case _e.T.POSITION:{(0,fe.hu)(3===t.size);const o=n.getField(e,m.ct);(0,fe.hu)(!!o,`No buffer view for ${e}`),o&&function(e,t,r,i,o,n=1){if(!r)return void Xe(e,t,i,o,n);const s=i.typedBuffer,l=i.typedBufferStride,c=e.length,d=r[0],u=r[1],h=r[2],m=r[4],f=r[5],p=r[6],g=r[8],v=r[9],_=r[10],T=r[12],x=r[13],b=r[14];o*=l;let E=0,A=0,S=0;const w=(0,a.y)(r)?e=>{E=t[e]+T,A=t[e+1]+x,S=t[e+2]+b}:e=>{const r=t[e],i=t[e+1],o=t[e+2];E=d*r+m*i+g*o+T,A=u*r+f*i+v*o+x,S=h*r+p*i+_*o+b};if(1===n)for(let t=0;t<c;++t)w(3*e[t]),s[o]=E,s[o+1]=A,s[o+2]=S,o+=l;else for(let t=0;t<c;++t){w(3*e[t]);for(let e=0;e<n;++e)s[o]=E,s[o+1]=A,s[o+2]=S,o+=l}}(r,t.data,i,o,s);break}case _e.T.NORMAL:{(0,fe.hu)(3===t.size);const i=n.getField(e,m.ct);(0,fe.hu)(!!i,`No buffer view for ${e}`),i&&function(e,t,r,i,o,n=1){if(!r)return void Xe(e,t,i,o,n);const s=r,l=i.typedBuffer,c=i.typedBufferStride,d=e.length,u=s[0],h=s[1],m=s[2],f=s[4],p=s[5],g=s[6],v=s[8],_=s[9],T=s[10],x=!(0,a.z)(s),b=1e-6,E=1-b;o*=c;let A=0,S=0,w=0;const R=(0,a.y)(s)?e=>{A=t[e],S=t[e+1],w=t[e+2]}:e=>{const r=t[e],i=t[e+1],o=t[e+2];A=u*r+f*i+v*o,S=h*r+p*i+_*o,w=m*r+g*i+T*o};if(1===n)if(x)for(let t=0;t<d;++t){R(3*e[t]);const r=A*A+S*S+w*w;if(r<E&&r>b){const e=1/Math.sqrt(r);l[o]=A*e,l[o+1]=S*e,l[o+2]=w*e}else l[o]=A,l[o+1]=S,l[o+2]=w;o+=c}else for(let t=0;t<d;++t)R(3*e[t]),l[o]=A,l[o+1]=S,l[o+2]=w,o+=c;else for(let t=0;t<d;++t){if(R(3*e[t]),x){const e=A*A+S*S+w*w;if(e<E&&e>b){const t=1/Math.sqrt(e);A*=t,S*=t,w*=t}}for(let e=0;e<n;++e)l[o]=A,l[o+1]=S,l[o+2]=w,o+=c}}(r,t.data,o,i,s);break}case _e.T.NORMALCOMPRESSED:{(0,fe.hu)(2===t.size);const i=n.getField(e,m.or);(0,fe.hu)(!!i,`No buffer view for ${e}`),i&&je(r,t.data,i,s);break}case _e.T.UV0:{(0,fe.hu)(2===t.size);const i=n.getField(e,m.Eu);(0,fe.hu)(!!i,`No buffer view for ${e}`),i&&je(r,t.data,i,s);break}case _e.T.COLOR:case _e.T.SYMBOLCOLOR:{const i=n.getField(e,m.mc);(0,fe.hu)(!!i,`No buffer view for ${e}`),(0,fe.hu)(3===t.size||4===t.size),!i||3!==t.size&&4!==t.size||function(e,t,r,i,o,n=1){const a=i.typedBuffer,s=i.typedBufferStride,l=e.length;if(o*=s,r!==t.length||4!==r)if(1!==n)if(4!==r)for(let r=0;r<l;++r){const i=3*e[r];for(let e=0;e<n;++e)a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=255,o+=s}else for(let r=0;r<l;++r){const i=4*e[r];for(let e=0;e<n;++e)a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=t[i+3],o+=s}else{if(4===r){for(let r=0;r<l;++r){const i=4*e[r];a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=t[i+3],o+=s}return}for(let r=0;r<l;++r){const i=3*e[r];a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=255,o+=s}}else{a[o]=t[0],a[o+1]=t[1],a[o+2]=t[2],a[o+3]=t[3];const e=new Uint32Array(i.typedBuffer.buffer,i.start),r=s/4,c=e[o/=4];o+=r;const d=l*n;for(let t=1;t<d;++t)e[o]=c,o+=r}}(r,t.data,t.size,i,s);break}case _e.T.COLORFEATUREATTRIBUTE:{const i=n.getField(e,m.ly);(0,fe.hu)(!!i,`No buffer view for ${e}`),(0,fe.hu)(1===t.size),i&&1===t.size&&function(e,t,r,i){const o=r.typedBuffer,n=r.typedBufferStride,a=e.length,s=t[0];i*=n;for(let e=0;e<a;++e)o[i]=s,i+=n}(r,t.data,i,s);break}case _e.T.TANGENT:{(0,fe.hu)(4===t.size);const i=n.getField(e,m.ek);(0,fe.hu)(!!i,`No buffer view for ${e}`),i&&function(e,t,r,i,o,n=1){if(!r)return void qe(e,t,i,o,n);const s=r,l=i.typedBuffer,c=i.typedBufferStride,d=e.length,u=s[0],h=s[1],m=s[2],f=s[4],p=s[5],g=s[6],v=s[8],_=s[9],T=s[10],x=!(0,a.z)(s),b=1e-6,E=1-b;if(o*=c,1===n)for(let r=0;r<d;++r){const i=4*e[r],n=t[i],a=t[i+1],s=t[i+2],d=t[i+3];let A=u*n+f*a+v*s,S=h*n+p*a+_*s,w=m*n+g*a+T*s;if(x){const e=A*A+S*S+w*w;if(e<E&&e>b){const t=1/Math.sqrt(e);A*=t,S*=t,w*=t}}l[o]=A,l[o+1]=S,l[o+2]=w,l[o+3]=d,o+=c}else for(let r=0;r<d;++r){const i=4*e[r],a=t[i],s=t[i+1],d=t[i+2],A=t[i+3];let S=u*a+f*s+v*d,w=h*a+p*s+_*d,R=m*a+g*s+T*d;if(x){const e=S*S+w*w+R*R;if(e<E&&e>b){const t=1/Math.sqrt(e);S*=t,w*=t,R*=t}}for(let e=0;e<n;++e)l[o]=S,l[o+1]=w,l[o+2]=R,l[o+3]=A,o+=c}}(r,t.data,o,i,s);break}case _e.T.PROFILERIGHT:case _e.T.PROFILEUP:case _e.T.PROFILEVERTEXANDNORMAL:case _e.T.FEATUREVALUE:{(0,fe.hu)(4===t.size);const i=n.getField(e,m.ek);(0,fe.hu)(!!i,`No buffer view for ${e}`),i&&qe(r,t.data,i,s)}}}class Ye{constructor(e){this.vertexBufferLayout=e}elementCount(e){return e.indices.get(_e.T.POSITION).length}write(e,t,r,i,o){!function(e,t,r,i,o,n){for(const a of t.fields.keys()){const t=e.vertexAttributes.get(a),s=e.indices.get(a);if(t&&s)Ze(a,t,s,r,i,o,n);else if(a===_e.T.OBJECTANDLAYERIDCOLOR&&null!=e.objectAndLayerIdColor){const t=e.indices.get(_e.T.POSITION);if((0,fe.hu)(!!t,`No buffer view for ${a}`),t){const r=t.length,i=o.getField(a,m.mc);Je(e.objectAndLayerIdColor,i,r,n)}}}}(r,this.vertexBufferLayout,e,t,i,o)}}var Ke=r(57790),Qe=r(88669),et=r(135),tt=r(15719),rt=r(96310),it=r(78869),ot=r(14589),nt=r(83475),at=r(59377);J.wb.LESS,J.wb.ALWAYS;const st={mask:255},lt={function:{func:J.wb.ALWAYS,ref:B.hU.OutlineVisualElementMask,mask:B.hU.OutlineVisualElementMask},operation:{fail:J.xS.KEEP,zFail:J.xS.KEEP,zPass:J.xS.ZERO}},ct={function:{func:J.wb.ALWAYS,ref:B.hU.OutlineVisualElementMask,mask:B.hU.OutlineVisualElementMask},operation:{fail:J.xS.KEEP,zFail:J.xS.KEEP,zPass:J.xS.REPLACE}};J.wb.EQUAL,B.hU.OutlineVisualElementMask,B.hU.OutlineVisualElementMask,J.xS.KEEP,J.xS.KEEP,J.xS.KEEP,J.wb.NOTEQUAL,B.hU.OutlineVisualElementMask,B.hU.OutlineVisualElementMask,J.xS.KEEP,J.xS.KEEP,J.xS.KEEP;const dt=[1,1,.5],ut=[0,.6,.2],ht=[0,1,.2];var mt=r(32078);class ft extends tt.d4{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=(0,c.g)(dt),this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=B.Vr.Back,this.isInstanced=!1,this.hasInstancedColor=!1,this.emissiveFactor=(0,c.f)(0,0,0),this.instancedDoublePrecision=!1,this.normalType=Ee.r.Attribute,this.receiveSSAO=!0,this.receiveShadows=!0,this.castShadows=!0,this.shadowMappingEnabled=!1,this.ambient=(0,c.f)(.2,.2,.2),this.diffuse=(0,c.f)(.8,.8,.8),this.externalColor=(0,Qe.f)(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=(0,c.c)(),this.hasSlicePlane=!1,this.hasSliceHighlight=!0,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.modelTransformation=null,this.transparent=!1,this.writeDepth=!0,this.customDepthTest=B.Gv.Less,this.textureAlphaMode=B.JJ.Blend,this.textureAlphaCutoff=rt.F,this.textureAlphaPremultiplied=!1,this.hasOccludees=!1,this.renderOccluded=Re.yD.Occlude,this.isDecoration=!1}}class pt extends ot.A{initializeConfiguration(e,t){t.spherical=e.viewingMode===Te.JY.Global,t.doublePrecisionRequiresObfuscation=e.rctx.driverTest.doublePrecisionRequiresObfuscation.result,t.textureCoordinateType=t.hasColorTexture||t.hasMetallicRoughnessTexture||t.hasEmissionTexture||t.hasOcclusionTexture||t.hasNormalTexture?et.N.Default:et.N.None,t.objectAndLayerIdColorInstanced=t.instanced}initializeProgram(e){return this._initializeProgram(e,pt.shader)}_initializeProgram(e,t){return new at.$(e.rctx,t.get().build(this.configuration),nt.i)}_convertDepthTestFunction(e){return e===B.Gv.Lequal?J.wb.LEQUAL:J.wb.LESS}_makePipeline(e,t){const r=this.configuration,i=e===Ce.A.NONE,o=e===Ce.A.FrontFace;return(0,ye.sm)({blending:r.output!==be.H.Color&&r.output!==be.H.Alpha||!r.transparent?null:i?Oe:Ie(e),culling:gt(r)?(0,ye.zp)(r.cullFace):null,depthTest:{func:Le(e,this._convertDepthTestFunction(r.customDepthTest))},depthWrite:(i||o)&&r.writeDepth?ye.LZ:null,colorWrite:ye.BK,stencilWrite:r.hasOccludees?st:null,stencilTest:r.hasOccludees?t?ct:lt:null,polygonOffset:i||o?null:(n=r.enableOffset,n?Ne:null)});var n}initializePipeline(){return this._occludeePipelineState=this._makePipeline(this.configuration.transparencyPassType,!0),this._makePipeline(this.configuration.transparencyPassType,!1)}getPipelineState(e,t){return t?this._occludeePipelineState:super.getPipelineState(e,t)}}function gt(e){return e.cullFace!==B.Vr.None||!e.hasSlicePlane&&!e.transparent&&!e.doubleSidedMode}pt.shader=new it.J(mt.D,(()=>r.e(9291).then(r.bind(r,79291))));var vt=r(43697),_t=r(51354),Tt=r(47624),xt=r(67498);class bt extends Tt.PO{}(0,vt._)([(0,_t.o)({constValue:!0})],bt.prototype,"hasSliceHighlight",void 0),(0,vt._)([(0,_t.o)({constValue:!1})],bt.prototype,"hasSliceInVertexProgram",void 0),(0,vt._)([(0,_t.o)({constValue:xt.P.Pass})],bt.prototype,"pbrTextureBindType",void 0);class Et extends bt{constructor(){super(...arguments),this.output=be.H.Color,this.alphaDiscardMode=B.JJ.Opaque,this.doubleSidedMode=Ae.q.None,this.pbrMode=Se.f7.Disabled,this.cullFace=B.Vr.None,this.transparencyPassType=Ce.A.NONE,this.normalType=Ee.r.Attribute,this.textureCoordinateType=et.N.None,this.customDepthTest=B.Gv.Less,this.spherical=!1,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.hasVerticalOffset=!1,this.hasSlicePlane=!1,this.hasSliceHighlight=!0,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasEmissionTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasScreenSizePerspective=!1,this.hasVertexTangents=!1,this.hasOccludees=!1,this.multipassEnabled=!1,this.hasModelTransformation=!1,this.offsetBackfaces=!1,this.vvSize=!1,this.vvColor=!1,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.textureAlphaPremultiplied=!1,this.instanced=!1,this.instancedColor=!1,this.objectAndLayerIdColorInstanced=!1,this.instancedDoublePrecision=!1,this.doublePrecisionRequiresObfuscation=!1,this.writeDepth=!0,this.transparent=!1,this.enableOffset=!0,this.cullAboveGround=!1,this.snowCover=!1,this.hasColorTextureTransform=!1,this.hasEmissionTextureTransform=!1,this.hasNormalTextureTransform=!1,this.hasOcclusionTextureTransform=!1,this.hasMetallicRoughnessTextureTransform=!1}}(0,vt._)([(0,_t.o)({count:be.H.COUNT})],Et.prototype,"output",void 0),(0,vt._)([(0,_t.o)({count:B.JJ.COUNT})],Et.prototype,"alphaDiscardMode",void 0),(0,vt._)([(0,_t.o)({count:Ae.q.COUNT})],Et.prototype,"doubleSidedMode",void 0),(0,vt._)([(0,_t.o)({count:Se.f7.COUNT})],Et.prototype,"pbrMode",void 0),(0,vt._)([(0,_t.o)({count:B.Vr.COUNT})],Et.prototype,"cullFace",void 0),(0,vt._)([(0,_t.o)({count:Ce.A.COUNT})],Et.prototype,"transparencyPassType",void 0),(0,vt._)([(0,_t.o)({count:Ee.r.COUNT})],Et.prototype,"normalType",void 0),(0,vt._)([(0,_t.o)({count:et.N.COUNT})],Et.prototype,"textureCoordinateType",void 0),(0,vt._)([(0,_t.o)({count:B.Gv.COUNT})],Et.prototype,"customDepthTest",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"spherical",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasVertexColors",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasSymbolColors",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasVerticalOffset",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasSlicePlane",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasSliceHighlight",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasColorTexture",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasMetallicRoughnessTexture",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasEmissionTexture",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasOcclusionTexture",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasNormalTexture",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasScreenSizePerspective",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasVertexTangents",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasOccludees",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"multipassEnabled",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasModelTransformation",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"offsetBackfaces",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"vvSize",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"vvColor",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"receiveShadows",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"receiveAmbientOcclusion",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"textureAlphaPremultiplied",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"instanced",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"instancedColor",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"objectAndLayerIdColorInstanced",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"instancedDoublePrecision",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"doublePrecisionRequiresObfuscation",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"writeDepth",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"transparent",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"enableOffset",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"cullAboveGround",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"snowCover",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasColorTextureTransform",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasEmissionTextureTransform",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasNormalTextureTransform",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasOcclusionTextureTransform",void 0),(0,vt._)([(0,_t.o)()],Et.prototype,"hasMetallicRoughnessTextureTransform",void 0),(0,vt._)([(0,_t.o)({constValue:!0})],Et.prototype,"hasVvInstancing",void 0),(0,vt._)([(0,_t.o)({constValue:!1})],Et.prototype,"useCustomDTRExponentForWater",void 0),(0,vt._)([(0,_t.o)({constValue:!1})],Et.prototype,"supportsTextureAtlas",void 0),(0,vt._)([(0,_t.o)({constValue:!0})],Et.prototype,"useFillLights",void 0);var At=r(41846);class St extends pt{initializeConfiguration(e,t){super.initializeConfiguration(e,t),t.hasMetallicRoughnessTexture=!1,t.hasEmissionTexture=!1,t.hasOcclusionTexture=!1,t.hasNormalTexture=!1,t.hasModelTransformation=!1,t.normalType=Ee.r.Attribute,t.doubleSidedMode=Ae.q.WindingOrder,t.hasVertexTangents=!1}initializeProgram(e){return this._initializeProgram(e,St.shader)}}St.shader=new it.J(At.R,(()=>r.e(8096).then(r.bind(r,38096))));class wt extends Re.F5{constructor(e){super(e,Ct),this.supportsEdges=!0,this._configuration=new Et,this._vertexBufferLayout=function(e){const t=(0,xe.U$)().vec3f(_e.T.POSITION);return e.normalType===Ee.r.Compressed?t.vec2i16(_e.T.NORMALCOMPRESSED,{glNormalized:!0}):t.vec3f(_e.T.NORMAL),e.hasVertexTangents&&t.vec4f(_e.T.TANGENT),(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&t.vec2f(_e.T.UV0),e.hasVertexColors&&t.vec4u8(_e.T.COLOR),e.hasSymbolColors&&t.vec4u8(_e.T.SYMBOLCOLOR),(0,G.Z)("enable-feature:objectAndLayerId-rendering")&&t.vec4u8(_e.T.OBJECTANDLAYERIDCOLOR),t}(this.parameters)}isVisibleForOutput(e){return e!==be.H.Shadow&&e!==be.H.ShadowExcludeHighlight&&e!==be.H.ShadowHighlight||this.parameters.castShadows}isVisible(){const e=this.parameters;if(!super.isVisible()||0===e.layerOpacity)return!1;const{hasInstancedColor:t,hasVertexColors:r,hasSymbolColors:i,vvColor:o}=e,n="replace"===e.colorMixMode,a=e.opacity>0,s=e.externalColor&&e.externalColor[3]>0,l=t||o||i;return r&&l?n||a:r?n?s:a:l?n||a:n?s:a}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasNormalTexture=!!this.parameters.normalTextureId,this._configuration.hasColorTexture=!!this.parameters.textureId,this._configuration.hasVertexTangents=this.parameters.hasVertexTangents,this._configuration.instanced=this.parameters.isInstanced,this._configuration.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasSliceHighlight=this.parameters.hasSliceHighlight,this._configuration.alphaDiscardMode=this.parameters.textureAlphaMode,this._configuration.normalType=this.parameters.normalType,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,null!=this.parameters.customDepthTest&&(this._configuration.customDepthTest=this.parameters.customDepthTest),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?B.Vr.None:this.parameters.cullFace,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.hasModelTransformation=null!=this.parameters.modelTransformation,e!==be.H.Color&&e!==be.H.Alpha||(this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this._configuration.doubleSidedMode=Ae.q.WindingOrder:this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?Ae.q.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?Ae.q.WindingOrder:Ae.q.None,this._configuration.instancedColor=this.parameters.hasInstancedColor,this._configuration.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this._configuration.receiveAmbientOcclusion=!!t.ssaoHelper.active&&this.parameters.receiveSSAO,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this._configuration.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?Se.f7.Schematic:Se.f7.Normal:Se.f7.Disabled,this._configuration.hasMetallicRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this._configuration.hasEmissionTexture=!!this.parameters.emissiveTextureId,this._configuration.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<5e5,this._configuration.snowCover=this.hasSnowCover(t),this._configuration.hasColorTextureTransform=!!this.parameters.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!this.parameters.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!this.parameters.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!this.parameters.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!this.parameters.metallicRoughnessTextureTransformMatrix),this._configuration}hasSnowCover(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}intersect(e,t,r,i,o,n){if(null!=this.parameters.verticalOffset){const e=r.camera;(0,l.s)(Nt,t[12],t[13],t[14]);let n=null;switch(r.viewingMode){case Te.JY.Global:n=(0,l.n)(Pt,Nt);break;case Te.JY.Local:n=(0,l.c)(Pt,Mt)}let a=0;const s=(0,l.b)(Lt,Nt,e.eye),c=(0,l.l)(s),d=(0,l.g)(s,s,1/c);let u=null;this.parameters.screenSizePerspective&&(u=(0,l.e)(n,d)),a+=(0,Ke.Hx)(e,c,this.parameters.verticalOffset,u??0,this.parameters.screenSizePerspective),(0,l.g)(n,n,a),(0,l.t)(It,n,r.transform.inverseRotation),i=(0,l.b)(yt,i,It),o=(0,l.b)(Ot,o,It)}(0,Ke.Bw)(e,r,i,o,function(e){return null!=e?(Be.offset=e,Be):null}(r.verticalOffset),n)}canRender(e,t){return!(t!==be.H.Color&&t!==be.H.Alpha&&t!==be.H.Depth&&t!==be.H.Normal&&t!==be.H.Shadow&&t!==be.H.ShadowHighlight&&t!==be.H.ShadowExcludeHighlight&&t!==be.H.Highlight&&t!==be.H.ObjectAndLayerIdColor||e!==(this.parameters.transparent?this.parameters.writeDepth?De.TRANSPARENT_MATERIAL:De.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:De.OPAQUE_MATERIAL)&&e!==De.DRAPED_MATERIAL)}createGLMaterial(e){return new Rt(e)}createBufferWriter(){return new Ye(this._vertexBufferLayout)}}class Rt extends we.F{constructor(e){super({...e,...e.material.parameters})}_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMap.enabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output!==be.H.Color&&this._output!==be.H.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e));const t=this._material.parameters;this.updateTexture(t.textureId);const r=e.camera.viewInverseTransposeMatrix;return(0,l.s)(t.origin,r[3],r[7],r[11]),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(t.treeRendering?St:pt,e)}}const Ct=new class extends ft{constructor(){super(...arguments),this.initTextureTransparent=!1,this.treeRendering=!1,this.hasVertexTangents=!1}},yt=(0,c.c)(),Ot=(0,c.c)(),Mt=(0,c.f)(0,0,1),Pt=(0,c.c)(),It=(0,c.c)(),Nt=(0,c.c)(),Lt=(0,c.c)(),Dt=I.Z.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");function Ft(e){throw new P.Z("",`Request for object resource failed: ${e}`)}function Ht(e){const t=e.params,r=t.topology;let i=!0;switch(t.vertexAttributes||(Dt.warn("Geometry must specify vertex attributes"),i=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const r in t.vertexAttributes){const t=e[r];t&&t.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(Dt.warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),i=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(Dt.warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),i=!1)):(Dt.warn(`Indexed geometry does not specify face indices for '${r}' attribute`),i=!1)}}else Dt.warn("Indexed geometries must specify faces"),i=!1;break}default:Dt.warn(`Unsupported topology '${r}'`),i=!1}e.params.material||(Dt.warn("Geometry requires material"),i=!1);const o=e.params.vertexAttributes;for(const e in o)o[e].values||(Dt.warn("Geometries with externally defined attributes are not yet supported"),i=!1);return i}function Bt(e){const t=(0,d.cS)();return e.forEach((e=>{const r=e.boundingInfo;null!=r&&((0,d.pp)(t,r.bbMin),(0,d.pp)(t,r.bbMax))})),t}function Ut(e){switch(e){case"mask":return B.JJ.Mask;case"maskAndTransparency":return B.JJ.MaskBlend;case"none":return B.JJ.Opaque;default:return B.JJ.Blend}}function Gt(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const Vt=new D.G(1,2,"wosr");var zt=r(57758);async function Wt(e,t){const r=function(e){const t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);return t?{fileType:"gltf",url:t[1],specifiedLodIndex:null!=t[4]?Number(t[4]):null}:e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}((0,i.pJ)(e));if("wosr"===r.fileType){const e=await(t.cache?t.cache.loadWOSR(r.url,t):async function(e,t){const r=await async function(e,t){const r=null!=t&&t.streamDataRequester;if(r)return async function(e,t,r){const i=await(0,O.q6)(t.request(e,"json",r));if(!0===i.ok)return i.value;(0,L.r9)(i.error),Ft(i.error.details.url)}(e,r,t);const i=await(0,O.q6)((0,y.default)(e,t));if(!0===i.ok)return i.value.data;(0,L.r9)(i.error),Ft(i.error)}(e,t),i=await async function(e,t){const r=new Array;for(const i in e){const o=e[i],n=o.images[0].data;if(!n){Dt.warn("Externally referenced texture data is not yet supported");continue}const a=o.encoding+";base64,"+n,s="/textureDefinitions/"+i,l="rgba"===o.channels?o.alphaChannelUsage||"transparency":"none",c={noUnpackFlip:!0,wrap:{s:J.e8.REPEAT,t:J.e8.REPEAT},preMultiplyAlpha:Ut(l)!==B.JJ.Opaque},d=null!=t&&t.disableTextures?Promise.resolve(null):F(a,t);r.push(d.then((e=>({refId:s,image:e,parameters:c,alphaChannelUsage:l}))))}const i=await Promise.all(r),o={};for(const e of i)o[e.refId]=e;return o}(r.textureDefinitions??{},t);let o=0;for(const e in i)if(i.hasOwnProperty(e)){const t=i[e];o+=t?.image?t.image.width*t.image.height*4:0}return{resource:r,textures:i,size:o+(0,M.Ul)(r)}}(r.url,t)),{engineResources:i,referenceBoundingBox:o}=function(e,t){const r=new Array,i=new Array,o=new Array,n=new N,a=e.resource,s=D.G.parse(a.version||"1.0","wosr");Vt.validate(s);const l=a.model.name,d=a.model.geometries,u=a.materialDefinitions??{},h=e.textures;let m=0;const f=new Map;for(let e=0;e<d.length;e++){const a=d[e];if(!Ht(a))continue;const s=Gt(a),l=a.params.vertexAttributes,p=[];for(const e in l){const t=l[e],r=t.values;p.push([e,new H.a(r,t.valuesPerElement,!0)])}const g=[];if("PerAttributeArray"!==a.params.topology){const e=a.params.faces;for(const t in e)g.push([t,e[t].values])}const v=s.texture,_=h&&h[v];if(_&&!f.has(v)){const{image:e,parameters:t}=_,r=new ge(e,t);i.push(r),f.set(v,r)}const T=f.get(v),x=T?T.id:void 0,b=s.material;let E=n.get(b,v);if(null==E){const e=u[b.substring(b.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=_&&_.alphaChannelUsage,i=e.transparency>0||"transparency"===r||"maskAndTransparency"===r,o=_?Ut(_.alphaChannelUsage):void 0,a={ambient:(0,c.g)(e.diffuse),diffuse:(0,c.g)(e.diffuse),opacity:1-(e.transparency||0),transparent:i,textureAlphaMode:o,textureAlphaCutoff:.33,textureId:x,initTextureTransparent:!0,doubleSided:!0,cullFace:B.Vr.None,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:_?.parameters.preMultiplyAlpha??!1};null!=t&&t.materialParamsMixin&&Object.assign(a,t.materialParamsMixin),E=new wt(a),n.set(b,v,E)}o.push(E);const A=new U.Z(E,p,g);m+=g.find((e=>e[0]===_e.T.POSITION))?.[1].length??0,r.push(A)}return{engineResources:[{name:l,stageResources:{textures:i,materials:o,geometries:r},pivotOffset:a.model.pivotOffset,numberOfVertices:m,lodThreshold:null}],referenceBoundingBox:Bt(r)}}(e,t);return{lods:i,referenceBoundingBox:o,isEsriSymbolResource:!1,isWosr:!0}}const n=await(t.cache?t.cache.loadGLTF(r.url,t,!!t.usePBR):(0,x.Q)(new T.C(t.streamDataRequester),r.url,t,t.usePBR)),u=n.model.meta?.ESRI_proxyEllipsoid,A=n.meta.isEsriSymbolResource&&null!=u&&n.meta.uri.includes("/RealisticTrees/");A&&!n.customMeta.esriTreeRendering&&(n.customMeta.esriTreeRendering=!0,function(e,t){for(let r=0;r<e.model.lods.length;++r){const i=e.model.lods[r];for(const o of i.parts){const i=o.attributes.normal;if(null==i)return;const n=o.attributes.position,d=n.count,u=(0,c.c)(),h=(0,c.c)(),f=(0,c.c)(),p=new Uint8Array(4*d),g=new Float64Array(3*d),v=(0,a.a)((0,s.c)(),o.transform);let _=0,T=0;for(let a=0;a<d;a++){n.getVec(a,h),i.getVec(a,u),(0,l.m)(h,h,o.transform),(0,l.b)(f,h,t.center),(0,l.E)(f,f,t.radius);const s=f[2],c=(0,l.l)(f),d=Math.min(.45+.55*c*c,1);(0,l.E)(f,f,t.radius),null!==v&&(0,l.m)(f,f,v),(0,l.n)(f,f),r+1!==e.model.lods.length&&e.model.lods.length>1&&(0,l.h)(f,f,u,s>-1?.2:Math.min(-4*s-3.8,1)),g[_]=f[0],g[_+1]=f[1],g[_+2]=f[2],_+=3,p[T]=255*d,p[T+1]=255*d,p[T+2]=255*d,p[T+3]=255,T+=4}o.attributes.normal=new m.ct(g),o.attributes.color=new m.mc(p)}}}(n,u));const S=!!t.usePBR,R=n.meta.isEsriSymbolResource?{usePBR:S,isSchematic:!1,treeRendering:A,mrrFactors:[...ht]}:{usePBR:S,isSchematic:!1,treeRendering:!1,mrrFactors:[...dt]},P={...t.materialParamsMixin,treeRendering:A},{engineResources:I,referenceBoundingBox:G}=function(e,t,r,i){const n=e.model,a=new Array,s=new Map,u=new Map,T=n.lods.length,x=(0,d.cS)();return n.lods.forEach(((e,A)=>{const S=!0===i.skipHighLods&&(T>1&&0===A||T>3&&1===A)||!1===i.skipHighLods&&null!=i.singleLodIndex&&A!==i.singleLodIndex;if(S&&0!==A)return;const R=new C(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach((e=>{const i=S?new wt({}):function(e,t,r,i,o,n,a){const s=t.material+(t.attributes.normal?"_normal":"")+(t.attributes.color?"_color":"")+(t.attributes.texCoord0?"_texCoord0":"")+(t.attributes.tangent?"_tangent":""),d=e.materials.get(t.material),u=null!=t.attributes.texCoord0,h=null!=t.attributes.normal;if(null==d)return null;const m=function(e){switch(e){case"BLEND":return B.JJ.Blend;case"MASK":return B.JJ.Mask;case"OPAQUE":case null:case void 0:return B.JJ.Opaque}}(d.alphaMode);if(!n.has(s)){if(u){const t=(t,r=!1)=>{if(null!=t&&!a.has(t)){const i=e.textures.get(t);if(null!=i){const e=i.data;a.set(t,new ge((0,E.$A)(e)?e.data:e,{...i.parameters,preMultiplyAlpha:!(0,E.$A)(e)&&r,encoding:(0,E.$A)(e)&&null!=e.encoding?e.encoding:void 0}))}}};t(d.textureColor,m!==B.JJ.Opaque),t(d.textureNormal),t(d.textureOcclusion),t(d.textureEmissive),t(d.textureMetallicRoughness)}const r=d.color[0]**(1/zt.K),f=d.color[1]**(1/zt.K),p=d.color[2]**(1/zt.K),g=d.emissiveFactor[0]**(1/zt.K),v=d.emissiveFactor[1]**(1/zt.K),_=d.emissiveFactor[2]**(1/zt.K),T=null!=d.textureColor&&u?a.get(d.textureColor):null,x=function({normalTexture:e,metallicRoughnessTexture:t,metallicFactor:r,roughnessFactor:i,emissiveTexture:o,emissiveFactor:n,occlusionTexture:a}){return null==e&&null==t&&null==o&&(null==n||(0,l.k)(n,c.Z))&&null==a&&(null==i||1===i)&&(null==r||1===r||0===r)}({normalTexture:d.textureNormal,metallicRoughnessTexture:d.textureMetallicRoughness,metallicFactor:d.metallicFactor,roughnessFactor:d.roughnessFactor,emissiveTexture:d.textureEmissive,emissiveFactor:d.emissiveFactor,occlusionTexture:d.textureOcclusion});n.set(s,new wt({...i,transparent:m===B.JJ.Blend,customDepthTest:B.Gv.Lequal,textureAlphaMode:m,textureAlphaCutoff:d.alphaCutoff,diffuse:[r,f,p],ambient:[r,f,p],opacity:d.opacity,doubleSided:d.doubleSided,doubleSidedType:"winding-order",cullFace:d.doubleSided?B.Vr.None:B.Vr.Back,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:h?Ee.r.Attribute:Ee.r.ScreenDerivative,castShadows:!0,receiveSSAO:!0,textureId:null!=T?T.id:void 0,colorMixMode:d.colorMixMode,normalTextureId:null!=d.textureNormal&&u?a.get(d.textureNormal).id:void 0,textureAlphaPremultiplied:null!=T&&!!T.parameters.preMultiplyAlpha,occlusionTextureId:null!=d.textureOcclusion&&u?a.get(d.textureOcclusion).id:void 0,emissiveTextureId:null!=d.textureEmissive&&u?a.get(d.textureEmissive).id:void 0,metallicRoughnessTextureId:null!=d.textureMetallicRoughness&&u?a.get(d.textureMetallicRoughness).id:void 0,emissiveFactor:[g,v,_],mrrFactors:x?[...ut]:[d.metallicFactor,d.roughnessFactor,i.mrrFactors[2]],isSchematic:x,colorTextureTransformMatrix:w(d.colorTextureTransform),normalTextureTransformMatrix:w(d.normalTextureTransform),occlusionTextureTransformMatrix:w(d.occlusionTextureTransform),emissiveTextureTransformMatrix:w(d.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:w(d.metallicRoughnessTextureTransform),...o}))}const f=n.get(s);if(r.stageResources.materials.push(f),u){const e=e=>{null!=e&&r.stageResources.textures.push(a.get(e))};e(d.textureColor),e(d.textureNormal),e(d.textureOcclusion),e(d.textureEmissive),e(d.textureMetallicRoughness)}return f}(n,e,R,t,r,s,u),{geometry:a,vertexCount:T}=function(e,t){const r=e.attributes.position.count,i=(0,b.p)(e.indices||r,e.primitiveType),n=h(3*r),{typedBuffer:a,typedBufferStride:s}=e.attributes.position;(0,f.t)(n,a,e.transform,3,s);const l=[[_e.T.POSITION,new H.a(n,3,!0)]],c=[[_e.T.POSITION,i]];if(null!=e.attributes.normal){const t=h(3*r),{typedBuffer:n,typedBufferStride:a}=e.attributes.normal;(0,o.d)(kt,e.transform),(0,f.a)(t,n,kt,3,a),l.push([_e.T.NORMAL,new H.a(t,3,!0)]),c.push([_e.T.NORMAL,i])}if(null!=e.attributes.tangent){const t=h(4*r),{typedBuffer:n,typedBufferStride:a}=e.attributes.tangent;(0,o.d)(kt,e.transform),(0,p.t)(t,n,kt,4,a),l.push([_e.T.TANGENT,new H.a(t,4,!0)]),c.push([_e.T.TANGENT,i])}if(null!=e.attributes.texCoord0){const t=h(2*r),{typedBuffer:o,typedBufferStride:n}=e.attributes.texCoord0;(0,g.n)(t,o,2,n),l.push([_e.T.UV0,new H.a(t,2,!0)]),c.push([_e.T.UV0,i])}if(null!=e.attributes.color){const t=new Uint8Array(4*r);4===e.attributes.color.elementCount?e.attributes.color instanceof m.ek?(0,p.s)(t,e.attributes.color,255):e.attributes.color instanceof m.mc?(0,_.c)(t,e.attributes.color):e.attributes.color instanceof m.v6&&(0,p.s)(t,e.attributes.color,1/256):(t.fill(255),e.attributes.color instanceof m.ct?(0,f.s)(t,e.attributes.color,255,4):e.attributes.color instanceof m.ne?(0,v.c)(t,e.attributes.color.typedBuffer,4,e.attributes.color.typedBufferStride):e.attributes.color instanceof m.mw&&(0,f.s)(t,e.attributes.color,1/256,4)),l.push([_e.T.COLOR,new H.a(t,4,!0)]),c.push([_e.T.COLOR,i])}return{geometry:new U.Z(t,l,c),vertexCount:r}}(e,null!=i?i:new wt({})),C=a.boundingInfo;null!=C&&0===A&&((0,d.pp)(x,C.bbMin),(0,d.pp)(x,C.bbMax)),null!=i&&(R.stageResources.geometries.push(a),R.numberOfVertices+=T)})),S||a.push(R)})),{engineResources:a,referenceBoundingBox:x}}(n,R,P,t.skipHighLods&&null==r.specifiedLodIndex?{skipHighLods:!0}:{skipHighLods:!1,singleLodIndex:r.specifiedLodIndex});return{lods:I,referenceBoundingBox:G,isEsriSymbolResource:n.meta.isEsriSymbolResource,isWosr:!1}}const kt=(0,n.c)()},1391:(e,t,r)=>{r.d(t,{Zu:()=>l,bA:()=>c,qj:()=>d});var i=r(55039),o=r(2095),n=r(19693),a=r(74709);function s(e){e.varyings.add("linearDepth","float")}function l(e){e.vertex.uniforms.add(new n.A("nearFar",((e,t)=>t.camera.nearFar)))}function c(e){e.vertex.code.add(a.H`float calculateLinearDepth(vec2 nearFar,float z) {
|
|
286
286
|
return (-z - nearFar[0]) / (nearFar[1] - nearFar[0]);
|
|
287
287
|
}`)}function d(e,t){const{vertex:r}=e;switch(t.output){case i.H.Color:if(t.receiveShadows)return s(e),void r.code.add(a.H`void forwardLinearDepth() { linearDepth = gl_Position.w; }`);break;case i.H.Depth:case i.H.Shadow:case i.H.ShadowHighlight:case i.H.ShadowExcludeHighlight:return e.include(o.up,t),s(e),l(e),c(e),void r.code.add(a.H`void forwardLinearDepth() {
|
|
288
288
|
linearDepth = calculateLinearDepth(nearFar, vPosition_view.z);
|
package/core/Collection.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"./ArrayPool.js";import s from"./Evented.js";import{makeHandle as i}from"./handleUtils.js";import{clone as r}from"./lang.js";import n from"./ObjectPool.js";import{ObservableChangesType as h}from"./ObservableChangesType.js";import{schedule as o}from"./scheduling.js";import{ensureType as l,ensureOneOfType as a}from"./accessorSupport/ensureType.js";import{trackAccess as c}from"./accessorSupport/tracking.js";import{property as f}from"./accessorSupport/decorators/property.js";import{shared as _}from"./accessorSupport/decorators/shared.js";import{subclass as m}from"./accessorSupport/decorators/subclass.js";import{SimpleObservable as u}from"./accessorSupport/tracking/SimpleObservable.js";var g;class d{constructor(){this.target=null,this.cancellable=!1,this.defaultPrevented=!1,this.item=void 0,this.type=void 0}preventDefault(){this.cancellable&&(this.defaultPrevented=!0)}reset(e){this.defaultPrevented=!1,this.item=e}}class p{constructor(e,t,s,i,r){this.target=e,this.added=t,this.removed=s,this.start=i,this.deleteCount=r}}const b=new n(d,void 0,(e=>{e.item=null,e.target=null,e.defaultPrevented=!1,e.cancellable=!1}));function v(e){return e?e instanceof R?e.toArray():e.length?Array.prototype.slice.apply(e):[]:[]}function E(e){if(e&&e.length)return e[0]}function C(e,t,s,i){const r=Math.min(e.length-s,t.length-i);let n=0;for(;n<r&&e[s+n]===t[i+n];)n++;return n}function y(e,t,s,i){t&&t.forEach(((t,r,n)=>{e.push(t),y(e,s.call(i,t,r,n),s,i)}))}const A=new Set,O=new Set,M=new Set,D=new Map;let x=0,R=g=class extends s.EventedAccessor{static isCollection(e){return null!=e&&e instanceof g}constructor(e){super(e),this._chgListeners=[],this._notifications=null,this._timer=null,this._observable=new u,this.length=0,this._items=[],Object.defineProperty(this,"uid",{value:x++})}normalizeCtorArgs(e){return e?Array.isArray(e)||e instanceof g?{items:e}:e:{}}destroy(){this._removeAllRaw()}*[Symbol.iterator](){yield*this.items}get items(){return c(this._observable),this._items}set items(e){this._emitBeforeChanges(h.ADD)||(this._splice(0,this.length,v(e)),this._emitAfterChanges(h.ADD))}hasEventListener(e){return"change"===e?this._chgListeners.length>0:this._emitter.hasEventListener(e)}on(e,t){if("change"===e){const e=this._chgListeners,s={removed:!1,callback:t};return e.push(s),this._notifications&&this._notifications.push({listeners:e.slice(),items:this._items.slice(),changes:[]}),i((()=>{s.removed=!0,e.splice(e.indexOf(s),1)}))}return this._emitter.on(e,t)}once(e,t){return this.on(e,t)}add(e,t){if(c(this._observable),this._emitBeforeChanges(h.ADD))return this;const s=this.getNextIndex(t??null);return this._splice(s,0,[e]),this._emitAfterChanges(h.ADD),this}addMany(e,t=this._items.length){if(c(this._observable),!e||!e.length)return this;if(this._emitBeforeChanges(h.ADD))return this;const s=this.getNextIndex(t);return this._splice(s,0,v(e)),this._emitAfterChanges(h.ADD),this}at(e){if(c(this._observable),(e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this._items[e]}removeAll(){if(c(this._observable),!this.length||this._emitBeforeChanges(h.REMOVE))return[];const e=this._removeAllRaw();return this._emitAfterChanges(h.REMOVE),e}_removeAllRaw(){return 0===this.length?[]:this._splice(0,this.length)||[]}clone(){return c(this._observable),this._createNewInstance({items:this._items.map(r)})}concat(...e){c(this._observable);const t=e.map(v);return this._createNewInstance({items:this._items.concat(...t)})}drain(e,t){if(c(this._observable),!this.length||this._emitBeforeChanges(h.REMOVE))return;const s=this._splice(0,this.length),i=s.length;for(let r=0;r<i;r++)e.call(t,s[r],r,s);this._emitAfterChanges(h.REMOVE)}every(e,t){return c(this._observable),this._items.every(e,t)}filter(e,t){let s;return c(this._observable),s=2===arguments.length?this._items.filter(e,t):this._items.filter(e),this._createNewInstance({items:s})}find(e,t){return c(this._observable),this._items.find(e,t)}findIndex(e,t){return c(this._observable),this._items.findIndex(e,t)}flatten(e,t){c(this._observable);const s=[];return y(s,this,e,t),new g(s)}forEach(e,t){return c(this._observable),this._items.forEach(e,t)}getItemAt(e){return c(this._observable),this._items[e]}getNextIndex(e){c(this._observable);const t=this.length;return(e=e??t)<0?e=0:e>t&&(e=t),e}includes(e,t=0){return c(this._observable),this._items.includes(e,t)}indexOf(e,t=0){return c(this._observable),this._items.indexOf(e,t)}join(e=","){return c(this._observable),this._items.join(e)}lastIndexOf(e,t=this.length-1){return c(this._observable),this._items.lastIndexOf(e,t)}map(e,t){c(this._observable);const s=this._items.map(e,t);return new g({items:s})}reorder(e,t=this.length-1){c(this._observable);const s=this.indexOf(e);if(-1!==s){if(t<0?t=0:t>=this.length&&(t=this.length-1),s!==t){if(this._emitBeforeChanges(h.MOVE))return e;this._splice(s,1),this._splice(t,0,[e]),this._emitAfterChanges(h.MOVE)}return e}}pop(){if(c(this._observable),!this.length||this._emitBeforeChanges(h.REMOVE))return;const e=E(this._splice(this.length-1,1));return this._emitAfterChanges(h.REMOVE),e}push(...e){return c(this._observable),this._emitBeforeChanges(h.ADD)||(this._splice(this.length,0,e),this._emitAfterChanges(h.ADD)),this.length}reduce(e,t){c(this._observable);const s=this._items;return 2===arguments.length?s.reduce(e,t):s.reduce(e)}reduceRight(e,t){c(this._observable);const s=this._items;return 2===arguments.length?s.reduceRight(e,t):s.reduceRight(e)}remove(e){return c(this._observable),this.removeAt(this.indexOf(e))}removeAt(e){if(c(this._observable),e<0||e>=this.length||this._emitBeforeChanges(h.REMOVE))return;const t=E(this._splice(e,1));return this._emitAfterChanges(h.REMOVE),t}removeMany(e){if(c(this._observable),!e||!e.length||this._emitBeforeChanges(h.REMOVE))return[];const t=e instanceof g?e.toArray():e,s=this._items,i=[],r=t.length;for(let n=0;n<r;n++){const e=t[n],r=s.indexOf(e);if(r>-1){const e=1+C(t,s,n+1,r+1),h=this._splice(r,e);h&&h.length>0&&i.push.apply(i,h),n+=e-1}}return this._emitAfterChanges(h.REMOVE),i}reverse(){if(c(this._observable),this._emitBeforeChanges(h.MOVE))return this;const e=this._splice(0,this.length);return e&&(e.reverse(),this._splice(0,0,e)),this._emitAfterChanges(h.MOVE),this}shift(){if(c(this._observable),!this.length||this._emitBeforeChanges(h.REMOVE))return;const e=E(this._splice(0,1));return this._emitAfterChanges(h.REMOVE),e}slice(e=0,t=this.length){return c(this._observable),this._createNewInstance({items:this._items.slice(e,t)})}some(e,t){return c(this._observable),this._items.some(e,t)}sort(e){if(c(this._observable),!this.length||this._emitBeforeChanges(h.MOVE))return this;const t=this._splice(0,this.length);return arguments.length?t.sort(e):t.sort(),this._splice(0,0,t),this._emitAfterChanges(h.MOVE),this}splice(e,t,...s){c(this._observable);const i=(t?h.REMOVE:0)|(s.length?h.ADD:0);if(this._emitBeforeChanges(i))return[];const r=this._splice(e,t,s)||[];return this._emitAfterChanges(i),r}toArray(){return c(this._observable),this._items.slice()}toJSON(){return c(this._observable),this.toArray()}toLocaleString(){return c(this._observable),this._items.toLocaleString()}toString(){return c(this._observable),this._items.toString()}unshift(...e){return c(this._observable),!e.length||this._emitBeforeChanges(h.ADD)||(this._splice(0,0,e),this._emitAfterChanges(h.ADD)),this.length}_createNewInstance(e){return new this.constructor(e)}_splice(e,t,s){const i=this._items,r=this.itemType;let n,h;if(!this._notifications&&this.hasEventListener("change")&&(this._notifications=[{listeners:this._chgListeners.slice(),items:this._items.slice(),changes:[]}],this._timer&&this._timer.remove(),this._timer=o((()=>this._dispatchChange()))),t){if(h=i.splice(e,t),this.hasEventListener("before-remove")){const t=b.acquire();t.target=this,t.cancellable=!0;for(let s=0,r=h.length;s<r;s++)n=h[s],t.reset(n),this.emit("before-remove",t),t.defaultPrevented&&(h.splice(s,1),i.splice(e,0,n),e+=1,s-=1,r-=1);b.release(t)}if(this.length=this._items.length,this.hasEventListener("after-remove")){const e=b.acquire();e.target=this,e.cancellable=!1;const t=h.length;for(let s=0;s<t;s++)e.reset(h[s]),this.emit("after-remove",e);b.release(e)}}if(s&&s.length){if(r){const e=[];for(const t of s){const s=r.ensureType(t);null==s&&null!=t||e.push(s)}s=e}const t=this.hasEventListener("before-add"),n=this.hasEventListener("after-add"),h=e===this.length;if(t||n){const r=b.acquire();r.target=this,r.cancellable=!0;const o=b.acquire();o.target=this,o.cancellable=!1;for(const l of s)t?(r.reset(l),this.emit("before-add",r),r.defaultPrevented||(h?i.push(l):i.splice(e++,0,l),this._set("length",i.length),n&&(o.reset(l),this.emit("after-add",o)))):(h?i.push(l):i.splice(e++,0,l),this._set("length",i.length),o.reset(l),this.emit("after-add",o));b.release(o),b.release(r)}else{if(h)for(const e of s)i.push(e);else i.splice(e,0,...s);this._set("length",i.length)}}if((s&&s.length||h&&h.length)&&this._notifyChangeEvent(s,h),this.hasEventListener("after-splice")){const i=new p(this,s,h,e,t);this.emit("after-splice",i)}return h}_emitBeforeChanges(e){let t=!1;if(this.hasEventListener("before-changes")){const s=b.acquire();s.target=this,s.cancellable=!0,s.type=e,this.emit("before-changes",s),t=s.defaultPrevented,b.release(s)}return t}_emitAfterChanges(e){if(this.hasEventListener("after-changes")){const t=b.acquire();t.target=this,t.cancellable=!1,t.type=e,this.emit("after-changes",t),b.release(t)}this._observable.notify()}_notifyChangeEvent(e,t){this.hasEventListener("change")&&this._notifications&&this._notifications[this._notifications.length-1].changes.push({added:e,removed:t})}_dispatchChange(){if(this._timer&&(this._timer.remove(),this._timer=null),!this._notifications)return;const e=this._notifications;this._notifications=null;for(const s of e){const e=s.changes;A.clear(),O.clear(),M.clear();for(const{added:t,removed:s}of e){if(t)if(0===M.size&&0===O.size)for(const e of t)A.add(e);else for(const e of t)O.has(e)?(M.add(e),O.delete(e)):M.has(e)||A.add(e);if(s)if(0===M.size&&0===A.size)for(const e of s)O.add(e);else for(const e of s)A.has(e)?A.delete(e):(M.delete(e),O.add(e))}const i=t.acquire();A.forEach((e=>{i.push(e)}));const r=t.acquire();O.forEach((e=>{r.push(e)}));const n=this._items,h=s.items,o=t.acquire();if(M.forEach((e=>{h.indexOf(e)!==n.indexOf(e)&&o.push(e)})),s.listeners&&(i.length||r.length||o.length)){const e={target:this,added:i,removed:r,moved:o},t=s.listeners.length;for(let i=0;i<t;i++){const t=s.listeners[i];t.removed||t.callback.call(this,e)}}t.release(i),t.release(r),t.release(o)}A.clear(),O.clear(),M.clear()}};R.ofType=t=>{if(!t)return g;if(D.has(t))return D.get(t);let s=null;if("function"==typeof t)s=t.prototype.declaredClass;else if(t.base)s=t.base.prototype.declaredClass;else for(const e in t.typeMap){const i=t.typeMap[e].prototype.declaredClass;s?s+=` | ${i}`:s=i}let i=class extends g{};return e([_({Type:t,ensureType:"function"==typeof t?l(t):a(t)})],i.prototype,"itemType",void 0),i=e([m(`esri.core.Collection<${s}>`)],i),D.set(t,i),i},e([f()],R.prototype,"length",void 0),e([f()],R.prototype,"items",null),R=g=e([m("esri.core.Collection")],R);const V=R;export{V as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"./ArrayPool.js";import s from"./Evented.js";import{makeHandle as i}from"./handleUtils.js";import{clone as r}from"./lang.js";import n from"./ObjectPool.js";import{ObservableChangesType as h}from"./ObservableChangesType.js";import{schedule as o}from"./scheduling.js";import{ensureType as l,ensureOneOfType as a}from"./accessorSupport/ensureType.js";import{trackAccess as c}from"./accessorSupport/tracking.js";import{property as f}from"./accessorSupport/decorators/property.js";import{shared as _}from"./accessorSupport/decorators/shared.js";import{subclass as m}from"./accessorSupport/decorators/subclass.js";import{SimpleObservable as u}from"./accessorSupport/tracking/SimpleObservable.js";var g;class d{constructor(){this.target=null,this.cancellable=!1,this.defaultPrevented=!1,this.item=void 0,this.type=void 0}preventDefault(){this.cancellable&&(this.defaultPrevented=!0)}reset(e){this.defaultPrevented=!1,this.item=e}}class p{constructor(e,t,s,i,r){this.target=e,this.added=t,this.removed=s,this.start=i,this.deleteCount=r}}const b=new n(d,void 0,(e=>{e.item=null,e.target=null,e.defaultPrevented=!1,e.cancellable=!1}));function v(e){return e?e instanceof R?e.toArray():e.length?Array.prototype.slice.apply(e):[]:[]}function E(e){if(e&&e.length)return e[0]}function C(e,t,s,i){const r=Math.min(e.length-s,t.length-i);let n=0;for(;n<r&&e[s+n]===t[i+n];)n++;return n}function y(e,t,s,i){t&&t.forEach(((t,r,n)=>{e.push(t),y(e,s.call(i,t,r,n),s,i)}))}const A=new Set,O=new Set,M=new Set,D=new Map;let x=0,R=g=class extends s.EventedAccessor{static isCollection(e){return null!=e&&e instanceof g}constructor(e){super(e),this._chgListeners=[],this._notifications=null,this._timer=null,this._observable=new u,this.length=0,this._items=[],Object.defineProperty(this,"uid",{value:x++})}normalizeCtorArgs(e){return e?Array.isArray(e)||e instanceof g?{items:e}:e:{}}destroy(){this._removeAllRaw()}*[Symbol.iterator](){yield*this.items}get items(){return c(this._observable),this._items}set items(e){this._emitBeforeChanges(h.ADD)||(this._splice(0,this.length,v(e)),this._emitAfterChanges(h.ADD))}hasEventListener(e){return"change"===e?this._chgListeners.length>0:this._emitter.hasEventListener(e)}on(e,t){if("change"===e){const e=this._chgListeners,s={removed:!1,callback:t};return e.push(s),this._notifications&&this._notifications.push({listeners:e.slice(),items:this._items.slice(),changes:[]}),i((()=>{s.removed=!0,e.splice(e.indexOf(s),1)}))}return this._emitter.on(e,t)}once(e,t){return this.on(e,t)}add(e,t){if(c(this._observable),this._emitBeforeChanges(h.ADD))return this;const s=this.getNextIndex(t??null);return this._splice(s,0,[e]),this._emitAfterChanges(h.ADD),this}addMany(e,t=this._items.length){if(c(this._observable),!e||!e.length)return this;if(this._emitBeforeChanges(h.ADD))return this;const s=this.getNextIndex(t);return this._splice(s,0,v(e)),this._emitAfterChanges(h.ADD),this}at(e){if(c(this._observable),(e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this._items[e]}removeAll(){if(c(this._observable),!this.length||this._emitBeforeChanges(h.REMOVE))return[];const e=this._removeAllRaw();return this._emitAfterChanges(h.REMOVE),e}_removeAllRaw(){return 0===this.length?[]:this._splice(0,this.length)||[]}clone(){return c(this._observable),this._createNewInstance({items:this._items.map(r)})}concat(...e){c(this._observable);const t=e.map(v);return this._createNewInstance({items:this._items.concat(...t)})}drain(e,t){if(c(this._observable),!this.length||this._emitBeforeChanges(h.REMOVE))return;const s=this._splice(0,this.length),i=s.length;for(let r=0;r<i;r++)e.call(t,s[r],r,s);this._emitAfterChanges(h.REMOVE)}every(e,t){return c(this._observable),this._items.every(e,t)}filter(e,t){let s;return c(this._observable),s=2===arguments.length?this._items.filter(e,t):this._items.filter(e),this._createNewInstance({items:s})}find(e,t){return c(this._observable),this._items.find(e,t)}findIndex(e,t){return c(this._observable),this._items.findIndex(e,t)}flatten(e,t){c(this._observable);const s=[];return y(s,this,e,t),new g(s)}forEach(e,t){return c(this._observable),this._items.forEach(e,t)}getItemAt(e){return c(this._observable),this._items[e]}getNextIndex(e){c(this._observable);const t=this.length;return(e=e??t)<0?e=0:e>t&&(e=t),e}includes(e,t=0){return c(this._observable),this._items.includes(e,t)}indexOf(e,t=0){return c(this._observable),this._items.indexOf(e,t)}join(e=","){return c(this._observable),this._items.join(e)}lastIndexOf(e,t=this.length-1){return c(this._observable),this._items.lastIndexOf(e,t)}map(e,t){c(this._observable);const s=this._items.map(e,t);return new g({items:s})}reorder(e,t=this.length-1){c(this._observable);const s=this.indexOf(e);if(-1!==s){if(t<0?t=0:t>=this.length&&(t=this.length-1),s!==t){if(this._emitBeforeChanges(h.MOVE))return e;this._splice(s,1),this._splice(t,0,[e]),this._emitAfterChanges(h.MOVE)}return e}}pop(){if(c(this._observable),!this.length||this._emitBeforeChanges(h.REMOVE))return;const e=E(this._splice(this.length-1,1));return this._emitAfterChanges(h.REMOVE),e}push(...e){return c(this._observable),this._emitBeforeChanges(h.ADD)||(this._splice(this.length,0,e),this._emitAfterChanges(h.ADD)),this.length}reduce(e,t){c(this._observable);const s=this._items;return 2===arguments.length?s.reduce(e,t):s.reduce(e)}reduceRight(e,t){c(this._observable);const s=this._items;return 2===arguments.length?s.reduceRight(e,t):s.reduceRight(e)}remove(e){return c(this._observable),this.removeAt(this.indexOf(e))}removeAt(e){if(c(this._observable),e<0||e>=this.length||this._emitBeforeChanges(h.REMOVE))return;const t=E(this._splice(e,1));return this._emitAfterChanges(h.REMOVE),t}removeMany(e){if(c(this._observable),!e||!e.length||this._emitBeforeChanges(h.REMOVE))return[];const t=e instanceof g?e.toArray():e,s=this._items,i=[],r=t.length;for(let n=0;n<r;n++){const e=t[n],r=s.indexOf(e);if(r>-1){const e=1+C(t,s,n+1,r+1),h=this._splice(r,e);h&&h.length>0&&i.push.apply(i,h),n+=e-1}}return this._emitAfterChanges(h.REMOVE),i}reverse(){if(c(this._observable),this._emitBeforeChanges(h.MOVE))return this;const e=this._splice(0,this.length);return e&&(e.reverse(),this._splice(0,0,e)),this._emitAfterChanges(h.MOVE),this}shift(){if(c(this._observable),!this.length||this._emitBeforeChanges(h.REMOVE))return;const e=E(this._splice(0,1));return this._emitAfterChanges(h.REMOVE),e}slice(e=0,t=this.length){return c(this._observable),this._createNewInstance({items:this._items.slice(e,t)})}some(e,t){return c(this._observable),this._items.some(e,t)}sort(e){if(c(this._observable),!this.length||this._emitBeforeChanges(h.MOVE))return this;const t=this._splice(0,this.length);return arguments.length?t.sort(e):t.sort(),this._splice(0,0,t),this._emitAfterChanges(h.MOVE),this}splice(e,t,...s){c(this._observable);const i=(t?h.REMOVE:0)|(s.length?h.ADD:0);if(this._emitBeforeChanges(i))return[];const r=this._splice(e,t,s)||[];return this._emitAfterChanges(i),r}toArray(){return c(this._observable),this._items.slice()}toJSON(){return c(this._observable),this.toArray()}toLocaleString(){return c(this._observable),this._items.toLocaleString()}toString(){return c(this._observable),this._items.toString()}unshift(...e){return c(this._observable),!e.length||this._emitBeforeChanges(h.ADD)||(this._splice(0,0,e),this._emitAfterChanges(h.ADD)),this.length}_createNewInstance(e){return new this.constructor(e)}_splice(e,t,s){const i=this._items,r=this.itemType;let n,h;if(!this._notifications&&this.hasEventListener("change")&&(this._notifications=[{listeners:this._chgListeners.slice(),items:this._items.slice(),changes:[]}],this._timer&&this._timer.remove(),this._timer=o((()=>this._dispatchChange()))),e<0&&(e+=this.length),t){if(h=i.splice(e,t),this.hasEventListener("before-remove")){const t=b.acquire();t.target=this,t.cancellable=!0;for(let s=0,r=h.length;s<r;s++)n=h[s],t.reset(n),this.emit("before-remove",t),t.defaultPrevented&&(h.splice(s,1),i.splice(e,0,n),e+=1,s-=1,r-=1);b.release(t)}if(this.length=this._items.length,this.hasEventListener("after-remove")){const e=b.acquire();e.target=this,e.cancellable=!1;const t=h.length;for(let s=0;s<t;s++)e.reset(h[s]),this.emit("after-remove",e);b.release(e)}}if(s&&s.length){if(r){const e=[];for(const t of s){const s=r.ensureType(t);null==s&&null!=t||e.push(s)}s=e}const t=this.hasEventListener("before-add"),n=this.hasEventListener("after-add"),h=e===this.length;if(t||n){const r=b.acquire();r.target=this,r.cancellable=!0;const o=b.acquire();o.target=this,o.cancellable=!1;for(const l of s)t?(r.reset(l),this.emit("before-add",r),r.defaultPrevented||(h?i.push(l):i.splice(e++,0,l),this._set("length",i.length),n&&(o.reset(l),this.emit("after-add",o)))):(h?i.push(l):i.splice(e++,0,l),this._set("length",i.length),o.reset(l),this.emit("after-add",o));b.release(o),b.release(r)}else{if(h)for(const e of s)i.push(e);else i.splice(e,0,...s);this._set("length",i.length)}}if((s&&s.length||h&&h.length)&&this._notifyChangeEvent(s,h),this.hasEventListener("after-splice")){const i=new p(this,s,h,e,t);this.emit("after-splice",i)}return h}_emitBeforeChanges(e){let t=!1;if(this.hasEventListener("before-changes")){const s=b.acquire();s.target=this,s.cancellable=!0,s.type=e,this.emit("before-changes",s),t=s.defaultPrevented,b.release(s)}return t}_emitAfterChanges(e){if(this.hasEventListener("after-changes")){const t=b.acquire();t.target=this,t.cancellable=!1,t.type=e,this.emit("after-changes",t),b.release(t)}this._observable.notify()}_notifyChangeEvent(e,t){this.hasEventListener("change")&&this._notifications&&this._notifications[this._notifications.length-1].changes.push({added:e,removed:t})}_dispatchChange(){if(this._timer&&(this._timer.remove(),this._timer=null),!this._notifications)return;const e=this._notifications;this._notifications=null;for(const s of e){const e=s.changes;A.clear(),O.clear(),M.clear();for(const{added:t,removed:s}of e){if(t)if(0===M.size&&0===O.size)for(const e of t)A.add(e);else for(const e of t)O.has(e)?(M.add(e),O.delete(e)):M.has(e)||A.add(e);if(s)if(0===M.size&&0===A.size)for(const e of s)O.add(e);else for(const e of s)A.has(e)?A.delete(e):(M.delete(e),O.add(e))}const i=t.acquire();A.forEach((e=>{i.push(e)}));const r=t.acquire();O.forEach((e=>{r.push(e)}));const n=this._items,h=s.items,o=t.acquire();if(M.forEach((e=>{h.indexOf(e)!==n.indexOf(e)&&o.push(e)})),s.listeners&&(i.length||r.length||o.length)){const e={target:this,added:i,removed:r,moved:o},t=s.listeners.length;for(let i=0;i<t;i++){const t=s.listeners[i];t.removed||t.callback.call(this,e)}}t.release(i),t.release(r),t.release(o)}A.clear(),O.clear(),M.clear()}};R.ofType=t=>{if(!t)return g;if(D.has(t))return D.get(t);let s=null;if("function"==typeof t)s=t.prototype.declaredClass;else if(t.base)s=t.base.prototype.declaredClass;else for(const e in t.typeMap){const i=t.typeMap[e].prototype.declaredClass;s?s+=` | ${i}`:s=i}let i=class extends g{};return e([_({Type:t,ensureType:"function"==typeof t?l(t):a(t)})],i.prototype,"itemType",void 0),i=e([m(`esri.core.Collection<${s}>`)],i),D.set(t,i),i},e([f()],R.prototype,"length",void 0),e([f()],R.prototype,"items",null),R=g=e([m("esri.core.Collection")],R);const V=R;export{V as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../has.js";import e from"../Logger.js";import{getOrCreateMapValue as n}from"../MapUtils.js";const r=e.getLogger("esri.core.accessorSupport.ensureTypes");function t(e){return null==e?e:new Date(e)}function o(e){return null==e?e:!!e}function u(e){return null==e?e:e.toString()}function a(e){return null==e?e:(e=parseFloat(e),isNaN(e)?0:e)}function s(e){return null==e?e:Math.round(parseFloat(e))}function i(e){return e&&e.constructor&&void 0!==e.constructor.__accessorMetadata__}function c(e,n){return null!=n&&e&&!(n instanceof e)}function l(e){return e&&"isCollection"in e}function f(e){return e&&e.Type?"function"==typeof e.Type?e.Type:e.Type.base:null}function p(e,n){if(!n||!n.constructor||!l(n.constructor))return y(e,n)?n:new e(n);const r=f(e.prototype.itemType),t=f(n.constructor.prototype.itemType);return r?t?r===t?n:r.prototype.isPrototypeOf(t.prototype)?new e(n):(y(e,n),n):new e(n):n}function y(e,n){return!!i(n)&&(r.error("Accessor#set","Assigning an instance of '"+(n.declaredClass||"unknown")+"' which is not a subclass of '"+g(e)+"'"),!0)}function v(e,n){return null==n?n:l(e)?p(e,n):c(e,n)?y(e,n)?n:new e(n):n}function g(e){return e&&e.prototype&&e.prototype.declaredClass||"unknown"}const h=new WeakMap;function m(e){switch(e){case Number:return a;case T:return s;case Boolean:return o;case String:return u;case Date:return t;default:return n(h,e,(()=>v.bind(null,e)))}}function d(e,n){const r=m(e);return 1===arguments.length?r:r(n)}function b(e,n,r){return 1===arguments.length?b.bind(null,e):n?Array.isArray(n)?n.map((n=>e(n,r))):[e(n,r)]:n}function w(e,n){return 1===arguments.length?b((n=>d(e,n))):b((n=>d(e,n)),n)}function A(e,n,r){return 0!==n&&Array.isArray(r)?r.map((r=>A(e,n-1,r))):e(r)}function $(e,n,r){if(2===arguments.length)return r=>$(e,n,r);if(!r)return r;r=A(e,n,r);let t=n,o=r;for(;t>0&&Array.isArray(o);)t--,o=o[0];if(void 0!==o)for(let u=0;u<t;u++)r=[r];return r}function j(e,n,r){return 2===arguments.length?$((n=>d(e,n)),n):$((n=>d(e,n)),n,r)}function k(e){return!!Array.isArray(e)&&!e.some((n=>{const r=typeof n;return!("string"===r||"number"===r||"function"===r&&e.length>1)}))}function M(e,n){if(2===arguments.length)return M(e).call(null,n);const t=new Set,o=e.filter((e=>"function"!=typeof e)),u=e.filter((e=>"function"==typeof e));for(const r of e)"string"!=typeof r&&"number"!=typeof r||t.add(r);let a=null,s=null;return(e,n)=>{if(null==e)return e;const i=typeof e,l="string"===i||"number"===i;return l&&(t.has(e)||u.some((e=>"string"===i&&e===String||"number"===i&&e===Number)))||"object"===i&&u.some((n=>!c(e,n)))?e:(l&&o.length?(a||(a=o.map((e=>"string"==typeof e?`'${e}'`:`${e}`)).join(", ")),r.error("Accessor#set",`'${e}' is not a valid value for this property, only the following values are valid: ${a}`)):"object"==typeof e&&u.length?(s||(s=u.map((e=>g(e))).join(", ")),r.error("Accessor#set",`'${e}' is not a valid value for this property, value must be one of ${s}`)):r.error("Accessor#set",`'${e}' is not a valid value for this property`),n&&(n.valid=!1),null)}}function S(e,n){if(2===arguments.length)return S(e).call(null,n);const t={},o=[],u=[];for(const r in e.typeMap){const n=e.typeMap[r];t[r]=d(n),o.push(g(n)),u.push(r)}const a=()=>`'${o.join("', '")}'`,s=()=>`'${u.join("', '")}'`,l="string"==typeof e.key?n=>n[e.key]:e.key;return n=>{if(e.base&&!c(e.base,n))return n;if(null==n)return n;const o=l(n)||e.defaultKeyValue,u=t[o];if(!u)return r.error("Accessor#set",`Invalid property value, value needs to be one of ${a()}, or a plain object that can autocast (having .type = ${s()})`),null;if(!c(e.typeMap[o],n))return n;if("string"==typeof e.key&&!i(n)){const r={};for(const t in n)t!==e.key&&(r[t]=n[t]);return u(r)}return u(n)}}class T{}const N={native:e=>({type:"native",value:e}),array:e=>({type:"array",value:e}),oneOf:e=>({type:"one-of",values:e})};function _(e){if(!e||!("type"in e))return!1;switch(e.type){case"native":case"array":case"one-of":return!0}return!1}function B(e){switch(e.type){case"native":return d(e.value);case"array":return b(B(e.value));case"one-of":return C(e);default:return null}}function C(e){let n=null;return(t,o)=>F(t,e)?t:(null==n&&(n=D(e)),r.error("Accessor#set",`Invalid property value, value needs to be of type ${n}`),o&&(o.valid=!1),null)}function D(e){switch(e.type){case"native":switch(e.value){case Number:return"number";case String:return"string";case Boolean:return"boolean";case T:return"integer";case Date:return"date";default:return g(e.value)}case"array":return`array of ${D(e.value)}`;case"one-of":{const n=e.values.map((e=>D(e)));return`one of ${n.slice(0
|
|
5
|
+
import"../has.js";import e from"../Logger.js";import{getOrCreateMapValue as n}from"../MapUtils.js";const r=e.getLogger("esri.core.accessorSupport.ensureTypes");function t(e){return null==e?e:new Date(e)}function o(e){return null==e?e:!!e}function u(e){return null==e?e:e.toString()}function a(e){return null==e?e:(e=parseFloat(e),isNaN(e)?0:e)}function s(e){return null==e?e:Math.round(parseFloat(e))}function i(e){return e&&e.constructor&&void 0!==e.constructor.__accessorMetadata__}function c(e,n){return null!=n&&e&&!(n instanceof e)}function l(e){return e&&"isCollection"in e}function f(e){return e&&e.Type?"function"==typeof e.Type?e.Type:e.Type.base:null}function p(e,n){if(!n||!n.constructor||!l(n.constructor))return y(e,n)?n:new e(n);const r=f(e.prototype.itemType),t=f(n.constructor.prototype.itemType);return r?t?r===t?n:r.prototype.isPrototypeOf(t.prototype)?new e(n):(y(e,n),n):new e(n):n}function y(e,n){return!!i(n)&&(r.error("Accessor#set","Assigning an instance of '"+(n.declaredClass||"unknown")+"' which is not a subclass of '"+g(e)+"'"),!0)}function v(e,n){return null==n?n:l(e)?p(e,n):c(e,n)?y(e,n)?n:new e(n):n}function g(e){return e&&e.prototype&&e.prototype.declaredClass||"unknown"}const h=new WeakMap;function m(e){switch(e){case Number:return a;case T:return s;case Boolean:return o;case String:return u;case Date:return t;default:return n(h,e,(()=>v.bind(null,e)))}}function d(e,n){const r=m(e);return 1===arguments.length?r:r(n)}function b(e,n,r){return 1===arguments.length?b.bind(null,e):n?Array.isArray(n)?n.map((n=>e(n,r))):[e(n,r)]:n}function w(e,n){return 1===arguments.length?b((n=>d(e,n))):b((n=>d(e,n)),n)}function A(e,n,r){return 0!==n&&Array.isArray(r)?r.map((r=>A(e,n-1,r))):e(r)}function $(e,n,r){if(2===arguments.length)return r=>$(e,n,r);if(!r)return r;r=A(e,n,r);let t=n,o=r;for(;t>0&&Array.isArray(o);)t--,o=o[0];if(void 0!==o)for(let u=0;u<t;u++)r=[r];return r}function j(e,n,r){return 2===arguments.length?$((n=>d(e,n)),n):$((n=>d(e,n)),n,r)}function k(e){return!!Array.isArray(e)&&!e.some((n=>{const r=typeof n;return!("string"===r||"number"===r||"function"===r&&e.length>1)}))}function M(e,n){if(2===arguments.length)return M(e).call(null,n);const t=new Set,o=e.filter((e=>"function"!=typeof e)),u=e.filter((e=>"function"==typeof e));for(const r of e)"string"!=typeof r&&"number"!=typeof r||t.add(r);let a=null,s=null;return(e,n)=>{if(null==e)return e;const i=typeof e,l="string"===i||"number"===i;return l&&(t.has(e)||u.some((e=>"string"===i&&e===String||"number"===i&&e===Number)))||"object"===i&&u.some((n=>!c(e,n)))?e:(l&&o.length?(a||(a=o.map((e=>"string"==typeof e?`'${e}'`:`${e}`)).join(", ")),r.error("Accessor#set",`'${e}' is not a valid value for this property, only the following values are valid: ${a}`)):"object"==typeof e&&u.length?(s||(s=u.map((e=>g(e))).join(", ")),r.error("Accessor#set",`'${e}' is not a valid value for this property, value must be one of ${s}`)):r.error("Accessor#set",`'${e}' is not a valid value for this property`),n&&(n.valid=!1),null)}}function S(e,n){if(2===arguments.length)return S(e).call(null,n);const t={},o=[],u=[];for(const r in e.typeMap){const n=e.typeMap[r];t[r]=d(n),o.push(g(n)),u.push(r)}const a=()=>`'${o.join("', '")}'`,s=()=>`'${u.join("', '")}'`,l="string"==typeof e.key?n=>n[e.key]:e.key;return n=>{if(e.base&&!c(e.base,n))return n;if(null==n)return n;const o=l(n)||e.defaultKeyValue,u=t[o];if(!u)return r.error("Accessor#set",`Invalid property value, value needs to be one of ${a()}, or a plain object that can autocast (having .type = ${s()})`),null;if(!c(e.typeMap[o],n))return n;if("string"==typeof e.key&&!i(n)){const r={};for(const t in n)t!==e.key&&(r[t]=n[t]);return u(r)}return u(n)}}class T{}const N={native:e=>({type:"native",value:e}),array:e=>({type:"array",value:e}),oneOf:e=>({type:"one-of",values:e})};function _(e){if(!e||!("type"in e))return!1;switch(e.type){case"native":case"array":case"one-of":return!0}return!1}function B(e){switch(e.type){case"native":return d(e.value);case"array":return b(B(e.value));case"one-of":return C(e);default:return null}}function C(e){let n=null;return(t,o)=>F(t,e)?t:(null==n&&(n=D(e)),r.error("Accessor#set",`Invalid property value, value needs to be of type ${n}`),o&&(o.valid=!1),null)}function D(e){switch(e.type){case"native":switch(e.value){case Number:return"number";case String:return"string";case Boolean:return"boolean";case T:return"integer";case Date:return"date";default:return g(e.value)}case"array":return`array of ${D(e.value)}`;case"one-of":{const n=e.values.map((e=>D(e)));return`one of ${n.slice(0,-1)} or ${n[n.length-1]}`}}return"unknown"}function F(e,n){if(null==e)return!0;switch(n.type){case"native":switch(n.value){case Number:case T:return"number"==typeof e;case Boolean:return"boolean"==typeof e;case String:return"string"==typeof e}return e instanceof n.value;case"array":return!!Array.isArray(e)&&!e.some((e=>!F(e,n.value)));case"one-of":return n.values.some((n=>F(e,n)))}}export{T as Integer,w as ensureArray,b as ensureArrayTyped,o as ensureBoolean,v as ensureClass,t as ensureDate,s as ensureInteger,B as ensureLongFormType,j as ensureNArray,$ as ensureNArrayTyped,a as ensureNumber,M as ensureOneOf,S as ensureOneOfType,u as ensureString,d as ensureType,i as isClassedType,_ as isLongFormType,k as isOneOf,c as requiresType,N as types};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import o from"../Error.js";import has from"../has.js";import"../Logger.js";import{get as r}from"./get.js";function t(o,e,s){if(o&&e)if("object"==typeof e)for(const r of Object.getOwnPropertyNames(e))t(o,r,e[r]);else{if(e.includes(".")){const n=e.split("."),i=n.splice(
|
|
5
|
+
import o from"../Error.js";import has from"../has.js";import"../Logger.js";import{get as r}from"./get.js";function t(o,e,s){if(o&&e)if("object"==typeof e)for(const r of Object.getOwnPropertyNames(e))t(o,r,e[r]);else{if(e.includes(".")){const n=e.split("."),i=n.splice(-1,1)[0];return void t(r(o,n),i,s)}const i=o.__accessor__;null!=i&&n(e,i),o[e]=s}}function n(r,t){if(has("esri-unknown-property-errors")&&!e(r,t))throw new o("set:unknown-property",s(r,t))}function e(o,r){return null!=r.metadatas[o]}function s(o,r){return"setting unknown property '"+o+"' on instance of "+r.host.declaredClass}export{t as set};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../Graphic.js";import t from"../request.js";import has from"../core/has.js";import i from"../core/Logger.js";import{removeMaybe as s}from"../core/maybe.js";import{isAbortError as r}from"../core/promiseUtils.js";import{watch as a}from"../core/reactiveUtils.js";import{i as n}from"../chunks/vec3.js";import{c as o}from"../chunks/vec3f64.js";import{renderSRFromViewSR as l}from"../geometry/support/coordinateSystem.js";import{PointIndex as h,PlaneIndex as d}from"../geometry/support/frustum.js";import{WasmCullMode as _,VoxelRequestType as u,UpdateFlags as c,ContainerType as m}from"../libs/vxl/enums.js";import{loadVoxelWASM as g}from"../libs/vxl/VxlModule.js";import{ViewingMode as f}from"../views/ViewingMode.js";import{VoxelTarget as p}from"../views/3d/layers/i3s/Intersector.js";import{Frustum as x}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as y}from"../views/3d/support/RenderCoordsHelper.js";import{ShaderOutput as v}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{newIntersectorResult as b}from"../views/3d/webgl-engine/lib/Intersector.js";import{IntersectorType as w,StoreResults as T}from"../views/3d/webgl-engine/lib/IntersectorInterfaces.js";import{RenderFeature as R}from"../views/3d/webgl-engine/lib/RenderFeature.js";import{RenderSlot as L}from"../views/3d/webgl-engine/lib/RenderSlot.js";import{ContextType as E}from"../views/webgl/contextUtils.js";import{CompareFunction as C,Face as F,StencilOperation as V}from"../views/webgl/enums.js";const S=i.getLogger("esri.layers.VoxelWasmPerSceneView");var P;!function(e){e[e.Lifetime=1]="Lifetime",e[e.RequestResponse=2]="RequestResponse",e[e.Rendering=3]="Rendering",e[e.Error=4]="Error"}(P||(P={}));const U=L.VOXEL;class W{constructor(e){this._halfIntTexturesAvailable=!1,this._textureFloatLinearAvailable=!1,this._havePreparedWithAllLayers=!1,this._readyWatchHandle=null,this._qualityWatchHandle=null,this._stationaryWatchHandle=null,this._timeExtentWatchHandle=null,this._renderPluginContext=null,this._vxlPromise=null,this._vxl=null,this._pluginIsActive=!1,this._moreToLoad=!1,this._viewportWidth=-1,this._viewportHeight=-1,this._newLayers=[],this._layers=new Map,this._shaderOutput=v.Color,this.renderSlots=[U],this._rctx=null,this._renderTargetToRestore=null,this._lastFrameWasStationary=!1,this._wasmMemBlockSizes=[512,1024,2048,4096,8192,16384,32768,65536],this._wasmMemBlocks=new Map,this._dbgFlags=new Set,this._captureFrustum=!1,this._frustum=null,this._frustumRenderableId=-1,this._renderCoordsHelper=null,this.type=w.VOXEL,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerUid=[],this._view=e,this._initialize()}get canRender(){return!!this._vxl&&"local"===this._view.viewingMode}_dbg(e,t){this._dbgFlags.has(e)&&(e===P.Error?S.error(t):S.warn(t))}_removeRenderPlugin(){this._pluginIsActive&&this._view._stage&&(this._dbg(P.Lifetime,"--removeRenderPlugin--"),this._view._stage.removeRenderPlugin(this)),this._pluginIsActive=!1}_initialize(){this._dbg(P.Lifetime,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this._readyWatchHandle=a((()=>this._view.ready),(e=>{e&&"local"===this._view.viewingMode?(this._dbg(P.Lifetime,"view ready status changed to ready on a local view, calling addRenderPlugin"),this._view._stage.addRenderPlugin(this),this._pluginIsActive=!0):(this._dbg(P.Lifetime,"view ready status changed, not ready or not a local view!"),this._removeRenderPlugin())}),{initial:!0}),this._qualityWatchHandle=a((()=>this._view?.qualityProfile),(e=>{this._dbg(P.Rendering,"qualityProfile changed to "+e),this._vxl&&this._vxl.set_quality(this._toWasmQuality(e))}),{initial:!0}),this._timeExtentWatchHandle=a((()=>this._view?.timeExtent),(()=>{if(this._vxl){const e=this._getTimeArgs(this._view?.timeExtent);this._dbg(P.Rendering,"sceneView timeExtent changed to useTime="+e.useTime+" st="+e.startTime+" et="+e.endTime),this._vxl.set_scene_time_extent(e.startTime,e.endTime,e.useTime),this._renderPluginContext.requestRender()}}),{initial:!0}),this._stationaryWatchHandle=a((()=>this._view?.stationary),(e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this._renderPluginContext.requestRender()}))}initializeRenderContext(e){this._dbg(P.Lifetime,"--initializeRenderContext--");const t=e.renderContext.rctx;t.type===E.WEBGL2?(this._renderPluginContext=e,this._rctx=e.renderContext.rctx,this._halfIntTexturesAvailable=!!this._rctx.capabilities.textureNorm16,this._textureFloatLinearAvailable=this._rctx.capabilities.textureFloatLinear,this._initializeWasm(t.gl)):this._dbg(P.Error,"WebGL 1 context only!")}uninitializeRenderContext(){this._renderPluginContext=null,this._rctx=null,this._dbg(P.Lifetime,"--uninitializeRenderContext--")}_restoreFramebuffer(){if(!this._renderTargetToRestore)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(P.Error,"no context in restoreFramebuffer!");this._rctx.bindFramebuffer(e,!0);const t=this._renderTargetToRestore.viewport;this._rctx.setViewport(t.x,t.y,t.width,t.height)}_bindPreviousDepthToSlot(e,t){const i=!!this._rctx,s=!!this._renderTargetToRestore;if(!i||!s)return 0;const r=this._renderTargetToRestore.fbo.depthStencilTexture;return r?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(r,e,!0),1):(this._dbg(P.Error,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,i){if(!this._rctx)return void this._dbg(P.Error,"modifyAllocation callback has no rendering context!");const s=e;1===i?this._rctx.instanceCounter.increment(s,t):this._rctx.instanceCounter.decrement(s,t)}_setBlendState(e,t,i,s){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,i),this._rctx.setBlendEquation(s)):this._dbg(P.Error,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(P.Error,"setFrontFace callback has no rendering context!")}_setDepthStencilStateFunction(e,t,i){this._rctx?(this._rctx.setDepthFunction(i),this._rctx.setDepthTestEnabled(1===e),this._rctx.setDepthWriteEnabled(1===t),this._rctx.setStencilTestEnabled(!1),this._rctx.setStencilFunction(C.ALWAYS,0,255),this._rctx.setStencilOpSeparate(F.FRONT,V.KEEP,V.INCR,V.KEEP),this._rctx.setStencilOpSeparate(F.BACK,V.KEEP,V.DECR,V.KEEP)):this._dbg(P.Error,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case _.None:this._rctx.setFaceCullingEnabled(!1);break;case _.Back:this._rctx.setCullFace(F.BACK),this._rctx.setFaceCullingEnabled(!0);break;case _.Front:this._rctx.setCullFace(F.FRONT),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(P.Error,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,i,s){this._rctx?this._rctx.setViewport(e,t,i,s):this._dbg(P.Error,"setViewport callback has no rendering context!")}_updateMemoryUsage(){this._layers.forEach(((e,t)=>{if(e.needMemoryUsageUpdate){const i=this._vxl.estimate_memory_usage(t);i>=0&&(e.needMemoryUsageUpdate=!1,e.layerView.setUsedMemory(i))}}))}_syncRequestsResponses(){this._layers.forEach(((e,i)=>{const s=[];e.responses.forEach(((t,r)=>{s.push(r),this._dbg(P.RequestResponse,"responding for requestID:"+r+" size:"+t.size),this._vxl.respond(i,r,t),t.requestType!==u.TreeIndex&&t.requestType!==u.Section||(e.needMemoryUsageUpdate=!0)}));const a=e.responses;for(const t of s)a.delete(t);const n=this._vxl.get_new_requests(i),o=e.abortController.signal;for(const l in n){e.outstandingRequestCount+=1,1===e.outstandingRequestCount&&e.layerView.updatingFlagChanged();const i=n[l],s={responseType:"array-buffer",signal:o};this._dbg(P.RequestResponse,"making requestID:"+l+" url:"+i.url),t(i.url,s).then((t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),this._dbg(P.RequestResponse,"have response for requestID:"+l);let s=0;if(t.data.byteLength>0){s=this._vxl._malloc(t.data.byteLength);const e=new Uint8Array(this._vxl.HEAPU8.buffer,s,t.data.byteLength),i=new Uint8Array(t.data);for(let s=0;s<t.data.byteLength;++s)e[s]=i[s]}a.set(+l,{responseType:i.responseType,ptr:s,size:t.data.byteLength,success:!0,requestType:i.requestType})})).catch((t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),r(t)||(this._dbg(P.Error,`requestID:${l} failed, error=${t.toString()}`),a.set(+l,{responseType:i.responseType,ptr:0,size:0,success:!1,requestType:i.requestType}))}))}}))}updateWasmCamera(e){this._vxl.set_projection_matrix.apply(this._vxl,e.projectionMatrix),this._vxl.set_view_matrix.apply(this._vxl,e.viewMatrix),this._vxl.set_near_far(e.near,e.far)}isUpdating(e){if(!this._vxl&&this._vxlPromise)return!0;const t=this._layers.get(e);return!!t&&t.outstandingRequestCount>0}getLayerTimes(e){const t=[];return this._layers.forEach(((i,s)=>{if(i.layerView.wasmLayerId===e.wasmLayerId){const i=this._vxl.get_layer_epoch_times(s,e.layer.currentVariableId);for(let e=0;e<i.length;++e)t.push(i[e])}})),t}getCurrentLayerTimeIndex(e){let t=0;return this._layers.forEach(((i,s)=>{i.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl.get_layer_current_time_id(s))})),t}setEnabled(e,t){this._layers.forEach(((i,s)=>{i.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.set_enabled(s,t),i.needMemoryUsageUpdate=!0,this._renderPluginContext.requestRender())}))}setStaticSections(e,t){const i={mask:c.StaticSections,staticSections:t};return this._doMaskedUIUpdate(e,i,!0)}setCurrentVariable(e,t){const i={mask:c.CurrentVariable,currentVariable:t};return this._doMaskedUIUpdate(e,i,!0)}setRenderMode(e,t){const i={mask:c.RenderMode,renderMode:t};return this._doMaskedUIUpdate(e,i,!0)}setVerticalExaggerationAndOffset(e,t,i,s){const r={mask:c.ExaggerationAndOffset,volStyleDesc:{volumeId:t,verticalExaggeration:i,verticalOffset:s}};return this._doMaskedUIUpdate(e,r,!0)}setVariableStyles(e,t){const i={mask:c.VariableStyles,variableStyles:t};return this._doMaskedUIUpdate(e,i,!0)}setVolumeStyles(e,t){const i={mask:c.VolumeStyles,volumeStyles:t};return this._doMaskedUIUpdate(e,i,!0)}setEnableDynamicSections(e,t){const i={mask:c.ContainerVisibility,containerIsVisible:t,container:m.DynamicSections};return this._doMaskedUIUpdate(e,i,!0)}setEnableIsosurfaces(e,t){const i={mask:c.ContainerVisibility,containerIsVisible:t,container:m.Isosurfaces};return this._doMaskedUIUpdate(e,i,!0)}setEnableSections(e,t){const i={mask:c.ContainerVisibility,containerIsVisible:t,container:m.StaticSections};return this._doMaskedUIUpdate(e,i,!0)}setAnalysisSlice(e,t,i,s){const r={mask:c.AnalysisSlice,analysisSlice:{point:i,normal:s,enabled:t}};return this._doMaskedUIUpdate(e,r,!0)}_doMaskedUIUpdate(e,t,i){if(!this._vxl)return!1;let s=!1;return this._layers.forEach(((i,r)=>{if(i.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(s=1===this._vxl.handle_masked_ui_update(r,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}})),s&&i&&this._renderPluginContext.requestRender(),s}_addTriangleToWasmBuffer(e,t,i,s,r){return e[3*t]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],e[3*(t+=1)]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],t+=1}_addNormalToWasmBuffer(e,t,i){return e[3*t]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],t+=1}_doCaptureFrustum(){if(!this._vxl)return;const e=36,t=e/3,i=this._vxl._malloc(3*e*Float32Array.BYTES_PER_ELEMENT),s=new Float32Array(this._vxl.HEAPF32.buffer,i,3*e),r=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,r,e),n=this._frustum.points[h.NEAR_BOTTOM_LEFT],o=this._frustum.points[h.NEAR_BOTTOM_RIGHT],l=this._frustum.points[h.NEAR_TOP_RIGHT],_=this._frustum.points[h.NEAR_TOP_LEFT],u=this._frustum.points[h.FAR_BOTTOM_LEFT],c=this._frustum.points[h.FAR_BOTTOM_RIGHT],m=this._frustum.points[h.FAR_TOP_RIGHT],g=this._frustum.points[h.FAR_TOP_LEFT];let f=0,p=0;const x=this._frustum.planes[d.NEAR];f=this._addTriangleToWasmBuffer(s,f,l,o,n),p=this._addNormalToWasmBuffer(a,p,x),f=this._addTriangleToWasmBuffer(s,f,n,_,l),p=this._addNormalToWasmBuffer(a,p,x);const y=this._frustum.planes[d.FAR];f=this._addTriangleToWasmBuffer(s,f,u,c,m),p=this._addNormalToWasmBuffer(a,p,y),f=this._addTriangleToWasmBuffer(s,f,m,g,u),p=this._addNormalToWasmBuffer(a,p,y);const v=this._frustum.planes[d.TOP];f=this._addTriangleToWasmBuffer(s,f,m,l,_),p=this._addNormalToWasmBuffer(a,p,v),f=this._addTriangleToWasmBuffer(s,f,_,g,m),p=this._addNormalToWasmBuffer(a,p,v);const b=this._frustum.planes[d.BOTTOM];f=this._addTriangleToWasmBuffer(s,f,n,o,c),p=this._addNormalToWasmBuffer(a,p,b),f=this._addTriangleToWasmBuffer(s,f,c,u,n),p=this._addNormalToWasmBuffer(a,p,b);const w=this._frustum.planes[d.LEFT];f=this._addTriangleToWasmBuffer(s,f,_,n,u),p=this._addNormalToWasmBuffer(a,p,w),f=this._addTriangleToWasmBuffer(s,f,u,g,_),p=this._addNormalToWasmBuffer(a,p,w);const T=this._frustum.planes[d.RIGHT];f=this._addTriangleToWasmBuffer(s,f,l,m,c),p=this._addNormalToWasmBuffer(a,p,T),f=this._addTriangleToWasmBuffer(s,f,c,o,l),p=this._addNormalToWasmBuffer(a,p,T),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(i,3*e,r,e,255,0,0,64),this._vxl._free(i),this._vxl._free(r),this._captureFrustum=!1,this._renderPluginContext.requestRender()}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=y.create(f.Local,l(!1,this._view.spatialReference))),null===this._frustum&&(this._frustum=new x(this._renderCoordsHelper)),this._captureFrustum=!0,null!==this._renderPluginContext&&this._renderPluginContext.requestRender()}toggleFullVolumeExtentDraw(e){this._vxl&&this._layers.forEach(((t,i)=>{t.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.toggle_full_volume_extent_draw(i),this._renderPluginContext.requestRender())}))}addVoxelLayer(e){if(!this._vxl){const t={layerView:e,resolveCallback:null,rejectCallback:null},i=new Promise(((e,i)=>{t.resolveCallback=e,t.rejectCallback=i}));return this._newLayers.push(t),i}const t=this._addVoxelLayer(e);return t<0?Promise.reject(-1):Promise.resolve(t)}removeVoxelLayer(e){if(!this._vxl){const t=this._newLayers.findIndex((t=>e.uid===t.layerView.uid));t>=0&&(this._newLayers[t].resolveCallback(-1),this._newLayers.splice(t,1));const i=this._newLayers.length;return 0===i&&(this._dbg(P.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),i}let t=-1;this._layers.forEach(((i,s)=>{if(i.layerView.wasmLayerId===e.wasmLayerId){t=s,i.abortController.abort(),this._vxl.remove_layer(t);const r=this.layerUid.indexOf(e.layer.uid);-1!==r&&this.layerUid.splice(r,1)}})),t>=0&&this._layers.delete(t);const i=this._layers.size;return 0===i&&(this._dbg(P.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),i}_getBlockSize(e){for(const t of this._wasmMemBlockSizes)if(e<t)return t;return-1}_allocateBlock(e){e.byteCount=this._vxl.lengthBytesUTF8(e.str)+1;const t=this._getBlockSize(e.byteCount);return t<0?(e.isReusable=!1,e.ptr=this._vxl._malloc(e.byteCount)):(e.isReusable=!0,e.ptr=this._wasmMemBlocks.get(t),0===e.ptr&&(e.ptr=this._vxl._malloc(t),this._wasmMemBlocks.set(t,e.ptr))),0!==e.ptr&&(this._vxl.stringToUTF8(e.str,e.ptr,e.byteCount),!0)}_getTimeArgs(e){let t=-Number.MAX_VALUE,i=Number.MAX_VALUE,s=!1;return null!=e&&(e.isAllTime?s=!0:(null!=e.start&&(s=!0,t=e.start.getTime()/1e3),null!=e.end&&(s=!0,i=e.end.getTime()/1e3))),{startTime:t,endTime:i,useTime:s}}_addVoxelLayer(e){const t=e.layer;let i=-1;const s=t.getConfiguration();if(s.length<1)return-1;const r={str:s,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(r))return-1;const a=this._getTimeArgs(this._view?.timeExtent),n=this._view.spatialReference.isWGS84&&t.spatialReference.isWGS84?111319.49079327357:1;if(i=this._vxl.add_layer(t.serviceRoot,r.ptr,r.byteCount,n,n,a.startTime,a.endTime,a.useTime,this._toWasmQuality(this._view.qualityProfile)),r.isReusable||this._vxl._free(r.ptr),i>=0){t.test?.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const s=new AbortController;if(this._layers.set(i,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:s,needMemoryUsageUpdate:!1}),this.layerUid.push(e.layer.uid),!this._halfIntTexturesAvailable||has("mac")){const t=[];let i="";for(const s of e.layer.variables)"Int16"!==s.renderingFormat.type&&"UInt16"!==s.renderingFormat.type||(t.push(s.name),s.id===e.layer.currentVariableId&&(i=s.name));""!==i&&S.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${i}' in this browser`),t.length>0&&S.warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}if(!this._textureFloatLinearAvailable){const t=[];let i="";for(const s of e.layer.variables)"Float32"===s.renderingFormat.type&&(t.push(s.name),s.id===e.layer.currentVariableId&&(i=s.name));""!==i&&S.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${i}' in this browser`),t.length>0&&S.warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}return has("esri-mobile")&&S.warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),i}return-1}prepareRender(e){if(!this._vxl)return;const t=e.bindParameters.camera.viewForward,i=e.bindParameters.camera.eye;this._vxl.update_camera_pos_and_direction(i[0],i[1],i[2],t[0],t[1],t[2]);const s=this._vxl.cull();this._dbg(P.RequestResponse,"missingResourceCount="+s),this._moreToLoad=s>0,this._havePreparedWithAllLayers=0===this._newLayers.length,this._updateMemoryUsage()}render(e){if(!this._vxl||e.output!==this._shaderOutput||e.bindParameters.slot!==U)return;for(const i of this._newLayers){const e=this._addVoxelLayer(i.layerView);-1===e?i.rejectCallback(-1):i.resolveCallback(e)}if(this._newLayers=[],0===this._layers.size)return void this._dbg(P.Error,"No voxel layers but RenderPlugin instance is being asked to render!");this._lastFrameWasStationary=this._view.stationary,this._syncRequestsResponses(),this._beforeDraw(),this._vxl.begin_color_frame(!this._view._stage.renderer.isFeatureEnabled(R.HighResolutionVoxel),e.bindParameters.lighting.mainLight.direction[0],e.bindParameters.lighting.mainLight.direction[1],e.bindParameters.lighting.mainLight.direction[2]);const t=this._renderTargetToRestore.viewport;t.width===this._viewportWidth&&t.height===this._viewportHeight||(this._viewportWidth=t.width,this._viewportHeight=t.height,this._vxl.set_viewport(t.width,t.height),this._layers.forEach((e=>{e.needMemoryUsageUpdate=!0}))),0===t.x&&0===t.y||this._dbg(P.Error,"Unsupported viewport parameters detected!"),this.updateWasmCamera(e.bindParameters.camera),this._captureFrustum&&(this._frustum.update(e.bindParameters.camera),this._doCaptureFrustum()),this._vxl.draw(),this._afterDraw(),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this._renderPluginContext.requestRender()}destroy(){this._dbg(P.Lifetime,"--destroy--"),this._removeRenderPlugin(),this._readyWatchHandle=s(this._readyWatchHandle),this._qualityWatchHandle=s(this._qualityWatchHandle),this._timeExtentWatchHandle=s(this._timeExtentWatchHandle),this._stationaryWatchHandle=s(this._stationaryWatchHandle),this._vxl&&(this._layers.forEach((e=>{e.abortController.abort()})),this._wasmMemBlocks.forEach((e=>{0!==e&&this._vxl._free(e)})),this._vxl.uninitialize_voxel_wasm(),this._vxl=null)}_initializeWasm(e){return this._vxl?Promise.resolve():(this._vxlPromise||(this._vxlPromise=g(e).then((e=>{if(this._vxl=e,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(P.Lifetime," no voxel layers left after WASM downloaded, removing RenderPlugin and destroying"),void this.destroy();const t=this._getTimeArgs(this._view?.timeExtent),i=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),s=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),r=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),a=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),n=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),o=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),l=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),h=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),d=this._halfIntTexturesAvailable&&!has("mac"),_=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(i,s,r,a,n,o,l,h,t.startTime,t.endTime,t.useTime,d,_),this._renderPluginContext&&this._renderPluginContext.requestRender()})).catch((()=>{for(const e of this._newLayers)e.rejectCallback(-2);this._dbg(P.Error," WASM failed to download, removing RenderPlugin and destroying"),this.destroy()}))),this._vxlPromise)}pickDepth(e,t,i){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const s=i.viewport[3]-t;if(e<0||e>i.viewport[2]||t<0||t>i.viewport[3])return this._dbg(P.Error,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${s.toFixed(0)}]]`),null;this._beforeDraw();const r=i.viewForward,a=i.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],r[0],r[1],r[2]),this.updateWasmCamera(i),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,s);if(this._afterDraw(),n.success){return n.distanceToCamera}return null}pickObject(e,t,i,s){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const r=Math.round(e),a=Math.round(t);if(r<0||r>i.viewport[2]||a<0||a>i.viewport[3])return this._dbg(P.Error,`[js] pickObject: outOfRange, screenXY=[${r}, ${a}], vp=[${i.viewport.toString()}]`),null;this._beforeDraw();const n=i.viewForward,o=i.eye;this._vxl.update_camera_pos_and_direction(o[0],o[1],o[2],n[0],n[1],n[2]),this.updateWasmCamera(i),this._vxl.begin_frame();let l=null;if(0===s.length)l=this._vxl.pick_object(r,a,0,0);else{const e={str:JSON.stringify({layerIds:s}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(l=this._vxl.pick_object(r,a,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}return this._afterDraw(),l}_beforeDraw(){this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()},this._rctx.setPolygonOffsetFillEnabled(!1),this._rctx.setScissorTestEnabled(!1),this._rctx.setColorMask(!0,!0,!0,!0)}_afterDraw(){this._renderTargetToRestore.fbo=null,this._rctx.externalTextureUnitUpdate(this._vxl.get_texture_units_bound_in_frame(),this._vxl.get_active_texture_unit()),this._rctx.externalVertexArrayObjectUpdate(),this._rctx.externalVertexBufferUpdate(),this._rctx.externalProgramUpdate()}intersect(e,t,i,s,r){if(!this._vxl||!this._rctx||0===this._layers.size||!e.options.selectionMode||e.options.isFiltered)return;if(r[0]<0||r[0]>e.camera.viewport[2]||r[1]<0||r[1]>e.camera.viewport[3])return this._dbg(P.Error,`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${r[0].toFixed(0)}, ${r[1].toFixed(0)}]`),null;const a=[];this._layers.forEach((t=>{e.options.filteredLayerUids.includes(t.layerView.layer.uid)&&a.push(t.layerView.wasmLayerId)}));const l=this.pickObject(r[0],r[1],e.camera,a);if(null==l||-1===l.layerId)return;const h=this._layers.get(l.layerId);if(h){const t=h.layerView.layer.uid,r=l.distanceToCamera/n(i,s),a=o();a[0]=l.worldX,a[1]=l.worldY,a[2]=l.worldZ;const d={};if(null!=l.continuousValue&&null!=l.continuousValueUnits?d["Voxel.ServiceValue"]=`${l.continuousValue.toLocaleString()} ${l.continuousValueUnits}`:null!=l.uniqueValueLabel&&null!=l.uniqueValue?d["Voxel.ServiceValue"]=`${l.uniqueValueLabel} (${l.uniqueValue})`:null!=l.uniqueValue&&(d["Voxel.ServiceValue"]=`${l.uniqueValue}`),d["Voxel.ServiceVariableLabel"]=l.variableLabel,d["Voxel.Position"]=l.voxelSpacePosition,null!=l.epochTime&&null!=l.nativeTime&&null!=l.nativeTimeUnits){const e=new Date(l.epochTime);d["Voxel.ServiceLocalTime"]=e.toString(),d["Voxel.ServiceNativeTime"]=`${l.nativeTime.toLocaleString()} ${l.nativeTimeUnits}`}null!=l.depth&&null!=l.depthUnits&&(d["Voxel.ServiceDepth"]=`${l.depth.toLocaleString()} ${l.depthUnits}`);const _=l.faceNormal;d["Voxel.WorldPosition"]=`[${a[0]}, ${a[1]}, ${a[2]}]`;const u=e=>{const i=new p(a,t,(()=>this._createVoxelGraphic(h.layerView.layer,d)));e.set(this.type,i,r,_)},c=e.results,m=e.options.store===T.ALL;if((null==c.min.dist||r<c.min.dist)&&u(c.min),(null==c.max.dist||r>c.max.dist)&&u(c.max),m){const t=b(e.ray);u(t),e.results.all.push(t)}}}_createVoxelGraphic(t,i){return new e({layer:t,sourceLayer:t,attributes:i})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}_setUpscalingLimits(e,t,i){this._vxl&&this._vxl.set_upscaling_limits(e,t,i)}}export{W as default};
|
|
5
|
+
import e from"../Graphic.js";import t from"../request.js";import has from"../core/has.js";import i from"../core/Logger.js";import{removeMaybe as s}from"../core/maybe.js";import{isAbortError as r}from"../core/promiseUtils.js";import{watch as a}from"../core/reactiveUtils.js";import{i as n}from"../chunks/vec3.js";import{c as o}from"../chunks/vec3f64.js";import{renderSRFromViewSR as l}from"../geometry/support/coordinateSystem.js";import{PointIndex as h,PlaneIndex as d}from"../geometry/support/frustum.js";import{WasmCullMode as _,VoxelRequestType as u,UpdateFlags as c,ContainerType as m}from"../libs/vxl/enums.js";import{loadVoxelWASM as g}from"../libs/vxl/VxlModule.js";import{ViewingMode as f}from"../views/ViewingMode.js";import{VoxelTarget as p}from"../views/3d/layers/i3s/Intersector.js";import{Frustum as x}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as y}from"../views/3d/support/RenderCoordsHelper.js";import{ShaderOutput as v}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{newIntersectorResult as b}from"../views/3d/webgl-engine/lib/Intersector.js";import{IntersectorType as w,StoreResults as T}from"../views/3d/webgl-engine/lib/IntersectorInterfaces.js";import{RenderFeature as R}from"../views/3d/webgl-engine/lib/RenderFeature.js";import{RenderSlot as L}from"../views/3d/webgl-engine/lib/RenderSlot.js";import{ContextType as E}from"../views/webgl/contextUtils.js";import{CompareFunction as C,Face as F,StencilOperation as V}from"../views/webgl/enums.js";const S=i.getLogger("esri.layers.VoxelWasmPerSceneView");var P;!function(e){e[e.Lifetime=1]="Lifetime",e[e.RequestResponse=2]="RequestResponse",e[e.Rendering=3]="Rendering",e[e.Error=4]="Error"}(P||(P={}));const U=L.VOXEL;class W{constructor(e){this._halfIntTexturesAvailable=!1,this._textureFloatLinearAvailable=!1,this._havePreparedWithAllLayers=!1,this._readyWatchHandle=null,this._qualityWatchHandle=null,this._stationaryWatchHandle=null,this._timeExtentWatchHandle=null,this._renderPluginContext=null,this._vxlPromise=null,this._vxl=null,this._pluginIsActive=!1,this._moreToLoad=!1,this._viewportWidth=-1,this._viewportHeight=-1,this._newLayers=[],this._layers=new Map,this._shaderOutput=v.Color,this.renderSlots=[U],this._rctx=null,this._renderTargetToRestore=null,this._lastFrameWasStationary=!1,this._wasmMemBlockSizes=[512,1024,2048,4096,8192,16384,32768,65536],this._wasmMemBlocks=new Map,this._dbgFlags=new Set,this._captureFrustum=!1,this._frustum=null,this._frustumRenderableId=-1,this._renderCoordsHelper=null,this.type=w.VOXEL,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerUid=[],this._view=e,this._initialize()}canRender(){return!!this._vxl&&"local"===this._view.viewingMode}requiresOutput(){return!1}_dbg(e,t){this._dbgFlags.has(e)&&(e===P.Error?S.error(t):S.warn(t))}_removeRenderPlugin(){this._pluginIsActive&&this._view._stage&&(this._dbg(P.Lifetime,"--removeRenderPlugin--"),this._view._stage.removeRenderPlugin(this)),this._pluginIsActive=!1}_initialize(){this._dbg(P.Lifetime,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this._readyWatchHandle=a((()=>this._view.ready),(e=>{e&&"local"===this._view.viewingMode?(this._dbg(P.Lifetime,"view ready status changed to ready on a local view, calling addRenderPlugin"),this._view._stage.addRenderPlugin(this),this._pluginIsActive=!0):(this._dbg(P.Lifetime,"view ready status changed, not ready or not a local view!"),this._removeRenderPlugin())}),{initial:!0}),this._qualityWatchHandle=a((()=>this._view?.qualityProfile),(e=>{this._dbg(P.Rendering,"qualityProfile changed to "+e),this._vxl&&this._vxl.set_quality(this._toWasmQuality(e))}),{initial:!0}),this._timeExtentWatchHandle=a((()=>this._view?.timeExtent),(()=>{if(this._vxl){const e=this._getTimeArgs(this._view?.timeExtent);this._dbg(P.Rendering,"sceneView timeExtent changed to useTime="+e.useTime+" st="+e.startTime+" et="+e.endTime),this._vxl.set_scene_time_extent(e.startTime,e.endTime,e.useTime),this._renderPluginContext.requestRender()}}),{initial:!0}),this._stationaryWatchHandle=a((()=>this._view?.stationary),(e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this._renderPluginContext.requestRender()}))}initializeRenderContext(e){this._dbg(P.Lifetime,"--initializeRenderContext--");const t=e.renderContext.rctx;t.type===E.WEBGL2?(this._renderPluginContext=e,this._rctx=e.renderContext.rctx,this._halfIntTexturesAvailable=!!this._rctx.capabilities.textureNorm16,this._textureFloatLinearAvailable=this._rctx.capabilities.textureFloatLinear,this._initializeWasm(t.gl)):this._dbg(P.Error,"WebGL 1 context only!")}uninitializeRenderContext(){this._renderPluginContext=null,this._rctx=null,this._dbg(P.Lifetime,"--uninitializeRenderContext--")}_restoreFramebuffer(){if(!this._renderTargetToRestore)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(P.Error,"no context in restoreFramebuffer!");this._rctx.bindFramebuffer(e,!0);const t=this._renderTargetToRestore.viewport;this._rctx.setViewport(t.x,t.y,t.width,t.height)}_bindPreviousDepthToSlot(e,t){const i=!!this._rctx,s=!!this._renderTargetToRestore;if(!i||!s)return 0;const r=this._renderTargetToRestore.fbo.depthStencilTexture;return r?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(r,e,!0),1):(this._dbg(P.Error,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,i){if(!this._rctx)return void this._dbg(P.Error,"modifyAllocation callback has no rendering context!");const s=e;1===i?this._rctx.instanceCounter.increment(s,t):this._rctx.instanceCounter.decrement(s,t)}_setBlendState(e,t,i,s){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,i),this._rctx.setBlendEquation(s)):this._dbg(P.Error,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(P.Error,"setFrontFace callback has no rendering context!")}_setDepthStencilStateFunction(e,t,i){this._rctx?(this._rctx.setDepthFunction(i),this._rctx.setDepthTestEnabled(1===e),this._rctx.setDepthWriteEnabled(1===t),this._rctx.setStencilTestEnabled(!1),this._rctx.setStencilFunction(C.ALWAYS,0,255),this._rctx.setStencilOpSeparate(F.FRONT,V.KEEP,V.INCR,V.KEEP),this._rctx.setStencilOpSeparate(F.BACK,V.KEEP,V.DECR,V.KEEP)):this._dbg(P.Error,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case _.None:this._rctx.setFaceCullingEnabled(!1);break;case _.Back:this._rctx.setCullFace(F.BACK),this._rctx.setFaceCullingEnabled(!0);break;case _.Front:this._rctx.setCullFace(F.FRONT),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(P.Error,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,i,s){this._rctx?this._rctx.setViewport(e,t,i,s):this._dbg(P.Error,"setViewport callback has no rendering context!")}_updateMemoryUsage(){this._layers.forEach(((e,t)=>{if(e.needMemoryUsageUpdate){const i=this._vxl.estimate_memory_usage(t);i>=0&&(e.needMemoryUsageUpdate=!1,e.layerView.setUsedMemory(i))}}))}_syncRequestsResponses(){this._layers.forEach(((e,i)=>{const s=[];e.responses.forEach(((t,r)=>{s.push(r),this._dbg(P.RequestResponse,"responding for requestID:"+r+" size:"+t.size),this._vxl.respond(i,r,t),t.requestType!==u.TreeIndex&&t.requestType!==u.Section||(e.needMemoryUsageUpdate=!0)}));const a=e.responses;for(const t of s)a.delete(t);const n=this._vxl.get_new_requests(i),o=e.abortController.signal;for(const l in n){e.outstandingRequestCount+=1,1===e.outstandingRequestCount&&e.layerView.updatingFlagChanged();const i=n[l],s={responseType:"array-buffer",signal:o};this._dbg(P.RequestResponse,"making requestID:"+l+" url:"+i.url),t(i.url,s).then((t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),this._dbg(P.RequestResponse,"have response for requestID:"+l);let s=0;if(t.data.byteLength>0){s=this._vxl._malloc(t.data.byteLength);const e=new Uint8Array(this._vxl.HEAPU8.buffer,s,t.data.byteLength),i=new Uint8Array(t.data);for(let s=0;s<t.data.byteLength;++s)e[s]=i[s]}a.set(+l,{responseType:i.responseType,ptr:s,size:t.data.byteLength,success:!0,requestType:i.requestType})})).catch((t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),r(t)||(this._dbg(P.Error,`requestID:${l} failed, error=${t.toString()}`),a.set(+l,{responseType:i.responseType,ptr:0,size:0,success:!1,requestType:i.requestType}))}))}}))}updateWasmCamera(e){this._vxl.set_projection_matrix.apply(this._vxl,e.projectionMatrix),this._vxl.set_view_matrix.apply(this._vxl,e.viewMatrix),this._vxl.set_near_far(e.near,e.far)}isUpdating(e){if(!this._vxl&&this._vxlPromise)return!0;const t=this._layers.get(e);return!!t&&t.outstandingRequestCount>0}getLayerTimes(e){const t=[];return this._layers.forEach(((i,s)=>{if(i.layerView.wasmLayerId===e.wasmLayerId){const i=this._vxl.get_layer_epoch_times(s,e.layer.currentVariableId);for(let e=0;e<i.length;++e)t.push(i[e])}})),t}getCurrentLayerTimeIndex(e){let t=0;return this._layers.forEach(((i,s)=>{i.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl.get_layer_current_time_id(s))})),t}setEnabled(e,t){this._layers.forEach(((i,s)=>{i.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.set_enabled(s,t),i.needMemoryUsageUpdate=!0,this._renderPluginContext.requestRender())}))}setStaticSections(e,t){const i={mask:c.StaticSections,staticSections:t};return this._doMaskedUIUpdate(e,i,!0)}setCurrentVariable(e,t){const i={mask:c.CurrentVariable,currentVariable:t};return this._doMaskedUIUpdate(e,i,!0)}setRenderMode(e,t){const i={mask:c.RenderMode,renderMode:t};return this._doMaskedUIUpdate(e,i,!0)}setVerticalExaggerationAndOffset(e,t,i,s){const r={mask:c.ExaggerationAndOffset,volStyleDesc:{volumeId:t,verticalExaggeration:i,verticalOffset:s}};return this._doMaskedUIUpdate(e,r,!0)}setVariableStyles(e,t){const i={mask:c.VariableStyles,variableStyles:t};return this._doMaskedUIUpdate(e,i,!0)}setVolumeStyles(e,t){const i={mask:c.VolumeStyles,volumeStyles:t};return this._doMaskedUIUpdate(e,i,!0)}setEnableDynamicSections(e,t){const i={mask:c.ContainerVisibility,containerIsVisible:t,container:m.DynamicSections};return this._doMaskedUIUpdate(e,i,!0)}setEnableIsosurfaces(e,t){const i={mask:c.ContainerVisibility,containerIsVisible:t,container:m.Isosurfaces};return this._doMaskedUIUpdate(e,i,!0)}setEnableSections(e,t){const i={mask:c.ContainerVisibility,containerIsVisible:t,container:m.StaticSections};return this._doMaskedUIUpdate(e,i,!0)}setAnalysisSlice(e,t,i,s){const r={mask:c.AnalysisSlice,analysisSlice:{point:i,normal:s,enabled:t}};return this._doMaskedUIUpdate(e,r,!0)}_doMaskedUIUpdate(e,t,i){if(!this._vxl)return!1;let s=!1;return this._layers.forEach(((i,r)=>{if(i.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(s=1===this._vxl.handle_masked_ui_update(r,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}})),s&&i&&this._renderPluginContext.requestRender(),s}_addTriangleToWasmBuffer(e,t,i,s,r){return e[3*t]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],e[3*(t+=1)]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],t+=1}_addNormalToWasmBuffer(e,t,i){return e[3*t]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],t+=1}_doCaptureFrustum(){if(!this._vxl)return;const e=36,t=e/3,i=this._vxl._malloc(3*e*Float32Array.BYTES_PER_ELEMENT),s=new Float32Array(this._vxl.HEAPF32.buffer,i,3*e),r=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,r,e),n=this._frustum.points[h.NEAR_BOTTOM_LEFT],o=this._frustum.points[h.NEAR_BOTTOM_RIGHT],l=this._frustum.points[h.NEAR_TOP_RIGHT],_=this._frustum.points[h.NEAR_TOP_LEFT],u=this._frustum.points[h.FAR_BOTTOM_LEFT],c=this._frustum.points[h.FAR_BOTTOM_RIGHT],m=this._frustum.points[h.FAR_TOP_RIGHT],g=this._frustum.points[h.FAR_TOP_LEFT];let f=0,p=0;const x=this._frustum.planes[d.NEAR];f=this._addTriangleToWasmBuffer(s,f,l,o,n),p=this._addNormalToWasmBuffer(a,p,x),f=this._addTriangleToWasmBuffer(s,f,n,_,l),p=this._addNormalToWasmBuffer(a,p,x);const y=this._frustum.planes[d.FAR];f=this._addTriangleToWasmBuffer(s,f,u,c,m),p=this._addNormalToWasmBuffer(a,p,y),f=this._addTriangleToWasmBuffer(s,f,m,g,u),p=this._addNormalToWasmBuffer(a,p,y);const v=this._frustum.planes[d.TOP];f=this._addTriangleToWasmBuffer(s,f,m,l,_),p=this._addNormalToWasmBuffer(a,p,v),f=this._addTriangleToWasmBuffer(s,f,_,g,m),p=this._addNormalToWasmBuffer(a,p,v);const b=this._frustum.planes[d.BOTTOM];f=this._addTriangleToWasmBuffer(s,f,n,o,c),p=this._addNormalToWasmBuffer(a,p,b),f=this._addTriangleToWasmBuffer(s,f,c,u,n),p=this._addNormalToWasmBuffer(a,p,b);const w=this._frustum.planes[d.LEFT];f=this._addTriangleToWasmBuffer(s,f,_,n,u),p=this._addNormalToWasmBuffer(a,p,w),f=this._addTriangleToWasmBuffer(s,f,u,g,_),p=this._addNormalToWasmBuffer(a,p,w);const T=this._frustum.planes[d.RIGHT];f=this._addTriangleToWasmBuffer(s,f,l,m,c),p=this._addNormalToWasmBuffer(a,p,T),f=this._addTriangleToWasmBuffer(s,f,c,o,l),p=this._addNormalToWasmBuffer(a,p,T),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(i,3*e,r,e,255,0,0,64),this._vxl._free(i),this._vxl._free(r),this._captureFrustum=!1,this._renderPluginContext.requestRender()}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=y.create(f.Local,l(!1,this._view.spatialReference))),null===this._frustum&&(this._frustum=new x(this._renderCoordsHelper)),this._captureFrustum=!0,null!==this._renderPluginContext&&this._renderPluginContext.requestRender()}toggleFullVolumeExtentDraw(e){this._vxl&&this._layers.forEach(((t,i)=>{t.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.toggle_full_volume_extent_draw(i),this._renderPluginContext.requestRender())}))}addVoxelLayer(e){if(!this._vxl){const t={layerView:e,resolveCallback:null,rejectCallback:null},i=new Promise(((e,i)=>{t.resolveCallback=e,t.rejectCallback=i}));return this._newLayers.push(t),i}const t=this._addVoxelLayer(e);return t<0?Promise.reject(-1):Promise.resolve(t)}removeVoxelLayer(e){if(!this._vxl){const t=this._newLayers.findIndex((t=>e.uid===t.layerView.uid));t>=0&&(this._newLayers[t].resolveCallback(-1),this._newLayers.splice(t,1));const i=this._newLayers.length;return 0===i&&(this._dbg(P.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),i}let t=-1;this._layers.forEach(((i,s)=>{if(i.layerView.wasmLayerId===e.wasmLayerId){t=s,i.abortController.abort(),this._vxl.remove_layer(t);const r=this.layerUid.indexOf(e.layer.uid);-1!==r&&this.layerUid.splice(r,1)}})),t>=0&&this._layers.delete(t);const i=this._layers.size;return 0===i&&(this._dbg(P.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),i}_getBlockSize(e){for(const t of this._wasmMemBlockSizes)if(e<t)return t;return-1}_allocateBlock(e){e.byteCount=this._vxl.lengthBytesUTF8(e.str)+1;const t=this._getBlockSize(e.byteCount);return t<0?(e.isReusable=!1,e.ptr=this._vxl._malloc(e.byteCount)):(e.isReusable=!0,e.ptr=this._wasmMemBlocks.get(t),0===e.ptr&&(e.ptr=this._vxl._malloc(t),this._wasmMemBlocks.set(t,e.ptr))),0!==e.ptr&&(this._vxl.stringToUTF8(e.str,e.ptr,e.byteCount),!0)}_getTimeArgs(e){let t=-Number.MAX_VALUE,i=Number.MAX_VALUE,s=!1;return null!=e&&(e.isAllTime?s=!0:(null!=e.start&&(s=!0,t=e.start.getTime()/1e3),null!=e.end&&(s=!0,i=e.end.getTime()/1e3))),{startTime:t,endTime:i,useTime:s}}_addVoxelLayer(e){const t=e.layer;let i=-1;const s=t.getConfiguration();if(s.length<1)return-1;const r={str:s,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(r))return-1;const a=this._getTimeArgs(this._view?.timeExtent),n=this._view.spatialReference.isWGS84&&t.spatialReference.isWGS84?111319.49079327357:1;if(i=this._vxl.add_layer(t.serviceRoot,r.ptr,r.byteCount,n,n,a.startTime,a.endTime,a.useTime,this._toWasmQuality(this._view.qualityProfile)),r.isReusable||this._vxl._free(r.ptr),i>=0){t.test?.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const s=new AbortController;if(this._layers.set(i,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:s,needMemoryUsageUpdate:!1}),this.layerUid.push(e.layer.uid),!this._halfIntTexturesAvailable||has("mac")){const t=[];let i="";for(const s of e.layer.variables)"Int16"!==s.renderingFormat.type&&"UInt16"!==s.renderingFormat.type||(t.push(s.name),s.id===e.layer.currentVariableId&&(i=s.name));""!==i&&S.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${i}' in this browser`),t.length>0&&S.warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}if(!this._textureFloatLinearAvailable){const t=[];let i="";for(const s of e.layer.variables)"Float32"===s.renderingFormat.type&&(t.push(s.name),s.id===e.layer.currentVariableId&&(i=s.name));""!==i&&S.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${i}' in this browser`),t.length>0&&S.warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}return has("esri-mobile")&&S.warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),i}return-1}prepareRender(e){if(!this._vxl)return;const t=e.bindParameters.camera.viewForward,i=e.bindParameters.camera.eye;this._vxl.update_camera_pos_and_direction(i[0],i[1],i[2],t[0],t[1],t[2]);const s=this._vxl.cull();this._dbg(P.RequestResponse,"missingResourceCount="+s),this._moreToLoad=s>0,this._havePreparedWithAllLayers=0===this._newLayers.length,this._updateMemoryUsage()}render(e){if(!this._vxl||e.output!==this._shaderOutput||e.bindParameters.slot!==U)return;for(const i of this._newLayers){const e=this._addVoxelLayer(i.layerView);-1===e?i.rejectCallback(-1):i.resolveCallback(e)}if(this._newLayers=[],0===this._layers.size)return void this._dbg(P.Error,"No voxel layers but RenderPlugin instance is being asked to render!");this._lastFrameWasStationary=this._view.stationary,this._syncRequestsResponses(),this._beforeDraw(),this._vxl.begin_color_frame(!this._view._stage.renderer.isFeatureEnabled(R.HighResolutionVoxel),e.bindParameters.lighting.mainLight.direction[0],e.bindParameters.lighting.mainLight.direction[1],e.bindParameters.lighting.mainLight.direction[2]);const t=this._renderTargetToRestore.viewport;t.width===this._viewportWidth&&t.height===this._viewportHeight||(this._viewportWidth=t.width,this._viewportHeight=t.height,this._vxl.set_viewport(t.width,t.height),this._layers.forEach((e=>{e.needMemoryUsageUpdate=!0}))),0===t.x&&0===t.y||this._dbg(P.Error,"Unsupported viewport parameters detected!"),this.updateWasmCamera(e.bindParameters.camera),this._captureFrustum&&(this._frustum.update(e.bindParameters.camera),this._doCaptureFrustum()),this._vxl.draw(),this._afterDraw(),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this._renderPluginContext.requestRender()}destroy(){this._dbg(P.Lifetime,"--destroy--"),this._removeRenderPlugin(),this._readyWatchHandle=s(this._readyWatchHandle),this._qualityWatchHandle=s(this._qualityWatchHandle),this._timeExtentWatchHandle=s(this._timeExtentWatchHandle),this._stationaryWatchHandle=s(this._stationaryWatchHandle),this._vxl&&(this._layers.forEach((e=>{e.abortController.abort()})),this._wasmMemBlocks.forEach((e=>{0!==e&&this._vxl._free(e)})),this._vxl.uninitialize_voxel_wasm(),this._vxl=null)}_initializeWasm(e){return this._vxl?Promise.resolve():(this._vxlPromise||(this._vxlPromise=g(e).then((e=>{if(this._vxl=e,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(P.Lifetime," no voxel layers left after WASM downloaded, removing RenderPlugin and destroying"),void this.destroy();const t=this._getTimeArgs(this._view?.timeExtent),i=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),s=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),r=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),a=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),n=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),o=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),l=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),h=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),d=this._halfIntTexturesAvailable&&!has("mac"),_=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(i,s,r,a,n,o,l,h,t.startTime,t.endTime,t.useTime,d,_),this._renderPluginContext&&this._renderPluginContext.requestRender()})).catch((()=>{for(const e of this._newLayers)e.rejectCallback(-2);this._dbg(P.Error," WASM failed to download, removing RenderPlugin and destroying"),this.destroy()}))),this._vxlPromise)}pickDepth(e,t,i){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const s=i.viewport[3]-t;if(e<0||e>i.viewport[2]||t<0||t>i.viewport[3])return this._dbg(P.Error,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${s.toFixed(0)}]]`),null;this._beforeDraw();const r=i.viewForward,a=i.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],r[0],r[1],r[2]),this.updateWasmCamera(i),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,s);if(this._afterDraw(),n.success){return n.distanceToCamera}return null}pickObject(e,t,i,s){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const r=Math.round(e),a=Math.round(t);if(r<0||r>i.viewport[2]||a<0||a>i.viewport[3])return this._dbg(P.Error,`[js] pickObject: outOfRange, screenXY=[${r}, ${a}], vp=[${i.viewport.toString()}]`),null;this._beforeDraw();const n=i.viewForward,o=i.eye;this._vxl.update_camera_pos_and_direction(o[0],o[1],o[2],n[0],n[1],n[2]),this.updateWasmCamera(i),this._vxl.begin_frame();let l=null;if(0===s.length)l=this._vxl.pick_object(r,a,0,0);else{const e={str:JSON.stringify({layerIds:s}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(l=this._vxl.pick_object(r,a,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}return this._afterDraw(),l}_beforeDraw(){this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()},this._rctx.setPolygonOffsetFillEnabled(!1),this._rctx.setScissorTestEnabled(!1),this._rctx.setColorMask(!0,!0,!0,!0)}_afterDraw(){this._renderTargetToRestore.fbo=null,this._rctx.externalTextureUnitUpdate(this._vxl.get_texture_units_bound_in_frame(),this._vxl.get_active_texture_unit()),this._rctx.externalVertexArrayObjectUpdate(),this._rctx.externalVertexBufferUpdate(),this._rctx.externalProgramUpdate()}intersect(e,t,i,s,r){if(!this._vxl||!this._rctx||0===this._layers.size||!e.options.selectionMode||e.options.isFiltered)return;if(r[0]<0||r[0]>e.camera.viewport[2]||r[1]<0||r[1]>e.camera.viewport[3])return this._dbg(P.Error,`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${r[0].toFixed(0)}, ${r[1].toFixed(0)}]`),null;const a=[];this._layers.forEach((t=>{e.options.filteredLayerUids.includes(t.layerView.layer.uid)&&a.push(t.layerView.wasmLayerId)}));const l=this.pickObject(r[0],r[1],e.camera,a);if(null==l||-1===l.layerId)return;const h=this._layers.get(l.layerId);if(h){const t=h.layerView.layer.uid,r=l.distanceToCamera/n(i,s),a=o();a[0]=l.worldX,a[1]=l.worldY,a[2]=l.worldZ;const d={};if(null!=l.continuousValue&&null!=l.continuousValueUnits?d["Voxel.ServiceValue"]=`${l.continuousValue.toLocaleString()} ${l.continuousValueUnits}`:null!=l.uniqueValueLabel&&null!=l.uniqueValue?d["Voxel.ServiceValue"]=`${l.uniqueValueLabel} (${l.uniqueValue})`:null!=l.uniqueValue&&(d["Voxel.ServiceValue"]=`${l.uniqueValue}`),d["Voxel.ServiceVariableLabel"]=l.variableLabel,d["Voxel.Position"]=l.voxelSpacePosition,null!=l.epochTime&&null!=l.nativeTime&&null!=l.nativeTimeUnits){const e=new Date(l.epochTime);d["Voxel.ServiceLocalTime"]=e.toString(),d["Voxel.ServiceNativeTime"]=`${l.nativeTime.toLocaleString()} ${l.nativeTimeUnits}`}null!=l.depth&&null!=l.depthUnits&&(d["Voxel.ServiceDepth"]=`${l.depth.toLocaleString()} ${l.depthUnits}`);const _=l.faceNormal;d["Voxel.WorldPosition"]=`[${a[0]}, ${a[1]}, ${a[2]}]`;const u=e=>{const i=new p(a,t,(()=>this._createVoxelGraphic(h.layerView.layer,d)));e.set(this.type,i,r,_)},c=e.results,m=e.options.store===T.ALL;if((null==c.min.dist||r<c.min.dist)&&u(c.min),(null==c.max.dist||r>c.max.dist)&&u(c.max),m){const t=b(e.ray);u(t),e.results.all.push(t)}}}_createVoxelGraphic(t,i){return new e({layer:t,sourceLayer:t,attributes:i})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}_setUpscalingLimits(e,t,i){this._vxl&&this._vxl.set_upscaling_limits(e,t,i)}}export{W as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../core/Error.js";import{assertIsSome as i}from"../../../core/maybe.js";import{urlToObject as s}from"../../../core/urlUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import l from"../RasterInfo.js";import o from"../RasterStorageInfo.js";import n from"../TileInfo.js";import{TilemapCache as c}from"../TilemapCache.js";import m from"./BaseRaster.js";import{setValidBoundary as u}from"../rasterFunctions/pixelUtils.js";import h from"../rasterTransforms/GCSShiftTransform.js";import{fetchServiceRasterInfo as f}from"../../../rest/imageService/fetchRasterInfo.js";import p from"../../../geometry/SpatialReference.js";import d from"../../../geometry/Point.js";import y from"../../../geometry/Extent.js";let x=class extends m{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async open(e){await this.init();const r=e&&e.signal,a=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:r});a.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const l=a.data;if(this.sourceJSON=l,!l)throw new t("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!l.tileInfo)throw new t("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();const m=["jpg","jpeg","png","png8","png24","png32","mixed"];this.tileType=l.cacheType,null==this.tileType&&(m.includes(l.tileInfo.format.toLowerCase())?this.tileType="Map":"lerc"===l.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=l.name?.slice(l.name.indexOf("/")+1)??"";const u=await this._fetchRasterInfo({signal:r});if(null==u)throw new t("image-server-raster:open","cannot initialize image service");const h="Map"===this.tileType?g(l.tileInfo,l):n.fromJSON(l.tileInfo);i(h);const[f,p]=this._computeMinMaxLOD(u,h),{extent:d,pixelSize:y}=u,x=.5/u.width*y.x,v=Math.max(y.x,y.y),{lods:S}=h;("Map"!==this.tileType&&0!==l.maxScale||Math.abs(y.x-y.y)>x||!S.some((e=>Math.abs(e.resolution-v)<x)))&&(y.x=y.y=f.resolution,u.width=Math.ceil((d.xmax-d.xmin)/y.x-.1),u.height=Math.ceil((d.ymax-d.ymin)/y.y-.1));const I=f.level-p.level,[w,j]=h.size,M=[],b=[];S.forEach(((e,t)=>{e.level>=p.level&&e.level<=f.level&&M.push({x:e.resolution,y:e.resolution}),t<S.length-1&&b.push(Math.round(10*e.resolution/S[t+1].resolution)/10)})),M.sort(((e,t)=>e.x-t.x));const T=this.computeBlockBoundary(d,w,j,h.origin,M,I),_=M.length>1?M.slice(1):null;let O;l.transposeInfo&&(O={tileSize:[l.transposeInfo.rows,l.transposeInfo.cols],packetSize:u.keyProperties?._yxs.PacketSize??0});const R=b.length<=1||b.length>=3&&b.slice(0
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../core/Error.js";import{assertIsSome as i}from"../../../core/maybe.js";import{urlToObject as s}from"../../../core/urlUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import l from"../RasterInfo.js";import o from"../RasterStorageInfo.js";import n from"../TileInfo.js";import{TilemapCache as c}from"../TilemapCache.js";import m from"./BaseRaster.js";import{setValidBoundary as u}from"../rasterFunctions/pixelUtils.js";import h from"../rasterTransforms/GCSShiftTransform.js";import{fetchServiceRasterInfo as f}from"../../../rest/imageService/fetchRasterInfo.js";import p from"../../../geometry/SpatialReference.js";import d from"../../../geometry/Point.js";import y from"../../../geometry/Extent.js";let x=class extends m{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async open(e){await this.init();const r=e&&e.signal,a=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:r});a.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const l=a.data;if(this.sourceJSON=l,!l)throw new t("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!l.tileInfo)throw new t("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();const m=["jpg","jpeg","png","png8","png24","png32","mixed"];this.tileType=l.cacheType,null==this.tileType&&(m.includes(l.tileInfo.format.toLowerCase())?this.tileType="Map":"lerc"===l.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=l.name?.slice(l.name.indexOf("/")+1)??"";const u=await this._fetchRasterInfo({signal:r});if(null==u)throw new t("image-server-raster:open","cannot initialize image service");const h="Map"===this.tileType?g(l.tileInfo,l):n.fromJSON(l.tileInfo);i(h);const[f,p]=this._computeMinMaxLOD(u,h),{extent:d,pixelSize:y}=u,x=.5/u.width*y.x,v=Math.max(y.x,y.y),{lods:S}=h;("Map"!==this.tileType&&0!==l.maxScale||Math.abs(y.x-y.y)>x||!S.some((e=>Math.abs(e.resolution-v)<x)))&&(y.x=y.y=f.resolution,u.width=Math.ceil((d.xmax-d.xmin)/y.x-.1),u.height=Math.ceil((d.ymax-d.ymin)/y.y-.1));const I=f.level-p.level,[w,j]=h.size,M=[],b=[];S.forEach(((e,t)=>{e.level>=p.level&&e.level<=f.level&&M.push({x:e.resolution,y:e.resolution}),t<S.length-1&&b.push(Math.round(10*e.resolution/S[t+1].resolution)/10)})),M.sort(((e,t)=>e.x-t.x));const T=this.computeBlockBoundary(d,w,j,h.origin,M,I),_=M.length>1?M.slice(1):null;let O;l.transposeInfo&&(O={tileSize:[l.transposeInfo.rows,l.transposeInfo.cols],packetSize:u.keyProperties?._yxs.PacketSize??0});const R=b.length<=1||b.length>=3&&b.slice(0,-1).every((e=>e===b[0]))?b[0]??2:Math.round(10/(p.resolution/f.resolution)**(-1/I))/10;if(u.storageInfo=new o({blockWidth:h.size[0],blockHeight:h.size[1],pyramidBlockWidth:h.size[0],pyramidBlockHeight:h.size[1],pyramidResolutions:_,pyramidScalingFactor:R,compression:h.format,origin:h.origin,firstPyramidLevel:1,maximumPyramidLevel:I,tileInfo:h,transposeInfo:O,blockBoundary:T}),this._fixGCSShift(u),this._set("rasterInfo",u),l.capabilities.toLowerCase().includes("tilemap")){const e={tileInfo:u.storageInfo.tileInfo,parsedUrl:s(this.url),url:this.url,tileServers:[]};this._tilemapCache=new c({layer:e})}}async fetchRawTile(e,t,i,s={}){const{storageInfo:r,extent:a}=this.rasterInfo,{transposeInfo:l}=r,o=null!=l&&!!s.transposedVariableName;if(this._slices&&!o&&null==s.sliceId)return null;const n=o?0:r.maximumPyramidLevel-e+this._levelOffset,c=`${this.url}/tile/${n}/${t}/${i}`,m=this._slices?o?{variable:s.transposedVariableName}:{sliceId:s.sliceId||0}:null,{data:h}=await this.request(c,{query:m,responseType:"array-buffer",signal:s.signal});if(!h)return null;const f=o?l.tileSize:r.tileInfo.size,p=await this.decodePixelBlock(h,{width:f[0],height:f[1],planes:null,pixelType:null,isPoint:"Elevation"===this.tileType,returnInterleaved:o,noDataValue:this.rasterInfo.noDataValue});if(null==p)return null;const d=r.blockBoundary[e];if("jpg"!==r.compression||i>d.minCol&&i<d.maxCol&&t>d.minRow&&t<d.maxRow)return p;const{origin:y,blockWidth:x,blockHeight:g}=r,{x:v,y:S}=this.getPyramidPixelSize(e),I=Math.round((a.xmin-y.x)/v)%x,w=Math.round((a.xmax-y.x)/v)%x||x,j=Math.round((y.y-a.ymax)/S)%g,M=Math.round((y.y-a.ymin)/S)%g||g,b=i===d.minCol?I:0,T=t===d.minRow?j:0,_=i===d.maxCol?w:x,O=t===d.maxRow?M:g;return u(p,{x:b,y:T},{width:_-b,height:O-T}),p}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;const t=e;for(let i=0;i<this._slices.length;i++){const e=this._slices[i].multidimensionalDefinition;if(e.length===t.length&&!e.some((e=>{const i=t.find((t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName));if(!i)return!0;return(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])})))return i}return null}async fetchVariableStatisticsHistograms(e,t){const i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.statistics)),s=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.histograms)),r=await Promise.all([i,s]);return r[0]&&r[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:r[0]||null,histograms:r[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,t.datumTransformation);if(null===i)return null;let s=0;const{maximumPyramidLevel:r}=this.rasterInfo.storageInfo;let a=r-s+this._levelOffset;const l=i.srcLocation;for(;a>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(a,i.row,i.col,t))break}catch{}if(a--,s++,i=this.identifyPixelLocation(l,s,t.datumTransformation),null===i)return null}return-1===a||null==i?null:s}async _fetchRasterInfo(e){const t=this.sourceJSON;if("Map"===this.tileType){const e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),s=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),r=p.fromJSON(t.spatialReference||e.spatialReference),a=new d({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:r});return new l({width:i,height:s,bandCount:3,extent:y.fromJSON(e),spatialReference:r,pixelSize:a,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}const{signal:i}=e,s=f(this.url,this.sourceJSON,{signal:i,query:this.ioConfig.customFetchParameters}),r=t.hasMultidimensions?this.request(`${this.url}/slices`,{query:{f:"json"},signal:i}).then((e=>e.data&&e.data.slices)).catch((()=>null)):null,a=await Promise.all([s,r]);return this._slices=a[1],a[0]}_fixScaleInServiceInfo(){const{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_fixGCSShift(e){const{extent:t,spatialReference:i}=e;t.xmin>-1&&t.xmax>181&&i?.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new h,e.extent=e.transform.forwardTransform(t))}_computeMinMaxLOD(e,t){const{pixelSize:i}=e,s=.5/e.width*i.x,{lods:r}=t,a=t.lodAt(Math.max.apply(null,r.map((e=>e.level)))),l=t.lodAt(Math.min.apply(null,r.map((e=>e.level)))),{tileType:o}=this;if("Map"===o)return this._levelOffset=r[0].level,[a,l];if("Raster"===o){return[r.find((e=>e.resolution===i.x))??a,l]}const{minScale:n,maxScale:c}=this.sourceJSON;let m=a;c>0&&(m=r.find((e=>Math.abs(e.scale-c)<s)),m||(m=r.filter((e=>e.scale>c)).sort(((e,t)=>e.scale>t.scale?1:-1))[0]??a));let u=l;return n>0&&(u=r.find((e=>Math.abs(e.scale-n)<s))??l,this._levelOffset=u.level-l.level),[m,u]}};function g(e,t){if(!e)return null;const{minScale:i,maxScale:s,minLOD:r,maxLOD:a}=t;if(null!=r&&null!=a)return n.fromJSON({...e,lods:e.lods.filter((({level:e})=>null!=e&&e>=r&&e<=a))});if(0!==i&&0!==s){const t=e=>Math.round(1e4*e)/1e4,r=i?t(i):1/0,a=s?t(s):-1/0;return n.fromJSON({...e,lods:e.lods.filter((e=>{const i=t(e.scale);return i<=r&&i>=a}))})}return n.fromJSON(e)}e([r({type:String,json:{write:!0}})],x.prototype,"datasetFormat",void 0),e([r()],x.prototype,"tileType",void 0),x=e([a("esri.layers.support.rasterDatasets.ImageServerRaster")],x);const v=x;export{v as default};
|