(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5e807b02","chunk-579fe43e"],{2698:function(e,t,i){"use strict";function s(e){return e&&"getAtOrigin"in e&&"originOf"in e}i.d(t,"a",(function(){return s}))},"2a00":function(e,t,i){"use strict";i.r(t),i.d(t,"destroyContext",(function(){return m})),i.d(t,"dracoDecompressPointCloudData",(function(){return u})),i.d(t,"filterObbsForModifications",(function(){return b})),i.d(t,"filterObbsForModificationsSync",(function(){return v})),i.d(t,"initialize",(function(){return w})),i.d(t,"interpretObbModificationResults",(function(){return j})),i.d(t,"process",(function(){return h})),i.d(t,"setLegacySchema",(function(){return g})),i.d(t,"setModifications",(function(){return f})),i.d(t,"setModificationsSync",(function(){return y})),i.d(t,"test",(function(){return I}));var s=i("b2b2"),r=i("a21b"),n=i("7a89"),a=i("b2cd");function o(){return l||(l=new Promise(e=>i.e("chunk-2d0e887f").then(i.bind(null,"8a55")).then(e=>e.i).then(({default:t})=>{const i=t({locateFile:d,onRuntimeInitialized:()=>e(i)});delete i.then})).catch(e=>Promise.reject(e))),l}function d(e){return Object(a["b"])("esri/libs/i3s/"+e)}let l;var c=i("c453");async function h(e){await w();const t=[e.geometryBuffer];return{result:O(e,t),transferList:t}}async function u(e){var t;await w();const i=[e.geometryBuffer],{geometryBuffer:s}=e,n=s.byteLength,a=p._malloc(n),o=new Uint8Array(p.HEAPU8.buffer,a,n);o.set(new Uint8Array(s));const d=p.dracoDecompressPointCloudData(a,o.byteLength);if(p._free(a),d.error.length>0)throw"i3s.wasm: "+d.error;const l=(null==(t=d.featureIds)?void 0:t.length)>0?Object(r["m"])(d.featureIds):null,c=Object(r["m"])(d.positions);return l&&i.push(l.buffer),i.push(c.buffer),{result:{positions:c,featureIds:l},transferList:i}}async function b(e){await w(),v(e);const t={buffer:e.buffer};return{result:t,transferList:[t.buffer]}}async function f(e){await w(),y(e)}async function g(e){await w(),p.setLegacySchema(e.context,e.jsonSchema)}function m(e){x(e)}let _,p;function y(e){const t=e.modifications,i=p._malloc(8*t.length),s=new Float64Array(p.HEAPU8.buffer,i,t.length);for(let r=0;re.some(e=>"color"===e.name)),normal:e.needNormals&&e.layouts.some(e=>e.some(e=>"normalCompressed"===e.name)),uv0:e.layouts.some(e=>e.some(e=>"uv0"===e.name)),uvRegion:e.layouts.some(e=>e.some(e=>"uvRegion"===e.name)),featureIndex:x.featureIndex},I=p.process(i,!!e.obb,g,y.byteLength,x,w,_,c,b,f,e.normalReferenceFrame);if(p._free(_),p._free(g),I.error.length>0)throw"i3s.wasm: "+I.error;if(I.discarded)return null;const N=I.componentOffsets.length>0?Object(r["m"])(I.componentOffsets):null,M=I.featureIds.length>0?Object(r["m"])(I.featureIds):null,S=Object(r["m"])(I.interleavedVertedData).buffer,D=I.indicesType===n["a"].Int16?Object(r["m"])(new Uint16Array(I.indices.buffer,I.indices.byteOffset,I.indices.byteLength/2)):Object(r["m"])(new Uint32Array(I.indices.buffer,I.indices.byteOffset,I.indices.byteLength/4)),E=Object(r["m"])(I.positions),P=I.positionIndicesType===n["a"].Int16?Object(r["m"])(new Uint16Array(I.positionIndices.buffer,I.positionIndices.byteOffset,I.positionIndices.byteLength/2)):Object(r["m"])(new Uint32Array(I.positionIndices.buffer,I.positionIndices.byteOffset,I.positionIndices.byteLength/4)),F={layout:e.layouts[0],interleavedVertexData:S,indices:D,hasColors:I.hasColors,hasModifications:I.hasModifications,positionData:{data:E,indices:P}};return M&&t.push(M.buffer),N&&t.push(N.buffer),t.push(S),t.push(D.buffer),t.push(E.buffer),t.push(P.buffer),{componentOffsets:N,featureIds:M,transformedGeometry:F,obb:I.obb}}function j(e){return 0===e?c["f"].Unmodified:1===e?c["f"].PotentiallyModified:2===e?c["f"].Culled:c["f"].Unknown}function v(e){const{context:t,buffer:i}=e,s=p._malloc(i.byteLength),r=i.byteLength/Float64Array.BYTES_PER_ELEMENT,n=new Float64Array(p.HEAPU8.buffer,s,r),a=new Float64Array(i);n.set(a),p.filterOBBs(t,s,r),a.set(n),p._free(s)}function x(e){p&&p.destroy(e)}function C(e,t){for(let i=0;i{p=e,_=null})),_)}const I={transform:O,destroy:x}},"2b13":function(e,t,i){"use strict";var s,r;i.d(t,"a",(function(){return s})),i.d(t,"b",(function(){return r})),function(e){e[e.KTX2=1]="KTX2",e[e.Basis=2]="Basis",e[e.DDS_S3TC=4]="DDS_S3TC",e[e.PNG=8]="PNG",e[e.JPG=16]="JPG",e[e.KTX_ETC2=32]="KTX_ETC2"}(s||(s={})),function(e){e[e.None=0]="None",e[e.Color=1]="Color",e[e.MetallicRoughness=2]="MetallicRoughness",e[e.Normal=4]="Normal",e[e.Occlusion=8]="Occlusion",e[e.Emissive=16]="Emissive",e[e.AlphaMask=32]="AlphaMask",e[e.ColorTextures=19]="ColorTextures",e[e.GeometryTextures=36]="GeometryTextures",e[e.GeometryTexturesPBR=44]="GeometryTexturesPBR",e[e.AllTextures=37]="AllTextures",e[e.AllTexturesPBR=63]="AllTexturesPBR"}(r||(r={}))},"38a2":function(e,t,i){"use strict";i.d(t,"a",(function(){return ke}));var s=i("a4ee"),r=i("fc29"),n=i("af40"),a=i("c120"),o=i("e92d"),d=i("b2b2"),l=i("8a44"),c=i("fab3"),h=i("f4cc"),u=i("477c"),b=i("59b2"),f=i("b50f"),g=(i("cea0"),i("d386")),m=i("8188"),_=i("9180"),p=i("1a54"),y=i("306f"),O=i("9305");class j{constructor(e){this.referenceCount=0,this.callbacks=[],this.runIndex=0,this.handle=e.registerTask(O["c"].I3S_CONTROLLER,this)}destroy(){this.handle&&(this.handle.remove(),this.handle=null)}get running(){for(const e of this.callbacks)if(e.needsUpdate())return!0;return!1}runTask(e){this._sort();const t=this.callbacks,i={numIndexLoading:0,numNodesLoading:0};for(let s=0;s0;i--){const s=e[i-1];let r=i;for(;r{null!=i&&(i.remove(t),i.callbacks.length>0||(v.delete(e),i.destroy()),i=null)}}}var C=i("e431"),w=i("0fc4"),I=i("c453"),N=i("ee9c"),M=i("cee3");class S{constructor(e,t,i,s,r){this.childOffset=e,this.childCount=t,this.visibilityCache=i,this.ref=s,this.node=r,this.useAsHole=0,this.filterImpact=I["e"].NotChecked}}class D{constructor(e,t,i,s,r,n,a,o,d,c,h,u,b,f){this.streamDataController=i,this.viewportQueries=s,this.logger=r,this.holeFilling=n,this._isLoaded=a,this._isReloading=o,this._isSelected=d,this._enable=c,this._needsUpdate=h,this._canRequest=u,this._computeVisibilityObb=b,this._computeNodeFiltering=f,this._dirty=!0,this._nodePages=[],this.nodeCount=0,this.nodesPerPage=0,this.rootIndex=0,this.lodMetric=I["b"].None,this._lodConversion=e=>e,this.urlPrefix="",this._loading=new Set,this._failedNodes=new Set,this._failedPages=new Set,this._indexMissing=1,this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.POSITIVE_INFINITY,this._nodeTraversalState=new Map,this._version=A(0),this._visibilityCacheVersion=A(0),this._maxLevel=1,this._featureEstimate={estimate:0,leavesReached:!1},this._unloadedMemoryEstimate=0,this._missing=new l["a"]({deallocator:null}),this._prefetch=new l["a"]({deallocator:null}),this._updates=new P(this._missing),this._imModificationUncategorized=new l["a"]({deallocator:null}),this.ignoreServiceObb=!1,this.progressiveLoadPenalty=0,this._pageQueue=[],this.layerHasModifications=!1,this._layerHasFilter=!1,this.logLayer=e,e.serviceUpdateTimeStamp&&e.serviceUpdateTimeStamp.lastUpdate&&(this.lastUpdate=""+e.serviceUpdateTimeStamp.lastUpdate),this._maxLodLevel=this.viewportQueries?this.viewportQueries.maxLodLevel:1,this._init(t)}_init(e){if("page"===e.type){switch(this.urlPrefix=e.urlPrefix,this.nodesPerPage=e.pageSize,this.rootIndex=e.rootIndex,e.lodMetric){case"maxScreenThreshold":this.lodMetric=I["b"].MaxScreenThreshold;break;case"maxScreenThresholdSQ":this.lodMetric=I["b"].MaxScreenThreshold,this._lodConversion=q}this._addPage(V(this.rootIndex,this.nodesPerPage),e.rootPage),this._updateParentsAndLevel()}else if("node"===e.type){this.urlPrefix=e.urlPrefix,this._nodePages.push({nodes:[],children:[],parents:[]}),this._makeRefNode(new I["d"](e.rootNode.id,null),-1);const t=this._validateNode(e.rootNode.id,e.rootNode);t&&this._addNode(t,0)}}_loadPage(e){this._loading.add(e);const t=this.urlPrefix+e;this.streamDataController.request(t,"json").then(t=>{this._pageQueue.push({pageIndex:e,page:t})}).catch(t=>{this._loading.delete(e),Object(h["m"])(t)||(this._failedPages.add(e),this.logger.error("#loadPage()",this.logLayer,"Error when loading page "+e,t))})}_addQueuedPages(e){for(;this._pageQueue.length>0&&!e.done;){const{pageIndex:t,page:i}=this._pageQueue.shift();this._addPage(t,i),this._loading.delete(t),e.madeProgress()}this._updateParentsAndLevel()}_addPage(e,t){for(let n=this._nodePages.length;n{const n=i.length,a=t.children?t.children.length:0;s.push(-1);for(let e=0;e{const r=this._getPage(t);if(Object(d["k"])(r)){const n=U(t,this.nodesPerPage);r.parents[n]=i;const a=r.nodes[n].node;Object(d["k"])(a)&&(a.level=s,e.push(t))}};for(t(this.rootIndex,-1,0);e.length;){const i=e.pop(),s=this.getNode(i);if(Object(d["k"])(s))for(let e=0;e{(Object(d["k"])(i.node)&&i.node.id===e||Object(d["k"])(i.ref)&&i.ref.id===e)&&(t=s)}),t}getNodeById(e){const t=this.getIndexById(e);return t>=0?this.getNode(t):null}getChildIndex(e,t){const i=this._getPage(e.index);if(Object(d["j"])(i))return-1;const s=i.nodes[U(e.index,this.nodesPerPage)];return i.children[s.childOffset+t]}getParentIndex(e){const t=this._getPage(e);return Object(d["k"])(t)?t.parents[U(e,this.nodesPerPage)]:-1}getParent(e){return(e=this.getParentIndex(e))>=0?this.getNode(e):null}isLeaf(e){const t=this._getNodeInternal(e);return Object(d["k"])(t)&&0===t.childCount}get rootNode(){return this.getNode(this.rootIndex)}get size(){return this.nodeCount}invalidateVisibilityCache(){this._visibilityCacheVersion=A(this._visibilityCacheVersion)}invalidateNodeVisibilityCache(e){const t=this._getNodeInternal(e);Object(d["k"])(t)&&this.invalidateNodeVisibilityCacheInternal(t)}invalidateNodeVisibilityCacheInternal(e){e.visibilityCache=T(this._visibilityCacheVersion)}invalidateBoundingVolumeCache(e){const t=this._getNodeInternal(e);Object(d["k"])(t)&&(F(t),this.invalidateNodeVisibilityCacheInternal(t))}invalidateGeometryVisibility(e){const t=this._getNodeInternal(e);Object(d["k"])(t)&&Object(d["k"])(t.node)&&(t.node.geometryObb=null,t.node.renderMbs[3]=-1,Object(d["k"])(t.node.serviceObbInRenderSR)&&(t.node.serviceObbInRenderSR.halfSize[0]=-1))}invalidateVisibilityObbs(){Object(d["j"])(this.rootNode)||this.traverse(this.rootNode,e=>(e.visibilityObb=this._computeVisibilityObb(e),e.geometryObb=null,!0))}isNodeVisible(e){const t=this._getNodeInternal(e);if(Object(d["j"])(t)||Object(d["k"])(t.ref)&&!t.ref.mbs)return!0;if(!R(t.visibilityCache,this._visibilityCacheVersion)){const e=t.node,i=Object(d["k"])(e)&&(Object(d["j"])(t.ref)||Object(d["k"])(e.visibilityObb))?e:Object(d["k"])(t.ref)?t.ref:null;if(this._layerHasFilter&&this._computeNodeFiltering&&(Object(d["k"])(e)||Object(d["k"])(t.ref))&&t.filterImpact===I["e"].NotChecked){const i=Object(d["k"])(e)?e.mbs:Object(d["k"])(t.ref)?t.ref.mbs:null;t.filterImpact=null!=i?this._computeNodeFiltering(i):I["e"].Unmodified}const s=Object(d["k"])(e)&&t.filterImpact===I["e"].Culled,r=!(Object(d["k"])(e)&&e.imModificationImpact===I["f"].Culled)&&(!i||this.viewportQueries.isNodeVisible(i))&&!s;return t.visibilityCache=k(r,this._visibilityCacheVersion),r}return L(t.visibilityCache)}isGeometryVisible(e){if(!this.isNodeVisible(e))return!1;const t=this._getNodeInternal(e);return!(Object(d["k"])(t)&&Object(d["k"])(t.node)&&Object(d["k"])(t.node.geometryObb)&&(!this.layerHasModifications||t.node.imModificationImpact!==I["f"].NotChecked))||this.viewportQueries.isGeometryVisible(t.node)}_traverseCoverage(e,t,i,s,r){const n=this._getPage(e);if(Object(d["j"])(n)||0===t.childCount)return;const a=t.childOffset+t.childCount,o=new Array;for(let l=t.childOffset;l{Object(d["k"])(e)&&(e.imModificationImpact=I["f"].NotChecked,e.visibilityObb=this._computeVisibilityObb(e),e.hasModifications&&this.invalidateGeometryVisibility(e.index))}),this.invalidateVisibilityCache()}layerFilterChanged(e){this._layerHasFilter=e,this._forAllNodes(e=>{if(Object(d["k"])(e)){e.filterImpact=I["e"].NotChecked;const t=e.node;Object(d["k"])(t)&&this.invalidateNodeVisibilityCache(t.index)}}),this.invalidateVisibilityCache()}update(e,t,i){if(!this._dirty)return;this._pageQueue.length>0&&this._addQueuedPages(t),this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.NEGATIVE_INFINITY,this._missing.clear(),this._prefetch.clear(),this._updates.reset(e),E.clear();let s=!0;const r=new H,n=new H,a=this._imModificationUncategorized;a.clear();const o=new Set,l=(l,c,h)=>{if(Object(d["j"])(c)){let e=this._entryPriority(l);e===1/0&&(e=this._entryPriority(h));const t=V(l,this.nodesPerPage);return E.set(t,Math.max(e,E.get(t)||0)),this._loading.has(t)||this._failedPages.has(t)||this._missing.push(t),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const u=c.node;if(this._updateNodeFeatureEstimate(u,n),Object(d["j"])(u)){const e=this._entryPriority(l);return this._loading.has(l)||this._failedNodes.has(l)||(this._missing.push(l),E.set(l,e)),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const b=Object(d["t"])(this._getPage(l));if(0===this._missing.length&&0===this.nodesPerPage)for(let e=0;e0&&(s=!1):(r.unremoved+=u.memory,s=!1),this._needsUpdate(u)){const e=this._entryPriority(l);E.set(l,e),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e),this._updates.update.push(l)}return}if(u.memory&&(r.known+=u.memory,++r.knownNodes),!this._isSelected(u))return void(this._isReloading(l)&&this._updates.remove.push(l));if(c.childCount>0&&(s=!1),u.memory?(r.missing+=u.memory,r.known+=u.memory,++r.knownNodes):++r.missingNodes,e.indexOf(u.index)>=0)return this._maxProcessingPrio=Math.max(this._maxProcessingPrio,this._entryPriority(l)),void(this._updates.cancel=this._updates.cancel.filter(e=>e!==u.index));if(!t.done&&this._enable(u))return void t.madeProgress();const f=this._entryPriority(l);E.set(l,f),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,f),this._updates.add.push(l),this.layerHasModifications&&i&&Object(d["k"])(u)&&u.imModificationImpact===I["f"].NotChecked&&a.push(l)};this.traverseVisible(l);const c=this._updates.add;c.length>0&&this.layerHasModifications&&(a.length>0&&i(a),c.filterInPlace(e=>{const t=this._getNodeInternal(e),i=Object(d["j"])(t)||Object(d["j"])(t.node)||t.node.imModificationImpact!==I["f"].Culled;return i||this.invalidateNodeVisibilityCache(e),i})),this._unloadedMemoryEstimate=r.missing-r.unremoved,r.knownNodes>3&&r.missingNodes>0&&(this._unloadedMemoryEstimate+=r.known/r.knownNodes*r.missingNodes),this._unloadedMemoryEstimate=.8*Math.max(0,this._unloadedMemoryEstimate),this._featureEstimate.estimate=this._computeFeatureEstimate(n),this._featureEstimate.leavesReached=s,this._missing.sort((e,t)=>e-t),this._missing.filterInPlace((e,t)=>t<1||this._missing.data[t-1]!==e),this._missing.sort((e,t)=>E.get(e)-E.get(t)),this._missing.length>0&&(this._maxUnloadedPrio=E.get(this._missing.back()),this._prefetch.clear()),this._updates.add.filterInPlace(e=>E.get(e)>=this._maxUnloadedPrio).sort((e,t)=>E.get(e)-E.get(t)),this._updates.update.sort((e,t)=>E.get(e)-E.get(t)),this._indexMissing=this._loading.size+this._missing.length,this._dirty=this._indexMissing>0,E.clear()}checkFeatureTarget(e,t){const i=this.viewportQueries.updateScreenSpaceErrorBias(t);let s=t,r=t,n=i,a=10;for(;a--;){const i=new H;if(this._updateFeatureEstimate(s,i),this._computeFeatureEstimate(i)<=e){if(s>=t||i.missingNodes>0||0===a)break;n=s,s=.5*(s+r)}else r=s,s=.5*(s+n)}return this._version=A(this._version),this.viewportQueries.updateScreenSpaceErrorBias(i),Math.min(t,s)}_updateFeatureEstimate(e,t){this._version=A(this._version),this.viewportQueries.updateScreenSpaceErrorBias(e),this.traverseVisible((e,i)=>this._updateNodeFeatureEstimate(Object(d["k"])(i)&&i.node,t))}_updateNodeFeatureEstimate(e,t){if(!(Object(d["j"])(e)||e.failed||Object(d["j"])(e.numFeatures)))return this._isLoaded(e.index)?(t.known+=e.numFeatures,++t.knownNodes,void(this._isSelected(e)||(t.unremoved+=e.numFeatures))):void(this._isSelected(e)&&(Object(d["k"])(e.numFeatures)?(t.missing+=e.numFeatures,t.known+=e.numFeatures,++t.knownNodes):++t.missingNodes))}_computeFeatureEstimate(e){let t=e.known-e.unremoved;return e.knownNodes>3&&e.missingNodes>0&&(t+=e.known/e.knownNodes*e.missingNodes),Math.max(0,t)}load(){return this._load(this._missing)}prefetch(){return this._prefetch.sort((e,t)=>E.get(e)-E.get(t)),this._load(this._prefetch)}_load(e){if(0===e.length||!this._canRequest())return!1;for(;e.length>0&&this._canRequest();)0===this.nodesPerPage?this._loadNode(e.pop()):this._loadPage(e.pop());return!0}isLoading(){return this._indexMissing>0}getIndexLoading(){return this._loading.size}getIndexMissing(){return this._indexMissing}getUnloadedMemoryEstimate(){return this._unloadedMemoryEstimate}get updates(){return this._updates}get featureEstimate(){return this._featureEstimate}nodeTraversalState(e){if(Object(d["j"])(e))return null;let t=this._nodeTraversalState.get(e.index);if(t&&R(t.version,this._version))return t;const i=this.viewportQueries.getLodLevel(e),s=this.viewportQueries.hasLOD(e);let r=!0;if(s){const t=this.getParentIndex(e.index);if(t>=0){const e=this._nodeTraversalState.get(t);r=e&&i>e.lodLevel}else r=i>0}else r=0===e.childCount;return t?(t.lodLevel=i,t.isChosen=r,t.version=k(!0,this._version),t):(t=new I["h"](s,r,i,k(!0,this._version)),this._nodeTraversalState.set(e.index,t),t)}_loadNode(e){this._loading.add(e);const t=Object(d["t"])(this._getNodeInternal(e)).ref;if(Object(d["j"])(t))return void this._failedNodes.add(e);const i=t.id,s=this.urlPrefix+i,r=()=>{this._loading.delete(e),0===this._missing.length&&0===this._loading.size&&this.requestUpdate()};this.streamDataController.request(s,"json").then(t=>{r();const s=this._validateNode(i,t);if(null==s)return;s.obb&&this.invalidateNodeVisibilityCache(e);const n=this._addNode(s,e);this.nodeTraversalState(n)},t=>{r(),Object(h["m"])(t)||(this.logger.error("#loadNode()",this.logLayer,"Error loading node: "+s),this._failedNodes.add(e))})}_validateNode(e,t){if(null==t||"object"!=typeof t||t.id!==e)return this.logger.error("#validateNode()",this.logLayer,`Invalid node. Wrong type or wrong id "${e}"`),null;if(!Array.isArray(t.mbs))return this.logger.error("#validateNode()",this.logLayer,`Invalid bounding volume on node ${e}.`),null;t.sharedResource&&"./shared"!==t.sharedResource.href&&"./shared/"!==t.sharedResource.href&&this.logger.warn("#validateNode()",this.logLayer,`Invalid shared resource href on node "${e}"`),null==t.geometryData||Array.isArray(t.geometryData)&&1===t.geometryData.length&&"./geometries/0"===t.geometryData[0].href||this.logger.warn("#validateNode()",this.logLayer,`Invalid geometry data on node "${e}"`),null==t.attributeData||Array.isArray(t.attributeData)&&!t.attributeData.some((e,t)=>e.href!==`./attributes/f_${t}/0`)||this.logger.warn("#validateNode()",this.logLayer,`Invalid attribute data on node "${e}"`),t.featureData&&t.featureData.length>1&&this.logger.warn("#validateNode()",this.logLayer,`Node ${e} has ${t.featureData.length} bundles. Only the first bundle will be loaded.`);const i=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:null,s=t.featureData&&1===t.featureData.length&&t.featureData[0].featureRange?t.featureData[0].featureRange[1]-t.featureData[0].featureRange[0]+1:null,r=t=>{if(null==t)return null;const i=t=>this.logger.error("#validateNode()",this.logLayer,`Invalid node reference on node ${e}: ${t}`);if("number"==typeof t.id)i(`id ${t.id} is a number instead of a string.`);else if("string"!=typeof t.id||!Array.isArray(t.mbs))return i("Missing or invalid id."),null;if(!Array.isArray(t.mbs))return i(`Invalid bounding volume on reference ${t.id}.`),null;t.href&&t.href!=="../"+t.id&&this.logger.error("#validateNode()",this.logLayer,`Invalid node href on node "${e}"`);const s=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:null,r=new I["d"](""+t.id,t.mbs);return r.serviceObb=s,r.visibilityObb=this._computeVisibilityObb(r),r},n=Array.isArray(t.children)?t.children.map(r).filter(e=>null!=e):null;return{id:e,mbs:t.mbs,obb:i,children:n,resources:{hasFeatureData:t.featureData&&t.featureData.length>0,hasSharedResource:null!=t.sharedResource,attributes:t.attributeData?e:null,texture:t.textureData&&t.textureData.length>0?e:null,geometry:null!=t.geometryData?e:null},version:"string"==typeof t.version?t.version:null,lodSelection:Array.isArray(t.lodSelection)?t.lodSelection:null,numFeatures:s}}resetFailedNodes(){this._failedNodes.clear(),this._failedPages.clear(),this._forAllNodes(e=>{Object(d["k"])(e.node)&&(e.node.failed=!1)})}_entryPriority(e){const t=this._getNodeInternal(e),i=this.getParentIndex(e);if(Object(d["j"])(t)||i<0&&null==t.node)return i<0?1/0:this._entryPriority(i);let s=0;if(t.node&&i>=0){const e=this._nodeTraversalState.get(i);null!=e&&(s=e.lodLevel)}let r=this.progressiveLoadPenalty;for(let a=e;a>=0;a=this.getParentIndex(a))if(this._isLoaded(a)){r=0;break}const n=Object(d["k"])(t.ref)?this.viewportQueries.distToPOI(t.ref):Object(d["k"])(t.node)?this.viewportQueries.distToPOI(t.node):0;return-n-s*(n+this.progressiveLoadPenalty)+r}traverseVisible(e){const t=this._getNodeInternal(this.rootIndex);Object(d["j"])(t)?e(this.rootIndex,null,null):this._traverseVisible(this.rootIndex,-1,t,e)}_traverseVisible(e,t,i,s){if(i.node&&0===i.childCount)return void(this.isGeometryVisible(e)&&s(e,i,t));if(!this.isNodeVisible(e))return;if(s(e,i,t),null==i.node)return;const r=this.nodeTraversalState(i.node);if(r.nodeHasLOD&&r.lodLevel===this._maxLodLevel)return;const n=Object(d["t"])(this._getPage(e));for(let a=0;a0&&(e.nodes+=" + "+this._updates.add.length),(this._indexMissing||this._prefetch.length>0)&&(e.index+=" + "+this._indexMissing||!1),e.prio=this._maxProcessingPrio,this._featureEstimate.estimate){const t=this._featureEstimate.estimate-e.features;t>0?e.features+=" + "+t:t<0&&(e.features+=" - "+-t)}}getPriority(){return Math.max(this._maxProcessingPrio,this._maxUnloadedPrio)}updateElevationInfo(e){this._forAllNodes(F),this.viewportQueries.updateElevationInfo(e)}_forAllNodes(e){for(let t=0;tthis._addNode(e,t)}}}const E=new Map;class P{constructor(e){this.missing=e,this.update=new l["a"]({deallocator:null}),this.add=new l["a"]({deallocator:null}),this.remove=new l["a"]({deallocator:null}),this.cancel=[]}reset(e){this.add.clear(),this.update.clear(),this.cancel=e}}function F(e){Object(d["k"])(e.node)&&(e.node.renderMbs[3]=-1,Object(d["k"])(e.node.serviceObbInRenderSR)&&(e.node.serviceObbInRenderSR.halfSize[0]=-1)),Object(d["k"])(e.ref)&&(e.ref.renderMbs[3]=-1,Object(d["k"])(e.ref.serviceObbInRenderSR)&&(e.ref.serviceObbInRenderSR.halfSize[0]=-1))}function T(e){return Object(N["b"])(e,-2)}function A(e){return Object(N["b"])(e,2)}function k(e,t){return t+(e?1:0)}function R(e,t){return(-2&e)===t}function L(e){return 1==(1&e)}function V(e,t){return 0===t?0:e/t|0}function U(e,t){return 0===t?e:e%t}const G=[["maxScreenThreshold",I["b"].MaxScreenThreshold],["screenSpaceRelative",I["b"].ScreenSpaceRelative],["removedFeatureDiameter",I["b"].RemovedFeatureDiameter],["distanceRangeFromDefaultCamera",I["b"].DistanceRangeFromDefaultCamera]];function B(e){if(e)for(let t=0;t0;let b=u;if(u)for(let m=0;m((this.layerView.isNodeLoaded(e.index)||this.layerView.isNodeReloading(e.index))&&$.push(e.index),!0))}hasNoVisibleChildren(e){let t=!0;return this._index.traverseChildren(e,e=>!(!t||!this._index.isNodeVisible(e.index))&&(!this.layerView.isNodeLoaded(e.index)||(t=!1,!1))),t}_childrenRequireLoading(e){let t=!1,i=!0;return this._index.traverseChildren(e,e=>{if(!i||!this._index.isNodeVisible(e.index))return!1;const s=this._index.nodeTraversalState(e);return this._isChosenMaxLOD(s)&&this._index.isGeometryVisible(e.index)&&(t=!0),!this.layerView.isNodeLoaded(e.index)||(i=!1,!1)}),i&&t}_isChosenMaxLOD(e){return e.isChosen&&(!e.nodeHasLOD||e.lodLevel===this._maxLodLevel)}}const $=new l["a"]({deallocator:null});var K=i("792b"),X=i("7ffa"),Y=i("e041"),W=i("2b13"),J=i("ad64"),Z=i("8752");class ee{constructor(e,t,i,s,r,n){if(this.streamDataController=t,this.logger=i,this.defaultGeometrySchema=s,this.requiredAttributes=r,this.options=n,this.logLayer=e,this.layerUrl=e.parsedUrl.path,this.geometryDefinitions=e.geometryDefinitions,e.materialDefinitions){const t=e.textureSetDefinitions;this.materialAndTextures=e.materialDefinitions.map(e=>Object(Z["d"])(t,e))}}_load(e,t,i){return this.streamDataController.request(e,t,i)}_loadAttribute(e,t,i){const s=`${this.layerUrl}/nodes/${e.resources.attributes}/attributes/${t.key}/0`;return this._load(s,"binary",i).then(e=>Object(J["d"])(t,e))}loadAttributes(e,t,i){return Object(h["j"])(t.map(t=>this._loadAttribute(e,t.attributeStorageInfo,i))).then(i=>{const s={};for(let r=0;r=0?this.materialAndTextures[e.resources.materialDefinition]:null!=o?Object(Z["e"])(o):null,c=l&&l.material,h=l&&l.textures,u=""+e.id,b=!n&&this.options.loadFeatureData,f=b?await this._loadFeatureData(u,t):null,g=b?ie(f):te(c),m=Object(d["j"])(g)&&se(f),_=null!=h&&h.length>0?Object(K["d"])(this.loadTextures(e,h,t)):null;let p=null,y=null;if(a){p=Object(K["a"])(await a);const e=re(this.defaultGeometrySchema,o);y=Object(J["a"])(s,e)}const O=_?Object(K["a"])(await _):null,j=i?Object(K["a"])(await i):{},v=j?{attributeData:j,loadedAttributes:this.requiredAttributes}:null;return Object(d["k"])(g)?{geometryData:g,attributeDataInfo:v,geometryBuffer:p,geometryDescriptor:y,requiredTextures:h,textureData:O}:Object(d["k"])(m)?{pointData:m,attributeDataInfo:v,geometryBuffer:p,geometryDescriptor:y,requiredTextures:h,textureData:O}:Promise.reject()}static _addAbsoluteHrefTexture(e,t){const i=e.textureDefinitions;if(null!=i)for(const s of Object.keys(i))for(const e of i[s].images)Array.isArray(e.href)?e.hrefConcat=e.href.map(e=>Object(Y["C"])(e,t)):e.hrefConcat=Object(Y["C"])(e.href,t)}static _fixTextureEncodings(e){const t=e.textureDefinitions;if(null!=t)for(const i in t){const e=t[i];if(Array.isArray(e.encoding))for(let t=0;t(ee._fixTextureEncodings(e),ee._addAbsoluteHrefTexture(e,i),e))}_loadTexture(e,t,i,s,r,n){let a=!1;return r===W["a"].DDS_S3TC||r===W["a"].KTX2||r===W["a"].Basis?this._load(e,"binary",n).then(e=>({id:t,usage:i,data:e,encoding:r,downsampled:a})):this._load(e,"image",n).then(e=>{let n=e;const o=4096,d=2;if(s&&e.width*e.height>=o){const t=Math.ceil(e.width/d),i=Math.ceil(e.height/d),s=document.createElement("canvas");s.width=t,s.height=i,s.getContext("2d").drawImage(e,0,0,t,i),n=s,a=!0}return{id:t,usage:i,data:n,encoding:r,downsampled:a}})}loadTextures(e,t,i){const s=this.options.uncompressedTextureDownsamplingEnabled,r=this.options.textureUsageMask;return Promise.all(t.map(t=>{if(0==(t.usage&r))return null;const n=Object(Z["g"])(t.encodings,this.options.textureEncodings);if(null==n)return this.logger.error("#loadTextures",this.logLayer,"No known encoding for texture found on node "+e.id),Promise.reject();const a=e.resources.texture||e.id,o=`${this.layerUrl}/nodes/${a}/textures/${n.name}`;return this._loadTexture(o,t.id,t.usage,s,n.encoding,i)}))}_loadFeatureData(e,t){const i=`${this.layerUrl}/nodes/${e}/features/0`;return this._load(i,"json",t)}_loadGeometry(e,t,i){const s=`${this.layerUrl}/nodes/${e}/geometries/${t}`;return this._load(s,"binary",i)}}function te(e){return{featureIds:[],geometries:[{type:"ArrayBufferView",params:{material:e}}],featureDataPosition:[0,0,0]}}function ie(e){for(const t of e.featureData){const e=t.geometries;if(null!=e)for(const i of e)return{featureIds:[t.id],featureDataPosition:t.position,geometries:[i]}}return null}function se(e){const t=new Array;for(const i of e.featureData)null!=i.position&&t.push({featureIds:[i.id],featureDataPosition:i.position,geometries:null});return t}function re(e,t){if(!e||!t||!t.materialDefinitions)return e;const i=Object.keys(t.materialDefinitions)[0];return!t.materialDefinitions[i].params.vertexRegions&&e.vertexAttributes.region&&delete(e=Object(X["a"])(e)).vertexAttributes.region,e}function ne(e,t){const i={bufferDefinition:null,bufferIndex:0};if(null==e||t.resources.geometryDefinition<0)return i;const s=t.resources.geometryDefinition>=0?e[t.resources.geometryDefinition].geometryBuffers:null;if(null==s)return i;for(let r=0;rs.abort()),n={signal:s.signal,query:{token:this.apiKey}},a=this.requester.request(e,t,n),o={response:a,abortController:s,abortHandle:r};return this.activeRequests.add(o),Object(h["c"])(a,()=>{var e;o.abortController=null,null==(e=o.abortHandle)||e.remove(),o.abortHandle=null,this.activeRequests.delete(o)}),a}cancelAll(){this.activeRequests.forEach(e=>{var t,i;null==(t=e.abortController)||t.abort(),e.abortController=null,null==(i=e.abortHandle)||i.remove()}),this.activeRequests.clear()}}var oe=i("0b2d"),de=i("7577"),le=i("f694"),ce=i("d359"),he=i("f895"),ue=i("2e0f"),be=i("0eb9"),fe=i("e9d6");const ge=1e5;class me{constructor(e,t,i,s,r,n,a,o={}){this._indexSR=e,this._renderCoordsHelper=t,this.clippingArea=r,this._elevationProvider=n,this._options=o,this._frustum=Object(ce["f"])(),this._useFrustumCulling=!1,this._poi=Object(oe["f"])(),this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmp1=Object(oe["f"])(),this._tmp2=Object(oe["f"])(),this._tmp3=Object(oe["f"])(),this._tmp0=Object(oe["f"])(),this._screenspaceErrorBias=o.screenspaceErrorBias||1,this._progressiveLoadFactor=o.progressiveLoadFactor||1,this.updateCamera(i,s),this.engineSR=this._renderCoordsHelper.spatialReference,this.updateElevationInfo(a),this._tmpPoint=Object(p["j"])(0,0,0,e)}updateElevationInfo(e){null!=e?(this._elevationContext=be["a"].fromElevationInfo(e),this._elevationContext.updateFeatureExpressionInfoContext(Object(fe["c"])(Object(fe["f"])(e,!1)))):this._elevationContext=null}updateCamera(e,t){this._useFrustumCulling=t,t&&Object(ce["h"])(e.viewMatrix,e.projectionMatrix,this._frustum),this._screenSizeFactor=1/(e.perScreenPixelRatio/2),this._camPos=e.eye,this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this.clippingArea=e}getRenderMbs(e){const t=e.renderMbs;return t[3]<0&&(Object(de["c"])(t,e.mbs),this._elevationContext&&t[3]=2e5){const e=Object(C["l"])(this._tmp1,l,u);let t=Object(C["j"])(e,r)/Object(C["r"])(e);t<.08&&(t=1e-4),b/=t}return b}}_getDistance(e,t){return this.engineSR===Object(le["g"])(this.engineSR)?this._getDistanceGlobeMode(e,t):this._getDistancePlanarMode(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(e.lodMetric===I["b"].None)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case I["b"].ScreenSpaceRelative:{const i=this.getRenderMbs(e),s=this._getDistance(this._camPos,i),r=2*s/this._screenSizeFactor,n=s+i[3];return this._updateMinMaxDistance(n),e.maxError*t<=r}case I["b"].MaxScreenThreshold:{let i=this._screenSpaceDiameterMbs(e,e.mbs[3]*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),ie.maxError*t}return!1}distToPOI(e){const t=this.getRenderMbs(e);return Object(C["o"])(t,this._poi)-t[3]}distCameraToPOI(){return Object(C["o"])(this._camPos,this._poi)}}var _e=i("4b49"),pe=i("2aa2"),ye=i("5e70");const Oe=o["a"].getLogger("esri.layers.graphics.controllers.I3SOnDemandController"),je=100,ve=2,xe=1e4,Ce=1e-4,we=1.2,Ie=500,Ne=1.5;let Me=class extends(Object(c["b"])(r["a"])){constructor(e){super(e),this.screenSizeFactor=0,this.featureTarget=5e4,this.fixedFeatureTarget=!1,this.updating=!0,this.updatingProgress=1,this.leavesReached=!1,this.scaleVisibilityEnabled=!0,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._newLoadingNodes=new l["a"]({deallocator:null}),this._loadedNodeScales=new Map,this._modificationsNodeFilteringArray=new l["a"],this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._handles=new n["a"],this._idleQueue=new y["a"],this._elevationUpdateNodes=new l["a"]({deallocator:null}),this._errorCount=0}get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store.lodType}get isGraphics3D(){return"points"===this.layer.profile}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(this.layer.version.major<2||!Object(a["a"])("enable-feature:point-base-layer"))}get indexStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(pe["a"].I3S_INDEX);return new ae(e,this.layer.apiKey)}get dataStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(pe["a"].I3S_DATA);return new ae(e,this.layer.apiKey)}get crsVertex(){return Object(N["s"])(this.layer)}get crsIndex(){return Object(N["q"])(this.layer)}get rootNodeVisible(){if(Object(d["k"])(this._index)){const e=this._index.rootNode;if(Object(d["k"])(e))return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0}get index(){return this._index}initialize(){this._disableMemCache=!this.layerView.loadCachedGPUData||!this.layerView.addCachedGPUData,this._lodHandling=new Q(this.layerView);const e=this.layerView.i3slayer;this.layer=e,this._defaultGeometrySchema=e.store.defaultGeometrySchema,this.disableIDBCache=Object(a["a"])("disable-feature:idb-cache"),"fields"in e&&(this._fields=e.fields,this._attributeStorageInfo=e.attributeStorageInfo),this.addResolvingPromise(Promise.all([this.layer.indexInfo,this.layer.when(),this.layerView.when()]).then(([t])=>{var i;if(this.destroyed||!this.layerView||this.layerView.destroyed)return;const s=this.layerView.view;this._setClippingArea(s.clippingArea);const r=this.layerView.view.resourceController;this._handles.add([Object(u["e"])(()=>{var e,t;return null==s||null==(e=s.pointsOfInterest)||null==(t=e.focus)?void 0:t.renderLocation},e=>this._pointOfInterestChanged(e),u["a"]),r.memoryController.events.on("quality-changed",()=>this._setCameraDirty()),Object(u["e"])(()=>{var e;return null==(e=this.layerView)?void 0:e.suspended},e=>{const t=e?()=>this._updateViewData():()=>this._updateIdleState(!0),i=e?()=>{}:()=>this._updateIdleState(!1);this._idleStateCallbacks?(e&&this.cancelNodeLoading(),this.restartNodeLoading(),this._idleStateCallbacks.idleBegin=t,this._idleStateCallbacks.idleEnd=i):this._idleStateCallbacks=r.scheduler.registerIdleStateCallbacks(t,i)},u["a"]),x(this.layerView.view.resourceController.scheduler,{update:(e,t)=>this._frame(e,t),needsUpdate:()=>this.updating}),this.watch("uncompressedTextureDownsamplingEnabled",()=>this.restartNodeLoading()),this.watch(["featureTarget","fixedFeatureTarget"],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),s.state.watch("contentCamera",()=>this._setCameraDirty()),this.layer.watch("elevationInfo",()=>this._elevationInfoChanged()),this.layer.watch("effectiveScaleRange",()=>this._scaleBoundsChanged()),this.layerView.watch("lodFactor",()=>this._setCameraDirty()),this.layerView.watch("availableFields?",()=>this._requiredFieldsChange()),this.layerView.watch("holeFilling",e=>Object(d["k"])(this._index)&&(this._index.holeFilling=e))]),this._updateScaleHandles(),this._viewportQueries=new me(this.crsIndex,s.renderCoordsHelper,s.state.contentCamera,!s.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,s.elevationProvider,this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this.lod,angleDependentLoD:this.lod<.5}),this._index=new D(e,t,this.indexStreamController,this._viewportQueries,Oe,this.layerView.holeFilling,e=>this.layerView.isNodeLoaded(e),e=>this.layerView.isNodeReloading(e),e=>this._shouldLoadNode(e),e=>this._enableFromGPUCache(e,I["g"].Leaf),e=>this._needsUpdate(e),()=>!this.indexStreamController.busy,e=>this.layerView.computeVisibilityObb?this.layerView.computeVisibilityObb(e):null,null!=(i=this.layerView)&&i.computeNodeFiltering?e=>this.layerView.computeNodeFiltering(e):void 0),this._index.imModificationsChanged(!!this.layerView.hasModifications),this._startNodeLoading()})),this._tmpPoint=Object(p["j"])(0,0,0,this.crsIndex)}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;Object(d["k"])(t)&&i&&i.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll(e=>{const i=t.getNode(e);Object(d["k"])(i)&&this._modificationsNodeFilteringArray.push(i)}),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._idleStateCallbacks&&(this._isIdle=!1,this._idleStateCallbacks.remove(),this._idleStateCallbacks=null),this._handles.destroy(),this._nodeLoader=null,Se.prune(),Object(d["k"])(De)&&(De.hide(),De=null)}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map(i=>{const s=Pe(e,i),r=Pe(t,i);return s>=0&&r>=0?{index:s,name:t[r].name,field:t[r],attributeStorageInfo:e[s]}:null}).filter(e=>null!=e&&e.name!==i)}_requiredFieldsChange(){const e=this._getRequiredAttributes();Ee(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=Object(_["l"])();Object(_e["b"])(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){Object(d["k"])(this._viewportQueries)&&(this._viewportQueries.setPointOfInterest(e),Object(d["k"])(this._index)&&(this._index.progressiveLoadPenalty=Fe.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate()))}updateClippingArea(e){this._setClippingArea(e),Object(d["k"])(this._viewportQueries)&&Object(d["k"])(this._index)&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this.notifyChange("rootNodeVisible"),this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}updateElevationChanged(e,t){const i=this._index;if(Object(d["j"])(i))return;const s=i.rootNode;if(Object(d["j"])(s))return;const r=this._elevationUpdateNodes;r.clear(),Object(N["m"])(e,t,s,this.crsIndex,i,e=>r.push(e.index)),r.forAll(e=>{i.invalidateBoundingVolumeCache(e),e===s.index&&this.notifyChange("rootNodeVisible")}),r.length&&this.restartNodeLoading()}getParentIndex(e){return Object(d["k"])(this._index)&&this._index.getParentIndex(e)}_elevationInfoChanged(){Object(d["k"])(this._index)&&this._index.updateElevationInfo(this.layer.elevationInfo),this._setCameraDirty()}_updateScaleHandles(){const e="scale-bounds";this._handles.remove(e),this.areScaleBoundsActive&&this._handles.add(this.layerView.view.basemapTerrain.on("scale-change",e=>this._scaleUpdateHandler(e)),e)}_scaleBoundsChanged(){this.areScaleBoundsActive||this._loadedNodeScales.clear(),this._updateScaleHandles(),this._setCameraDirty()}_scaleUpdateHandler(e){this._updateScaleInBoundingRect(e.extent,e.spatialReference),this._setCameraDirty()}_updateScaleInBoundingRect(e,t){const i=this._index;if(Object(d["j"])(i))return;const s=i.rootNode;!Object(d["j"])(s)&&Object(m["n"])(e,t,Te,this.crsIndex)&&this._loadedNodeScales.forEach((e,t)=>{const s=i.getNode(t);Object(d["k"])(s)&&Object(_["y"])(Te,s.mbs)&&this._loadedNodeScales.set(t,this._computeScale(s))})}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateUpdating()}schedule(e,t){return this._idleQueue.push(e,t)}reschedule(e,t){return this._idleQueue.unshift(e,t)}get isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get areScaleBoundsActive(){const{minScale:e,maxScale:t}=Object(ye["a"])(this.layer);return this.scaleVisibilityEnabled&&(e>0||t>0)}get unloadedMemoryEstimate(){return Object(d["j"])(this._index)||this.layerView.suspended?0:this._index.getUnloadedMemoryEstimate()*this.lodDropFactor}get indexDepth(){return Object(d["k"])(this._index)?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData||(this._disableMemCache=!0),this._disableMemCache=e}_frame(e,t){return this.layerView.suspended?(this._updateViewData(),this._evaluateUpdating(),-1/0):!this.layerView.visible||Object(d["j"])(this._index)?-1/0:(this._processLogError(e,t),this._index.getPriority())}_processLogError(e,t){try{this._process(e,t)}catch(i){this._errorCount<50?Oe.error("Error during processing: "+i):50===this._errorCount&&Oe.error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null==this._nodeLoader||Object(d["j"])(this._index)||(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this.isIntegratedMesh&&(e.enabled=!1),e.run(()=>this._processIndex(e)),this._updateFeatureLOD(),e.run(()=>this._processCache(e)),this.isIntegratedMesh&&(e.enabled=!0),e.run(()=>this._processNodes(e,t)),this._idleQueue.runTask(e),e.run(()=>this._prefetchIndex()),t.numIndexLoading+=this._index.getIndexLoading(),t.numNodesLoading+=this._downloadingCount,e.run(()=>this._lodHandling.lodGlobalHandling(e)),this._evaluateUpdating())}_processIndex(e){if(Object(d["j"])(this._index))return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update([...this._loadingNodes.keys()],e,e=>this.updateNodeModificationStatus(e)),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));const t=this._index.featureEstimate.leavesReached;this._index.isLoading()||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(Object(d["j"])(this._index)||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||Object(d["j"])(this._index)||Object(d["j"])(this._viewportQueries))return;const e=!this._index.isLoading(),t=this.featureTarget*this.baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.getIndexMissing()>Ie){if(this._featureLOD<=Ce)return;this._featureLOD/=Ne,this._stableFeatureLOD=!1}else if(e&&i.estimate=xe||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this.lod,r=this._index.checkFeatureTarget(t,s);r!==s&&(this._featureLOD=r/this.baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*we||e&&i.estimate>t))return;if(this._featureLOD<=Ce)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(xe,Math.max(Ce,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this.lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(Object(d["j"])(t))return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);Object(d["k"])(s)&&!this.layerView.isNodeLoaded(s.index)&&this._isNodeInScaleBounds(s);s=t.getParent(s.index))if(this._enableFromGPUCache(s,I["g"].Hole)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(Object(d["j"])(this._index))return!1;let i=(this._isIdle?je:ve)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());Object(d["k"])(t)&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const r=this._index.getNode(s.add.back());if(Object(d["j"])(r)||r.cacheState!==I["a"].Cached&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(r),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach(e=>e.abort()),this._loadingNodes.clear(),this._updatingNodes.forEach(e=>e.abort()),this._updatingNodes.clear()}_cancelNode(e){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=ve)&&this._downloadingCount0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.running||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}this.updating=e,this.updatingProgress=t}_updateViewData(){if(!this._cameraDirty||Object(d["j"])(this._index)||Object(d["j"])(this._viewportQueries))return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this.screenSizeFactor=1/(t.perScreenPixelRatio/2),this._viewportQueries.updateCamera(t,!i||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this.lod),this._index.invalidateVisibilityCache(),this._index.progressiveLoadPenalty=Fe.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.resourceController.memoryController.memoryFactor<1?1:this.layerView.progressiveLoadFactor}get lod(){return this._featureLOD*this.baseLOD}get baseLOD(){const e=this.layerView.lodFactor,t=this.layerView.view.resourceController.memoryController.memoryFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*t}get lodDropFactor(){if(this.fixedFeatureTarget)return 1;const e=this.layerView.view.resourceController.memoryController;return(Math.min(e.memoryFactor,.5)-e.minQuality)/(.5-e.minQuality)}isGeometryVisible(e){return Object(d["k"])(this._index)&&this._index.isGeometryVisible(e.index)}updateVisibility(e){Object(d["k"])(this._index)&&this._index.invalidateNodeVisibilityCache(e)}updateBoundingVolume(e){Object(d["k"])(this._index)&&this._index.invalidateBoundingVolumeCache(e)}invalidateGeometryVisibility(e){Object(d["k"])(this._index)&&this._index.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){Object(d["k"])(this._index)&&this._index.invalidateVisibilityObbs()}modificationsChanged(){Object(d["k"])(this._index)&&this._index.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e))&&!(!Object(d["k"])(this._index)||!this._index.isGeometryVisible(e.index))&&this._isNodeInScaleBounds(e)}_shouldDropNode(e){if(Object(d["j"])(this._viewportQueries))return!1;const t=this.lodDropFactor;return!(t>=1||!this._lodHandling.hasNoVisibleChildren(e))&&Math.abs(this._viewportQueries.calcCameraDistanceToCenter(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||Object(d["j"])(e)||Object(d["j"])(this._viewportQueries))return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,uncompressedTextureDownsamplingEnabled:this.layerView.uncompressedTextureDownsamplingEnabled,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new ee(this.layer,this.dataStreamController,Oe,this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading(e=>this._isNodeInScaleBounds(e),(e,t)=>this._removeNodes(e,t,Ae.fadeout),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateUpdating()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexStreamController.cancelAll(),this.dataStreamController.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateUpdating())}_removeInvisibleNodes(e){const t=this._index;if(Object(d["j"])(t)||Object(d["j"])(this._viewportQueries))return!1;Se.clear(),this.layerView.getLoadedNodeIndices(Se);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return Se.filterInPlace(e=>{const i=t.getNode(e);return Object(d["j"])(i)||!t.isGeometryVisible(e)||s(i)||!this._isNodeInScaleBounds(i)}),Se.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(Se,e,Ae.pop),!(i&&this.lodDropFactor<1)&&(0===Se.length||(Se.clear(),!1))}markNodeToRemove(e){Se.push(e)}removeMarkedNodes(){this._removeNodes(Se,O["e"],Ae.pop)}_removeNodes(e,t,i){const s=e.length;if(0!==s&&!t.done){for(Object(d["k"])(this._index)&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),r=this._index;i===Ae.fadeout&&this.layerView.nodeFadeoutEnabled&&Object(d["k"])(r)&&r.isGeometryVisible(s)?this.layerView.fadeNode(s,z["a"].FadeOut,!0):this.layerView.removeNode(s),t.madeProgress()}if(this._loadedNodeScales.size>0)for(let t=e.length;tthis.schedule(()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:i},t.signal),t.signal)).catch(i=>{if(!Object(h["m"])(i))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)}).catch(()=>{}).then(()=>{this._updatingNodes.delete(e.index),this._evaluateUpdating()}),this._evaluateUpdating()}_loadNode(e){if(this._loadingNodes.has(e.index))return void Oe.error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateUpdating(),this._loadAndAddNode(e,t.signal).then(i=>{i&&Object(d["k"])(this._index)&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())}).catch(e=>{if(!Object(h["m"])(e))throw e}).finally(()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateUpdating()})}_loadAndAddNode(e,t){return e.cacheState===I["a"].Uncached?this._loadUncached(e,t).then(()=>!1):this._loadCached(e,t).then(t=>!t&&(e.cacheState=I["a"].Uncached,!0)).catch(t=>!Object(h["m"])(t)&&(e.cacheState=I["a"].Uncached,!0))}_enableFromGPUCache(e,t){if(this._disableMemCache||Object(d["j"])(this._index))return!1;if(t===I["g"].Hole&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e);return Object(d["k"])(t)&&Object(d["k"])(t.attributeInfo)&&Ee(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){Object(d["k"])(this._index)&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}_loadCached(e,t){if(this._enableFromGPUCache(e,I["g"].Leaf))return Promise.resolve(!0);const i=this.layerView;return!this.disableIDBCache&&i.loadCachedNodeData&&i.addCachedNodeData?this.schedule(()=>i.loadCachedNodeData(e,t,(t,i)=>this._nodeLoader.loadTextures(e,t,i)),t).then(s=>{if(Object(d["j"])(s))return!1;const r=this._requiredAttributes;return this.reschedule(()=>this._nodeLoader.loadAttributes(e,r,t),t).then(n=>this.reschedule(()=>i.addCachedNodeData(e,s,{loadedAttributes:r,attributeData:n},t),t)).then(()=>(this._nodeAdded(),!0))}):Promise.resolve(!1)}_loadUncached(e,t){return this._downloadingCount++,this._nodeLoader.loadNodeData(e,t).catch(e=>{throw this._downloadingCount--,e}).then(i=>(this._downloadingCount--,this.schedule(()=>this.layerView.addNode(e,i,t),t))).then(()=>{this._nodeAdded(),e.cacheState=I["a"].Cached}).catch(t=>{if(!Object(h["m"])(t))throw Oe.error("#loadNodeData()",this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,Object(d["k"])(this._index)&&this._index.requestUpdate(),t})}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateUpdating(),e&&this._index&&Object(d["k"])(this._index)&&this._index.resetFailedNodes())}_getScale(e){if(this._loadedNodeScales.has(e.index))return this._loadedNodeScales.get(e.index);const t=this._computeScale(e);return this.layerView.isNodeLoaded(e.index)&&this._loadedNodeScales.set(e.index,t),t}_computeScale(e){this._tmpPoint.x=e.mbs[0],this._tmpPoint.y=e.mbs[1],this._tmpPoint.z=e.mbs[2];const t=e.mbs[3];return this.layerView.view.basemapTerrain.getSphereScale(this._tmpPoint,t)}_isNodeInScaleBounds(e){if(!this.areScaleBoundsActive)return!0;const t=this._getScale(e),{minScale:i,maxScale:s}=Object(ye["a"])(this.layer);return Object(ye["e"])(t,i,s)}updateStats(e){e.index=Object(d["k"])(this._index)?this._index.size:0,this.isGraphics3D&&(e.detail=this._featureLOD,e.target=this.featureTarget*this.baseLOD),Object(d["k"])(this._index)&&this._index.updateStats(e)}get test(){const e=this;return{index:this._index,set disableUpdates(t){e._updatesDisabled=t,t?e.cancelNodeLoading():e.requestUpdate()},set disableIDBCache(t){e.disableIDBCache=t},set ignoreServiceObb(t){Object(d["k"])(e._index)&&(e._index.ignoreServiceObb=t)},shouldLoadNode:t=>e._shouldLoadNode(t)}}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating(),Object(d["k"])(this._index)&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;Object(d["k"])(t)&&t.layerFilterChanged(e),this.requestUpdate()}};Object(s["a"])([Object(b["b"])({readOnly:!0})],Me.prototype,"isMeshPyramid",null),Object(s["a"])([Object(b["b"])({readOnly:!0})],Me.prototype,"isGraphics3D",null),Object(s["a"])([Object(b["b"])({readOnly:!0})],Me.prototype,"useMaximumNumberOfFeatures",null),Object(s["a"])([Object(b["b"])({readOnly:!0})],Me.prototype,"indexStreamController",null),Object(s["a"])([Object(b["b"])({readOnly:!0})],Me.prototype,"dataStreamController",null),Object(s["a"])([Object(b["b"])({readOnly:!0})],Me.prototype,"crsVertex",null),Object(s["a"])([Object(b["b"])({readOnly:!0})],Me.prototype,"crsIndex",null),Object(s["a"])([Object(b["b"])()],Me.prototype,"screenSizeFactor",void 0),Object(s["a"])([Object(b["b"])()],Me.prototype,"featureTarget",void 0),Object(s["a"])([Object(b["b"])()],Me.prototype,"fixedFeatureTarget",void 0),Object(s["a"])([Object(b["b"])()],Me.prototype,"layerView",void 0),Object(s["a"])([Object(b["b"])()],Me.prototype,"layer",void 0),Object(s["a"])([Object(b["b"])({})],Me.prototype,"updating",void 0),Object(s["a"])([Object(b["b"])({})],Me.prototype,"updatingProgress",void 0),Object(s["a"])([Object(b["b"])({readOnly:!0})],Me.prototype,"leavesReached",void 0),Object(s["a"])([Object(b["b"])({constructOnly:!0})],Me.prototype,"scaleVisibilityEnabled",void 0),Object(s["a"])([Object(b["b"])({readOnly:!0,dependsOn:[]})],Me.prototype,"rootNodeVisible",null),Me=Object(s["a"])([Object(g["a"])("esri.layers.graphics.controllers.I3SOnDemandController")],Me);const Se=new l["a"]({deallocator:null});let De;function Ee(e,t){return Object(d["k"])(e)&&e.length===t.length&&e.every(e=>Pe(t,e.name)>=0)}function Pe(e,t){const i=t.toLowerCase();for(let s=0;sthis._handleChanges(e))}destroy(){this._handle.remove()}get length(){return this._active.length}toArray(){return this._active.toArray()}find(e){return this._active.find(e)}forEach(e){this._active.forEach(e)}addMany(e){this._all.addMany(e)}removeManyByObjectId(e){this._all.removeManyByObjectId(e)}_handleChanges(e){let t=e.removed;if(this._pending.size>0){t=new Array;for(const i of e.removed)this._pending.delete(i.objectId)||t.push(i)}let i=this._limit-this._active.length+t.length;i{W.sample()&&(t.push(e),this._pending.set(e.objectId,e))}),i=this._limit-this._active.length+t.length);let s=e.added;if(i0&&this._pending.size>0&&(W.reset(r/this._pending.size),this._pending.forEach(e=>{W.sample()&&(s.push(e),this._pending.delete(e.objectId))})),this._active.addAndRemove(s,t)}}class Y{constructor(){this.percentage=1,this.last=-1,this.index=0}reset(e){this.percentage=e,this.last=-1}sample(){const e=Math.floor(this.index*this.percentage);return++this.index,e!==this.last&&(this.last=e,!0)}}const W=new Y;class J{constructor(e){this._parent=e,this._map=new Map}get length(){return this._map.size}forEach(e){this._map.forEach(t=>e(t))}find(e){let t;return Object(c["c"])(this._map,i=>!!e(i)&&(t=i,!0)),t}toArray(){return[...this._map.values()]}addAndRemove(e,t){for(const i of e)this._map.set(i.objectId,i);for(const i of t)this._map.delete(i.objectId);(e.length>0||t.length>0)&&this._parent.emit("change",{added:e,removed:t})}removeMany(e){for(const t of e)this._map.delete(t.objectId);e.length>0&&this._parent.emit("change",{added:[],removed:e})}}var Z=i("b7c2"),ee=i("7533");let te=class extends U["a"]{constructor(e){super(e),this.loadedGraphics=new X(5e4),this.slicePlaneEnabled=!1,this._renderingInfo={symbol:new ee["a"]},this._handles=new G["a"],this._graphicsByNode=new Map,this._scaleVisibility=null}initialize(){this._graphicsCore=new q["a"]({owner:this,layer:this.layer,preferredUpdatePolicy:Z["m"].ASYNC,elevationFeatureExpressionEnabled:!1,graphicSymbolSupported:!1,getRenderingInfoWithoutRenderer:!0,hasZ:!0,hasM:!1});const e=this.view.basemapTerrain;this._scaleVisibility=new z["a"]({layerScaleEnabled:!1}),this._scaleVisibility.setup(this,this.layer,(e,t,i)=>this._graphicsCore.spatialIndex.queryGraphicUIDsInExtent(e,t,i),this._graphicsCore,e);const t=this.view.labeler.addGraphicsOwner(this._graphicsCore,this._scaleVisibility,{emptySymbolLabelSupported:!0,elevationInfoOverride:{mode:"absolute-height",offset:0},disablePlacement:{logEntityDescription:"3D Object Scene Layer features"}}),i=this.view.deconflictor.addGraphicsOwner(this._graphicsCore);this._graphicsCore.setup({labeler:t,deconflictor:i,scaleVisibility:this._scaleVisibility}).then(()=>{this._graphicsCore.startCreateGraphics()}).catch(()=>{}),this._handles.add([this.layer.watch("labelingInfo",(e,t)=>{Object(B["a"])(e,t)&&this._graphicsCore.updateLabelingInfo()})])}destroy(){this._handles&&(this._handles.destroy(),this._handles=null),null!=this._scaleVisibility&&(this._scaleVisibility.destroy(),this._scaleVisibility=null),null!=this._graphicsCore&&(this._graphicsCore.destroy(),this._graphicsCore=null),this.loadedGraphics.destroy(),this.view=null}addNodeMeta(e,t){let i=0;const s=e.filteredIds,r=e.featureIds.map((r,a)=>{Object(Q["b"])(a,this.collection,e.objectHandle,se);const o=Object(H["j"])(0,0,0,this.view.spatialReference);this.view.renderCoordsHelper.fromRenderCoords(se,o);const d=t(a,e);let l=!1;return Object(h["j"])(s)?l=!0:ie;if(t.spatialReference){if(!Object(S["b"])(t.spatialReference,i)){oe.warn("Can't project modification polygon into layer spatial reference, ignoring modification");continue}d=e=>(Object(S["y"])(e,t.spatialReference,ce,i),ce)}else t.hasZ||(ce[2]=0,d=e=>(ce[0]=e[0],ce[1]=e[1],ce));o=o||e===ae["b"].Outside,le.push(e),le.push(t.rings.length);for(const i of t.rings){le.push(i.length);for(const e of i){const t=d(e);le.push(t[0]),le.push(t[1]),le.push(t[2]),s=Math.min(s,t[0]),r=Math.min(r,t[1]),n=Math.max(n,t[0]),a=Math.max(a,t[1])}}}if(Object(h["k"])(e))if(o){const t=1e-4;le.push(ae["b"].Inside),le.push(2),le.push(4),le.push(s-t),le.push(r-t),le.push(0),le.push(n+t),le.push(r-t),le.push(0),le.push(n+t),le.push(a+t),le.push(0),le.push(s-t),le.push(a+t),le.push(0),le.push(4),le.push(e[0]),le.push(e[1]),le.push(0),le.push(e[2]),le.push(e[1]),le.push(0),le.push(e[2]),le.push(e[3]),le.push(0),le.push(e[0]),le.push(e[3]),le.push(0)}else le.push(ae["b"].Outside),le.push(1),le.push(4),le.push(e[0]),le.push(e[1]),le.push(0),le.push(e[2]),le.push(e[1]),le.push(0),le.push(e[2]),le.push(e[3]),le.push(0),le.push(e[0]),le.push(e[3]),le.push(0);le.push(ae["b"].Finished);const d=new Float64Array(le.length);for(let l=0;lthis._releaseSet(e)),this.highlights=null}acquireSet(){const e=new me;this.highlights.push(e);const t={remove:()=>{this._releaseSet(e),Object(O["k"])(this.highlights,e)},pause:()=>{this._releaseSet(e),e.paused=!0},resume:()=>{e.paused=!1,this._initializeSet(e)}};return{set:e,handle:t}}setFeatureIds(e,t){t.forEach(t=>e.ids.add(t)),this._initializeSet(e)}_initializeSet(e){this.forAllFeatures((t,i,s)=>(e.ids.has(t)&&this.collection.addComponentHighlight(s.objectHandle,i),ue["a"].CONTINUE))}_releaseSet(e){this.forAllFeatures((t,i,s)=>(e.ids.has(t)&&this.collection.removeComponentHighlight(s.objectHandle,i),ue["a"].CONTINUE))}objectCreated(e){this.highlights.forEach(t=>{t.paused||this.forAllFeaturesOfNode(e,(i,s)=>(t.ids.has(i)&&this.collection.addComponentHighlight(e.objectHandle,s),ue["a"].CONTINUE))})}objectDeleted(e){this.collection.clearHighlights(e.objectHandle)}}var pe=i("d5bc"),ye=i("673a");class Oe{constructor(){this.lodCrossfadeSignedDuration=0}}class je{constructor(e){this.view=e,this._preRenderFrameTaskHandle=null,this._currentFrameStartTime=null,this._numFadingNodes=0}get updating(){return this._numFadingNodes>0}stopNodeFading(e){null!=e.lodCrossfadeProgress&&(this._numFadingNodes--,e.lodCrossfadeProgress=null,0===this._numFadingNodes&&(null!=this._preRenderFrameTaskHandle&&(this._preRenderFrameTaskHandle=Object(h["s"])(this._preRenderFrameTaskHandle)),this.view.notifyLODUpdate(),this.view.notifyUpdate()))}_startNodeFading(e,t,i){0===this._numFadingNodes&&(this._preRenderFrameTaskHandle=Object(g["a"])({preRender:e=>this._updateAllNodeFading(e)}),this.view.notifyLODUpdate()),null==e.lodCrossfadeProgress&&(this._numFadingNodes++,this.view.notifyUpdate()),e.lodCrossfadeSignedDuration=i,e.lodCrossfadeProgress=t}_updateAllNodeFading(e){const t=this.view.nodeCrossfadingEnabled;this.view.foreachCrossfadeNode((i,s)=>{if(Object(h["k"])(s)&&Object(h["k"])(s.lodCrossfadeProgress)){const r=s.lodCrossfadeSignedDuration,n=r>0?this.view.fullOpacity:0,a=e.deltaTime/r,o=s.lodCrossfadeProgress+Math.abs(a),d=!t||o>=1||0===r,l=n-(d?0:r>0?1:-1)*(1-o);d?(this.stopNodeFading(s),r<0&&this.view.markNodeToRemove(i)):s.lodCrossfadeProgress=o,this.view.setNodeOpacityByIndex(i,l)}}),this.view.removeMarkedNodes()}stopAllNodeFading(){this.view.foreachCrossfadeNode((e,t)=>{if(Object(h["k"])(t)&&Object(h["k"])(t.lodCrossfadeProgress)){this.stopNodeFading(t);const i=t.lodCrossfadeSignedDuration;i<0&&this.view.markNodeToRemove(e);const s=i>0?this.view.fullOpacity:0;this.view.setNodeOpacityByIndex(e,s)}}),this.view.removeMarkedNodes()}fadeNode(e,t,i,s){null==this._currentFrameStartTime&&(this._currentFrameStartTime=Date.now());const r=this.view,n=r.nodeCrossfadingEnabled,a=i===ye["a"].FadeIn?r.fullOpacity:0,o=n?s?i===ye["a"].FadeIn?r.lodCrossfadeinDuration:r.lodCrossfadeoutDuration:r.lodCrossfadeUncoveredDuration:0,d=this.view.getNodeOpacityByIndex(e);if(n&&d!==a&&o>0){const e=1-Math.abs(a-d);this._startNodeFading(t,e,ve(i)*o)}else this.stopNodeFading(t),this.view.setNodeOpacityByIndex(e,a),i===ye["a"].FadeOut&&this.view.removeNode(e)}isNodeFullyFadedIn(e){const t=this.view.getNodeCrossfadeMetaData(e);return Object(h["j"])(t)||null==t.lodCrossfadeProgress&&this.view.getNodeOpacityByIndex(e)===this.view.fullOpacity}}function ve(e){return e===ye["a"].FadeIn?1:-1}var xe=i("9250"),Ce=i("1942");const we=Object(E["n"])(),Ie=Object(w["d"])(),Ne=Object(N["f"])(),Me=Object(N["f"])(),Se=Object(N["f"])(),De=l["a"].getLogger("esri.views.3d.layers.i3s.I3SElevationProvider");let Ee=class extends($["a"].EventedMixin(U["a"])){constructor(e){super(e),this.tmpEvent={spatialReference:null,extent:we,context:"scene"}}initialize(){this.view=this.layerView.view,this.renderCoordsHelper=this.view.renderCoordsHelper,this.intersector=Object(xe["b"])(this.view.state.viewingMode),this.intersector.options.store=Ce["c"].MIN;const e=this.layerView.i3slayer.fullExtent;Object(h["j"])(e)?De.error("I3SElevationProvider expected fullExtent on I3SLayer."):(this.zmin=e.zmin,this.zmax=e.zmax),this.tmpEvent.context=this.intersectionHandler.isGround?"ground":"scene"}getElevation(e,t,i,s){if(Ne[0]=e,Ne[1]=t,Ne[2]=i,!this.renderCoordsHelper.toRenderCoords(Ne,s,Ne))return De.error("could not project point to compute elevation"),null;const r=this.layerView.elevationOffset,n=this.zmin+r,a=this.zmax+r;return this.renderCoordsHelper.setAltitude(Me,a,Ne),this.renderCoordsHelper.setAltitude(Se,n,Ne),this.intersector.reset(Me,Se,null),this.intersectionHandler.intersect(this.intersector,null,Me,Se),this.intersector.results.min.getIntersectionPoint(Ne)?this.renderCoordsHelper.getAltitude(Ne):null}layerChanged(){this.spatialReference&&(this.tmpEvent.extent=this._computeLayerExtent(),this.tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this.tmpEvent))}objectChanged(e){this.spatialReference&&(this.tmpEvent.extent=this._computeObjectExtent(e),this.tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this.tmpEvent))}_computeObjectExtent(e){return Object(E["n"])(we),this._expandExtent(e,we),we}_computeLayerExtent(){Object(E["n"])(we);for(const e of this.layerView.getVisibleNodes())this._expandExtent(e,we);return we}_expandExtent(e,t){const i=e.visibilityObb||e.serviceObbInRenderSR;if(Object(h["k"])(i)){Object(C["l"])(Ie,i.quaternion),Ie[12]=i.center[0],Ie[13]=i.center[1],Ie[14]=i.center[2];for(let e=0;e<8;++e)Ne[0]=1&e?i.halfSize[0]:-i.halfSize[0],Ne[1]=2&e?i.halfSize[1]:-i.halfSize[1],Ne[2]=4&e?i.halfSize[2]:-i.halfSize[2],Object(I["s"])(Ne,Ne,Ie),this.renderCoordsHelper.fromRenderCoords(Ne,Ne,this.spatialReference),Object(E["p"])(t,Ne,t)}else{const i=e.renderMbs[3],s=Object(I["m"])(Me,e.renderMbs);s[0]-=i,s[1]-=i,s[2]-=i;const r=Object(I["m"])(Se,e.renderMbs);r[0]+=i,r[1]+=i,r[2]+=i;for(let e=0;e<8;++e)Ne[0]=1&e?s[0]:r[0],Ne[1]=2&e?s[1]:r[1],Ne[2]=4&e?s[2]:r[2],this.renderCoordsHelper.fromRenderCoords(Ne,Ne,this.spatialReference),Object(E["p"])(t,Ne,t)}}};Object(s["a"])([Object(y["b"])({constructOnly:!0})],Ee.prototype,"layerView",void 0),Object(s["a"])([Object(y["b"])({constructOnly:!0})],Ee.prototype,"intersectionHandler",void 0),Object(s["a"])([Object(y["b"])()],Ee.prototype,"view",void 0),Object(s["a"])([Object(y["b"])({readOnly:!0,aliasOf:"view.elevationProvider.spatialReference"})],Ee.prototype,"spatialReference",void 0),Ee=Object(s["a"])([Object(j["a"])("esri.views.3d.layers.i3s.I3SElevationProvider")],Ee);const Pe=Ee;var Fe=i("cee3"),Te=i("89bf");class Ae{constructor(e){this.type=Ce["b"].I3S,this.layerUid=e.layerUid,this.sublayerUid=e.sublayerUid,this.collection=e.collection,this.traverseNodeHierarchy=e.traverseNodeHierarchy,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isGround=e.isGround}intersect(e,t,i,s){const r=e.results,n=e.options.store===Ce["c"].ALL,a=e.ray.direction,o=e.tolerance;let d=e=>e,l=e=>e;const c=Object(Te["c"])(e.verticalOffset);Object(h["k"])(c)&&(d=e=>c.applyToMbs(e),l=e=>c.applyToObb(e)),this.traverseNodeHierarchy((u,b)=>!(Object(h["k"])(u.serviceObbInRenderSR)&&!Object(Fe["f"])(l(u.serviceObbInRenderSR),i,a,o))&&(!b||Object(h["k"])(u.geometryObb)&&!Object(Fe["f"])(l(u.geometryObb),i,a,o)||!Object(h["k"])(u.serviceObbInRenderSR)&&!ke(d(u.renderMbs),i,a,o)||this.collection.intersect(b,i,s,o,c,(a,o,d,l)=>{if(o>=0){if(null!=t&&!t(i,s,o))return;const c=e=>{const t={layerUid:this.layerUid,sublayerUid:this.sublayerUid,nodeIndex:u.index,componentIndex:a,triangleNr:l};e.set(this.type,t,o,d)};if(this.isGround&&(null==r.ground.dist||or.max.dist)&&c(r.max),n){const t=Object(xe["c"])(e.ray);c(t),e.results.all.push(t)}}}),!0))}}function ke(e,t,i,s=0){const r=e[3]+s,n=t[0]-e[0],a=t[1]-e[1],o=t[2]-e[2],d=i[0],l=i[1],c=i[2],h=d*n+l*a+c*o;return h*h-(d*d+l*l+c*c)*(n*n+a*a+o*o-r*r)>=0}var Re=i("8752"),Le=i("c453"),Ve=i("82de"),Ue=i("ee9c"),Ge=i("ce50");const Be=14;class He{constructor(e,t,i=Be){this._version=i,this._db=null,this._quotaReductionPromise=null,this._gcCounter=0,this._hit=0,this._miss=0,this._destroyed=!1,this.gcFrequency=50,this.maxByteSize=a["a"].GIGABYTES,this.quotaReductionFactor=.2,this._dbName=e,this._storeName=t}init(){return Promise.resolve().then(()=>{const e=indexedDB.open(this._dbName,this._version);return e.onupgradeneeded=t=>{const i=e.result,s=e.transaction,r=i.objectStoreNames.contains(this._storeName)?s.objectStore(this._storeName):i.createObjectStore(this._storeName),n=i.objectStoreNames.contains("last_access")?s.objectStore("last_access"):i.createObjectStore("last_access");n.indexNames.contains("date")||n.createIndex("date","date",{unique:!1}),n.indexNames.contains("byteSize")||n.createIndex("byteSize","byteSize",{unique:!1}),t.oldVersion{this._destroyed?e.close():this._db=e})}destroy(){this._db&&(this._db.close(),this._db=null),this._destroyed=!0}get initialized(){return null!=this._db}getHitRate(){return this._hit/(this._hit+this._miss)}put(e,t){return null==this._db?Promise.reject(new Ge["a"]("indexedb:not-initialized","IndexedDB Cache is not initialized")):(null!=this._quotaReductionPromise?this._quotaReductionPromise:Promise.resolve()).then(()=>this._put(e,t)).catch(i=>{if(i&&"QuotaExceededError"===i.name)return null==this._quotaReductionPromise&&(this._quotaReductionPromise=this._getCacheSize().then(e=>this._removeLeastRecentlyAccessed(t.byteSize+Math.ceil(e*this.quotaReductionFactor))),this._quotaReductionPromise.then(()=>this._quotaReductionPromise=null,()=>this._quotaReductionPromise=null)),this._quotaReductionPromise.then(()=>this._put(e,t));throw i}).then(()=>{this._gcCounter--,this._gcCounter<0&&null!=this._db&&(this._gcCounter=this.gcFrequency,this._getCacheSize().then(e=>this._removeLeastRecentlyAccessed(e-this.maxByteSize)))})}get(e,t){if(null==this._db)return Promise.resolve(null);let i=null;return Promise.resolve().then(()=>{const s=this._db.transaction(this._storeName,"readonly");return i=Object(b["q"])(t,()=>{s.abort()}),ze(s.objectStore(this._storeName).get(e))}).then(t=>(null==t?++this._miss:this._db&&(++this._hit,this._db.transaction("last_access","readwrite").objectStore("last_access").put({date:Date.now(),byteSize:t.byteSize},e)),Object(h["k"])(i)&&i.remove(),t)).catch(()=>(++this._miss,Object(b["v"])(t),Object(h["k"])(i)&&i.remove(),null))}remove(e){return null==this._db?Promise.resolve():Promise.resolve().then(async()=>{const t=this._db.transaction([this._storeName,"last_access"],"readwrite"),i=t.objectStore(this._storeName),s=t.objectStore("last_access"),r=i.delete(e),n=s.delete(e);await Promise.all([ze(r),ze(n),qe(t)])})}_put(e,t){const i=this._db.transaction([this._storeName,"last_access"],"readwrite"),s=i.objectStore(this._storeName),r=i.objectStore("last_access"),n=s.put(t,e),a=r.put({date:Date.now(),byteSize:t.byteSize},e);return Promise.all([ze(n),ze(a),qe(i)])}_removeLeastRecentlyAccessed(e){if(e<=0)return;const t=this._db.transaction([this._storeName,"last_access"],"readwrite"),i=t.objectStore(this._storeName),s=t.objectStore("last_access");let r=0;const n=s.index("date").openCursor(null,"next");return n.onsuccess=()=>{const t=n.result;null!=t&&(null!=t.value.byteSize&&(r+=t.value.byteSize),i.delete(t.primaryKey),s.delete(t.primaryKey),r{const e=s.result;if(!e)return;const t=e.key;null!=t&&(i+=t),e.continue()},qe(e).then(()=>i)}}function qe(e){return new Promise((t,i)=>{e.oncomplete=()=>t(),e.onerror=()=>i(e.error),e.onabort=()=>i(e.error)})}function ze(e){return new Promise((t,i)=>{"done"===e.readyState?null!=e.error?i(e.error):t(e.result):(e.onsuccess=()=>t(e.result),e.onerror=()=>i(e.error))})}var Qe=i("d36d"),$e=i("caf1"),Ke=i("6611"),Xe=i("4b49"),Ye=i("deae"),We=i("2ebb"),Je=i("bff6"),Ze=i("7752"),et=i("dfaf"),tt=i("c15d3"),it=i("dd0e");const st=l["a"].getLogger("esri.views.3d.layers.SceneLayerView3D"),rt=[1,1,1,1];class nt extends Oe{constructor(e,t,i,s,r,n,a){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=n,this.textures=a,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbology=null}}var at;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(at||(at={}));const ot=19,dt=100*a["a"].MEGABYTES,lt=e=>{let t=class extends e{constructor(...e){super(e),this._elevationProvider=null,this._intersectionHandler=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._idbCache=new He("esri-scenelayer-cache","geometries"),this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.filter=null,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._arcade=null,this._tmpAttributeOnlyGraphic=new n["a"](null,null,{}),this._crossfadeHelper=new je(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return Object(Ue["v"])(this._currentRenderer)?this._usePBR()||this._hasLoadedPBRTextures?ge["b"].AllTexturesPBR:ge["b"].AllTextures:this._usePBR()||this._hasLoadedPBRTextures?ge["b"].GeometryTexturesPBR:ge["b"].GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=Object(_["g"])(this.i3slayer.spatialReference),i=Object(V["a"])(e.unit);return Object(h["u"])(e.offset,0)*i/t}return 0}get supportedTextureEncodings(){return Object(Re["f"])(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){var e;const t=null==(e=this.view)?void 0:e.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,i=0==(this.supportedTextureEncodings&ge["a"].DDS_S3TC);return t&&i}initialize(){this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController;if(this.attributeOverrides=new pe["a"](this.i3slayer,e.memoryController),this._worker=new de(t=>e.schedule(t)),this.addResolvingPromise(this._worker.promise),this._worker.setLegacySchema(this.layerUid,this.i3slayer.store.defaultGeometrySchema),Object(Ue["f"])(this.i3slayer),Object(Ue["e"])(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new P["a"]({layerView:this}),this.gpuMemoryEstimate=0,this.texMemoryEstimate=0,this.geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this._highlights=new _e({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,ue["b"].ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._isIntegratedMesh||!this.i3slayer.store.defaultGeometrySchema)this._hasSymbolColors=!1;else{const e=this.i3slayer.store.defaultGeometrySchema.featureAttributes;this._hasSymbolColors=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=this.i3slayer.store.defaultGeometrySchema.vertexAttributes.color&&(null==this.i3slayer.cachedDrawingInfo||!this.i3slayer.cachedDrawingInfo.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderView.ensureEdgeView());const t=this.view.resourceController.memoryController.newCache(this.i3slayer.uid,e=>this._deleteComponentObject(e));this._memCache=t;const s=e=>Object(h["k"])(this._controller.index)&&Object(h["k"])(this._controller.index.rootNode)?this._controller.index.traverse(this._controller.index.rootNode,t=>{const i=t.index,s=this._nodeId2Meta.get(i)||this._nodeId2MetaReloading.get(i);return e(t,Object(h["k"])(s)?s.objectHandle:null)}):()=>{};this._intersectionHandler=new Ae({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:s}),this._elevationProvider=new Pe({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR(),this.updatingHandles.add(()=>this.view.clippingArea,()=>this._clippingAreaChanged(),f["a"]),this.updatingHandles.add(()=>this.fullOpacity,e=>this._opacityChange(e)),this.updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this.updatingHandles.add(()=>this.elevationOffset,(e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()}),this.updatingHandles.add(()=>this.filter,()=>this._filterChange(),f["a"]),this.updatingHandles.add(()=>this.view.qualitySettings.physicallyBasedRenderingEnabled,()=>this._updatePBR());const r=()=>{this._reloadAll(),this.clearMemCache()};this.updatingHandles.add(()=>this.rendererTextureUsage,r),this.updatingHandles.add(()=>this.uncompressedTextureDownsamplingEnabled,r),this.updatingHandles.add(()=>this.suspended,e=>this._suspendedChange(e),f["a"]),this.updatingHandles.add(()=>this.i3slayer.labelsVisible,()=>this._labelingChanged(),f["a"]),this.updatingHandles.add(()=>this.i3slayer.labelingInfo,()=>this._labelingChanged(),f["a"]),this.updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),f["a"]),this.handles.add([Object(p["a"])(Ke["a"],"I3S_TREE_SHOW_TILES",e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;i.e("chunk-71e77862").then(i.bind(null,"4d47")).then(({I3STreeDebugger:t})=>{!this._treeDebugger&&Ke["a"].I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else e||Ke["a"].I3S_TREE_SHOW_TILES||(this._treeDebugger=Object(h["d"])(this._treeDebugger))}),Object(p["a"])(Ke["a"],"I3S_SHOW_MODIFICATIONS",()=>this._showModifications())]),this._cacheKeySuffix=Object(Ue["n"])(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch(e=>st.warn("Failed to initialize IndexedDB cache: "+e))}destroy(){this._clearAddTasks(),this.attributeOverrides=Object(h["d"])(this.attributeOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.i3slayer.uid).then(()=>e.destroy()),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=Object(h["d"])(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=Object(h["d"])(this._labeler),this._treeDebugger=Object(h["d"])(this._treeDebugger),this._controller=Object(h["d"])(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_memEstimateTextureAdded(e){const t=e.estimatedTexMemRequired;return this.gpuMemoryEstimate+=t,this.texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(Object(h["k"])(e)){const t=e.estimatedTexMemRequired;this.gpuMemoryEstimate-=t,this.texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this.gpuMemoryEstimate+=t,this.geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this.gpuMemoryEstimate-=t,this.geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}getUsedMemory(){let e=Object(h["k"])(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach(t=>e+=Object(h["k"])(t)?t.node.memory:0),this._nodeId2MetaReloading.forEach(t=>e+=Object(h["k"])(t)?t.node.memory:0),e}getUnloadedMemory(){return(Object(h["k"])(this._controller)?this._controller.unloadedMemoryEstimate:0)+(Object(h["k"])(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!Object(T["a"])(this.i3slayer)||!this._supportsLabeling)return void(Object(h["k"])(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(Object(h["k"])(this._labeler))return;const e=new re({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach(t=>Object(h["k"])(t)&&this._addMetaToLabeler(e,t)),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then(e=>(--this._asyncModuleLoading,e),e=>{throw--this._asyncModuleLoading,e})}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=Object(be["initialize"])().then(()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()}),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.i3slayer.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=he(this._layerClippingArea,this._modifications,t);Object(be["setModificationsSync"])({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new u["a"]:null;this._nodeId2Meta.forEach((e,t)=>{Object(h["j"])(e)?this._nodeId2Meta.delete(t):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):Object(h["k"])(s)&&s.push(e.node)}),Object(h["k"])(s)&&this._nodeId2MetaReloading.forEach(e=>s.push(e.node)),Object(h["k"])(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll(e=>{if(e.imModificationImpact!==Le["f"].Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),this._nodeId2Meta.delete(e.index),Object(h["k"])(t)&&this._nodeId2MetaReloading.set(e.index,t)}})),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(Object(h["k"])(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!Ke["a"].I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const i of this._modifications){i.geometry.spatialReference=this.i3slayer.spatialReference;const s={...t,color:e[i.type]};this._modificationGraphics.push(new n["a"]({geometry:i.geometry,symbol:s}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,(e,t)=>this._createAttributes(e,t))}_suspendedChange(e){e?(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler)):(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(Object(h["k"])(t)&&Object(h["k"])(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(Object(h["k"])(t)&&Object(h["k"])(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);Object(h["k"])(i)&&Object(h["k"])(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);Object(h["k"])(s)&&(await this.attributeOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,Object(h["k"])(this._labeler)&&this._labeler.setNodeMetaAttributes(e,(e,t)=>this._createAttributes(e,t)),this._updateEngineObject(e)}clearMemCache(){Object(h["k"])(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach(t=>Object(h["k"])(t)&&e.push(t.node)),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach((t,i)=>e.push(i)),this._nodeId2MetaReloading.forEach((t,i)=>e.push(i))}_preLoadBasis(){!Object(d["a"])("disable-feature:i3s-basis")&&0!=(this.supportedTextureEncodings&ge["a"].Basis)&&Object(h["b"])(this.i3slayer.textureSetDefinitions,e=>e.some(e=>e.formats.some(e=>"basis"===e.format||"ktx2"===e.format)))&&Object(tt["e"])()}_getVertexBufferLayout(e,t){const i={hasTexture:_t(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return Object(We["a"])(Object(Ze["a"])(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||"OBJECTID"}_findGraphicNodeAndIndex(e){const t=Object(Qe["a"])(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return Object(c["c"])(this._nodeId2Meta,e=>{if(Object(h["j"])(e))return!1;const s=e.featureIds.indexOf(t);return-1!==s&&(i={node:e.node,index:s},!0)}),i}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(Object(h["j"])(i))return[];const s=[],r=this._getObjectIdField(),n=this.i3slayer.fieldsIndex;for(const a of t){const e=Object(Qe["a"])(n,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._nodeId2Meta.get(t.node.index);if(Object(h["j"])(i))return Promise.reject();const s=i.objectHandle,r=Object(Q["a"])(t.index,this._collection,s,new Float64Array(24)),n=this.view.renderSpatialReference,a=this.view.spatialReference;if(Object(S["p"])(r,n,0,r,a,0,8)){const e=Object(D["k"])();return Object(D["n"])(e,r,0,8),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}}whenGraphicAttributes(e,t){return Object(Ue["y"])(this.i3slayer,e,this._getObjectIdField(),t,()=>[...this._nodeId2Meta.values()].filter(h["k"]))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return Object(h["j"])(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${ot}/${e.id}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return Object(h["k"])(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){Object(h["k"])(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(Object(h["j"])(this._memCache))return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,e.node.memory,i)}loadMissingTextures(e,t,i,s){var r;const n=null!=(r=null==e?void 0:e.filter((e,i)=>{if(0==(e.usage&this.rendererTextureUsage))return!1;if(Object(h["j"])(t))return!0;const s=Object(Re["g"])(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(Object(h["j"])(r)||null==r.data||s&&r.encoding!==s.encoding)}))?r:[];return 0===n.length?Promise.resolve(!1):i(n,s).then(i=>{let s=0;for(let r=0;rnull==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e)),null):(e.geometryObb=s.geometryObb,this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then(i=>(i&&this._idbCache.initialized&&Object(h["k"])(s.textureData)&&(s.byteSize=Ot(s.transformedGeometry,s.textureData),s.textureData.every(yt)&&jt(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch(t=>st.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`))),Object(b["v"])(t),s)))):Promise.resolve(null)}addNode(e,t,i){return pt(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,()=>this._transformNode(e,t,i).then(s=>this._safeReschedule(()=>{if(Object(h["j"])(s))return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:n,featureIds:a,transformedGeometry:o}=s,d=this._controller.crsIndex,l=this.view.renderSpatialReference,c=Object(Ve["a"])(e.mbs,this.elevationOffset,d,l);e.geometryObb=Object(Fe["e"])([r.center.x,r.center.y,r.center.z],[r.extents.x,r.extents.y,r.extents.z],[r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w]),Object(I["s"])(e.geometryObb.center,e.geometryObb.center,c),t.geometryData.componentOffsets=n,a&&(t.geometryData.featureIds=Array.from(a));const u={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:o,globalTrafo:c,geometryObb:e.geometryObb,byteSize:Ot(o,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&jt(e,u)){const t=Object(h["k"])(u.textureData)?u.textureData.map(e=>yt(e)?e:null):null;this._idbCache.put(this._getCacheKey(e),{...u,textureData:t}).catch(t=>st.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`))}return this._addCachedNodeData(e,u,i)},i))):Promise.reject()}computeVisibilityObb(e){return Object(Ue["i"])(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications)}_transformNode(e,t,i){const s=t.geometryData.geometries,r=new Array(s.length);for(let h=0;h0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this.supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(e.geometryObb=Object(Fe["b"])(this._collection.getComponentObb(t.objectHandle)),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);Object(h["k"])(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,Je["b"].Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this._updateEngineObject(t),this._highlights.objectCreated(t),Object(h["k"])(this._treeDebugger)&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,()=>this._addCachedNodeData(e,t,s))}async _addCachedNodeData(e,t,i){var s;if(this.suspended||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(Object(h["j"])(t))return void this._addNodeMeta(e.index,null);const r=this._addTasks.get(e.index),{geometryData:n,transformedGeometry:a,globalTrafo:o}=t;await this.attributeOverrides.apply(n.featureIds,r.attributeInfo,i);const l=Object(h["k"])(t.textureData)?t.textureData.filter(e=>Object(h["k"])(e)&&0!=(e.usage&this.rendererTextureUsage)):[];!Object(d["a"])("disable-feature:i3s-basis")&&l.some(e=>Object(h["k"])(e)&&(e.encoding===ge["a"].Basis||e.encoding===ge["a"].KTX2))&&await Object(tt["e"])(),e.memory=0;const{componentOffsets:c,geometries:u,featureIds:b}=n,f=this._collection,g=u[0],{layout:m,indices:_,interleavedVertexData:p,positionData:y,hasColors:O}=a,j=this._materialParameters(g,m),I=c||new Uint32Array([0,_?_.length:p.byteLength/m[0].stride]),M={vertices:{data:p,count:p.byteLength/m[0].stride,layoutParameters:j.geometryParams},positionData:{positions:y.data,indices:y.indices},indices:_,componentOffsets:I},D=g.transformation?Object(w["c"])(g.transformation):Object(w["d"])();Object(C["n"])(D,o,D);const E=Object(C["a"])(Object(N["f"])(),D),P=Object(v["f"])(Object(x["b"])(),D),F=this.view.renderSpatialReference,T=this.view.basemapTerrain.spatialReference,A=Object(N["f"])(),k=[1,1,1];Object(S["j"])(E,F,k,T)||st.errorOnce("Unsupported coordinate system for IM overlay"),Object(S["y"])(E,F,A,T);const R=f.createObject({toMapSpace:[A[0],A[1],k[0],k[1]],geometry:M,obb:Object(h["t"])(e.geometryObb),transform:{position:E,rotationScale:P}}),L=j.geometryParams.textureCoordinates===et["b"].Atlas,{textures:V,texturePromise:U}=this._initMaterialAndTextures(R,j.material,l,L);e.memory+=this._memEstimateGeometryAdded(R),e.memory+=V.reduce((e,t)=>e+(Object(h["k"])(t)?this._memEstimateTextureAdded(t):0),0);const G=!!j.material.hasParametersFromSource,B="blend"!==j.material.alphaMode&&j.material.metallicRoughness.baseColorFactor[3]>=1,H=new nt(e,b,R,this._getInvalidRendererVersion(),r.attributeInfo,{hasParametersFromSource:G,isOpaque:B},V);r.meta=H,!this._hasTextures&&null!=(s=t.requiredTextures)&&s.some(({usage:e})=>0!=(e&ge["b"].ColorTextures))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||O,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const q=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(H),U]).then(([t,s])=>(Object(h["k"])(t)&&t.updateObjectVisibility(H.objectHandle,!1),this._safeReschedule(()=>{const i=this._addTasks.get(e.index);if(!i)return;if(Object(h["k"])(this._labeler)&&this._addMetaToLabeler(this._labeler,H),this._addNodeMeta(e.index,H),i.meta=null,this.suspended)return void this._removeNodeStageData(e.index,this.elevationOffset);f.setObjectVisibility(R,Je["b"].Visible),Object(h["k"])(t)&&t.updateObjectVisibility(H.objectHandle,!0),H.attributeInfo=i.attributeInfo;const s=H.cachedRendererVersion!==this._rendererVersion,r=q!==this.slicePlaneEnabled;this._setObjectSymbolColors(H);const n=this._applyFiltersToNode(H);(s||Object(h["k"])(t)&&(r||n))&&this._addOrUpdateEdgeRendering(H),this._visibleGeometryChanged(H),this._highlights.objectCreated(H),this._updateMaterial(H),this._setNewNodeOpacity(H),Object(h["k"])(this._treeDebugger)&&this._treeDebugger.update()},i))).catch(e=>{throw Object(h["k"])(r.meta)&&(this._cacheGPUData(r.meta),r.meta=null),e})}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){st.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);Object(h["k"])(t)&&this._deleteComponentObject(t)}Object(h["k"])(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Ct(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_safeReschedule(e,t){return Object(b["v"])(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=Object(h["k"])(e.params.material)?e.params.material:Object(Re["c"])(),s=t.some(e=>"uvRegion"===e.name),r=t.some(e=>"normalCompressed"===e.name),n=_t(i);return{geometryParams:this._getGeometryParameters({hasTexture:n,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,n=i.map(e=>Object(Re["b"])(e,t,s,r));this._stage.addMany(n);let a=null;return this._collection.updateMaterial(e,e=>{a=Object(Re["a"])(e,t,n,i,this.view._stage.renderView.textureRepository,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR(),isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)}),{textures:n,texturePromise:a}}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?et["b"].Atlas:et["b"].Default:et["b"].None,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,i){let s=this._addTasks.get(e.index);return s?s.attributeInfo=t:(s={...Object(b["g"])(),attributeInfo:t,meta:null},this._addTasks.set(e.index,s),i().then(s.resolve,s.reject).then(()=>this._addTasks.delete(e.index)).catch(t=>{throw this._addTasks.delete(e.index),t})),s.promise}_clearAddTasks(){this._addTasks.forEach(e=>{Object(h["k"])(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)}),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=Object(E["l"])();this._renderClippingArea=Object(Xe["b"])(this.view.clippingArea,i,e)?i:null;const s=Object(E["l"])();this._layerClippingArea=Object(Xe["b"])(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}_geometryFilterChange(){this._controller.geometryFilterChanged(this.hasGeometryFilter)}get hasGeometryFilter(){return!1}_filterChange(){this._applyFilters(!1)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach(e=>{Object(h["k"])(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e))})}getFilters(){const e=[],t=this._renderClippingArea;return Object(h["k"])(t)&&e.push((e,i)=>this._boundingRectFilter(e,i,t)),e}addSqlFilter(e,t,i){if(Object(h["k"])(t)){const s=t.fieldNames;e.push((e,r)=>this._sqlFilter(e,r,t,s,i))}}_sqlFilter(e,t,i,s,r){const n={},a=this._createLayerGraphic(n),o=this.i3slayer.objectIdField,d=t.featureIds,l=Object(h["k"])(t.attributeInfo)&&t.attributeInfo.attributeData;s.every(e=>null!=l[e]||e===o)&&Object(Ue["k"])(e,d,e=>{n[o]=d[e];for(const t of s)t!==o&&(n[t]=Object(Ue["o"])(l[t],e));try{return i.testFeature(a)}catch(t){return r(t),!1}})}_boundingRectNodeTest(e,t){return Object(S["o"])(e.node.mbs,this._controller.crsIndex,mt,this.view.renderSpatialReference),Object(Ue["t"])(t,mt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,ct),Object(D["F"])(ct,ht),Object(E["w"])(i,ht)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===Ue["a"].INSIDE)return;if(r===Ue["a"].OUTSIDE)return void(e.length=0);const n=s.getComponentCount(t.objectHandle);if(n.invisible+n.visible!==t.featureIds.length)return;const a=this._transformClippingArea(ut,i,t.objectHandle);Object(Ue["k"])(e,t.featureIds,e=>this._boundingRectFeatureTest(t,e,a))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,n=s.rotationScale;return e[0]=(t[0]-r[0])/n[0],e[1]=(t[1]-r[1])/n[4],e[2]=(t[2]-r[0])/n[0],e[3]=(t[3]-r[1])/n[4],e}_addOrUpdateEdgeRendering(e,t=!0){const i=this._edgeView;if(Object(h["j"])(i))return Promise.resolve(null);const s=e.objectHandle,r=i.hasObject(s),{hasEdges:n,perFeatureEdgeMaterials:a}=this._getFilteredEdgeMaterials(e),o={slicePlaneEnabled:this.slicePlaneEnabled};return n&&r?(this.nodeCrossfadingEnabled&&Ct(a,this.getNodeOpacity(e)),i.updateAllComponentMaterials(s,a,o,t),i.updateObjectVisibility(s,!0),Promise.resolve(i)):n&&!r?this._collection.addEdges(s,i,a,o).then(t=>(e.edgeMemoryUsage=t,e.node.memory+=t,i)):(!n&&r&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,i.removeObject(s)),Promise.resolve(null))}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(Object(h["k"])(this._labeler)&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=0===t.getComponentCount(e.objectHandle).invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!i;if(this._updateCachedFilteredIds(e),e.filteredIds===e.featureIds)return!i;const s=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,s),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array;return e.featureIds.forEach((i,s)=>{e.filteredIds[t.length]===i&&t.push(s)}),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach((t,i)=>this._removeNodeStageData(i,e)),this._nodeId2MetaReloading.forEach((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading))}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading)}_removeNodeStageData(e,t,i=this._nodeId2Meta){const s=i.get(e);Object(h["j"])(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,Je["b"].Hidden),Object(h["k"])(this._edgeView)&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1),this._visibleGeometryChanged(s),Object(h["k"])(this._labeler)&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),Object(h["k"])(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(Object(h["k"])(this._edgeView)&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);Object(h["k"])(i)&&this._collection.updateMaterial(i.objectHandle,e=>e.polygonOffsetEnabled=t===Le["g"].Hole)}_invalidateAllSymbols(){this._rendererVersion=Object(Ue["b"])(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return Object(Ue["b"])(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=Object(Ue["b"])(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await Object(R["e"])()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:st.warn("Unsupported visual variable type for 3D Object Scene Services: "+t.type);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&st.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getSymbolColors(e){this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(e,i)=>{const s=5*e;Object(M["l"])(i.externalColor,t[s+0]/255,t[s+1]/255,t[s+2]/255,t[s+3]/255),i.externalColorMixMode=t[s+4]&(1<0?Object(h["k"])(this._rendererFields)&&this._rendererFields.length>0?Object(F["j"])(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasSymbolColors)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=Object(h["k"])(e.attributeInfo)&&e.attributeInfo.attributeData,n=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&Object(h["k"])(this._symbologyFields)&&this._symbologyFields.length>0,o=a?[]:null,d=a?[]:null;if(a&&Object(h["k"])(this._symbologyFields))for(const h of this._symbologyFields){const e=r[h];e&&(o.push(h),d.push(e))}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const l={color:ft,castShadows:!0,pickable:!0,colorMixMode:$e["a"].Multiply,edgeMaterial:null},c=this.fullOpacity,u=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):c;let b=null,f=it["a"].OPAQUE,g=Ue["x"],m=0;for(let _=0;_=1&&(e.material.isOpaque||l.colorMixMode===$e["a"].Replace)?it["a"].OPAQUE:it["a"].TRANSPARENT;l.edgeMaterial===b&&t===f||(g={...l.edgeMaterial,opacity:u,objectTransparency:t},b=l.edgeMaterial,f=t),e.cachedEdgeMaterials[_]=g}else e.cachedEdgeMaterials[_]=Ue["x"];e.cachedSymbology[m+0]=Math.round(255*c[0]),e.cachedSymbology[m+1]=Math.round(255*c[1]),e.cachedSymbology[m+2]=Math.round(255*c[2]),e.cachedSymbology[m+3]=Math.round(255*c[3]),e.cachedSymbology[m+4]=l.colorMixMode|+l.castShadows<e!==Ue["x"]),perFeatureEdgeMaterials:t};let i=0,s=!1;const r=t.map((t,r)=>e.featureIds[r]!==e.filteredIds[i]?Ue["x"]:(s=s||t!==Ue["x"],i++,t));return{hasEdges:s,perFeatureEdgeMaterials:r}}_setObjectSymbolColors(e){if(!this._hasSymbolColors)return;const t=e.objectHandle,i=this._getSymbolColors(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach(t=>{Object(h["j"])(t)||(this._collection.updateMaterial(t.objectHandle,t=>t.objectOpacity=e),Ct(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))})}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,e=>{e.commonMaterialParameters.slicePlaneEnabled=this.slicePlaneEnabled,e.usePBR=this._usePBR(),this._updateMaterialOverlay(e)})}_updateMaterialOverlay(e){}_updateEngineObject(e){this._setObjectSymbolColors(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),Object(h["k"])(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach(t=>{Object(h["j"])(t)||(this._collection.updateMaterial(t.objectHandle,t=>{t.commonMaterialParameters.slicePlaneEnabled=e}),this._updateEdgeRendering(t,!1))})}_updatePBR(){this._nodeId2Meta.forEach(e=>{Object(h["j"])(e)||this._collection.updateMaterial(e.objectHandle,e=>{e.usePBR=this._usePBR()})}),this._hasLoadedPBRTextures=!0}_usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){Object(h["k"])(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=ue["b"].VISIBLE_ONLY){Object(c["c"])(this._nodeId2Meta,s=>{if(Object(h["j"])(s))return!1;if(Object(h["k"])(t))switch(t(s)){case ue["a"].EXIT:return!0;case ue["a"].SKIP:return!1}let r=ue["a"].CONTINUE;switch(i){case ue["b"].ALL:r=this._forAllFeaturesOfNode(s,e);break;case ue["b"].VISIBLE_ONLY:r=this._forVisibleFeaturesOfNode(s,e);break;case ue["b"].ALL_IN_CLIPPING_AREA:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return r===ue["a"].EXIT})}_forAllFeaturesOfNode(e,t){let i=ue["a"].CONTINUE;const s=e.featureIds;for(let r=0;r(i=t(s[r],r,e),i===ue["a"].CONTINUE)),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(Object(h["j"])(this._renderClippingArea))return this._forAllFeaturesOfNode(e,t);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===Ue["a"].OUTSIDE)return ue["a"].CONTINUE;if(i===Ue["a"].INSIDE)return this._forAllFeaturesOfNode(e,t);const s=ue["a"].CONTINUE,r=e.featureIds,n=e.objectHandle,a=Object(Ue["p"])(this._renderClippingArea,this._collection.getObjectTransform(n));for(let o=0;o0){if(e[0]instanceof n["a"]){const i=e,s=this.i3slayer.fieldsIndex,r=this._getObjectIdField(),n=i.map(e=>Object(Qe["a"])(s,e.attributes,r)),{set:a,handle:o}=t.acquireSet();return t.setFeatureIds(a,n),o}if("number"==typeof e[0]){const i=e,{set:s,handle:r}=t.acquireSet();return t.setFeatureIds(s,i),r}}return xt}_visibleGeometryChanged(e){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=Object(g["b"])(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this.gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this.geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this.texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.getUnloadedMemory()/1048576).toFixed(1)+"MB"};return Object(h["k"])(this._memCache)&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this;return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const t=[];return e._forAllFeatures(e=>(t.push(e),ue["a"].CONTINUE),null,ue["b"].VISIBLE_ONLY),t.sort((e,t)=>e-t),t},get numNodes(){return e._nodeId2Meta.size}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return Object(h["k"])(e)?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach((t,i)=>e(i,t))}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);Object(h["k"])(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);Object(h["k"])(i)&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,e=>e.objectOpacity=t),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(!Object(h["k"])(this._edgeView)||!e.cachedEdgeMaterials)return;Ct(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t)}get hasModifications(){return this._isIntegratedMesh&&Object(h["k"])(this._layerClippingArea)||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.i3slayer.uid,s=vt(e);if(Object(h["k"])(s)){const t={context:i,buffer:s.buffer};Object(be["filterObbsForModificationsSync"])(t);const r=new Float64Array(s.buffer);e.forAll((e,t)=>{const i=r[t],s=Object(be["interpretObbModificationResults"])(i);e.imModificationImpact=s,s!==Le["f"].Unmodified&&this._controller.invalidateGeometryVisibility(e.index)})}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||Object(h["k"])(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0}};return Object(s["a"])([Object(y["b"])()],t.prototype,"_hasLoadedPBRTextures",void 0),Object(s["a"])([Object(y["b"])()],t.prototype,"_asyncModuleLoading",void 0),Object(s["a"])([Object(y["b"])()],t.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),Object(s["a"])([Object(y["b"])()],t.prototype,"view",void 0),Object(s["a"])([Object(y["b"])()],t.prototype,"i3slayer",void 0),Object(s["a"])([Object(y["b"])()],t.prototype,"_controller",void 0),Object(s["a"])([Object(y["b"])()],t.prototype,"_labeler",void 0),Object(s["a"])([Object(y["b"])()],t.prototype,"updating",void 0),Object(s["a"])([Object(y["b"])()],t.prototype,"suspended",void 0),Object(s["a"])([Object(y["b"])()],t.prototype,"holeFilling",void 0),Object(s["a"])([Object(y["b"])(Ye["a"])],t.prototype,"updatingProgress",void 0),Object(s["a"])([Object(y["b"])({readOnly:!0,aliasOf:"_controller.updatingProgress"})],t.prototype,"updatingProgressValue",void 0),Object(s["a"])([Object(y["b"])({readOnly:!0})],t.prototype,"hasTexturesOrVertexColors",null),Object(s["a"])([Object(y["b"])({readOnly:!0})],t.prototype,"rendererTextureUsage",null),Object(s["a"])([Object(y["b"])()],t.prototype,"filter",void 0),Object(s["a"])([Object(y["b"])({readOnly:!0})],t.prototype,"elevationOffset",null),Object(s["a"])([Object(y["b"])({type:Boolean})],t.prototype,"slicePlaneEnabled",void 0),Object(s["a"])([Object(y["b"])()],t.prototype,"supportedTextureEncodings",null),Object(s["a"])([Object(y["b"])()],t.prototype,"uncompressedTextureDownsamplingEnabled",null),Object(s["a"])([Object(y["b"])({type:[A["a"]]})],t.prototype,"_modifications",void 0),t=Object(s["a"])([Object(j["a"])("esri.views.3d.layers.I3SMeshView3D")],t),t},ct=Object(D["h"])(),ht=Object(E["l"])(),ut=Object(E["l"])(),bt=Object(Fe["e"])(),ft=[0,0,0,0],gt=new r["a"]([0,0,0,0]),mt=[0,0,0,0];function _t(e){if(Object(h["j"])(e))return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function pt(e){return"geometryData"in e}function yt(e){return Object(h["k"])(e)&&Object(m["c"])(e.data)}function Ot(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(Object(h["k"])(t))for(const s of t)Object(h["k"])(s)&&Object(m["c"])(s.data)&&(i+=s.data.byteLength);return i}function jt(e,t){return t.byteSize>dt?(st.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function vt(e){if(0===e.length)return null;const t=10*e.length,i=new Float64Array(t);return e.forAll((e,t)=>{let s=e.serviceObb;Object(h["j"])(s)&&(s=bt,Object(I["m"])(s.center,e.mbs),s.halfSize[0]=s.halfSize[1]=s.halfSize[2]=e.mbs[3]);const r=10*t;i[r+0]=s.center[0],i[r+1]=s.center[1],i[r+2]=s.center[2],i[r+3]=s.halfSize[0],i[r+4]=s.halfSize[1],i[r+5]=s.halfSize[2],i[r+6]=s.quaternion[0],i[r+7]=s.quaternion[1],i[r+8]=s.quaternion[2],i[r+9]=s.quaternion[3]}),i}const xt={remove(){},pause(){},resume(){}};function Ct(e,t){e.forEach(e=>e.opacity=t)}},"623b":function(e,t,i){"use strict";i.d(t,"a",(function(){return g}));var s,r=i("a4ee"),n=(i("e06a"),i("6a0ed")),a=i("7ffa"),o=i("0028"),d=i("59b2"),l=(i("cea0"),i("d386")),c=i("09db"),h=i("c6f7"),u=i("8188"),b=i("1219");let f=s=class extends n["a"]{constructor(e){super(e),this.geometry=null,this.type="clip"}writeGeometry(e,t,i,s){if(s.layer&&s.layer.spatialReference&&!s.layer.spatialReference.equals(this.geometry.spatialReference)){if(!Object(u["b"])(e.spatialReference,s.layer.spatialReference))return void(s&&s.messages&&s.messages.push(new o["a"]("scenemodification:unsupported","Scene modifications with incompatible spatial references are not supported",{modification:this,spatialReference:s.layer.spatialReference,context:s})));const r=new b["a"];Object(u["v"])(e,r,s.layer.spatialReference),t[i]=r.toJSON(s)}else t[i]=e.toJSON(s);delete t[i].spatialReference}clone(){return new s({geometry:Object(a["a"])(this.geometry),type:this.type})}};Object(r["a"])([Object(d["b"])({type:b["a"]}),Object(h["a"])()],f.prototype,"geometry",void 0),Object(r["a"])([Object(c["a"])(["web-scene","portal-item"],"geometry")],f.prototype,"writeGeometry",null),Object(r["a"])([Object(d["b"])({type:["clip","mask","replace"],nonNullable:!0}),Object(h["a"])()],f.prototype,"type",void 0),f=s=Object(r["a"])([Object(l["a"])("esri.layers.support.SceneModification")],f);const g=f},"673a":function(e,t,i){"use strict";var s;i.d(t,"a",(function(){return s})),function(e){e[e.FadeIn=0]="FadeIn",e[e.FadeOut=1]="FadeOut"}(s||(s={}))},"7a89":function(e,t,i){"use strict";var s,r;i.d(t,"a",(function(){return s})),i.d(t,"b",(function(){return r})),function(e){e[e.None=0]="None",e[e.Int16=1]="Int16",e[e.Int32=2]="Int32"}(s||(s={})),function(e){e[e.Replace=0]="Replace",e[e.Outside=1]="Outside",e[e.Inside=2]="Inside",e[e.Finished=3]="Finished"}(r||(r={}))},"82de":function(e,t,i){"use strict";i.d(t,"a",(function(){return o})),i.d(t,"b",(function(){return c}));var s=i("afe1"),r=i("0b2d"),n=i("8188"),a=i("f694");function o(e,t,i,r){const a=c(e,t,i),o=Object(s["d"])();return Object(n["d"])(i,a,o,r),o}const d=1,l=5-d;function c(e,t,i){const s=Object(r["f"])(),n=e[3],o=2**(Math.ceil(Math.log(n)*Math.LOG2E/l)*l+d);if(i.isGeographic){const t=o/Object(a["e"])(i).radius*180/Math.PI,r=Math.round(e[1]/t),n=Math.max(-90,Math.min(90,r*t)),d=t/Math.cos((Math.abs(n)-t/2)/180*Math.PI),l=Math.round(e[0]/d)*d;s[0]=l,s[1]=n}else{const t=Math.round(e[0]/o),i=Math.round(e[1]/o);s[0]=t*o,s[1]=i*o}const c=e[2]+t,h=Math.round(c/o);return s[2]=h*o,s}},8752:function(e,t,i){"use strict";i.d(t,"a",(function(){return C})),i.d(t,"b",(function(){return j})),i.d(t,"c",(function(){return O})),i.d(t,"d",(function(){return g})),i.d(t,"e",(function(){return y})),i.d(t,"f",(function(){return w})),i.d(t,"g",(function(){return I}));var s=i("c120"),r=i("38a4"),n=i("b2b2"),a=i("2b13"),o=i("f4cc");class d{constructor(e,t){this._textureRep=e,this._disposed=!1;const i=this._textureRep.acquire(t);Object(o["o"])(i)?(i.then(e=>{this._disposed?Object(n["r"])(e):this._textureRef=e}),this.loadPromise=i):this._textureRef=i}dispose(){this._textureRef=Object(n["r"])(this._textureRef),this._disposed=!0}bind(e,t,i){const s=Object(n["k"])(this._textureRef)?this._textureRef.glTexture:null;Object(n["k"])(s)&&(e.bindTexture(s,t),e.setUniform2f(i,s.descriptor.width,s.descriptor.height))}}var l=i("a7d7"),c=i("ebd5"),h=i("7c7f"),u=i("b7c2"),b=i("1e2c"),f=i("d17d");function g(e,t){const i=new Map,s=(e,t)=>{if(Object(n["j"])(e))return-1;if(i.has(e.id)){const s=i.get(e.id);return s.usage|=t,s.id}const s=i.size;return i.set(e.id,{id:s,usage:t}),s},r=t.pbrMetallicRoughness,o=r&&r.baseColorFactor,d=t.emissiveFactor,c=null==t.normalTexture&&null==t.emissiveTexture&&null==t.occlusionTexture&&(!r||null==r.metallicRoughnessTexture&&1===r.roughnessFactor&&(1===r.metallicFactor||0===r.metallicFactor)),h=c?l["b"][0]:r?r.metallicFactor:1,b=c?l["b"][1]:r?r.roughnessFactor:1,f="mask"===t.alphaMode?a["b"].Color|a["b"].AlphaMask:a["b"].Color,g={baseColorFactor:o?[o[0],o[1],o[2],o[3]]:[1,1,1,1],baseColorTextureId:s(r&&r.baseColorTexture,f),metallicRoughnessTextureId:s(r&&r.metallicRoughnessTexture,a["b"].MetallicRoughness),metallicFactor:h,roughnessFactor:b},p={alphaMode:t.alphaMode,alphaCutoff:t.alphaCutoff,doubleSided:t.doubleSided,cullFace:"none"===t.cullFace?u["c"].None:"back"===t.cullFace?u["c"].Back:"front"===t.cullFace?u["c"].Front:void 0,normalTextureId:s(t.normalTexture,a["b"].Normal),emissiveTextureId:s(t.emissiveTexture,a["b"].Emissive),occlusionTextureId:s(t.occlusionTexture,a["b"].Occlusion),emissiveFactor:d?[d[0],d[1],d[2]]:[0,0,0],metallicRoughness:g,wrapTextures:!1,hasParametersFromSource:c},y=[];return i.forEach(({usage:t},i)=>{const s=Object(n["k"])(e)&&e[i]&&e[i].formats,r=s?m(s.map(({name:e,format:t})=>({name:e,encoding:_[t]}))):[];y.push({id:i,usage:t,encodings:r})}),{material:p,textures:y}}function m(e){return e.sort((e,t)=>e.encoding-t.encoding)}const _={ktx2:a["a"].KTX2,basis:a["a"].Basis,dds:a["a"].DDS_S3TC,png:a["a"].PNG,jpg:a["a"].JPG,"ktx-etc2":a["a"].KTX_ETC2},p={[b["a"].KTX2_ENCODING]:a["a"].Basis,[b["a"].BASIS_ENCODING]:a["a"].Basis,[b["a"].DDS_ENCODING]:a["a"].DDS_S3TC,"image/png":a["a"].PNG,"image/jpg":a["a"].JPG,"image/jpeg":a["a"].JPG,"image/ktx":a["a"].KTX_ETC2};function y(e){const t=e&&e.materialDefinitions?Object.keys(e.materialDefinitions)[0]:null,i=e&&e.textureDefinitions?Object.keys(e.textureDefinitions)[0]:null,s=t&&e.materialDefinitions[t],n=i&&e.textureDefinitions[i],o=O();if(null!=s){const e=s.params;e.diffuse&&(o.metallicRoughness.baseColorFactor=[e.diffuse[0],e.diffuse[1],e.diffuse[2],1]),null!=e.doubleSided&&(o.doubleSided=e.doubleSided,o.cullFace=e.doubleSided?u["c"].None:u["c"].Back),"none"!==e.cullFace&&"front"!==e.cullFace&&"back"!==e.cullFace||(o.cullFace="none"===e.cullFace?u["c"].None:"back"===e.cullFace?u["c"].Back:u["c"].Front),e.transparency&&(o.metallicRoughness.baseColorFactor[3]=Object(r["f"])(1-e.transparency,0,1)),(e.useVertexColorAlpha||o.metallicRoughness.baseColorFactor[3]<1)&&(o.alphaMode="blend")}const d=[];if(null!=n){const e=0;!n.wrap||"repeat"!==n.wrap[0]&&"repeat"!==n.wrap[1]||(o.wrapTextures=!0);let t=a["b"].Color;"rgba"===n.channels&&(o.alphaMode="blend",t|=a["b"].AlphaMask);const i=n.images.length-1,s=n.images[i],r=e=>e&&e.split("/").pop(),l=Array.isArray(n.encoding)?m(n.encoding.map((e,t)=>({name:r(s.href[t]),encoding:p[e]||0}))):[{name:r(s.href),encoding:p[n.encoding]||0}];d.push({id:e,usage:t,encodings:l}),o.metallicRoughness.baseColorTextureId=e}return{material:o,textures:d}}const O=()=>({alphaMode:"opaque",alphaCutoff:c["b"],doubleSided:!0,cullFace:u["c"].None,normalTextureId:-1,emissiveTextureId:-1,occlusionTextureId:-1,emissiveFactor:[0,0,0],metallicRoughness:{baseColorFactor:[.8,.8,.8,1],baseColorTextureId:-1,metallicRoughnessTextureId:-1,metallicFactor:0,roughnessFactor:.6},wrapTextures:!1,hasParametersFromSource:!0});function j(e,t,i,s){if(Object(n["j"])(e)||null==e.data)return null;const o=e.data,d=!(o instanceof HTMLImageElement)||Object(r["k"])(o.width)&&Object(r["k"])(o.height),l=s.renderingContext.parameters.maxMaxAnisotropy,c=i&&!s.capabilities.shaderTextureLOD?1:l,h=d&&!e.downsampled&&c>1,u=i||!t.wrapTextures?v:x,f=M(e.encoding),g=e.usage&a["b"].Color?"opaque"===t.alphaMode?3:4:3;return new b["a"](o,{mipmap:h,maxAnisotropy:c,encoding:f,wrap:u,components:g,noUnpackFlip:!0})}const v={s:f["B"].CLAMP_TO_EDGE,t:f["B"].CLAMP_TO_EDGE},x={s:f["B"].REPEAT,t:f["B"].REPEAT};function C(e,t,i,s,o,l){const b=l.rendererTextureUsage,f=e=>N(s,i,e&b),g=t.metallicRoughness.baseColorFactor,m=Object(r["f"])(t.metallicRoughness.baseColorFactor[3],0,1);e.baseColor=[g[0],g[1],g[2],m],e.hasParametersFromSource=!!t.hasParametersFromSource,e.usePBR=l.usePBR,e.mrrFactors=[t.metallicRoughness.metallicFactor,t.metallicRoughness.roughnessFactor,t.hasParametersFromSource?.2:.5],e.emissiveFactor=t.emissiveFactor,e.isIntegratedMesh=l.isIntegratedMesh,e.alphaCutoff="mask"===t.alphaMode?t.alphaCutoff:c["b"],e.alphaDiscardMode="opaque"===t.alphaMode?u["a"].Opaque:"mask"===t.alphaMode?u["a"].Mask:u["a"].MaskBlend;const _=[],p=f(a["b"].Color|a["b"].AlphaMask);Object(n["k"])(p)&&(e.baseColorTexture=new d(o,p),_.push(e.baseColorTexture.loadPromise));const y=f(a["b"].MetallicRoughness);Object(n["k"])(y)&&(e.metallicRoughnessTexture=new d(o,y),_.push(e.metallicRoughnessTexture.loadPromise));const O=f(a["b"].Emissive);Object(n["k"])(O)&&(e.emissionTexture=new d(o,O),_.push(e.emissionTexture.loadPromise));const j=f(a["b"].Occlusion);Object(n["k"])(j)&&(e.occlusionTexture=new d(o,j),_.push(e.occlusionTexture.loadPromise));const v=f(a["b"].Normal);return Object(n["k"])(v)&&(e.normalTexture=new d(o,v),_.push(e.normalTexture.loadPromise)),e.commonMaterialParameters.slicePlaneEnabled=l.slicePlaneEnabled,e.commonMaterialParameters.doubleSided=t.doubleSided,e.commonMaterialParameters.cullFace=t.cullFace,e.ellipsoidMode=Object(h["b"])(l.viewSpatialReference),Promise.all(_)}function w(e){const t=!!e.compressedTextureS3TC,i=!!e.compressedTextureETC,r=Object(s["a"])("disable-feature:i3s-basis")?0:a["a"].Basis|a["a"].KTX2,n=a["a"].JPG|a["a"].PNG,o=r|a["a"].DDS_S3TC;return n|(t?o:0)|(i?r:0)}function I(e,t){return e.find(e=>0!=(e.encoding&t))}function N(e,t,i){if(Object(n["j"])(e)||i===a["b"].None)return null;for(let s=0;s{let l=n.meta.featureExtents;if(Object(s["j"])(l)){l=new Float64Array(6*n.meta.featureIds.length),n.meta.featureExtents=l;for(let e=0;e=192&&a<224){if(n+1>=i)throw new s["a"]("utf8-decode-error","UTF-8 Decode failed. Two byte character was truncated.");const o=(31&a)<<6|63&e[t+n+1];r+=String.fromCharCode(o),n+=2}else if(a>=224&&a<240){if(n+2>=i)throw new s["a"]("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const o=(15&a)<<12|(63&e[t+n+1])<<6|63&e[t+n+2];r+=String.fromCharCode(o),n+=3}else{if(!(a>=240&&a<248))throw new s["a"]("utf8-decode-error","UTF-8 Decode failed. Invalid multi byte sequence.");{if(n+3>=i)throw new s["a"]("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const o=(7&a)<<18|(63&e[t+n+1])<<12|(63&e[t+n+2])<<6|63&e[t+n+3];if(o>=65536){const e=55296+(o-65536>>10),t=56320+(1023&o);r+=String.fromCharCode(e,t)}else r+=String.fromCharCode(o);n+=4}}}return r}function c(e,t){const i={byteOffset:0,byteCount:0,fields:Object.create(null)};let s=0;for(let r=0;r0){if(r.push(l(i,o,n-1)),0!==i[o+n-1])throw new s["a"]("string-array-error","Invalid string array: missing null termination.")}else r.push(null);o+=n}return r}function u(e,t){return new(0,x[t.valueType])(e,t.byteOffset,t.count*t.valuesPerElement)}function b(e,t){return new Uint8Array(e,t.byteOffset,t.byteCount)}function f(e,t,i){const n=null!=t.header?c(e,t.header):{byteOffset:0,byteCount:0,fields:{count:i}},a={header:n,byteOffset:n.byteCount,byteCount:0,entries:Object.create(null)};let o=n.byteCount;for(let d=0;dnew DataView(e,0).getFloat32(t,!0),Float64:(e,t)=>new DataView(e,0).getFloat64(t,!0),UInt8:(e,t)=>new DataView(e,0).getUint8(t),Int8:(e,t)=>new DataView(e,0).getInt8(t),UInt16:(e,t)=>new DataView(e,0).getUint16(t,!0),Int16:(e,t)=>new DataView(e,0).getInt16(t,!0),UInt32:(e,t)=>new DataView(e,0).getUint32(t,!0),Int32:(e,t)=>new DataView(e,0).getInt32(t,!0)};function w(e){return x.hasOwnProperty(e)}function I(e){return w(e)?x[e].BYTES_PER_ELEMENT:0}},c453:function(e,t,i){"use strict";i.d(t,"a",(function(){return n})),i.d(t,"b",(function(){return a})),i.d(t,"c",(function(){return c})),i.d(t,"d",(function(){return l})),i.d(t,"e",(function(){return s})),i.d(t,"f",(function(){return r})),i.d(t,"g",(function(){return o})),i.d(t,"h",(function(){return h}));var s,r,n,a,o,d=i("0fc4");class l{constructor(e,t){this.id=e,this.mbs=t,this.renderMbs=Object(d["f"])([0,0,0,-1]),this.imModificationImpact=r.NotChecked}}!function(e){e[e.Unmodified=0]="Unmodified",e[e.Culled=1]="Culled",e[e.NotChecked=2]="NotChecked"}(s||(s={})),function(e){e[e.Unmodified=0]="Unmodified",e[e.PotentiallyModified=1]="PotentiallyModified",e[e.Culled=2]="Culled",e[e.Unknown=3]="Unknown",e[e.NotChecked=4]="NotChecked"}(r||(r={}));class c extends l{constructor(e,t,i,s,r,a,o,d,l,c){super(e,i),this.index=t,this.childCount=s,this.level=r,this.resources=a,this.version=o,this.lodMetric=d,this.maxError=l,this.numFeatures=c,this.failed=!1,this.hasModifications=!1,this.cacheState=n.Unknown,this.vertexCount=0,this.memory=0}}!function(e){e[e.Unknown=0]="Unknown",e[e.Uncached=1]="Uncached",e[e.Cached=2]="Cached"}(n||(n={})),function(e){e[e.None=0]="None",e[e.MaxScreenThreshold=1]="MaxScreenThreshold",e[e.ScreenSpaceRelative=2]="ScreenSpaceRelative",e[e.RemovedFeatureDiameter=3]="RemovedFeatureDiameter",e[e.DistanceRangeFromDefaultCamera=4]="DistanceRangeFromDefaultCamera"}(a||(a={})),function(e){e[e.Hole=0]="Hole",e[e.Leaf=1]="Leaf"}(o||(o={}));class h{constructor(e,t,i,s){this.nodeHasLOD=e,this.isChosen=t,this.lodLevel=i,this.version=s}}},c6f7:function(e,t,i){"use strict";i.d(t,"a",(function(){return p}));var s=i("b2b2"),r=i("2698"),n=i("e041"),a=i("8eed"),o=i("7af8"),d=i("92ef"),l=i("59b2");function c(e){return b[h(e)]||g}function h(e){return e instanceof Blob?e.type:u(e.url)}function u(e){const t=Object(n["p"])(e);return m[t]||f}const b={},f="text/plain",g=b[f],m={png:"image/png",jpeg:"image/jpeg",jpg:"image/jpg",bmp:"image/bmp",gif:"image/gif",json:"application/json",txt:"text/plain",xml:"application/xml",svg:"image/svg+xml",zip:"application/zip",pbf:"application/vnd.mapbox-vector-tile",gz:"application/gzip"};for(const S in m)b[m[S]]=S;var _=i("fcf2");function p(e){const t=Object(s["k"])(e)&&e.origins?e.origins:[void 0];return(i,s)=>{const r=y(e,i,s);for(const e of t){const t=Object(l["c"])(i,e,s);for(const e in r)t[e]=r[e]}}}function y(e,t,i){if(Object(s["k"])(e)&&"resource"===e.type)return O(e,t,i);switch(Object(s["k"])(e)&&e.type?e.type:"other"){case"other":return{read:!0,write:!0};case"url":{const{read:e,write:t}=_["d"];return{read:e,write:t}}}}function O(e,t,i){const a=Object(o["b"])(t,i);return{type:String,read:(e,t,i)=>{const s=Object(_["e"])(e,t,i);return a.type===String?s:"function"==typeof a.type?new a.type({url:s}):void 0},write:{writer(t,o,l,c){if(!c||!c.resources)return"string"==typeof t?void(o[l]=Object(_["f"])(t,c)):void(o[l]=t.write({},c));const h=N(t),u=h?Object(_["f"])(h,{...c,verifyItemRelativeUrls:c&&c.verifyItemRelativeUrls?{writtenUrls:c.verifyItemRelativeUrls.writtenUrls,rootPath:null}:null},_["a"].NO):null,b=a.type!==String&&(!Object(r["a"])(this)||c&&c.origin&&this.originIdOf(i)>Object(d["e"])(c.origin));c&&c.portalItem&&Object(s["k"])(u)&&!Object(n["u"])(u)?b?v(this,i,t,u,o,l,c,e):x(u,o,l,c):c&&c.portalItem&&(Object(s["j"])(u)||Object(s["k"])(Object(_["c"])(u))||Object(n["v"])(u)||b)?j(this,i,t,u,o,l,c,e):o[l]=u}}}}function j(e,t,i,r,o,d,l,h){const u=Object(a["a"])(),b=w(i,r,l),f=Object(n["B"])(Object(s["i"])(h,"prefix"),u),g=`${f}.${c(b)}`,m=l.portalItem.resourceFromPath(g);Object(n["v"])(r)&&l.resources.pendingOperations.push(I(r).then(e=>{m.path=`${f}.${c(e)}`,o[d]=m.itemRelativeUrl}).catch(()=>{})),C(e,t,m,b,l.resources.toAdd),o[d]=m.itemRelativeUrl}function v(e,t,i,s,r,a,o,d){const l=o.portalItem.resourceFromPath(s),h=w(i,s,o);c(h)===Object(n["p"])(l.path)?(C(e,t,l,h,o.resources.toUpdate),r[a]=s):j(e,t,i,s,r,a,o,d)}function x(e,t,i,s){s.resources.toKeep.push({resource:s.portalItem.resourceFromPath(e)}),t[i]=e}function C(e,t,i,s,r){r.push({resource:i,content:s,finish:i=>{M(e,t,i)}})}function w(e,t,i){return"string"==typeof e?{url:t}:new Blob([JSON.stringify(e.toJSON(i))],{type:"application/json"})}async function I(e){const t=(await Promise.resolve().then(i.bind(null,"2eab"))).default,{data:s}=await t(e,{responseType:"blob"});return s}function N(e){return Object(s["j"])(e)?null:"string"==typeof e?e:e.url}function M(e,t,i){"string"==typeof e[t]?e[t]=i.url:e[t].url=i.url}},d207:function(e,t,i){"use strict";i.d(t,"a",(function(){return _})),i.d(t,"b",(function(){return f})),i.d(t,"c",(function(){return l}));var s=i("ce50");const r=!0,n={identifierOffset:0,identifierLength:10,versionOffset:10,checksumOffset:12,byteCount:16};function a(e,t,i){return{identifier:String.fromCharCode.apply(null,new Uint8Array(e,i+n.identifierOffset,n.identifierLength)),version:t.getUint16(i+n.versionOffset,r),checksum:t.getUint32(i+n.checksumOffset,r)}}const o={sizeLo:0,sizeHi:4,minX:8,minY:16,minZ:24,maxX:32,maxY:40,maxZ:48,errorX:56,errorY:64,errorZ:72,count:80,reserved:84,byteCount:88};function d(e,t){return{sizeLo:e.getUint32(t+o.sizeLo,r),sizeHi:e.getUint32(t+o.sizeHi,r),minX:e.getFloat64(t+o.minX,r),minY:e.getFloat64(t+o.minY,r),minZ:e.getFloat64(t+o.minZ,r),maxX:e.getFloat64(t+o.maxX,r),maxY:e.getFloat64(t+o.maxY,r),maxZ:e.getFloat64(t+o.maxZ,r),errorX:e.getFloat64(t+o.errorX,r),errorY:e.getFloat64(t+o.errorY,r),errorZ:e.getFloat64(t+o.errorZ,r),count:e.getUint32(t+o.count,r),reserved:e.getUint32(t+o.reserved,r)}}function l(e){const t=new DataView(e,0);let i=0;const{identifier:r,version:l}=a(e,t,i);if(i+=n.byteCount,"LEPCC "!==r)throw new s["a"]("lepcc-decode-error","Bad identifier");if(l>1)throw new s["a"]("lepcc-decode-error","Unknown version");const h=d(t,i);if(i+=o.byteCount,h.sizeHi*2**32+h.sizeLo!==e.byteLength)throw new s["a"]("lepcc-decode-error","Bad size");const u=new Float64Array(3*h.count),b=[],f=[],g=[],m=[];if(i=c(e,i,b),i=c(e,i,f),i=c(e,i,g),i=c(e,i,m),i!==e.byteLength)throw new s["a"]("lepcc-decode-error","Bad length");let _=0,p=0;for(let s=0;s>6;let c=0;if(0===l)c=n.getUint32(1,r),t+=5;else if(1===l)c=n.getUint16(1,r),t+=3;else{if(2!==l)throw new s["a"]("lepcc-decode-error","Bad count type");c=n.getUint8(1),t+=2}if(d)throw new s["a"]("lepcc-decode-error","LUT not implemented");const h=Math.ceil(c*o/8),u=new Uint8Array(e,t,h);let b=0,f=0,g=0;const m=-1>>>32-o;for(let s=0;s>>=o,f-=o,f+o>32&&(b|=u[g-1]>>8-f)}return t+g}const u={sizeLo:0,sizeHi:4,count:8,colorMapCount:12,lookupMethod:14,compressionMethod:15,byteCount:16};function b(e,t){return{sizeLo:e.getUint32(t+u.sizeLo,r),sizeHi:e.getUint32(t+u.sizeHi,r),count:e.getUint32(t+u.count,r),colorMapCount:e.getUint16(t+u.colorMapCount,r),lookupMethod:e.getUint8(t+u.lookupMethod),compressionMethod:e.getUint8(t+u.compressionMethod)}}function f(e){const t=new DataView(e,0);let i=0;const{identifier:r,version:o}=a(e,t,i);if(i+=n.byteCount,"ClusterRGB"!==r)throw new s["a"]("lepcc-decode-error","Bad identifier");if(o>1)throw new s["a"]("lepcc-decode-error","Unknown version");const d=b(t,i);if(i+=u.byteCount,d.sizeHi*2**32+d.sizeLo!==e.byteLength)throw new s["a"]("lepcc-decode-error","Bad size");if((2===d.lookupMethod||1===d.lookupMethod)&&0===d.compressionMethod){if(3*d.colorMapCount+d.count+i!==e.byteLength||d.colorMapCount>256)throw new s["a"]("lepcc-decode-error","Bad count");const t=new Uint8Array(e,i,3*d.colorMapCount),r=new Uint8Array(e,i+3*d.colorMapCount,d.count),n=new Uint8Array(3*d.count);for(let e=0;e1)throw new s["a"]("lepcc-decode-error","Unknown version");const d=m(t,i);if(i+=g.byteCount,d.sizeHi*2**32+d.sizeLo!==e.byteLength)throw new s["a"]("lepcc-decode-error","Bad size");const l=new Uint16Array(d.count);if(8===d.bitsPerPoint){if(d.count+i!==e.byteLength)throw new s["a"]("lepcc-decode-error","Bad size");const t=new Uint8Array(e,i,d.count);for(let e=0;ethis.pendingFetchAbortController=null)}destroy(){this.layer=null,this.memCache.destroy(),this.memCache=null,this.pendingFetchAbortController&&(this.pendingFetchAbortController.abort(),this.pendingFetchAbortController=null),this.pendingFetchChangedObjectIds=null}createInteractiveEditSession(e){this.changedObjectIds.add(e),Object(d["j"])(this.interactiveEditingSessions)&&(this.interactiveEditingSessions=[]);const t=this.interactiveEditingSessions,i=new p(e,{rollback:()=>{Object(r["j"])(t,i),0===t.length&&(this.interactiveEditingSessions=null)},commit:t=>{for(const[i,s]of t)this.updateValue(e,i,s)}});return t.unshift(i),i}async apply(e,t,i){if(Object(d["j"])(t))return;const{loadedAttributes:s,attributeData:r}=t;if(Object(d["j"])(s)||0===s.length||Object(d["j"])(r))return;if(await Object(l["z"])(this.pendingFetchChangedObjectIds,i),0===this.changedObjectIds.size)return;const n={loadedAttributes:s,attributeData:r},a=this._getOverridesFromCache(e,n,this.changedObjectIds),{objectIds:o,fieldNames:c}=a,h=await this._queryOverridesFromAssociatedLayer(o,c,i);Object(d["j"])(h)||this._processOverridesFromAssociatedLayer(e,h,c,n)}updateValue(e,t,i){this.changedObjectIds.add(e),this._cacheValue(e,t,i)}_cacheValue(e,t,i){this.memCache.put(this._getCacheKey(e,t),i,this._memCacheValueSize(i))}_getOverridesFromCache(e,{loadedAttributes:t,attributeData:i},s){const r=new Set,n=new Array;for(const o of t)n[o.index]=i[o.name];const a=new Set;for(let o=0;oe-t),this.warnMaximumChangedObjectsExceeded&&(this.warnMaximumChangedObjectsExceeded=!1,this._logMaximumObjectsExceededWarning());const s=Object(d["t"])(this.layer.associatedLayer),a=s.createQuery();a.where="1=1",a.returnGeometry=!1,a.outFields=[s.objectIdField,...t],a.cacheHint=!0,a.objectIds=e;const o=b(s),l=e.length>o?Object(r["n"])(e,o).map(e=>{const t=a.clone();return t.objectIds=e,Object(n["e"])(u(s,t,{signal:i}))}):[Object(n["e"])(u(s,a,{signal:i}))];return(await Promise.all(l)).reduce((e,t)=>e.concat(t.ok?t.value.features:[]),[])}_logMaximumObjectsExceededWarning(){let e=`The number of edited objects that are not yet cached in the scene service exceeds the maximum limit. Attribute changes will only be available for the first ${Object(c["b"])(this._maximumNumberOfEditOVerrides)} objects. Please consider re-caching the scene service`;const t=this.layer.portalItem;t&&t.loaded?e+=` (${t.portal.url}/home/item.html?id=${t.id}#settings)`:e+=` (${this.layer.parsedUrl.path})`,m.warn("#queryOverrides()",this.layer.title,e+".")}_processOverridesFromAssociatedLayer(e,t,i,{loadedAttributes:s,attributeData:r}){const n=Object(d["t"])(this.layer.associatedLayer).objectIdField,a=i.map(e=>r[e]),o=new Map(s.map(e=>[e.name,e.index])),l=i.map(e=>o.get(e)),c=new Map(Array.from(e,(e,t)=>[e,t]));for(const d of t){const e=d.attributes[n];for(let t=0;te-t);for(let i=0;i0){const e=this.toArray();this._map.clear(),this.emit("change",{added:[],removed:e})}}get length(){return this._map.size}get(e){return this._map.get(e)}addMany(e){if(0===e.length)return;const t=new Set;for(let s=0;s0?e.filter(e=>!t.has(e.objectId)):e;i.length>0&&this.emit("change",{added:i,removed:[]})}removeMany(e){const t=[];for(const i of e){const e=i.objectId,s=this._map.get(e);null!=s&&--s.refCount<=0&&(this._map.delete(e),t.push(i))}t.length>0&&this.emit("change",{added:[],removed:t})}removeManyByObjectId(e){const t=[];for(const i of e){const e=this._map.get(i);null!=e&&--e.refCount<=0&&(this._map.delete(i),t.push(e))}t.length>0&&this.emit("change",{added:[],removed:t})}toArray(){return[...this._map.values()]}find(e){let t;return Object(r["c"])(this._map,i=>!!e(i)&&(t=i,!0)),t}forEach(e){this._map.forEach(t=>e(t))}}},ee9c:function(e,t,i){"use strict";i.d(t,"a",(function(){return L})),i.d(t,"b",(function(){return be})),i.d(t,"c",(function(){return ae})),i.d(t,"d",(function(){return ne})),i.d(t,"e",(function(){return se})),i.d(t,"f",(function(){return ie})),i.d(t,"g",(function(){return J})),i.d(t,"h",(function(){return ee})),i.d(t,"i",(function(){return we})),i.d(t,"j",(function(){return E})),i.d(t,"k",(function(){return F})),i.d(t,"l",(function(){return U})),i.d(t,"m",(function(){return P})),i.d(t,"n",(function(){return W})),i.d(t,"o",(function(){return K})),i.d(t,"p",(function(){return k})),i.d(t,"q",(function(){return X})),i.d(t,"r",(function(){return ue})),i.d(t,"s",(function(){return Y})),i.d(t,"t",(function(){return V})),i.d(t,"u",(function(){return T})),i.d(t,"v",(function(){return le})),i.d(t,"w",(function(){return fe})),i.d(t,"x",(function(){return ce})),i.d(t,"y",(function(){return G}));var s=i("2eab"),r=i("b50f"),n=i("ce50"),a=i("c120"),o=i("b2b2"),d=i("f4cc"),l=i("a21b"),c=i("1c92"),h=i("dae5"),u=i("d791"),b=i("afe1"),f=i("04f0"),g=i("e764"),m=i("e431"),_=i("0b2d"),p=i("0fc4"),y=i("8188"),O=i("f694"),j=i("5996"),v=i("9180"),x=i("7f83"),C=i("69dd"),w=i("ad64"),I=i("82de"),N=i("ec13"),M=i("caf1"),S=i("cee3");function D(e){return e&&parseInt(e.substring(e.lastIndexOf("/")+1,e.length),10)}function E(e){if(Object(a["a"])("disable-feature:i3s-draco")||!e)return!1;for(const i of e)for(const e of i.geometryBuffers){var t;if("draco"===(null==(t=e.compressedAttributes)?void 0:t.encoding))return!0}return!1}function P(e,t,i,s,r,n){r.traverse(i,i=>{let r=i.mbs;t!==s&&(r=R,Object(y["o"])(i.mbs,s,r,t));const a=V(e,r);return a!==L.OUTSIDE&&(n(i,a),!0)})}function F(e,t,i){let s=0,r=0;for(let n=0;n=0===t&&(i[n]=i[s],n++),s++;i.length=n}const A=Object(v["l"])();function k(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return A[0]=(e[0]-t.position[0])/t.rotationScale[0],A[1]=(e[1]-t.position[1])/t.rotationScale[4],A[2]=(e[2]-t.position[0])/t.rotationScale[0],A[3]=(e[3]-t.position[1])/t.rotationScale[4],A}const R=Object(p["e"])();var L;function V(e,t){const i=t[0],s=t[1],r=t[3],n=e[0]-i,a=i-e[2],o=e[1]-s,d=s-e[3],l=Math.max(n,a,0),c=Math.max(o,d,0),h=l*l+c*c;return h>r*r?L.OUTSIDE:h>0?L.INTERSECTS_CENTER_OUTSIDE:-Math.max(n,a,o,d)>r?L.INSIDE:L.INTERSECTS_CENTER_INSIDE}function U(e,t,i){const s=[],r=i&&i.missingFields,n=i&&i.originalFields;for(const a of e){const e=a.toLowerCase();let i=!1;for(const r of t)if(e===r.name.toLowerCase()){s.push(r.name),i=!0,n&&n.push(a);break}!i&&r&&r.push(a)}return s}async function G(e,t,i,s,a){if(0===t.length)return[];const d=e.attributeStorageInfo;if(Object(o["k"])(e.associatedLayer))try{return await H(e.associatedLayer,t,i,s)}catch(l){if(e.associatedLayer.loaded)throw l}if(d){const l=B(t,i,a);if(Object(o["j"])(l))throw new n["a"]("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const c=e.parsedUrl.path,h=await Promise.all(l.map(e=>z(c,d,e.node,e.indices,s).then(t=>{for(let i=0;i=0){let e=s.get(i.node);e||(e={node:i.node,indices:[],graphics:[]},r.push(e),s.set(i.node,e)),e.indices.push(o),e.graphics.push(a);for(let i=t;i>0;i--)n[i]=n[i-1];n[0]=i;break}}}return r}async function H(e,t,i,s){t.sort((e,t)=>e.attributes[i]-t.attributes[i]);const r=t.map(e=>e.attributes[i]),n=[],a=U(s,e.fields,{originalFields:n}),o=await q(e,r,a);for(let d=0;ds){const n=Object(r["n"])(t,s);return Promise.all(n.map(t=>q(e,t,i))).then(r["f"])}const a=new C["a"]({objectIds:t,outFields:i,orderByFields:[e.objectIdField]});return e.queryFeatures(a).then(e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map(e=>e.attributes);throw new n["a"]("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")})}function z(e,t,i,r,n){const a=[];for(const s of t)if(s&&-1!==n.indexOf(s.name)){const t=`${e}/nodes/${i.resources.attributes}/attributes/${s.key}/0`;a.push({url:t,storageInfo:s})}return Object(d["j"])(a.map(e=>Object(s["default"])(e.url,{responseType:"array-buffer"}).then(t=>Object(w["d"])(e.storageInfo,t.data)))).then(e=>{const t=[];for(const i of r){const s={};for(let t=0;t{if(!d)if(d=Me,Object(v["n"])(De),Object(o["k"])(e.serviceObb)){fe(e.serviceObb,i,Ee,t,r),Object(S["d"])(Ee,d);for(const e of d)Object(m["s"])(e,e,Te),Object(v["q"])(De,e)}else{const s=e.mbs,n=s[3];Object(y["y"])(s,i,Pe,t),Object(m["s"])(Pe,Pe,Te),Pe[2]+=r;for(let e=0;e<8;++e){const t=1&e?n:-n,i=2&e?n:-n,s=4&e?n:-n,r=d[e];Object(m["m"])(r,[Pe[0]+t,Pe[1]+i,Pe[2]+s]),Object(v["q"])(De,r)}}};let c=1/0,h=-1/0;const b=e=>{if("replace"!==e.type)return;const i=e.geometry;if(!i.hasZ)return;Object(v["n"])(Se);const r=i.spatialReference||s,n=i.rings.reduce((e,i)=>i.reduce((e,i)=>(Object(y["y"])(i,r,Pe,t),Object(m["s"])(Pe,Pe,Te),Object(v["q"])(Se,Pe),Math.min(Pe[2],e)),e),1/0);l(),Object(v["w"])(De,Se)&&(c=Math.min(c,n),h=Math.max(h,n))};if(n.forEach(e=>b(e)),c===1/0)return null;const f=(e,t,i)=>{Object(m["s"])(Pe,i,a),e[t+0]=Pe[0],e[t+1]=Pe[1],e[t+2]=Pe[2],t+=24,i[2]=c,Object(m["s"])(Pe,i,a),e[t+0]=Pe[0],e[t+1]=Pe[1],e[t+2]=Pe[2],t+=24,i[2]=h,Object(m["s"])(Pe,i,a),e[t+0]=Pe[0],e[t+1]=Pe[1],e[t+2]=Pe[2]};for(let o=0;o<8;++o)f(Fe.data,3*o,d[o]);return Object(S["c"])(Fe)}const Ie=Object(b["d"])(),Ne=Object(g["b"])(),Me=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],Se=Object(v["l"])(),De=Object(v["l"])(),Ee=Object(S["e"])(),Pe=[0,0,0],Fe={data:new Array(72),size:3},Te=Object(b["d"])()}}]); //# sourceMappingURL=chunk-5e807b02.d7398333.js.map