>y,F=v+b*(8*_+4*(1-_));h=h<<3*_+2*(1-_)|v,l=l<<2*_+3*(1-_)|b,d.children[F]==null&&(d.children[F]=qt.create(this._fields,h,l,u+1),this._depth=Math.max(this._depth,u+1),this._size+=1),u+=1,d=d.children[F]}}putBins(e,t){for(const r of this.getNodes(t)){const i=e.get(r.id);i?i.merge(r):e.set(r.id,r.clone())}}getNodes(e){const t=[],{geohashBounds:r,level:i}=e;let n=this._root;for(;n!==null;){const a=n.depth,o=n.xNode,d=n.yNode;if(a>=i){t.push(n),n=n.next;continue}const u=Math.ceil((a+1)/2),h=Math.floor((a+1)/2),l=1-a%2,p=30-(3*u+2*h),g=30-(2*u+3*h),_=~((1<>p,v=(r.yLL&f)>>g,b=(r.xTR&_)>>p,F=(r.yTR&f)>>g,C=o<<3*l+2*(1-l),x=d<<2*l+3*(1-l),S=C+8*l+4*(1-l),k=x+4*l+8*(1-l),E=Math.max(C,y),L=Math.max(x,v),R=Math.min(S,b),N=Math.min(k,F);let ce=null,Re=null;for(let Ae=L;Ae<=N;Ae++)for(let Pe=E;Pe<=R;Pe++){const Xs=Pe-C+(Ae-x)*(8*l+4*(1-l)),te=n.children[Xs];te&&(ce||(ce=te,ce.next=n.next),Re&&(Re.next=te),Re=te,te.next=n.next)}n=ce||n.next}return t}}let Ms=class{constructor(s){this._options=s}insert(s,e){const t=s.getCursor(),r={$view:{scale:this._options.scale,timeZone:this._options.timeZone}};for(;t.next();)this._insertFeature(t,r,e)}_insertFeature(s,e,t){const{featureFilter:r}=this._options;if(r!==null&&!r.check(s))return;let i=0,n=0;if(s.geometryType==="esriGeometryPoint")i=s.readXWorldSpace(),n=s.readYWorldSpace();else{if(t){const o=s.readCentroidForDisplay();if(o==null)return;const[d,u]=o.coords;if(d<0||d>T||u<0||u>T)return}const a=s.readCentroidWorldSpace();if(a==null)return;i=a.coords[0],n=a.coords[1]}this._insert(s,i,n,e)}},hi=class extends Ms{constructor(s){super(s),this._tree=new li(this._options.fields)}put(s){throw new Error("Geohash tree does not support put")}putBounded(s,e,t){const{geohashLevel:r,spatialReference:i}=this._options,n=si(e,t,r,i);n!=null&&this._tree.putBins(s,n)}_insert(s,e,t,r){const{geohashLevel:i,spatialReference:n}=this._options,a=Ve(e,t,i,n);a&&this._tree.insert(s,e,t,a[0],a[1],i,r)}},Qe=class fe extends Is{static createId(e,t){return`${e}.${t}`}static create(e,t,r,i){return new fe(e,t,vs.create(r),i)}constructor(e,t,r,i){super(r),this.gridX=e,this.gridY=t,this._worldUnitsPerCell=i,this._count=0,this._xWorldTotal=0,this._yWorldTotal=0,this._objectIds=new Set}get id(){return fe.createId(this.gridX,this.gridY)}get containedObjectIds(){return this._objectIds}get count(){return this._count}get firstObjectId(){return this._objectIds.values().next().value}get centroidXWorld(){return this._xWorldTotal/this._count}get centroidYWorld(){return this._yWorldTotal/this._count}clone(){const e=new fe(this.gridX,this.gridY,this._statistics.clone(),this._worldUnitsPerCell);return e._count=this._count,e._xWorldTotal=this._xWorldTotal,e._yWorldTotal=this._yWorldTotal,e._firstFeatureAttributes=this._firstFeatureAttributes,e._objectIds=new Set(this._objectIds),e}insert(e,t,r,i){this._count===0?this._firstFeatureAttributes=e.readAttributes():this._firstFeatureAttributes=null,this._count+=1,this._xWorldTotal+=r,this._yWorldTotal+=i,this._statistics.insert(e,t),this._objectIds.add(e.getObjectId())}merge(e){if(e._count!==0){this._count+=e._count,this._firstFeatureAttributes=e._firstFeatureAttributes,this._xWorldTotal+=e._xWorldTotal,this._yWorldTotal+=e._yWorldTotal,this._statistics.merge(e._statistics);for(const t of e._objectIds.values())this._objectIds.add(t)}}getCentroidX(e){return e==null?this.centroidXWorld:Cr(e,this.centroidXWorld)}getCentroidY(e){return e==null?this.centroidYWorld:Tr(e,this.centroidYWorld)}getGeometry(e,t){const r=this.gridX*this._worldUnitsPerCell,i=this.gridY*this._worldUnitsPerCell,n=new M([4],[r,i,r+this._worldUnitsPerCell,i,r+this._worldUnitsPerCell,i+this._worldUnitsPerCell,r,i+this._worldUnitsPerCell]);if(t!=null){const a=new M;return Q(a,n,!1,!1,"esriGeometryPolygon",t)}return n}getCentroid(e){const t=new M([],[this.centroidXWorld,this.centroidYWorld]);if(e!=null){const r=new M;return Q(r,t,!1,!1,"esriGeometryPoint",e)}return t}getGeometricCentroid(e,t){const r=this.gridX*this._worldUnitsPerCell+.5*this._worldUnitsPerCell,i=this.gridY*this._worldUnitsPerCell+.5*this._worldUnitsPerCell,n=new M([],[r,i]);if(t!=null){const a=new M;return Q(a,n,!1,!1,"esriGeometryPoint",t)}return n}getAttributes(){const e={aggregateId:this.id};for(const t of this._statistics.values())e[t.field.name]=t.value;return this._firstFeatureAttributes!=null?{...e,...this._firstFeatureAttributes}:e}};const _i=96;function Ze(s,e){return rr(s)*ir*_i/e}let pi=class extends Ms{constructor(s){super(s),this._cells=new Map,this._pixelsPerMapUnit=Ze(s.spatialReference,s.scale)}put(s){for(const e of this._cells.values()){const t=s.get(e.id);t?t.merge(e):s.set(e.id,e.clone())}}putBounded(s,e,t){const r=[e.xmin,e.ymin,e.xmax,e.ymax],[i,n,a,o]=r,d=Math.floor(i*this._pixelsPerMapUnit/this._options.cellSize),u=Math.floor(n*this._pixelsPerMapUnit/this._options.cellSize),h=Math.ceil(a*this._pixelsPerMapUnit/this._options.cellSize),l=Math.ceil(o*this._pixelsPerMapUnit/this._options.cellSize);for(let p=u;p<=l;p++)for(let g=d;g<=h;g++){const _=`${g}.${p}`,f=this._cells.get(_);if(!f)continue;const y=s.get(f.id);y?f&&!s.has(f.id)&&y.merge(f):s.set(f.id,f.clone())}}_insert(s,e,t,r){const i=e*this._pixelsPerMapUnit,n=t*this._pixelsPerMapUnit,a=Math.floor(i/this._options.cellSize),o=Math.floor(n/this._options.cellSize);this._getCellOrCreate(a,o).insert(s,r,e,t)}_getCellOrCreate(s,e){const t=Qe.createId(s,e);let r=this._cells.get(t);if(!r){const i=1*this._options.cellSize/this._pixelsPerMapUnit;r=Qe.create(s,e,this._options.fields,i),this._cells.set(t,r)}return r}},gi=class He extends Fe{static from(e,t){return new He(e.copy(),t)}constructor(e,t){super(e.metadata),this._currentIndex=-1,this._displayTranslationX=0,this._displayTranslationY=0,this._displayScaleX=1,this._displayScaleY=1,this._reader=e,this._indices=t,this._isPoint=e.geometryType==="esriGeometryPoint"}setTransformForDisplay(e){const t=this._reader.getInTransform();if(t==null){const[l,p]=e.scale,[g,_]=e.translate;return this._displayTranslationX=-g/l,this._displayScaleX=1/l,this._displayTranslationY=_/p,this._displayScaleY=1/-p,void(this._displayTransform=e)}const[r,i]=t.scale,[n,a]=t.translate,[o,d]=e.scale,[u,h]=e.translate;if(this._displayScaleX=r/o,this._displayTranslationX=(n-u)/o,this._displayScaleY=i/d,this._displayTranslationY=(-a+h)/d,!this._isPoint&&t)throw new Error("InternalError: Relative transformations not supported for non-point features");this._displayTransform=e}getInTransform(){return this._reader.getInTransform()}get fields(){return this._reader.fields}get hasNext(){return this._currentIndex+1!(r.objectId!=null&&t.has(r.objectId)))}getSize(){return this._features.length}getCursor(){return this.copy()}getInTransform(){return this._transform}getAttributeHash(){let e="";for(const t in this._current.attributes)e+=this._current.attributes[t];return e}getIndex(){return this._featureIndex}setIndex(e){this._featureIndex=e}getObjectId(){return this._current?.objectId}getDisplayId(){return this._current.displayId}setDisplayId(e){this._current.displayId=e}copy(){const e=new z(this._features,this.metadata);return this.copyInto(e),e}next(){for(;++this._featureIndex!t.has(r.objectId))}getTileReader(s){if(!this._features.length)return null;const e=this.queryFeaturesInBounds(s.bounds);return e.setTransformForDisplay(s.transform),e}_onChange(){this.invalidate()}},fi=class extends ht{constructor(s,e){super(s),this.bins=new Map,this.featureCache=new Map,this.done=!1,this._store=e}reset(){this.destroy(),this.done=!1}invaldateForLocalEditDropped(){this.handledChunks.clear(),this.bins.clear()}destroy(){const s=this.subscription.tile.key.level;for(const e of this.featureCache.keys())this._store.releaseDisplayIdForObjectId(`${e}.${s}`);this.bins.clear(),this.featureCache.clear(),this.handledChunks.clear()}get tile(){return this.subscription.tile}*featuresWorldSpace(){for(const s of this.featureCache.values()){const e=s.clone();e.geometry&&kr(e.geometry,e.geometry,!1,!1,this.subscription.tile.transform),yield e}}},yi=class Es extends bs{static async create(e,t,r,i,n){const a=new at({spatialReference:t}),o=await Promise.all(e.fields.map(async u=>ys.create(a,u))),d=e.featureFilter?await es.create({geometryType:r.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:r.metadata.timeInfo,fieldsIndex:r.metadata.fieldsIndex,spatialReference:t,filterJSON:e.featureFilter}):null;return e.index.type==="geohash"&&await Er(t,P.WGS84),new Es(e,d,n,o,t,r,i)}constructor(e,t,r,i,n,a,o){super(a,o,n,i),this._schema=e,this._featureFilter=t,this._timeZone=r,this._metadata=ot.createFeature({geometryType:"esriGeometryPolygon",objectIdField:"aggregateId",fieldsIndex:new de(e.fields).toJSON(),globalIdField:null,spatialReference:a.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null})}createState(e){return new fi(e,this._attributeStore)}async*applyLocalEdit(e){for(const t of this._sendStates.values())t.reset(),yield new _t(t.subscription,q.empty(this._source.metadata),!0,!1,{})}displayMap(e,t,r){const i=new Map(e.map(a=>[t(a),a])),n=[];for(const a of this._sendStates.values())for(const o of a.featuresWorldSpace()){const{objectId:d,displayId:u}=o,h=i.get(d);if(h!=null){const l=r(u,h,d);n.push(l),i.delete(d)}}return n}getDisplayFeatures(e){const t=new Set(e),r=new Set,i=[];for(const n of this._sendStates.values())for(const a of n.featuresWorldSpace())t.has(a.displayId)&&!r.has(a.objectId)&&(a.geometry&&i.push({...rs(a,this._metadata.geometryType,!1,!1),displayId:a.displayId}),r.add(a.objectId));return{features:[],aggregates:i}}getFeatureObjectIdsForAggregate(e){for(const t of this._sendStates.values())for(const r of t.bins.values())if(r.id===e)return Array.from(r.containedObjectIds);return[]}beforeUpdateChunks(){const e=this._source.chunks();if(!e.length)return;let t=!1;for(const r of e)qs(r)&&r.lastLocalEditDropped!==this._lastHandledLocalEdit&&(this._lastHandledLocalEdit=r.lastLocalEditDropped,t=!0);if(t)for(const r of this._sendStates.values())r.invaldateForLocalEditDropped()}async*updateChunks(){for(const e of this._sendStates.values())yield*this._update(e,this._source)}forEachAggregateWorldSpace(e){const t=new Set;for(const r of this._sendStates.values())for(const i of r.featuresWorldSpace())t.has(i.objectId)||(e(i),t.add(i.objectId))}_createIndexOptions(e){switch(this._schema.index.type){case"geohash":return{type:"geohash",fields:this.aggregateFields,featureFilter:this._featureFilter,geohashLevel:this._schema.index.fixBinLevel,spatialReference:this.spatialReference,timeZone:this._timeZone,scale:e.scale};case"grid":{const t=this._schema.index.fixedBinLevel,r=t!=null?e.tileInfoView.getLODInfoAt(t).scale:e.scale;return{type:"grid",fields:this.aggregateFields,cellSize:this._schema.index.size,featureFilter:this._featureFilter,spatialReference:this.spatialReference,timeZone:this._timeZone,scale:r}}}}async*_update(e,t){const{handledChunks:r,subscription:i,bins:n,featureCache:a}=e,o=i.tile;if(e.done)return;for(const _ of t.chunks()){if(r.has(_.chunkId))continue;r.add(_.chunkId);const f=_.queryInfo;if("tileId"in f){const y=new nt(f.tileId);if(y.level!==o.level||y.world!==o.key.world)continue}_.getAggregateIndex(this._createIndexOptions(e.tile)).putBounded(n,e.tile.extent,e.tile.resolution)}const d=[],u=i.tile.transform,h=i.tile.key.level;for(const _ of n.values()){let f=a.get(_.id);if(f)f.attributes=_.getAttributes();else{const y=_.getGeometry(this.spatialReference,u);f=new Y(y,_.getAttributes(),null),y||(f.centroid=_.getGeometricCentroid(this.spatialReference,u)),f.objectId=_.id,f.displayId=this._attributeStore.createDisplayIdForObjectId(`${f.objectId}.${h}`),a.set(_.id,f)}d.push(f)}this.events.emit("changed"),e.done=!t.updateTracking.updating;const l=q.fromOptimizedFeatures(d,this._metadata,u),p=l.getCursor(),g=e.subscription.tile.createArcadeEvaluationOptions(this._timeZone);for(;p.next();)this._attributeStore.setAttributeData(p.getDisplayId(),p,g);yield new Be(e.subscription,l,[],e.done,{})}},mi=class{constructor(s,e){this.inner=s,this.displayId=e}};const _e=128;let bi=class extends ht{constructor(s){super(s),this.didSend=!1,this.done=!1}},wi=class{constructor(s,e,t,r,i){this._level=s,this._scale=e,this._indexOptions=t,this._clusterRadius=r,this._store=i,this._cells=new Map,this._handledChunks=new Set,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const s of this._clusters.values())this._store.releaseDisplayIdForObjectId(s.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const s of this._clusters.values()){const e=s.inner.getCentroid(null),t=new Y(e,s.inner.getAttributes(),null);t.objectId=s.inner.id,t.displayId=s.displayId,yield t}}clusters(){return this._clusters.values()}updateChunks(s,e){let t=!1;for(const a of s){const o=a.queryInfo;"tileId"in o&&new nt(o.tileId).level!==this._level||this._handledChunks.has(a.normalizedChunkId)||(this._handledChunks.add(a.normalizedChunkId),t=!0,a.getAggregateIndex({...this._indexOptions,scale:this._scale}).put(this._cells))}const r={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},i=Ze(this._indexOptions.spatialReference,this._scale),n=this._indexOptions.cellSize;for(const{subscription:a}of e){const o=a.tile.bounds,d=Math.floor(o[0]*i/n),u=Math.floor(o[1]*i/n),h=Math.ceil(o[2]*i/n),l=Math.ceil(o[3]*i/n);r.xMin=Math.min(r.xMin,d),r.yMin=Math.min(r.yMin,u),r.xMax=Math.max(r.xMax,h),r.yMax=Math.max(r.yMax,l)}return this._lastCellBounds!=null&&r.xMin===this._lastCellBounds.xMin&&r.yMin===this._lastCellBounds.yMin&&r.yMin===this._lastCellBounds.yMin&&r.yMax===this._lastCellBounds.yMax||(t=!0,this._lastCellBounds=r),t&&this._clusterCells(r),t}async updateStatistics(s){let e=!1;for(const t of this._clusters.values())t.inner.count>1&&(e=this._updateAggregateStatistics(this._statistics,t.inner)||e);if(e){const t=Array.from(this._statistics.entries()).map(([r,i])=>({fieldName:r,minValue:i.minValue,maxValue:i.maxValue}));await s.container.updateStatistics(this._level,t)}}createAggregateFeatures(s,e){const t=s.subscription,r=[],i=t.tile.transform;for(const n of this._clusters.values()){let a=n.inner.getCentroidX(i);const o=n.inner.getCentroidY(i),d=t.tile.lod,u=d.wrap?d.worldSize[0]:null,h=n.inner.count===1?n.inner.firstObjectId:n.inner.id,l=n.displayId;if(u!=null)if(u===1){const p=new M([],[a,o]),g=new Y(p,n.inner.getAttributes(),null);g.geometry.coords[0]-=T,g.objectId=h,g.displayId=l,r.push(g);const _=new M([],[a,o]),f=new Y(_,n.inner.getAttributes(),null);f.geometry.coords[0]+=T,f.objectId=h,f.displayId=l,r.push(f)}else a>T+T/2?a-=u*T:a<-T/2&&(a+=u*T);if(a=-_e&&o=-_e){const p=new M([],[a,o]),g=new Y(p,n.inner.getAttributes(),null);g.objectId=h,g.displayId=l,r.push(g)}}return q.fromOptimizedFeatures(r,e,t.tile.transform)}_clusterCells(s){let e=Array.from(this._cells.values());e=e.sort((a,o)=>o.count-a.count);const t=[];for(const a of this._clusters.values())t.push(a.inner.id);this._clusters.clear();const r=this._clusterRadius*(1/Ze(this._indexOptions.spatialReference,this._scale)),i=1+this._clusterRadius/this._indexOptions.cellSize,n=new Set;for(const a of e){if(n.has(a.id)||a.gridXs.xMax||a.gridYs.yMax)continue;const o=this._store.createDisplayIdForObjectId(a.id),d=new mi(a.clone(),o);n.add(a.id),this._clusters.set(a.id,d);const u=a.centroidXWorld,h=a.centroidYWorld;for(let l=a.gridY-i;l<=a.gridY+i;l++)for(let p=a.gridX-i;p<=a.gridX+i;p++){if(l===a.gridY&&p===a.gridX)continue;const g=this._cells.get(Qe.createId(p,l));if(!g||n.has(g.id))continue;const _=Math.abs(g.centroidXWorld-u),f=Math.abs(g.centroidYWorld-h);_ys.create(o,u))),spatialReference:r,featureFilter:t.featureFilter?await es.create({geometryType:i.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:i.metadata.timeInfo,fieldsIndex:i.metadata.fieldsIndex,spatialReference:r,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4,timeZone:a};return new Os(e,t.clusterRadius,d,t.fields,i,n)}constructor(e,t,r,i,n,a){super(n,a,r.spatialReference,r.fields),this._connection=e,this._clusterRadius=t,this._indexOptions=r,this._cellsPerScale=new Map,this._metadata=ot.createFeature({geometryType:"esriGeometryPoint",objectIdField:"aggregateId",fieldsIndex:new de([...i,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}]).toJSON(),globalIdField:null,spatialReference:n.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!1}invalidate(){super.invalidate();for(const e of this._cellsPerScale.values())e.destroy();this._cellsPerScale.clear()}onSubscribe(e){super.onSubscribe(e),this._requiredLevel=e.tile.level,this._requiredScale=e.tile.scale}createState(e){return new bi(e)}async*applyLocalEdit(e){for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(e,t,r){const i=new Map(e.map(o=>[t(o),o])),n=[],a=this._getClusterState(this._requiredLevel,this._requiredScale);for(const o of a.clusters()){const d=i.get(o.inner.id);if(d==null){if(o.inner.count===1){const u=i.get(o.inner.firstObjectId);if(u!=null){const h=r(o.displayId,u,o.inner.firstObjectId);n.push(h),i.delete(o.inner.firstObjectId)}}}else{const u=r(o.displayId,d,o.inner.id);n.push(u),i.delete(o.inner.id)}}return n}getDisplayFeatures(e){const t=new Set(e),r=new Set,i=[],n=[],a=this._getClusterState(this._requiredLevel,this._requiredScale);for(const o of a.aggregatesWorldSpace())if(t.has(o.displayId)&&!r.has(o.displayId)){const d=rs(o,this._metadata.geometryType,!1,!1);if(r.add(o.displayId),d.attributes.cluster_count===1){i.push({...d,displayId:o.displayId});continue}n.push({...d,displayId:o.displayId})}return{features:i,aggregates:n}}getFeatureObjectIdsForAggregate(e){const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const r of t.clusters())if(r.inner.id===e)return Array.from(r.inner.containedObjectIds);return[]}async*updateChunks(){const e=this._source.chunks();if(!e.length)return;for(const a of e)qs(a)&&a.lastLocalEditDropped!==this._lastHandledLocalEdit&&(this.invalidate(),this._lastHandledLocalEdit=a.lastLocalEditDropped);const t=this._getClusterState(this._requiredLevel,this._requiredScale),r=Array.from(this._sendStates.values()).filter(a=>a.subscription.tile.level===this._requiredLevel);if(t.updateChunks(e,r)||!this._source.updateTracking.updating)for(const a of r)a.subscription.tile.level===this._requiredLevel&&(a.didSend=!1,a.done=!1);const i=Array.from(this._sendStates.values()).filter(a=>a.done).map(a=>a.subscription.tile.key),n=new Set(i);for(const a of this._sendStates.values())this._source.updateTracking.updating&&(i.some(o=>o.containsChild(a.subscription.tile.key))||a.subscription.tile.key.getChildKeys().every(o=>n.has(o)))||a.didSend||a.subscription.tile.level!==this._requiredLevel||(a.didSend=!0,yield*this._update(a,t,this._source));await t.updateStatistics(this._connection)}forEachAggregateWorldSpace(e){if(this._requiredLevel==null||this._requiredScale==null)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const r of t.aggregatesWorldSpace())e(r)}_getClusterState(e,t){if(e==null||t==null)throw new Error("InternalError: Level and scale must be defined");let r=this._cellsPerScale.get(t);return r||(r=new wi(e,t,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerScale.set(t,r)),r}async*_update(e,t,r){if(e.done)return;const i=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=!r.updateTracking.updating;const n=i.getCursor(),a=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.timeZone);for(;n.next();)this._attributeStore.setAttributeData(n.getDisplayId(),n,a);yield new _t(e.subscription,i,!0,e.done,{})}},vi=class extends ht{},xi=class extends ms{constructor(s,e,t){super(s,e),this._timeZone=t,this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set,this._streamLayerDeferredObjectIdsToRemove=[]}destroy(){super.destroy();for(const s of this._source.chunks())this._cleanupChunkIds(s)}invalidateAttributeData(){this.handledChunksForAttributeData.clear()}onSubscribe(s){super.onSubscribe(s),this._evalOptions=s.tile.createArcadeEvaluationOptions(this._timeZone)}createState(s){return new vi(s)}get aggregateQueryEngine(){return null}displayMap(s,e,t){const r=new Map(s.map(n=>[e(n),n])),i=[];for(const n of this._source.chunks()){const a=n.reader.getCursor();for(;a.next();){const o=a.getObjectId(),d=a.getDisplayId(),u=r.get(o);if(u!=null){const h=t(d,u,o);i.push(h),r.delete(o)}}}return i}getDisplayFeatures(s){const e=new Set(s),t=new Set,r=[];for(const i of this._source.chunks()){const n=i.reader.getCursor();for(;n.next();){const a=n.getObjectId(),o=n.getDisplayId();e.has(o)&&!t.has(a)&&(r.push({...n.readLegacyFeatureWorldSpace(),displayId:o}),t.add(a))}}return{features:r,aggregates:[]}}async*applyLocalEdit(s){const e=[],t=s.reader.getCursor();for(;t.next();){const n=t.getObjectId(),a=this._attributeStore.createDisplayIdForObjectId(n);t.setDisplayId(a),this._attributeStore.setAttributeData(a,t,this._evalOptions),e.push(a)}const r=[];for(const n of s.removed){const a=this._attributeStore.getDisplayIdForObjectId(n);a!=null&&r.push(a)}w("esri-2d-update-debug")&&console.debug("FeatureUpdateStrategy.applyLocalEdit",{message:s,modifiedDisplayIds:e,removedDisplayIds:r});const i=new Je(this._source.metadata,"localEdit");i.applyOverrides(s),this.handledChunks.add(i.chunkId),this.handledChunksForAttributeData.add(i.chunkId),this.handledChunksForIdCreation.add(i.chunkId);for(const n of this._sendStates.values())n.handledChunks.add(i.chunkId),yield new Be(n.subscription,null,e,!1,i.queryInfo);for(const n of this._sendStates.values()){const a=i.getTileReader(n.subscription.tile);yield new Be(n.subscription,a,r,!1,i.queryInfo)}for(const n of s.removed)this._attributeStore.releaseDisplayIdForObjectId(n)}async*updateChunks(){if(this._source.chunks().length){await this._updateAttributeData();for(const s of this._sendStates.values())yield*this._update(s)}}removeChunks(s){for(const e of s)this.handledChunks.delete(e.chunkId),this.handledChunksForAttributeData.delete(e.chunkId),this._cleanupChunkIds(e)}afterUpdateChunks(){for(const s of this._streamLayerDeferredObjectIdsToRemove)this._attributeStore.releaseDisplayIdForObjectId(s);this._streamLayerDeferredObjectIdsToRemove=[]}_cleanupChunkIds(s){if(this.handledChunksForIdCreation.has(s.chunkId)){const e=s.reader.getCursor();for(;e.next();){const t=e.getObjectId();this._source.isStream?this._streamLayerDeferredObjectIdsToRemove.push(t):this._attributeStore.releaseDisplayIdForObjectId(t)}this.handledChunksForIdCreation.delete(s.chunkId)}}async _updateAttributeData(){for(const s of this._source.chunks()){const{chunkId:e,reader:t}=s;if(!this.handledChunksForIdCreation.has(e)){this.handledChunksForIdCreation.add(e);const r=t.getCursor();for(;r.next();){const i=this._attributeStore.createDisplayIdForObjectId(r.getObjectId());r.setDisplayId(i)}}}for(const s of this._source.chunks())if(!this.handledChunksForAttributeData.has(s.chunkId)){this.handledChunksForAttributeData.add(s.chunkId);const e=s.reader.getCursor();for(;e.next();){const t=e.getDisplayId();this._attributeStore.setAttributeData(t,e,this._evalOptions)}}}*_update(s){const{subscription:e,handledChunks:t}=s;for(const r of this._source.chunks()){const{chunkId:i}=r;if(t.has(i))continue;t.add(i);const n=r.getTileReader(e.tile);n&&(yield new _t(s.subscription,n,!1,r.end,r.queryInfo))}}},Si=class{constructor(s,e){this._connection=s,this._source=e,this._version=1,this._registry=new Ir,this._proxy=new fr({fetch:(t,r)=>this._connection.layerView.fetch(t,r),fetchDictionary:(t,r)=>this._connection.layerView.fetchDictionary(t,r)}),this._attributeStore=new yr({isLocal:!1,update:t=>it(this._connection.container.updateAttributeView(t))})}destroy(){this._proxy.destroy(),this._strategy?.destroy(),this._attributeStore.destroy()}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}getDisplayFeatures(s){return this._strategy?this._strategy.getDisplayFeatures(s):{features:[],aggregates:[]}}getDisplayIds(s){const e={};return this._strategy&&this._strategy.displayMap(s,t=>t,(t,r,i)=>{e[i]=t}),e}getFeatureObjectIdsForAggregate(s){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(s):[]}onSubscribe(s){this._strategy?.onSubscribe(s)}onUnsubscribe(s){this._strategy?.onUnsubscribe(s)}async update(s,e,t,r,i){const n=s.processor,a=le(this._schema?.storage,n.storage),o=le(this._schema?.mesh.properties,n.mesh.properties),d=le(this._schema?.mesh.factory,n.mesh.factory),u=le(this._schema?.mesh.strategy,n.mesh.strategy),h=o||d||u;if(!(a||h)&&!r)return;w("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:Kt(this._schema,n),schema:n}),this._schema=n;const l=P.fromJSON(this._source.service.outSpatialReference),p=new at({fields:this._source.metadata.fieldsIndex,spatialReference:l});if(await this._attributeStore.update(n.storage,p,this._source.metadata,l,e),this._strategy?.invalidateAttributeData(),!r&&!h)return;(u||o)&&await this._updateStrategy(n.mesh.strategy,l,i,n.mesh.properties.timeZone),this._updateSortKey(p,"sortKey"in n.mesh.properties?n.mesh.properties.sortKey:null);const g=new Jr(p,this._proxy,t,this._registry);return(d||n.mesh.factory.symbology.type==="dictionary")&&(this._factory=await Hr.create(g,n.mesh.factory)),this._invalidate(),this._version=e,this._connection.container.updateRenderState(this._version)}async applyLocalEdit(s){if(!this._strategy)return;const e=this._strategy.applyLocalEdit(s);for await(const t of e)try{await this._process(t)}catch{}}async updateChunks(){this._strategy?.beforeUpdateChunks(),await this._doUpdateChunks(),this._strategy?.afterUpdateChunks()}async removeChunks(s){this._strategy?.removeChunks(s),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:s}){if(!this._strategy)return void this._attributeStore.setHighlight(s.map(({objectId:t,highlightFlags:r})=>({objectId:t,highlightFlags:r,displayId:-1})),s);const e=this._strategy.displayMap(s,({objectId:t})=>t,(t,{highlightFlags:r},i)=>({objectId:i,displayId:t,highlightFlags:r}));this._attributeStore.setHighlight(e,s)}async _doUpdateChunks(){if(!this._strategy)return;const s=this._strategy.updateChunks(),e=[],t=new Map;for await(const r of s){let i=t.get(r.id);i==null&&(i=new Kr({concurrency:16,process:a=>this._process(a)}),t.set(r.id,i));const n=i.push(r).catch(a=>et(a));e.push(n)}try{await Promise.all(e)}catch{}w("esri-2d-update-debug")&&console.log("SendUpdates"),this._attributeStore.sendUpdates(),w("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(s,e,t,r){switch(this._strategy?.destroy(),s.type){case"feature":this._strategy=new xi(this._source,this._attributeStore,r);break;case"binning":this._strategy=await yi.create(s,e,this._source,this._attributeStore,r);break;case"cluster":this._strategy=await Ii.create(this._connection,s,e,this._source,this._attributeStore,r)}for(const i of t)this._strategy.onSubscribe(i)}async _updateSortKey(s,e){if(this._sortInfo=Zt(this._sortInfo?.computed),e!=null){const t=e.byRenderer?null:await s.createComputedField(e);this._sortInfo={...e,computed:t}}}_invalidate(){this._strategy&&this._strategy.invalidate()}async _process(s){const e=s.subscription;if(w("esri-2d-update-debug")){const o=e.tile;console.debug(`Version[${this._version}] Tile[${o.key.id}, end=${s.end}] Processor._process`)}await this._fetchResources(s),Z(e.signal);const t=await this._write(s,e.tile.createArcadeEvaluationOptions(this._schema?.mesh.properties.timeZone)),r=e.tile.tileInfoView.getLODInfoAt(e.tile.key),{message:i,transferList:n}=t.serialize(r),a={objectIdMap:null,inner:s.createMessage(i,this._version,this._attributeStore.epoch)};if(this._schema?.mesh.properties.returnMeshObjectId){a.objectIdMap={};const o=s.reader?.getCursor();if(o)for(;o.next();)a.objectIdMap[o.getDisplayId()]=o.getObjectId()}if(Z(e.signal),await this._connection.container.onMessage(a,{signal:e.signal,transferList:n}),this._attributeStore.sendUpdates(),w("esri-2d-update-debug")){const o=e.tile;console.debug(`Version[${this._version}] Tile[${o.key.id}, end=${s.end}] Processor._process.await`)}}async _fetchResources(s){await this._fetchMatcherResources(s),await this._fetchWriterResources(s)}async _fetchMatcherResources(s){if(s.reader)return this._factory.enqueueMatcherRequests(this._proxy,s.reader)}async _fetchWriterResources(s){if(!s.reader)return;const e=s.reader.getCursor(),t=s.subscription.tile.createArcadeEvaluationOptions(this._schema.mesh.properties.timeZone);for(;e.next();)this._factory.enqueueWriterRequests(this._proxy,e,t);await this._proxy.fetchEnqueuedResources()}async _write(s,e){const t=s.subscription.tile,r=s.reader?.getCursor(),i=r?.getSize()??0,n=t.tileInfoView.tileInfo.isWrappable,a=t.tileInfoView.tileInfo.spatialReference.isWGS84,o=new Nr(t.key,this._strategy.enablePixelBuffering,n,a,i);if(!r)return o;const d=t.createArcadeEvaluationOptions(this._schema.mesh.properties.timeZone);for(;r.next();){const u=this._getSortKeyValue(r,e);o.entityStart(r.getDisplayId(),u),this._factory.write(o,this._proxy,r,d,t.level),o.entityEnd()}return o}_getSortKeyValue(s,e){if(!this._sortInfo)return 0;const{computed:t,order:r,byRenderer:i}=this._sortInfo,n=i?this._factory.getSortKey(s,e):t?.read(s,e);return n==null||isNaN(n)?0:n*(r==="asc"?-1:1)}},Fi=class Rs{static from(e){let t=0,r=0,i=0;return e.forEach(n=>{const a=n._readGeometry();a&&(r+=a.isPoint?1:a.lengths.reduce((o,d)=>o+d,0),i+=a.isPoint?1:a.lengths.length,t+=1)}),new Rs(t,r,i)}constructor(e,t,r){this.featureCount=e,this.vertexCount=t,this.ringCount=r}toJSON(){return{featureCount:this.featureCount,ringCount:this.featureCount,vertexCount:this.featureCount}}};const Le=4;function ki(s,e,t){const r=s.orderByFields??t.objectIdField+" ASC",i=s.source,n={returnCentroid:!(i!==null&&typeof i=="object"&&"path"in i&&Pr(i.path))&&t.serviceGeometryType==="esriGeometryPolygon",returnGeometry:!0,timeReferenceUnknownClient:t.timeReferenceUnknownClient??void 0,outSpatialReference:P.fromJSON(s.outSpatialReference),orderByFields:s.type==="memory"?[]:[r],where:e.mutable.dataFilter.definitionExpression??"1=1",outFields:e.mutable.availableFields,multipatchOption:t.serviceGeometryType==="esriGeometryMultiPatch"?"xyFootprint":null};if(e.type==="feature"){const{gdbVersion:a,historicMoment:o,timeExtent:d}=e.mutable.dataFilter;return{...n,gdbVersion:a,historicMoment:o?new Date(o):null,timeExtent:d?jr.fromJSON(d):null,outFields:e.mutable.availableFields}}return n}let Ci=class As{static fromSchema(e,t,r){const i=t.type==="feature"?t.mutable.dataFilter.queryScaleRanges:[];return new As(ki(e,t,r),i,r.subtypeField,t.mutable.dataFilter.customParameters,r.geometryType,e.queryMetadata)}constructor(e,t,r,i,n,a){this._queryParams=e,this._queryScaleRanges=t,this._subtypeField=r,this._customParameters=i,this._geometryType=n,this._queryMetadata=a}get pageSize(){if(this._queryMetadata==null)throw new Error("InternalError: Service does not support paged queries");const e=this._queryMetadata.supportsMaxRecordCountFactor?Le:null,t=(this._queryMetadata.maxRecordCount??8e3)*(e??1);return Math.min(8e3,t)}updateHistoricMoment(e){this._queryParams.historicMoment=e}updateFields(e){this._queryParams.outFields=e}createPatchFieldsQuery(e,t){if(!t.getSize())return null;const r=e.clone();if(this._queryParams.outFields[0]==="*"){if((r.outFields??[])[0]==="*")return null;r.outFields=this._queryParams.outFields}else{const i=new Set(this._queryParams.outFields),n=[];for(const a of i)t.hasField(a)||n.push(a);if(n.length===0)return null;r.outFields=n}return r.returnGeometry=!1,r.returnCentroid=!1,r.quantizationParameters=null,r.cacheHint=!0,{inner:r,customParameters:this._customParameters}}createQuery(e={}){if(!this._queryParams)throw new Error("InternalError: queryInfo should be defined");return{inner:new os({...this._queryParams,...e}),customParameters:this._customParameters}}createTileQuery(e,t){if(this._queryMetadata==null)throw new Error("InternalError: Service does not support tile queries");const r=this.createQuery(t),i=r.inner;if(this._queryScaleRanges.length){const n=this._queryScaleRanges.filter(a=>(!a.minScale||a.minScale>=e.maxScale)&&(!a.maxScale||a.maxScale<=e.minScale)).map(a=>a.subtypeCode);if(n.length){const a=`${this._subtypeField} IN (${n})`;i.where=Js(i.where,a)}}if(i.quantizationParameters=t.quantizationParameters??e.getQuantizationParameters(),i.resultType="tile",i.geometry=e.extent,this._queryMetadata.supportsQuantization?this._geometryType==="esriGeometryPolyline"&&(i.maxAllowableOffset=e.resolution*w("feature-polyline-generalization-factor")):this._geometryType!=="esriGeometryPolyline"&&this._geometryType!=="esriGeometryPolygon"||(i.maxAllowableOffset=e.resolution,this._geometryType==="esriGeometryPolyline"&&(i.maxAllowableOffset*=w("feature-polyline-generalization-factor"))),i.defaultSpatialReferenceEnabled=this._queryMetadata.supportsDefaultSpatialReference,i.compactGeometryEnabled=this._queryMetadata.supportsCompactGeometry,this._queryMetadata.supportsMaxRecordCountFactor&&(i.maxRecordCountFactor=Le),w("esri-tiles-debug")){const n=e.id.replaceAll("/",".");r.customParameters=r.customParameters?{...r.customParameters,tileId:n}:{tileId:n}}return r}createPagedTileQuery(e,t){const r=this.pageSize;return this.createTileQuery(e,{start:r*t,num:r,returnExceededLimitFeatures:!0})}createPagedQuery(e){const t=this.pageSize;return this.createQuery({start:t*e,num:t,returnExceededLimitFeatures:!0,maxRecordCountFactor:Le})}};const Ti=2500;let ye=class extends Ht{constructor(s){super(),this._connection=s,this._enabledEventTypes=new Set,this._updateInfo={websocket:0,client:0},this._lastTime=performance.now(),this._queuedCommands=[],this.addHandles([Ne(()=>this._strategy?.connectionStatus??"disconnected",e=>{this._layerView.setProperty({propertyName:"pipelineConnectionStatus",value:e})},{initial:!0}),Ne(()=>this._strategy?.errorString||null,e=>this._layerView.setProperty({propertyName:"pipelineErrorString",value:e}),{initial:!0})])}destroy(){this._strategy=null,this.removeAllHandles()}get _layerView(){return this._connection.layerView}set strategy(s){this._strategy==null&&this._resetUpdateInfo(performance.now());const e="event-handles";this.removeHandles(e),s!=null&&(this.addHandles([s.events.on("data-received",t=>this._onFeature(t)),s.events.on("message-received",t=>this._onWebSocketMessage(t)),s.events.on("features-updated",t=>this._onUpdate(t)),s.events.on("tick",()=>this._onTick())],e),this._queuedCommands.forEach(t=>t(s)),this._queuedCommands=[]),this._strategy=s}updateCustomParameters(s){s!=null&&this._callOrEnqueue(e=>e.updateCustomParameters(s))}sendMessageToSocket(s){this._callOrEnqueue(e=>e.sendMessageToSocket(s))}sendMessageToClient(s){this._callOrEnqueue(e=>e.sendMessageToClient(s))}enableEvent(s,e){e?this._enabledEventTypes.add(s):this._enabledEventTypes.delete(s)}disconnect(){this._strategy?.disconnect()}connect(){this._strategy?.connect()}clear(){this._strategy?.clear()}_onWebSocketMessage(s){this._enabledEventTypes.has("message-received")&&this._layerView.emitEvent({name:"message-received",event:s})}_onFeature(s){this._updateInfo.websocket++,this._enabledEventTypes.has("data-received")&&this._layerView.emitEvent({name:"data-received",event:{attributes:s.attributes,centroid:s.centroid,geometry:s.geometry}})}_onUpdate(s){this._updateInfo.client+=s}_onTick(){const s=performance.now(),e=s-this._lastTime;if(e>Ti){const t=Math.round(this._updateInfo.client/(e/1e3)),r=Math.round(this._updateInfo.websocket/(e/1e3));this._resetUpdateInfo(s),this._layerView.emitEvent({name:"update-rate",event:{client:t,websocket:r}})}}_resetUpdateInfo(s){this._lastTime=s,this._updateInfo.client=0,this._updateInfo.websocket=0}_callOrEnqueue(s){this._strategy!=null?s(this._strategy):this._queuedCommands.push(s)}};V([ge()],ye.prototype,"_strategy",void 0),ye=V([Xt("esri.views.2d.layers.features.sources.StreamMessenger")],ye);let pt=class{constructor(s){this._store=s,this._controller=new AbortController}destroy(){this._controller.abort()}get _options(){return{signal:this._controller.signal}}unsafeSetQueryHistoricMoment(s){throw new Error("InternalError: LoadStrategy does not support query info")}async queryOverride(s){throw new Error("InternalError: LoadStrategy does not support fetching")}async queryByObjectId(s){throw new Error("InternalError: LoadStrategy does not support fetching")}async addParquetFile(s){throw new Error("InternalError: LoadStrategy does not support loading blobs")}};const ze=268435455;let Mi=class{constructor(){this.hasFeatures=!1,this.exceededTransferLimit=!1,this.fieldCount=0,this.featureCount=0,this.objectIdFieldIndex=0,this.vertexCount=0,this.offsets={attributes:new Array,geometry:new Array},this.centroid=new Array}};function qi(s,e,t=!1){const r=s.asUnsafe(),i=r.pos(),n=new Mi;let a=0,o=0;const d=1,u=2,h=4,l=3;let p=null,g=null,_=null,f=!1;const y=[];for(;r.next();)switch(r.tag()){case 1:p=r.getString();break;case 3:g=r.getString();break;case 12:_=r.processMessage(zr);break;case 9:if(n.exceededTransferLimit=r.getBool(),n.exceededTransferLimit){n.offsets.geometry=t?new Float64Array(8e3):new Int32Array(8e3),n.centroid=t?new Float64Array(16e3):new Int32Array(16e3);for(let b=0;b0:!1}let ji=class Ke extends Fe{static fromBuffer(e,t,r=!1){const i=t.geometryType,n=Oi(e),a=qi(n,i==="esriGeometryPoint",r);return new Ke(n,a,t)}constructor(e,t,r){super(r),this._hasNext=!1,this._isPoints=!1,this._featureIndex=-1,this._featureOffset=0,this._cache={area:0,unquantGeometry:void 0,geometry:void 0,centroid:void 0,legacyFeature:void 0,optFeature:void 0},this._parseCaches=new Array,this._geometryType=r.geometryType,this._reader=e,this._header=t,this._hasNext=t.hasFeatures,this._isPoints=r.geometryType==="esriGeometryPoint"}get _size(){return this._header.featureCount}get fields(){return this._header.fields}get geometryType(){return this._geometryType}get hasZ(){return!1}get hasM(){return!1}get hasFeatures(){return this._header.hasFeatures}get hasNext(){return this._hasNext}get exceededTransferLimit(){return this._header.exceededTransferLimit}getSize(){return this._size}getInTransform(){return this._header.transform}getCursor(){return this.copy()}getIndex(){return this._featureIndex}setIndex(e){this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0,this._featureIndex=e}getAttributeHash(){let e="";for(const t of this._header.fields.fields)e+=this._readAttributeAtIndex(t.index)+".";return e}getObjectId(){return this._readAttributeAtIndex(this._header.objectIdFieldIndex)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(e){this._header.displayIds[this._featureIndex]=e}readGeometryArea(){return this._cache.area||this._readGeometry(!0),this._cache.area}copy(){const e=this._reader.clone(),t=new Ke(e,this._header,this.metadata);return this.copyInto(t),t}next(){for(this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0;++this._featureIndexu.length)for(let y=0;y=y?(h+=-.5*(R-C)*(N+x),b>1&&Ue(g,u[d-2],u[d-1],S,k)?(u[d-2]+=S,u[d-1]+=k):(u[d++]=S,u[d++]=k,b++),C=R,x=N):(E+=S,L+=k),S=E,k=L,v++}b<3||F?d-=2*b:(h+=-.5*(C+S-C)*(x+k+x),Ue(g,u[d-2],u[d-1],S,k)?(u[d-2]+=S,u[d-1]+=k,a.push(b)):(u[d++]=S,u[d++]=k,a.push(++b)))}else{let y=0,v=t.getSInt32(),b=t.getSInt32();this.hasZ&&t.getSInt32(),this.hasM&&t.getSInt32(),u[d++]=v,u[d++]=b,y+=1;for(let F=1;F2&&Ue(g,u[d-2],u[d-1],C,x)?(u[d-2]+=C,u[d-1]+=x):(u[d++]=C,u[d++]=x,y+=1),v=S,b=k}a.push(y)}break}default:t.skip()}return this._cache.area=h,a.length?new M(a,u):u!=null?this._createQuantizedExtrudedGeometry(u[0],u[1]):null}},qe=class{constructor(s,e){this.service=s,this._metadata=e}destroy(){}};function Di(s,e){switch(s.type){case"memory":return new zi(s,e);case"ogc":return new Gi(s,e);case"feature-service":return s.queryMetadata.supportsFormatPBF&&w("featurelayer-pbf")?new Ui(s,e):new Wi(s,e)}}async function Li(s){const e=new lr;return await e.open(s,{}),e}let zi=class extends qe{constructor(s,e){super(s,e),this._portsOpen=Li(s.source).then(t=>this.client=t)}destroy(){this.client.close(),this.client=null}async executeQuery(s,e){await this._portsOpen;const t=await this.client.invoke("queryFeatures",s.toJSON(),e);return q.fromFeatureSet(t,this._metadata)}},Ui=class extends qe{async executeQuery(s,e){const{data:t}=await Ar(this.service.source,s,e),r=!s.quantizationParameters;return ji.fromBuffer(t,this._metadata,r)}},Wi=class extends qe{async executeQuery(s,e){const{source:t,queryMetadata:r}=this.service;if(s.quantizationParameters!=null&&!r.supportsQuantization){const n=s.clone(),a=ds(n.quantizationParameters);n.quantizationParameters=null;const{data:o}=await It(t,n,this._metadata.spatialReference,e),d=ss(o,this._metadata.objectIdField);return is(a,d),q.fromOptimizedFeatureSet(d,this._metadata)}const{data:i}=await It(t,s,this._metadata.spatialReference,e);return this._metadata.geometryType==="esriGeometryPoint"&&(i.features=i.features?.filter(n=>{if(n.geometry!=null){const a=n.geometry;return Number.isFinite(a.x)&&Number.isFinite(a.y)}return!0})),q.fromFeatureSet(i,this._metadata)}},Gi=class extends qe{async executeQuery(s,e){if(s.quantizationParameters&&!this.service.queryMetadata.supportsQuantization){const r=s.clone(),i=ds(r.quantizationParameters);r.quantizationParameters=null;const n=await vt(this.service.source,s,e);return is(i,n),q.fromOptimizedFeatureSet(n,this._metadata)}const t=await vt(this.service.source,s,e);return q.fromOptimizedFeatureSet(t,this._metadata)}},Ps=class extends pt{constructor(s,e,t,r,i){super(t),this._serviceInfo=s,this._queryInfo=e,this._metadata=r,this._connection=i,this._queue=new ts({concurrency:16,process:async n=>{const a={signal:n.options?.signal,query:n.query.customParameters};return this._adapter.executeQuery(n.query.inner,a)}}),this._adapter=Di(s,r)}unsafeSetQueryHistoricMoment(s){this._queryInfo.updateHistoricMoment(s)}async updateFields(s){this._queryInfo.updateFields(s);const e=Array.from(this._store.chunks()).map(async r=>{const i=os.fromJSON(r.queryInfo.queryJSON);if(i)try{return await this._tryUpdateFields(r.reader,i),null}catch(n){return n}}),t=(await Promise.all(e)).filter(r=>r);if(t.length)throw new W("featurelayer-query","Encountered errors when downloading fields",{errors:t})}async queryByObjectId(s){if(s.length===0)return q.empty(this._metadata);const e=this._queryInfo.createQuery({objectIds:s});return this._fetch(e)}async _fetch(s,e){const t=await this._enqueue(s,e);return await this._tryUpdateFields(t,s.inner),t}async _tryUpdateFields(s,e){const t=this._queryInfo.createPatchFieldsQuery(e,s);if(!t)return;const r=await this._enqueue(t,this._options);s.joinAttributes(r)}async _enqueue(s,e){return this._connection.onEvent({type:"fetchStart"}),this._queue.push({query:s,options:e}).finally(()=>{this._connection.onEvent({type:"fetchEnd",done:this._queue.length===0})})}},js=class extends Ps{constructor(){super(...arguments),this._chunksById=new Map}unload(s){this._removeChunks(s.tile)}_addChunk(s){const e=s.tile.id;this._chunksById.has(e)||this._chunksById.set(e,[]);const t=s.size();(t||s.first||s.end)&&(w("esri-2d-update-debug")&&console.debug(`Chunk[${s.chunkId}] ATileLoadStrategy.addChunk [count=${t}]`),this._chunksById.get(e).push(s),this._store.insert(s))}_removeChunks(s){const e=this._chunksById.get(s.key.id)??[];for(const t of e)w("esri-2d-update-debug")&&console.debug(`Tile[${s.key.id}] Chunk[${t.chunkId}] ATileLoadStrategy.removeChunk`),this._store.remove(t);this._chunksById.delete(s.key.id)}},Pt=class extends ue{constructor(s,e,t,r,i,n){super(),this._reader=s,this._queryJSON=e,this._tile=t,this._sourceTile=r,this._sourceTileDepth=i,this._end=n,this.chunkId=`${this._tile.key.id}.${this._sourceTile?.key.id}${this._end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._sourceTile?.key.normalizedId}${this._end?"e":""}`}get queryInfo(){return{type:"drill-down-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,sourceTileDepth:this._sourceTileDepth,sourceTileId:this._sourceTile?.key.id,size:this.size(),end:this.end}}get first(){return this._sourceTileDepth===0}get reader(){return this._reader}get end(){return this._end}get tile(){return this._tile}get isTiled(){return!0}getTileReader(s){return this._tile.key.id===s.key.id?this.reader:null}},Ni=class{constructor(s,e){this.subscription=s,this._tileIdToResult=new Map,this._controller=new AbortController,this._handles=Se([we(s.signal,()=>this._controller.abort()),we(e,()=>this._controller.abort())])}destroy(){this._controller.abort(),this._handles.remove()}get(s){return this._tileIdToResult.get(s)}set(s,e){this._tileIdToResult.set(s,e)}get options(){return{signal:this._controller.signal}}},$i=class extends js{constructor(){super(...arguments),this._loadStates=new Map}destroy(){super.destroy();for(const s of this._loadStates.values())s.destroy();this._loadStates.clear()}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}async load(s){this._loadStates.has(s.key.id)||this._loadStates.set(s.key.id,new Ni(s,this._options));const e=this._loadStates.get(s.key.id);let t;try{for await(const i of this._fetchChunkInfos(e,s.tile,0)){const{queryJSON:n,reader:a,sourceTile:o,sourceTileDepth:d,tile:u}=i,h=new Pt(a,n,u,o,d,!1);Z(e.options),this._addChunk(h)}}catch(i){t=i}const r=new Pt(q.empty(this._metadata),null,s.tile,null,-1,!0);if(this._addChunk(r),t)throw t}unload(s){super.unload(s),this._loadStates.get(s.key.id)?.destroy(),this._loadStates.delete(s.key.id)}async*_fetchChunkInfos(s,e,t){let r=s.get(e.id);const i=!!r;if(r||(r=await this._fetchChunkInfo(s,e,t),s.set(e.id,r)),r.reader.exceededTransferLimit&&tthis._controller.abort()),we(e,()=>this._controller.abort())])}destroy(){this._controller.abort(),this._handles.remove()}get pageStart(){let s=-1;for(const e of this._pages.values())s=Math.max(s,e);return s+1}get done(){return this._done}get options(){return{signal:this._controller.signal}}add(s,e){this._pages.add(s),this._done=this._done||e}},Vi=class extends js{constructor(){super(...arguments),this._loadStates=new Map}destroy(){super.destroy();for(const s of this._loadStates.values())s.destroy();this._loadStates.clear()}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}async load(s){this._loadStates.has(s.key.id)||this._loadStates.set(s.key.id,new Bi(s,this._options));const e=this._loadStates.get(s.key.id);let t;try{await this._fetchPages(e)}catch(i){t=i}const r=new jt(q.empty(this._metadata),null,s.tile,-1,!0);if(Ks(e.options)||this._addChunk(r),t)throw t}unload(s){super.unload(s),this._loadStates.get(s.key.id)?.destroy(),this._loadStates.delete(s.key.id)}async _fetchPages(s){let e=0,t=s.pageStart,r=1;for(;e<20&&!s.done;){const i=[];for(let a=0;a{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Ds.decode();let se=null;function me(){return se!==null&&se.byteLength!==0||(se=new Uint8Array(c.memory.buffer)),se}function X(s,e){return s>>>=0,Ds.decode(me().subarray(s,s+e))}const Dt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>{c.__wbindgen_export_0.get(s.dtor)(s.a,s.b)});function Xi(s,e,t,r){const i={a:s,b:e,cnt:1,dtor:t},n=(...a)=>{i.cnt++;const o=i.a;i.a=0;try{return r(o,i.b,...a)}finally{--i.cnt==0?(c.__wbindgen_export_0.get(i.dtor)(o,i.b),Dt.unregister(i)):i.a=o}};return n.original=i,Dt.register(n,i,i),n}function Qi(s,e,t){c._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h7be72b1871260ae2(s,e,m(t))}function Zi(){c.enableTracing()}let O=0;const be=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Hi=typeof be.encodeInto=="function"?function(s,e){return be.encodeInto(s,e)}:function(s,e){const t=be.encode(s);return e.set(t),{read:s.length,written:t.length}};function oe(s,e,t){if(t===void 0){const o=be.encode(s),d=e(o.length,1)>>>0;return me().subarray(d,d+o.length).set(o),O=o.length,d}let r=s.length,i=e(r,1)>>>0;const n=me();let a=0;for(;a127)break;n[i+a]=o}if(a!==r){a!==0&&(s=s.slice(a)),i=t(i,r,r=a+3*s.length,1)>>>0;const o=me().subarray(i+a,i+r);a+=Hi(s,o).written,i=t(i,r,a,1)>>>0}return O=a,i}let U=null;function H(){return(U===null||U.buffer.detached===!0||U.buffer.detached===void 0&&U.buffer!==c.memory.buffer)&&(U=new DataView(c.memory.buffer)),U}function j(s,e){try{return s.apply(this,e)}catch(t){c.__wbindgen_exn_store(m(t))}}function Ji(s,e,t,r){c.wasm_bindgen__convert__closures__invoke2_mut__h35729c14da098d24(s,e,m(t),m(r))}let re=null;function Ki(){return re!==null&&re.byteLength!==0||(re=new Uint16Array(c.memory.buffer)),re}function Lt(s,e){const t=e(2*s.length,2)>>>0;return Ki().set(s,t/2),O=s.length,t}function Ls(s,e,t){const r=oe(s,c.__wbindgen_malloc,c.__wbindgen_realloc),i=O;return D(c.readMetadata(r,i,m(e),m(t)))}function zt(s,e){if(!(s instanceof e))throw new Error(`expected instance of ${e.name}`);return s.ptr}function en(s,e,t,r,i){const n=oe(s,c.__wbindgen_malloc,c.__wbindgen_realloc),a=O;zt(r,ee);var o=r.__destroy_into_raw();zt(i,J);var d=i.__destroy_into_raw();return D(c.readFile(n,a,m(e),m(t),o,d))}function We(s){return s==null}const Ut=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>c.__wbg_fieldmetadata_free(s>>>0,1));class Ee{static __wrap(e){e>>>=0;const t=Object.create(Ee.prototype);return t.__wbg_ptr=e,Ut.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Ut.unregister(this),e}free(){const e=this.__destroy_into_raw();c.__wbg_fieldmetadata_free(e,0)}get name(){let e,t;try{const n=c.__wbindgen_add_to_stack_pointer(-16);c.fieldmetadata_name(n,this.__wbg_ptr);var r=H().getInt32(n+0,!0),i=H().getInt32(n+4,!0);return e=r,t=i,X(r,i)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_free(e,t,1)}}get index(){return c.fieldmetadata_index(this.__wbg_ptr)}get type(){return["esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeBigInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeLong","esriFieldTypeString","esriFieldTypeDate","esriFieldTypeOID","esriFieldTypeGeometry","esriFieldTypeBlob","esriFieldTypeRaster","esriFieldTypeGUID","esriFieldTypeGlobalID","esriFieldTypeXML","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"][c.fieldmetadata_esri_type(this.__wbg_ptr)]}}const Wt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>c.__wbg_filemetadata_free(s>>>0,1));class ee{static __wrap(e){e>>>=0;const t=Object.create(ee.prototype);return t.__wbg_ptr=e,Wt.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Wt.unregister(this),e}free(){const e=this.__destroy_into_raw();c.__wbg_filemetadata_free(e,0)}version(){return c.filemetadata_version(this.__wbg_ptr)}numRows(){return c.filemetadata_numRows(this.__wbg_ptr)>>>0}numFields(){return c.filemetadata_numFields(this.__wbg_ptr)>>>0}keyValueMetadata(e){try{const i=c.__wbindgen_add_to_stack_pointer(-16),n=oe(e,c.__wbindgen_malloc,c.__wbindgen_realloc),a=O;c.filemetadata_keyValueMetadata(i,this.__wbg_ptr,n,a);var t=H().getInt32(i+0,!0),r=H().getInt32(i+4,!0);let o;return t!==0&&(o=X(t,r).slice(),c.__wbindgen_free(t,1*r,1)),o}finally{c.__wbindgen_add_to_stack_pointer(16)}}getFieldIndex(e){const t=oe(e,c.__wbindgen_malloc,c.__wbindgen_realloc),r=O,i=c.filemetadata_getFieldIndex(this.__wbg_ptr,t,r);return i===16777215?void 0:i}getFieldByIndex(e){const t=c.filemetadata_getFieldByIndex(this.__wbg_ptr,e);return t===0?void 0:Ee.__wrap(t)}}const Gt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>c.__wbg_geometryinfodescriptor_free(s>>>0,1));class J{static __wrap(e){e>>>=0;const t=Object.create(J.prototype);return t.__wbg_ptr=e,Gt.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Gt.unregister(this),e}free(){const e=this.__destroy_into_raw();c.__wbg_geometryinfodescriptor_free(e,0)}get wkbIndex(){const e=c.__wbg_get_geometryinfodescriptor_wkbIndex(this.__wbg_ptr);return e===16777215?void 0:e}set wkbIndex(e){c.__wbg_set_geometryinfodescriptor_wkbIndex(this.__wbg_ptr,We(e)?16777215:e)}get lngIndex(){const e=c.__wbg_get_geometryinfodescriptor_lngIndex(this.__wbg_ptr);return e===16777215?void 0:e}set lngIndex(e){c.__wbg_set_geometryinfodescriptor_lngIndex(this.__wbg_ptr,We(e)?16777215:e)}get latIndex(){const e=c.__wbg_get_geometryinfodescriptor_latIndex(this.__wbg_ptr);return e===16777215?void 0:e}set latIndex(e){c.__wbg_set_geometryinfodescriptor_latIndex(this.__wbg_ptr,We(e)?16777215:e)}static new(){const e=c.geometryinfodescriptor_new();return J.__wrap(e)}}const Nt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>c.__wbg_parquetchunk_free(s>>>0,1));class Oe{static __wrap(e){e>>>=0;const t=Object.create(Oe.prototype);return t.__wbg_ptr=e,Nt.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Nt.unregister(this),e}free(){const e=this.__destroy_into_raw();c.__wbg_parquetchunk_free(e,0)}size(){return c.parquetchunk_size(this.__wbg_ptr)>>>0}hasField(e){return c.parquetchunk_hasField(this.__wbg_ptr,e)!==0}readX(e){return c.parquetchunk_readX(this.__wbg_ptr,e)}readY(e){return c.parquetchunk_readY(this.__wbg_ptr,e)}readAttributes(e){return D(c.parquetchunk_readAttributes(this.__wbg_ptr,e))}readAttribute(e,t){return D(c.parquetchunk_readAttribute(this.__wbg_ptr,e,t))}}const $t=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>c.__wbg_parquetfile_free(s>>>0,1));let zs=class Us{static __wrap(e){e>>>=0;const t=Object.create(Us.prototype);return t.__wbg_ptr=e,$t.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,$t.unregister(this),e}free(){const e=this.__destroy_into_raw();c.__wbg_parquetfile_free(e,0)}metadata(){const e=c.parquetfile_metadata(this.__wbg_ptr);return ee.__wrap(e)}readChunksWithCallback(e,t){const r=Lt(e,c.__wbindgen_malloc),i=O;return D(c.parquetfile_readChunksWithCallback(this.__wbg_ptr,r,i,m(t)))}updateChunks(e){const t=Lt(e,c.__wbindgen_malloc),r=O;return D(c.parquetfile_updateChunks(this.__wbg_ptr,t,r))}};const Bt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>c.__wbg_rangeproviderjs_free(s>>>0,1));class ne{static __wrap(e){e>>>=0;const t=Object.create(ne.prototype);return t.__wbg_ptr=e,Bt.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Bt.unregister(this),e}free(){const e=this.__destroy_into_raw();c.__wbg_rangeproviderjs_free(e,0)}static new(e,t){const r=c.rangeproviderjs_new(m(e),m(t));return ne.__wrap(r)}static withFetch(){const e=c.rangeproviderjs_withFetch();return ne.__wrap(e)}}async function tn(s,e){if(typeof Response=="function"&&s instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(s,e)}catch(r){if(s.headers.get("Content-Type")=="application/wasm")throw r;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r)}const t=await s.arrayBuffer();return await WebAssembly.instantiate(t,e)}{const t=await WebAssembly.instantiate(s,e);return t instanceof WebAssembly.Instance?{instance:t,module:s}:t}}function Ws(){const s={wbg:{}};return s.wbg.__wbg_new_abda76e883ba8a5f=function(){return m(new Error)},s.wbg.__wbg_stack_658279fe44541cf6=function(e,t){const r=oe(I(t).stack,c.__wbindgen_malloc,c.__wbindgen_realloc),i=O;H().setInt32(e+4,i,!0),H().setInt32(e+0,r,!0)},s.wbg.__wbg_error_f851667af71bcfc6=function(e,t){let r,i;try{r=e,i=t,console.error(X(e,t))}finally{c.__wbindgen_free(r,i,1)}},s.wbg.__wbindgen_object_drop_ref=function(e){D(e)},s.wbg.__wbindgen_is_function=function(e){return typeof I(e)=="function"},s.wbg.__wbg_self_3093d5d1f7bcb682=function(){return j(function(){return m(self.self)},arguments)},s.wbg.__wbg_window_3bcfc4d31bc012f8=function(){return j(function(){return m(window.window)},arguments)},s.wbg.__wbg_globalThis_86b222e13bdf32ed=function(){return j(function(){return m(globalThis.globalThis)},arguments)},s.wbg.__wbg_global_e5a3fe56f8be9485=function(){return j(function(){return m(global.global)},arguments)},s.wbg.__wbindgen_is_undefined=function(e){return I(e)===void 0},s.wbg.__wbg_newnoargs_76313bd6ff35d0f2=function(e,t){return m(new Function(X(e,t)))},s.wbg.__wbindgen_object_clone_ref=function(e){return m(I(e))},s.wbg.__wbindgen_number_new=function(e){return m(e)},s.wbg.__wbg_new_525245e2b9901204=function(){return m(new Object)},s.wbg.__wbindgen_string_new=function(e,t){return m(X(e,t))},s.wbg.__wbg_call_1084a111329e68ce=function(){return j(function(e,t){return m(I(e).call(I(t)))},arguments)},s.wbg.__wbg_call_89af060b4e1523f2=function(){return j(function(e,t,r){return m(I(e).call(I(t),I(r)))},arguments)},s.wbg.__wbg_call_7de908392845a9a5=function(){return j(function(e,t,r,i,n){return m(I(e).call(I(t),I(r),I(i),I(n)))},arguments)},s.wbg.__wbg_valueOf_563b3487b1b116aa=function(e){return I(e).valueOf()},s.wbg.__wbg_set_eacc7d73fefaafdf=function(){return j(function(e,t,r){return Reflect.set(I(e),I(t),I(r))},arguments)},s.wbg.__wbg_buffer_b7b08af79b0b0974=function(e){return m(I(e).buffer)},s.wbg.__wbg_new_b85e72ed1bfd57f9=function(e,t){try{var r={a:e,b:t},i=(n,a)=>{const o=r.a;r.a=0;try{return Ji(o,r.b,n,a)}finally{r.a=o}};return m(new Promise(i))}finally{r.a=r.b=0}},s.wbg.__wbg_resolve_570458cb99d56a43=function(e){return m(Promise.resolve(I(e)))},s.wbg.__wbg_then_95e6edc0f89b73b1=function(e,t){return m(I(e).then(I(t)))},s.wbg.__wbg_then_876bb3c633745cc6=function(e,t,r){return m(I(e).then(I(t),I(r)))},s.wbg.__wbg_new_ea1883e1e5e86686=function(e){return m(new Uint8Array(I(e)))},s.wbg.__wbg_length_8339fcf5d8ecd12e=function(e){return I(e).length},s.wbg.__wbg_set_d1e79e2388520f18=function(e,t,r){I(e).set(I(t),r>>>0)},s.wbg.__wbindgen_throw=function(e,t){throw new Error(X(e,t))},s.wbg.__wbindgen_memory=function(){return m(c.memory)},s.wbg.__wbg_queueMicrotask_48421b3cc9052b68=function(e){return m(I(e).queueMicrotask)},s.wbg.__wbindgen_cb_drop=function(e){const t=D(e).original;return t.cnt--==1?(t.a=0,!0):!1},s.wbg.__wbg_queueMicrotask_12a30234db4045d3=function(e){queueMicrotask(I(e))},s.wbg.__wbg_parquetchunk_new=function(e){return m(Oe.__wrap(e))},s.wbg.__wbindgen_bigint_from_i64=function(e){return m(e)},s.wbg.__wbg_parquetfile_new=function(e){return m(zs.__wrap(e))},s.wbg.__wbg_filemetadata_new=function(e){return m(ee.__wrap(e))},s.wbg.__wbindgen_closure_wrapper1401=function(e,t,r){return m(Xi(e,t,74,Qi))},s}function Gs(s,e){return c=s.exports,Ns.__wbindgen_wasm_module=e,U=null,re=null,se=null,c}function sn(s){if(c!==void 0)return c;s!==void 0&&Object.getPrototypeOf(s)===Object.prototype?{module:s}=s:console.warn("using deprecated parameters for `initSync()`; pass a single object instead");const e=Ws();return s instanceof WebAssembly.Module||(s=new WebAssembly.Module(s)),Gs(new WebAssembly.Instance(s,e),s)}async function Ns(s){if(c!==void 0)return c;s!==void 0&&Object.getPrototypeOf(s)===Object.prototype?{module_or_path:s}=s:console.warn("using deprecated parameters for the initialization function; pass a single object instead");const e=Ws();(typeof s=="string"||typeof Request=="function"&&s instanceof Request||typeof URL=="function"&&s instanceof URL)&&(s=fetch(s));const{instance:t,module:r}=await tn(await s,e);return Gs(t,r)}const rn=Object.freeze(Object.defineProperty({__proto__:null,FieldMetadata:Ee,FileMetadata:ee,GeometryInfoDescriptor:J,ParquetChunk:Oe,ParquetFile:zs,RangeProviderJs:ne,default:Ns,enableTracing:Zi,initSync:sn,readFile:en,readMetadata:Ls},Symbol.toStringTag,{value:"Module"}));let Ge=null;async function $s(){return Ge||(Ge=nn()),Ge}async function nn(){const s=await Promise.resolve().then(()=>rn);return await s.default({module_or_path:nr("esri/libs/parquet/pkg/arcgis_parquet_bg.wasm")}),s.enableTracing(),s}const Bs=s=>async function(e,t,r){const i=s(),{data:n}=await tt(e,{responseType:"array-buffer",query:i,headers:{range:`bytes=${t}-${r}`}});return n},Vs=s=>async function(e){const t=s(),{data:r}=await tt(e,{responseType:"native",method:"head",query:t}),i=r.headers.get("Content-Length");if(i==null)throw new Error("Unable to parse content length");return parseInt(i,10)};class ve{static async create(e,t){const r=await $s(),i=await r.readMetadata(e,Bs(t),Vs(t));return ve.fromFileMetadata(i)}static fromFileMetadata(e){const t=[];for(let r=0;r65535&&console.error("Exceeded max allowed parquet reader size")}destroy(){super.destroy(),this._inner.free()}get fields(){return this._fields}get geometryType(){return"esriGeometryPoint"}get hasFeatures(){return!0}get hasNext(){throw new Error("Method not implemented.")}get exceededTransferLimit(){return!1}get hasZ(){return!1}get hasM(){return!1}getInTransform(){return null}getSize(){return this._size}getCursor(){return this.copy()}getAttributeHash(){let e="";for(const t of this.fields.fields)e+=this._readAttribute(t.name,!1)+".";return e}getObjectId(){return this._objectIdFieldIndex!=null?this._inner.readAttribute(this._index,this._objectIdFieldIndex):this._index<<16|this._chunkId}getDisplayId(){return this._displayIds[this._index]}setDisplayId(e){this._displayIds[this._index]=e}setIndex(e){this._index=e}getIndex(){return this._index}next(){for(;++this._index{const n=Array.from(r).map(a=>i.metadata.getFieldIndex(a));return i.inner.updateChunks(new Uint16Array(n))}))}async load(e){return this._promise==null&&(this._promise=this._download()),this._promise}unload(e){}async addParquetFile(e){this._insert(e)}async _insert(e){const t=await gt.create(e,{geometryInfo:this._service.geometryInfo,outSpatialReference:this._service.outSpatialReference,getCustomParameters:()=>this._schema.mutable.dataFilter.customParameters}),{geometryInfo:r}=this._service;Z(this._options);const{fields:i,timeZoneByFieldName:n}=this._service.metadata.fieldsIndex,a=i.map(u=>({...u,index:t.metadata.getFieldIndex(u.name)})),o=de.fromJSON({fields:a,timeZoneByFieldName:n}),d=new Uint16Array(Array.from(this._availableFields.values()).map(u=>o.get(u)?.index));await t.inner.readChunksWithCallback(d,u=>{const h=this._chunkId++,l=new an(this._metadata,o,r,u,h),p=new xe(l,null,h,!1);this._store.insert(p)}),this._files.push(t)}async _download(){try{await Promise.all(this._service.source.urls.map(t=>this._insert(t)));const e=new xe(q.empty(this._metadata),null,-1,!0);this._store.insert(e)}catch(e){throw console.error(e),e}}}class dn extends Ps{constructor(e,t,r,i,n,a){super(e,t,r,n,a),this._random=new Jt(1e3),this._featureCount=i}get about(){return{willQueryAllFeatures:!0,willQueryFullResolutionGeometry:!0}}load(e){return this._promise==null&&(this._promise=this._downloadPages(this._featureCount)),this._promise}unload(e){}async _downloadPages(e){const t=Math.ceil(e/this._queryInfo.pageSize),r=Array.from({length:t},(o,d)=>d).sort((o,d)=>this._random.getInt()-this._random.getInt()),i=await Promise.all(r.map(o=>this._downloadPage(o))),n=new xe(q.empty(this._metadata),null,-1,!0);this._store.insert(n);const a=i.filter(o=>o);if(a.length)throw new W("featurelayer-query","Encountered errors when downloading data",{errors:a})}async _downloadPage(e){try{const t=this._queryInfo.createPagedQuery(e),r=await this._fetch(t,this._options),i=new xe(r,t.inner.toJSON(),e,!1);return Z(this._options),this._store.insert(i),null}catch(t){return t}}}const un="__esri_stream_id__",Vt="__esri_timestamp__",Yt=1e3;class cn{constructor(e,t,r,i,n=128){this._trackIdToObservations=new Map,this._idCounter=0,this._lastPurge=performance.now(),this._addOrUpdated=new Map,this._removed=[],this._maxAge=0,this._timeInfo=r,this._purgeOptions=i,this.store=e,this.objectIdField=t,this.purgeInterval=n,this._useGeneratedIds=this.objectIdField===un}removeById(e){this._removed.push(e)}removeByTrackId(e){const t=this._trackIdToObservations.get(e);if(t)for(const r of t.entries)this._removed.push(r)}add(e){if(this._useGeneratedIds){const a=this._nextId();e.attributes[this.objectIdField]=a,e.objectId=a}else e.objectId=e.attributes[this.objectIdField];const t=e.objectId;if(this._addOrUpdated.set(t,e),this._maxAge=Math.max(this._maxAge,e.attributes[this._timeInfo.startTimeField]),!this._timeInfo.trackIdField)return this._trackIdLessObservations==null&&(this._trackIdLessObservations=new xt(1e5)),void this._trackIdLessObservations.enqueue(t);const r=e.attributes[this._timeInfo.trackIdField];if(!this._trackIdToObservations.has(r)){const a=this._purgeOptions?.maxObservations!=null?this._purgeOptions.maxObservations:Yt,o=ar(a,0,Yt);this._trackIdToObservations.set(r,new xt(o))}const i=this._trackIdToObservations.get(r),n=i?.enqueue(t);n!=null&&(this._addOrUpdated.has(n)?this._addOrUpdated.delete(n):this._removed.push(n))}checkForUpdates(){const e=this._getToAdd(),t=this._getToRemove(),r=performance.now();r-this._lastPurge>=this.purgeInterval&&(this._purge(r),this._lastPurge=r);const i=[];if(t!=null)for(const a of t){const o=this.store.removeById(a);o!=null&&i.push(o)}const n=[];if(e!=null){const a=new Set(t??[]);for(const o of e)a.has(o.objectId)||(o.attributes[Vt]=r,this.store.add(o),n.push(o))}return!(!n.length&&!i?.length)&&(this.store.update(n,i),!0)}_getToAdd(){if(!this._addOrUpdated.size)return null;const e=new Array(this._addOrUpdated.size);let t=0;return this._addOrUpdated.forEach(r=>e[t++]=r),this._addOrUpdated.clear(),e}_getToRemove(){const e=this._removed;return this._removed.length?(this._removed=[],e):null}_nextId(){const e=this._idCounter;return this._idCounter=(this._idCounter+1)%4294967294+1,e}_purge(e){const t=this._purgeOptions;t!=null&&(this._purgeSomeByDisplayCount(t),this._purgeByAge(t),this._purgeByAgeReceived(e,t),this._purgeTracks())}_purgeSomeByDisplayCount(e){if(!e.displayCount)return;let t=this.store.size;if(t>e.displayCount){if(this._timeInfo.trackIdField){for(const r of this._trackIdToObservations.values())if(t>e.displayCount&&r.size){const i=r.dequeue();this._removed.push(i),t--}}if(this._trackIdLessObservations!=null){let r=t-e.displayCount;for(;r-- >0;){const i=this._trackIdLessObservations.dequeue();i!=null&&this._removed.push(i)}}}}_purgeByAge(e){const t=this._timeInfo?.startTimeField;if(!e.age||!t)return;const r=60*e.age*1e3,i=this._maxAge-r;this.store.forEach(n=>{n.attributes[t]{i.attributes[Vt]{e.size===0&&this._trackIdToObservations.delete(t)})}}let B=class extends Ht{constructor(s){super(s)}get connectionStatus(){return this.connection?.connectionStatus}get errorString(){return this.connection?.errorString}};V([ge()],B.prototype,"connection",void 0),V([ge()],B.prototype,"connectionStatus",null),V([ge()],B.prototype,"errorString",null),B=V([Xt("esri.views.2d.layers.features.sources.StreamConnectionState")],B);let ln=class{constructor(s,e){this._metadata=s,this._onUpdate=e,this._objectIdToFeature=new Map}get size(){return this._objectIdToFeature.size}get reader(){return q.fromFeatures([...this._objectIdToFeature.values()],this._metadata)}add(s){this._objectIdToFeature.set(s.objectId,s)}forEach(s){this._objectIdToFeature.forEach(s)}removeById(s){const e=this._objectIdToFeature.get(s);return e?(this._objectIdToFeature.delete(s),e):null}clear(){this._objectIdToFeature=new Map}update(s,e){this._onUpdate(s?.length??0)}};class hn extends ue{constructor(e){super(),this._reader=e,this.chunkId="stream-chunk",this.normalizedChunkId="stream-chunk"}get reader(){return this._reader}get first(){return!0}get end(){return!0}get queryInfo(){return{type:"stream",chunkId:this.chunkId,size:this.size(),end:this.end}}get isTiled(){return!1}getTileReader(e){const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}class _n extends pt{constructor(e,t,r,i,n){super(r),this._service=e,this._dataFilter=t,this._streamOptions=i,this._metadata=n,this._connectionState=new B,this._forceRefresh=!1,this.events=new st;const{objectIdField:a,timeInfo:o}=this._metadata,{purgeOptions:d}=t;this._stagingStore=new ln(this._metadata,u=>this.events.emit("features-updated",u)),this._manager=new cn(this._stagingStore,a,o,d),this.connect()}destroy(){super.destroy(),this.disconnect()}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}get connectionStatus(){return this._connectionState.connectionStatus}get errorString(){return this._connectionState?.errorString}async refresh(){const e=this._chunk!=null;this._manager.checkForUpdates()||!e||this._forceRefresh?(this._chunk&&this._store.remove(this._chunk),this._forceRefresh=!1,this._chunk=new hn(this._stagingStore.reader),this._store.insert(this._chunk),this.events.emit("tick")):this.events.emit("tick")}async updateFields(e){throw new Error("Updating available fields not supported for StreamLayer")}async load(e){}unload(e){}disconnect(){this._connection=Zt(this._connection),this._connectionState.connection=null,this._handlesGroup?.remove()}connect(){if(this._connection!=null)return;const{geometryType:e,spatialReference:t}=this._metadata,{maxReconnectionAttempts:r,maxReconnectionInterval:i,geometryDefinition:n,definitionExpression:a,customParameters:o}=this._dataFilter;this._connection=Ur(this._service.source,t,this._streamOptions.outSR,e,a,n,r,i,o),this._handlesGroup=Se([this._connection.on("data-received",d=>this._onFeature(d)),this._connection.on("message-received",d=>this._onWebSocketMessage(d))]),this._connectionState.connection=this._connection}clear(){this._manager.checkForUpdates(),this._stagingStore.clear(),this._forceRefresh=!0}updateCustomParameters(e){this._connection?.updateCustomParameters(e)}sendMessageToSocket(e){this._connection?.sendMessageToSocket(e)}sendMessageToClient(e){this._connection?.sendMessageToClient(e)}_onWebSocketMessage(e){if("type"in e)switch(e.type){case"delete":if(e.objectIds)for(const t of e.objectIds)this._manager.removeById(t);if(e.trackIds)for(const t of e.trackIds)this._manager.removeByTrackId(t);break;case"clear":this.clear()}this.events.emit("message-received",e)}_onFeature(e){try{this._manager.add(e),this.events.emit("data-received",e)}catch{}}}class pn{constructor(e){this._onChange=e,this._chunks=new Map,this._chunksToRemove=[],this.events=new st,this.featureAdapter=new mr}destroy(){this.clear()}clear(){for(const e of this._chunks.values())this._chunksToRemove.push(e);this._chunks.clear(),this._localEditChunk!=null&&this._chunksToRemove.push(this._localEditChunk),this._localEditChunk=null}*chunks(){this._localEditChunk&&(yield this._localEditChunk),this._localOverridesChunk&&(yield this._localOverridesChunk),yield*this._chunks.values()}dataChunks(){return this._chunks.values()}insert(e){w("esri-2d-update-debug")&&console.debug(`Chunk[${e.chunkId}] SourceChunkStore.insert`),this._localOverridesChunk?.overriddenIds.size&&(e.reader.removeIds(this._localOverridesChunk.overriddenIds),e.invalidate()),this._localEditChunk?.overriddenIds.size&&this._localEditChunk.removeOverrides(e),this._chunks.set(e.chunkId,e),this.events.emit("changed"),this._onChange()}remove(e){w("esri-2d-update-debug")&&console.debug(`Chunk[${e.chunkId}] SourceChunkStore.remove`),this._chunks.delete(e.chunkId),this._chunksToRemove.push(e)}cleanupRemovedChunks(){const e=this._chunksToRemove;return this._chunksToRemove=[],e}applyLocalOverrides(e,t){this._localOverridesChunk==null&&(this._localOverridesChunk=new Je(t,"localOverride")),this._localOverridesChunk.applyOverrides(e);for(const r of this._chunks.values())r.reader.removeIds(this._localOverridesChunk.overriddenIds),r.invalidate();this.events.emit("changed")}applyLocalEdit(e,t){this._localEditChunk==null&&(this._localEditChunk=new Je(t,"localEdit")),this._localEditChunk.applyOverrides(e);for(const r of this._chunks.values())r.reader.removeIds(this._localEditChunk.overriddenIds),r.invalidate();this.events.emit("changed")}forEach(e){const t=new Set;for(const r of this.chunks()){const i=r.reader.getCursor();for(;i.next();){const n=i.getObjectId();t.has(n)||(e(i.copy()),t.add(n))}}}forEachUnsafe(e){const t=new Set;for(const r of this.chunks()){const i=r.reader.getCursor();for(;i.next();){const n=i.getObjectId();t.has(n)||(e(i),t.add(n))}}}forEachInBounds(e,t){const r=new Set;for(const i of this.chunks()){const n=i.queryFeaturesInBounds(e);for(;n.next();){const a=n.getObjectId();r.has(a)||(t(n.copy()),r.add(a))}}}forEachBounds(e,t){const r=rt();for(const i of e)i.getBounds(r)&&t(r)}}class gn{constructor(e,t,r,i,n){this.service=e,this._aggregateAdapter=t,this._subscriptions=r,this._onChange=i,this._connection=n,this._updateTracking=new Wr({debugName:"FeatureSource"}),this._didInvalidateData=!1,this._store=new pn(this._onChange),this._metadata=ot.createFeature(e.metadata)}destroy(){this._strategy?.destroy(),this._store.destroy(),this._streamMessenger?.destroy(),this.service.type==="memory"&&this.service.source.map(e=>e.close())}get metadata(){if(!this._metadata)throw new Error("InternalError: Metadata not defined. Was update called?");return this._metadata}get store(){return this._store}get streamMessenger(){return this._streamMessenger==null&&this._initStreamMessenger(),this._streamMessenger}get statistics(){return Fi.from(this._store)}get updateTracking(){return this._updateTracking}get queryEngine(){if(!this._queryEngine){if(!this._schema)return null;const{dataFilter:e}=this._schema.mutable,t=this._schema.mutable.availableFields,r=this._metadata;this._queryEngine=new as({featureStore:this._store,fieldsIndex:r.fieldsIndex,geometryType:r.geometryType,objectIdField:r.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.service.outSpatialReference,aggregateAdapter:this._aggregateAdapter,timeInfo:r.timeInfo,definitionExpression:e.definitionExpression,availableFields:t})}return this._queryEngine}get isStream(){return this._schema.type==="stream"}chunks(){return Array.from(this._store.chunks())}cleanupRemovedChunks(){return this._store.cleanupRemovedChunks()}onSubscribe(e){this._connection.onEvent({type:"subscribe",tile:e.tile.id});const t=this._strategy?.load(e);t&&(t.then(()=>this._connection.onEvent({type:"loaded",tile:e.tile.id})).catch(r=>this._connection.onEvent({type:"error",tile:e.tile.id,error:r})),this._updateTracking.addPromise(t))}onResume(e){this._updateTracking.addPromise(Qt(this._strategy?.load(e)))}onUnsubscribe(e){this._connection.onEvent({type:"unsubscribe",tile:e.tile.id}),this._strategy?.unload(e)}getLocalEdit(e){return this._updateTracking.addPromise(this._getGetLocalEdit(e))}applyLocalEdit(e){this._didInvalidateData=!0,this._store.applyLocalEdit(e,this.metadata)}async update(e,t){const r=e.source,i=Kt(this._schema?.mutable,r.mutable);if(!i)return!1;if(w("esri-2d-update-debug")&&console.debug(`Version[${t}] FeatureSource.update`,{changes:i}),this._schema=r,this._queryEngine?.destroy(),this._queryEngine=null,this.service.type==="feature-service"&&this.service.queryMetadata.lastEditDate!=null&&(this._lastEditDate=this.service.queryMetadata.lastEditDate),this._streamMessenger==null&&this._schema.type==="stream"&&this._initStreamMessenger(),mt(i,"sourceRefreshVersion")&&this._strategy?.refresh)return await this._strategy.refresh(),!0;if((r.type==="feature"||r.type==="parquet")&&mt(i,"availableFields")){if(await this._queryLastEditDateChanged()||this._didInvalidateData)this._didInvalidateData=!1,await this._updateStrategy(t);else{this._connection.onEvent({type:"updateFieldsStart"});try{await this._strategy.updateFields(r.mutable.availableFields),this._connection.onEvent({type:"updateFieldsEnd"})}catch(n){this._connection.onEvent({type:"updateFieldsError",error:n})}}return!1}return!(!bt(i,"dataFilter")&&!bt(i,"sourceRefreshVersion"))&&(await this._updateStrategy(t),!0)}async addParquetFile(e){this._strategy.addParquetFile(e)}_initStreamMessenger(){this._streamMessenger==null&&(this._streamMessenger=new ye(this._connection))}async _getGetLocalEdit(e){if(e.historicMoment&&this._schema.type==="feature"&&(this._schema.mutable.dataFilter.historicMoment=e.historicMoment,this._strategy.unsafeSetQueryHistoricMoment(new Date(e.historicMoment))),e.type==="edit-by-feature"){const i=[...e.added,...e.updated].map(n=>Y.fromJSON(n,this.metadata.objectIdField));return{reader:q.fromOptimizedFeatures(i,this.metadata),removed:this._resolveIdentifiers(e.removed)}}const t=this._resolveIdentifiers(e.removed);if(!e.updated.length&&!e.added.length)return{reader:q.empty(this.metadata),removed:t};const r=this._resolveIdentifiers([...e.added,...e.updated]);return{reader:await this._strategy.queryByObjectId(r),removed:t}}_resolveIdentifiers(e){const t=[],r=[];for(const i of e)i.objectId!=null&&i.objectId!==-1?r.push(i.objectId):t.push(i.globalId);if(t.length){const i=new Set(t),n=this.metadata.globalIdField;if(n==null)throw new Error("InternalError: Recieved an edit with globalIds, but not supported by the service");this._store.forEachUnsafe(a=>{const o=a.readAttribute(n);i.has(o)&&r.push(a.getObjectId())})}return r}async _queryLastEditDateChanged(){if(this._lastEditDate==null)return!1;const e=this.service.source,t={...e.query,f:"json"},r=(await tt(e.path,{query:t,responseType:"json"})).data.editingInfo.lastEditDate;return r!==this._lastEditDate&&(this._lastEditDate=r,!0)}async _createStrategy(){const e="isSourceHosted"in this.service&&this.service.isSourceHosted,t=Array.isArray(this.service.source),r=this.service.source&&"collection"in this.service.source,i=e||t||r;if(this._schema.type==="stream"){const d=new _n(this.service,this._schema.mutable.dataFilter,this._store,{outSR:this.service.outSpatialReference},this.metadata);return this._streamMessenger.strategy=d,d}if(this._schema.type==="parquet"){const d=this.service;return new on(d,this._metadata,this._schema,this._store)}const n=this.service,a=Ci.fromSchema(n,this._schema,this._metadata),o=await this._supportSnapshotMode(n,a);return o?new dn(n,a,this._store,o.featureCount,this.metadata,this._connection):i?new Vi(n,a,this._store,this.metadata,this._connection):new $i(n,a,this._store,this.metadata,this._connection)}async _updateStrategy(e){const t=await this._createStrategy();this._connection.onEvent({type:"updateStrategyStart",about:t.about});const r=!!this._strategy;this._store.clear(),this._strategy?.destroy(),this._strategy=t,w("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureSource.updateStrategy`,{strategy:t});const i=Array.from(this._subscriptions.values());if(!i.length)return void this._connection.onEvent({type:"updateStrategyEnd"});const n=Promise.all(i.map(a=>this._strategy.load(a).then(()=>this._connection.onEvent({type:"loaded",tile:a.tile.id})).catch(o=>this._connection.onEvent({type:"error",tile:a.tile.id,error:o}))));this._updateTracking.addPromise(n);try{r&&await n}catch(a){et(a)}this._connection.onEvent({type:"updateStrategyEnd"}),w("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureSource.updateStrategyEnd`,{strategy:t})}async _supportSnapshotMode(e,t){const{queryMetadata:r}=e,i=r.snapshotInfo;if(!i||!i.supportsSnapshotMinThreshold||!i.snapshotCountThresholds)return null;const n=e.source,a=t.createQuery();a.inner.orderByFields=[],a.inner.returnGeometry=!1;const o=(await Rr(n,a.inner,{query:a.customParameters})).data.count,{min:d,max:u}=i.snapshotCountThresholds;return o<=d||i.supportsSnapshotMaxThreshold&&othis._processor.getFeatureObjectIdsForAggregate(e)},this._subscriptions=new Map,this._updateRequested=!1,this._updateSubscriptionRequests=[],this._updateHighlightRequests=[]}destroy(){this._subscriptions.clear(),this._processor?.destroy(),this._source?.destroy(),this._handles?.remove(),this._updateLocalEditsRequest=null,this._tileInfoView=null}onAttach(e){w("esri-2d-update-debug")&&console.debug("Pipeline.onAttach");const t=this._connection,r=hr.fromJSON(e.tileInfoJSON);this._tileInfoView=new _r(r),this._source=new gn(e.service,this._aggregateAdapter,this._subscriptions,()=>this._requestUpdate(),t),this._processor=new Si(t,this._source),this._handles=Se([Ne(()=>this._source.updateTracking.updating,()=>{this._requestUpdate(),Qt(this._connection.layerView.setUpdating({data:this._source.updateTracking.updating,pipeline:!0}))})])}onDetach(){w("esri-2d-update-debug")&&console.debug("Pipeline.onDetach"),this.destroy()}set remoteClient(e){this._connection=new Gr(e)}get features(){const e=this._source?.queryEngine;if(!e)throw new W("no-queryEngine","No query engine defined");return e}get aggregates(){const e=this._processor?.aggregateQueryEngine;if(!e)throw new W("no-queryEngine","No aggregate query engine defined");return e}get processor(){return this._processor}get streamMessenger(){return this._source.streamMessenger}getDisplayFeatures(e){return this._processor.getDisplayFeatures(e)}getDisplayIds(e){return this._processor.getDisplayIds(e)}async updateSchema(e,t){return w("esri-2d-update-debug")&&this._updateSchemaRequest&&console.error("InternalError: Schema already updating"),this._updateSchemaRequest=new pe({schema:e,version:t}),this._requestUpdate(),this._updateSchemaRequest.resolver.promise}updateSubscriptions(e){const t=new pe(e);return this._updateSubscriptionRequests.push(t),this._requestUpdate(),t.resolver.promise}updateHighlight(e){const t=new pe(e);return this._updateHighlightRequests.push(t),this._requestUpdate(),t.resolver.promise}async addParquetFile(e){return this._source.addParquetFile(e)}async onEdits(e){if(this._updateLocalEditsRequest!=null)throw new W("InternalError - Already processing an edit");this._updateLocalEditsRequest=new pe(e);const t=this._updateLocalEditsRequest.resolver.promise;return this._requestUpdate(),t}queryStatistics(){return this._source.statistics.toJSON()}async queryVisibleFeatures(e,t){return this.features.executeQuery(e,t)}async queryHeatmapStatistics(e){const t=Math.round(Qs(e.radius));let r=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const n=typeof e.fieldOffset=="string",a=e.fieldOffset??0,o=Array.from(this._subscriptions.values()),d=this._source.chunks(),u=t**2,h=3/(Math.PI*u),l=2*t,p=Math.ceil(T/l);for(const g of o){const _=g.tile,f=new Float64Array(p*p);for(const y of d){const v=y.getTileReader(_);if(!v)continue;const b=v.getCursor();for(;b.next();){let F=1;if(e.field!=null){const R=b.readAttribute(e.field);F=n?-1*+R:+R+a}const C=b.readXForDisplay()/l,x=b.readYForDisplay()/l,S=Math.floor(C),k=Math.floor(x);if(S<0||k<0||S>=p||k>=p)continue;const E=((.5+S-C)*l)**2+((.5+k-x)*l)**2;if(E>u)continue;const L=F*(h*(1-E/u)**2);f[k+S*p]+=L}}for(let y=0;yd+u.size(),0)<=e.minFeatureCount){if(!this._source.updateTracking.updating){const d=[];return this._source.store.forEachUnsafe(u=>d.push(u.readLegacyFeatureWorldSpace())),d}return null}const r=new Set,i=[],n=t.map(d=>d.reader.getCursor()),a=new Jt,o=3*e.sampleSize;for(let d=0;d=e.sampleSize?i:null}_requestUpdate(){this._updateRequested||(this._updateRequested=!0,Zs(()=>this._scheduleNextUpdate()))}_scheduleNextUpdate(){this._updateRequested&&(this._ongoingUpdate||(this._ongoingUpdate=it(this._doUpdate()).finally(()=>{this._ongoingUpdate=null,this._scheduleNextUpdate()}),this._updateRequested=!1))}_subscribe(e){const t=e.tileId;if(this._subscriptions.has(t))return;w("esri-2d-update-debug")&&console.debug(`Tile[${t}] Pipeline.subscribe`);const r=new pr(this._tileInfoView,t),i=new fn(r,e.version);this._subscriptions.set(t,i),this._source.onSubscribe(i),this._processor.onSubscribe(i)}_unsubscribe(e){const t=this._subscriptions.get(e);t&&(w("esri-2d-update-debug")&&console.debug(`Tile[${e}] Pipeline.unsubscribe`),t.abort(),this._source.onUnsubscribe(t),this._processor.onUnsubscribe(t),this._subscriptions.delete(t.key.id))}async _doUpdate(){if(w("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateStart"),await this._connection.layerView.setUpdating({data:this._source.updateTracking.updating,pipeline:!0}),this._updateSubscriptionRequests.length){const i=this._updateSubscriptionRequests;this._updateSubscriptionRequests=[];for(const n of i)this._doUpdateSubscriptions(n.inner),n.resolver.resolve()}const e=this._updateSchemaRequest;if(this._updateSchemaRequest=null,e!=null){const{schema:i,version:n}=e.inner;await this._doUpdateSchema(i,n)}const t=this._updateLocalEditsRequest;if(this._updateLocalEditsRequest=null,t!=null){w("esri-2d-update-debug")&&console.debug("Pipeline.applyEditOverride",t.inner);const i=await this._source.getLocalEdit(t.inner);await this._processor.applyLocalEdit(i),this._source.applyLocalEdit(i),w("esri-2d-update-debug")&&console.debug("Pipeline.endEditOverride",t.inner)}if(this._updateHighlightRequests.length){const i=this._updateHighlightRequests;this._updateHighlightRequests=[];for(const n of i)this._processor.updateHighlight(n.inner),n.resolver.resolve()}const r=this._source.cleanupRemovedChunks();this._processor.removeChunks(r);try{this._subscriptions.size&&(w("esri-2d-update-debug")&&console.debug("Pipeline.updateChunksStart"),await this._processor.updateChunks(),w("esri-2d-update-debug")&&console.debug("Pipeline.updateChunksEnd"))}catch(i){et(i)}t?.resolver.resolve(),e?.resolver.resolve(),this._updateRequested?(w("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateEnd [updateRequested=true]"),await this._connection.layerView.setUpdating({data:this._source.updateTracking.updating,pipeline:!0})):(w("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateEnd [updateRequested=false, After flush]"),await this._connection.layerView.setUpdating({data:this._source.updateTracking.updating,pipeline:this._updateRequested}))}async _doUpdateSchema(e,t){w("esri-2d-update-debug")&&console.debug(`Version[${t}] Pipeline.updateStart`,{schema:e});const r={tileInfo:this._tileInfoView?.tileInfo},i=await this._source.update(e,t),n=Array.from(this._subscriptions.values());await this._processor.update(e,t,r,i,n),w("esri-2d-update-debug")&&console.debug(`Version[${t}] Pipeline.updateEnd`)}_doUpdateSubscriptions(e){w("esri-2d-update-debug")&&console.debug("Pipeline.updateSubscriptions",e);for(const t of e.subscribe)this._subscribe(t);for(const t of e.unsubscribe)this._unsubscribe(t)}}export{to as default};
diff --git a/fix-191/assets/FeatureReductionLayer-BTZjL0_Z-BuJtD3jW.js b/fix-191/assets/FeatureReductionLayer-BTZjL0_Z-BuJtD3jW.js
deleted file mode 100644
index d4151632..00000000
--- a/fix-191/assets/FeatureReductionLayer-BTZjL0_Z-BuJtD3jW.js
+++ /dev/null
@@ -1 +0,0 @@
-import{aa as te,e as j,v as n,S as o,i as g,bz as M,bL as B,ab as K,dN as f,ac as _,a0 as x,e8 as ie,K as J,P as p,dK as O,ah as re,av as se,e0 as ne,o as oe,a1 as ae}from"./story-DULt3Rma.js";import{G as le,y as R,h as ue}from"./UniqueValueRenderer-fS5V0Ej1-BykZGEgA.js";import{m as U,o as F,p as $}from"./jsonUtils-C64Zfu7c-DhKY2SjZ.js";import{Y as X,X as D,s as pe}from"./commonProperties-BtIqvFU_-CfGSai59.js";import{e as S,c as k}from"./FeatureReductionSelection-BjX3h7Sz-B4a-3Q-d.js";import{p as H}from"./featureLayerUtils-DgfQQyK4-3epgQor7.js";import{C as P}from"./labelingInfo-DGVNul26-DjgpGBtD.js";import{k as Q}from"./MD5-CHHr-oed-SuyrCYQ0.js";let v=class extends te(j){constructor(i){super(i),this.expression=null,this.title=null,this.returnType=null}};n([o({type:String,json:{write:!0}})],v.prototype,"expression",void 0),n([o({type:String,json:{write:!0}})],v.prototype,"title",void 0),n([o({type:String,json:{write:!0}})],v.prototype,"returnType",void 0),v=n([g("esri.layers.support.ExpressionInfo")],v);const C=v;var V;let c=V=class extends j{constructor(i){super(i),this.isAutoGenerated=!1,this.name=null,this.alias=null,this.onStatisticField=null,this.onStatisticExpression=null,this.statisticType=null}clone(){return new V({name:this.name,alias:this.alias,isAutoGenerated:this.isAutoGenerated,onStatisticExpression:p(this.onStatisticExpression),onStatisticField:this.onStatisticField,statisticType:this.statisticType})}};n([o({type:Boolean,json:{write:!0}})],c.prototype,"isAutoGenerated",void 0),n([o({type:String,json:{write:!0}})],c.prototype,"name",void 0),n([o({type:String,json:{write:!0}})],c.prototype,"alias",void 0),n([o({type:String,json:{write:!0}})],c.prototype,"onStatisticField",void 0),n([o({type:C,json:{write:!0}})],c.prototype,"onStatisticExpression",void 0),n([o({type:String,json:{write:!0}})],c.prototype,"statisticType",void 0),c=V=n([g("esri.layers.support.AggregateField")],c);const m=c;var z;let u=z=class extends S{constructor(i){super(i),this.type="binning",this.binType="geohash",this.fixedBinLevel=null,this.labelingInfo=null,this.labelsVisible=!0,this.maxScale=0,this.popupEnabled=!0,this.popupTemplate=null,this.size=f("12px"),this.fields=[],this.renderer=null}writeFields(i,s,e){const t=i.filter(r=>r.statisticType!=="avg_angle").map(r=>r.toJSON());O(e,t,s)}readRenderer(i,s,e){const t=s.drawingInfo?.renderer;return t?F(t,s,e)??void 0:H(s,e)}clone(){return new z({fields:p(this.fields),fixedBinLevel:this.fixedBinLevel,labelingInfo:p(this.labelingInfo),labelsVisible:this.labelsVisible,maxScale:this.maxScale,popupEnabled:this.popupEnabled,popupTemplate:p(this.popupTemplate),renderer:p(this.renderer),binType:p(this.binType),size:this.size})}};n([M({binning:"binning"})],u.prototype,"type",void 0),n([M({geohash:"geohash",square:"square"}),o({type:["geohash","square"]})],u.prototype,"binType",void 0),n([o({type:Number,json:{write:!0}})],u.prototype,"fixedBinLevel",void 0),n([o({type:[P],json:{read:{source:"drawingInfo.labelingInfo"},write:{target:"drawingInfo.labelingInfo"}}})],u.prototype,"labelingInfo",void 0),n([o(X)],u.prototype,"labelsVisible",void 0),n([o({type:Number,json:{default:0,name:"visibilityInfo.maxScale"}})],u.prototype,"maxScale",void 0),n([o(D)],u.prototype,"popupEnabled",void 0),n([o({type:B,json:{name:"popupInfo",write:!0}})],u.prototype,"popupTemplate",void 0),n([o({cast:i=>i==="auto"?i:K(f(i))})],u.prototype,"size",void 0),n([o({type:[m],json:{write:!0}})],u.prototype,"fields",void 0),n([_("fields")],u.prototype,"writeFields",null),n([o({types:U,json:{write:{target:"drawingInfo.renderer"}}})],u.prototype,"renderer",void 0),n([x("renderer",["drawingInfo.renderer"])],u.prototype,"readRenderer",null),u=z=n([g("esri.layers.support.FeatureReductionBinning")],u);const Z=u;var T;function L(i){return i.type==="simple"&&!i.visualVariables?.length}let l=T=class extends j{constructor(i){super(i),this.type="cluster",this.clusterRadius=f("80px"),this.clusterMinSize=f("12px"),this.clusterMaxSize=f("50px"),this.maxScale=0,this.popupEnabled=!0,this.popupTemplate=null,this.renderer=null,this.symbol=null,this.labelingInfo=null,this.labelsVisible=!0,this.fields=[]}readRenderer(i,s,e){const t=s.drawingInfo?.renderer;return t?.authoringInfo?.isAutoGenerated?null:t?L(t)?null:F(t,s,e)??void 0:H(s,e)}readSymbol(i,s,e){const t=s.drawingInfo?.renderer;return t?.authoringInfo?.isAutoGenerated?null:t&&L(t)?F(t,s,e)?.symbol:null}writeSymbol(i,s,e,t){const r=this.renderer?.authoringInfo?.isAutoGenerated;if(!this.renderer||r){const a=new $({symbol:i});s.drawingInfo={renderer:a.write({},t)}}}writeFields(i,s,e){const t=i.filter(r=>r.statisticType!=="avg_angle").map(r=>r.toJSON());O(e,t,s)}readFields(i,s,e){return i.filter(t=>!t.isAutoGenerated).map(t=>m.fromJSON(t))}clone(){return new T({clusterRadius:this.clusterRadius,clusterMinSize:this.clusterMinSize,clusterMaxSize:this.clusterMaxSize,labelingInfo:p(this.labelingInfo),labelsVisible:this.labelsVisible,fields:p(this.fields),maxScale:this.maxScale,renderer:p(this.renderer),symbol:p(this.symbol),popupEnabled:this.popupEnabled,popupTemplate:p(this.popupTemplate)})}};n([o({type:["cluster"],readOnly:!0,json:{write:!0}})],l.prototype,"type",void 0),n([o({cast:i=>i==="auto"?i:K(f(i)),json:{write:!0}})],l.prototype,"clusterRadius",void 0),n([o({type:Number,cast:f,json:{write:!0}})],l.prototype,"clusterMinSize",void 0),n([o({type:Number,cast:f,json:{write:!0}})],l.prototype,"clusterMaxSize",void 0),n([o({type:Number,json:{default:0,name:"visibilityInfo.maxScale"}})],l.prototype,"maxScale",void 0),n([o(D)],l.prototype,"popupEnabled",void 0),n([o({type:B,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],l.prototype,"popupTemplate",void 0),n([o({types:U,json:{write:{target:"drawingInfo.renderer"}}})],l.prototype,"renderer",void 0),n([x("renderer",["drawingInfo.renderer"])],l.prototype,"readRenderer",null),n([o({types:ie})],l.prototype,"symbol",void 0),n([x("symbol",["drawingInfo.renderer"])],l.prototype,"readSymbol",null),n([_("symbol")],l.prototype,"writeSymbol",null),n([o({type:[P],json:{read:{source:"drawingInfo.labelingInfo"},write:{target:"drawingInfo.labelingInfo"}}})],l.prototype,"labelingInfo",void 0),n([o(X)],l.prototype,"labelsVisible",void 0),n([o({type:[m],json:{write:!0}})],l.prototype,"fields",void 0),n([_("fields")],l.prototype,"writeFields",null),n([x("fields")],l.prototype,"readFields",null),l=T=n([g("esri.layers.support.FeatureReductionCluster")],l);const W=l,N={key:"type",base:S,typeMap:{cluster:W,binning:Z}},de={types:{key:"type",base:S,typeMap:{selection:k,cluster:W,binning:Z}},json:{name:"layerDefinition.featureReduction",write:{allowNull:!0},origins:{"web-map":{types:N},"portal-item":{types:N},"web-scene":{types:{key:"type",base:S,typeMap:{selection:k}},name:"layerDefinition.featureReduction",write:{layerContainerTypes:pe}}}}},ce=()=>ae.getLogger("esri.views.2d.layers.support.clusterUtils");J.add("esri-cluster-arcade-enabled",!0);const fe=J("esri-cluster-arcade-enabled"),ye=new Set(["simple-line","simple-fill","picture-fill"]);function q(i,s){let e=s.clone();if(!me(e))return e;if(s.getSymbols().some(t=>ye.has(t.type))&&(e=new $({symbol:new ne})),e.authoringInfo||(e.authoringInfo=new ue),e.authoringInfo.isAutoGenerated=!0,"visualVariables"in e){const t=(e.visualVariables||[]).filter(r=>r.valueExpression!=="$view.scale");t.forEach(r=>{r.type==="rotation"?r.field?r.field=y(i,r.field,"avg_angle","number"):r.valueExpression&&(r.field=h(i,r.valueExpression,"avg_angle","number"),r.valueExpression=null):r.normalizationField?(r.field=y(i,r.field,"avg_norm","number",r.normalizationField),r.normalizationField=null):r.field?r.field=y(i,r.field,"avg","number"):r.valueExpression&&(r.field=h(i,r.valueExpression,"avg","number"),r.valueExpression=null)}),e.visualVariables=t}switch(e.type){case"simple":break;case"pie-chart":for(const t of e.attributes)t.field?t.field=y(i,t.field,"sum","number"):t.valueExpression&&(t.field=h(i,t.valueExpression,"sum","number"),t.valueExpression=null);break;case"unique-value":e.field?e.field=y(i,e.field,"mode","string"):e.valueExpression&&(e.field=h(i,e.valueExpression,"mode","string"),e.valueExpression=null);break;case"class-breaks":e.normalizationField?(e.field=y(i,e.field,"avg_norm","number",e.normalizationField),e.normalizationField=null):e.field?e.field=y(i,e.field,"avg","number"):e.valueExpression&&(e.field=h(i,e.valueExpression,"avg","number"),e.valueExpression=null)}return e}const me=i=>{const s=e=>ce().error(new oe("Unsupported-renderer",e,{renderer:i}));if(!i)return!1;switch(i.type){case"unique-value":if(i.field2||i.field3)return s("FeatureReductionCluster does not support multi-field UniqueValueRenderers"),!1;break;case"class-breaks":if(i.normalizationField){const e=i.normalizationType;if(e!=="field")return s(`FeatureReductionCluster does not support a normalizationType of ${e}`),!1}break;case"simple":case"pie-chart":break;default:return s(`FeatureReductionCluster does not support renderers of type ${i.type}`),!1}if(!fe){if("valueExpression"in i&&i.valueExpression)return s("FeatureReductionCluster does not currently support renderer.valueExpression. Support will be added in a future release"),!1;if(("visualVariables"in i&&i.visualVariables||[]).some(e=>!(!("valueExpression"in e)||!e.valueExpression)))return s("FeatureReductionCluster does not currently support visualVariables with a valueExpression. Support will be added in a future release"),!1}return!0};function be(i,s,e){switch(i){case"sum":return`cluster_sum_${s}`;case"avg":case"avg_angle":return`cluster_avg_${s}`;case"mode":return`cluster_type_${s}`;case"avg_norm":{const t=e,r="field",a=s.toLowerCase()+",norm:"+r+","+t.toLowerCase();return"cluster_avg_"+Q(a)}}}function h(i,s,e,t){const r=Q(s),a=e==="mode"?`cluster_type_${r}`:e==="sum"?`cluster_sum_${r}`:`cluster_avg_${r}`;return i.some(d=>d.name===a)||i.push(new m({name:a,isAutoGenerated:!0,onStatisticExpression:new C({expression:s,returnType:t}),statisticType:e})),a}function y(i,s,e,t,r){if(s==="cluster_count"||i.some(d=>d.name===s))return s;const a=be(e,s,r);return i.some(d=>d.name===a)||(e==="avg_norm"?i.push(new m({name:a,isAutoGenerated:!0,onStatisticExpression:new C({expression:`$feature.${s} / $feature.${r}`,returnType:t}),statisticType:"avg"})):i.push(new m({name:a,isAutoGenerated:!0,onStatisticField:s,statisticType:e}))),a}const Re=i=>{let s=class extends i{constructor(...e){super(...e),this.addHandles(re(()=>this.renderer,()=>{if(this.featureReduction){const t=this._normalizeFeatureReduction(this.featureReduction);this._set("featureReduction",t)}},se))}set featureReduction(e){const t=this._normalizeFeatureReduction(e);this._set("featureReduction",t)}set renderer(e){}_withClusterVariable(e,t,r){const a=e.clone();return"visualVariables"in a&&(a.visualVariables||(a.visualVariables=[]),a.visualVariables.some(d=>d.type==="size")||a.visualVariables.push(new le({field:"cluster_count",stops:[new R({value:1}),new R({useMinValue:!0,size:t}),new R({useMaxValue:!0,size:r})]}))),a}_normalizeFeatureReduction(e){if(e?.type!=="cluster")return e;const t=e.clone(),r=[new m({name:"cluster_count",alias:"cluster_count",isAutoGenerated:!0,statisticType:"count"})],a=(t.fields??[]).filter(b=>!b.isAutoGenerated),d=e.renderer&&!e.renderer.authoringInfo?.isAutoGenerated,{clusterMinSize:E,clusterMaxSize:I}=t;if(d){t.fields=[...r,...a];const b=this._withClusterVariable(t.renderer,E,I);return t.effectiveFeatureRenderer=b,t.effectiveClusterRenderer=b,t}if(e.symbol){if(t.fields=[...r,...a],t.renderer=null,!this.renderer)return t.effectiveFeatureRenderer=null,t.effectiveClusterRenderer=null,t;const b=q(r,this.renderer),w=this._withClusterVariable(b,E,I),Y="visualVariables"in w&&w.visualVariables?w.visualVariables:[],ee=new $({symbol:e.symbol,visualVariables:Y});return t.fields=[...r,...a],t.effectiveFeatureRenderer=w,t.effectiveClusterRenderer=ee,t}if(!this.renderer)return e;const G=q(r,this.renderer);t.fields=[...r,...a],t.renderer=G;const A=this._withClusterVariable(G,E,I);return t.effectiveFeatureRenderer=A,t.effectiveClusterRenderer=A,t}};return n([o(de)],s.prototype,"featureReduction",null),s=n([g("esri.layers.mixins.FeatureReductionLayer")],s),s};export{de as X,Re as v};
diff --git a/fix-191/assets/FeatureReductionSelection-BjX3h7Sz-B4a-3Q-d.js b/fix-191/assets/FeatureReductionSelection-BjX3h7Sz-B4a-3Q-d.js
deleted file mode 100644
index 13e6c05c..00000000
--- a/fix-191/assets/FeatureReductionSelection-BjX3h7Sz-B4a-3Q-d.js
+++ /dev/null
@@ -1 +0,0 @@
-import{e as p,v as r,S as o,i as n}from"./story-DULt3Rma.js";let e=class extends p{constructor(){super(...arguments),this.type=null}};r([o({type:["selection","cluster","binning"],readOnly:!0,json:{read:!1,write:!0}})],e.prototype,"type",void 0),e=r([n("esri.layers.support.FeatureReduction")],e);var s;let t=s=class extends e{constructor(i){super(i),this.type="selection"}clone(){return new s}};r([o({type:["selection"]})],t.prototype,"type",void 0),t=s=r([n("esri.layers.support.FeatureReductionSelection")],t);const l=t;export{l as c,e};
diff --git a/fix-191/assets/FeatureServiceSnappingSourceWorker-DUCI4USj-eIbMguSj.js b/fix-191/assets/FeatureServiceSnappingSourceWorker-DUCI4USj-eIbMguSj.js
deleted file mode 100644
index bdd057fb..00000000
--- a/fix-191/assets/FeatureServiceSnappingSourceWorker-DUCI4USj-eIbMguSj.js
+++ /dev/null
@@ -1 +0,0 @@
-import{bh as W,v as d,S as p,i as R,I as se,b as ie,$ as g,J as v,ah as P,av as K,aw as re,g as ne,an as oe,dh as ae,P as z,hm as D,j as X,hn as M,ho as le,hp as O,hq as ue,aF as he,ay as b,W as N,a1 as j,n as ce,hr as de,gI as pe,hs as U,ht as A,gH as H,hu as fe,hv as q,hw as Y,ec as B}from"./story-DULt3Rma.js";import{i as ee}from"./UpdatingHandles-CUu3u1ms-C-zZs-35.js";import{I as _e}from"./FeatureStore-Co2V0sVE-BhxyyBiT.js";import{Z as ge}from"./QueryEngine-CH5uUhZK-BPFE3Fml.js";import{V as I}from"./TileInfo-CWIRDhZl-1qRzvaVI.js";import{b as S}from"./Query-BrwMGK8U-DaHaJHm8.js";import{q as ye,j as me}from"./ElevationInfo-yv2-9tj6-B5v76p2q.js";import{b as te}from"./LRUCache-C3erQTWv-CBR8rG5i.js";import{s as V}from"./uuid-Dj9mdEVg-BaKSCiyT.js";import{L as Fe,q as Ce,V as Ee}from"./featureConversionUtils-D6hFQ4Af-Cb3HkUwF.js";import{L as Te}from"./arcgisLayerUrl-HNYh8jvG-CTcC0GBx.js";import{U as ve}from"./pbfQueryUtils-F4ZE8-K8-DpF92BrR.js";import{w as Se,J as be,q as Ie,P as we}from"./query-DFW9-NG_-DqquB_ii.js";import{G as Oe}from"./ByteSizeUnit-DL8UhsB0-B2-AmVRx.js";import{r as xe}from"./BoundsStore--N6o1xkF-W3ru2llD.js";import{e as Re}from"./TileKey-B_6qmYK--BtZdR-Xy.js";import"./main-Bm7g2Jde.js";import"./timeSupport-jPViR5jn-Blw8tou2.js";import"./OptimizedFeature-EIithYlr-Cq64mIT3.js";import"./queryUtils-Brxu6254-UOAsUqfL.js";import"./projection-BA9M1R7d-DvHr0GeG.js";import"./projectBuffer-CvCBvJ6W-Cc8J4MEJ.js";import"./normalizeUtils-Bxmy9MNI-CZMTs6Vg.js";import"./normalizeUtilsCommon-CRJlkfEA-CgRBIB_J.js";import"./utils-9sQxfkoa-CjNZjdKD.js";import"./utils-Bq23Xwmj-DhZYu3yh.js";import"./json-BI97KiBB-Ce5cWfI2.js";import"./optimizedFeatureQueryEngineAdapter-DFdaawxC-p1ngWYoX.js";import"./WhereClause-DxwoyBMS-rEYyQL9l.js";import"./TimeOnly-DSMefxKy-BAXliSDH.js";import"./UnknownTimeZone-C--TOcPG-C3cinqRV.js";import"./fieldType-CD2CL2hr-BeIaxmP1.js";import"./QueryEngineCapabilities-Gr588n9t-DjYb9CEb.js";import"./quantizationUtils-bJy1cRwp-DKHwdnl5.js";import"./utils-HtkT8Fn3-CgLa5wkn.js";import"./TimeExtent-Cn0Jofqr-DWlRQ-Qn.js";import"./heatmapUtils-seiMkkkR-DETYxyq4.js";import"./vec42-D8CJyqHG-DnfLTeQH.js";import"./common-CYWrYyJl-E8-sukrT.js";import"./vec4f64-hf2nxvhQ-CaAr8PTM.js";import"./utils-DyydRFHu-BgVNtJ0_.js";import"./Basemap-BEqqSTw9-B8z1wR1c.js";import"./loadAll-e978YItg-Sr8yCS6_.js";import"./PortalItem-CctGdnxF-Dbw3pVTD.js";import"./writeUtils-D5qlLkwk-B7Zow5Ob.js";import"./mat4f32-CiZjBg9k-CUm34GoR.js";import"./mat4-DX7gBViE-DBcL5Ayd.js";import"./utils-tNxq3jkf-BmjMQb3R.js";import"./ClassBreaksDefinition-bYRgYgPp-fywCcmFq.js";import"./FieldsIndex-HmzMbJQG-nfgmohOl.js";import"./Scheduler-B7UX7Wr5-Bw_5FpBi.js";import"./signal-CETehA7D-Cb8aw_q5.js";import"./Field-C6hA1tZj-DdgmWWCq.js";import"./lengthUtils-DKpMe5qR-BEdWsC7X.js";import"./OptimizedFeatureSet-DfZGBuxJ-C08BOAgi.js";import"./pbf-D-y3_eZO-D-TFO35M.js";import"./queryZScale-BiYV6Pr6-CHuA90gs.js";import"./PooledRBush-DbfAmeLn-CnmkMtQT.js";import"./quickselect-DHTstthl-Ds_Aj0x5.js";function $(e=!1,t){if(e){const{elevationInfo:s,alignPointsInFeatures:i}=t;return new Pe(s,i)}return new Ae}let Ae=class{async alignCandidates(e,t,s){return e}notifyElevationSourceChange(){}};const He=1024;let Pe=class{constructor(e,t){this._elevationInfo=e,this._alignPointsInFeatures=t,this._alignmentsCache=new te(He),this._cacheVersion=0}async alignCandidates(e,t,s){const i=this._elevationInfo;return i==null||i.mode!=="absolute-height"||i.featureExpressionInfo?this._alignComputedElevationCandidates(e,t,s):(De(e,t,i),e)}notifyElevationSourceChange(){this._alignmentsCache.clear(),this._cacheVersion++}async _alignComputedElevationCandidates(e,t,s){const i=new Map;for(const _ of e)oe(i,_.objectId,Me).push(_);const[r,n,o]=this._prepareQuery(i,t),a=await this._alignPointsInFeatures(r,s);if(g(s),o!==this._cacheVersion)return this._alignComputedElevationCandidates(e,t,s);this._applyCacheAndResponse(r,a,n);const{drapedObjectIds:l,failedObjectIds:h}=a,c=[];for(const _ of e){const{objectId:y}=_;l.has(y)&&_.type==="edge"&&(_.draped=!0),h.has(y)||c.push(_)}return c}_prepareQuery(e,t){const s=[],i=[];for(const[r,n]of e){const o=[];for(const a of n)this._addToQueriesOrCachedResult(r,a.target,o,i),a.type==="edge"&&(this._addToQueriesOrCachedResult(r,a.start,o,i),this._addToQueriesOrCachedResult(r,a.end,o,i));o.length!==0&&s.push({objectId:r,points:o})}return[{spatialReference:t.toJSON(),pointsInFeatures:s},i,this._cacheVersion]}_addToQueriesOrCachedResult(e,t,s,i){const r=k(e,t),n=this._alignmentsCache.get(r);n==null?s.push(t):i.push(new ze(t,n))}_applyCacheAndResponse(e,{elevations:t,drapedObjectIds:s,failedObjectIds:i},r){for(const a of r)a.apply();let n=0;const o=this._alignmentsCache;for(const{objectId:a,points:l}of e.pointsInFeatures){if(i.has(a)){n+=l.length;continue}const h=!s.has(a);for(const c of l){const _=k(a,c),y=t[n++];c.z=y,h&&o.put(_,y,1)}}}};class ze{constructor(t,s){this.point=t,this.z=s}apply(){this.point.z=this.z}}function k(e,{x:t,y:s,z:i,spatialReference:r}){return`${e}-${t}-${s}-${i??0}}-wkid:${r?.wkid}`}function De(e,t,s){const{offset:i,unit:r}=s;if(i==null)return;const n=ae(t),o=i*(me(r??"meters")/n);for(const a of e)switch(a.type){case"edge":a.start.z+=o,a.end.z+=o;continue;case"vertex":a.target.z+=o;continue}}function Me(){return[]}let Ne=class{filter(e,t){return t}notifyElevationSourceChange(){}},je=class{filter(e,t){const{point:s,distance:i}=e,{z:r}=s;if(r==null||t.length===0)return t;const n=$e(i),o=this._updateCandidatesTo3D(t,s,n).filter(Ue);return o.sort(ke),o}_updateCandidatesTo3D(e,t,s){for(const i of e)switch(i.type){case"edge":qe(i,t,s);continue;case"vertex":Ve(i,t,s);continue}return e}};function Ue(e){return e.distance<=1}function L(e=!1){return e?new je:new Ne}function qe(e,t,{x:s,y:i,z:r}){const{start:n,end:o,target:a}=e;e.draped||Be(a,t,n,o);const l=(t.x-a.x)/s,h=(t.y-a.y)/i,c=(t.z-a.z)/r;e.distance=Math.sqrt(l*l+h*h+c*c)}function Be(e,t,s,i){const r=i.x-s.x,n=i.y-s.y,o=i.z-s.z,a=r*r+n*n+o*o,l=(t.x-s.x)*r+(t.y-s.y)*n+o*(t.z-s.z),h=Math.min(1,Math.max(0,l/a)),c=s.x+r*h,_=s.y+n*h,y=s.z+o*h;e.x=c,e.y=_,e.z=y}function Ve(e,t,{x:s,y:i,z:r}){const{target:n}=e,o=(t.x-n.x)/s,a=(t.y-n.y)/i,l=(t.z-n.z)/r,h=Math.sqrt(o*o+a*a+l*l);e.distance=h}function $e(e){return typeof e=="number"?{x:e,y:e,z:e}:e}function ke(e,t){return e.distance-t.distance}function J(e=!1,t){return e?new Qe(t):new Le}class Le{async fetch(){return[]}notifySymbologyChange(){}}const Je=1024;let Qe=class{constructor(e){this._getSymbologyCandidates=e,this._candidatesCache=new te(Je),this._cacheVersion=0}async fetch(e,t){if(e.length===0)return[];const s=[],i=[],r=this._candidatesCache;for(const c of e){const _=Q(c),y=r.get(_);if(y)for(const E of y)i.push(z(E));else s.push(c),r.put(_,[],1)}if(s.length===0)return i;const n=this._cacheVersion,{candidates:o,sourceCandidateIndices:a}=await this._getSymbologyCandidates(s,t);if(g(t),n!==this._cacheVersion)return this.fetch(e,t);const l=[],{length:h}=o;for(let c=0;c{const r=await B(s.fetchCount(this,i));this.state.type===u.FETCH_COUNT&&(this.state=Ge(this.state,r.ok?r.value:1/0))})}}_gotoFetchFeatures(t,s){return{type:u.FETCH_FEATURES,previous:t,task:b(async i=>{const r=await B(s.fetchFeatures(this,t.featureCount,i));this.state.type===u.FETCH_FEATURES&&(this.state=We(this.state,r.ok?r.value:[]))})}}_goToDone(t,s){return s.finish(this,t.features),{type:u.DONE,previous:t}}reset(){const t=this.state;switch(this.state={type:u.CREATED},t.type){case u.CREATED:case u.FETCHED_COUNT:case u.FETCHED_FEATURES:case u.DONE:break;case u.FETCH_COUNT:case u.FETCH_FEATURES:t.task.abort()}}intersects(t){return t==null||!this.data.extent||(H(t,Z),A(this.data.extent,Z))}}function Ge(e,t){return{type:u.FETCHED_COUNT,featureCount:t,previous:e}}function We(e,t){return{type:u.FETCHED_FEATURES,previous:e,features:t}}var u;(function(e){e[e.CREATED=0]="CREATED",e[e.FETCH_COUNT=1]="FETCH_COUNT",e[e.FETCHED_COUNT=2]="FETCHED_COUNT",e[e.FETCH_FEATURES=3]="FETCH_FEATURES",e[e.FETCHED_FEATURES=4]="FETCHED_FEATURES",e[e.DONE=5]="DONE"})(u||(u={}));const Z=W();let f=class extends X{get _minimumVerticesPerFeature(){switch(this.store?.featureStore.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":return 1;case"esriGeometryPolygon":return 4;case"esriGeometryPolyline":return 2}}get _mandatoryOutFields(){const e=new Set;return this.objectIdField&&e.add(this.objectIdField),this.globalIdField&&e.add(this.globalIdField),e}set outFields(e){const t=this._get("outFields"),s=M(e,this._mandatoryOutFields);le(s,t)||(this._set("outFields",s),O(s,t)||this.refresh())}get outFields(){return this._get("outFields")??this._mandatoryOutFields}set filter(e){const t=this._get("filter"),s=this._filterProperties(e);JSON.stringify(t)!==JSON.stringify(s)&&this._set("filter",s)}set customParameters(e){const t=this._get("customParameters");JSON.stringify(t)!==JSON.stringify(e)&&this._set("customParameters",e)}get _configuration(){return{filter:this.filter,customParameters:this.customParameters,tileInfo:this.tileInfo,tileSize:this.tileSize}}set tileInfo(e){const t=this._get("tileInfo");t!==e&&(e!=null&&t!=null&&JSON.stringify(e)===JSON.stringify(t)||(this._set("tileInfo",e),this.store.tileInfo=e))}set tileSize(e){this._get("tileSize")!==e&&this._set("tileSize",e)}get updating(){return this._updatingHandles.updating}get hasZ(){return this.store.featureStore.hasZ}constructor(e){super(e),this.suspended=!0,this._historicMoment=null,this.tilesOfInterest=[],this.availability=0,this._pendingTiles=new Map,this._updatingHandles=new ee}initialize(){this._initializeFetchExtent(),this._updatingHandles.add(()=>this._configuration,()=>this.refresh()),this._updatingHandles.add(()=>this.tilesOfInterest,(e,t)=>{ue(e,t,({id:s},{id:i})=>s===i)||this._process()},K),this.addHandles(he(()=>!this.suspended,()=>this._process()))}destroy(){this._pendingTiles.forEach(e=>this._deletePendingTile(e)),this._pendingTiles.clear(),this.store.destroy(),this.tilesOfInterest.length=0,this._updatingHandles.destroy()}refresh(){this.store.refresh(),this._pendingTiles.forEach(e=>this._deletePendingTile(e)),this._process()}async handleEdits(e){if(e.historicMoment&&(this._historicMoment=e.historicMoment),!e.addedFeatures.length&&!e.updatedFeatures.length&&!e.deletedFeatures.length)return;for(const i of this._pendingTiles.values())i.reset();const t={...e,deletedFeatures:e.deletedFeatures.map(({objectId:i,globalId:r})=>i&&i!==-1?i:this._lookupObjectIdByGlobalId(r))},s=b(async i=>{try{await this.store.processEdits(t,(r,n)=>this._queryFeaturesById(r,n),i),this._processPendingTiles()}catch(r){N(r),j.getLogger(this).warn("Failed to apply edits",r)}});this.addHandles(s),await this._updatingHandles.addPromise(s.promise)}setHistoricMoment(e){e?.getTime()!==this._historicMoment?.getTime()&&(this._historicMoment=e,this.refresh())}_initializeFetchExtent(){if(!this.capabilities.query.supportsExtent||!Te(this.url))return;const e=b(async t=>{try{const s=await Se(this.url,new S({where:"1=1",outSpatialReference:this.spatialReference,cacheHint:this.capabilities.query.supportsCacheHint??void 0}),{query:this._configuration.customParameters,signal:t});this.store.extent=ce.fromJSON(s.data?.extent)}catch(s){N(s),j.getLogger(this).warn("Failed to fetch data extent",s)}});this._updatingHandles.addPromise(e.promise.then(()=>this._process())),this.addHandles(e)}get debugInfo(){return{numberOfFeatures:this.store.featureStore.numFeatures,tilesOfInterest:this.tilesOfInterest,pendingTiles:Array.from(this._pendingTiles.values()).map(e=>e.debugInfo),storedTiles:this.store.debugInfo}}_process(){this._markTilesNotAlive(),this._createPendingTiles(),this._deletePendingTiles(),this._processPendingTiles()}_markTilesNotAlive(){for(const e of this._pendingTiles.values())e.alive=!1}_createPendingTiles(){if(this.suspended)return;const e=this._collectMissingTilesInfo();if(this._setAvailability(e==null?1:e.coveredArea/e.fullArea),e!=null)for(const{data:t,resolution:s}of e.missingTiles){const i=this._pendingTiles.get(t.id);i?(i.resolution=s,i.alive=!0):this._createPendingTile(t,s)}}_collectMissingTilesInfo(){let e=null;for(let t=this.tilesOfInterest.length-1;t>=0;t--){const s=this.tilesOfInterest[t],i=this.store.process(s,(r,n)=>this._verifyTileComplexity(r,n),this.outFields);e==null?e=i:e.prepend(i)}return e}_deletePendingTiles(){for(const e of this._pendingTiles.values())e.alive||this._deletePendingTile(e)}_processPendingTiles(){const e={fetchCount:(t,s)=>this._fetchCount(t,s),fetchFeatures:(t,s,i)=>this._fetchFeatures(t,s,i),finish:(t,s)=>this._finishPendingTile(t,s),resume:()=>this._processPendingTiles()};if(this._ensureFetchAllCounts(e))for(const t of this._pendingTiles.values())this._verifyTileComplexity(this.store.getFeatureCount(t.data),t.resolution)&&this._updatingHandles.addPromise(t.process(e))}_verifyTileComplexity(e,t){return this._verifyVertexComplexity(e)&&this._verifyFeatureDensity(e,t)}_verifyVertexComplexity(e){return e*this._minimumVerticesPerFeature{r===V(n.attributes[t])&&(i=n.objectId??n.attributes[s])}),i==null)throw new Error(`Expected to find a feature with globalId ${e}`);return i}_queryFeaturesById(e,t){const s=this._createFeaturesQuery();return s.objectIds=e,this._queryFeatures(s,t)}_queryFeatures(e,t){return this.capabilities.query.supportsFormatPBF?this._queryFeaturesPBF(e,t):this._queryFeaturesJSON(e,t)}async _queryFeaturesPBF(e,t){const{sourceSpatialReference:s}=this,{data:i}=await be(this.url,e,new ve({sourceSpatialReference:s}),{query:this._configuration.customParameters,timeout:w,signal:t});return Fe(i)}async _queryFeaturesJSON(e,t){const{sourceSpatialReference:s}=this,{data:i}=await Ie(this.url,e,s,{query:this._configuration.customParameters,timeout:w,signal:t});return Ce(i,this.objectIdField)}_createCountQuery(e){const t=this._createBaseQuery(e);return this.capabilities.query.supportsCacheHint&&(t.cacheHint=!0),t}_createFeaturesQuery(e=null){const t=this._createBaseQuery(e),s=e?.data!=null?this.store.getAttributesForTile(e?.data?.id):null,i=M(de(this.outFields,s??new Set),this._mandatoryOutFields);return t.outFields=Array.from(i),t.returnGeometry=!0,e!=null&&(this.capabilities.query.supportsResultType?t.resultType="tile":this.capabilities.query.supportsCacheHint&&(t.cacheHint=!0)),t}_createBaseQuery(e){const t=new S({returnZ:this.hasZ,returnM:!1,historicMoment:this._historicMoment,geometry:this.tileInfo!=null&&e!=null?pe(e.data.extent,this.tileInfo.spatialReference):void 0}),s=this._configuration.filter;return s!=null&&(t.where=s.where,t.gdbVersion=s.gdbVersion,t.timeExtent=s.timeExtent),t.outSpatialReference=this.spatialReference,t}_setPagingParameters(e,t,s){if(!this.capabilities.query.supportsPagination)return!1;const{supportsMaxRecordCountFactor:i,supportsCacheHint:r,tileMaxRecordCount:n,maxRecordCount:o,supportsResultType:a}=this.capabilities.query,l=i?S.MAX_MAX_RECORD_COUNT_FACTOR:1,h=l*((a||r)&&n?n:o||Ke);return e.start=t,i?(e.maxRecordCountFactor=Math.min(l,Math.ceil(s/h)),e.num=Math.min(s,e.maxRecordCountFactor*h)):e.num=Math.min(s,h),!0}};d([p({constructOnly:!0})],f.prototype,"url",void 0),d([p({constructOnly:!0})],f.prototype,"objectIdField",void 0),d([p({constructOnly:!0})],f.prototype,"globalIdField",void 0),d([p({constructOnly:!0})],f.prototype,"capabilities",void 0),d([p({constructOnly:!0})],f.prototype,"sourceSpatialReference",void 0),d([p({constructOnly:!0})],f.prototype,"spatialReference",void 0),d([p({constructOnly:!0})],f.prototype,"store",void 0),d([p({readOnly:!0})],f.prototype,"_minimumVerticesPerFeature",null),d([p()],f.prototype,"_mandatoryOutFields",null),d([p()],f.prototype,"outFields",null),d([p()],f.prototype,"suspended",void 0),d([p()],f.prototype,"_historicMoment",void 0),d([p()],f.prototype,"filter",null),d([p()],f.prototype,"customParameters",null),d([p({readOnly:!0})],f.prototype,"_configuration",null),d([p()],f.prototype,"tileInfo",null),d([p()],f.prototype,"tileSize",null),d([p()],f.prototype,"tilesOfInterest",void 0),d([p({readOnly:!0})],f.prototype,"updating",null),d([p({readOnly:!0})],f.prototype,"availability",void 0),d([p()],f.prototype,"hasZ",null),f=d([R("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiledFetcher")],f);const Ke=2e3,w=6e5,Xe=1e6,Ye=25,et=1;class tt{constructor(){this._store=new Map,this._byteSize=0}set(t,s){this.delete(t),this._store.set(t,s),this._byteSize+=s.byteSize}delete(t){const s=this._store.get(t);return!!this._store.delete(t)&&(s!=null&&(this._byteSize-=s.byteSize),!0)}get(t){return this._used(t),this._store.get(t)}has(t){return this._used(t),this._store.has(t)}clear(){this._store.clear()}applyByteSizeLimit(t,s){for(const[i,r]of this._store){if(this._byteSize<=t)break;this.delete(i),s(r)}}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}_used(t){const s=this._store.get(t);s&&(this._store.delete(t),this._store.set(t,s))}}let F=class extends X{constructor(e){super(e),this.tileInfo=null,this.extent=null,this.maximumByteSize=10*Oe.MEGABYTES,this._tileBounds=new xe,this._tiles=new tt,this._refCounts=new Map,this._tileFeatureCounts=new Map,this._tmpBoundingRect=W()}add(e,t){for(const r of t)this._referenceFeature(r.objectId);const s=this.featureStore.upsertMany(t),i=s.map(r=>new Set(Object.keys(r.attributes))).reduce((r,n)=>U(r,n),new Set(Object.keys(s[0]?.attributes??[])));this._addTileStorage(e,new Set(s.map(r=>r.objectId)),it(s),i),this._tiles.applyByteSizeLimit(this.maximumByteSize,r=>this._removeTileStorage(r))}getAttributesForTile(e){return e?this._tiles.get(e)?.attributeKeys:null}destroy(){this.clear(),this._tileFeatureCounts.clear()}clear(){this.featureStore.clear(),this._tileBounds.clear(),this._tiles.clear(),this._refCounts.clear()}refresh(){this.clear(),this._tileFeatureCounts.clear()}processEdits(e,t,s){return this._processEditsDelete(e.deletedFeatures.concat(e.updatedFeatures)),this._processEditsRefetch(e.addedFeatures.concat(e.updatedFeatures),t,s)}_addTileStorage(e,t,s,i){const r=e.id;this._tiles.set(r,new ot(e,t,s,i)),this._tileBounds.set(r,e.extent),this._tileFeatureCounts.set(r,t.size)}_remove({id:e}){const t=this._tiles.get(e);t&&this._removeTileStorage(t)}_removeTileStorage(e){const t=[];for(const i of e.objectIds)this._unreferenceFeature(i)===C.REMOVED&&t.push(i);this.featureStore.removeManyById(t);const s=e.data.id;this._tiles.delete(s),this._tileBounds.delete(s)}_processEditsDelete(e){this.featureStore.removeManyById(e);for(const t of this._tiles.values()){for(const s of e)t.objectIds.delete(s);this._tileFeatureCounts.set(t.data.id,t.objectIds.size)}for(const t of e)this._refCounts.delete(t)}async _processEditsRefetch(e,t,s){if(!e.length)return;const i=(await t(e,s)).features,{hasZ:r,hasM:n}=this.featureStore;for(const o of i){const a=Ee(this._tmpBoundingRect,o.geometry,r,n);a!=null&&this._tileBounds.forEachInBounds(a,l=>{const h=this._tiles.get(l);this.featureStore.add(o);const c=o.objectId;h.objectIds.has(c)||(h.objectIds.add(c),this._referenceFeature(c),this._tileFeatureCounts.set(h.data.id,h.objectIds.size))})}}process(e,t=()=>!0,s){if(this.tileInfo==null||!e.extent||this.extent!=null&&!A(H(this.extent,this._tmpBoundingRect),e.extent))return new x(e);const i=this.getAttributesForTile(e.id);if(O(s,i))return new x(e);const r=this._createTileTree(e,this.tileInfo);return this._simplify(r,t,null,0,1),this._collectMissingTiles(e,r,this.tileInfo,s)}get debugInfo(){return Array.from(this._tiles.values()).map(({data:e})=>({data:e,featureCount:this._tileFeatureCounts.get(e.id)||0}))}getFeatureCount(e){return this._tileFeatureCounts.get(e.id)??0}async fetchCount(e,t,s,i){const r=this._tileFeatureCounts.get(e.id);if(r!=null)return r;const n=await we(t,s,i);return this._tileFeatureCounts.set(e.id,n.data.count),n.data.count}_createTileTree(e,t){const s=new G(e.level,e.row,e.col);return t.updateTileInfo(s,I.ExtrapolateOptions.POWER_OF_TWO),this._tileBounds.forEachInBounds(e.extent,i=>{const r=this._tiles.get(i)?.data;r&&st(e,r)&&this._populateChildren(s,r,t,this._tileFeatureCounts.get(r.id)||0)}),s}_populateChildren(e,t,s,i){const r=t.level-e.level-1;if(r<0)return void(e.isLeaf=!0);const n=t.row>>r,o=t.col>>r,a=e.row<<1,l=o-(e.col<<1)+(n-a<<1),h=e.children[l];if(h!=null)this._populateChildren(h,t,s,i);else{const c=new G(e.level+1,n,o);s.updateTileInfo(c,I.ExtrapolateOptions.POWER_OF_TWO),e.children[l]=c,this._populateChildren(c,t,s,i)}}_simplify(e,t,s,i,r){const n=r*r;if(e.isLeaf)return t(this.getFeatureCount(e),r)?0:(this._remove(e),s!=null&&(s.children[i]=null),n);const o=r/2,a=o*o;let l=0;for(let h=0;h{const n=this._tiles.get(r.id);if(n){s=s?U(s,n.attributeKeys):new Set(n.attributeKeys),i+=n.byteSize;for(const o of n.objectIds)t.has(o)||(t.add(o),this._referenceFeature(o));this._remove(r)}}),this._addTileStorage(e,t,i,s??new Set),e.isLeaf=!0,e.children[0]=e.children[1]=e.children[2]=e.children[3]=null,this._tileFeatureCounts.set(e.id,t.size)}_forEachLeaf(e,t){for(const s of e.children)s!=null&&(s.isLeaf?t(s):this._forEachLeaf(s,t))}_purge(e){if(e!=null)if(e.isLeaf)this._remove(e);else for(let t=0;t>1),(e.col<<1)+(1&a),o):this._collectMissingTilesRecurse(l,t,o,i)}}_referenceFeature(e){const t=(this._refCounts.get(e)||0)+1;return this._refCounts.set(e,t),t===1?C.ADDED:C.UNCHANGED}_unreferenceFeature(e){const t=(this._refCounts.get(e)||0)-1;return t===0?(this._refCounts.delete(e),C.REMOVED):(t>0&&this._refCounts.set(e,t),C.UNCHANGED)}get test(){}};function st(e,t){if(!e||!t)return!1;if(e.level===t.level)return e.row===t.row&&e.col===t.col;const s=e.levelt+rt(s),0)}function rt(e){return 32+nt(e.geometry)+fe(e.attributes)}function nt(e){if(e==null)return 0;const t=q(e.lengths,4);return 32+q(e.coords,8)+t}d([p({constructOnly:!0})],F.prototype,"featureStore",void 0),d([p()],F.prototype,"tileInfo",void 0),d([p()],F.prototype,"extent",void 0),d([p()],F.prototype,"maximumByteSize",void 0),F=d([R("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTileStore")],F);let ot=class{constructor(e,t,s,i){this.data=e,this.objectIds=t,this.byteSize=s,this.attributeKeys=i}};class G{constructor(t,s,i){this.level=t,this.row=s,this.col=i,this.isLeaf=!1,this.extent=null,this.children=[null,null,null,null]}get hasChildren(){return!this.isLeaf&&(this.children[0]!=null||this.children[1]!=null||this.children[2]!=null||this.children[3]!=null)}}let x=class{constructor(e,t=[]){this.missingTiles=t,this.fullArea=0,this.coveredArea=0,this.fullArea=Y(e.extent),this.coveredArea=this.fullArea}prepend(e){this.missingTiles=e.missingTiles.concat(this.missingTiles),this.coveredArea+=e.coveredArea,this.fullArea+=e.fullArea}},at=class{constructor(e,t,s){this._tileInfo=e,this._extent=null,this.info=new x(t),s!=null&&(this._extent=H(s))}addMissing(e,t,s,i){const r=new Re(null,e,t,s);this._tileInfo.updateTileInfo(r,I.ExtrapolateOptions.POWER_OF_TWO),r.extent==null||this._extent!=null&&!A(this._extent,r.extent)||(this.info.missingTiles.push({data:r,resolution:i}),this.info.coveredArea-=Y(r.extent))}};const lt=.18751;var C;(function(e){e[e.ADDED=0]="ADDED",e[e.REMOVED=1]="REMOVED",e[e.UNCHANGED=2]="UNCHANGED"})(C||(C={}));let T=class extends se.EventedAccessor{constructor(){super(...arguments),this._isInitializing=!0,this.remoteClient=null,this._whenSetup=ie(),this._elevationAligner=$(),this._elevationFilter=L(),this._symbologyCandidatesFetcher=J(),this._updatingHandles=new ee,this._alignPointsInFeatures=async(e,t)=>{const s={query:e},i=await this.remoteClient.invoke("alignElevation",s,{signal:t});return g(t),i},this._getSymbologyCandidates=async(e,t)=>{const s={candidates:e,spatialReference:this._spatialReference.toJSON()},i=await this.remoteClient.invoke("getSymbologyCandidates",s,{signal:t});return g(t),i}}get updating(){return this._isInitializing||this._updatingHandles.updating||this._featureFetcher.updating}destroy(){this._featureFetcher?.destroy(),this._queryEngine?.destroy(),this._featureStore?.clear()}async setup(e){if(this.destroyed)return{result:{}};const{geometryType:t,objectIdField:s,timeInfo:i,fieldsIndex:r}=e.serviceInfo,{hasZ:n}=e,o=v.fromJSON(e.spatialReference);this._spatialReference=o,this._featureStore=new _e({...e.serviceInfo,hasZ:n,hasM:!1}),this._queryEngine=new ge({spatialReference:e.spatialReference,featureStore:this._featureStore,geometryType:t,fieldsIndex:r,hasZ:n,hasM:!1,objectIdField:s,timeInfo:i}),this._featureFetcher=new f({store:new F({featureStore:this._featureStore}),url:e.serviceInfo.url,objectIdField:e.serviceInfo.objectIdField,globalIdField:e.serviceInfo.globalIdField,capabilities:e.serviceInfo.capabilities,spatialReference:o,sourceSpatialReference:v.fromJSON(e.serviceInfo.spatialReference),customParameters:e.configuration.customParameters});const a=e.configuration.viewType==="3d";return this._elevationAligner=$(a,{elevationInfo:e.elevationInfo!=null?ye.fromJSON(e.elevationInfo):null,alignPointsInFeatures:this._alignPointsInFeatures}),this._elevationFilter=L(a),this.addHandles([P(()=>this._featureFetcher.availability,l=>this.emit("notify-availability",{availability:l}),K),P(()=>this.updating,()=>this._notifyUpdating())]),this._whenSetup.resolve(),this._isInitializing=!1,this.configure(e.configuration)}async configure(e){return await this._updatingHandles.addPromise(this._whenSetup.promise),this._updateFeatureFetcherConfiguration(e),m}async setSuspended(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),g(t),this._featureFetcher.suspended=e,m}async updateOutFields(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),g(t),this._featureFetcher.outFields=new Set(e??[]),m}async fetchCandidates(e,t){await this._whenSetup.promise,g(t);const s=ut(e),i=t?.signal,r=await this._queryEngine.executeQueryForSnapping(s,i);g(i);const n=await this._elevationAligner.alignCandidates(r.candidates,v.fromJSON(e.point.spatialReference)??v.WGS84,i);g(i);const o=await this._symbologyCandidatesFetcher.fetch(n,i);g(i);const a=o.length===0?n:n.concat(o);return{result:{candidates:this._elevationFilter.filter(s,a)}}}async updateTiles(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),g(t),this._featureFetcher.tileSize=e.tileSize,this._featureFetcher.tilesOfInterest=e.tiles,this._featureFetcher.tileInfo=e.tileInfo!=null?I.fromJSON(e.tileInfo):null,m}async refresh(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),g(t),this._featureFetcher.refresh(),m}async whenNotUpdating(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),g(t),await re(()=>!this.updating,t),g(t),m}async getDebugInfo(e,t){return g(t),{result:this._featureFetcher.debugInfo}}async handleEdits(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),g(t),await this._updatingHandles.addPromise(this._featureFetcher.handleEdits(e)),g(t),m}async setHistoricMoment(e,t){return this._featureFetcher.setHistoricMoment(e.moment),m}async notifyElevationSourceChange(e,t){return this._elevationAligner.notifyElevationSourceChange(),m}async notifySymbologyChange(e,t){return this._symbologyCandidatesFetcher.notifySymbologyChange(),m}async setSymbologySnappingSupported(e){return this._symbologyCandidatesFetcher=J(e,this._getSymbologyCandidates),m}_updateFeatureFetcherConfiguration(e){this._featureFetcher.filter=e.filter!=null?S.fromJSON(e.filter):null,this._featureFetcher.customParameters=e.customParameters}_notifyUpdating(){this.emit("notify-updating",{updating:this.updating})}};d([p({readOnly:!0})],T.prototype,"updating",null),d([p()],T.prototype,"_isInitializing",void 0),T=d([R("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceSnappingSourceWorker")],T);const _s=T;function ut(e){if(!e.filter)return{...e,query:{where:"1=1"}};const{distance:t,units:s,spatialRel:i,where:r,timeExtent:n,objectIds:o}=e.filter,a={geometry:e.filter.geometry?ne(e.filter.geometry):void 0,distance:t,units:s,spatialRel:i,timeExtent:n,objectIds:o,where:r??"1=1"};return{...e,query:a}}const m={result:{}};export{_s as default};
diff --git a/fix-191/assets/FeatureSet-BkVNthuN-DUN6SnMl.js b/fix-191/assets/FeatureSet-BkVNthuN-DUN6SnMl.js
deleted file mode 100644
index 679daf34..00000000
--- a/fix-191/assets/FeatureSet-BkVNthuN-DUN6SnMl.js
+++ /dev/null
@@ -1 +0,0 @@
-import{aK as T,v as h,S as d,bi as S,a0 as G,ac as z,af as N,J as R,i as P,e as j,g as F,P as J,ca as x}from"./story-DULt3Rma.js";import{y as q}from"./Field-C6hA1tZj-DdgmWWCq.js";var v;const w=new T({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let c=v=class extends j{constructor(n){super(n),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(n,a){const o=R.fromJSON(a.spatialReference),e=[];for(let s=0;s0)for(let o=0;oMath.round((t-e)/a),i=t=>Math.round((s-t)/o),m=this.features,u=this._getQuantizationFunction(this.geometryType,r,i);for(let t=0,y=m.length;tp*r+e,u=p=>s-p*i;let t=null,y=null;if(this.hasZ&&o?.scale?.[2]!=null){const{translate:[,,p],scale:[,,g]}=o;t=f=>f*g+p}if(this.hasM&&o?.scale?.[3]!=null){const{translate:[,,,p],scale:[,,,g]}=o;y=f=>f==null?f:f*g+p}const l=this._getHydrationFunction(n,m,u,t,y);for(const{geometry:p}of a)p!=null&&l&&l(p);return this.transform=null,this}_quantizePoints(n,a,o){let e,s;const r=[];for(let i=0,m=n.length;i0){const t=a(u[0]),y=o(u[1]);t===e&&y===s||(r.push([t-e,y-s]),e=t,s=y)}else e=a(u[0]),s=o(u[1]),r.push([e,s])}return r.length>0?r:null}_getQuantizationFunction(n,a,o){return n==="point"?e=>(e.x=a(e.x),e.y=o(e.y),e):n==="polyline"||n==="polygon"?e=>{const s=x(e)?e.rings:e.paths,r=[];for(let i=0,m=s.length;i0?(x(e)?e.rings=r:e.paths=r,e):null}:n==="multipoint"?e=>{const s=this._quantizePoints(e.points,a,o);return s&&s.length>0?(e.points=s,e):null}:n==="extent"?e=>e:null}_getHydrationFunction(n,a,o,e,s){return n==="point"?r=>{r.x=a(r.x),r.y=o(r.y),e&&(r.z=e(r.z))}:n==="polyline"||n==="polygon"?r=>{const i=x(r)?r.rings:r.paths;let m,u;for(let t=0,y=i.length;t0?(m+=f[0],u+=f[1]):(m=f[0],u=f[1]),f[0]=a(m),f[1]=o(u)}}if(e&&s)for(let t=0,y=i.length;t{r.xmin=a(r.xmin),r.ymin=o(r.ymin),r.xmax=a(r.xmax),r.ymax=o(r.ymax),e&&r.zmax!=null&&r.zmin!=null&&(r.zmax=e(r.zmax),r.zmin=e(r.zmin)),s&&r.mmax!=null&&r.mmin!=null&&(r.mmax=s(r.mmax),r.mmin=s(r.mmin))}:n==="multipoint"?r=>{const i=r.points;let m,u;for(let t=0,y=i.length;t0?(m+=l[0],u+=l[1]):(m=l[0],u=l[1]),l[0]=a(m),l[1]=o(u)}if(e&&s)for(let t=0,y=i.length;t({enabled:n})}}})],c.prototype,"exceededTransferLimit",void 0),h([d({type:[S],json:{write:!0}})],c.prototype,"features",void 0),h([G("features")],c.prototype,"readFeatures",null),h([d({type:[q],json:{write:!0}})],c.prototype,"fields",void 0),h([d({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:w.read}}})],c.prototype,"geometryType",void 0),h([z("geometryType")],c.prototype,"writeGeometryType",null),h([d({type:Boolean,json:{write:{overridePolicy:n=>({enabled:n})}}})],c.prototype,"hasM",void 0),h([d({type:Boolean,json:{write:{overridePolicy:n=>({enabled:n})}}})],c.prototype,"hasZ",void 0),h([d({types:N,json:{write:!0}})],c.prototype,"queryGeometry",void 0),h([G("queryGeometry")],c.prototype,"readQueryGeometry",null),h([d({type:R,json:{write:!0}})],c.prototype,"spatialReference",void 0),h([z("spatialReference")],c.prototype,"writeSpatialReference",null),h([d({json:{write:!0}})],c.prototype,"transform",void 0),c=v=h([P("esri.rest.support.FeatureSet")],c),c.prototype.toJSON.isDefaultToJSON=!0;const M=c;export{M as O};
diff --git a/fix-191/assets/FeatureStore-Co2V0sVE-BhxyyBiT.js b/fix-191/assets/FeatureStore-Co2V0sVE-BhxyyBiT.js
deleted file mode 100644
index c18eec37..00000000
--- a/fix-191/assets/FeatureStore-Co2V0sVE-BhxyyBiT.js
+++ /dev/null
@@ -1 +0,0 @@
-import{gU as d,I as f,aq as g,gV as l,a1 as i,o as a,bh as u}from"./story-DULt3Rma.js";import{V as h}from"./featureConversionUtils-D6hFQ4Af-Cb3HkUwF.js";import{r as m}from"./BoundsStore--N6o1xkF-W3ru2llD.js";import{r as y}from"./timeSupport-jPViR5jn-Blw8tou2.js";import{s as _}from"./optimizedFeatureQueryEngineAdapter-DFdaawxC-p1ngWYoX.js";const c=d();class M{constructor(t){this.geometryInfo=t,this._boundsStore=new m,this._featuresById=new Map,this.events=new f,this.featureAdapter=_}get geometryType(){return this.geometryInfo.geometryType}get hasM(){return this.geometryInfo.hasM}get hasZ(){return this.geometryInfo.hasZ}get numFeatures(){return this._featuresById.size}get fullBounds(){return this._boundsStore.fullBounds}get storeStatistics(){let t=0;return this._featuresById.forEach(e=>{e.geometry!=null&&e.geometry.coords&&(t+=e.geometry.coords.length)}),{featureCount:this._featuresById.size,vertexCount:t/(this.hasZ?this.hasM?4:3:this.hasM?3:2)}}getFullExtent(t){if(this.fullBounds==null)return null;const[e,s,r,o]=this.fullBounds;return{xmin:e,ymin:s,xmax:r,ymax:o,spatialReference:y(t)}}add(t){this._add(t),this._emitChanged()}addMany(t){for(const e of t)this._add(e);this._emitChanged()}upsertMany(t){const e=t.map(s=>this._upsert(s));return this._emitChanged(),e.filter(g)}clear(){this._featuresById.clear(),this._boundsStore.clear(),this._emitChanged()}removeById(t){const e=this._featuresById.get(t);return e?(this._remove(e),this._emitChanged(),e):null}removeManyById(t){this._boundsStore.invalidateIndex();for(const e of t){const s=this._featuresById.get(e);s&&this._remove(s)}this._emitChanged()}forEachBounds(t,e){for(const s of t){const r=this._boundsStore.get(s.objectId);r&&e(l(c,r))}}getFeature(t){return this._featuresById.get(t)}has(t){return this._featuresById.has(t)}forEach(t){this._featuresById.forEach(e=>t(e))}forEachInBounds(t,e){this._boundsStore.forEachInBounds(t,s=>{e(this._featuresById.get(s))})}_emitChanged(){this.events.emit("changed",void 0)}_add(t){if(!t)return;const e=t.objectId;if(e==null)return void i.getLogger("esri.layers.graphics.data.FeatureStore").error(new a("featurestore:invalid-feature","feature id is missing",{feature:t}));const s=this._featuresById.get(e);let r;if(s?(t.displayId=s.displayId,r=this._boundsStore.get(e),this._boundsStore.delete(e)):this.onFeatureAdd!=null&&this.onFeatureAdd(t),!t.geometry?.coords?.length)return this._boundsStore.set(e,null),void this._featuresById.set(e,t);r=h(r??u(),t.geometry,this.geometryInfo.hasZ,this.geometryInfo.hasM),r!=null&&this._boundsStore.set(e,r),this._featuresById.set(e,t)}_upsert(t){const e=t?.objectId;if(e==null)return i.getLogger("esri.layers.graphics.data.FeatureStore").error(new a("featurestore:invalid-feature","feature id is missing",{feature:t})),null;const s=this._featuresById.get(e);if(!s)return this._add(t),t;const{geometry:r,attributes:o}=t;for(const n in o)s.attributes[n]=o[n];return r&&(s.geometry=r,this._boundsStore.set(e,h(u(),r,this.geometryInfo.hasZ,this.geometryInfo.hasM)??null)),s}_remove(t){this.onFeatureRemove!=null&&this.onFeatureRemove(t);const e=t.objectId;return this._boundsStore.delete(e),this._featuresById.delete(e),t}}export{M as I};
diff --git a/fix-191/assets/FeatureTemplate-SPHPD45f-BaZP_5wa.js b/fix-191/assets/FeatureTemplate-SPHPD45f-BaZP_5wa.js
deleted file mode 100644
index 67078bc2..00000000
--- a/fix-191/assets/FeatureTemplate-SPHPD45f-BaZP_5wa.js
+++ /dev/null
@@ -1 +0,0 @@
-import{aK as l,aa as a,e as s,v as o,S as r,i as n}from"./story-DULt3Rma.js";const t=new l({esriFeatureEditToolAutoCompletePolygon:"auto-complete-polygon",esriFeatureEditToolCircle:"circle",esriFeatureEditToolEllipse:"ellipse",esriFeatureEditToolFreehand:"freehand",esriFeatureEditToolLine:"line",esriFeatureEditToolNone:"none",esriFeatureEditToolPoint:"point",esriFeatureEditToolPolygon:"polygon",esriFeatureEditToolRectangle:"rectangle",esriFeatureEditToolArrow:"arrow",esriFeatureEditToolTriangle:"triangle",esriFeatureEditToolLeftArrow:"left-arrow",esriFeatureEditToolRightArrow:"right-arrow",esriFeatureEditToolUpArrow:"up-arrow",esriFeatureEditToolDownArrow:"down-arrow"});let e=class extends a(s){constructor(i){super(i),this.name=null,this.description=null,this.drawingTool=null,this.prototype=null,this.thumbnail=null}};o([r({json:{write:!0}})],e.prototype,"name",void 0),o([r({json:{write:!0}})],e.prototype,"description",void 0),o([r({json:{read:t.read,write:t.write}})],e.prototype,"drawingTool",void 0),o([r({json:{write:!0}})],e.prototype,"prototype",void 0),o([r({json:{write:!0}})],e.prototype,"thumbnail",void 0),e=o([n("esri.layers.support.FeatureTemplate")],e);const d=e;export{d as p};
diff --git a/fix-191/assets/FeatureType-C9hJmS6_-BkSD91s_.js b/fix-191/assets/FeatureType-C9hJmS6_-BkSD91s_.js
deleted file mode 100644
index d366710a..00000000
--- a/fix-191/assets/FeatureType-C9hJmS6_-BkSD91s_.js
+++ /dev/null
@@ -1 +0,0 @@
-import{aa as a,e as p,v as e,S as i,a0 as m,ac as l,i as d}from"./story-DULt3Rma.js";import{i as y}from"./Field-C6hA1tZj-DdgmWWCq.js";import{p as c}from"./FeatureTemplate-SPHPD45f-BaZP_5wa.js";let o=class extends a(p){constructor(t){super(t),this.id=null,this.name=null,this.domains=null,this.templates=null}readDomains(t){const r={};for(const s of Object.keys(t))r[s]=y(t[s]);return r}writeDomains(t,r){const s={};for(const n of Object.keys(t))t[n]&&(s[n]=t[n]?.toJSON());r.domains=s}};e([i({json:{write:!0}})],o.prototype,"id",void 0),e([i({json:{write:!0}})],o.prototype,"name",void 0),e([i({json:{write:!0}})],o.prototype,"domains",void 0),e([m("domains")],o.prototype,"readDomains",null),e([l("domains")],o.prototype,"writeDomains",null),e([i({type:[c],json:{write:!0}})],o.prototype,"templates",void 0),o=e([d("esri.layers.support.FeatureType")],o);const w=o;export{w as y};
diff --git a/fix-191/assets/Field-C6hA1tZj-DdgmWWCq.js b/fix-191/assets/Field-C6hA1tZj-DdgmWWCq.js
deleted file mode 100644
index 3ce0b620..00000000
--- a/fix-191/assets/Field-C6hA1tZj-DdgmWWCq.js
+++ /dev/null
@@ -1 +0,0 @@
-import{v as t,S as o,i as l,aK as j,bz as u,a0 as f,bB as x,e as b,P as T}from"./story-DULt3Rma.js";import{i as D}from"./fieldType-CD2CL2hr-BeIaxmP1.js";import"./main-Bm7g2Jde.js";var m;let s=m=class extends b{constructor(e){super(e),this.name=null,this.code=null}clone(){return new m({name:this.name,code:this.code})}};t([o({type:String,json:{write:!0}})],s.prototype,"name",void 0),t([o({type:[String,Number],json:{write:!0}})],s.prototype,"code",void 0),s=m=t([l("esri.layers.support.CodedValue")],s);const J=new j({inherited:"inherited",codedValue:"coded-value",range:"range"});let d=class extends b{constructor(e){super(e),this.name=null,this.type=null}};t([o({type:String,json:{write:!0}})],d.prototype,"name",void 0),t([u(J)],d.prototype,"type",void 0),d=t([l("esri.layers.support.Domain")],d);const y=d;var h;let p=h=class extends y{constructor(e){super(e),this.codedValues=null,this.type="coded-value"}getName(e){let r=null;if(this.codedValues){const i=String(e);this.codedValues.some(w=>(String(w.code)===i&&(r=w.name),!!r))}return r}clone(){return new h({codedValues:T(this.codedValues),name:this.name})}};t([o({type:[s],json:{write:!0}})],p.prototype,"codedValues",void 0),t([u({codedValue:"coded-value"})],p.prototype,"type",void 0),p=h=t([l("esri.layers.support.CodedValueDomain")],p);const S=p;var v;let c=v=class extends y{constructor(e){super(e),this.type="inherited"}clone(){return new v}};t([u({inherited:"inherited"})],c.prototype,"type",void 0),c=v=t([l("esri.layers.support.InheritedDomain")],c);const O=c;var g;let a=g=class extends y{constructor(e){super(e),this.maxValue=null,this.minValue=null,this.type="range"}clone(){return new g({maxValue:this.maxValue,minValue:this.minValue,name:this.name})}};t([o({json:{type:[Number],read:{source:"range",reader:(e,r)=>r.range?.[1]},write:{enabled:!1,overridePolicy(){return{enabled:this.maxValue!=null&&this.minValue==null}},target:"range",writer(e,r,i){r[i]=[this.minValue||0,e]}}}})],a.prototype,"maxValue",void 0),t([o({json:{type:[Number],read:{source:"range",reader:(e,r)=>r.range?.[0]},write:{target:"range",writer(e,r,i){r[i]=[e,this.maxValue||0]}}}})],a.prototype,"minValue",void 0),t([u({range:"range"})],a.prototype,"type",void 0),a=g=t([l("esri.layers.support.RangeDomain")],a);const N=a,B={key:"type",base:y,typeMap:{range:N,"coded-value":S,inherited:O}};function P(e){if(!e?.type)return null;switch(e.type){case"range":return N.fromJSON(e);case"codedValue":return S.fromJSON(e);case"inherited":return O.fromJSON(e)}return null}var V;const _=new j({binary:"binary",coordinate:"coordinate",countOrAmount:"count-or-amount",dateAndTime:"date-and-time",description:"description",locationOrPlaceName:"location-or-place-name",measurement:"measurement",nameOrTitle:"name-or-title",none:"none",orderedOrRanked:"ordered-or-ranked",percentageOrRatio:"percentage-or-ratio",typeOrCategory:"type-or-category",uniqueIdentifier:"unique-identifier"});let n=V=class extends b{constructor(e){super(e),this.alias=null,this.defaultValue=void 0,this.description=null,this.domain=null,this.editable=!0,this.length=void 0,this.name=null,this.nullable=!0,this.type=null,this.valueType=null,this.visible=!0}readDescription(e,{description:r}){let i=null;try{i=r?JSON.parse(r):null}catch{}return i?.value??null}readValueType(e,{description:r}){let i=null;try{i=r?JSON.parse(r):null}catch{}return i?_.fromJSON(i.fieldValueType):null}clone(){return new V({alias:this.alias,defaultValue:this.defaultValue,description:this.description,domain:this.domain?.clone()??null,editable:this.editable,length:this.length,name:this.name,nullable:this.nullable,type:this.type,valueType:this.valueType,visible:this.visible})}};t([o({type:String,json:{write:!0}})],n.prototype,"alias",void 0),t([o({type:[String,Number],json:{write:{allowNull:!0}}})],n.prototype,"defaultValue",void 0),t([o()],n.prototype,"description",void 0),t([f("description")],n.prototype,"readDescription",null),t([o({types:B,json:{read:{reader:P},write:!0}})],n.prototype,"domain",void 0),t([o({type:Boolean,json:{write:!0}})],n.prototype,"editable",void 0),t([o({type:x,json:{write:{overridePolicy:e=>({enabled:Number.isFinite(e)})}}})],n.prototype,"length",void 0),t([o({type:String,json:{write:!0}})],n.prototype,"name",void 0),t([o({type:Boolean,json:{write:!0}})],n.prototype,"nullable",void 0),t([u(D)],n.prototype,"type",void 0),t([o()],n.prototype,"valueType",void 0),t([f("valueType",["description"])],n.prototype,"readValueType",null),t([o({type:Boolean,json:{read:!1}})],n.prototype,"visible",void 0),n=V=t([l("esri.layers.support.Field")],n);const F=n,q=Object.freeze(Object.defineProperty({__proto__:null,default:F},Symbol.toStringTag,{value:"Module"}));export{q as F,S as a,P as i,B as n,s as p,F as y};
diff --git a/fix-191/assets/FieldsIndex-HmzMbJQG-nfgmohOl.js b/fix-191/assets/FieldsIndex-HmzMbJQG-nfgmohOl.js
deleted file mode 100644
index 5d6a8c6c..00000000
--- a/fix-191/assets/FieldsIndex-HmzMbJQG-nfgmohOl.js
+++ /dev/null
@@ -1 +0,0 @@
-import{cg as N,ch as S,ci as y,cj as _,ck as b,a1 as B,o as q,cl as h,cm as u,b_ as z,an as J,c7 as O,cn as L,co as $,cp as D,cq as c}from"./story-DULt3Rma.js";import{t as R}from"./UnknownTimeZone-C--TOcPG-C3cinqRV.js";function I(s){return"timeZone"in s}function x(s){return"timeZone"in s}function C(s){return"dateFieldsTimeZone"in s}const j=new Map;let A=class m{static fromJSON(e){return new m(e.fields,e.timeZoneByFieldName)}static fromLayer(e){return new m(e.fields??[],T(e))}static fromLayerJSON(e){return new m(e.fields??[],T(e))}constructor(e=[],t){this._fieldsMap=new Map,this._normalizedFieldsMap=new Map,this._dateFieldsSet=new Set,this._numericFieldsSet=new Set,this._requiredFields=null,this.dateFields=[],this.numericFields=[],this.fields=e||[],this._timeZoneByFieldName=t?new Map(t):null;const n=[];for(const i of this.fields){const r=i?.name,o=g(r);if(r&&o){const l=a(r);this._fieldsMap.set(r,i),this._fieldsMap.set(l,i),this._normalizedFieldsMap.set(o,i),n.push(`${l}:${i.type}:${this._timeZoneByFieldName?.get(r)}`),N(i)?(this.dateFields.push(i),this._dateFieldsSet.add(i)):S(i)&&(this._numericFieldsSet.add(i),this.numericFields.push(i)),y(i)||_(i)||(i.editable=i.editable==null||!!i.editable,i.nullable=i.nullable==null||!!i.nullable)}}n.sort(),this.uid=n.join()}get requiredFields(){if(!this._requiredFields){this._requiredFields=[];for(const e of this.fields)y(e)||_(e)||e.nullable||b(e)!==void 0||this._requiredFields.push(e)}return this._requiredFields}equals(e){return this.uid===e?.uid}has(e){return this.get(e)!=null}get(e){if(!e)return;let t=this._fieldsMap.get(e);return t||(t=this._fieldsMap.get(a(e))??this._normalizedFieldsMap.get(g(e)),t&&this._fieldsMap.set(e,t),t)}getTimeZone(e){const t=this.get(e&&typeof e!="string"?e.name:e);return t?this._timeZoneByFieldName?this._timeZoneByFieldName.get(t.name):t.type==="date"||t.type==="esriFieldTypeDate"?(B.getLogger("esri.layers.support.FieldsIndex").error(new q("getTimeZone:no-timezone-information",`no time zone information for field '${t.name}'`)),h):Z.has(t.type)?u:null:null}getLuxonTimeZone(e){const t=this.getTimeZone(e);return t?t===u?R.instance:t===h?z.utcInstance:J(j,t,()=>O.create(t)):null}isDateField(e){return this._dateFieldsSet.has(this.get(e))}isTimeOnlyField(e){return L(this.get(e))}isNumericField(e){return this._numericFieldsSet.has(this.get(e))}normalizeFieldName(e){return this.get(e)?.name??void 0}toJSON(){return{fields:this.fields.map(e=>$(e)?e.toJSON():e),timeZoneByFieldName:this._timeZoneByFieldName?Array.from(this._timeZoneByFieldName.entries()):null}}};function a(s){return s.trim().toLowerCase()}function g(s){return D(s)?.toLowerCase()??""}const Z=new Set(["time-only","date-only","timestamp-offset","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"]);function T(s){const e=new Map;if(!s.fields)return e;const t=s.datesInUnknownTimezone===!0,{timeInfo:n,editFieldsInfo:i}=s,r=(n?"startField"in n?n.startField:n.startTimeField:"")??"",o=(n?"endField"in n?n.endField:n.endTimeField:"")??"",l=C(s)?s.dateFieldsTimeZone??null:s.dateFieldsTimeReference?c(s.dateFieldsTimeReference):null,F=i?I(i)?i.timeZone??l:i.dateFieldsTimeReference?c(i.dateFieldsTimeReference):l??h:null,p=n?x(n)?n.timeZone??l:n.timeReference?c(n.timeReference):l:null,w=new Map([[a(i?.creationDateField??""),F],[a(i?.editDateField??""),F],[a(r),p],[a(o),p]]);for(const{name:d,type:f}of s.fields)if(Z.has(f))e.set(d,u);else if(f!=="date"&&f!=="esriFieldTypeDate")e.set(d,null);else if(t)e.set(d,u);else{const M=w.get(a(d??""))??l;e.set(d,M)}return e}export{A as o};
diff --git a/fix-191/assets/FloatingArrow-BG9llDYg-DxKn5aR3.js b/fix-191/assets/FloatingArrow-BG9llDYg-DxKn5aR3.js
deleted file mode 100644
index 2801b1a0..00000000
--- a/fix-191/assets/FloatingArrow-BG9llDYg-DxKn5aR3.js
+++ /dev/null
@@ -1 +0,0 @@
-import{a}from"./themeUtils-YjM7iIiX-Dxg99YfT.js";const s={arrow:"calcite-floating-ui-arrow",arrowStroke:"calcite-floating-ui-arrow__stroke"},d={width:12,height:6,strokeWidth:1},c=({floatingLayout:l,key:n,ref:w})=>{const{width:t,height:e,strokeWidth:r}=d,o=t/2,i=l==="vertical",h=`M0,0 H${t} L${t-o},${e} Q${o},${e} ${o},${e} Z`;return a("svg",{"aria-hidden":"true",class:s.arrow,height:t,key:n,ref:w,viewBox:`0 0 ${t} ${t+(i?0:r)}`,width:t+(i?r:0)},r>0&&a("path",{class:s.arrowStroke,d:h,fill:"none","stroke-width":r+1}),a("path",{d:h,stroke:"none"}))};export{c as $};
diff --git a/fix-191/assets/GeoJSONLayer-BFFwDRph-CE0i4Pge.js b/fix-191/assets/GeoJSONLayer-BFFwDRph-CE0i4Pge.js
deleted file mode 100644
index c0fd96cc..00000000
--- a/fix-191/assets/GeoJSONLayer-BFFwDRph-CE0i4Pge.js
+++ /dev/null
@@ -1,2 +0,0 @@
-const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./editingSupport-gUqP9iyf-Dk8BPGiA.js","./story-DULt3Rma.js","./main-Bm7g2Jde.js","./main-DIDVYkhz.css","./story-DBsbaiEU.css","./uuid-Dj9mdEVg-BaKSCiyT.js","./normalizeUtils-Bxmy9MNI-CZMTs6Vg.js","./normalizeUtilsCommon-CRJlkfEA-CgRBIB_J.js","./utils-9sQxfkoa-CjNZjdKD.js","./utils-Bq23Xwmj-DhZYu3yh.js","./EditBusLayer-Df29OyJh-C5V3CPW4.js","./infoFor3D-DIuYZyyK-BtH19JJ7.js"])))=>i.map(i=>d[i]);
-import{_ as w}from"./main-Bm7g2Jde.js";import{v as r,S as i,i as E,J as O,W as J,bT as y,dL as N,a as f,bQ as j,n as S,bW as F,bL as R,aB as T,bp as q,o as g,l as P,K as $,a1 as v}from"./story-DULt3Rma.js";import"./UniqueValueRenderer-fS5V0Ej1-BykZGEgA.js";import{m as D,u as k}from"./jsonUtils-C64Zfu7c-DhKY2SjZ.js";import{m as C}from"./MultiOriginJSONSupport-DKRh9P6w-tF-GNPM3.js";import{D as L}from"./Layer-ChoECxvZ-DQ-28MDL.js";import{q as Q}from"./workers-PiCjreoO-CABaMBvC.js";import{$ as G}from"./clientSideDefaults-BqqayPct-DxPS0b1M.js";import{O as Z}from"./FeatureSet-BkVNthuN-DUN6SnMl.js";import{u as z}from"./BlendLayer-D1WkSmwP-BHrWqYGA.js";import{i as V}from"./CustomParametersMixin-vdKsTHer-ByoZbxFR.js";import{l as W}from"./FeatureEffectLayer-Cro89IEC-DzZmG0FU.js";import{v as A}from"./FeatureReductionLayer-BTZjL0_Z-BuJtD3jW.js";import{E as B}from"./OperationalLayer-B5IXiMa2-BCAq75zB.js";import{p as U}from"./OrderedLayer-6Qsmrd_l-DuIv1zsG.js";import{C as Y}from"./PortalLayer-CElnYuSQ-jChQE2im.js";import{T as M}from"./RefreshableLayer-a8BQ58Xh-D8rhwboV.js";import{S as X}from"./ScaleRangeLayer-Bz0DcnvM-BoX1P84V.js";import{x as H}from"./TemporalLayer-CpOrN_w9-Obih3ZXC.js";import{i as K,$ as ee,e as te,Y as re,_ as ie,E as oe,X as se,V as ne,Z as ae}from"./commonProperties-BtIqvFU_-CfGSai59.js";import{p as le}from"./FeatureTemplate-SPHPD45f-BaZP_5wa.js";import{y as pe}from"./Field-C6hA1tZj-DdgmWWCq.js";import{f as ue}from"./fieldProperties-Bq26w7gt-BW_ewX2p.js";import{C as de,q as he}from"./labelingInfo-DGVNul26-DjgpGBtD.js";import{b as d}from"./Query-BrwMGK8U-DaHaJHm8.js";import{w as me}from"./popupUtils-B0uZcXX0-CcOxvXQU.js";import"./RendererLegendOptions-K3md58-X-DR3I9sq7.js";import"./diffUtils-Cz3Fi8Xb-Dx3TppL9.js";import"./colorRamps-q0bZVhs2-DkXm9F7X.js";import"./sizeVariableUtils-t52KcLLi-D0hbQF8b.js";import"./visualVariableUtils-D3kZJRyn-PuRGVqRl.js";import"./compilerUtils-CV1QYWI8-5SsZKq4e.js";import"./lengthUtils-DKpMe5qR-BEdWsC7X.js";import"./styleUtils-BtpNqZyT-nGAxWjLn.js";import"./LRUCache-C3erQTWv-CBR8rG5i.js";import"./Version-CoKzbupV-BJLwrorf.js";import"./FieldsIndex-HmzMbJQG-nfgmohOl.js";import"./UnknownTimeZone-C--TOcPG-C3cinqRV.js";import"./OverrideHelper-DWRbVlj1-CckXmRiC.js";import"./colorUtils-Cthpxcks-CToOrmBC.js";import"./vec42-D8CJyqHG-DnfLTeQH.js";import"./common-CYWrYyJl-E8-sukrT.js";import"./vec4f64-hf2nxvhQ-CaAr8PTM.js";import"./utils-SPbpQbmm-BoVqh098.js";import"./enums-CpSG_SL3-BMD3Tb1v.js";import"./quantizationUtils-bJy1cRwp-DKHwdnl5.js";import"./heatmapUtils-seiMkkkR-DETYxyq4.js";import"./TimeExtent-Cn0Jofqr-DWlRQ-Qn.js";import"./QueryEngineCapabilities-Gr588n9t-DjYb9CEb.js";import"./capabilities-Cjn77swe-Y9lFlGVh.js";import"./jsonUtils-wIllKWI4-CU3QWWOb.js";import"./parser-DyDJ-rlI-8QTzeGdu.js";import"./mat4f32-CiZjBg9k-CUm34GoR.js";import"./mat4-DX7gBViE-DBcL5Ayd.js";import"./FeatureEffect-CDEk9Es7-DVWjqrZY.js";import"./FeatureFilter-BCFHgLVU-9aOViOGO.js";import"./fieldType-CD2CL2hr-BeIaxmP1.js";import"./FeatureReductionSelection-BjX3h7Sz-B4a-3Q-d.js";import"./featureLayerUtils-DgfQQyK4-3epgQor7.js";import"./uuid-Dj9mdEVg-BaKSCiyT.js";import"./RelationshipQuery-DJsz3K0U-6hvEADre.js";import"./MD5-CHHr-oed-SuyrCYQ0.js";import"./OrderByInfo-GD2XnU8e-D_OyCWyv.js";import"./PortalItem-CctGdnxF-Dbw3pVTD.js";import"./portalItemUtils-B8bw6SAG-CEVZt8QT.js";import"./projection-BA9M1R7d-DvHr0GeG.js";import"./projectBuffer-CvCBvJ6W-Cc8J4MEJ.js";import"./TimeInfo-w_HB2CsF-CGuO-bD4.js";import"./ElevationInfo-yv2-9tj6-B5v76p2q.js";import"./labelUtils-BW14kBqX-CwFoWB4r.js";let l=class extends T{constructor(){super(...arguments),this.type="geojson",this.refresh=q(async e=>{await this.load();const{extent:t,timeExtent:s}=await this._connection.invoke("refresh",e);return this.sourceJSON.extent=t,s&&(this.sourceJSON.timeInfo.timeExtent=[s.start,s.end]),{dataChanged:!0,updates:{extent:this.sourceJSON.extent,timeInfo:this.sourceJSON.timeInfo}}})}load(e){const t=e!=null?e.signal:null;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null}applyEdits(e){return this.load().then(()=>this._applyEdits(e))}openPorts(){return this.load().then(()=>this._connection.openPorts())}queryFeatures(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryFeatures",e?e.toJSON():null,t)).then(s=>Z.fromJSON(s))}queryFeaturesJSON(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryFeatures",e?e.toJSON():null,t))}queryFeatureCount(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryFeatureCount",e?e.toJSON():null,t))}queryObjectIds(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryObjectIds",e?e.toJSON():null,t))}queryExtent(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryExtent",e?e.toJSON():null,t)).then(s=>({count:s.count,extent:S.fromJSON(s.extent)}))}querySnapping(e,t={}){return this.load(t).then(()=>this._connection.invoke("querySnapping",e,t))}_applyEdits(e){if(!this._connection)throw new g("geojson-layer-source:edit-failure","Memory source not loaded");const t=this.layer.objectIdField,s=[],n=[],h=[];if(e.addFeatures)for(const a of e.addFeatures)s.push(this._serializeFeature(a));if(e.deleteFeatures)for(const a of e.deleteFeatures)"objectId"in a&&a.objectId!=null?n.push(a.objectId):"attributes"in a&&a.attributes[t]!=null&&n.push(a.attributes[t]);if(e.updateFeatures)for(const a of e.updateFeatures)h.push(this._serializeFeature(a));return this._connection.invoke("applyEdits",{adds:s,updates:h,deletes:n}).then(({extent:a,timeExtent:p,featureEditResults:m})=>(this.sourceJSON.extent=a,p&&(this.sourceJSON.timeInfo.timeExtent=[p.start,p.end]),this._createEditsResult(m)))}_createEditsResult(e){return{addFeatureResults:e.addResults?e.addResults.map(this._createFeatureEditResult,this):[],updateFeatureResults:e.updateResults?e.updateResults.map(this._createFeatureEditResult,this):[],deleteFeatureResults:e.deleteResults?e.deleteResults.map(this._createFeatureEditResult,this):[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}_createFeatureEditResult(e){const t=e.success===!0?null:e.error||{code:void 0,description:void 0};return{objectId:e.objectId,globalId:e.globalId,error:t?new g("geojson-layer-source:edit-failure",t.description,{code:t.code}):null}}_serializeFeature(e){const{attributes:t}=e,s=this._geometryForSerialization(e);return s?{geometry:s.toJSON(),attributes:t}:{attributes:t}}_geometryForSerialization(e){const{geometry:t}=e;return t==null?null:t.type==="mesh"||t.type==="extent"?P.fromExtent(t.extent):t}async _startWorker(e){this._connection=await Q("GeoJSONSourceWorker",{strategy:$("feature-layers-workers")?"dedicated":"local",signal:e,registryTarget:this});const{fields:t,spatialReference:s,hasZ:n,geometryType:h,objectIdField:a,url:p,timeInfo:m,customParameters:I}=this.layer,x=this.layer.originOf("spatialReference")==="defaults",_={url:p,customParameters:I,fields:t&&t.map(c=>c.toJSON()),geometryType:F.toJSON(h),hasZ:n,objectIdField:a,timeInfo:m?m.toJSON():null,spatialReference:x?null:s&&s.toJSON()},u=await this._connection.invoke("load",_,{signal:e});for(const c of u.warnings)v.getLogger(this.layer).warn("#load()",`${c.message} (title: '${this.layer.title||"no title"}', id: '${this.layer.id??"no id"}')`,{warning:c});u.featureErrors.length&&v.getLogger(this.layer).warn("#load()",`Encountered ${u.featureErrors.length} validation errors while loading features. (title: '${this.layer.title||"no title"}', id: '${this.layer.id??"no id"}')`,{errors:u.featureErrors}),this.sourceJSON=u.layerDefinition,this.capabilities=G(this.sourceJSON.hasZ,!0)}};r([i()],l.prototype,"capabilities",void 0),r([i()],l.prototype,"type",void 0),r([i({constructOnly:!0})],l.prototype,"layer",void 0),r([i()],l.prototype,"sourceJSON",void 0),l=r([E("esri.layers.graphics.sources.GeoJSONSource")],l);const b=ue();let o=class extends U(V(A(W(z(H(X(M(B(Y(C(L))))))))))){constructor(e){super(e),this.attributeTableTemplate=null,this.copyright=null,this.dateFieldsTimeZone=null,this.definitionExpression=null,this.displayField=null,this.editingEnabled=!1,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.fullExtent=null,this.geometryType=null,this.hasZ=void 0,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="GeoJSON",this.outFields=null,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new l({layer:this}),this.spatialReference=O.WGS84,this.templates=null,this.title="GeoJSON",this.type="geojson"}destroy(){this.source?.destroy()}load(e){const t=this.loadFromPortal({supportedTypes:["GeoJson"],supportsData:!1},e).catch(J).then(()=>this.source.load(e)).then(()=>{this.read(this.source.sourceJSON,{origin:"service",url:this.parsedUrl}),this.revert(["objectIdField","fields","timeInfo"],"service"),y(this.renderer,this.fieldsIndex),N(this.timeInfo,this.fieldsIndex)});return this.addResolvingPromise(t),Promise.resolve(this)}get capabilities(){return this.source?this.source.capabilities:null}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("capabilities"),(this._get("createQueryVersion")||0)+1}get defaultPopupTemplate(){return this.createPopupTemplate()}get isTable(){return this.loaded&&this.geometryType==null}get parsedUrl(){return this.url?f(this.url):null}set renderer(e){y(e,this.fieldsIndex),this._set("renderer",e)}set url(e){if(!e)return void this._set("url",e);const t=f(e);this._set("url",t.path),t.query&&(this.customParameters={...this.customParameters,...t.query})}async applyEdits(e,t){const{applyEdits:s}=await w(()=>import("./editingSupport-gUqP9iyf-Dk8BPGiA.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url);await this.load();const n=await s(this,this.source,e,t);return this.read({extent:this.source.sourceJSON.extent,timeInfo:this.source.sourceJSON.timeInfo},{origin:"service",ignoreDefaults:!0}),n}on(e,t){return super.on(e,t)}createPopupTemplate(e){return me(this,e)}createQuery(){const e=new d,t=this.capabilities?.data;e.returnGeometry=!0,t&&t.supportsZ&&(e.returnZ=!0),e.outFields=["*"],e.where=this.definitionExpression||"1=1";const{timeOffset:s,timeExtent:n}=this;return e.timeExtent=s!=null&&n!=null?n.offset(-s.value,s.unit):n||null,e}getFieldDomain(e,t){return this.getField(e)?.domain}getField(e){return this.fieldsIndex.get(e)}queryFeatures(e,t){return this.load().then(()=>this.source.queryFeatures(d.from(e)||this.createQuery(),t)).then(s=>{if(s?.features)for(const n of s.features)n.layer=n.sourceLayer=this;return s})}queryObjectIds(e,t){return this.load().then(()=>this.source.queryObjectIds(d.from(e)||this.createQuery(),t))}queryFeatureCount(e,t){return this.load().then(()=>this.source.queryFeatureCount(d.from(e)||this.createQuery(),t))}queryExtent(e,t){return this.load().then(()=>this.source.queryExtent(d.from(e)||this.createQuery(),t))}async hasDataChanged(){try{const{dataChanged:e,updates:t}=await this.source.refresh(this.customParameters);return t!=null&&this.read(t,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}};r([i(K)],o.prototype,"attributeTableTemplate",void 0),r([i({readOnly:!0,json:{read:!1,write:!1}})],o.prototype,"capabilities",null),r([i({type:String})],o.prototype,"copyright",void 0),r([i({readOnly:!0})],o.prototype,"createQueryVersion",null),r([i(j("dateFieldsTimeReference"))],o.prototype,"dateFieldsTimeZone",void 0),r([i({readOnly:!0})],o.prototype,"defaultPopupTemplate",null),r([i({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],o.prototype,"definitionExpression",void 0),r([i({type:String})],o.prototype,"displayField",void 0),r([i({type:Boolean})],o.prototype,"editingEnabled",void 0),r([i(ee)],o.prototype,"elevationInfo",void 0),r([i({type:[pe],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"fields"}}}})],o.prototype,"fields",void 0),r([i(b.fieldsIndex)],o.prototype,"fieldsIndex",void 0),r([i({type:S,json:{name:"extent"}})],o.prototype,"fullExtent",void 0),r([i({type:["point","polygon","polyline","multipoint"],json:{read:{reader:F.read}}})],o.prototype,"geometryType",void 0),r([i({type:Boolean})],o.prototype,"hasZ",void 0),r([i(te)],o.prototype,"id",void 0),r([i({type:Boolean,readOnly:!0})],o.prototype,"isTable",null),r([i(re)],o.prototype,"labelsVisible",void 0),r([i({type:[de],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:he},write:!0}})],o.prototype,"labelingInfo",void 0),r([i(ie)],o.prototype,"legendEnabled",void 0),r([i({type:["show","hide"]})],o.prototype,"listMode",void 0),r([i({type:String,json:{name:"layerDefinition.objectIdField",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"objectIdField"}}}})],o.prototype,"objectIdField",void 0),r([i(oe)],o.prototype,"opacity",void 0),r([i({type:["GeoJSON"]})],o.prototype,"operationalLayerType",void 0),r([i(b.outFields)],o.prototype,"outFields",void 0),r([i({readOnly:!0})],o.prototype,"parsedUrl",null),r([i(se)],o.prototype,"popupEnabled",void 0),r([i({type:R,json:{name:"popupInfo",write:!0}})],o.prototype,"popupTemplate",void 0),r([i({types:D,json:{name:"layerDefinition.drawingInfo.renderer",write:!0,origins:{service:{name:"drawingInfo.renderer"},"web-scene":{types:k}}}})],o.prototype,"renderer",null),r([i(ne)],o.prototype,"screenSizePerspectiveEnabled",void 0),r([i({readOnly:!0})],o.prototype,"source",void 0),r([i({type:O})],o.prototype,"spatialReference",void 0),r([i({type:[le]})],o.prototype,"templates",void 0),r([i()],o.prototype,"title",void 0),r([i({json:{read:!1},readOnly:!0})],o.prototype,"type",void 0),r([i(ae)],o.prototype,"url",null),o=r([E("esri.layers.GeoJSONLayer")],o);const jt=o;export{jt as default};
diff --git a/fix-191/assets/GeoJSONSourceWorker-CLrugTuD-GOfRnlHQ.js b/fix-191/assets/GeoJSONSourceWorker-CLrugTuD-GOfRnlHQ.js
deleted file mode 100644
index 5e6974e0..00000000
--- a/fix-191/assets/GeoJSONSourceWorker-CLrugTuD-GOfRnlHQ.js
+++ /dev/null
@@ -1 +0,0 @@
-import{eS as _,o as I,ck as A,gT as Z,cl as Q,ay as $,aU as v,a1 as G,aC as P,f as M,bK as R}from"./story-DULt3Rma.js";import{z,n as N,A as H,j as L,k as Y}from"./featureConversionUtils-D6hFQ4Af-Cb3HkUwF.js";import{I as B}from"./FeatureStore-Co2V0sVE-BhxyyBiT.js";import{f as E,h as b}from"./queryUtils-Brxu6254-UOAsUqfL.js";import{Z as J}from"./QueryEngine-CH5uUhZK-BPFE3Fml.js";import{Y as U,_ as V,X as W}from"./geojson-CNt_qtQf-D7rgzWVa.js";import{A as K,f as X,d as ee}from"./clientSideDefaults-BqqayPct-DxPS0b1M.js";import{G as te,F as T,j,c as F,x as k}from"./sourceUtils-BMeqkJ5g-FH8zRKXI.js";import{o as C}from"./FieldsIndex-HmzMbJQG-nfgmohOl.js";import{i as ie}from"./fieldType-CD2CL2hr-BeIaxmP1.js";import"./main-Bm7g2Jde.js";import"./OptimizedFeature-EIithYlr-Cq64mIT3.js";import"./OptimizedFeatureSet-DfZGBuxJ-C08BOAgi.js";import"./BoundsStore--N6o1xkF-W3ru2llD.js";import"./PooledRBush-DbfAmeLn-CnmkMtQT.js";import"./quickselect-DHTstthl-Ds_Aj0x5.js";import"./timeSupport-jPViR5jn-Blw8tou2.js";import"./optimizedFeatureQueryEngineAdapter-DFdaawxC-p1ngWYoX.js";import"./projection-BA9M1R7d-DvHr0GeG.js";import"./projectBuffer-CvCBvJ6W-Cc8J4MEJ.js";import"./normalizeUtils-Bxmy9MNI-CZMTs6Vg.js";import"./normalizeUtilsCommon-CRJlkfEA-CgRBIB_J.js";import"./utils-9sQxfkoa-CjNZjdKD.js";import"./utils-Bq23Xwmj-DhZYu3yh.js";import"./json-BI97KiBB-Ce5cWfI2.js";import"./LRUCache-C3erQTWv-CBR8rG5i.js";import"./WhereClause-DxwoyBMS-rEYyQL9l.js";import"./TimeOnly-DSMefxKy-BAXliSDH.js";import"./UnknownTimeZone-C--TOcPG-C3cinqRV.js";import"./QueryEngineCapabilities-Gr588n9t-DjYb9CEb.js";import"./quantizationUtils-bJy1cRwp-DKHwdnl5.js";import"./utils-HtkT8Fn3-CgLa5wkn.js";import"./TimeExtent-Cn0Jofqr-DWlRQ-Qn.js";import"./heatmapUtils-seiMkkkR-DETYxyq4.js";import"./vec42-D8CJyqHG-DnfLTeQH.js";import"./common-CYWrYyJl-E8-sukrT.js";import"./vec4f64-hf2nxvhQ-CaAr8PTM.js";import"./utils-DyydRFHu-BgVNtJ0_.js";import"./Basemap-BEqqSTw9-B8z1wR1c.js";import"./loadAll-e978YItg-Sr8yCS6_.js";import"./PortalItem-CctGdnxF-Dbw3pVTD.js";import"./writeUtils-D5qlLkwk-B7Zow5Ob.js";import"./mat4f32-CiZjBg9k-CUm34GoR.js";import"./mat4-DX7gBViE-DBcL5Ayd.js";import"./utils-tNxq3jkf-BmjMQb3R.js";import"./ClassBreaksDefinition-bYRgYgPp-fywCcmFq.js";import"./Scheduler-B7UX7Wr5-Bw_5FpBi.js";import"./signal-CETehA7D-Cb8aw_q5.js";import"./date-Cqvy-TgA-DIf-QFLz.js";import"./capabilities-Cjn77swe-Y9lFlGVh.js";const se={hasAttachments:!1,capabilities:"query, editing, create, delete, update",useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsQueryWithCacheHint:!0,supportsQueryWithDistance:!0,supportsQueryWithResultType:!0,supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0}};class tt{constructor(){this._queryEngine=null,this._snapshotFeatures=async e=>{const t=await this._fetch(e);return this._createFeatures(t)}}destroy(){this._queryEngine?.destroy(),this._queryEngine=this._createDefaultAttributes=null}async load(e,t={}){this._loadOptions={url:e.url,customParameters:e.customParameters};const s=[],[i]=await Promise.all([e.url?this._fetch(t?.signal):null,this._checkProjection(e.spatialReference)]),r=U(i,{geometryType:e.geometryType}),l=e.fields||r.fields||[],p=e.hasZ!=null?e.hasZ:r.hasZ,d=r.geometryType;let c=e.objectIdField||r.objectIdFieldName||"__OBJECTID";const h=e.spatialReference||_;let a=e.timeInfo;l===r.fields&&r.unknownFields.length>0&&s.push({name:"geojson-layer:unknown-field-types",message:"Some fields types couldn't be inferred from the features and were dropped",details:{unknownFields:r.unknownFields}});const o=new C(l);let u=o.get(c);u?(u.type!=="esriFieldTypeString"&&(u.type="esriFieldTypeOID"),u.editable=!1,u.nullable=!1,c=u.name):(u={alias:c,name:c,type:r.objectIdFieldType==="string"?"esriFieldTypeString":"esriFieldTypeOID",editable:!1,nullable:!1},l.unshift(u));const y={};for(const n of l){if(n.name==null&&(n.name=n.alias),n.alias==null&&(n.alias=n.name),!n.name)throw new I("geojson-layer:invalid-field-name","field name is missing",{field:n});if(!ie.jsonValues.includes(n.type))throw new I("geojson-layer:invalid-field-type",`invalid type for field "${n.name}"`,{field:n});if(n.name!==u.name){const g=A(n);g!==void 0&&(y[n.name]=g)}n.length==null&&(n.length=Z(n))}if(a){if(a.startTimeField){const n=o.get(a.startTimeField);n?(a.startTimeField=n.name,n.type="esriFieldTypeDate"):a.startTimeField=null}if(a.endTimeField){const n=o.get(a.endTimeField);n?(a.endTimeField=n.name,n.type="esriFieldTypeDate"):a.endTimeField=null}if(a.trackIdField){const n=o.get(a.trackIdField);n?a.trackIdField=n.name:(a.trackIdField=null,s.push({name:"geojson-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:a}}))}a.startTimeField||a.endTimeField||(s.push({name:"geojson-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing",details:{timeInfo:a}}),a=null)}const m=d?ee(d):void 0,w=o.dateFields.length?{timeZoneIANA:Q}:null,f={warnings:s,featureErrors:[],layerDefinition:{...se,drawingInfo:m??void 0,templates:K(y),extent:void 0,geometryType:d,objectIdField:c,fields:l,hasZ:!!p,timeInfo:a,dateFieldsTimeReference:w}};this._queryEngine=new J({fieldsIndex:C.fromLayerJSON({fields:l,timeInfo:a,dateFieldsTimeReference:w}),geometryType:d,hasM:!1,hasZ:p,objectIdField:c,spatialReference:h,timeInfo:a,featureStore:new B({geometryType:d,hasM:!1,hasZ:p})});const q=this._queryEngine.fieldsIndex.requiredFields.indexOf(u);q>-1&&this._queryEngine.fieldsIndex.requiredFields.splice(q,1),this._createDefaultAttributes=X(y,c);const x=await this._createFeatures(i);this._objectIdGenerator=this._createObjectIdGenerator(this._queryEngine,x);const O=this._normalizeFeatures(x,f.featureErrors);this._queryEngine.featureStore.addMany(O);const{fullExtent:D,timeExtent:S}=await this._queryEngine.fetchRecomputedExtents();if(f.layerDefinition.extent=D,S){const{start:n,end:g}=S;f.layerDefinition.timeInfo.timeExtent=[n,g]}return f}async applyEdits(e){const{spatialReference:t,geometryType:s}=this._queryEngine;return await Promise.all([te(t,s),E(e.adds,t),E(e.updates,t)]),await this._waitSnapshotComplete(),this._applyEdits(e)}async queryFeatures(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQuery(e,t.signal)}async queryFeatureCount(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForCount(e,t.signal)}async queryObjectIds(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForIds(e,t.signal)}async queryExtent(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForExtent(e,t.signal)}async querySnapping(e,t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForSnapping(e,t.signal)}async refresh(e){this._loadOptions.customParameters=e,this._snapshotTask?.abort(),this._snapshotTask=$(this._snapshotFeatures),this._snapshotTask.promise.then(i=>{this._queryEngine.featureStore.clear(),this._objectIdGenerator=this._createObjectIdGenerator(this._queryEngine,i);const r=this._normalizeFeatures(i);r&&this._queryEngine.featureStore.addMany(r)},i=>{this._queryEngine.featureStore.clear(),v(i)||G.getLogger("esri.layers.GeoJSONLayer").error(new I("geojson-layer:refresh","An error occurred during refresh",{error:i}))}),await this._waitSnapshotComplete();const{fullExtent:t,timeExtent:s}=await this._queryEngine.fetchRecomputedExtents();return{extent:t,timeExtent:s}}async _createFeatures(e){if(e==null)return[];const{geometryType:t,hasZ:s,objectIdField:i}=this._queryEngine,r=V(e,{geometryType:t,hasZ:s,objectIdField:i});if(!P(this._queryEngine.spatialReference,_))for(const l of r)l.geometry!=null&&(l.geometry=z(b(N(l.geometry,this._queryEngine.geometryType,this._queryEngine.hasZ,!1),_,this._queryEngine.spatialReference)));return r}async _waitSnapshotComplete(){if(this._snapshotTask&&!this._snapshotTask.finished){try{await this._snapshotTask.promise}catch{}return this._waitSnapshotComplete()}}async _fetch(e){const{url:t,customParameters:s}=this._loadOptions,i=(await M(t??"",{responseType:"json",query:{...s},signal:e})).data;return W(i),i}_normalizeFeatures(e,t){const{objectIdField:s,fieldsIndex:i}=this._queryEngine,r=[];for(const l of e){const p=this._createDefaultAttributes(),d=T(i,p,l.attributes,!0);d?t?.push(d):(this._assignObjectId(p,l.attributes,!0),l.attributes=p,l.objectId=p[s],r.push(l))}return r}async _applyEdits(e){const{adds:t,updates:s,deletes:i}=e,r={addResults:[],deleteResults:[],updateResults:[],uidToObjectId:{}};if(t?.length&&this._applyAddEdits(r,t),s?.length&&this._applyUpdateEdits(r,s),i?.length){for(const d of i)r.deleteResults.push(j(d));this._queryEngine.featureStore.removeManyById(i)}const{fullExtent:l,timeExtent:p}=await this._queryEngine.fetchRecomputedExtents();return{extent:l,timeExtent:p,featureEditResults:r}}_applyAddEdits(e,t){const{addResults:s}=e,{geometryType:i,hasM:r,hasZ:l,objectIdField:p,spatialReference:d,featureStore:c,fieldsIndex:h}=this._queryEngine,a=[];for(const o of t){if(o.geometry&&i!==R(o.geometry)){s.push(F("Incorrect geometry type."));continue}const u=this._createDefaultAttributes(),y=T(h,u,o.attributes);if(y)s.push(y);else{if(this._assignObjectId(u,o.attributes),o.attributes=u,o.uid!=null){const m=o.attributes[p];e.uidToObjectId[o.uid]=m}if(o.geometry!=null){const m=o.geometry.spatialReference??d;o.geometry=b(k(o.geometry,m),m,d)}a.push(o),s.push(j(o.attributes[p]))}}c.addMany(H([],a,i,l,r,p))}_applyUpdateEdits({updateResults:e},t){const{geometryType:s,hasM:i,hasZ:r,objectIdField:l,spatialReference:p,featureStore:d,fieldsIndex:c}=this._queryEngine;for(const h of t){const{attributes:a,geometry:o}=h,u=a?.[l];if(u==null){e.push(F(`Identifier field ${l} missing`));continue}if(!d.has(u)){e.push(F(`Feature with object id ${u} missing`));continue}const y=L(d.getFeature(u),s,r,i);if(o!=null){if(s!==R(o)){e.push(F("Incorrect geometry type."));continue}const m=o.spatialReference??p;y.geometry=b(k(o,m),m,p)}if(a){const m=T(c,y.attributes,a);if(m){e.push(m);continue}}d.add(Y(y,s,r,i,l)),e.push(j(u))}}_createObjectIdGenerator(e,t){const s=e.fieldsIndex.get(e.objectIdField);if(s.type==="esriFieldTypeString")return()=>s.name+"-"+Date.now().toString(16);let i=Number.NEGATIVE_INFINITY;for(const r of t)r.objectId&&(i=Math.max(i,r.objectId));return i=Math.max(0,i)+1,()=>i++}_assignObjectId(e,t,s=!1){const i=this._queryEngine.objectIdField;e[i]=s&&i in t?t[i]:this._objectIdGenerator()}async _checkProjection(e){try{await E(_,e)}catch{throw new I("geojson-layer","Projection not supported")}}}export{tt as default};
diff --git a/fix-191/assets/GeoRSSLayer-DgF8xnYi-BGPG7DB_.js b/fix-191/assets/GeoRSSLayer-DgF8xnYi-BGPG7DB_.js
deleted file mode 100644
index 09b4d350..00000000
--- a/fix-191/assets/GeoRSSLayer-DgF8xnYi-BGPG7DB_.js
+++ /dev/null
@@ -1 +0,0 @@
-import{gK as n,W as p,f as y,dc as m,C as u,v as o,S as i,a0 as d,n as h,i as c,dS as a,d_ as S,eB as f,e0 as g,d$ as v}from"./story-DULt3Rma.js";import{m as C}from"./MultiOriginJSONSupport-DKRh9P6w-tF-GNPM3.js";import{D as b}from"./Layer-ChoECxvZ-DQ-28MDL.js";import{u as G}from"./BlendLayer-D1WkSmwP-BHrWqYGA.js";import{E as _}from"./OperationalLayer-B5IXiMa2-BCAq75zB.js";import{C as F}from"./PortalLayer-CElnYuSQ-jChQE2im.js";import{T as x}from"./RefreshableLayer-a8BQ58Xh-D8rhwboV.js";import{S as E}from"./ScaleRangeLayer-Bz0DcnvM-BoX1P84V.js";import{e as P,_ as k,Z as w}from"./commonProperties-BtIqvFU_-CfGSai59.js";import"./main-Bm7g2Jde.js";import"./TimeExtent-Cn0Jofqr-DWlRQ-Qn.js";import"./jsonUtils-wIllKWI4-CU3QWWOb.js";import"./parser-DyDJ-rlI-8QTzeGdu.js";import"./mat4f32-CiZjBg9k-CUm34GoR.js";import"./mat4-DX7gBViE-DBcL5Ayd.js";import"./common-CYWrYyJl-E8-sukrT.js";import"./PortalItem-CctGdnxF-Dbw3pVTD.js";import"./portalItemUtils-B8bw6SAG-CEVZt8QT.js";import"./projection-BA9M1R7d-DvHr0GeG.js";import"./projectBuffer-CvCBvJ6W-Cc8J4MEJ.js";import"./ElevationInfo-yv2-9tj6-B5v76p2q.js";import"./lengthUtils-DKpMe5qR-BEdWsC7X.js";const R=["atom","xml"],j={base:a,key:"type",typeMap:{"simple-line":S},errorContext:"symbol"},M={base:a,key:"type",typeMap:{"picture-marker":f,"simple-marker":g},errorContext:"symbol"},D={base:a,key:"type",typeMap:{"simple-fill":v},errorContext:"symbol"};let t=class extends G(x(_(F(E(C(b)))))){constructor(...e){super(...e),this.description=null,this.fullExtent=null,this.legendEnabled=!0,this.lineSymbol=null,this.pointSymbol=null,this.polygonSymbol=null,this.operationalLayerType="GeoRSS",this.url=null,this.type="geo-rss"}normalizeCtorArgs(e,r){return typeof e=="string"?{url:e,...r}:e}readFeatureCollections(e,r){return r.featureCollection.layers.forEach(s=>{const l=s.layerDefinition.drawingInfo.renderer.symbol;l&&l.type==="esriSFS"&&l.outline?.style.includes("esriSFS")&&(l.outline.style="esriSLSSolid")}),r.featureCollection.layers}get hasPoints(){return this._hasGeometry("esriGeometryPoint")}get hasPolylines(){return this._hasGeometry("esriGeometryPolyline")}get hasPolygons(){return this._hasGeometry("esriGeometryPolygon")}get title(){const e=this._get("title");return e&&this.originOf("title")!=="defaults"?e:this.url?n(this.url,R)||"GeoRSS":e}set title(e){this._set("title",e)}load(e){const r=e!=null?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Map Service","Feature Service","Feature Collection","Scene Service"]},e).catch(p).then(()=>this._fetchService(r)).then(s=>{this.read(s,{origin:"service"})})),Promise.resolve(this)}async hasDataChanged(){const e=await this._fetchService();return this.read(e,{origin:"service",ignoreDefaults:!0}),!0}async _fetchService(e){const r=this.spatialReference,{data:s}=await y(u.geoRSSServiceUrl,{query:{url:this.url,refresh:!!this.loaded||void 0,outSR:m(r)?void 0:r.wkid??JSON.stringify(r)},signal:e});return s}_hasGeometry(e){return this.featureCollections?.some(r=>r.featureSet?.geometryType===e&&r.featureSet.features?.length>0)??!1}};o([i()],t.prototype,"description",void 0),o([i()],t.prototype,"featureCollections",void 0),o([d("service","featureCollections",["featureCollection.layers"])],t.prototype,"readFeatureCollections",null),o([i({type:h,json:{name:"lookAtExtent"}})],t.prototype,"fullExtent",void 0),o([i(P)],t.prototype,"id",void 0),o([i(k)],t.prototype,"legendEnabled",void 0),o([i({types:j,json:{write:!0}})],t.prototype,"lineSymbol",void 0),o([i({type:["show","hide"]})],t.prototype,"listMode",void 0),o([i({types:M,json:{write:!0}})],t.prototype,"pointSymbol",void 0),o([i({types:D,json:{write:!0}})],t.prototype,"polygonSymbol",void 0),o([i({type:["GeoRSS"]})],t.prototype,"operationalLayerType",void 0),o([i(w)],t.prototype,"url",void 0),o([i({json:{origins:{service:{read:{source:"name",reader:e=>e||void 0}}}}})],t.prototype,"title",null),o([i({readOnly:!0,json:{read:!1},value:"geo-rss"})],t.prototype,"type",void 0),t=o([c("esri.layers.GeoRSSLayer")],t);const oe=t;export{oe as default};
diff --git a/fix-191/assets/GeoRSSLayerView2D-BLTYupUX-pRmwv74N.js b/fix-191/assets/GeoRSSLayerView2D-BLTYupUX-pRmwv74N.js
deleted file mode 100644
index 77f1ede2..00000000
--- a/fix-191/assets/GeoRSSLayerView2D-BLTYupUX-pRmwv74N.js
+++ /dev/null
@@ -1 +0,0 @@
-import{ah as l,aL as h,ag as g,bL as w,v as f,i as d}from"./story-DULt3Rma.js";import{t as u,p as n}from"./jsonUtils-C64Zfu7c-DhKY2SjZ.js";import{O as b}from"./FeatureSet-BkVNthuN-DUN6SnMl.js";import{X as V,Y as S}from"./LayerView-Bish-E63-BuRTInx3.js";import{d as _}from"./GraphicContainer-DuOHUciE-CvWnJTeb.js";import{X as v}from"./GraphicsView2D-C4wYE2ut-YaHOk0G5.js";import"./main-Bm7g2Jde.js";import"./UniqueValueRenderer-fS5V0Ej1-BykZGEgA.js";import"./RendererLegendOptions-K3md58-X-DR3I9sq7.js";import"./diffUtils-Cz3Fi8Xb-Dx3TppL9.js";import"./colorRamps-q0bZVhs2-DkXm9F7X.js";import"./sizeVariableUtils-t52KcLLi-D0hbQF8b.js";import"./visualVariableUtils-D3kZJRyn-PuRGVqRl.js";import"./compilerUtils-CV1QYWI8-5SsZKq4e.js";import"./lengthUtils-DKpMe5qR-BEdWsC7X.js";import"./styleUtils-BtpNqZyT-nGAxWjLn.js";import"./LRUCache-C3erQTWv-CBR8rG5i.js";import"./Version-CoKzbupV-BJLwrorf.js";import"./FieldsIndex-HmzMbJQG-nfgmohOl.js";import"./UnknownTimeZone-C--TOcPG-C3cinqRV.js";import"./OverrideHelper-DWRbVlj1-CckXmRiC.js";import"./colorUtils-Cthpxcks-CToOrmBC.js";import"./vec42-D8CJyqHG-DnfLTeQH.js";import"./common-CYWrYyJl-E8-sukrT.js";import"./vec4f64-hf2nxvhQ-CaAr8PTM.js";import"./utils-SPbpQbmm-BoVqh098.js";import"./enums-CpSG_SL3-BMD3Tb1v.js";import"./quantizationUtils-bJy1cRwp-DKHwdnl5.js";import"./heatmapUtils-seiMkkkR-DETYxyq4.js";import"./Field-C6hA1tZj-DdgmWWCq.js";import"./fieldType-CD2CL2hr-BeIaxmP1.js";import"./Container-BcuL1ZEG-B_CYK192.js";import"./MapView-BGOJJ8ch-D1TWNssr.js";import"./Cyclical-C_9rKUUQ-BTshTtlN.js";import"./CollectionFlattener-DkHuHn5E-CAzLWmFf.js";import"./workers-PiCjreoO-CABaMBvC.js";import"./projection-BA9M1R7d-DvHr0GeG.js";import"./projectBuffer-CvCBvJ6W-Cc8J4MEJ.js";import"./TileInfo-CWIRDhZl-1qRzvaVI.js";import"./TileKey-B_6qmYK--BtZdR-Xy.js";import"./themeUtils-YjM7iIiX-Dxg99YfT.js";import"./uuid-Dj9mdEVg-BaKSCiyT.js";import"./UpdatingHandles-CUu3u1ms-C-zZs-35.js";import"./signal-CETehA7D-Cb8aw_q5.js";import"./Map-1zd11DKO-DXcvys-y.js";import"./Basemap-BEqqSTw9-B8z1wR1c.js";import"./loadAll-e978YItg-Sr8yCS6_.js";import"./PortalItem-CctGdnxF-Dbw3pVTD.js";import"./writeUtils-D5qlLkwk-B7Zow5Ob.js";import"./mat4f32-CiZjBg9k-CUm34GoR.js";import"./mat4-DX7gBViE-DBcL5Ayd.js";import"./TablesMixin-C8RojhYs-C4TS9tnz.js";import"./Layer-ChoECxvZ-DQ-28MDL.js";import"./TimeExtent-Cn0Jofqr-DWlRQ-Qn.js";import"./GraphicsCollection-CWTXNZOX-DHToCUr-.js";import"./HeightModelInfo-C5vFqzyF-B3QZnpVY.js";import"./ReactiveMap-CFk6jPfN-D0CsM6VZ.js";import"./Query-BrwMGK8U-DaHaJHm8.js";import"./arcgisLayerUrl-HNYh8jvG-CTcC0GBx.js";import"./ViewingMode-CyR_b1T8-_s7_Gbsk.js";import"./vec2f64-CeODonrJ-CkkJCdRC.js";import"./vec2-tHZ6OaOy-xCj1obDt.js";import"./Tile-D75RMC64-6QC6K6en.js";import"./TileKey-C5IL-JBr-DX55j9sZ.js";import"./QueueProcessor-DbfV9fLy-Cb_v9ly0.js";import"./quickselect-DHTstthl-Ds_Aj0x5.js";import"./normalizeUtils-Bxmy9MNI-CZMTs6Vg.js";import"./normalizeUtilsCommon-CRJlkfEA-CgRBIB_J.js";import"./utils-9sQxfkoa-CjNZjdKD.js";import"./utils-Bq23Xwmj-DhZYu3yh.js";import"./mat3-CC4Foazl-BWjyqE2v.js";import"./vec2f32-CVhmN3Me-DxoqVD7C.js";import"./unitBezier-CGtWxaCq-BRwEDigF.js";import"./Scheduler-B7UX7Wr5-Bw_5FpBi.js";import"./vec32-D9GsKZ1t-BK5Q1Wvx.js";import"./definitions-DJSdSb77-DkoRHaVx.js";import"./enums-DBi1-Mm2-CUS1pvQe.js";import"./Texture-BCt2hphT-Tabr9F2Q.js";import"./imageUtils-BA2D6Uf1-mQylXFz2.js";import"./capabilities-agoTWNzb-CtsNgRyk.js";import"./ColorBackground-gVZldRLm-S6_H1D84.js";import"./parser-DyDJ-rlI-8QTzeGdu.js";import"./layerViewUtils-DURAPenP-B_msxcGA.js";import"./AGraphicContainer-LUCT6Gle-Dcauzal2.js";import"./TechniqueInstance-DGTKoOL6-4HwqbTFw.js";import"./UpdateTracking2D-Du_WIf4G-D2PpCov4.js";import"./BidiEngine-Bdqv5H5j-Dyqh9XG-.js";import"./OptimizedFeature-EIithYlr-Cq64mIT3.js";import"./GeometryUtils-NHgB9gGQ-CFw4-bSu.js";import"./Rect-DD6XS68q-D_hsV3ag.js";import"./LabelMetric-BeluzH3o-gRzb7KR4.js";import"./Program-DLVwTiPA-DnEcW3oW.js";import"./BufferObject-BM_7mcDb-Bve6V6Hz.js";import"./VertexElementDescriptor-BAy1DPb3-BOhpDZGx.js";import"./BindType-9iOk18Ed-CRW1cdX4.js";import"./Util-BjGjeg6f-08Szkf4F.js";import"./TileContainer-D48pXXgL-3qcmtXL9.js";import"./WGLContainer-LxgEo4I_-CsRH2D6t.js";import"./VertexArrayObject-M4iRGGoi-CgmBRrBK.js";import"./ProgramTemplate-DQOm6Omy-BzE6z6ri.js";import"./vec3f32-BS0cezmI-B_madU1n.js";import"./StyleDefinition-Ct4HIk9T-B82pTf0h.js";import"./config-nuMERBvb-MDUrh2eL.js";import"./earcut-XDcq3zAf-BcwyrT7l.js";import"./featureConversionUtils-D6hFQ4Af-Cb3HkUwF.js";import"./OptimizedFeatureSet-DfZGBuxJ-C08BOAgi.js";import"./FeatureCommandQueue-DzV-HBIG-CZbfy6TK.js";import"./constants-Bqe1QJ4u-F8oTIn7N.js";import"./AttributeStore-DjyP9U7y-B4SfjpJ9.js";import"./TimeOnly-DSMefxKy-BAXliSDH.js";import"./timeSupport-jPViR5jn-Blw8tou2.js";import"./queryUtils-Brxu6254-UOAsUqfL.js";import"./json-BI97KiBB-Ce5cWfI2.js";import"./labelUtils-BW14kBqX-CwFoWB4r.js";import"./normalizeUtilsSync-CBU7m8rm-fmmSahg-.js";let y=class extends V(S){constructor(){super(...arguments),this._graphicsViewMap={},this._popupTemplates=new Map,this.graphicsViews=[]}async hitTest(t,o){if(!this.graphicsViews.length)return null;const p=this.layer;return this.graphicsViews.reverse().flatMap(r=>{const i=this._popupTemplates.get(r),e=r.hitTest(t);for(const m of e)m.layer=p,m.sourceLayer=p,m.popupTemplate=i;return e}).map(r=>({type:"graphic",graphic:r,layer:p,mapPoint:t}))}update(t){if(this.graphicsViews)for(const o of this.graphicsViews)o.processUpdate(t)}attach(){this.addAttachHandles([l(()=>this.layer?.featureCollections,t=>{this._clear();for(const{popupInfo:o,featureSet:p,layerDefinition:r}of t){const i=b.fromJSON(p),e=new g(i.features),m=r.drawingInfo,c=o?w.fromJSON(o):null,s=u(m.renderer),a=new v({requestUpdateCallback:()=>this.requestUpdate(),view:this.view,graphics:e,renderer:s,container:new _(this.view.featuresTilingScheme)});this._graphicsViewMap[i.geometryType]=a,this._popupTemplates.set(a,c),i.geometryType!=="polygon"||this.layer.polygonSymbol?i.geometryType!=="polyline"||this.layer.lineSymbol?i.geometryType!=="point"||this.layer.pointSymbol||(this.layer.pointSymbol=s.symbol):this.layer.lineSymbol=s.symbol:this.layer.polygonSymbol=s.symbol,this.graphicsViews.push(a),this.container.addChild(a.container)}},h),l(()=>this.layer?.polygonSymbol,t=>{this._graphicsViewMap.polygon.renderer=new n({symbol:t})},h),l(()=>this.layer?.lineSymbol,t=>{this._graphicsViewMap.polyline.renderer=new n({symbol:t})},h),l(()=>this.layer?.pointSymbol,t=>{this._graphicsViewMap.point.renderer=new n({symbol:t})},h)])}detach(){this._clear()}moveEnd(){}viewChange(){for(const t of this.graphicsViews)t.viewChange()}_clear(){this.container.removeAllChildren();for(const t of this.graphicsViews)t.destroy();this._graphicsViewMap={},this._popupTemplates.clear(),this.graphicsViews.length=0}};y=f([d("esri.views.2d.layers.GeoRSSLayerView2D")],y);const qi=y;export{qi as default};
diff --git a/fix-191/assets/GeometryUtils-NHgB9gGQ-CFw4-bSu.js b/fix-191/assets/GeometryUtils-NHgB9gGQ-CFw4-bSu.js
deleted file mode 100644
index fd985d67..00000000
--- a/fix-191/assets/GeometryUtils-NHgB9gGQ-CFw4-bSu.js
+++ /dev/null
@@ -1 +0,0 @@
-import{hS as S}from"./story-DULt3Rma.js";const z=512;var P,p;(function(t){t[t.Unknown=0]="Unknown",t[t.Point=1]="Point",t[t.LineString=2]="LineString",t[t.Polygon=3]="Polygon"})(P||(P={}));let f=class R{constructor(i,s){this.x=i,this.y=s}clone(){return new R(this.x,this.y)}equals(i,s){return i===this.x&&s===this.y}isEqual(i){return i.x===this.x&&i.y===this.y}setCoords(i,s){return this.x=i,this.y=s,this}normalize(){const i=this.x,s=this.y,h=Math.sqrt(i*i+s*s);return this.x/=h,this.y/=h,this}rightPerpendicular(){const i=this.x;return this.x=this.y,this.y=-i,this}leftPerpendicular(){const i=this.x;return this.x=-this.y,this.y=i,this}move(i,s){return this.x+=i,this.y+=s,this}assign(i){return this.x=i.x,this.y=i.y,this}assignAdd(i,s){return this.x=i.x+s.x,this.y=i.y+s.y,this}assignSub(i,s){return this.x=i.x-s.x,this.y=i.y-s.y,this}rotate(i,s){const h=this.x,e=this.y;return this.x=h*i-e*s,this.y=h*s+e*i,this}scale(i){return this.x*=i,this.y*=i,this}length(){const i=this.x,s=this.y;return Math.sqrt(i*i+s*s)}sub(i){return this.x-=i.x,this.y-=i.y,this}add(i){return this.x+=i.x,this.y+=i.y,this}static distance(i,s){const h=s.x-i.x,e=s.y-i.y;return Math.sqrt(h*h+e*e)}static add(i,s){return new R(i.x+s.x,i.y+s.y)}static sub(i,s){return new R(i.x-s.x,i.y-s.y)}};class v{constructor(i,s,h){this.ratio=i,this.x=s,this.y=h}}let C=class{constructor(t,i,s,h=8,e=8){this._lines=[],this._starts=[],this.validateTessellation=!0,this._pixelRatio=h,this._pixelMargin=e,this._tileSize=z*h,this._dz=t,this._yPos=i,this._xPos=s}setPixelMargin(t){t!==this._pixelMargin&&(this._pixelMargin=t,this.setExtent(this._extent))}setExtent(t){this._extent=t,this._finalRatio=this._tileSize/t*(1<>this._dz;i>s&&(i=s),this._margin=i,this._xmin=s*this._xPos-i,this._ymin=s*this._yPos-i,this._xmax=this._xmin+s+2*i,this._ymax=this._ymin+s+2*i}reset(t){this._type=t,this._lines=[],this._starts=[],this._line=null,this._start=0}moveTo(t,i){this._pushLine(),this._prevIsIn=this._isIn(t,i),this._moveTo(t,i,this._prevIsIn),this._prevPt=new f(t,i),this._firstPt=new f(t,i),this._dist=0}lineTo(t,i){const s=this._isIn(t,i),h=new f(t,i),e=f.distance(this._prevPt,h);let l,n,x,_,r,g,m,u;if(s)this._prevIsIn?this._lineTo(t,i,!0):(l=this._prevPt,n=h,x=this._intersect(n,l),this._start=this._dist+e*(1-this._r),this._lineTo(x.x,x.y,!0),this._lineTo(n.x,n.y,!0));else if(this._prevIsIn)n=this._prevPt,l=h,x=this._intersect(n,l),this._lineTo(x.x,x.y,!0),this._lineTo(l.x,l.y,!1);else{const a=this._prevPt,o=h;if(a.x<=this._xmin&&o.x<=this._xmin||a.x>=this._xmax&&o.x>=this._xmax||a.y<=this._ymin&&o.y<=this._ymin||a.y>=this._ymax&&o.y>=this._ymax)this._lineTo(o.x,o.y,!1);else{const y=[];if((a.xthis._xmin||a.x>this._xmin&&o.x=this._ymax?g=!0:y.push(new v(_,this._xmin,u))),(a.xthis._xmax||a.x>this._xmax&&o.x=this._ymax?g=!0:y.push(new v(_,this._xmax,u))),(a.ythis._ymin||a.y>this._ymin&&o.y=this._xmax?r=!0:y.push(new v(_,m,this._ymin))),(a.ythis._ymax||a.y>this._ymax&&o.y=this._xmax?r=!0:y.push(new v(_,m,this._ymax))),y.length===0)r?g?this._lineTo(this._xmax,this._ymax,!0):this._lineTo(this._xmax,this._ymin,!0):g?this._lineTo(this._xmin,this._ymax,!0):this._lineTo(this._xmin,this._ymin,!0);else if(y.length>1&&y[0].ratio>y[1].ratio)this._start=this._dist+e*y[1].ratio,this._lineTo(y[1].x,y[1].y,!0),this._lineTo(y[0].x,y[0].y,!0);else{this._start=this._dist+e*y[0].ratio;for(let d=0;d2){const t=this._firstPt,i=this._prevPt;t.x===i.x&&t.y===i.y||this.lineTo(t.x,t.y);const s=this._line;let h=s.length;for(;h>=4&&(s[0].x===s[1].x&&s[0].x===s[h-2].x||s[0].y===s[1].y&&s[0].y===s[h-2].y);)s.pop(),s[0].x=s[h-2].x,s[0].y=s[h-2].y,--h}}result(t=!0){return this._pushLine(),this._lines.length===0?null:(this._type===P.Polygon&&t&&D.simplify(this._tileSize,this._margin*this._finalRatio,this._lines),this._lines)}resultWithStarts(){if(this._type!==P.LineString)throw new Error("Only valid for lines");this._pushLine();const t=this._lines,i=t.length;if(i===0)return null;const s=[];for(let h=0;h=this._xmin&&t<=this._xmax&&i>=this._ymin&&i<=this._ymax}_intersect(t,i){let s,h,e;if(i.x>=this._xmin&&i.x<=this._xmax)h=i.y<=this._ymin?this._ymin:this._ymax,e=(h-t.y)/(i.y-t.y),s=t.x+e*(i.x-t.x);else if(i.y>=this._ymin&&i.y<=this._ymax)s=i.x<=this._xmin?this._xmin:this._xmax,e=(s-t.x)/(i.x-t.x),h=t.y+e*(i.y-t.y);else{h=i.y<=this._ymin?this._ymin:this._ymax,s=i.x<=this._xmin?this._xmin:this._xmax;const l=(s-t.x)/(i.x-t.x),n=(h-t.y)/(i.y-t.y);l0&&(this._lines.push(this._line),this._starts.push(this._start)):this._type===P.LineString?this._line.length>1&&(this._lines.push(this._line),this._starts.push(this._start)):this._type===P.Polygon&&this._line.length>3&&(this._lines.push(this._line),this._starts.push(this._start))),this._line=[],this._start=0}_moveTo(t,i,s){this._type!==P.Polygon?s&&(t=Math.round((t-(this._xmin+this._margin))*this._finalRatio),i=Math.round((i-(this._ymin+this._margin))*this._finalRatio),this._line.push(new f(t,i))):(s||(tthis._xmax&&(t=this._xmax),ithis._ymax&&(i=this._ymax)),t=Math.round((t-(this._xmin+this._margin))*this._finalRatio),i=Math.round((i-(this._ymin+this._margin))*this._finalRatio),this._line.push(new f(t,i)),this._isH=!1,this._isV=!1)}_lineTo(t,i,s){let h,e;if(this._type!==P.Polygon)if(s){if(t=Math.round((t-(this._xmin+this._margin))*this._finalRatio),i=Math.round((i-(this._ymin+this._margin))*this._finalRatio),this._line.length>0&&(h=this._line[this._line.length-1],h.equals(t,i)))return;this._line.push(new f(t,i))}else this._line&&this._line.length>0&&this._pushLine();else if(s||(tthis._xmax&&(t=this._xmax),ithis._ymax&&(i=this._ymax)),t=Math.round((t-(this._xmin+this._margin))*this._finalRatio),i=Math.round((i-(this._ymin+this._margin))*this._finalRatio),this._line&&this._line.length>0){h=this._line[this._line.length-1];const l=h.x===t,n=h.y===i;if(l&&n)return;this._isH&&l||this._isV&&n?(h.x=t,h.y=i,e=this._line[this._line.length-2],e.x===t&&e.y===i?(this._line.pop(),this._line.length<=1?(this._isH=!1,this._isV=!1):(e=this._line[this._line.length-2],this._isH=e.x===t,this._isV=e.y===i)):(this._isH=e.x===t,this._isV=e.y===i)):(this._line.push(new f(t,i)),this._isH=l,this._isV=n)}else this._line.push(new f(t,i))}};class A{setExtent(i){this._ratio=i===4096?1:4096/i}get validateTessellation(){return this._ratio<1}reset(i){this._lines=[],this._line=null}moveTo(i,s){this._line&&this._lines.push(this._line),this._line=[];const h=this._ratio;this._line.push(new f(i*h,s*h))}lineTo(i,s){const h=this._ratio;this._line.push(new f(i*h,s*h))}close(){const i=this._line;i&&!i[0].isEqual(i[i.length-1])&&i.push(i[0])}result(){return this._line&&this._lines.push(this._line),this._lines.length===0?null:this._lines}}(function(t){t[t.sideLeft=0]="sideLeft",t[t.sideRight=1]="sideRight",t[t.sideTop=2]="sideTop",t[t.sideBottom=3]="sideBottom"})(p||(p={}));let D=class T{static simplify(i,s,h){if(!h)return;const e=-s,l=i+s,n=-s,x=i+s,_=[],r=[],g=h.length;for(let u=0;uo.y?(_.push(u),_.push(c),_.push(p.sideLeft),_.push(-1)):(r.push(u),r.push(c),r.push(p.sideLeft),r.push(-1))),y.x>=l&&(y.y=x&&(y.x>o.x?(_.push(u),_.push(c),_.push(p.sideBottom),_.push(-1)):(r.push(u),r.push(c),r.push(p.sideBottom),r.push(-1)))),y=o}if(_.length===0||r.length===0)return;T.fillParent(h,r,_),T.fillParent(h,_,r);const m=[];T.calcDeltas(m,r,_),T.calcDeltas(m,_,r),T.addDeltas(m,h)}static fillParent(i,s,h){const e=h.length,l=s.length;for(let n=0;n1&&e[n-2]===l?0:(e.push(l),T.calcDelta(l,h,s,e)+1)}static addDeltas(i,s){const h=i.length;let e=0;for(let l=0;le&&(e=n)}for(let l=0;lt>=i&&t<=s||t>=s&&t<=i,O=Number.POSITIVE_INFINITY,L=Math.PI,U=2*L,q=128/L,E=256/360,F=L/180,N=1/Math.LN2;function b(t,i){return(t%=i)>=0?t:t+i}function W(t){return b(t*q,256)}function Y(t){return b(t*E,256)}function j(t){return Math.log(t)*N}function G(t,i,s){return t*(1-s)+i*s}const V=8,k=14,B=16;function J(t){return V+Math.max((t-k)*B,0)}function K(t,i,s){let h,e,l,n=0;for(const x of s){h=x.length;for(let _=1;_i!=l.y>i&&((l.x-e.x)*(i-e.y)-(l.y-e.y)*(t-e.x)>0?n++:n--)}return n!==0}function Q(t,i,s,h){let e,l,n,x;const _=h*h;for(const r of s){const g=r.length;if(!(g<2)){e=r[0].x,l=r[0].y;for(let m=1;mr.hasData)){switch(e.drawPhase){case s.MAP:this._renderChildren(e,i.All);break;case s.HIGHLIGHT:this.hasHighlight&&this._renderHighlight(e)}this._boundsRenderer&&this._boundsRenderer.doRender(e)}}_renderHighlight(e){t(e,!1,r=>{this._renderChildren(r,i.Highlight)})}};export{l as d};
diff --git a/fix-191/assets/GraphicsCollection-CWTXNZOX-DHToCUr-.js b/fix-191/assets/GraphicsCollection-CWTXNZOX-DHToCUr-.js
deleted file mode 100644
index 4d95b8c3..00000000
--- a/fix-191/assets/GraphicsCollection-CWTXNZOX-DHToCUr-.js
+++ /dev/null
@@ -1 +0,0 @@
-import{v as r,S as p,i as a,dz as w,bi as l,bG as y,ag as o,dA as _,am as c}from"./story-DULt3Rma.js";let s=class extends o{constructor(e){super(e),this.addHandles([this.on("before-add",t=>{t.item==null&&t.preventDefault()}),this.on("after-add",t=>this._own(t.item)),this.on("after-remove",t=>this._release(t.item))])}get owner(){return this._get("owner")}set owner(e){e!==this._get("owner")&&(this._releaseAll(),this._set("owner",e),this._ownAll())}_ownAll(){for(const e of this.items)this._own(e)}_releaseAll(){for(const e of this.items)this._release(e)}_createNewInstance(e){return this.itemType?new(o.ofType(this.itemType.Type))(e):new o(e)}};function u(e,t){return{type:e,cast:_,set(h){const n=c(h,this._get(t),e);n.owner=this,this._set(t,n)}}}r([p()],s.prototype,"owner",null),s=r([a("esri.core.support.OwningCollection")],s);let i=class extends s{_own(e){e.layer&&"remove"in e.layer&&e.layer!==this.owner&&e.layer.remove(e),e.layer=this.owner}_release(e){e.layer===this.owner&&(e.layer=null)}};r([w({Type:l,ensureType:y(l)})],i.prototype,"itemType",void 0),i=r([a("esri.support.GraphicsCollection")],i);export{i as o,s,u};
diff --git a/fix-191/assets/GraphicsLayer-DfeGaYc1-yzLfNt1n.js b/fix-191/assets/GraphicsLayer-DfeGaYc1-yzLfNt1n.js
deleted file mode 100644
index 7ecf2ebc..00000000
--- a/fix-191/assets/GraphicsLayer-DfeGaYc1-yzLfNt1n.js
+++ /dev/null
@@ -1 +0,0 @@
-import{v as e,S as i,i as s}from"./story-DULt3Rma.js";import{o,u as a}from"./GraphicsCollection-CWTXNZOX-DHToCUr-.js";import{D as h}from"./Layer-ChoECxvZ-DQ-28MDL.js";import{u as n}from"./BlendLayer-D1WkSmwP-BHrWqYGA.js";import{S as m}from"./ScaleRangeLayer-Bz0DcnvM-BoX1P84V.js";import{q as d}from"./ElevationInfo-yv2-9tj6-B5v76p2q.js";import"./main-Bm7g2Jde.js";import"./TimeExtent-Cn0Jofqr-DWlRQ-Qn.js";import"./jsonUtils-wIllKWI4-CU3QWWOb.js";import"./parser-DyDJ-rlI-8QTzeGdu.js";import"./mat4f32-CiZjBg9k-CUm34GoR.js";import"./mat4-DX7gBViE-DBcL5Ayd.js";import"./common-CYWrYyJl-E8-sukrT.js";import"./lengthUtils-DKpMe5qR-BEdWsC7X.js";let t=class extends n(m(h)){constructor(r){super(r),this.elevationInfo=null,this.graphics=new o,this.screenSizePerspectiveEnabled=!0,this.type="graphics",this.internal=!1}destroy(){this.removeAll(),this.graphics.destroy()}add(r){return this.graphics.add(r),this}addMany(r){return this.graphics.addMany(r),this}removeAll(){return this.graphics.removeAll(),this}remove(r){this.graphics.remove(r)}removeMany(r){this.graphics.removeMany(r)}on(r,p){return super.on(r,p)}graphicChanged(r){this.emit("graphic-update",r)}};e([i({type:d})],t.prototype,"elevationInfo",void 0),e([i(a(o,"graphics"))],t.prototype,"graphics",void 0),e([i({type:["show","hide"]})],t.prototype,"listMode",void 0),e([i()],t.prototype,"screenSizePerspectiveEnabled",void 0),e([i({readOnly:!0})],t.prototype,"type",void 0),e([i({constructOnly:!0})],t.prototype,"internal",void 0),t=e([s("esri.layers.GraphicsLayer")],t);const E=t;export{E as default};
diff --git a/fix-191/assets/GraphicsLayerView2D-CGXlTqHO-D8GCbsyK.js b/fix-191/assets/GraphicsLayerView2D-CGXlTqHO-D8GCbsyK.js
deleted file mode 100644
index fe779eda..00000000
--- a/fix-191/assets/GraphicsLayerView2D-CGXlTqHO-D8GCbsyK.js
+++ /dev/null
@@ -1 +0,0 @@
-import{aA as s,bi as a,ag as g,aq as l,a2 as h,v as m,S as n,i as c}from"./story-DULt3Rma.js";import{X as d,Y as u}from"./LayerView-Bish-E63-BuRTInx3.js";import{d as w}from"./GraphicContainer-DuOHUciE-CvWnJTeb.js";import{X as y}from"./GraphicsView2D-C4wYE2ut-YaHOk0G5.js";import{i as V}from"./HighlightCounter-DFWq7PnG-L3ompOf4.js";import"./main-Bm7g2Jde.js";import"./Container-BcuL1ZEG-B_CYK192.js";import"./MapView-BGOJJ8ch-D1TWNssr.js";import"./Cyclical-C_9rKUUQ-BTshTtlN.js";import"./CollectionFlattener-DkHuHn5E-CAzLWmFf.js";import"./workers-PiCjreoO-CABaMBvC.js";import"./projection-BA9M1R7d-DvHr0GeG.js";import"./projectBuffer-CvCBvJ6W-Cc8J4MEJ.js";import"./TileInfo-CWIRDhZl-1qRzvaVI.js";import"./TileKey-B_6qmYK--BtZdR-Xy.js";import"./themeUtils-YjM7iIiX-Dxg99YfT.js";import"./uuid-Dj9mdEVg-BaKSCiyT.js";import"./UpdatingHandles-CUu3u1ms-C-zZs-35.js";import"./signal-CETehA7D-Cb8aw_q5.js";import"./Map-1zd11DKO-DXcvys-y.js";import"./Basemap-BEqqSTw9-B8z1wR1c.js";import"./loadAll-e978YItg-Sr8yCS6_.js";import"./PortalItem-CctGdnxF-Dbw3pVTD.js";import"./writeUtils-D5qlLkwk-B7Zow5Ob.js";import"./compilerUtils-CV1QYWI8-5SsZKq4e.js";import"./mat4f32-CiZjBg9k-CUm34GoR.js";import"./mat4-DX7gBViE-DBcL5Ayd.js";import"./common-CYWrYyJl-E8-sukrT.js";import"./TablesMixin-C8RojhYs-C4TS9tnz.js";import"./Layer-ChoECxvZ-DQ-28MDL.js";import"./TimeExtent-Cn0Jofqr-DWlRQ-Qn.js";import"./GraphicsCollection-CWTXNZOX-DHToCUr-.js";import"./HeightModelInfo-C5vFqzyF-B3QZnpVY.js";import"./ReactiveMap-CFk6jPfN-D0CsM6VZ.js";import"./Query-BrwMGK8U-DaHaJHm8.js";import"./Field-C6hA1tZj-DdgmWWCq.js";import"./fieldType-CD2CL2hr-BeIaxmP1.js";import"./arcgisLayerUrl-HNYh8jvG-CTcC0GBx.js";import"./ViewingMode-CyR_b1T8-_s7_Gbsk.js";import"./vec2f64-CeODonrJ-CkkJCdRC.js";import"./vec2-tHZ6OaOy-xCj1obDt.js";import"./Tile-D75RMC64-6QC6K6en.js";import"./TileKey-C5IL-JBr-DX55j9sZ.js";import"./QueueProcessor-DbfV9fLy-Cb_v9ly0.js";import"./quickselect-DHTstthl-Ds_Aj0x5.js";import"./normalizeUtils-Bxmy9MNI-CZMTs6Vg.js";import"./normalizeUtilsCommon-CRJlkfEA-CgRBIB_J.js";import"./utils-9sQxfkoa-CjNZjdKD.js";import"./utils-Bq23Xwmj-DhZYu3yh.js";import"./mat3-CC4Foazl-BWjyqE2v.js";import"./vec2f32-CVhmN3Me-DxoqVD7C.js";import"./unitBezier-CGtWxaCq-BRwEDigF.js";import"./Scheduler-B7UX7Wr5-Bw_5FpBi.js";import"./vec32-D9GsKZ1t-BK5Q1Wvx.js";import"./definitions-DJSdSb77-DkoRHaVx.js";import"./enums-DBi1-Mm2-CUS1pvQe.js";import"./Texture-BCt2hphT-Tabr9F2Q.js";import"./imageUtils-BA2D6Uf1-mQylXFz2.js";import"./capabilities-agoTWNzb-CtsNgRyk.js";import"./Version-CoKzbupV-BJLwrorf.js";import"./ColorBackground-gVZldRLm-S6_H1D84.js";import"./parser-DyDJ-rlI-8QTzeGdu.js";import"./layerViewUtils-DURAPenP-B_msxcGA.js";import"./AGraphicContainer-LUCT6Gle-Dcauzal2.js";import"./TechniqueInstance-DGTKoOL6-4HwqbTFw.js";import"./UpdateTracking2D-Du_WIf4G-D2PpCov4.js";import"./BidiEngine-Bdqv5H5j-Dyqh9XG-.js";import"./OptimizedFeature-EIithYlr-Cq64mIT3.js";import"./GeometryUtils-NHgB9gGQ-CFw4-bSu.js";import"./enums-CpSG_SL3-BMD3Tb1v.js";import"./utils-SPbpQbmm-BoVqh098.js";import"./Rect-DD6XS68q-D_hsV3ag.js";import"./LabelMetric-BeluzH3o-gRzb7KR4.js";import"./Program-DLVwTiPA-DnEcW3oW.js";import"./BufferObject-BM_7mcDb-Bve6V6Hz.js";import"./VertexElementDescriptor-BAy1DPb3-BOhpDZGx.js";import"./BindType-9iOk18Ed-CRW1cdX4.js";import"./Util-BjGjeg6f-08Szkf4F.js";import"./vec42-D8CJyqHG-DnfLTeQH.js";import"./vec4f64-hf2nxvhQ-CaAr8PTM.js";import"./TileContainer-D48pXXgL-3qcmtXL9.js";import"./WGLContainer-LxgEo4I_-CsRH2D6t.js";import"./VertexArrayObject-M4iRGGoi-CgmBRrBK.js";import"./ProgramTemplate-DQOm6Omy-BzE6z6ri.js";import"./vec3f32-BS0cezmI-B_madU1n.js";import"./StyleDefinition-Ct4HIk9T-B82pTf0h.js";import"./config-nuMERBvb-MDUrh2eL.js";import"./earcut-XDcq3zAf-BcwyrT7l.js";import"./featureConversionUtils-D6hFQ4Af-Cb3HkUwF.js";import"./OptimizedFeatureSet-DfZGBuxJ-C08BOAgi.js";import"./FeatureCommandQueue-DzV-HBIG-CZbfy6TK.js";import"./constants-Bqe1QJ4u-F8oTIn7N.js";import"./lengthUtils-DKpMe5qR-BEdWsC7X.js";import"./FieldsIndex-HmzMbJQG-nfgmohOl.js";import"./UnknownTimeZone-C--TOcPG-C3cinqRV.js";import"./OverrideHelper-DWRbVlj1-CckXmRiC.js";import"./colorUtils-Cthpxcks-CToOrmBC.js";import"./quantizationUtils-bJy1cRwp-DKHwdnl5.js";import"./AttributeStore-DjyP9U7y-B4SfjpJ9.js";import"./TimeOnly-DSMefxKy-BAXliSDH.js";import"./timeSupport-jPViR5jn-Blw8tou2.js";import"./queryUtils-Brxu6254-UOAsUqfL.js";import"./json-BI97KiBB-Ce5cWfI2.js";import"./labelUtils-BW14kBqX-CwFoWB4r.js";import"./diffUtils-Cz3Fi8Xb-Dx3TppL9.js";import"./normalizeUtilsSync-CBU7m8rm-fmmSahg-.js";let e=class extends d(u){constructor(){super(...arguments),this._highlightCounter=new V}attach(){this.graphicsView=new y({requestUpdateCallback:()=>this.requestUpdate(),view:this.view,graphics:this.layer.graphics,container:new w(this.view.featuresTilingScheme),layerId:this.layer.id}),this.container.addChild(this.graphicsView.container),this.addAttachHandles([this.layer.on("graphic-update",this.graphicsView.graphicUpdateHandler),this.watch("layer.visible",i=>{i&&(this.graphicsView.update({state:this.view.state}),this.graphicsView.pushUpdate())})]),this._updateHighlights()}detach(){this.container.removeAllChildren(),this.graphicsView=s(this.graphicsView)}async hitTest(i){return this.graphicsView?this.graphicsView.hitTest(i).map(t=>({type:"graphic",graphic:t,mapPoint:i,layer:this.layer})):null}queryGraphics(){return Promise.resolve(this.graphicsView.graphics)}update(i){this.graphicsView.processUpdate(i)}viewChange(){this.graphicsView.viewChange()}moveEnd(){}isUpdating(){return!this.graphicsView||this.graphicsView.updating}highlight(i,t="default"){let r;typeof i=="number"?r=[i]:i instanceof a?r=[i.uid]:Array.isArray(i)&&i.length>0?r=typeof i[0]=="number"?i:i.map(o=>o&&o.uid):g.isCollection(i)&&i.length>0&&(r=i.map(o=>o&&o.uid).toArray());const p=r?.filter(l);return p?.length?(this._addHighlight(p,t),h(()=>this._removeHighlight(p,t))):h()}_addHighlight(i,t){this._highlightCounter.addGroup(i,t),this._updateHighlights()}_removeHighlight(i,t){this._highlightCounter.deleteGroup(i,t),this._updateHighlights()}_updateHighlights(){const i=[];for(const t of this._highlightCounter.ids()){const r=this._highlightCounter.getHighlightGroups(t),p=this._getHighlightBits(r);i.push({objectId:t,highlightFlags:p})}this.graphicsView?.setHighlight(i)}};m([n()],e.prototype,"graphicsView",void 0),e=m([c("esri.views.2d.layers.GraphicsLayerView2D")],e);const yt=e;export{yt as default};
diff --git a/fix-191/assets/GraphicsView2D-C4wYE2ut-YaHOk0G5.js b/fix-191/assets/GraphicsView2D-C4wYE2ut-YaHOk0G5.js
deleted file mode 100644
index 064561c8..00000000
--- a/fix-191/assets/GraphicsView2D-C4wYE2ut-YaHOk0G5.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import{bR as W,j as L,K as y,ah as X,aq as B,b9 as Y,$ as N,bh as g,cb as Q,iX as J,ca as K,eQ as V,iY as ee,iZ as te,bK as E,O as se,v as m,S as _,i as re,ht as ie,aG as oe,g_ as ae,et as T,i_ as ne,h0 as he,i$ as de}from"./story-DULt3Rma.js";import{o as ce}from"./FieldsIndex-HmzMbJQG-nfgmohOl.js";import{a as le,bo as ue,k as pe,bp as me,bq as z,br as q,bs as A}from"./UpdateTracking2D-Du_WIf4G-D2PpCov4.js";import{c as _e}from"./OverrideHelper-DWRbVlj1-CckXmRiC.js";import{D as ye,t as v,h as ge,j as fe,k as be}from"./definitions-DJSdSb77-DkoRHaVx.js";import{i as we}from"./WGLContainer-LxgEo4I_-CsRH2D6t.js";import{o as Ie,m as ve,u as Se,P as xe,W as Re,e as Me}from"./AttributeStore-DjyP9U7y-B4SfjpJ9.js";import{_ as Te,h as Ge,j as je,a as Ce,e as ze,J as Pe,Z as Ue,Y as ke,X as $e,K as qe,W as P}from"./FeatureCommandQueue-DzV-HBIG-CZbfy6TK.js";import{z as Ae,R as Oe,C as U}from"./featureConversionUtils-D6hFQ4Af-Cb3HkUwF.js";import{c as x}from"./OptimizedFeature-EIithYlr-Cq64mIT3.js";import{V as Ve}from"./Tile-D75RMC64-6QC6K6en.js";import{l as Ee}from"./normalizeUtils-Bxmy9MNI-CZMTs6Vg.js";import{H as De}from"./normalizeUtilsSync-CBU7m8rm-fmmSahg-.js";import{f as Fe,h as Ze}from"./queryUtils-Brxu6254-UOAsUqfL.js";async function He(r,e,t){const s=[],i={scaleInfo:je(r),scaleExpression:null};for(const o of e)switch(o.type){case"marker":if(o.animationParams){s.push(...$e(t.instances.animatedMarker,o,P,i));break}s.push(...qe(t.instances.marker,o,P,i));break;case"fill":o.spriteRasterizationParam==null?s.push(...Ue(t.instances.fill,o,i)):s.push(...ke(t.instances.complexFill,o,!1,i));break;case"line":o.spriteRasterizationParam?s.push(...ze(t.instances.texturedLine,o,!1,i)):s.push(...Pe(t.instances.line,o,!1,i));break;case"text":s.push(...Ce(t.instances.text,o,P,i))}return s}class G extends Me{static from(e,t,s){return new G(e,t,s)}constructor(e,t,s){super(s),this._items=e,this._tile=t,this._index=-1,this._cachedGeometry=null;const i=t.lod;i.wrap&&(this._wrappingInfo={worldSizeX:i.worldSize[0]})}get _current(){return this._items[this._index]}getItem(){return this._current}getZOrder(){return this._current.zOrder}getMeshWriters(){return this._current.symbolResource?.symbolInfo.meshWriters??[]}hasField(e){return this._current.attributes[e]!=null}field(e){return this.readAttribute(e)}get geometryType(){const e=E(this._current.geometry);return e==="esriGeometryPoint"?"esriGeometryMultipoint":e}getCursor(){return this.copy()}copy(){const e=new G(this._items,this._tile,this.metadata);return this.copyInto(e),e}copyInto(e){super.copyInto(e),e._cachedGeometry=this._cachedGeometry,e._index=this._index}get fields(){throw new Error("Fields reading not supported to graphics.")}get hasFeatures(){return!!this._items.length}get hasNext(){return this._index+1v*(i-1)&&(e[o]=a-v*i)}_readX(){const e=this._readGeometry();return e!=null?e.coords[0]:0}_readY(){const e=this._readGeometry();return e!=null?e.coords[1]:0}_readServerCentroid(){switch(this.geometryType){case"esriGeometryPolygon":{const e=he(this._current.projectedGeometry),t=new x([],e);return U(new x,t,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}case"esriGeometryPolyline":{const e=this._current.projectedGeometry,t=ne(e.paths,this.hasZ),s=new x([],t);return U(new x,s,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}}return null}_readAttribute(e,t){const s=this._current.attributes[e];if(s!==void 0)return s;const i=e.toLowerCase();for(const o in this._current.attributes)if(o.toLowerCase()===i)return this._current.attributes[o]}_readAttributes(){return this._current.attributes}}class k{static fromGraphic(e,t,s,i){return new k(e.geometry,t,e.attributes,e.visible,e.uid,e.version,s,i)}constructor(e,t,s,i,o,a,n,l){this.geometry=e,this.symbol=t,this.attributes=s,this.visible=i,this.objectId=o,this._version=a,this.zOrder=n,this.displayId=l,this.bounds=g(),this.prevBounds=g(),this.size=[0,0,0,0]}get linearCIM(){return this.symbolResource?.symbolInfo.linearCIM}get hasAnimations(){const{linearCIM:e}=this;return!!e&&e.some(t=>"animationParams"in t&&!!t.animationParams)}update(e,t,s){return(this._version!==e.version||this.zOrder!==s||this.symbol!==t)&&(this.prevBounds=this.bounds,this.bounds=g(),this.zOrder=s,this.geometry=e.geometry,this.attributes=e.attributes,this.symbol=t,this.visible=e.visible,this._version=e.version,this.symbolResource=null,this.projectedGeometry=null,!0)}async projectAndNormalize(e){let t=this.geometry;if(!t||!t.spatialReference||t.type==="mesh")return;t.type==="extent"&&(t=A(t)),await Fe(t.spatialReference,e);const s=De(t);if(!s)return;const i=Ze(s,t.spatialReference,e);i&&de(i),this.projectedGeometry=V(i)?A(i):i}}class We{constructor(e,t,s){this.added=e,this.updated=t,this.removed=s}hasAnyUpdate(){return!!(this.added.length||this.updated.length||this.removed.length)}}const O=1e-5;function Le(r,e){return e.zOrder-r.zOrder}class Xe{constructor(e,t,s,i,o){this._items=new Map,this._boundsDirty=!1,this._outSpatialReference=e,this._cimResourceManager=t,this._hittestDrawHelper=new me(t),this._tileInfoView=s,this._store=o;const a=s.getClosestInfoForScale(i);this._resolution=this._tileInfoView.getTileResolution(a.level)}destroy(){this._hittestDrawHelper.destroy()}items(){return this._items.values()}getItem(e){return this._items.get(e)}async update(e,t,s){const i=[],o=[],a=[],n=new Set,l=[];let d=0;for(const h of e.items){d++;const c=h.uid,u=this._items.get(c),f=t(h);if(n.add(c),u){u.update(h,f,d)&&(o.push(u),l.push(this._updateItem(u,s)));continue}const b=this._store.createDisplayIdForObjectId(c),w=k.fromGraphic(h,f,d,b);l.push(this._updateItem(w,s)),this._items.set(w.objectId,w),i.push(w)}for(const[h,c]of this._items.entries())n.has(h)||(this._store.releaseDisplayIdForObjectId(h),this._items.delete(h),a.push(c));return await Promise.all(l),this._index=null,new We(i,o,a)}updateLevel(e){this._resolution!==e&&(this._index=null,this._boundsDirty=!0,this._resolution=e)}hitTest(e,t,s,i,o){const a=y("esri-mobile"),n=a?ge:fe,l=n+(a?0:be);e=Ee(e,this._tileInfoView.spatialReference);const d=i*window.devicePixelRatio*l,h=g();h[0]=e-d,h[1]=t-d,h[2]=e+d,h[3]=t+d;const c=i*window.devicePixelRatio*n,u=g();u[0]=e-c,u[1]=t-c,u[2]=e+c,u[3]=t+c;const f=.5*i*(l+z),b=this._searchIndex(e-f,t-f,e+f,t+f);if(!b||b.length===0)return[];const w=[],$=g(),R=g();for(const I of b){if(!I.visible)continue;const{projectedGeometry:C,symbolResource:M}=I;this._getSymbolBounds($,M,C,R,o),R[3]=R[2]=R[1]=R[0]=0,ie($,h)&&w.push(I)}if(w.length===0)return[];const D=this._hittestDrawHelper,j=[];for(const I of w){const{projectedGeometry:C,symbolResource:M}=I;if(!M)continue;const{textInfo:F,symbolInfo:Z}=M,H=Z.cimSymbol;D.hitTest(u,H.symbol,C,F,o,i)&&j.push(I)}return j.sort(Le),j.map(I=>I.objectId)}queryItems(e){return this._items.size===0?[]:this._searchForItems(e)}clear(){this._items.clear(),this._index=null}async _updateItem(e,t){await e.projectAndNormalize(this._outSpatialReference),await t(e);const{size:s}=e;s[0]=s[1]=s[2]=s[3]=0,this._getSymbolBounds(e.bounds,e.symbolResource,e.projectedGeometry,e.size,0)}_searchIndex(e,t,s,i){return this._boundsDirty&&(this._items.forEach(o=>this._getSymbolBounds(o.bounds,o.symbolResource,o.projectedGeometry,o.size,0)),this._boundsDirty=!1),this._index||(this._index=Ve(9,o=>({minX:o.bounds[0],minY:o.bounds[1],maxX:o.bounds[2],maxY:o.bounds[3]})),this._index.load(Array.from(this._items.values()))),this._index.search({minX:e,minY:t,maxX:s,maxY:i})}_searchForItems(e){const t=this._tileInfoView.spatialReference,s=e.bounds,i=oe(t);if(i&&t.isWrappable){const[o,a]=i.valid,n=Math.abs(s[2]-a){if(e.type==="update")return this._update();throw new Error("InternalError: Unsupported command")}}),this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this.container.destroy(),this.view=null,this.renderer=null,this._set("graphics",null),this._controller.abort(),this._graphicStore.clear(),this._graphicStore.destroy(),this._attributeStore=null,this._hashToSymbolInfo.clear(),this._updateTracking.destroy(),this._commandQueue.destroy()}_initAttributeStore(){this._storage=new Ie({spatialReference:this.view.spatialReference,fields:new ce}),this._attributeStore=new ve({isLocal:!0,update:e=>{y("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateStart`,{message:e}),this.container.attributeView.requestUpdate(e),this.container.requestRender(),y("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateEnd`,{message:e})}});const r=Ge(null,[]);this._attributeStore.update(r,this._storage,null),this.container.checkHighlight=()=>this._attributeStore.hasHighlight}initialize(){this._initAttributeStore(),this._metadata=Se.createGraphics(this.view.spatialReference),this._resourceProxy=new xe({fetch:e=>Promise.all(e.map(t=>this.view.stage.textureManager.rasterizeItem(t))),fetchDictionary:e=>{throw new Error("InternalError: Graphics do not support Dictionary requests")}}),this.addHandles([X(()=>this._effectiveRenderer,()=>this._pushUpdate()),this.view.graphicsTileStore.on("update",this._onTileUpdate.bind(this)),this.container.on("attach",()=>{this.addHandles([this.graphics.on("change",()=>this._pushUpdate())]),this._graphicStore?.destroy(),this._graphicStore=new Xe(this.view.spatialReference,this._cimResourceManager,this.view.featuresTilingScheme,this.view.state.scale,this._attributeStore),this._attached=!0,this.requestUpdate(),this._pushUpdate()})]),this._updateTracking.addUpdateTracking("CommandQueue",this._commandQueue.updateTracking);const r=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:r,removed:[]})}get _effectiveRenderer(){return typeof this.renderer=="function"?this.renderer():this.renderer}get _cimResourceManager(){return this.view.stage.textureManager.resourceManager}get updating(){const r=!this._attached||this._updateTracking.updating;return y("esri-2d-log-updating")&&console.log(`Updating GraphicsView2D: ${r}
- -> attaching ${!this._attached}
- -> updateTracking ${this._updateTracking.updating}`),r}hitTest(r){if(!this.view||this.view.suspended)return[];const{resolution:e,rotation:t}=this.view.state,s=this._graphicStore.hitTest(r.x,r.y,2,e,t),i=new Set(s),o=this.graphics.items.reduce((a,n)=>(i.has(n.uid)&&a.set(n.uid,n),a),new Map);return s.map(a=>o.get(a)).filter(B)}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback()),this.notifyChange("updating")}processUpdate(r){this.updateRequested&&(this.updateRequested=!1,this.update(r))}viewChange(){this.requestUpdate()}setHighlight(r){const e=[];for(const{objectId:t,highlightFlags:s}of r){const i=this._graphicStore.getItem(t)?.displayId;e.push({objectId:t,highlightFlags:s,displayId:i})}this._attributeStore.setHighlight(e,r),this._pushUpdate()}graphicUpdateHandler(r){this._pushUpdate()}update(r){this.updateRequested=!1,this._attached&&this._graphicStore.updateLevel(r.state.resolution)}pushUpdate(){this._pushUpdate()}_pushUpdate(){Y(this._commandQueue.push({type:"update"}))}async _update(){try{y("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView._update start`);const r=await this._graphicStore.update(this.graphics,t=>this._getSymbolForGraphic(t),t=>this._ensureSymbolResource(t));for(const t of r.updated)this.container.restartAnimation(t.objectId);if(!r.hasAnyUpdate())return void this._attributeStore.sendUpdates();r.removed.length&&(this._cleanupRequired=!0),y("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView updateMessage`,r);const e=this._createTileMessages(r);await this._fetchResources(e),this._write(e);for(const t of r.added)this._setFilterState(t);for(const t of r.updated)this._setFilterState(t);y("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate`,r),this._attributeStore.sendUpdates(),y("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate.await`,r)}catch{}this._cleanupSharedResources()}_createTileMessages(r){const e=new Map;for(const t of r.added){const s=this.view.graphicsTileStore.getIntersectingTiles(t.bounds);for(const i of s)S.getOrCreate(i,e,this._metadata).append(t)}for(const t of r.updated){const s=this.view.graphicsTileStore.getIntersectingTiles(t.prevBounds),i=this.view.graphicsTileStore.getIntersectingTiles(t.bounds);for(const o of s)S.getOrCreate(o,e,this._metadata).removed.push(t.displayId);for(const o of i)S.getOrCreate(o,e,this._metadata).append(t)}for(const t of r.removed){const s=this.view.graphicsTileStore.getIntersectingTiles(t.bounds);for(const i of s)S.getOrCreate(i,e,this._metadata).removed.push(t.displayId)}return Array.from(e.values())}async _fetchResources(r){for(const{tile:e,reader:t}of r){y("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${e.id}] GraphicsView fetchResources`,r);const s=t.getCursor();for(;s.next();)for(const i of s.getMeshWriters())i.enqueueRequest(this._resourceProxy,s,e.createArcadeEvaluationOptions(this.view.timeZone))}await this._resourceProxy.fetchEnqueuedResources()}_write(r){for(const e of r){y("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${e.tile.id}] GraphicsView write`,e);const t=this._writeMeshes(e);let s=this._tiles.get(e.tile.key);s||(s=this._createFeatureTile(e.tile.key)),y("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${e.tile.id}] GraphicsView onTileData`,e),this.container.onTileData(s,{type:"update",modify:t,remove:e.removed,end:!1,attributeEpoch:this._attributeStore.epoch,objectIdMap:e.objectIdMap}),this.container.requestRender()}}_writeMeshes(r){const e=new Re(r.tile.id),t=r.reader.getCursor();for(;t.next();){e.entityStart(t.getDisplayId(),t.getZOrder());for(const s of t.getMeshWriters())s.write(e,this._resourceProxy,t,r.tile.createArcadeEvaluationOptions(this.view.timeZone),r.tile.level);e.entityEnd()}return{...e.serialize().message,tileId:r.tile.id}}_setFilterState(r){const e=r.displayId,t=this._attributeStore.getHighlightFlags(r.objectId);this._attributeStore.setData(e,0,0,t|(r.visible?ye:0))}_getSymbolForGraphic(r){return r.symbol!=null?r.symbol:this._effectiveRenderer!=null?this._effectiveRenderer.getSymbol(r):this._getNullSymbol(r)}async _ensureSymbolResource(r){if(!r.symbol)return;const e=await this._getSymbolInfo(r.symbol);if(!e)return;const t=e.linearCIM.filter(s=>s.type==="text");if(t.length>0){const s=await this._getTextResources(r,t);r.symbolResource={symbolInfo:e,textInfo:s}}else r.symbolResource={symbolInfo:e}}_getSymbolInfo(r){const e=r.hash();return this._hashToSymbolInfo.has(e)||this._hashToSymbolInfo.set(e,this._createSymbolInfo(e,r).catch(t=>null)),this._hashToSymbolInfo.get(e)}async _createSymbolInfo(r,e){const t=await this._convertToCIMSymbol(e),s=await this._createLinearCIM(t);return{hash:r,cimSymbol:t,linearCIM:s,meshWriters:await this._createMeshWriters(t,s)}}async _convertToCIMSymbol(r){const e=ue(r);return e.type==="web-style"?(await e.fetchCIMSymbol()).data:e}async _createLinearCIM(r){return await Promise.all(pe.fetchResources(r.symbol,this._cimResourceManager,[])),this.view.stage.cimAnalyzer.analyzeSymbolReference(r,!1)}async _createMeshWriters(r,e){N(this._controller.signal);const t=this.container.instanceStore,s=this.view.stage.meshWriterRegistry,i=await He(r,e,t);return Promise.all(i.map(o=>s.createMeshWriter(this._storage,this._resourceProxy,{tileInfo:this.view.featuresTilingScheme.tileInfo},o)))}_onTileUpdate(r){if(r.added&&r.added.length>0)for(const e of r.added)this._updateTracking.addPromise(this._addTile(e));if(r.removed&&r.removed.length>0)for(const e of r.removed)this._removeTile(e.key)}_createFeatureTile(r){const e=this.view.featuresTilingScheme.getTileBounds(g(),r),t=this.view.featuresTilingScheme.getTileResolution(r.level),s=new we(r,t,e[0],e[3]);return this._tiles.set(r,s),this.container.addChild(s),s}async _addTile(r){if(!this._attached)return;const e=this._graphicStore.queryItems(r);if(!e.length)return;const t=this._createFeatureTile(r.key),s=S.fromItems(r,e,this._metadata);await this._fetchResources([s]);const i=this._writeMeshes(s);t.onMessage({type:"append",append:i,clear:!1,end:!0,attributeEpoch:this._attributeStore.epoch,objectIdMap:s.objectIdMap})}_removeTile(r){if(!this._tiles.has(r))return;const e=this._tiles.get(r);this.container.removeChild(e),e.destroy(),this._tiles.delete(r)}_getNullSymbol(r){const e=r.geometry;return Q(e)?J:K(e)||V(e)?ee:this.defaultPointSymbolEnabled?te:null}async _getTextResources(r,e){const t=new Array,s=new Array;for(let n=0;n0){const c=_e.resolveSymbolOverrides({type:"CIMSymbolReference",primitiveOverrides:h,symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,size:d.symbol.height,anchorPointUnits:"Relative",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},symbol:d.symbol,textString:d.textString}],scaleSymbolsProportionally:!0,respectFrame:!0}]}},r,this.view.spatialReference,null,E(r.projectedGeometry),null,null);c.then(u=>{const f=u.symbolLayers[0],{textString:b}=f.markerGraphics[0];s.push({type:"cim-rasterization-info",resource:{type:"text",textString:b||"",font:d.font}}),l.text=d.textString=b||""}),t.push(c)}else s.push({type:"cim-rasterization-info",resource:d})}t.length>0&&await Promise.all(t);const i=s.map(n=>this.view.stage.textureManager.rasterizeItem(n)),o=await Promise.all(i);se(o);const a=new Map;for(let n=0;n{const i=new h(2).multiply(e),s=d(i),a=d(t);return t.subtract(s.multiply(t).multiply(a))}],[Qt(t,new h(.25)),()=>{const i=new h(2).multiply(e),s=Kt(i).multiply(t),a=new h(16).multiply(t).subtract(new h(12)).multiply(t).add(new h(3));return t.add(s.multiply(a))}],[!0,()=>{const i=new h(2).multiply(e),s=Kt(i),a=Ie(t).subtract(t);return t.add(s.multiply(a))}])}function Lt(t,e){const i=d(P(new h(.5),e)).multiply(vt(t,new h(2).multiply(e))),s=P(new h(.5),e).multiply(wt(t,new h(2).multiply(Ve(e,.5))));return i.add(s)}function Yt(t){return F(F(t.r,t.g),t.b)}function ye(t){return Nt(Nt(t.r,t.g),t.b)}function Ut(t){return Pe(t,new b(.3,.59,.11))}function se(t){return ye(t).subtract(Yt(t))}function ri(t){const e=Ut(t),i=Yt(t),s=ye(t);return me([de(i,new h(0)),()=>{const a=t.subtract(e).multiply(e),o=e.subtract(i);return e.add(a.divide(o))}],[Xt(s,new h(1)),()=>{const a=t.subtract(e),o=d(e),n=a.multiply(o),l=s.subtract(e);return e.add(n.divide(l))}],[!0,t])}function Gt(t,e){const i=Ut(t),s=Ut(e).subtract(i);return ri(t.add(new b(s)))}function ne(t,e,i){const s=Yt(t),a=se(t),o=se(e);return Gt(C(Xt(a,new h(0)),()=>t.subtract(s).multiply(o).divide(a),new b(0)),i)}function zt(t,e){return C(D(e,new h(1)),e,()=>{const i=d(e),s=t.multiply(t).divide(i);return F(s,new h(1))})}c([De],dt.prototype,"blendMode",void 0),c([w(J)],dt.prototype,"config",void 0),c([I(0,A(_e))],dt.prototype,"vertex",null),c([I(0,A(ai))],dt.prototype,"fragment",null);class we extends Ct{}c([Mt(0,S)],we.prototype,"position",void 0);class li extends Ft{}let jt=class extends ot{};c([w(j)],jt.prototype,"layerTexture",void 0),c([w(h)],jt.prototype,"opacity",void 0);let Rt=class extends Tt{vertex(t){return{uv:t.position,glPosition:new y(t.position.subtract(new S(.5)).multiply(2),0,1)}}fragment(t){const e=new kt;return e.glFragColor=G(this.config.layerTexture,t.uv).multiply(this.config.opacity),e}};c([w(jt)],Rt.prototype,"config",void 0),c([I(0,A(we))],Rt.prototype,"vertex",null),c([I(0,A(li))],Rt.prototype,"fragment",null);const Pi={shaders:{vertexShader:$("highlight/textured.vert"),fragmentShader:$("highlight/highlight.frag")},attributes:new Map([["a_position",0],["a_texcoord",1]])},Ai={shaders:{vertexShader:$("highlight/textured.vert"),fragmentShader:$("highlight/blur.frag")},attributes:new Map([["a_position",0],["a_texcoord",1]])},k=!!Wt("esri-2d-profiler");let Zi=class{constructor(t,e){if(this._events=new Te,this._entries=new Map,this._timings=new Ge(10),this._currentContainer=null,this._currentPass=null,this._currentBrush=null,this._currentSummary=null,!k)return;this._ext=je(t.gl,{}),this._debugOutput=e;const i=t.gl;if(!this.enableCommandLogging)return;let s;for(s in i)if(typeof i[s]=="function"){const a=i[s],o=s.includes("draw");i[s]=(...n)=>(this._events.emit("command",{container:this._currentContainer,pass:this._currentPass,brush:this._currentBrush,method:s,args:n,isDrawCommand:o}),this._currentSummary&&(this._currentSummary.commands++,o&&this._currentSummary.drawCommands++),a.apply(i,n))}}get enableCommandLogging(){return!(typeof k=="object"&&k.disableCommands)}recordContainerStart(t){k&&(this._currentContainer=t)}recordContainerEnd(){k&&(this._currentContainer=null)}recordPassStart(t){k&&(this._currentPass=t,this._initSummary())}recordPassEnd(){k&&(this._currentPass=null,this._emitSummary())}recordBrushStart(t){k&&(this._currentBrush=t)}recordBrushEnd(){k&&(this._currentBrush=null)}recordStart(t){if(k&&this._ext!=null){if(this._entries.has(t)){const i=this._entries.get(t),s=this._ext.resultAvailable(i.query),a=this._ext.disjoint();if(s&&!a){const o=this._ext.getResult(i.query)/1e6;let n=0;if(this._timings.enqueue(o)!=null){const u=this._timings.entries,m=u.length;let _=0;for(const p of u)_+=p;n=_/m}const l=o.toFixed(2),r=n?n.toFixed(2):"--";this.enableCommandLogging?(console.groupCollapsed(`Frame report for ${t}, ${l} ms (${r} last 10 avg)
-${i.commandsLen} Commands (${i.drawCommands} draw)`),console.log("RenderPass breakdown: "),console.table(i.summaries),console.log("Commands: ",i.commands),console.groupEnd()):console.log(`Frame report for ${t}, ${l} ms (${r} last 10 avg)`),this._debugOutput.innerHTML=`${l} (${r})`}for(const o of i.handles)o.remove();this._ext.deleteQuery(i.query),this._entries.delete(t)}const e={name:t,query:this._ext.createQuery(),commands:[],commandsLen:0,drawCommands:0,summaries:[],handles:[]};this.enableCommandLogging&&(e.handles.push(this._events.on("command",i=>{e.commandsLen++,e.commands.push(i),i.isDrawCommand&&e.drawCommands++})),e.handles.push(this._events.on("summary",i=>{e.summaries.push(i)}))),this._ext.beginTimeElapsed(e.query),this._entries.set(t,e)}}recordEnd(t){k&&this._ext!=null&&this._entries.has(t)&&this._ext.endTimeElapsed()}_initSummary(){this.enableCommandLogging&&(this._currentSummary={container:this._currentContainer,pass:this._currentPass,drawCommands:0,commands:0})}_emitSummary(){this.enableCommandLogging&&this._currentSummary&&this._events.emit("summary",this._currentSummary)}};const E=1,bt=0,it=1,st=2;let ui=class{constructor(t,e,i){this._width=t*i,this._height=e*i,this._pixelRatio=i;const s=Math.ceil(this._width/E),a=Math.ceil(this._height/E);this._cols=s,this._rows=a,this._cells=ei.create(s*a)}insertMetrics(t){this._markMetrics(t)}hasCollision(t){let e=0;for(const{transformedX:i,transformedY:s,width:a,height:o}of t.bounds){const n=a*this._pixelRatio,l=o*this._pixelRatio,r=i*this._pixelRatio,u=s*this._pixelRatio;switch(this._collide(r,u,n,l)){case st:return st;case it:e++}}return e===t.bounds.length?it:bt}getCellId(t,e){return t+e*this._cols}has(t){return this._cells.has(t)}hasRange(t,e){return this._cells.hasRange(t,e)}set(t){this._cells.set(t)}setRange(t,e){this._cells.setRange(t,e)}_collide(t,e,i,s){const a=t-i/2,o=e-s/2,n=a+i,l=o+s;if(n<0||l<0||a>this._width||o>this._height)return it;const r=L(Math.floor(a/E),0,this._cols),u=L(Math.floor(o/E),0,this._rows),m=L(Math.ceil(n/E),0,this._cols),_=L(Math.ceil(l/E),0,this._rows);for(let p=u;p<=_;p++)for(let g=r;g<=m;g++){const v=this.getCellId(g,p);if(this.has(v))return st}return bt}_mark(t,e,i,s){const a=t-i/2,o=e-s/2,n=a+i,l=o+s,r=L(Math.floor(a/E),0,this._cols),u=L(Math.floor(o/E),0,this._rows),m=L(Math.ceil(n/E),0,this._cols),_=L(Math.ceil(l/E),0,this._rows);for(let p=u;p<=_;p++)for(let g=r;g<=m;g++){const v=this.getCellId(g,p);this.set(v)}return!1}_markMetrics(t){for(const{transformedX:e,transformedY:i,width:s,height:a}of t.bounds){const o=s*this._pixelRatio,n=a*this._pixelRatio,l=e*this._pixelRatio,r=i*this._pixelRatio;this._mark(l,r,o,n)}}};const H=254,pt=255,Q=0;function B(t,e){const i=t.children.slice();i.sort((s,a)=>s.tileAge-a.tileAge),i.forEach(s=>{s.labelMetrics!=null&&s.isReady&&e(s,s.labelMetrics)})}function oe(t,e){return(!t.minScale||t.minScale>=e)&&(!t.maxScale||t.maxScale<=e)}class hi{run(e,i,s,a){const o=[];for(let n=e.length-1;n>=0;n--){const l=e[n];l.labelingCollisionInfos?.length&&o.push(...l.labelingCollisionInfos)}Wt("esri-2d-update-debug")&&o.length&&console.debug("CollisionEngine.run"),this._transformMetrics(o),this._runCollision(o,i,s,a);for(const n of o)n.container.requestRender()}_runCollision(e,i,s,a){const[o,n]=i.state.size,l=new ui(o,n,i.pixelRatio);for(const{container:r,deconflictionEnabled:u,visible:m}of e){const _=r.attributeView;u?m?(this._prepare(r),this._collideVisible(l,r,s,a),this._collideInvisible(l,r)):B(r,(p,g)=>{for(const v of g)_.setLabelMinZoom(v.entityTexel,pt)}):B(r,(p,g)=>{for(const v of g)oe(v,s)?(_.setLabelMinZoom(v.entityTexel,Q),m&&l.insertMetrics(v)):_.setLabelMinZoom(v.entityTexel,H)})}}_isFiltered(e,i,s){const a=i.getFilterFlags(e),o=!s.hasFilter||!!(a&We),n=s.featureEffect==null||s.featureEffect.excludedLabelsVisible||!!(a&Xe);return!(o&&n)}_prepare(e){const i=e.attributeView,s=new Set;B(e,(a,o)=>{for(const n of o){const l=n.entityTexel;if(!s.has(l)){if(s.add(l),this._isFiltered(l,i,e.layerView)){i.setLabelMinZoom(l,H);continue}i.getLabelMinZoom(l)!==Q?i.setLabelMinZoom(l,pt):i.setLabelMinZoom(l,Q)}}})}_collideVisible(e,i,s,a){const o=i.attributeView,n=new Set;B(i,(l,r)=>{for(let u=0;u{for(let l=0;l{const l=i.attributeView,r=o.transforms.labelMat2d;r[4]=Math.round(r[4]),r[5]=Math.round(r[5]);const u=s==="polyline";for(const m of n){const{entityTexel:_,anchorX:p,anchorY:g}=m;let v=m.referenceBounds?.size??0;const T=a[0];if(T!=null){const M=T(l.getVisualVariableData(_,ti.SIZE));v=isNaN(M)||M==null||M===1/0?v:M}const at=Ye+v/2,rt=m.directionX*at,Y=m.directionY*at;for(const M of m.bounds){let lt=p,ut=g;if(u){const ht=p+M.x+rt,ct=g+M.y+Y;lt=r[0]*ht+r[2]*ct+r[4],ut=r[1]*ht+r[3]*ct+r[5];const Me=lt,Ce=ut;M.transformedX=Math.floor(Me),M.transformedY=Math.floor(Ce)}else{lt=r[0]*p+r[2]*g+r[4],ut=r[1]*p+r[3]*g+r[5];const ht=lt+M.x+rt,ct=ut+M.y+Y;M.transformedX=ht,M.transformedY=ct}}}})}}const ci=32;let K=class extends W{constructor(t){super(t),this._lastUpdate=0,this.collisionEngine=new hi,this.lastUpdateId=-1,this.updateRequested=!1,this.view=null}get updating(){return Wt("esri-2d-log-updating")&&console.log(`Updating LabelManager ${this.updateRequested}:
--> updateRequested: ${this.updateRequested}`),this.updateRequested}update(t){const e=performance.now();e-this._lastUpdate>=ci?(this._lastUpdate=e,this.doUpdate(t)):this.requestUpdate()}viewChange(){this.requestUpdate()}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.view?.requestUpdate())}processUpdate(t){this.updateRequested&&(this.updateRequested=!1,this.update(t))}doUpdate(t){const e=this.view;if(e)try{const i=t.state.scale,s=e.featuresTilingScheme.getClosestInfoForScale(i).level;this.collisionEngine.run(e.allLayerViews.items,t,i,s)}catch{}}};c([f()],K.prototype,"updateRequested",void 0),c([f()],K.prototype,"updating",null),c([f()],K.prototype,"view",void 0),K=c([X("esri.views.2d.LabelManager")],K);const gt="esri-zoom-box",_t={container:`${gt}__container`,overlay:`${gt}__overlay`,background:`${gt}__overlay-background`,box:`${gt}__outline`},$t={zoom:"Shift",counter:"Control"};let tt=class extends W{constructor(t){super(t),this._container=null,this._overlay=null,this._backgroundShape=null,this._boxShape=null,this._box={x:0,y:0,width:0,height:0},this._rafId=null,this._redraw=this._redraw.bind(this)}destroy(){this.view=null}set view(t){this.removeAllHandles(),this._destroyOverlay(),this._set("view",t),t&&this.addHandles([t.on("drag",[$t.zoom],e=>this._handleDrag(e,1),ee.INTERNAL),t.on("drag",[$t.zoom,$t.counter],e=>this._handleDrag(e,-1),ee.INTERNAL)])}_start(){this._createContainer(),this._createOverlay(),this.navigation.begin()}_update(t,e,i,s){this._box.x=t,this._box.y=e,this._box.width=i,this._box.height=s,this._rafId||(this._rafId=requestAnimationFrame(this._redraw))}_end(t,e,i,s,a){const o=this.view,n=o.toMap(ke(t+.5*i,e+.5*s));let l=Math.max(i/o.width,s/o.height);a===-1&&(l=1/l),this._destroyOverlay(),this.navigation.end(),o.goTo({center:n,scale:o.scale*l},{animationMode:"always",duration:pe()})}_updateBox(t,e,i,s){const a=this._boxShape;a.setAttributeNS(null,"x",""+t),a.setAttributeNS(null,"y",""+e),a.setAttributeNS(null,"width",""+i),a.setAttributeNS(null,"height",""+s),a.setAttributeNS(null,"class",_t.box)}_updateBackground(t,e,i,s){this._backgroundShape.setAttributeNS(null,"d",this._toSVGPath(t,e,i,s,this.view.width,this.view.height))}_createContainer(){const t=document.createElement("div");t.className=_t.container,this.view.root.appendChild(t),this._container=t}_createOverlay(){const t=this.view.width,e=this.view.height,i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttributeNS(null,"d","M 0 0 L "+t+" 0 L "+t+" "+e+" L 0 "+e+" Z"),i.setAttributeNS(null,"class",_t.background);const s=document.createElementNS("http://www.w3.org/2000/svg","rect"),a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),a.setAttributeNS(null,"class",_t.overlay),a.appendChild(i),a.appendChild(s),this._container.appendChild(a),this._backgroundShape=i,this._boxShape=s,this._overlay=a}_destroyOverlay(){this._container&&this._container.parentNode&&this._container.parentNode.removeChild(this._container),this._container=this._backgroundShape=this._boxShape=this._overlay=null}_toSVGPath(t,e,i,s,a,o){const n=t+i,l=e+s;return"M 0 0 L "+a+" 0 L "+a+" "+o+" L 0 "+o+" ZM "+t+" "+e+" L "+t+" "+l+" L "+n+" "+l+" L "+n+" "+e+" Z"}_handleDrag(t,e){const i=t.x,s=t.y,a=t.origin.x,o=t.origin.y;let n,l,r,u;switch(i>a?(n=a,r=i-a):(n=i,r=a-i),s>o?(l=o,u=s-o):(l=s,u=o-s),t.action){case"start":this._start();break;case"update":this._update(n,l,r,u);break;case"end":this._end(n,l,r,u,e)}t.stopPropagation()}_redraw(){if(!this._rafId||(this._rafId=null,!this._overlay))return;const{x:t,y:e,width:i,height:s}=this._box;this._updateBox(t,e,i,s),this._updateBackground(t,e,i,s),this._rafId=requestAnimationFrame(this._redraw)}};c([f()],tt.prototype,"navigation",void 0),c([f()],tt.prototype,"view",null),tt=c([X("esri.views.2d.navigation.ZoomBox")],tt);const mi=tt;let R=class{constructor(t){this._gain=t,this.lastValue=void 0,this.filteredDelta=void 0}update(t){if(this.hasLastValue()){const e=this.computeDelta(t);this._updateDelta(e)}this.lastValue=t}reset(){this.lastValue=void 0,this.filteredDelta=void 0}hasLastValue(){return this.lastValue!==void 0}hasFilteredDelta(){return this.filteredDelta!==void 0}computeDelta(t){return this.lastValue===void 0?NaN:t-this.lastValue}_updateDelta(t){this.filteredDelta!==void 0?this.filteredDelta=(1-this._gain)*this.filteredDelta+this._gain*t:this.filteredDelta=t}};class Ht{constructor(e,i,s){this._initialVelocity=e,this._stopVelocity=i,this._friction=s,this._duration=Math.abs(Math.log(Math.abs(this._initialVelocity)/this._stopVelocity)/Math.log(1-this._friction))}get duration(){return this._duration}isFinished(e){return e>this.duration}get friction(){return this._friction}value(e){return this.valueFromInitialVelocity(this._initialVelocity,e)}valueDelta(e,i){const s=this.value(e);return this.value(e+i)-s}valueFromInitialVelocity(e,i){i=Math.min(i,this.duration);const s=1-this.friction;return e*(s**i-1)/Math.log(s)}}class di extends Ht{constructor(e,i,s,a,o){super(e,i,s),this._sceneVelocity=a,this.direction=o}value(e){return super.valueFromInitialVelocity(this._sceneVelocity,e)}}class pi{constructor(e=300,i=12,s=.84){this._minimumInitialVelocity=e,this._stopVelocity=i,this._friction=s,this.enabled=!0,this._time=new R(.6),this._screen=[new R(.4),new R(.4)],this._scene=[new R(.6),new R(.6),new R(.6)],this._tmpDirection=ue()}add(e,i,s){if(this.enabled){if(this._time.hasLastValue()&&this._time.computeDelta(s)<.015)return;this._screen[0].update(e[0]),this._screen[1].update(e[1]),this._scene[0].update(i[0]),this._scene[1].update(i[1]),this._scene[2].update(i[2]),this._time.update(s)}}reset(){this._screen[0].reset(),this._screen[1].reset(),this._scene[0].reset(),this._scene[1].reset(),this._scene[2].reset(),this._time.reset()}evaluateMomentum(){if(!this.enabled||!this._screen[0].hasFilteredDelta()||!this._time.hasFilteredDelta())return null;const e=this._screen[0].filteredDelta,i=this._screen[1].filteredDelta,s=e==null||i==null?0:Math.sqrt(e*e+i*i),a=this._time.filteredDelta,o=a==null||s==null?0:s/a;return Math.abs(o)0&&ge(this._tmpDirection,this._tmpDirection,1/a);const o=this._time.filteredDelta;return new di(e,i,s,o==null?0:a/o,this._tmpDirection)}}let q=class extends W{constructor(t){super(t),this.animationTime=0,this.momentumEstimator=new pi(500,6,.92),this.momentum=null,this.tmpMomentum=ue(),this.momentumFinished=!1,this.viewpoint=new St({targetGeometry:new xt,scale:0,rotation:0}),this._previousDrag=null,he(()=>this.momentumFinished,()=>this.navigation.stop())}begin(t,e){this.navigation.begin(),this.momentumEstimator.reset(),this.addToEstimator(e),this._previousDrag=e}update(t,e){this.addToEstimator(e);let i=e.center.x,s=e.center.y;const a=this._previousDrag;i=a?a.center.x-i:-i,s=a?s-a.center.y:s,t.viewpoint=ft(this.viewpoint,t.viewpoint,[i||0,s||0]),this._previousDrag=e}end(t,e){this.addToEstimator(e);const i=t.navigation.effectiveMomentumEnabled;this.momentum=i?this.momentumEstimator.evaluateMomentum():null,this.animationTime=0,this.momentum&&this.onAnimationUpdate(t),this._previousDrag=null,this.navigation.end()}addToEstimator(t){const e=t.center.x,i=t.center.y,s=Fe(-e,i),a=Se(-e,i,0);this.momentumEstimator.add(s,a,.001*t.timestamp)}onAnimationUpdate(t){this.navigation.animationManager?.animateContinuous(t.viewpoint,(e,i)=>{const{momentum:s,animationTime:a,tmpMomentum:o}=this,n=.001*i;if(!(this.momentumFinished=!s||s.isFinished(a))){const l=s.valueDelta(a,n);ge(o,s.direction,l),ft(e,e,o),t.constraints.constrainByGeometry(e)}this.animationTime+=n})}stopMomentumNavigation(){this.momentum&&(this.momentumEstimator.reset(),this.momentum=null,this.navigation.stop())}};c([f()],q.prototype,"momentumFinished",void 0),c([f()],q.prototype,"viewpoint",void 0),c([f()],q.prototype,"navigation",void 0),q=c([X("esri.views.2d.navigation.actions.Pan")],q);const gi=q;let ve=class{constructor(t=2.5,e=.01,i=.95,s=12){this._minimumInitialVelocity=t,this._stopVelocity=e,this._friction=i,this._maxVelocity=s,this.enabled=!0,this.value=new R(.8),this.time=new R(.3)}add(t,e){if(this.enabled&&e!=null){if(this.time.hasLastValue()){if(this.time.computeDelta(e)<.01)return;if(this.value.hasFilteredDelta()){const i=this.value.computeDelta(t);this.value.filteredDelta*i<0&&this.value.reset()}}this.time.update(e),this.value.update(t)}}reset(){this.value.reset(),this.time.reset()}evaluateMomentum(){if(!this.enabled||!this.value.hasFilteredDelta()||!this.time.hasFilteredDelta())return null;let t=this.value.filteredDelta/this.time.filteredDelta;return t=L(t,-this._maxVelocity,this._maxVelocity),Math.abs(t)Math.PI;)a-=2*Math.PI;for(;a<-Math.PI;)a+=2*Math.PI;e=s+a}super.add(e,i)}}class yi extends Ht{constructor(e,i,s){super(e,i,s)}value(e){const i=super.value(e);return Math.exp(i)}valueDelta(e,i){const s=super.value(e),a=super.value(e+i)-s;return Math.exp(a)}}class wi extends ve{constructor(e=2.5,i=.01,s=.95,a=12){super(e,i,s,a)}add(e,i){super.add(Math.log(e),i)}createMomentum(e,i,s){return new yi(e,i,s)}}let U=class extends W{constructor(t){super(t),this._animationTime=0,this._momentumFinished=!1,this._previousAngle=0,this._previousRadius=0,this._previousCenter=null,this._rotationMomentumEstimator=new _i(.6,.15,.95),this._rotationDirection=1,this._startAngle=0,this._startRadius=0,this._updateTimestamp=null,this._zoomDirection=1,this._zoomMomentumEstimator=new wi,this._zoomOnly=null,this.viewpoint=new St({targetGeometry:new xt,scale:0,rotation:0}),this.zoomMomentum=null,this.rotateMomentum=null,this.addHandles(he(()=>this._momentumFinished,()=>this.navigation.stop()))}begin(t,e){this.navigation.begin(),this._rotationMomentumEstimator.reset(),this._zoomMomentumEstimator.reset(),this._zoomOnly=null,this._previousAngle=this._startAngle=e.angle,this._previousRadius=this._startRadius=e.radius,this._previousCenter=e.center,this._updateTimestamp=null,t.constraints.rotationEnabled&&this.addToRotateEstimator(0,e.timestamp),this.addToZoomEstimator(e,1)}update(t,e){this._updateTimestamp===null&&(this._updateTimestamp=e.timestamp);const i=e.angle,s=e.radius,a=e.center,o=Math.abs(180*(i-this._startAngle)/Math.PI),n=Math.abs(s-this._startRadius),l=this._startRadius/s;if(this._previousRadius&&this._previousCenter){const r=s/this._previousRadius;let u=180*(i-this._previousAngle)/Math.PI;this._rotationDirection=u>=0?1:-1,this._zoomDirection=r>=1?1:-1,t.constraints.rotationEnabled?(this._zoomOnly===null&&e.timestamp-this._updateTimestamp>200&&(this._zoomOnly=n-o>0),this._zoomOnly===null||this._zoomOnly?u=0:this.addToRotateEstimator(i-this._startAngle,e.timestamp)):u=0,this.addToZoomEstimator(e,l),this.navigation.setViewpoint([a.x,a.y],1/r,u,[this._previousCenter.x-a.x,a.y-this._previousCenter.y])}this._previousAngle=i,this._previousRadius=s,this._previousCenter=a}end(t){this.rotateMomentum=this._rotationMomentumEstimator.evaluateMomentum(),this.zoomMomentum=this._zoomMomentumEstimator.evaluateMomentum(),this._animationTime=0,(this.rotateMomentum||this.zoomMomentum)&&this.onAnimationUpdate(t),this.navigation.end()}addToRotateEstimator(t,e){this._rotationMomentumEstimator.add(t,.001*e)}addToZoomEstimator(t,e){this._zoomMomentumEstimator.add(e,.001*t.timestamp)}canZoomIn(t){const e=t.scale,i=t.constraints.effectiveMaxScale;return i===0||e>i}canZoomOut(t){const e=t.scale,i=t.constraints.effectiveMinScale;return i===0||e{const s=!this.canZoomIn(t)&&this._zoomDirection>1||!this.canZoomOut(t)&&this._zoomDirection<1,a=!this.rotateMomentum||this.rotateMomentum.isFinished(this._animationTime),o=s||!this.zoomMomentum||this.zoomMomentum.isFinished(this._animationTime),n=.001*i;if(this._momentumFinished=a&&o,!this._momentumFinished){const l=this.rotateMomentum?Math.abs(this.rotateMomentum.valueDelta(this._animationTime,n))*this._rotationDirection*180/Math.PI:0;let r=this.zoomMomentum?Math.abs(this.zoomMomentum.valueDelta(this._animationTime,n)):1;const u=nt(),m=nt();if(this._previousCenter){qt(u,this._previousCenter.x,this._previousCenter.y),He(m,t.size,t.padding),ni(u,u,m);const{constraints:_,scale:p}=t,g=p*r;r<1&&!_.canZoomInTo(g)?(r=p/_.effectiveMaxScale,this.zoomMomentum=null,this.rotateMomentum=null):r>1&&!_.canZoomOutTo(g)&&(r=p/_.effectiveMinScale,this.zoomMomentum=null,this.rotateMomentum=null),Qe(e,t.viewpoint,r,l,u,t.size),t.constraints.constrainByGeometry(e)}}this._animationTime+=n})}stopMomentumNavigation(){(this.rotateMomentum||this.zoomMomentum)&&(this.rotateMomentum&&(this._rotationMomentumEstimator.reset(),this.rotateMomentum=null),this.zoomMomentum&&(this._zoomMomentumEstimator.reset(),this.zoomMomentum=null),this.navigation.stop())}};c([f()],U.prototype,"_momentumFinished",void 0),c([f()],U.prototype,"viewpoint",void 0),c([f()],U.prototype,"navigation",void 0),U=c([X("esri.views.2d.navigation.actions.Pinch")],U);const vi=U,It=nt(),ae=nt();let et=class extends W{constructor(t){super(t),this._previousCenter=nt(),this.viewpoint=new St({targetGeometry:new xt,scale:0,rotation:0})}begin(t,e){this.navigation.begin(),qt(this._previousCenter,e.center.x,e.center.y)}update(t,e){const{state:{size:i,padding:s}}=t;qt(It,e.center.x,e.center.y),Ke(ae,i,s),t.viewpoint=Ot(this.viewpoint,t.state.paddedViewState.viewpoint,Je(ae,this._previousCenter,It)),oi(this._previousCenter,It)}end(){this.navigation.end()}};c([f()],et.prototype,"viewpoint",void 0),c([f()],et.prototype,"navigation",void 0),et=c([X("esri.views.2d.navigation.actions.Rotate")],et);const fi=et,O=10,re=1,Pt=new St({targetGeometry:new xt}),At=[0,0],le=250;let V=class extends W{constructor(t){super(t),this._endTimer=null,this._lastEventTimestamp=null,this.animationManager=null,this.interacting=!1}initialize(){this.pan=new gi({navigation:this}),this.rotate=new fi({navigation:this}),this.pinch=new vi({navigation:this}),this.zoomBox=new mi({view:this.view,navigation:this})}destroy(){this.pan=mt(this.pan),this.rotate=mt(this.rotate),this.pinch=mt(this.pinch),this.zoomBox=mt(this.zoomBox),this.animationManager=null}begin(){this.stop(),this._set("interacting",!0)}end(){this._lastEventTimestamp=performance.now(),this._startTimer(le)}async zoom(t,e=this._getDefaultAnchor()){if(this.begin(),this.view.constraints.snapToZoom&&this.view.constraints.effectiveLODs)return t<1?this.zoomIn(e):this.zoomOut(e);this.setViewpoint(e,t,0,[0,0])}async zoomIn(t){const e=this.view,i=e.constraints.snapToNextScale(e.scale);return this._zoomToScale(i,t)}async zoomOut(t){const e=this.view,i=e.constraints.snapToPreviousScale(e.scale);return this._zoomToScale(i,t)}setViewpoint(t,e,i,s){this.begin(),this.view.stateManager.state.viewpoint=this._scaleRotateTranslateViewpoint(this.view.viewpoint,t,e,i,s),this.end()}setViewpointImmediate(t,e=0,i=[0,0],s=this._getDefaultAnchor()){this.view.stateManager.state.viewpoint=this._scaleRotateTranslateViewpoint(this.view.viewpoint,s,t,e,i)}continuousRotateClockwise(){const t=this.view.viewpoint;this.animationManager?.animateContinuous(t,e=>{Ot(e,e,-re)})}continuousRotateCounterclockwise(){const t=this.view.viewpoint;this.animationManager?.animateContinuous(t,e=>{Ot(e,e,re)})}resetRotation(){this.view.constraints.rotationEnabled&&(this.view.rotation=0)}continuousPanLeft(){this._continuousPan([-O,0])}continuousPanRight(){this._continuousPan([O,0])}continuousPanUp(){this._continuousPan([0,O])}continuousPanDown(){this._continuousPan([0,-O])}continuousPanVector({x:t,y:e}){this._continuousPan([t*O,e*O])}stop(){this.pan.stopMomentumNavigation(),this.animationManager?.stop(),this.end(),this._endTimer!==null&&(clearTimeout(this._endTimer),this._endTimer=null,this._set("interacting",!1))}_continuousPan(t){const e=this.view.viewpoint;this.animationManager?.animateContinuous(e,i=>{ft(i,i,t),this.view.constraints.constrainByGeometry(i)})}_startTimer(t){return this._endTimer!==null||(this._endTimer=setTimeout(()=>{this._endTimer=null;const e=performance.now()-(this._lastEventTimestamp??0);ea&&!u))return ie(Pt,o,t/a,0,e,n,l),s.constrainByGeometry(Pt),i.goTo(Pt,{animate:!0,animationMode:"always",duration:pe(),pickClosestTarget:!1})}_scaleRotateTranslateViewpoint(t,e,i,s,a){const{view:o}=this,{size:n,padding:l,constraints:r,scale:u,viewpoint:m}=o,_=u*i,p=r.canZoomInTo(_),g=r.canZoomOutTo(_);return(i<1&&!p||i>1&&!g)&&(i=1),ft(m,m,a),ie(t,m,i,s,e,n,l),r.constrainByGeometry(t)}};c([f()],V.prototype,"animationManager",void 0),c([f({type:Boolean,readOnly:!0})],V.prototype,"interacting",void 0),c([f()],V.prototype,"pan",void 0),c([f()],V.prototype,"pinch",void 0),c([f()],V.prototype,"rotate",void 0),c([f()],V.prototype,"view",void 0),c([f()],V.prototype,"zoomBox",void 0),V=c([X("esri.views.2d.navigation.MapViewNavigation")],V);const Ni=V;class fe extends Ct{}c([Mt(0,S)],fe.prototype,"position",void 0);class bi extends Ft{}class z extends ot{}c([w(j)],z.prototype,"readbackTexture",void 0),c([w(j)],z.prototype,"maskTexture",void 0),c([w(j)],z.prototype,"overlayTexture",void 0),c([w(y)],z.prototype,"background",void 0),c([w(y)],z.prototype,"drawPos",void 0),c([w(h)],z.prototype,"maskEnabled",void 0),c([w(h)],z.prototype,"overlayEnabled",void 0);class Zt extends Tt{vertex(e){const i=e.position,s=e.position.subtract(new S(.5)).multiply(this.config.drawPos.zw),a=this.config.drawPos.xy.add(s);return{glPosition:new y(a,0,1),texCoord:i}}fragment(e){let i=G(this.config.readbackTexture,xi(e.texCoord));i=i.add(new h(1).subtract(i.a)).multiply(this.config.background);const s=C(D(this.config.maskEnabled,new h(1)),G(this.config.maskTexture,e.texCoord).a,new h(1));i=i.multiply(s);const a=C(D(this.config.overlayEnabled,new h(1)),G(this.config.overlayTexture,e.texCoord),new y(0)),o=new kt;return o.glFragColor=a.add(new h(1).subtract(a.a).multiply(i)),o}}function xi(t){const e=t.multiply(new S(2)).subtract(1);return C(D(e.x,new h(0)).and(D(e.y,new h(0))),new S(.5),()=>{const i=Ae(e.y,e.x),s=Ze(Be(e),new h(Ne)),a=new S(Oe(i),qe(i));return s.multiply(a).multiply(new S(.5)).add(new h(.5))})}c([w(z)],Zt.prototype,"config",void 0),c([I(0,A(fe))],Zt.prototype,"vertex",null),c([I(0,A(bi))],Zt.prototype,"fragment",null);class be extends Ct{}c([Mt(0,S)],be.prototype,"position",void 0);class Mi extends Ft{}class xe extends ot{}c([w(Ue)],xe.prototype,"dvs",void 0);class N extends ot{}c([w(h)],N.prototype,"halfWidth",void 0),c([w(h)],N.prototype,"aaWidth",void 0),c([w(h)],N.prototype,"pxPerCell",void 0),c([w(y)],N.prototype,"minorLineColor",void 0),c([w(y)],N.prototype,"majorLineColor",void 0),c([w(Bt)],N.prototype,"majorLineInterval",void 0);class yt extends Tt{vertex(e){const i=e.position.multiply(2).subtract(1);return{gridPos:this.transform.dvs.multiply(new b(i,1)).xy,glPosition:new y(i,0,1)}}fragment(e){const i=ce(e.gridPos),s=Le(i),a=F(s.x,new h(1).subtract(s.x)),o=F(s.y,new h(1).subtract(s.y)),n=new S(a,o).multiply(this.config.pxPerCell).subtract(this.config.halfWidth),l=F(n.x,n.y),r=new h(1).subtract(ze(new h(0),this.config.aaWidth,l)),u=new Bt(Jt(i.x)),m=new Bt(Jt(i.y)),_=new h(te(u,this.config.majorLineInterval)),p=new h(te(m,this.config.majorLineInterval)),g=C(de(n.x,n.y),_,p),v=Xt(Re(P(n.x,this.config.aaWidth),P(n.y,this.config.aaWidth)),new h(.5)),T=F(_,p),at=C(v,T,g),rt=$e(this.config.majorLineColor,this.config.minorLineColor,F(at,new h(1))),Y=new kt;return Y.glFragColor=rt.multiply(r),Y}}c([w(xe)],yt.prototype,"transform",void 0),c([w(N)],yt.prototype,"config",void 0),c([I(0,A(be))],yt.prototype,"vertex",null),c([I(0,A(Mi))],yt.prototype,"fragment",null);export{Zt as E,Ni as F,Rt as T,$i as a,Ii as b,Pi as c,Zi as d,K as j,Ai as m,yt as r,dt as t};
diff --git a/fix-191/assets/GroupLayer-ER-XzoYr-BDFpCwaR.js b/fix-191/assets/GroupLayer-ER-XzoYr-BDFpCwaR.js
deleted file mode 100644
index 57a99fc8..00000000
--- a/fix-191/assets/GroupLayer-ER-XzoYr-BDFpCwaR.js
+++ /dev/null
@@ -1,2 +0,0 @@
-const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./groupLayerUtils-D-25JsA_-BTCM_kcx.js","./utils-BVWK2jiA-D_Oj_AG8.js","./story-DULt3Rma.js","./main-Bm7g2Jde.js","./main-DIDVYkhz.css","./story-DBsbaiEU.css","./originUtils-BLsWtgV9-B4sclfuf.js","./multiOriginJSONSupportUtils-DGETddQl-BrWaY9_8.js","./PortalItem-CctGdnxF-Dbw3pVTD.js","./jsonContext-BA8GHqVk-DqGWyE2_.js","./portalItemUtils-B8bw6SAG-CEVZt8QT.js","./projection-BA9M1R7d-DvHr0GeG.js","./projectBuffer-CvCBvJ6W-Cc8J4MEJ.js","./saveUtils-CIYk-dsQ-CKT8D_08.js","./resourceUtils-BmW6QqlX-B6O2_-dP.js","./uuid-Dj9mdEVg-BaKSCiyT.js","./resourceUtils-rTM6Iemx-DfsjKZP5.js"])))=>i.map(i=>d[i]);
-import{_ as u}from"./main-Bm7g2Jde.js";import{bp as b,ah as d,bP as v,W as c,bU as f,v as s,S as l,ac as h,a0 as _,ax as w,ai as g,av as m,i as L,a1 as I}from"./story-DULt3Rma.js";import{f as O}from"./CollectionFlattener-DkHuHn5E-CAzLWmFf.js";import{y as S}from"./loadAll-e978YItg-Sr8yCS6_.js";import{m as E}from"./MultiOriginJSONSupport-DKRh9P6w-tF-GNPM3.js";import{D as P}from"./Layer-ChoECxvZ-DQ-28MDL.js";import{u as V}from"./BlendLayer-D1WkSmwP-BHrWqYGA.js";import{E as A}from"./OperationalLayer-B5IXiMa2-BCAq75zB.js";import{C as M}from"./PortalLayer-CElnYuSQ-jChQE2im.js";import{S as x}from"./ScaleRangeLayer-Bz0DcnvM-BoX1P84V.js";import{p as C}from"./fetchService-DbaKmJhP-CyQcaR1i.js";import R from"./PortalItem-CctGdnxF-Dbw3pVTD.js";import{x as T,L as $,g as G}from"./TablesMixin-C8RojhYs-C4TS9tnz.js";import{E as p}from"./interfaces-Cwm0pihk-Ptzy6gTd.js";import{i as F}from"./saveUtils-CIYk-dsQ-CKT8D_08.js";import{y as H}from"./writeUtils-D5qlLkwk-B7Zow5Ob.js";import"./TimeExtent-Cn0Jofqr-DWlRQ-Qn.js";import"./jsonUtils-wIllKWI4-CU3QWWOb.js";import"./parser-DyDJ-rlI-8QTzeGdu.js";import"./mat4f32-CiZjBg9k-CUm34GoR.js";import"./mat4-DX7gBViE-DBcL5Ayd.js";import"./common-CYWrYyJl-E8-sukrT.js";import"./commonProperties-BtIqvFU_-CfGSai59.js";import"./ElevationInfo-yv2-9tj6-B5v76p2q.js";import"./lengthUtils-DKpMe5qR-BEdWsC7X.js";import"./portalItemUtils-B8bw6SAG-CEVZt8QT.js";import"./projection-BA9M1R7d-DvHr0GeG.js";import"./projectBuffer-CvCBvJ6W-Cc8J4MEJ.js";const j=Symbol("WebScene");let r=class extends V(x(A(M(T($(E(P))))))){constructor(e){super(e),this.allLayers=new O({getCollections:()=>[this.layers],getChildrenFunction:i=>"layers"in i?i.layers:null}),this.allTables=G(this),this.fullExtent=void 0,this.operationalLayerType="GroupLayer",this.spatialReference=void 0,this.type="group",this._debouncedSaveOperations=b(async(i,t,o)=>{const{save:a,saveAs:n}=await u(()=>import("./groupLayerUtils-D-25JsA_-BTCM_kcx.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url);switch(i){case p.SAVE:return a(this,t);case p.SAVE_AS:return n(this,o,t)}})}initialize(){this._enforceVisibility(this.visibilityMode,this.visible),this.addHandles([d(()=>{let e=this.parent;for(;e&&"parent"in e&&e.parent;)e=e.parent;return e&&j in e},e=>{const i="prevent-adding-tables";this.removeHandles(i),e&&(this.tables.removeAll(),this.addHandles(g(()=>this.tables,"before-add",t=>{t.preventDefault(),I.getLogger(this).errorOnce("tables","tables in group layers in a webscene are not supported. Please move the tables from the group layer to the webscene if you want to persist them.")}),i))},w),d(()=>this.visible,this._onVisibilityChange.bind(this),m)])}destroy(){this.allLayers.destroy(),this.allTables.destroy()}get sourceIsPortalItem(){return this.portalItem&&this.originIdOf("portalItem")===v.USER}_writeLayers(e,i,t,o){const a=[];if(!e)return a;e.forEach(n=>{const y=H(n,o.webmap?o.webmap.getLayerJSONFromResourceInfo(n):null,o);y?.layerType&&a.push(y)}),i.layers=a}set portalItem(e){this._set("portalItem",e)}readPortalItem(e,i,t){const{itemId:o,layerType:a}=i;if(a==="GroupLayer"&&o)return new R({id:o,portal:t?.portal})}writePortalItem(e,i){e?.id&&(i.itemId=e.id)}set visibilityMode(e){const i=this._get("visibilityMode")!==e;this._set("visibilityMode",e),i&&this._enforceVisibility(e,this.visible)}async beforeSave(){return F(this)}load(e){const i=this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Group Layer","Scene Service"],layerModuleTypeMap:C},e).catch(t=>{if(c(t),this.sourceIsPortalItem)throw t});return this.addResolvingPromise(i),Promise.resolve(this)}async loadAll(){return S(this,e=>{e(this.layers,this.tables)})}async save(e){return this._debouncedSaveOperations(p.SAVE,e)}async saveAs(e,i){return this._debouncedSaveOperations(p.SAVE_AS,i,e)}layerAdded(e){e.visible&&this.visibilityMode==="exclusive"?this._turnOffOtherLayers(e):this.visibilityMode==="inherited"&&(e.visible=this.visible),this.hasHandles(e.uid)?console.error(`Layer read to Grouplayer: uid=${e.uid}`):this.addHandles(d(()=>e.visible,i=>this._onChildVisibilityChange(e,i),m),e.uid)}layerRemoved(e){this.removeHandles(e.uid),this._enforceVisibility(this.visibilityMode,this.visible)}_turnOffOtherLayers(e){this.layers.forEach(i=>{i!==e&&(i.visible=!1)})}_enforceVisibility(e,i){if(!f(this).initialized)return;const t=this.layers;let o=t.find(a=>a.visible);switch(e){case"exclusive":t.length&&!o&&(o=t.at(0),o.visible=!0),this._turnOffOtherLayers(o);break;case"inherited":t.forEach(a=>{a.visible=i})}}_onVisibilityChange(e){this.visibilityMode==="inherited"&&this.layers.forEach(i=>{i.visible=e})}_onChildVisibilityChange(e,i){switch(this.visibilityMode){case"exclusive":i?this._turnOffOtherLayers(e):this._isAnyLayerVisible()||(e.visible=!0);break;case"inherited":e.visible=this.visible}}_isAnyLayerVisible(){return this.layers.some(e=>e.visible)}};s([l({readOnly:!0,dependsOn:[]})],r.prototype,"allLayers",void 0),s([l({readOnly:!0})],r.prototype,"allTables",void 0),s([l({json:{read:!0,write:!0}})],r.prototype,"blendMode",void 0),s([l()],r.prototype,"fullExtent",void 0),s([l({readOnly:!0})],r.prototype,"sourceIsPortalItem",null),s([l({json:{read:!1,write:{ignoreOrigin:!0}}})],r.prototype,"layers",void 0),s([h("layers")],r.prototype,"_writeLayers",null),s([l({type:["GroupLayer"]})],r.prototype,"operationalLayerType",void 0),s([l({json:{origins:{"web-map":{read:!1,write:{overridePolicy(e,i,t){return{enabled:e?.type==="Group Layer"&&t?.initiator!==this}}}},"web-scene":{read:!1,write:!1}}}})],r.prototype,"portalItem",null),s([_("web-map","portalItem",["itemId"])],r.prototype,"readPortalItem",null),s([h("web-map","portalItem",{itemId:{type:String}})],r.prototype,"writePortalItem",null),s([l()],r.prototype,"spatialReference",void 0),s([l({json:{read:!1},readOnly:!0,value:"group"})],r.prototype,"type",void 0),s([l({type:["independent","inherited","exclusive"],value:"independent",json:{write:!0,origins:{"web-map":{type:["independent","exclusive"],write:(e,i,t)=>{e!=="inherited"&&(i[t]=e)}}}}})],r.prototype,"visibilityMode",null),r=s([L("esri.layers.GroupLayer")],r);const ue=r;export{ue as default};
diff --git a/fix-191/assets/GroupLayerView2D-BR-kLeLa-DoVn9NKM.js b/fix-191/assets/GroupLayerView2D-BR-kLeLa-DoVn9NKM.js
deleted file mode 100644
index 55b56f63..00000000
--- a/fix-191/assets/GroupLayerView2D-BR-kLeLa-DoVn9NKM.js
+++ /dev/null
@@ -1 +0,0 @@
-import{v as t,S as s,dA as n,i as h,ag as m,ah as l,av as o,am as d}from"./story-DULt3Rma.js";import{X as V,Y as w}from"./LayerView-Bish-E63-BuRTInx3.js";import"./main-Bm7g2Jde.js";import"./Container-BcuL1ZEG-B_CYK192.js";import"./MapView-BGOJJ8ch-D1TWNssr.js";import"./Cyclical-C_9rKUUQ-BTshTtlN.js";import"./CollectionFlattener-DkHuHn5E-CAzLWmFf.js";import"./workers-PiCjreoO-CABaMBvC.js";import"./projection-BA9M1R7d-DvHr0GeG.js";import"./projectBuffer-CvCBvJ6W-Cc8J4MEJ.js";import"./TileInfo-CWIRDhZl-1qRzvaVI.js";import"./TileKey-B_6qmYK--BtZdR-Xy.js";import"./themeUtils-YjM7iIiX-Dxg99YfT.js";import"./uuid-Dj9mdEVg-BaKSCiyT.js";import"./UpdatingHandles-CUu3u1ms-C-zZs-35.js";import"./signal-CETehA7D-Cb8aw_q5.js";import"./Map-1zd11DKO-DXcvys-y.js";import"./Basemap-BEqqSTw9-B8z1wR1c.js";import"./loadAll-e978YItg-Sr8yCS6_.js";import"./PortalItem-CctGdnxF-Dbw3pVTD.js";import"./writeUtils-D5qlLkwk-B7Zow5Ob.js";import"./compilerUtils-CV1QYWI8-5SsZKq4e.js";import"./mat4f32-CiZjBg9k-CUm34GoR.js";import"./mat4-DX7gBViE-DBcL5Ayd.js";import"./common-CYWrYyJl-E8-sukrT.js";import"./TablesMixin-C8RojhYs-C4TS9tnz.js";import"./Layer-ChoECxvZ-DQ-28MDL.js";import"./TimeExtent-Cn0Jofqr-DWlRQ-Qn.js";import"./GraphicsCollection-CWTXNZOX-DHToCUr-.js";import"./HeightModelInfo-C5vFqzyF-B3QZnpVY.js";import"./ReactiveMap-CFk6jPfN-D0CsM6VZ.js";import"./Query-BrwMGK8U-DaHaJHm8.js";import"./Field-C6hA1tZj-DdgmWWCq.js";import"./fieldType-CD2CL2hr-BeIaxmP1.js";import"./arcgisLayerUrl-HNYh8jvG-CTcC0GBx.js";import"./ViewingMode-CyR_b1T8-_s7_Gbsk.js";import"./vec2f64-CeODonrJ-CkkJCdRC.js";import"./vec2-tHZ6OaOy-xCj1obDt.js";import"./Tile-D75RMC64-6QC6K6en.js";import"./TileKey-C5IL-JBr-DX55j9sZ.js";import"./QueueProcessor-DbfV9fLy-Cb_v9ly0.js";import"./quickselect-DHTstthl-Ds_Aj0x5.js";import"./normalizeUtils-Bxmy9MNI-CZMTs6Vg.js";import"./normalizeUtilsCommon-CRJlkfEA-CgRBIB_J.js";import"./utils-9sQxfkoa-CjNZjdKD.js";import"./utils-Bq23Xwmj-DhZYu3yh.js";import"./mat3-CC4Foazl-BWjyqE2v.js";import"./vec2f32-CVhmN3Me-DxoqVD7C.js";import"./unitBezier-CGtWxaCq-BRwEDigF.js";import"./Scheduler-B7UX7Wr5-Bw_5FpBi.js";import"./vec32-D9GsKZ1t-BK5Q1Wvx.js";import"./definitions-DJSdSb77-DkoRHaVx.js";import"./enums-DBi1-Mm2-CUS1pvQe.js";import"./Texture-BCt2hphT-Tabr9F2Q.js";import"./imageUtils-BA2D6Uf1-mQylXFz2.js";import"./capabilities-agoTWNzb-CtsNgRyk.js";import"./Version-CoKzbupV-BJLwrorf.js";import"./ColorBackground-gVZldRLm-S6_H1D84.js";import"./parser-DyDJ-rlI-8QTzeGdu.js";import"./layerViewUtils-DURAPenP-B_msxcGA.js";let r=class extends w{constructor(i){super(i),this.type="group",this.layerViews=new m}destroy(){this.layerViews.length=0}_allLayerViewVisibility(i){this.layerViews.forEach(e=>{e.visible=i})}initialize(){this.addHandles([this.layerViews.on("change",i=>this._layerViewsChangeHandler(i)),l(()=>this.layer?.visibilityMode,()=>{this.layer&&this._applyVisibility(()=>this._allLayerViewVisibility(this.visible),()=>this._applyExclusiveVisibility(null))},o),l(()=>this.visible,i=>{this._applyVisibility(()=>this._allLayerViewVisibility(i),()=>{})},o)],"grouplayerview"),this._layerViewsChangeHandler({target:null,added:this.layerViews.toArray(),removed:[],moved:[]})}get creatingLayerViews(){return this.view?.layerViewManager?.isCreatingLayerViewsForLayer(this.layer)??!1}set layerViews(i){this._set("layerViews",d(i,this._get("layerViews")))}get updatingProgress(){return this.layerViews.length===0?1:this.layerViews.reduce((i,e)=>i+e.updatingProgress,0)/this.layerViews.length}isUpdating(){return this.creatingLayerViews||this.layerViews.some(i=>i.updating)}_hasLayerViewVisibleOverrides(){return this.layerViews.some(i=>i._isOverridden("visible"))}_findLayerViewForLayer(i){return i&&this.layerViews.find(e=>e.layer===i)}_firstVisibleOnLayerOrder(){const i=this.layer.layers.find(e=>!!this._findLayerViewForLayer(e)?.visible);return i&&this._findLayerViewForLayer(i)}_applyExclusiveVisibility(i){i==null&&(i=this._firstVisibleOnLayerOrder())==null&&this.layerViews.length>0&&(i=this._findLayerViewForLayer(this.layer.layers.at(0))),this.layerViews.forEach(e=>{e.visible=e===i})}_layerViewsChangeHandler(i){this.removeHandles("grouplayerview:visible"),this.addHandles(this.layerViews.map(a=>l(()=>a.visible,y=>this._applyVisibility(()=>{y!==this.visible&&(a.visible=this.visible)},()=>this._applyExclusiveVisibility(y?a:null)),o)).toArray(),"grouplayerview:visible");const e=i.added[i.added.length-1];this._applyVisibility(()=>this._allLayerViewVisibility(this.visible),()=>this._applyExclusiveVisibility(e?.visible?e:null))}_applyVisibility(i,e){this._hasLayerViewVisibleOverrides()&&(this.layer?.visibilityMode==="inherited"?i():this.layer?.visibilityMode==="exclusive"&&e())}};t([s({readOnly:!0})],r.prototype,"creatingLayerViews",null),t([s({cast:n})],r.prototype,"layerViews",null),t([s({readOnly:!0})],r.prototype,"updatingProgress",null),t([s()],r.prototype,"view",void 0),r=t([h("esri.views.layers.GroupLayerView")],r);const v=r;let p=class extends V(v){attach(){this._updateStageChildren(),this.addAttachHandles(this.layerViews.on("after-changes",()=>this._updateStageChildren()))}detach(){this.container.removeAllChildren()}update(i){}viewChange(){}moveEnd(){}_updateStageChildren(){this.container.removeAllChildren(),this.layerViews.forEach((i,e)=>this.container.addChildAt(i.container,e))}};p=t([h("esri.views.2d.layers.GroupLayerView2D")],p);const fi=p;export{fi as default};
diff --git a/fix-191/assets/HUDMaterial.glsl-BLhEaLk5-BM5_Ri93.js b/fix-191/assets/HUDMaterial.glsl-BLhEaLk5-BM5_Ri93.js
deleted file mode 100644
index 258f22d1..00000000
--- a/fix-191/assets/HUDMaterial.glsl-BLhEaLk5-BM5_Ri93.js
+++ /dev/null
@@ -1,347 +0,0 @@
-import{v as m,S as v,i as K,c$ as nr,I as ar,J as wr,ah as ns,aL as as,$ as ve,j as ye,ay as os,gI as ls,hT as cs,cJ as br,e6 as hs,ig as ds,hb as us,dg as A,ih as fs,bl as Xe,a1 as ps,ii as ms,ij as wi,aq as bi,x as xi,aT as gs,aA as _s,o as Ut,K as vs,dk as ys,a2 as ws,U as bs,gU as xs,ik as Is,il as $t,im as Cs,io as Ts,ip as Ss,iq as Os,ir as Rs,is as As,it as xr,iu as Es,iv as Ms,iw as or,ae as Ds,bh as Ii,bj as Ps,hZ as Fs,eI as qt,h$ as Ci,i9 as je,B as Ls,p as Ns,he as Ir,ix as zs,i1 as Bs}from"./story-DULt3Rma.js";import{Z as Gs}from"./QueryEngine-CH5uUhZK-BPFE3Fml.js";import{b as Cr}from"./Query-BrwMGK8U-DaHaJHm8.js";import{h as Vs}from"./ReactiveMap-CFk6jPfN-D0CsM6VZ.js";import{N as js,R as Ti}from"./PooledRBush-DbfAmeLn-CnmkMtQT.js";import{n as Hs}from"./timeSupport-jPViR5jn-Blw8tou2.js";import{c as kt}from"./OptimizedFeature-EIithYlr-Cq64mIT3.js";import{p as Us}from"./query-DFW9-NG_-DqquB_ii.js";import{o as $s}from"./pbf-D-y3_eZO-D-TFO35M.js";import{g as qs}from"./quantizationUtils-bJy1cRwp-DKHwdnl5.js";import{o as ks}from"./FieldsIndex-HmzMbJQG-nfgmohOl.js";import{k as Ws,m as Ys}from"./pbfQueryUtils-F4ZE8-K8-DpF92BrR.js";import{l as ne}from"./ViewingMode-CyR_b1T8-_s7_Gbsk.js";import{A as Qs,w as Js}from"./Indices-DEr2HrWx-B2uxSYxv.js";import{e as ae,o as le,T as Xs,c as Zs,i as Tr,m as Ks}from"./vec4f64-hf2nxvhQ-CaAr8PTM.js";import{d as Si,D as en,m as ft,P as tn}from"./vec2-tHZ6OaOy-xCj1obDt.js";import{e as X,o as lr}from"./vec2f64-CeODonrJ-CkkJCdRC.js";import{h as rn,b as F,Q as sn,i as nn,V as an,_ as on,F as ln,J as W,N as Wt,v as cn,x as hn,a as dn,z as Oi,e as un,j as fn,A as pn,t as Me,L as Sr,r as ge,c as Ri,m as mn,G as Ai,d as Yt,u as gn,k as Ue,f as _n,Z as vn,n as yn,g as Ei,X as wn,l as bn,o as Qt,s as pt,p as xn,P as In,q as Cn,U as Tn,w as Sn,y as On,S as Rn,B as An,C as En,$ as Mn,W as Or,D as Dn,T as Pn,E as Fn,H as Ln,I as Nn,K as zn,M as Bn,O as Gn,R as Vn,Y as jn,a0 as Rr,a1 as Ar,a2 as Hn,a3 as Un,a4 as $n,a5 as qn,a6 as kn,a7 as Wn,a8 as Yn,a9 as Qn,aa as Er}from"./AttributeArray-BWXEft_i-VmYBAXJe.js";import{p as xt}from"./glUtil-n1JOrdV3-CRAZdee5.js";import{o as E,s as Ct}from"./NormalAttribute.glsl-axtNsUxo-DMkZydQa.js";import{e as Mr,t as Jn}from"./basicInterfaces-Dsf65ICa-DkQ9Rsnx.js";import{s as Xn}from"./NestedMap-Ddo7BfvO-BpVPk8mz.js";import{k as ce,z as Pe,G as cr,B as Jt,a as Zn,M as Kn,n as ea,Z as ta,N as ra,E as ia}from"./mat4-DX7gBViE-DBcL5Ayd.js";import{t as L,u as sa}from"./mat4f64-Dn1WEGBx-C99QVUMW.js";import{h as N}from"./Util-BjGjeg6f-08Szkf4F.js";import{T as p}from"./VertexAttribute-DqD5S0a2-3q90nikV.js";import{r as Y,S as $e,l as he,_ as ie,g as Mi,A as j,R as Ze,k as Dr,y as qe,G as Pr,C as na,L as Z,b as me,W as aa,Y as _e,j as ht,Z as oa}from"./vec32-D9GsKZ1t-BK5Q1Wvx.js";import{R as hr}from"./InterleavedLayout-DXzw3B2n-CUDgRwJy.js";import{o as Fr,O as Lr,E as Tt,p as Ke,b as Nr,D as He}from"./vec42-D8CJyqHG-DnfLTeQH.js";import{N as la,S as ca,B as ha,y as Xt}from"./Octree-CJNwbhg4-BAC1JF3w.js";import{d as Di,D as da,b as ua,F as fa,H as pa,V as ma,_ as zr}from"./sphere-BenPORjV-YNNBQG3r.js";import{l as ga,I as _a,u as va,f as de,r as ya,M as wa}from"./plane-Dt8R0KeE-Dw-lq7TK.js";import{I as Fe,A as Br}from"./IntersectorInterfaces-CrXe7z5S-tY6PKd-m.js";import{P as dr,k as ba,V as xa}from"./mat3-CC4Foazl-BWjyqE2v.js";import{n as ur}from"./mat3f64-Dh9_zhFu-BIT-k8Dm.js";import{b as Gr,m as Ia,o as mt,p as Ca,A as Ta,X as Pi,L as ke,O as Vr,l as jr}from"./BufferView-PQoE3GL7-Dpb_8XL3.js";import{r as Fi}from"./BufferObject-BM_7mcDb-Bve6V6Hz.js";import{G as Hr,n as Li,T as Ur,L as Sa}from"./enums-DBi1-Mm2-CUS1pvQe.js";import{q as Oa,R as Ra}from"./boundedPlane-DlvE0eNx-BmnqmZGw.js";import{c as Aa}from"./VertexArrayObject-M4iRGGoi-CgmBRrBK.js";import{f as Ea}from"./doublePrecisionUtils-BJbYwoii-kIP-tL_t.js";import{i as Ma,p as Da}from"./Scheduler-B7UX7Wr5-Bw_5FpBi.js";import{r as Pa,i as Fa}from"./Texture-BCt2hphT-Tabr9F2Q.js";import{l as La}from"./floatRGBA-4pIJN00G-B4XKFXqE.js";import{o as oe}from"./AlphaCutoff-ZPx1GqOi-UcccL64p.js";import{N as Na,K as za,B as Ba,m as Ga}from"./renderState-Dap0WV9P-D4IHxyei.js";import{n as Va}from"./projectBuffer-CvCBvJ6W-Cc8J4MEJ.js";import{p as gt}from"./projectVectorToVector-sIYLNlex-CkwN7cTX.js";import{G as ja}from"./computeTranslationToOriginAndRotation-wF0y9WQG-91FHQ6No.js";import"./MeshLocalVertexSpace-BqgocsoS-BhammC6S.js";import{t as re,o as Ye}from"./vec3f32-BS0cezmI-B_madU1n.js";import{M as se}from"./orientedBoundingBox-oHezdpWm-BNWfTJhF.js";import"./triangle-hqU-Tc1X-BW1Qc_Ji.js";import{x as Ha}from"./spatialReferenceEllipsoidUtils-DUrKTvup-D45QZ5Pr.js";import{p as Ua}from"./projectPointToVector-B2UUY9SE-CysrF4Oe.js";import{e as w,c as z}from"./interfaces-DN2-jsJC-DzMTiT5R.js";import{a as $a}from"./BindType-9iOk18Ed-CRW1cdX4.js";import"./main-Bm7g2Jde.js";import"./projection-BA9M1R7d-DvHr0GeG.js";import"./normalizeUtils-Bxmy9MNI-CZMTs6Vg.js";import"./normalizeUtilsCommon-CRJlkfEA-CgRBIB_J.js";import"./utils-9sQxfkoa-CjNZjdKD.js";import"./utils-Bq23Xwmj-DhZYu3yh.js";import"./featureConversionUtils-D6hFQ4Af-Cb3HkUwF.js";import"./OptimizedFeatureSet-DfZGBuxJ-C08BOAgi.js";import"./LRUCache-C3erQTWv-CBR8rG5i.js";import"./WhereClause-DxwoyBMS-rEYyQL9l.js";import"./TimeOnly-DSMefxKy-BAXliSDH.js";import"./UnknownTimeZone-C--TOcPG-C3cinqRV.js";import"./fieldType-CD2CL2hr-BeIaxmP1.js";import"./queryUtils-Brxu6254-UOAsUqfL.js";import"./json-BI97KiBB-Ce5cWfI2.js";import"./QueryEngineCapabilities-Gr588n9t-DjYb9CEb.js";import"./utils-HtkT8Fn3-CgLa5wkn.js";import"./TimeExtent-Cn0Jofqr-DWlRQ-Qn.js";import"./heatmapUtils-seiMkkkR-DETYxyq4.js";import"./utils-DyydRFHu-BgVNtJ0_.js";import"./Basemap-BEqqSTw9-B8z1wR1c.js";import"./loadAll-e978YItg-Sr8yCS6_.js";import"./PortalItem-CctGdnxF-Dbw3pVTD.js";import"./writeUtils-D5qlLkwk-B7Zow5Ob.js";import"./mat4f32-CiZjBg9k-CUm34GoR.js";import"./utils-tNxq3jkf-BmjMQb3R.js";import"./ClassBreaksDefinition-bYRgYgPp-fywCcmFq.js";import"./Field-C6hA1tZj-DdgmWWCq.js";import"./quickselect-DHTstthl-Ds_Aj0x5.js";import"./queryZScale-BiYV6Pr6-CHuA90gs.js";import"./common-CYWrYyJl-E8-sukrT.js";import"./requestImageUtils-Ut4YcoNU-DzSedW22.js";import"./compilerUtils-CV1QYWI8-5SsZKq4e.js";import"./lengthUtils-DKpMe5qR-BEdWsC7X.js";import"./VertexElementDescriptor-BAy1DPb3-BOhpDZGx.js";import"./types-ChhhI6OU-Cxh6dPlX.js";import"./quatf64-C16JxGFv-BKWK1F8U.js";import"./lineSegment-CcqvCARM-CJXyfFir.js";import"./signal-CETehA7D-Cb8aw_q5.js";import"./quat-BODLR7mS-Bp23D9qW.js";function qa(e){e.code.add(w`const float MAX_RGBA_FLOAT =
-255.0 / 256.0 +
-255.0 / 256.0 / 256.0 +
-255.0 / 256.0 / 256.0 / 256.0 +
-255.0 / 256.0 / 256.0 / 256.0 / 256.0;
-const vec4 FIXED_POINT_FACTORS = vec4(1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0);
-vec4 float2rgba(const float value) {
-float valueInValidDomain = clamp(value, 0.0, MAX_RGBA_FLOAT);
-vec4 fixedPointU8 = floor(fract(valueInValidDomain * FIXED_POINT_FACTORS) * 256.0);
-const float toU8AsFloat = 1.0 / 255.0;
-return fixedPointU8 * toU8AsFloat;
-}`),e.code.add(w`const vec4 RGBA_2_FLOAT_FACTORS = vec4(
-255.0 / (256.0),
-255.0 / (256.0 * 256.0),
-255.0 / (256.0 * 256.0 * 256.0),
-255.0 / (256.0 * 256.0 * 256.0 * 256.0)
-);
-float rgba2float(vec4 rgba) {
-return dot(rgba, RGBA_2_FLOAT_FACTORS);
-}`),e.code.add(w`const vec4 uninterpolatedRGBAToFloatFactors = vec4(
-1.0 / 256.0,
-1.0 / 256.0 / 256.0,
-1.0 / 256.0 / 256.0 / 256.0,
-1.0 / 256.0 / 256.0 / 256.0 / 256.0
-);
-float uninterpolatedRGBAToFloat(vec4 rgba) {
-return (dot(round(rgba * 255.0), uninterpolatedRGBAToFloatFactors) - 0.5) * 2.0;
-}`)}let ka=class extends wn{constructor(e,t){super(e,"vec4",$a.Draw,(r,i,s)=>r.setUniform4fv(e,t(i,s)))}},fe=class extends ye{constructor(e){super(e),this._removing=0,this._tiles=new Vs}destroy(){for(const e of this._tiles.values())e.remove();this._tiles.clear()}get updating(){if(this._removing>0)return!0;for(const e of this._tiles.values())if(!e.finished)return!0;return!1}async onTileTreeChange(e){const{added:t,removed:r}=e,i=this._tiles,s=[];for(const n of r){const a=i.get(n);a!=null&&(a.abort(),i.delete(n),s.push({tileId:n}))}for(const n of t)i.has(n.id)||i.set(n.id,os(a=>this._addTile(n,a)));await this._removeTiles(s)}async _addTile(e,t){const r=await this.addTile(e,t);return ve(t),r}async _removeTiles(e){this._removing++,await this.removeTiles(e),this._removing--}};m([v()],fe.prototype,"updating",null),m([v({constructOnly:!0})],fe.prototype,"addTile",void 0),m([v({constructOnly:!0})],fe.prototype,"removeTiles",void 0),m([v()],fe.prototype,"_removing",void 0),fe=m([K("esri.views.3d.layers.graphics.pipeline.Tile3DManager")],fe);let Zt=class{constructor(e,t){this._index=e,this._view=t}getObjectId(){return this._view.getObjectId(this._index)}getAttribute(e){return this._view.getAttribute(this._index,e)}getAttributeAsTimestamp(e){return this._view.getAttributeAsTimestamp(this._index,e)}getAttributes(){return this._view.getAttributes(this._index)}getOptimizedGeometry(){return this._view.getOptimizedGeometry(this._index)}getCentroid(e){return this._view.getCentroid(this._index,e)}getBounds(){return this._view.getBounds(this._index)}getBoundingBox(){return this._view.getBoundingBox(this._index)}cloneWithGeometry(e){return new Wa(this._index,this._view,e)}},Wa=class extends Zt{constructor(e,t,r){super(e,t),this._geometryOverride=r}getOptimizedGeometry(){return this._geometryOverride}getCentroid(e){return Hs(new kt,this._geometryOverride,e.hasZ,e.hasM)}},Ya=class{constructor(){this._storedTiles=new Map,this._pageBounds=new Map,this.events=new ar,this.featureAdapter=Kt.shared}addTile(e){this._storedTiles.set(e.descriptor.id,e);for(const t of e.pages)this._addPage(t)}removeTile(e){const t=this._storedTiles,r=t.get(e);if(r!=null){t.delete(e);for(const i of r.pages)this._removePage(i)}}_addPage(e){const{featureCount:t}=e;if(t===0)return;const r=new js(9,s=>e.getBounds(s)),i=new Array;for(let s=0;se(new Zt(i,t)))}forEachInBounds(e,t){ze.minX=e[0],ze.minY=e[1],ze.maxX=e[2],ze.maxY=e[3];for(const[r,i]of this._pageBounds)i.search(ze,s=>t(new Zt(s,r)))}forEachBounds(e,t){for(const r of e)t(r.getBoundingBox())}getFullExtent(e){let t=1/0,r=1/0,i=-1/0,s=-1/0;for(const n of this._pageBounds.values()){const{minX:a,minY:o,maxX:l,maxY:c}=n.toJSON();t=Math.min(t,a),r=Math.min(r,o),i=Math.min(i,l),s=Math.min(s,c)}return{xmin:t,ymin:r,xmax:i,ymax:s,spatialReference:e}}},Kt=class{getObjectId(e){return e.getObjectId()}getAttribute(e,t){return e.getAttribute(t)}getAttributeAsTimestamp(e,t){return e.getAttributeAsTimestamp(t)}getAttributes(e){return e.getAttributes()}getGeometry(e){return e.getOptimizedGeometry()}getCentroid(e,t){return e.getCentroid(t)}cloneWithGeometry(e,t){return e.cloneWithGeometry(t)}};Kt.shared=new Kt;const ze=new Ti;let Qa=class{constructor(e,t){this.descriptor=e,this.pages=t}},Ja=class{constructor(e){const t=new $s(new Uint8Array(e),new DataView(e));this._reader=t,this._index=Xa(t)}get featureCount(){return this._index.featureIndices.length}get exceededTransferLimit(){return this._index.exceededTransferLimit}getObjectId(e){return this.getAttribute(e,this._index.objectIdFieldName)}getAttribute(e,t){const{_index:{fieldsIndex:r,attributeIndices:i}}=this,s=r.get(t)?.index;if(s==null)return;const n=i[e*r.fields.length+s],a=this._reader;return a.move(n),St(a)}getAttributeAsTimestamp(e,t){const r=this.getAttribute(e,t);return typeof r=="string"?new Date(r).getTime():typeof r=="number"||r==null?r:null}getAttributes(e){const{_index:{fieldsIndex:t,attributeIndices:r}}=this,i=e*t.fields.length,s=this._reader,n={};for(const a of t.fields){const o=r[i+a.index];s.move(o),n[a.name]=St(s)}return n}getCoordinates(e,t,r=0){const i=this._reader,{transform:s,featureIndices:n}=this._index,{scale:a,translate:o}=s;i.move(n[e]),this._readCoordinates(a,o,t,r)}getOptimizedGeometry(e){const t=A();return this.getCoordinates(e,t),new kt([],t)}getCentroid(e,{hasZ:t,hasM:r}){this.getCoordinates(e,we);const[i,s,n]=we,a=[i,s];return t&&(a[3]=n),r&&(a[t?4:3]=0),new kt([],a)}getBounds(e){this.getCoordinates(e,we);const[t,r]=we,i=new Ti;return i.minX=t,i.minY=r,i.maxX=t,i.maxY=r,i}getBoundingBox(e){this.getCoordinates(e,we);const[t,r,i]=we;return Ss(t,r,i,t,r,i)}readAllObjectIds(e,t=0){const r=this._reader,{_index:i,featureCount:s}=this,{objectIdFieldName:n,attributeIndices:a,fieldsIndex:o}=i,l=o.get(n).index,c=o.fields.length;for(let d=0;dt?.release()):e?.release()}let fr=class{constructor(e,t){this._material=e,this._repository=t,this._map=new Map}dispose(){this._map.forEach((e,t)=>{e!=null&&this._repository.release(this._material,t)})}load(e,t,r){if(!this._material.produces.get(t)?.(r))return null;this._map.has(r)||this._map.set(r,this._repository.acquire(this._material,t,r));const i=this._map.get(r);if(i!=null){if(i.ensureResources(e)===Jn.LOADED)return i;this._repository.requestRender()}return null}},Bi=class extends bn{constructor(e=A()){super(),this.origin=e}get slicePlaneLocalOrigin(){return this.origin}};var kr,pe;(function(e){e[e.ADD=0]="ADD",e[e.UPDATE=1]="UPDATE",e[e.REMOVE=2]="REMOVE"})(kr||(kr={})),function(e){e[e.NONE=0]="NONE",e[e.VISIBILITY=1]="VISIBILITY",e[e.GEOMETRY=2]="GEOMETRY",e[e.TRANSFORMATION=4]="TRANSFORMATION",e[e.HIGHLIGHT=8]="HIGHLIGHT",e[e.OCCLUDEE=16]="OCCLUDEE"}(pe||(pe={}));let pr=class{constructor(e=0,t=0){this.from=e,this.to=t}get numElements(){return this.to-this.from}};function Wr(e){const t=new Map;e.forAll(i=>t.set(i.from,i));let r=!0;for(;r;){r=!1;for(let i=0;ie||new pr,deallocator:null}),this.hasHiddenInstances=!1,this.hasOccludees=!1,this.drawCommandsDirty=!0,this.highlightGroups=new Set,this.drawCommandsDefault=et(),this.drawCommandsHighlights=new Map,this.drawCommandsOccludees=et(),this.drawCommandsShadowHighlightRest=et()}get numElements(){return this._numElements}get instances(){return this._instances}get hasHighlights(){return this.highlightGroups.size>0}resetInstanceSummary(){this.hasHiddenInstances=!1,this.hasOccludees=!1,this.highlightGroups.clear()}updateIfDrawCommandsDirty(e){if(this.drawCommandsDirty){this.resetInstanceSummary();for(const t of this.instances.values())this.updateDrawState(t);this.updateDrawCommands(e)}}addInstance(e,t){this.deleteInstance(e),this._instances.set(e,t),this._numElements+=t.numElements}deleteInstance(e){const t=this._instances.get(e);t&&(this._numElements-=t.numElements,this._instances.delete(e))}updateInstance(e,t,r){const i=this._instances.get(e);i&&(this._numElements-=i.numElements,i.from=t,i.to=r,this._numElements+=i.numElements)}updateDrawState(e){e.isVisible?(e.foreachHighlightGroup(t=>this.highlightGroups.add(t)),e.hasOccludees&&(this.hasOccludees=!0)):this.hasHiddenInstances=!0}updateDrawCommands(e){if(this.drawCommandsDefault.clear(),this.drawCommandsHighlights.clear(),this.drawCommandsOccludees.clear(),this.drawCommandsShadowHighlightRest.clear(),this.drawCommandsDirty=!1,this._instances.size===0)return;if(!this.needsMultipleCommands()){const i=this.drawCommandsDefault.pushNew(),s=this.holes.front();return this.vao!=null&&this.holes.length===1&&s.to===Math.floor(this.vao.byteSize/e)?(i.first=0,void(i.count=s.from)):(i.first=1/0,i.count=0,this._instances.forEach(n=>{i.first=Math.min(i.first,n.from),i.count=Math.max(i.count,n.to)}),void(i.count-=i.first))}const t=Array.from(this._instances.values()).sort((i,s)=>i.from===s.from?i.to-s.to:i.from-s.from),{drawCommandsHighlights:r}=this;for(const i of t)i.isVisible&&(Ot(i.hasOccludees?this.drawCommandsOccludees:this.drawCommandsDefault,i),i.hasHighlights?i.foreachHighlightGroup(s=>{let n=r.get(s);n||(n=et(),r.set(s,n)),Ot(n,i)}):Ot(this.drawCommandsShadowHighlightRest,i))}needsMultipleCommands(){return this.hasOccludees||this.hasHighlights||this.hasHiddenInstances}};function co(e){return e.vao!=null}function et(){return new nr({allocator:e=>e||new oo,deallocator:e=>e})}function Ot(e,t){const r=e.back();if(r==null){const i=e.pushNew();return i.first=t.from,void(i.count=t.numElements)}if(ho(r,t)){const i=t.from-r.first+t.numElements;r.count=i}else{const i=e.pushNew();i.first=t.from,i.count=t.numElements}}function ho(e,t){return e.first+e.count>=t.from}let uo=class{constructor(e){this.origin=e,this.buffers=new Array}dispose(){this.buffers.forEach(e=>e.vao.dispose()),this.buffers.length=0}findBuffer(e){return this.buffers.find(t=>t.instances.has(e))}},Rt=class extends zi{get _hasAnyHighlight(){return this._highlightGroups.size>0}constructor(e){super(e),this._dataByOrigin=new Map,this._drawParameters=new Bi,this._highlightGroups=new Set,this.drapedPriority=0,this._produces=new Map,this._hasOccludees=!1}destroy(){this._glMaterials=cs(this._glMaterials),this._dataByOrigin.forEach(e=>e.dispose()),this._dataByOrigin.clear(),this._vaoCache=null}initialize(){this.material.produces.forEach((e,t)=>{this._produces.set(t,r=>!(this._dataByOrigin.size===0||!(r!==E.Highlight&&r!==E.ShadowHighlight||this._hasAnyHighlight))&&e(r))})}initializeRenderContext(e,t){this._glMaterials=new fr(this.material,t??e.materials),this._bufferWriter=this.material.createBufferWriter(),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,xt(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}get produces(){return this._produces}get hasOccludees(){return this._hasOccludees}get hasEmissions(){return this.material.hasEmissions}get isDecoration(){return this.material.parameters.isDecoration}queryRenderOccludedState(e){return this.material.queryRenderOccludedState(e)}get numGeometries(){let e=0;return this._dataByOrigin.forEach(t=>e+=t.buffers.reduce((r,i)=>r+i.instances.size,0)),e}get usedMemory(){let e=0;return this._dataByOrigin.forEach(t=>e+=t.buffers.reduce((r,i)=>r+i.vao.usedMemory,0)),e}forEachGeometry(e){this._dataByOrigin.forEach(t=>t.buffers.forEach(r=>r.instances.forEach(({geometry:i})=>e(i))))}modify(e){this._updateGeometries(e.updates),this._addAndRemoveGeometries(e.adds,e.removes),this._updateDrawCommands()}_updateGeometries(e){const t=this._bufferWriter;if(t==null)return;const r=t.vertexBufferLayout.stride/4;for(const i of e){const s=i.renderGeometry,n=this._dataByOrigin.get(s.localOrigin.id),a=n?.findBuffer(s.id);if(a==null)return;const o=a.instances.get(s.id);if(i.updateType&(pe.GEOMETRY|pe.TRANSFORMATION)){const l=it(t.elementCount(o.geometry.geometry.attributes)*r),c=t.vertexBufferLayout.createView(l.buffer);this._writeGeometry(s,c,0),a.vao.vertexBuffers.get("geometry").setSubData(l,o.from*r,0,o.numElements*r)}i.updateType&(pe.HIGHLIGHT|pe.OCCLUDEE|pe.VISIBILITY)&&(a.drawCommandsDirty=!0)}}_computeDeltas(e,t){const r=new Xn;for(const i of e){const s=i.localOrigin;if(s==null)continue;let n=r.get(s.id,null);n==null&&(n=new Qr(s.vec3),r.set(s.id,null,n)),n.changes.push(i)}for(const i of t){const s=i.localOrigin;if(s==null)continue;const n=this._dataByOrigin.get(s.id),a=n?.findBuffer(i.id);if(a==null)continue;let o=r.get(s.id,a);o==null&&(o=new Qr(s.vec3),r.set(s.id,a,o)),o.changes.push(i)}return r}_addAndRemoveGeometries(e,t){if(this._bufferWriter==null||this._vaoCache==null)return;const{_bufferWriter:r,_dataByOrigin:i}=this,s=r.vertexBufferLayout.stride/4,n=this._computeDeltas(e,t);n.forEach((a,o)=>{const l=a.get(null),c=l?.changes??[];n.delete(o,null);let d=i.get(o);if(a.forEach((h,u)=>{if(n.delete(o,u),u==null)return void N(!1,"No VAO for removed geometries");if(u.instances.size===h.changes.length)return this._vaoCache.deleteVao(u.vao),br(d.buffers,u),void(d.buffers.length===0&&c.length===0&&i.delete(o));const f=u.numElements,_=u.vao.byteSize/4,g=c.reduce((O,M)=>O+r.elementCount(M.geometry.attributes),0),C=h.changes.reduce((O,M)=>O+r.elementCount(M.geometry.attributes),0),I=Math.min((f+g-C)*s,rt),x=I>_;I>vt&&I<_/2?(h.changes.forEach(({id:O})=>u.deleteInstance(O)),u.instances.forEach(({geometry:O})=>c.push(O)),this._vaoCache.deleteVao(u.vao),br(d.buffers,u)):x?this._applyAndRebuild(u,c,h):this._applyRemoves(u,h)}),c.length>0)for(d==null&&(d=new uo(l.origin),i.set(o,d)),d.buffers.forEach(h=>this._applyAdds(h,c));c.length>0;)d.buffers.push(this._applyAndRebuild(new lo,c,null))})}_updateDrawCommands(){this._highlightGroups.clear(),this._hasOccludees=!1,this._dataByOrigin.forEach(e=>{e.buffers.forEach(t=>{t.updateIfDrawCommandsDirty(this._bufferWriter.vertexBufferLayout.stride),t.hasHighlights&&hs(this._highlightGroups,t.highlightGroups),this._hasOccludees=this._hasOccludees||t.hasOccludees})})}_applyAndRebuild(e,t,r){if(r)for(const f of r.changes)e.deleteInstance(f.id);const i=this._bufferWriter,s=i.vertexBufferLayout.stride,n=s/4,a=Math.floor(rt/n);let o=e.numElements;for(;t.length>0;){const f=t.pop(),_=i.elementCount(f.geometry.attributes);if(o+_>a&&o>0){t.push(f);break}o+=_;const g=new Yr(f,0,0);N(e.instances.get(f.id)==null),e.addInstance(f.id,g)}const l=o*n,c=it(l),d=i.vertexBufferLayout.createView(c.buffer);let h=0;e.resetInstanceSummary(),e.instances.forEach((f,_)=>{this._writeGeometry(f.geometry,d,h);const g=h;h+=i.elementCount(f.geometry.geometry.attributes),e.updateInstance(_,g,h),e.updateDrawState(f)}),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(er(l)),e.vao.vertexBuffers.get("geometry").setSubData(c,0,0,h*n),e.holes.clear();const u=e.holes.pushNew();return u.from=h,u.to=Math.floor(e.vao.byteSize/s),e.updateDrawCommands(s),e}_applyRemoves(e,t){if(t.changes.length===0||this._bufferWriter==null)return;for(const a of t.changes){const o=a.id,l=e.instances.get(o);if(!l)continue;e.deleteInstance(o);const c=ee.back();if(c){if(c.to===l.from){c.to=l.to;continue}if(c.from===l.to){c.from=l.from;continue}}const d=ee.pushNew();d.from=l.from,d.to=l.to}Wr(ee);const r=this._bufferWriter.vertexBufferLayout.stride/4,i=ee.reduce((a,o)=>Math.max(a,o.numElements),0)*r,s=it(i);s.fill(0,0,i);const n=e.vao.vertexBuffers.get("geometry");ee.forAll(a=>n.setSubData(s,a.from*r,0,a.numElements*r)),e.holes.pushArray(ee.data,ee.length),ee.forAll((a,o)=>ee.data[o]=null),ee.clear(),e.drawCommandsDirty=!0}_applyAdds(e,t){if(t.length===0||this._bufferWriter==null)return;if(!co(e))return void this._applyAndRebuild(e,t,null);const r=this._bufferWriter,i=r.vertexBufferLayout.stride/4,s=e.numElements,n=t.reduce((C,I)=>C+r.elementCount(I.geometry.attributes),0),a=Math.min((s+n)*i,rt),o=4*a;if(e.vao.byteSizee.vao.byteSize)return void this._applyAndRebuild(e,t,null);Wr(e.holes);const l=new Array;for(const C of t){const I=r.elementCount(C.geometry.attributes),x=fo(e.holes,I);l.push(x)}const c=e.vao.vertexBuffers.get("geometry");let d=0,h=0,u=0;const f=it(a),_=r.vertexBufferLayout.createView(f.buffer);t.forEach((C,I)=>{const x=l[I];if(x==null)return;if(u!==x){const y=u-h;y>0&&c.setSubData(f,h*i,0,y*i),h=x,d=0}const O=r.elementCount(C.geometry.attributes);this._writeGeometry(C,_,d),d+=O,u=x+O;const M=new Yr(C,x,x+O);N(e.instances.get(C.id)==null),e.addInstance(C.id,M),e.drawCommandsDirty=!0});const g=u-h;g>0&&c.setSubData(f,h*i,0,g*i),ds(t,(C,I)=>l[I]==null)}_writeGeometry(e,t,r){this._bufferWriter!=null&&(ce(be,e.transformation),be[12]-=e.localOrigin.vec3[0],be[13]-=e.localOrigin.vec3[1],be[14]-=e.localOrigin.vec3[2],Pe(tt,be),cr(tt,tt),this._bufferWriter.write(be,tt,e.geometry.attributes,e.geometry.objectAndLayerIdColor,t,r))}updateAnimation(e){return this.material.update(e)}acquireTechniques(e){if(!this.material.shouldRender(e))return null;const{output:t,bind:r}=e;if(!this.material.produces.get(r.slot)?.(t))return null;const{highlightGroupName:i,slot:s}=r,n=t===E.ShadowHighlight,a=t===E.Highlight,o=a||n,l=h=>o&&(this._highlightGroups.size===0||a&&!!i&&!h.has(i));if(l(this._highlightGroups))return null;const c=t===E.ShadowExcludeHighlight,d=!(o||c);for(const{buffers:h}of this._dataByOrigin.values())for(const u of h){if(l(u.highlightGroups))continue;const f=n?u.drawCommandsHighlights.size>0:o?i?u.drawCommandsHighlights.get(i):u.drawCommandsHighlights.size>0:((c&&u.needsMultipleCommands()?u.drawCommandsShadowHighlightRest:u.drawCommandsDefault)||null)?.length??!1,_=d&&u.drawCommandsOccludees||null;if(f||_?.length){const g=this._glMaterials.load(e.rctx,s,t),C=g?.beginSlot(r);if(C)return C}}return null}render(e,t){const{output:r,bind:i}=e,{slot:s,highlightGroupName:n}=i,a=r===E.Highlight;if(a&&!n)return;const o=r===E.ShadowHighlight,l=a||o,c=r===E.ShadowExcludeHighlight,d=!(l||c),h=s===W.OCCLUDER_MATERIAL||s===W.TRANSPARENT_OCCLUDER_MATERIAL?s:null,{rctx:u}=e;u.runAppleAmdDriverHelper();const f=u.bindTechnique(t,i,this.material.parameters);for(const _ of this._dataByOrigin.values())for(const g of _.buffers){if(a&&(!g.hasHighlights||!g.drawCommandsHighlights.has(n))||o&&!g.hasHighlights)continue;const C=()=>{const y=[];for(const P of g.drawCommandsHighlights.values())y.push(P);return y},I=l&&!o?g.drawCommandsHighlights.get(n)??null:null,x=o?C():l?I?[I]:Xr:(c&&g.needsMultipleCommands()?[g.drawCommandsShadowHighlightRest]:[g.drawCommandsDefault])||Xr,O=x.some(y=>y.length>0),M=d&&g.drawCommandsOccludees||null;if(O||M?.length){if(this._drawParameters.origin=_.origin,f.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(g.vao),u.bindVAO(g.vao),O)for(const y of x)u.setPipelineState(t.getPipeline(!1,h)),y.forAll(P=>u.drawArrays(t.primitiveType,P.first,P.count));M?.length&&(u.setPipelineState(t.getPipeline(!0,h)),M.forAll(y=>u.drawArrays(t.primitiveType,y.first,y.count)))}}}get test(){}};m([v({constructOnly:!0})],Rt.prototype,"material",void 0),Rt=m([K("esri.views.3d.webgl-engine.materials.renderers.MergedRenderer")],Rt);let Qr=class{constructor(e){this.origin=e,this.changes=new Array}};function fo(e,t){const r=e.find(s=>s.numElements>=t);if(r==null)return null;const i=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),i}const be=L(),tt=L(),ee=new nr({allocator:e=>e||new pr,deallocator:null}),vt=65536,At=4*vt,Jr=1024,Gi=16777216,rt=Gi/4;let Et=new Float32Array(vt);function it(e){return Et.length{this._produces.set(t,r=>!!(r!==E.Highlight&&r!==E.ShadowHighlight||this._hasHighlights)&&e(r))})}destroy(){this._glMaterials.dispose();const e=this._renderGeometries.keys();for(const t of e)this.removeRenderGeometry(t)}acquireTechniques(e){const t=this.material;if(!t.shouldRender(e))return null;const{output:r,bind:i}=e;return!t.produces.get(i.slot)?.(r)||(r===E.Highlight||r===E.ShadowHighlight)&&!this._hasHighlights?null:this._glMaterials.load(e.rctx,i.slot,r)?.beginSlot(i)}render(e,t){const r=this._renderGeometries;if(r.size===0)return;const{bind:i}=e,s=i.slot===W.OCCLUDER_MATERIAL||i.slot===W.TRANSPARENT_OCCLUDER_MATERIAL?i.slot:null,n=e.rctx;n.runAppleAmdDriverHelper(),n.bindTechnique(t,i,this.material.parameters);const a=t.program;for(const[o,l]of r)this._drawParameters.origin=l.localOrigin,a.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(l.vao),n.bindVAO(l.vao),n.setPipelineState(t.getPipeline(!1,s)),n.drawArrays(t.primitiveType,0,l.numElements)}initializeRenderContext(e,t){this._glMaterials=new fr(this.material,e.materials);const r=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,xt(this._bufferWriter.vertexBufferLayout));this._vaoCache=r}uninitializeRenderContext(){}addRenderGeometry(e,t,r){this.removeRenderGeometry(e);const i=this._bufferWriter.vertexBufferLayout.stride,s=this._vaoCache.newVao(er(t.data.byteLength));s.vertexBuffers.get("geometry").setSubData(new Uint8Array(t.data),0,0,t.elementCount*i);const n={localOrigin:r,vao:s,numElements:t.elementCount};return this._renderGeometries.set(e,n),n}removeRenderGeometry(e){const t=this._renderGeometries.get(e);t!=null&&(this._vaoCache.deleteVao(t.vao),this._renderGeometries.delete(e))}};m([v({constructOnly:!0})],dt.prototype,"material",void 0),dt=m([K("esri.views.3d.layers.graphics.pipeline.rendering.DirectRenderer")],dt);function po(e,t,r){return 2*Math.atan(Math.sqrt(t*t+r*r)*Math.tan(.5*e)/t)}function mo(e,t,r){return 2*Math.atan(Math.sqrt(t*t+r*r)*Math.tan(.5*e)/r)}function go(e,t,r){return 2*Math.atan(t*Math.tan(.5*e)/Math.sqrt(t*t+r*r))}function _o(e,t,r){return 2*Math.atan(r*Math.tan(.5*e)/Math.sqrt(t*t+r*r))}var Zr,S;(function(e){e[e.Default=0]="Default",e[e.Screenshot=1]="Screenshot",e[e.ObjectAndLayerID=2]="ObjectAndLayerID"})(Zr||(Zr={})),function(e){e[e.TOP=0]="TOP",e[e.RIGHT=1]="RIGHT",e[e.BOTTOM=2]="BOTTOM",e[e.LEFT=3]="LEFT"}(S||(S={}));var tr;let b=tr=class extends ye{constructor(e){super(e),this._ray=Di(),this._viewport=ae(0,0,1,1),this._padding=ae(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=X(1,1e3),this._viewDirty=!0,this._viewMatrix=L(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=L(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=L(),this._frustumDirty=!0,this._frustum=la(),this._fullViewport=le(),this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=A(),this._up=A(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(e){this._pixelRatio=e>0?e:1}get rows(){return this._rows}set rows(e){this._rows=Math.max(1,e)}get columns(){return this._columns}set columns(e){this._columns=Math.max(1,e)}get eye(){return this._ray.origin}set eye(e){this._compareAndSetView(e,this._ray.origin)}get center(){return this._center}set center(e){this._compareAndSetView(e,this._center,"_center")}get ray(){return Y(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(e){this._compareAndSetView(e,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(e){ce(this._viewMatrix,e),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get viewForward(){return this._ensureViewClean(),ie(A(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),ie(A(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),ie(A(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(e){this._nearFar[0]!==e&&(this._nearFar[0]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(e){this._nearFar[1]!==e&&(this._nearFar[1]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(e){this.x=e[0],this.y=e[1],this.width=e[2],this.height=e[3]}get screenViewport(){if(this.pixelRatio===1)return this._viewport;const e=Fr(le(),this._viewport,1/this.pixelRatio),t=this._get("screenViewport");return t&&Lr(e,t)?t:e}get screenPadding(){if(this.pixelRatio===1)return this._padding;const e=Fr(le(),this._padding,1/this.pixelRatio),t=this._get("screenPadding");return t&&Lr(e,t)?t:e}get x(){return this._viewport[0]}set x(e){e+=this._padding[S.LEFT],this._viewport[0]!==e&&(this._viewport[0]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(e){e+=this._padding[S.BOTTOM],this._viewport[1]!==e&&(this._viewport[1]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(e){this._viewport[2]!==e&&(this._viewport[2]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(e){this._viewport[3]!==e&&(this._viewport[3]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[S.RIGHT]+this._padding[S.LEFT]}set fullWidth(e){this.width=e-(this._padding[S.RIGHT]+this._padding[S.LEFT])}get fullHeight(){return this._viewport[3]+this._padding[S.TOP]+this._padding[S.BOTTOM]}set fullHeight(e){this.height=e-(this._padding[S.TOP]+this._padding[S.BOTTOM])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[S.LEFT],this._fullViewport[1]=this._viewport[1]-this._padding[S.BOTTOM],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(e){Tt(this._padding,e)||(this._viewport[0]+=e[S.LEFT]-this._padding[S.LEFT],this._viewport[1]+=e[S.BOTTOM]-this._padding[S.BOTTOM],this._viewport[2]-=e[S.RIGHT]+e[S.LEFT]-(this._padding[S.RIGHT]+this._padding[S.LEFT]),this._viewport[3]-=e[S.TOP]+e[S.BOTTOM]-(this._padding[S.TOP]+this._padding[S.BOTTOM]),Ke(this._padding,e),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(Jt(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return Pe(L(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||L()}get fov(){return this._fov}set fov(e){this._fov=e,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return go(this._fov,this.width,this.height)}set fovX(e){this._fov=po(e,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return _o(this._fov,this.width,this.height)}set fovY(e){this._fov=mo(e,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return Mi(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(Pe(this._viewInverseTransposeMatrix,this.viewMatrix),cr(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(e){const t=2*e-1;return 2*this.near*this.far/(this.far+this.near-t*(this.far-this.near))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return this.relativeElevation!=null&&this.relativeElevation>=0}get _projectionMatrixInternal(){const e=this.width,t=this.height,r=this.near*Math.tan(this.fovY/2)*2,i=r*this._aspect,s=r/this.rows,n=i/this.columns,a=-i/2+this.column*n,o=a+n,l=-r/2+this.row*s,c=l+s,d=Zn(L(),a*(1+2*this._padding[S.LEFT]/e),o*(1+2*this._padding[S.RIGHT]/e),l*(1+2*this._padding[S.BOTTOM]/t),c*(1+2*this._padding[S.TOP]/t),this.near,this.far),h=this._get("projectionMatrix");return h&&Kn(h,d)?h:d}copyFrom(e){j(this._ray.origin,e.eye),this.center=e.center,this.up=e.up,Ke(this._viewport,e.viewport),this.notifyChange("_viewport"),Ke(this._padding,e.padding),this.notifyChange("_padding"),Si(this._nearFar,e.nearFar),this.notifyChange("_nearFar"),this._fov=e.fov,this.row=e.row,this.column=e.column,this.rows=e.rows,this.columns=e.columns,this.relativeElevation=e.relativeElevation;const t=e;return this._viewDirty=t._viewDirty,this._viewDirty||(ce(this._viewMatrix,e.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=t._frustumDirty,this._frustumDirty||(ca(this._frustum,e.frustum),this._frustumDirty=!1),t._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(ce(this._viewInverseTransposeMatrix,e.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),Ke(this._fullViewport,e.fullViewport),this.pixelRatio=e.pixelRatio,this}copyViewFrom(e){this.eye=e.eye,this.center=e.center,this.up=e.up,this.fov=e.fov}clone(){return new tr().copyFrom(this)}equals(e){return Ze(this.eye,e.eye)&&Ze(this.center,e.center)&&Ze(this.up,e.up)&&Tt(this._viewport,e.viewport)&&Tt(this._padding,e.padding)&&en(this.nearFar,e.nearFar)&&this._fov===e.fov&&this.pixelRatio===e.pixelRatio&&this.relativeElevation===e.relativeElevation&&this.row===e.row&&this.column===e.column&&this.rows===e.rows&&this.columns===e.columns}almostEquals(e){const t=Math.max(1,1/this.pixelRatio,1/e.pixelRatio);if(Math.abs(e.fov-this._fov)>=.001||Nr(e.screenPadding,this.screenPadding)>=t||Nr(this.screenViewport,e.screenViewport)>=t||this.row!==e.row||this.column!==e.column||this.rows!==e.rows||this.columns!==e.columns)return!1;Dr(B,e.eye,e.center),Dr(Mt,this.eye,this.center);const r=qe(B,Mt),i=Pr(B),s=Pr(Mt),n=5e-4;return r*r>=(1-1e-10)*i*s&&na(e.eye,this.eye)2&&(t[2]=.5*(r[2]+1))),t}unprojectFromScreen(e,t){return this.unprojectFromRenderScreen(this.screenToRender(e,Dt),t)}unprojectFromRenderScreen(e,t){if(Jt(st,this.projectionMatrix,this.viewMatrix),!Pe(st,st))return null;const r=this.fullViewport;return T[0]=2*(e[0]-r[0])/r[2]-1,T[1]=2*(e[1]-r[1])/r[3]-1,T[2]=2*e[2]-1,T[3]=1,He(T,T,st),T[3]===0?null:(t[0]=T[0]/T[3],t[1]=T[1]/T[3],t[2]=T[2]/T[3],t)}constrainWindowSize(e,t,r,i){const s=e*this.pixelRatio,n=t*this.pixelRatio,a=Math.max(s-r/2,0),o=Math.max(this.fullHeight-n-i/2,0),l=-Math.min(s-r/2,0),c=-Math.min(this.fullHeight-n-i/2,0),d=r-l- -Math.min(this.fullWidth-s-r/2,0),h=i-c- -Math.min(n-i/2,0);return[Math.round(a),Math.round(o),Math.round(d),Math.round(h)]}computeUp(e){e===ne.Global?this._computeUpGlobal():this._computeUpLocal()}screenToRender(e,t){const r=e[0]*this.pixelRatio,i=this.fullHeight-e[1]*this.pixelRatio;return t[0]=r,t[1]=i,t}renderToScreen(e,t){const r=e[0]/this.pixelRatio,i=(this.fullHeight-e[1])/this.pixelRatio;t[0]=r,t[1]=i}_computeUpGlobal(){Y(B,this.center,this.eye);const e=me(this.center);e<1?(ie(this._up,0,0,1),this._markViewDirty(),this.notifyChange("_up")):Math.abs(qe(B,this.center))>.9999*me(B)*e||($e(this._up,B,this.center),$e(this._up,this._up,B),he(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_computeUpLocal(){aa(B,this.eye,this.center),Math.abs(B[2])<=.9999&&(Z(B,B,B[2]),ie(this._up,-B[0],-B[1],1-B[2]),he(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_compareAndSetView(e,t,r=""){typeof e[0]=="number"&&isFinite(e[0])&&typeof e[1]=="number"&&isFinite(e[1])&&typeof e[2]=="number"&&isFinite(e[2])?Ze(e,t)||(j(t,e),this._markViewDirty(),r.length&&this.notifyChange(r)):ps.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(ha(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(ea(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};m([v()],b.prototype,"_viewport",void 0),m([v()],b.prototype,"_padding",void 0),m([v()],b.prototype,"_fov",void 0),m([v()],b.prototype,"_nearFar",void 0),m([v()],b.prototype,"_viewDirty",void 0),m([v()],b.prototype,"_viewMatrix",void 0),m([v()],b.prototype,"_pixelRatio",void 0),m([v()],b.prototype,"pixelRatio",null),m([v()],b.prototype,"row",void 0),m([v()],b.prototype,"column",void 0),m([v()],b.prototype,"_rows",void 0),m([v()],b.prototype,"rows",null),m([v()],b.prototype,"_columns",void 0),m([v()],b.prototype,"columns",null),m([v()],b.prototype,"eye",null),m([v()],b.prototype,"center",null),m([v()],b.prototype,"_center",void 0),m([v()],b.prototype,"up",null),m([v()],b.prototype,"_up",void 0),m([v()],b.prototype,"viewMatrix",null),m([v({readOnly:!0})],b.prototype,"viewForward",null),m([v({readOnly:!0})],b.prototype,"viewUp",null),m([v({readOnly:!0})],b.prototype,"viewRight",null),m([v({readOnly:!0})],b.prototype,"nearFar",null),m([v()],b.prototype,"near",null),m([v()],b.prototype,"far",null),m([v()],b.prototype,"viewport",null),m([v({readOnly:!0})],b.prototype,"screenViewport",null),m([v({readOnly:!0})],b.prototype,"screenPadding",null),m([v()],b.prototype,"x",null),m([v()],b.prototype,"y",null),m([v()],b.prototype,"width",null),m([v()],b.prototype,"height",null),m([v()],b.prototype,"fullWidth",null),m([v()],b.prototype,"fullHeight",null),m([v({readOnly:!0})],b.prototype,"_aspect",null),m([v()],b.prototype,"padding",null),m([v({readOnly:!0})],b.prototype,"projectionMatrix",null),m([v({readOnly:!0})],b.prototype,"inverseProjectionMatrix",null),m([v()],b.prototype,"fov",null),m([v()],b.prototype,"fovX",null),m([v()],b.prototype,"fovY",null),m([v()],b.prototype,"viewInverseTransposeMatrix",null),m([v({readOnly:!0})],b.prototype,"_projectionMatrixInternal",null),m([v()],b.prototype,"relativeElevation",void 0),b=tr=m([K("esri.views.3d.webgl.RenderCamera")],b);const vo=b,T=le(),st=L(),B=A(),Mt=A(),Dt=ms();let yo=class{constructor(e,t,r){this._elementSize=t,this._buffer=Fi.createVertex(e,Li.STATIC_DRAW),this.resize(r)}destroy(){this._buffer.dispose()}get elementSize(){return this._elementSize}get capacity(){return this._capacity}get array(){return this._array}get buffer(){return this._buffer}get usedMemory(){return this._array.byteLength+this._buffer.usedMemory}copyRange(e,t,r,i=0){const s=new Uint8Array(this.array,e*this.elementSize,(t-e)*this.elementSize);new Uint8Array(r.array,i*this.elementSize).set(s)}transferAll(){this._buffer.setData(this._array)}transferRange(e,t){const r=e*this._elementSize,i=t*this._elementSize;this._buffer.setSubData(new Uint8Array(this._array),r,r,i)}resize(e){const t=e*this._elementSize,r=new ArrayBuffer(t);this._array&&(e>=this._capacity?new Uint8Array(r).set(new Uint8Array(this._array)):new Uint8Array(r).set(new Uint8Array(this._array).subarray(0,e*this._elementSize))),this._array=r,this._buffer.setSize(t),this._capacity=e}},wo=class{constructor(e){this.modelOriginHi=e.getField(p.INSTANCEMODELORIGINHI,jr),this.modelOriginLo=e.getField(p.INSTANCEMODELORIGINLO,jr),this.model=e.getField(p.INSTANCEMODEL,mt),this.modelNormal=e.getField(p.INSTANCEMODELNORMAL,mt),this.featureAttribute=e.getField(p.INSTANCEFEATUREATTRIBUTE,Pi),this.color=e.getField(p.INSTANCECOLOR,ke),this.objectAndLayerIdColor=e.getField(p.INSTANCEOBJECTANDLAYERIDCOLOR,ke)}},bo=class{constructor(e,t){this._rctx=e,this._instanceBufferLayout=t,this._headIndex=0,this._tailIndex=0,this._firstIndex=null,this._captureFirstIndex=!0,this._updating=!1,this._prevHeadIndex=0,this._resized=!1,this._capacity=1}destroy(){this._buffer&&this._buffer.destroy()}get buffer(){return this._buffer.buffer}get view(){return this._view}get capacity(){return this._capacity}get size(){const e=this._headIndex,t=this._tailIndex;return e>=t?e-t:e+this._capacity-t}get isEmpty(){return this._headIndex===this._tailIndex}get isFull(){return this._tailIndex===(this._headIndex+1)%this._capacity}get headIndex(){return this._headIndex}get tailIndex(){return this._tailIndex}get firstIndex(){return this._firstIndex}get usedMemory(){return this._buffer?.usedMemory??0}reset(){this._headIndex=0,this._tailIndex=0,this._firstIndex=null}startUpdateCycle(){this._captureFirstIndex=!0}beginUpdate(){N(!this._updating,"already updating"),this._updating=!0,this._prevHeadIndex=this._headIndex}endUpdate(){N(this._updating,"not updating"),this.size0,"invalid size");const e=this._tailIndex===this._firstIndex;this._incrementTail(),e&&(this._firstIndex=this._tailIndex)}_grow(){const e=Math.max(yt,Math.floor(this._capacity*wi));this._resize(e)}_shrink(){const e=Math.max(yt,Math.floor(this._capacity*Rs));this._resize(e)}_resize(e){if(N(this._updating,"not updating"),e===this._capacity)return;const t=new yo(this._rctx,this._instanceBufferLayout.stride,e);if(this._buffer){this._firstIndex&&(this._firstIndex=(this._firstIndex+this._capacity-this._tailIndex)%this._capacity);const r=this.size,i=this._compactInstances(t);N(i===r,"invalid compaction"),this._buffer.destroy(),this._tailIndex=0,this._headIndex=i,this._prevHeadIndex=0}this._resized=!0,this._capacity=e,this._buffer=t,this._view=new wo(this._instanceBufferLayout.createView(this._buffer.array))}_compactInstances(e){const t=this._headIndex,r=this._tailIndex;return rt?(this._buffer.copyRange(r,this._capacity,e),t>0&&this._buffer.copyRange(0,t,e,this._capacity-r),t+(this._capacity-r)):0}_incrementHead(e=1){this._headIndex=(this._headIndex+e)%this._capacity}_incrementTail(e=1){this._tailIndex=(this._tailIndex+e)%this._capacity}_transferRange(e,t){et&&(t>0&&this._buffer.transferRange(0,t),this._buffer.transferRange(e,this._capacity))}};const yt=64;var R;function xo(e){let t=hr().mat4f64(p.LOCALTRANSFORM).mat4f64(p.GLOBALTRANSFORM).vec4f64(p.BOUNDINGSPHERE).vec3f64(p.MODELORIGIN).mat3f(p.INSTANCEMODEL).mat3f(p.INSTANCEMODELNORMAL).vec2f(p.MODELSCALEFACTORS);return e.includes(p.FEATUREATTRIBUTE)&&(t=t.vec4f(p.FEATUREATTRIBUTE)),e.includes(p.COLOR)&&(t=t.vec4u8(p.COLOR)),e.includes(p.OBJECTANDLAYERIDCOLOR)&&(t=t.vec4u8(p.OBJECTANDLAYERIDCOLOR)),t=t.u8(p.STATE).u8(p.LODLEVEL),t}(function(e){e[e.ALLOCATED=1]="ALLOCATED",e[e.DEFAULT_ACTIVE=2]="DEFAULT_ACTIVE",e[e.VISIBLE=4]="VISIBLE",e[e.HIGHLIGHT=8]="HIGHLIGHT",e[e.HIGHLIGHT_ACTIVE=16]="HIGHLIGHT_ACTIVE",e[e.REMOVE=32]="REMOVE",e[e.TRANSFORM_CHANGED=64]="TRANSFORM_CHANGED",e[e.ACTIVE=18]="ACTIVE"})(R||(R={}));let Kr=class{constructor(e){this.localTransform=e.getField(p.LOCALTRANSFORM,Gr),this.globalTransform=e.getField(p.GLOBALTRANSFORM,Gr),this.modelOrigin=e.getField(p.MODELORIGIN,Ia),this.model=e.getField(p.INSTANCEMODEL,mt),this.modelNormal=e.getField(p.INSTANCEMODELNORMAL,mt),this.modelScaleFactors=e.getField(p.MODELSCALEFACTORS,Ca),this.boundingSphere=e.getField(p.BOUNDINGSPHERE,Ta),this.featureAttribute=e.getField(p.FEATUREATTRIBUTE,Pi),this.color=e.getField(p.COLOR,ke),this.objectAndLayerIdColor=e.getField(p.OBJECTANDLAYERIDCOLOR,ke),this.state=e.getField(p.STATE,Vr),this.lodLevel=e.getField(p.LODLEVEL,Vr)}},Ee=class extends ye{constructor(e,t){super(e),this.events=new ar,this._capacity=0,this._size=0,this._next=0,this._highlightGroupMap=new Map,this._highlightGroupMapPrev=new Map,this._layout=xo(t),this._capacity=yt,this._buffer=this._layout.createBuffer(this._capacity),this._view=new Kr(this._buffer)}get capacity(){return this._capacity}get size(){return this._size}get view(){return this._view}addInstance(){this._size+1>this._capacity&&this._grow();const e=this._findSlot();return this._view.state.set(e,R.ALLOCATED),this._size++,this.events.emit("instances-changed"),e}removeInstance(e){const t=this._view.state;N(e>=0&&e=0&&eda(this._instanceData.view.boundingSphere.getVec(r,this._tmpSphere)),{maximumDepth:25}),this._instanceData=e,this._boundingSphere=t,this._tmpSphere=ua(),this._tmpMat4=L()}addInstance(e){const t=this._instanceData.view.boundingSphere,r=this._instanceData.getCombinedModelTransform(e,this._tmpMat4);_e(fa(this._tmpSphere),this._boundingSphere.center,r),this._tmpSphere[3]=this._boundingSphere.radius*va(r),t.setVec(e,this._tmpSphere),this.add([e])}removeInstance(e){this.remove([e])}},To=class{constructor(e,t){this._worldSpaceRadius=e,this._minScreenSpaceRadii=t}selectLevel(e,t,r){const i=r.computeScreenPixelSizeAt(e),s=this._worldSpaceRadius*t/i;let n=0;for(let a=1;a=this._minScreenSpaceRadii[a]&&(n=a);return n}},So=class{constructor(e){this.layerUid=e}},Oo=class extends So{constructor(e,t){super(e),this.graphicUid=t}};function Ro(e){return e?.dist!=null}let Ao=class{get ray(){return this._ray}get distanceInRenderSpace(){return this.dist!=null?(Z(nt,this.ray.direction,this.dist),me(nt)):null}getIntersectionPoint(e){return!!Ro(this)&&(Z(nt,this.ray.direction,this.dist),ht(e,this.ray.origin,nt),!0)}getTransformedNormal(e){return j(Be,this.normal),Be[3]=0,He(Be,Be,this.transformation),j(e,Be),he(e,e)}constructor(e){this.intersector=Fe.OBJECT,this.normal=A(),this.transformation=L(),this._ray=Di(),this.init(e)}init(e){this.dist=null,this.target=null,this.drapedLayerOrder=null,this.drapedLayerGraphicOrder=null,this.intersector=Fe.OBJECT,zr(e,this._ray)}set(e,t,r,i,s,n,a){this.intersector=e,this.dist=r,j(this.normal,i??Bs),ce(this.transformation,s??sa),this.target=t,this.drapedLayerOrder=n,this.drapedLayerGraphicOrder=a}copy(e){zr(e.ray,this._ray),this.intersector=e.intersector,this.dist=e.dist,this.target=e.target,this.drapedLayerOrder=e.drapedLayerOrder,this.drapedLayerGraphicOrder=e.drapedLayerGraphicOrder,j(this.normal,e.normal),ce(this.transformation,e.transformation)}};function Eo(e){return new Ao(e)}const nt=A(),Be=le();let Mo=class extends Aa{},Do=class extends Oo{constructor(e,t,r,i,s,n){super(e,t),this.layerUid=e,this.graphicUid=t,this.geometryId=r,this.triangleNr=i,this.baseBoundingSphere=s,this.numLodLevels=n}};function Po(e,t,r,i=null){const s=e.createBufferWriter(),n=s.vertexBufferLayout,a=s.elementCount(t),o=n.createBuffer(a);return s.write(null,null,t,i,o,0),{material:e,vertexBufferLayout:n,buffer:o.buffer,elementCount:a,boundingInfo:r}}let Fo=class{constructor(e,t){const r=e.renderContext.rctx,i=t.geometry;let s=null;s=i instanceof pt?Po(i.material,i.attributes,i.boundingInfo):i;const n=s.material;this._materials=e.materials,n.setParameters({instancedDoublePrecision:!0}),this.geometry=i,this.material=n,this.glMaterials=new fr(n,this._materials),this.vertexBufferLayout=s.vertexBufferLayout,this.vbo=Fi.createVertex(r,Li.STATIC_DRAW,s.buffer),this.vao=new Mo(r,Qt,new Map([["geometry",xt(s.vertexBufferLayout)]]),new Map([["geometry",this.vbo]])),this.vertexCount=s.elementCount}destroy(){this.glMaterials.dispose(),this.vbo.dispose(),this.vao.dispose()}get boundingInfo(){return this.geometry.boundingInfo}get triangleCount(){return this.vertexCount/3}intersect(e,t,r,i,s,n,a,o){if(!(this.geometry instanceof pt))return;const l=this.geometry.id;this.material.intersect(this.geometry,e.transform.transform,e,r,i,(c,d,h,u,f)=>{if(c>=0){if(t!=null&&!t(e.rayBegin,e.rayEnd,c))return;const _=new Do(n.layerUid,n.graphicUid(s),l,h,a,o);if((e.results.min.drapedLayerOrder==null||f>=e.results.min.drapedLayerOrder)&&(e.results.min.dist==null||c=e.results.max.drapedLayerOrder)&&(e.results.max.dist==null||c>e.results.max.dist)&&e.results.max.set(Fe.LOD,_,c,d,e.transform.transform,f),e.options.store===Br.ALL){const g=Eo(e.results.min.ray);g.set(Fe.LOD,_,c,d,e.transform.transform,f),e.results.all.push(g)}}})}},Lo=class Vi{static async create(t,r,i){const s=await Promise.allSettled(r.components.map(a=>t.controller.schedule(()=>new Fo(t,a),i))),n=s.map(a=>a.status==="fulfilled"?a.value:null).filter(bi);if(xi(i)||n.length!==s.length){n.forEach(a=>a.destroy()),ve(i);for(const a of s)if(a.status==="rejected")throw a.reason}return new Vi(r.minScreenSpaceRadius,n)}constructor(t,r){this.minScreenSpaceRadius=t,this.components=r}destroy(){this.components.forEach(t=>t.destroy())}intersect(t,r,i,s,n,a,o){this.components.forEach(l=>l.intersect(t,r,i,s,n,a,this.boundingSphere,o))}get boundingBox(){if(this._boundingBox==null){const t=As();this.components.forEach(r=>{r.boundingInfo!=null&&(xr(t,r.boundingInfo.bbMin),xr(t,r.boundingInfo.bbMax))}),this._boundingBox=t}return this._boundingBox}get boundingSphere(){if(this._boundingSphere==null){const t=this.boundingBox,r=A();Es(t,r),this._boundingSphere={center:r,radius:.5*Ms(t)}}return this._boundingSphere}get triangleCount(){return this.components.reduce((t,r)=>t+r.triangleCount,0)}};function No(e,t,r,i,s){at[0]=e.get(t,0),at[1]=e.get(t,1),at[2]=e.get(t,2),Ea(at,ue,3),r.set(s,0,ue[0]),i.set(s,0,ue[1]),r.set(s,1,ue[2]),i.set(s,1,ue[3]),r.set(s,2,ue[4]),i.set(s,2,ue[5])}const at=A(),ue=new Float32Array(6),zo=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map(i=>i.minScreenSpaceRadius);return new To(t,r)};let Q=class extends no{constructor(e,t){super(e),this.type=Fe.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDataMap=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new vo,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[W.OPAQUE_MATERIAL,r=>this._produces(r)],[W.TRANSPARENT_MATERIAL,r=>!!this._hasTransparentLevels()&&this._produces(r)]]),this._instanceData=new Ee({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(Ma.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=Go(this.optionalFields),this._glInstanceBufferLayout=xt(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",()=>this._requestUpdateCycle()),this._instanceData.events.on("instance-transform-changed",({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)}),this._instanceData.events.on("instance-visibility-changed",({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)}),this._instanceData.events.on("instance-highlight-changed",()=>this._requestUpdateCycle(!0))])}get _allRenderInstanceData(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDataMap)e.push(t[1]);return e}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this.metadata.layerUid}get instanceData(){return this._instanceData}get hasEmissions(){return this.baseMaterial.hasEmissions}get usedMemory(){return this._allRenderInstanceData.reduce((e,t)=>t.reduce((r,i)=>r+i.usedMemory,e),0)}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach((r,i)=>{const s=this._allRenderInstanceData[0][i].size+this._allRenderInstanceData[1][i].size,n=r.triangleCount;t.push({renderedInstances:s,renderedTriangles:s*n,trianglesPerInstance:n})}),{totalInstances:e,renderedInstances:t.reduce((r,i)=>r+i.renderedInstances,0),renderedTriangles:t.reduce((r,i)=>r+i.renderedTriangles,0),levels:t}}_createRenderInstanceDataArray(e=[]){const{rctx:t}=this._context.renderContext;return this.symbol.levels.map(r=>{e.push(new bo(t,this._instanceBufferLayout))}),e}async initializeRenderContext(e,t){this._context=e,this._createRenderInstanceDataArray(this._defaultRenderInstanceData);const r=await Promise.allSettled(this.symbol.levels.map(s=>Lo.create(e,s,t))),i=r.map(s=>s.status==="fulfilled"?s.value:null).filter(bi);if(xi(t)||i.length!==r.length){i.forEach(s=>s.destroy()),ve(t);for(const s of r)if(s.status==="rejected")throw s.reason}this._levels=i,this._levelSelector=zo(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach(e=>e.destroy()),this._defaultRenderInstanceData.forEach(e=>e.destroy()),this._highlightRenderInstanceDataMap.forEach(e=>e.forEach(t=>t.destroy()))}_hasTransparentLevels(){return this._levels.some(e=>e.components.some(t=>t.material.produces.get(W.TRANSPARENT_MATERIAL)?.(E.Color)))}hasHighlights(){return gs(this._highlightRenderInstanceDataMap,e=>e.some(t=>t.size>0))}_produces(e){return e!==E.Highlight&&e!==E.ShadowHighlight||this.hasHighlights()}prepareRender(e){if(!Wt.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(Da),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const r=new Array,i=this.levels;return t.forEach(s=>i.forEach(({components:n},a)=>n.forEach(o=>r.push(this._beginComponent(e,s[a],o))))),r}render(e,t){const r=this._getInstanceDatas(e);if(!r||t==null)return;let i=0;e.rctx.bindVAO();const s=this.levels;r.forEach(n=>s.forEach(({components:a},o)=>a.forEach(l=>this._renderComponent(e,t[i++],n[o],l,o))))}_getInstanceDatas(e){const{output:t,bind:r}=e,i=t===E.Highlight,s=!i&&t!==E.ShadowHighlight,n=t!==E.ShadowExcludeHighlight;if(s)return n?this._allRenderInstanceData:[this._defaultRenderInstanceData];if(n){if(i){const{highlightGroupName:o}=r;if(!o)return null;const l=this._highlightRenderInstanceDataMap.get(o);return l?[l]:null}const a=[];for(const o of this._highlightRenderInstanceDataMap)a.push(o[1]);return a}return null}intersect(e,t,r,i){if(!this.baseMaterial.visible||this._octree==null)return;const s=A();Y(s,i,r);const n=a=>{this._instanceData.getCombinedModelTransform(a,ii),e.transform.set(ii),_e(si,r,e.transform.inverse),_e(ni,i,e.transform.inverse);const o=this._instanceData.getState(a),l=this._instanceData.getLodLevel(a),c=this._levels.length;N(!!(o&R.ACTIVE),"invalid instance state"),N(l>=0&&le.forEach(t=>t.startUpdateCycle()))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:r,_levelSelector:i}=this;this._allRenderInstanceData.forEach(d=>d.forEach(h=>h.beginUpdate()));const s=this._instanceData,n=s.view;let a=s.size;const o=s.capacity;let l=this._instanceIndex;const c=Math.ceil(o/500);for(let d=0;d{const g=this._highlightRenderInstanceDataMap.get(_);if(!g)throw new Ut("Internal error in lodRenderer");g[f].freeTail()}),h&R.REMOVE)s.freeInstance(l);else if(h&R.VISIBLE){let _=0;t&&(n.modelOrigin.getVec(l,ri),_=i.selectLevel(ri,s.getCombinedMedianScaleFactor(l),r)),u=h&~(R.ACTIVE|R.TRANSFORM_CHANGED),_>=0&&(h&R.HIGHLIGHT?(s.foreachHighlightGroup(l,g=>{let C=this._highlightRenderInstanceDataMap.get(g);if(C||(C=this._createRenderInstanceDataArray(),C.forEach(I=>I.beginUpdate()),this._highlightRenderInstanceDataMap.set(g,C)),_>=C.length)throw new Ut(`LodRenderer internal error - missing lodLevel ${_}`);ti(C[_],n,l)}),u|=R.HIGHLIGHT_ACTIVE):(ti(this._defaultRenderInstanceData[_],n,l),u|=R.DEFAULT_ACTIVE)),n.state.set(l,u),n.lodLevel.set(l,_)}else u=h&~(R.ACTIVE|R.TRANSFORM_CHANGED),n.state.set(l,u);if(this._octreeCached!=null){const _=!!(h&R.ACTIVE),g=!!(u&R.ACTIVE);!_&&g?this._octreeCached.addInstance(l):_&&!g?this._octreeCached.removeInstance(l):_&&g&&h&R.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(l),this._octreeCached.addInstance(l))}l=l+1===o?0:l+1,l%c==0&&e.madeProgress()}this._instanceIndex=l,this._allRenderInstanceData.forEach(d=>d.forEach(h=>h.endUpdate())),this._context.requestRender()}_beginComponent(e,t,r){return t.size===0?null:r.glMaterials.load(e.rctx,e.bind.slot,e.output)?.beginSlot(e.bind)}_renderComponent(e,t,r,i,s){if(!t)return;const{bind:n,rctx:a}=e;a.runAppleAmdDriverHelper();const o=a.bindTechnique(t,n,i.material.parameters,Vo);a.bindVAO(i.vao),t.ensureAttributeLocations(i.vao),Wt.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===E.Color&&(o.setUniform4fv("externalColor",ai[Math.min(s,ai.length-1)]),o.setUniform1i("colorMixMode",cn.replace));const l=r.capacity,c=r.headIndex,d=r.tailIndex,h=r.firstIndex,u=this._glInstanceBufferLayout,f=(_,g)=>{Pa(a,Qt,r.buffer,u,_),a.drawArraysInstanced(t.primitiveType,0,i.vertexCount,g-_),Fa(a,Qt,r.buffer,u)};i.material.parameters.transparent&&h!=null?c>d?(N(h>=d&&h<=c,"invalid firstIndex"),f(h,c),f(d,h)):c=0&&h<=c,"invalid firstIndex"),f(h,c),f(d,l),f(0,h)):(N(h>=d&&h<=l,"invalid firstIndex"),f(h,l),f(0,c),f(d,h))):c>d?f(d,c):cs.geometry));this.numVertices=i.reduce((s,n)=>s+Ho(n),0)}},$o=class{constructor(e){this.levels=e,this.levels.sort((t,r)=>t.minScreenSpaceRadius===r.minScreenSpaceRadius?t.numVertices-r.numVertices:t.minScreenSpaceRadius-r.minScreenSpaceRadius)}};function qo(e){const t=[];return e.levels.forEach(r=>r.components.forEach(i=>t.push(i.geometry.material))),or(t)}function ko(e){const t=new Array;return e.levels.forEach(r=>r.components.forEach(i=>{i.textures!=null&&t.push(...i.textures)})),or(t)}let rr=class{constructor(e){this._optionalFields=new Array,this._instanceIndexToFeatureId=new Map,this._featureIdToInstanceIndex=new Map,this._disposeResourceHandles=new Array,this._lodRendererResources=null,this.layerUid=e.layerUid,this.view=e.view,this.sharedResources=this.view.sharedSymbolResources,this.scheduler=this.view.resourceController.scheduler}async doLoad(e,t,r){vs("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(p.OBJECTANDLAYERIDCOLOR);const i=Wo(l=>t(l),e),s=this.view._stage,n=qo(i);s.addMany(n),this._addDisposeResource(()=>s.removeMany(n));const a=ko(i);s.addMany(a),this._addDisposeResource(()=>{a.forEach(l=>l.unload()),s.removeMany(a)}),await Promise.all(a.map(l=>this.view._stage.schedule(()=>l.load(s.renderView.renderingContext),r))),ve(r);const o=await this._createLodRenderer(i,r);this._lodRendererResources={lodRenderer:o,materials:n,textures:a}}addInstances(e){const t=this._lodRendererResources;if(t==null)return;const{featureIds:r,localTransforms:i,globalTransforms:s}=e,n=t.lodRenderer;if(n==null)return;const a=n.instanceData,o=r.length;for(let l=0;l1,notifyGraphicGeometryChanged:n=>1,notifyGraphicVisibilityChanged:n=>1},s=new Q({symbol:e,optionalFields:this._optionalFields,metadata:i,shaderTransformation:null},this.scheduler);return s.slicePlaneEnabled=!1,this._addDisposeResource(()=>{r.removeRenderPlugin(s),s.destroy()}),await r.addRenderPlugin(s,t),s}};function Wo(e,t){const r=t.levels.map(i=>{const s=i.components.map(n=>{const a=e(n.materialId);if(!Yo(a))throw new Error("LodRenderer only supports DefaultMaterial");const o=a.createBufferWriter(),l={material:a,vertexBufferLayout:o.vertexBufferLayout,buffer:n.renderGeometryBuffer.data,elementCount:n.renderGeometryBuffer.elementCount,boundingInfo:n.boundingInfo};return new jo(l)});return new Uo(s,i.minScreenSpaceRadius)});return new $o(r)}function Yo(e){return e!=null&&"materialType"in e&&e.materialType==="default"}rr=m([K("esri.views.3d.layers.graphics.pipeline.rendering.LodRenderer")],rr);const ji=128,De=.5;function Qo(e){return e==="cross"||e==="x"}function Jo(e,t=ji,r=t*De,i=0){const s=Xo(e,t,r,i);return new xn(s,{mipmap:!1,wrap:{s:Hr.CLAMP_TO_EDGE,t:Hr.CLAMP_TO_EDGE},width:t,height:t,components:4,noUnpackFlip:!0,reloadable:!0})}function Xo(e,t=ji,r=t*De,i=0){switch(e){case"circle":default:return Zo(t,r);case"square":return Ko(t,r);case"cross":return tl(t,r,i);case"x":return rl(t,r,i);case"kite":return el(t,r);case"triangle":return il(t,r);case"arrow":return sl(t,r)}}function Zo(e,t){const r=e/2-.5;return Qe(e,$i(r,r,t/2))}function Ko(e,t){return Hi(e,t,!1)}function el(e,t){return Hi(e,t,!0)}function tl(e,t,r=0){return Ui(e,t,!1,r)}function rl(e,t,r=0){return Ui(e,t,!0,r)}function il(e,t){return Qe(e,qi(e/2,t,t/2))}function sl(e,t){const r=t,i=t/2,s=e/2,n=.8*r,a=$i(s,(e-t)/2-n,Math.sqrt(n*n+i*i)),o=qi(s,r,i);return Qe(e,(l,c)=>Math.max(o(l,c),-a(l,c)))}function Hi(e,t,r){return r&&(t/=Math.SQRT2),Qe(e,(i,s)=>{let n=i-.5*e+.25,a=.5*e-s-.75;if(r){const o=(n+a)/Math.SQRT2;a=(a-n)/Math.SQRT2,n=o}return Math.max(Math.abs(n),Math.abs(a))-.5*t})}function Ui(e,t,r,i=0){t-=i,r&&(t*=Math.SQRT2);const s=.5*t;return Qe(e,(n,a)=>{let o,l=n-.5*e,c=.5*e-a-1;if(r){const d=(l+c)/Math.SQRT2;c=(c-l)/Math.SQRT2,l=d}return l=Math.abs(l),c=Math.abs(c),o=l>c?l>s?Math.sqrt((l-s)*(l-s)+c*c):c:c>s?Math.sqrt(l*l+(c-s)*(c-s)):l,o-=i/2,o})}function $i(e,t,r){return(i,s)=>{const n=i-e,a=s-t;return Math.sqrt(n*n+a*a)-r}}function qi(e,t,r){const i=Math.sqrt(t*t+r*r);return(s,n)=>{const a=Math.abs(s-e)-r,o=n-e+t/2+.75,l=(t*a+r*o)/i,c=-o;return Math.max(l,c)}}function Qe(e,t){const r=new Uint8Array(4*e*e);for(let i=0;i=16}function al(e){return Array.isArray(e)&&e.length>=16}function ol(e){return nl(e)||al(e)}const ki=.5;function ll(e,t){e.include(Oi),e.attributes.add(p.POSITION,"vec3"),e.attributes.add(p.NORMAL,"vec3"),e.attributes.add(p.CENTEROFFSETANDDISTANCE,"vec4");const r=e.vertex;In(r,t),Cn(r,t),r.uniforms.add(new Me("viewport",(i,s)=>s.camera.fullViewport),new ge("polygonOffset",i=>i.shaderPolygonOffset),new ge("cameraGroundRelative",(i,s)=>s.camera.aboveGround?1:-1)),t.hasVerticalOffset&&Tn(r),r.constants.add("smallOffsetAngle","float",.984807753012208),r.code.add(w`struct ProjectHUDAux {
-vec3 posModel;
-vec3 posView;
-vec3 vnormal;
-float distanceToCamera;
-float absCosAngle;
-};`),r.code.add(w`
- float applyHUDViewDependentPolygonOffset(float pointGroundDistance, float absCosAngle, inout vec3 posView) {
- float pointGroundSign = ${t.terrainDepthTest?w.float(0):w`sign(pointGroundDistance)`};
- if (pointGroundSign == 0.0) {
- pointGroundSign = cameraGroundRelative;
- }
-
- // cameraGroundRelative is -1 if camera is below ground, 1 if above ground
- // groundRelative is 1 if both camera and symbol are on the same side of the ground, -1 otherwise
- float groundRelative = cameraGroundRelative * pointGroundSign;
-
- // view angle dependent part of polygon offset emulation: we take the absolute value because the sign that is
- // dropped is instead introduced using the ground-relative position of the symbol and the camera
- if (polygonOffset > .0) {
- float cosAlpha = clamp(absCosAngle, 0.01, 1.0);
- float tanAlpha = sqrt(1.0 - cosAlpha * cosAlpha) / cosAlpha;
- float factor = (1.0 - tanAlpha / viewport[2]);
-
- // same side of the terrain
- if (groundRelative > 0.0) {
- posView *= factor;
- }
- // opposite sides of the terrain
- else {
- posView /= factor;
- }
- }
-
- return groundRelative;
- }
- `),t.draped&&!t.hasVerticalOffset||Sn(r),t.draped||(r.uniforms.add(new ge("perDistancePixelRatio",(i,s)=>Math.tan(s.camera.fovY/2)/(s.camera.fullViewport[2]/2))),r.code.add(w`
- void applyHUDVerticalGroundOffset(vec3 normalModel, inout vec3 posModel, inout vec3 posView) {
- float distanceToCamera = length(posView);
-
- // Compute offset in world units for a half pixel shift
- float pixelOffset = distanceToCamera * perDistancePixelRatio * ${w.float(ki)};
-
- // Apply offset along normal in the direction away from the ground surface
- vec3 modelOffset = normalModel * cameraGroundRelative * pixelOffset;
-
- // Apply the same offset also on the view space position
- vec3 viewOffset = (viewNormal * vec4(modelOffset, 1.0)).xyz;
-
- posModel += modelOffset;
- posView += viewOffset;
- }
- `)),t.screenCenterOffsetUnitsEnabled&&Ri(r),t.hasScreenSizePerspective&&Ai(r),r.code.add(w`
- vec4 projectPositionHUD(out ProjectHUDAux aux) {
- vec3 centerOffset = centerOffsetAndDistance.xyz;
- float pointGroundDistance = centerOffsetAndDistance.w;
-
- aux.posModel = position;
- aux.posView = (view * vec4(aux.posModel, 1.0)).xyz;
- aux.vnormal = normal;
- ${t.draped?"":"applyHUDVerticalGroundOffset(aux.vnormal, aux.posModel, aux.posView);"}
-
- // Screen sized offset in world space, used for example for line callouts
- // Note: keep this implementation in sync with the CPU implementation, see
- // - MaterialUtil.verticalOffsetAtDistance
- // - HUDMaterial.applyVerticalOffsetTransformation
-
- aux.distanceToCamera = length(aux.posView);
-
- vec3 viewDirObjSpace = normalize(cameraPosition - aux.posModel);
- float cosAngle = dot(aux.vnormal, viewDirObjSpace);
-
- aux.absCosAngle = abs(cosAngle);
-
- ${t.hasScreenSizePerspective&&(t.hasVerticalOffset||t.screenCenterOffsetUnitsEnabled)?"vec3 perspectiveFactor = screenSizePerspectiveScaleFactor(aux.absCosAngle, aux.distanceToCamera, screenSizePerspectiveAlignment);":""}
-
- ${t.hasVerticalOffset?t.hasScreenSizePerspective?"float verticalOffsetScreenHeight = applyScreenSizePerspectiveScaleFactorFloat(verticalOffset.x, perspectiveFactor);":"float verticalOffsetScreenHeight = verticalOffset.x;":""}
-
- ${t.hasVerticalOffset?w`
- float worldOffset = clamp(verticalOffsetScreenHeight * verticalOffset.y * aux.distanceToCamera, verticalOffset.z, verticalOffset.w);
- vec3 modelOffset = aux.vnormal * worldOffset;
- aux.posModel += modelOffset;
- vec3 viewOffset = (viewNormal * vec4(modelOffset, 1.0)).xyz;
- aux.posView += viewOffset;
- // Since we elevate the object, we need to take that into account
- // in the distance to ground
- pointGroundDistance += worldOffset;`:""}
-
- float groundRelative = applyHUDViewDependentPolygonOffset(pointGroundDistance, aux.absCosAngle, aux.posView);
-
- ${t.screenCenterOffsetUnitsEnabled?"":w`
- // Apply x/y in view space, but z in screen space (i.e. along posView direction)
- aux.posView += vec3(centerOffset.x, centerOffset.y, 0.0);
-
- // Same material all have same z != 0.0 condition so should not lead to
- // branch fragmentation and will save a normalization if it's not needed
- if (centerOffset.z != 0.0) {
- aux.posView -= normalize(aux.posView) * centerOffset.z;
- }
- `}
-
- vec4 posProj = proj * vec4(aux.posView, 1.0);
-
- ${t.screenCenterOffsetUnitsEnabled?t.hasScreenSizePerspective?"float centerOffsetY = applyScreenSizePerspectiveScaleFactorFloat(centerOffset.y, perspectiveFactor);":"float centerOffsetY = centerOffset.y;":""}
-
- ${t.screenCenterOffsetUnitsEnabled?"posProj.xy += vec2(centerOffset.x, centerOffsetY) * pixelRatio * 2.0 / viewport.zw * posProj.w;":""}
-
- // constant part of polygon offset emulation
- posProj.z -= groundRelative * polygonOffset * posProj.w;
- return posProj;
- }
- `)}let cl=class{constructor(){this.factor=new oi,this.factorAlignment=new oi}},oi=class{constructor(){this.scale=0,this.factor=0,this.minScaleFactor=0}};function mr(e){e.uniforms.add(new On("alignPixelEnabled",(t,r)=>r.alignPixelEnabled)),e.code.add(w`vec4 alignToPixelCenter(vec4 clipCoord, vec2 widthHeight) {
-if (!alignPixelEnabled)
-return clipCoord;
-vec2 xy = vec2(0.500123) + 0.5 * clipCoord.xy / clipCoord.w;
-vec2 pixelSz = vec2(1.0) / widthHeight;
-vec2 ij = (floor(xy * widthHeight) + vec2(0.5)) * pixelSz;
-vec2 result = (ij * 2.0 - vec2(1.0)) * clipCoord.w;
-return vec4(result, clipCoord.zw);
-}`),e.code.add(w`vec4 alignToPixelOrigin(vec4 clipCoord, vec2 widthHeight) {
-if (!alignPixelEnabled)
-return clipCoord;
-vec2 xy = vec2(0.5) + 0.5 * clipCoord.xy / clipCoord.w;
-vec2 pixelSz = vec2(1.0) / widthHeight;
-vec2 ij = floor((xy + 0.5 * pixelSz) * widthHeight) * pixelSz;
-vec2 result = (ij * 2.0 - vec2(1.0)) * clipCoord.w;
-return vec4(result, clipCoord.zw);
-}`)}function hl(e,t){const{vertex:r,fragment:i}=e;e.include(Rn,t),r.include(mr),t.terrainDepthTest&&e.varyings.add("depth","float"),r.main.add(w`
- vec4 posProjCenter;
- if (dot(position, position) > 0.0) {
- // Render single point to center of the pixel to avoid subpixel filtering to affect the marker color
- ProjectHUDAux projectAux;
- vec4 posProj = projectPositionHUD(projectAux);
- posProjCenter = alignToPixelCenter(posProj, viewport.zw);
-
- ${t.terrainDepthTest?w`depth = projectAux.posView.z;`:""}
- vec3 vpos = projectAux.posModel;
- if (rejectBySlice(vpos)) {
- // Project out of clip space
- posProjCenter = vec4(1e038, 1e038, 1e038, 1.0);
- }
-
- } else {
- // Project out of clip space
- posProjCenter = vec4(1e038, 1e038, 1e038, 1.0);
- }
-
- gl_Position = posProjCenter;
- gl_PointSize = 1.0;
- `),i.main.add(w`fragColor = vec4(1);
-if(terrainDepthTest(depth)) {
-fragColor.g = 0.5;
-}`)}var wt;(function(e){e[e.Occluded=0]="Occluded",e[e.NotOccluded=1]="NotOccluded",e[e.Both=2]="Both",e[e.COUNT=3]="COUNT"})(wt||(wt={}));function dl(e){e.vertex.uniforms.add(new ge("renderTransparentlyOccludedHUD",(t,r)=>r.hudRenderStyle===wt.Occluded?1:r.hudRenderStyle===wt.NotOccluded?0:.75),new Me("viewport",(t,r)=>r.camera.fullViewport),new Yt("hudVisibilityTexture",(t,r)=>r.hudVisibility?.getTexture())),e.vertex.include(mr),e.vertex.code.add(w`bool testHUDVisibility(vec4 posProj) {
-vec4 posProjCenter = alignToPixelCenter(posProj, viewport.zw);
-vec4 occlusionPixel = texture(hudVisibilityTexture, .5 + .5 * posProjCenter.xy / posProjCenter.w);
-if (renderTransparentlyOccludedHUD > 0.5) {
-return occlusionPixel.r * occlusionPixel.g > 0.0 && occlusionPixel.g * renderTransparentlyOccludedHUD < 1.0;
-}
-return occlusionPixel.r * occlusionPixel.g > 0.0 && occlusionPixel.g == 1.0;
-}`)}const gr={occludedFadeFactor:.6};function Wi(e){const t=new hn,r=e.signedDistanceFieldEnabled;if(t.include(ll,e),t.include(dn,e),e.occlusionPass)return t.include(hl,e),t;const{vertex:i,fragment:s}=t;t.include(Oi),t.include(un,e),t.include(fn,e),t.include(dl),s.include(qa),s.include(pn),t.varyings.add("vcolor","vec4"),t.varyings.add("vtc","vec2"),t.varyings.add("vsize","vec2"),t.varyings.add("voccluded","float"),i.uniforms.add(new Me("viewport",(d,h)=>h.camera.fullViewport),new Sr("screenOffset",(d,h)=>ft(Yi,2*d.screenOffset[0]*h.camera.pixelRatio,2*d.screenOffset[1]*h.camera.pixelRatio)),new Sr("anchorPosition",d=>We(d)),new Me("materialColor",d=>d.color),new ge("materialRotation",d=>d.rotation)),Ri(i),r&&(i.uniforms.add(new Me("outlineColor",d=>d.outlineColor)),s.uniforms.add(new Me("outlineColor",d=>li(d)?d.outlineColor:Xs),new ge("outlineSize",d=>li(d)?d.outlineSize:0))),e.horizonCullingEnabled&&i.uniforms.add(new ka("pointDistanceSphere",(d,h)=>{const u=h.camera.eye,f=d.origin;return ae(f[0]-u[0],f[1]-u[1],f[2]-u[2],ys.radius)})),e.pixelSnappingEnabled&&i.include(mr),e.hasScreenSizePerspective&&(mn(i),Ai(i)),e.debugDrawLabelBorder&&t.varyings.add("debugBorderCoords","vec4"),t.attributes.add(p.UV0,"vec2"),t.attributes.add(p.COLOR,"vec4"),t.attributes.add(p.SIZE,"vec2"),t.attributes.add(p.ROTATION,"float"),t.attributes.add(p.FEATUREATTRIBUTE,"vec4"),i.code.add(e.horizonCullingEnabled?w`bool behindHorizon(vec3 posModel) {
-vec3 camToEarthCenter = pointDistanceSphere.xyz - localOrigin;
-vec3 camToPos = pointDistanceSphere.xyz + posModel;
-float earthRadius = pointDistanceSphere.w;
-float a = dot(camToPos, camToPos);
-float b = dot(camToPos, camToEarthCenter);
-float c = dot(camToEarthCenter, camToEarthCenter) - earthRadius * earthRadius;
-return b > 0.0 && b < a && b * b > a * c;
-}`:w`bool behindHorizon(vec3 posModel) { return false; }`),i.main.add(w`
- ProjectHUDAux projectAux;
- vec4 posProj = projectPositionHUD(projectAux);
- forwardObjectAndLayerIdColor();
-
- if (rejectBySlice(projectAux.posModel)) {
- // Project outside of clip plane
- gl_Position = vec4(1e038, 1e038, 1e038, 1.0);
- return;
- }
-
- if (behindHorizon(projectAux.posModel)) {
- // Project outside of clip plane
- gl_Position = vec4(1e038, 1e038, 1e038, 1.0);
- return;
- }
-
- vec2 inputSize;
- ${z(e.hasScreenSizePerspective,w`
- inputSize = screenSizePerspectiveScaleVec2(size, projectAux.absCosAngle, projectAux.distanceToCamera, screenSizePerspective);
- vec2 screenOffsetScaled = screenSizePerspectiveScaleVec2(screenOffset, projectAux.absCosAngle, projectAux.distanceToCamera, screenSizePerspectiveAlignment);`,w`
- inputSize = size;
- vec2 screenOffsetScaled = screenOffset;`)}
- ${z(e.vvSize,w`inputSize *= vvScale(featureAttribute).xx;`)}
-
- vec2 combinedSize = inputSize * pixelRatio;
- vec4 quadOffset = vec4(0.0);
- bool visible = testHUDVisibility(posProj);
- voccluded = visible ? 0.0 : 1.0;
- `);const n=w`
- vec2 uv01 = floor(uv0);
- vec2 uv = uv0 - uv01;
- quadOffset.xy = (uv01 - anchorPosition) * 2.0 * combinedSize;
-
- ${z(e.hasRotation,w`
- float angle = radians(materialRotation + rotation);
- float cosAngle = cos(angle);
- float sinAngle = sin(angle);
- mat2 rotate = mat2(cosAngle, -sinAngle, sinAngle, cosAngle);
-
- quadOffset.xy = rotate * quadOffset.xy;
- `)}
-
- quadOffset.xy = (quadOffset.xy + screenOffsetScaled) / viewport.zw * posProj.w;
- `,a=e.pixelSnappingEnabled?r?w`posProj = alignToPixelOrigin(posProj, viewport.zw) + quadOffset;`:w`posProj += quadOffset;
-if (inputSize.x == size.x) {
-posProj = alignToPixelOrigin(posProj, viewport.zw);
-}`:w`posProj += quadOffset;`;i.main.add(w`
- ${z(e.occlusionTestEnabled,w`
- if (!visible) {
- vtc = vec2(0.0);
- ${z(e.debugDrawLabelBorder,"debugBorderCoords = vec4(0.5, 0.5, 1.5 / combinedSize);")}
- return;
- }`)}
- ${n}
- ${e.vvColor?"vcolor = interpolateVVColor(featureAttribute.y) * materialColor;":"vcolor = color / 255.0 * materialColor;"}
-
- ${z(e.output===E.ObjectAndLayerIdColor,w`vcolor.a = 1.0;`)}
-
- bool alphaDiscard = vcolor.a < ${w.float(oe)};
- ${z(r,`alphaDiscard = alphaDiscard && outlineColor.a < ${w.float(oe)};`)}
- if (alphaDiscard) {
- // "early discard" if both symbol color (= fill) and outline color (if applicable) are transparent
- gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
- return;
- } else {
- ${a}
- gl_Position = posProj;
- }
-
- vtc = uv;
-
- ${z(e.debugDrawLabelBorder,w`debugBorderCoords = vec4(uv01, 1.5 / combinedSize);`)}
- vsize = inputSize;
- `),s.uniforms.add(new Yt("tex",d=>d.texture)),e.occludedFragmentFade&&(s.uniforms.add(new Yt("depthMap",(d,h)=>h.mainDepth)),s.uniforms.add(new ge("fadeFactor",()=>gr.occludedFadeFactor)));const o=e.debugDrawLabelBorder?w`(isBorder > 0.0 ? 0.0 : ${w.float(oe)})`:w.float(oe),l=e.output===E.Highlight,c=w`
- ${z(e.debugDrawLabelBorder,w`float isBorder = float(any(lessThan(debugBorderCoords.xy, debugBorderCoords.zw)) || any(greaterThan(debugBorderCoords.xy, 1.0 - debugBorderCoords.zw)));`)}
-
- ${z(e.sampleSignedDistanceFieldTexelCenter,w`
- float txSize = float(textureSize(tex, 0).x);
- float texelSize = 1.0 / txSize;
-
- // Calculate how much we have to add/subtract to/from each texel to reach the size of an onscreen pixel
- vec2 scaleFactor = (vsize - txSize) * texelSize;
- vec2 samplePos = vtc + (vec2(1.0, -1.0) * texelSize) * scaleFactor;`,w`vec2 samplePos = vtc;`)}
-
- ${r?w`
- vec4 fillPixelColor = vcolor;
-
- // Get distance and map it into [-0.5, 0.5]
- float d = rgba2float(texture(tex, samplePos)) - 0.5;
-
- // Distance in output units (i.e. pixels)
- float dist = d * vsize.x;
-
- // Create smooth transition from the icon into its outline
- float fillAlphaFactor = clamp(0.5 - dist, 0.0, 1.0);
- fillPixelColor.a *= fillAlphaFactor;
-
- if (outlineSize > 0.25) {
- vec4 outlinePixelColor = outlineColor;
- float clampedOutlineSize = min(outlineSize, 0.5*vsize.x);
-
- // Create smooth transition around outline
- float outlineAlphaFactor = clamp(0.5 - (abs(dist) - 0.5*clampedOutlineSize), 0.0, 1.0);
- outlinePixelColor.a *= outlineAlphaFactor;
-
- if (
- outlineAlphaFactor + fillAlphaFactor < ${o} ||
- fillPixelColor.a + outlinePixelColor.a < ${w.float(oe)}
- ) {
- discard;
- }
-
- // perform un-premultiplied over operator (see https://en.wikipedia.org/wiki/Alpha_compositing#Description)
- float compositeAlpha = outlinePixelColor.a + fillPixelColor.a * (1.0 - outlinePixelColor.a);
- vec3 compositeColor = vec3(outlinePixelColor) * outlinePixelColor.a +
- vec3(fillPixelColor) * fillPixelColor.a * (1.0 - outlinePixelColor.a);
-
- ${z(!l,w`fragColor = vec4(compositeColor, compositeAlpha);`)}
- } else {
- if (fillAlphaFactor < ${o}) {
- discard;
- }
-
- ${z(!l,w`fragColor = premultiplyAlpha(fillPixelColor);`)}
- }
-
- // visualize SDF:
- // fragColor = vec4(clamp(-dist/vsize.x*2.0, 0.0, 1.0), clamp(dist/vsize.x*2.0, 0.0, 1.0), 0.0, 1.0);
- `:w`
- vec4 texColor = texture(tex, vtc, -0.5);
- if (texColor.a < ${o}) {
- discard;
- }
- ${z(!l,w`fragColor = texColor * premultiplyAlpha(vcolor);`)}
- `}
-
- ${z(e.occludedFragmentFade&&!l,w`
- float zSample = texelFetch(depthMap, ivec2(gl_FragCoord.xy), 0).x;
- if (zSample < gl_FragCoord.z) {
- fragColor *= fadeFactor;
- }
- `)}
-
- ${z(!l&&e.debugDrawLabelBorder,w`fragColor = mix(fragColor, vec4(1.0, 0.0, 1.0, 1.0), isBorder * 0.5);`)}
- `;switch(e.output){case E.Color:e.oitPass===Ue.ColorAlpha&&(t.outputs.add("fragColor","vec4",0),t.outputs.add("fragAlpha","float",1)),s.main.add(w`
- ${c}
- ${z(e.oitPass===Ue.FrontFace,w`fragColor.rgb /= fragColor.a;`)}
- ${z(e.oitPass===Ue.ColorAlpha,w`fragAlpha = fragColor.a;`)}`);break;case E.ObjectAndLayerIdColor:s.main.add(w`
- ${c}
- outputObjectAndLayerIdColor();`);break;case E.Highlight:t.include(gn,e),s.main.add(w`
- ${c}
- outputHighlight(voccluded == 1.0);`)}return t}function li(e){return e.outlineColor[3]>0&&e.outlineSize>0}function We(e,t=Yi){return e.textureIsSignedDistanceField?ul(e.anchorPosition,e.distanceFieldBoundingBox,t):Si(t,e.anchorPosition),t}function ul(e,t,r){t!=null?ft(r,e[0]*(t[2]-t[0])+t[0],e[1]*(t[3]-t[1])+t[1]):ft(r,0,0)}const Yi=lr(),fl=Object.freeze(Object.defineProperty({__proto__:null,build:Wi,calculateAnchorPosForRendering:We,shaderSettings:gr},Symbol.toStringTag,{value:"Module"}));let pl=class extends qn{constructor(e,t,r){super(e,t,new kn(fl,()=>Promise.resolve().then(()=>cc)),r),this.primitiveType=t.occlusionPass?Ur.POINTS:Ur.TRIANGLES}initializePipeline(e){const{oitPass:t,hasPolygonOffset:r,draped:i,output:s,depthTestEnabled:n}=e,a=t===Ue.NONE,o=r?ml:null,l=t===Ue.ColorAlpha,c=i||!n||l||s===E.Highlight?null:Na;return za({blending:s===E.Color?a?Ba:Wn(t):null,depthTest:n&&!i?{func:Sa.LEQUAL}:null,depthWrite:c,drawBuffers:Yn(t,s),colorWrite:Ga,polygonOffset:o})}};const ml={factor:0,units:-4};let D=class extends _n{constructor(e){super(),this.spherical=e,this.screenCenterOffsetUnitsEnabled=!1,this.occlusionTestEnabled=!0,this.signedDistanceFieldEnabled=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.vvSize=!1,this.vvColor=!1,this.hasVerticalOffset=!1,this.hasScreenSizePerspective=!1,this.hasRotation=!1,this.debugDrawLabelBorder=!1,this.hasSlicePlane=!1,this.hasPolygonOffset=!1,this.depthTestEnabled=!0,this.pixelSnappingEnabled=!0,this.draped=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.occlusionPass=!1,this.occludedFragmentFade=!1,this.objectAndLayerIdColorInstanced=!1,this.horizonCullingEnabled=!0,this.textureCoordinateType=vn.None,this.emissionSource=yn.None,this.discardInvisibleFragments=!0,this.hasSliceInVertexProgram=!0,this.hasVvInstancing=!1}};m([F()],D.prototype,"screenCenterOffsetUnitsEnabled",void 0),m([F()],D.prototype,"occlusionTestEnabled",void 0),m([F()],D.prototype,"signedDistanceFieldEnabled",void 0),m([F()],D.prototype,"sampleSignedDistanceFieldTexelCenter",void 0),m([F()],D.prototype,"vvSize",void 0),m([F()],D.prototype,"vvColor",void 0),m([F()],D.prototype,"hasVerticalOffset",void 0),m([F()],D.prototype,"hasScreenSizePerspective",void 0),m([F()],D.prototype,"hasRotation",void 0),m([F()],D.prototype,"debugDrawLabelBorder",void 0),m([F()],D.prototype,"hasSlicePlane",void 0),m([F()],D.prototype,"hasPolygonOffset",void 0),m([F()],D.prototype,"depthTestEnabled",void 0),m([F()],D.prototype,"pixelSnappingEnabled",void 0),m([F()],D.prototype,"draped",void 0),m([F()],D.prototype,"terrainDepthTest",void 0),m([F()],D.prototype,"cullAboveTerrain",void 0),m([F()],D.prototype,"occlusionPass",void 0),m([F()],D.prototype,"occludedFragmentFade",void 0),m([F()],D.prototype,"objectAndLayerIdColorInstanced",void 0),m([F()],D.prototype,"horizonCullingEnabled",void 0);class gl extends An{constructor(t,r){super(t,Sl),this.produces=new Map([[W.HUD_MATERIAL,i=>Ct(i)&&!this.parameters.drawInSecondSlot],[W.LABEL_MATERIAL,i=>Ct(i)&&this.parameters.drawInSecondSlot],[W.OCCLUSION_PIXELS,()=>this.parameters.occlusionTest],[W.DRAPED_MATERIAL,i=>this.parameters.draped&&Ct(i)]]),this._visible=!0,this._configuration=new D(r)}getConfiguration(t,r){return this._configuration.output=t,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled=this.parameters.centerOffsetUnits==="screen",this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=this.parameters.draped,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=r.slot===W.OCCLUSION_PIXELS,this._configuration.occludedFragmentFade=this.parameters.occludedFragmentFade,this._configuration.horizonCullingEnabled=this.parameters.horizonCullingEnabled,this._configuration.depthTestEnabled=this.parameters.depthEnabled||r.slot===W.OCCLUSION_PIXELS,t===E.Color&&(this._configuration.debugDrawLabelBorder=!!Wt.LABELS_SHOW_BORDER),this._configuration.oitPass=r.oitPass,this._configuration.terrainDepthTest=r.terrainDepthTest,this._configuration.cullAboveTerrain=r.cullAboveTerrain,this._configuration}intersect(t,r,i,s,n,a){const{options:{selectionMode:o,hud:l,excludeLabels:c},point:d,camera:h}=i,{parameters:u}=this;if(!o||!l||c&&u.isLabel||!t.visible||!d)return;const{scaleX:f,scaleY:_}=this._getScreenScale(t,h.pixelRatio);dr(Lt,r),t.attributes.has(p.FEATUREATTRIBUTE)&&yl(Lt);const g=t.attributes.get(p.POSITION),C=t.attributes.get(p.SIZE),I=t.attributes.get(p.NORMAL),x=t.attributes.get(p.ROTATION),O=t.attributes.get(p.CENTEROFFSETANDDISTANCE);N(g.size>=3);const M=We(u),y=this.parameters.centerOffsetUnits==="screen";for(let P=0;P-1){y&&(k[0]||k[1])&&(V[0]+=k[0]*h.pixelRatio,k[1]!==0&&(V[1]+=En(k[1],Ft.factorAlignment)*h.pixelRatio),h.unapplyProjection(V,G)),V[0]+=this.parameters.screenOffset[0]*h.pixelRatio,V[1]+=this.parameters.screenOffset[1]*h.pixelRatio,V[0]=Math.floor(V[0]),V[1]=Math.floor(V[1]);const Je=P*C.size;$[0]=C.data[Je],$[1]=C.data[Je+1],Mn($,Ft.factor,$);const rs=Il*h.pixelRatio;let _r=0;u.textureIsSignedDistanceField&&(_r=Math.min(u.outlineSize,.5*$[0])*h.pixelRatio/2),$[0]*=f,$[1]*=_;const is=P*x.size,ss=u.rotation+x.data[is];if(hi(d,V[0],V[1],$,rs,_r,ss,u,M)){const vr=i.ray;if(_e(di,G,Pe(bl,h.viewMatrix)),V[0]=d[0],V[1]=d[1],h.unprojectFromRenderScreen(V,G)){const Ne=A();j(Ne,vr.direction);const yr=1/me(Ne);Z(Ne,Ne,yr),a(Mi(vr.origin,G)*yr,Ne,-1,!0,1,di)}}}}}intersectDraped(t,r,i,s,n,a){const o=t.attributes.get(p.POSITION),l=t.attributes.get(p.SIZE),c=t.attributes.get(p.ROTATION),d=this.parameters,h=We(d),{scaleX:u,scaleY:f}=this._getScreenScale(t,t.screenToWorldRatio),_=Cl*t.screenToWorldRatio;for(let g=0;g0?d:1/d),n}_applyVerticalGroundOffsetView(t,r,i,s){const n=me(t),a=i.aboveGround?1:-1,o=i.computeRenderPixelSizeAtDist(n)*ki,l=Z(G,r.normal,a*o);return ht(s,t,l),s}_applyVerticalOffsetTransformationView(t,r,i,s){const n=this.parameters;if(!n.verticalOffset?.screenLength){if(n.screenSizePerspective||n.screenSizePerspectiveAlignment){const c=me(t);this._updateScaleInfo(s,c,r.cosAngle)}else s.factor.scale=1,s.factorAlignment.scale=1;return t}const a=me(t),o=n.screenSizePerspectiveAlignment??n.screenSizePerspective,l=Dn(i,a,n.verticalOffset,r.cosAngle,o);return this._updateScaleInfo(s,a,r.cosAngle),Z(r.normal,r.normal,l),ht(t,t,r.normal)}_applyCenterOffsetView(t,r,i){const s=this.parameters.centerOffsetUnits!=="screen";return i!==t&&j(i,t),s&&(i[0]+=r[0],i[1]+=r[1],r[2]&&(he(Ge,i),ht(i,i,Z(Ge,Ge,r[2])))),i}_applyCenterOffsetNDC(t,r,i,s){const n=this.parameters.centerOffsetUnits!=="screen";return s!==t&&j(s,t),n||(s[0]+=r[0]/i.fullWidth*2,s[1]+=r[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(t,r,i,s){const n=this.parameters.shaderPolygonOffset;if(t!==s&&j(s,t),n){const a=i.aboveGround?1:-1,o=a*Math.sign(r[3]);s[2]-=(o||a)*n}return s}set visible(t){this._visible=t}get visible(){const{color:t,outlineSize:r,outlineColor:i}=this.parameters,s=t[3]>=oe||r>=oe&&i[3]>=oe;return this._visible&&s}createGLMaterial(t){return new _l(t)}calculateRelativeScreenBounds(t,r,i=Ii()){return vl(this.parameters,t,r,i),i[2]=i[0]+t[0],i[3]=i[1]+t[1],i}_getScreenScale(t,r){const i=t.attributes.get(p.FEATUREATTRIBUTE);if(i==null)return{scaleX:r,scaleY:r};const s=Zs(i.data,xl);return Pn(Nt,this.parameters,s),{scaleX:Nt[0]*r,scaleY:Nt[1]*r}}}class _l extends Fn{constructor(t){super({...t,...t.material.parameters})}beginSlot(t){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.acquireTechnique(pl,t)}}function vl(e,t,r,i){i[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*r,i[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*r}function ci(e,t,r,i){return ol(t)&&(t=dr(wl,t)),oa(i.normal,e,t),_e(i.normal,i.normal,r.viewInverseTransposeMatrix),i.cosAngle=qe(Qi,Tl),i}function yl(e){const t=e[0],r=e[1],i=e[2],s=e[3],n=e[4],a=e[5],o=e[6],l=e[7],c=e[8],d=1/Math.sqrt(t*t+r*r+i*i),h=1/Math.sqrt(s*s+n*n+a*a),u=1/Math.sqrt(o*o+l*l+c*c);return e[0]=t*d,e[1]=r*d,e[2]=i*d,e[3]=s*h,e[4]=n*h,e[5]=a*h,e[6]=o*u,e[7]=l*u,e[8]=c*u,e}function hi(e,t,r,i,s,n,a,o,l){let c=t-s-i[0]*l[0],d=c+i[0]+2*s,h=r-s-i[1]*l[1],u=h+i[1]+2*s;const f=o.distanceFieldBoundingBox;return o.textureIsSignedDistanceField&&f!=null&&(c+=i[0]*f[0],h+=i[1]*f[1],d-=i[0]*(1-f[2]),u-=i[1]*(1-f[3]),c-=n,d+=n,h-=n,u+=n),ft(ui,t,r),tn(Ve,e,ui,Ps(a)),Ve[0]>c&&Ve[0]h&&Ve[1]=4&&(l=o[0],c=o[1],d=o[2],h=o[3]),d=Math.min(1.99999,d+1),h=Math.min(1.99999,h+1);let u=i.get(p.POSITION).indices.length,f=a;const _=n.uv0;for(let x=0;xbs(o))]),n=a}break;default:throw new Error(`unable to create unknown material type ${e.type}`)}this._materials.set(e.materialId,n)}_getMaterial(e){return this._materials.get(e)}async _createDirectRenderer(e){const t=e.materialId,r=this._getMaterial(t);if(r==null)throw new Error(`material not found ${t}`);const{view:i}=this,s=new dt({material:r});this._directRenderers.set(t,s),i._stage.addRenderPlugin(s),i._stage.renderView.renderer.updateHasFlags()}async _addDirectRendererGeometry(e){const t=e.renderGeometryId,r=e.materialId;this._renderGeometries.get(t)!=null&&await this._removeDirectRendererGeometry({renderGeometryId:t});const i=this._directRenderers.get(r);if(i==null)return void console.error("no renderer assigned to provided material");const s=i.addRenderGeometry(t,e.renderGeometryBuffer,e.localOrigin);this._renderGeometries.set(t,{renderGeometry:s,materialId:r}),this.view._stage.renderView.requestRender()}async _removeDirectRendererGeometry(e){const t=e.renderGeometryId,r=this._renderGeometries.get(t);if(r==null)return;const i=r.materialId,s=this._directRenderers.get(i);s!=null?s.removeRenderGeometry(e.renderGeometryId):console.error("no renderer assigned to provided material")}async _createLodRenderer(e){const t=new rr({view:this.view,layerUid:this.layerUid}),r=new AbortController,i=s=>this._getMaterial(s);await t.doLoad(e.lodRenderGeometry,i,r.signal),this._lodRenderers.set(e.lodRendererId,t)}async _addLodInstances(e){const t=this._lodRenderers.get(e.lodRendererId);if(t==null)throw new Error("no lod renderer assigned to provided lod renderer Id");t.addInstances(e.data)}async _removeLodInstances(e){const t=this._lodRenderers.get(e.lodRendererId);if(t==null)throw new Error("no lod renderer assigned to provided lod renderer Id");t.removeInstances(e.featureIds)}};function Xi(e,t){const r={anchorPosition:io.center,occlusionTest:!0,hasSlicePlane:!1},i=r,s=1;i.color=[1,0,0,1],i.outlineColor=[0,0,0,1],i.outlineSize=s;const n=null;if(e!=null){const a=e.fromData("circle-icon",()=>Jo("circle"));i.textureId=a.texture.id,i.textureIsSignedDistanceField=!0,i.sampleSignedDistanceFieldTexelCenter=Qo("circle")}return i.distanceFieldBoundingBox=Ml,[new gl(r,t),n]}function Al(e,t,r){const i={usePBR:t.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:Un,ambient:qt,diffuse:qt,hasSlicePlane:t.slicePlaneEnabled,hasSliceHighlight:!1,castShadows:t.castShadows,offsetTransparentBackfaces:!t.isPrimitive};return El(i),i.screenSizePerspective=e.screenSizePerspectiveSettings,i.externalColor=Ks,i.isInstanced=!0,new Ei(i,{spherical:r,doublePrecisionRequiresObfuscation:!0})}function El(e){const t=e.opacity??1,r=t<1;return e.transparent=r,e.opacity=t,e.cullFace=r?Mr.None:Mr.Back,e}fi=m([K("esri.views.3d.layers.graphics.pipeline.rendering.FeaturePipelineRenderManager")],fi);const Ml=[De/2,De/2,1-De/2,1-De/2];let pi=class{constructor(e){this._bufferWriter=null,this._bufferWriter=e.createBufferWriter()}createBuffer(e,t){const r=this._bufferWriter;let i=null;if(e.transformation&&t)ce(xe,e.transformation),xe[12]-=t[0],xe[13]-=t[1],xe[14]-=t[2],i=xe;else{if(t)throw new Error("not implemented");e.transformation&&(i=e.transformation)}let s=null;i&&(Pe(ot,xe),cr(ot,ot),s=ot);const n=e.attributes,a=r.elementCount(n),o=r.vertexBufferLayout.stride/4;a>Math.floor(Dl/o)&&console.warn("geometry with very large number of elements encountered");const l=r.vertexBufferLayout.createBuffer(a);return r.write(i,s,n,e.objectAndLayerIdColor,l,0),{data:l.buffer,elementCount:a}}};const xe=L(),ot=L(),Dl=16777216/4;let Pl=class{constructor(e){this._context=e,this._commands=[],this._transferables=new Set}createMaterial(e){const t=this._context,r=t.generateId("material");switch(e){case"default":{const i=new Ei({},{spherical:this._context.globalViewingMode,doublePrecisionRequiresObfuscation:!0}),s=new pi(i);t.registerRenderGeometryBufferWriter(r,s)}break;case"hud":{const i=Xi(null,this._context.globalViewingMode)[0],s=new pi(i);t.registerRenderGeometryBufferWriter(r,s)}}return this._commands.push({id:"create-material",type:e,materialId:r}),r}createDirectRenderer(e){const t=this._context.generateId("material-renderer");return this._commands.push({id:"create-direct-renderer",materialRendererId:t,materialId:e}),t}addDirectRendererGeometry(e,t,r){const i=t.materialId,s=this._context.getRenderGeometryBufferWriter(i);if(s==null)throw new Error(`no bufferwriter found for material ${i}`);const n=s.createBuffer(t,r);this._transferables.add(n.data),this._commands.push({id:"add-direct-renderer-geometry",renderGeometryId:e,materialId:i,renderGeometryBuffer:n,localOrigin:r})}removeDirectRendererGeometry(e){this._commands.push({id:"remove-direct-renderer-geometry",renderGeometryId:e})}createLodRenderer(e){const t=this._context.generateId("lod-renderer"),r={levels:e.levels.map(i=>({components:i.components.map(s=>{const n=s.attributes.get(p.POSITION);if(!n||n.indices.length===0)throw new Error("positions attribute expected");const a=3,o=Qs(n.indices.length/a),l=new $n(o,a,n),c=this._context.getRenderGeometryBufferWriter(s.materialId);if(c==null)throw new Error("writer not found");const d=c.createBuffer(s,null);return this._transferables.add(d.data),{materialId:s.materialId,renderGeometryBuffer:d,boundingInfo:{bbMax:l.bbMax,bbMin:l.bbMin}}}),minScreenSpaceRadius:i.minScreenSpaceRadius}))};return this._commands.push({id:"create-lod-renderer",lodRendererId:t,lodRenderGeometry:r}),t}addLodInstances(e,t){this._commands.push({id:"add-lod-instances",lodRendererId:e,data:t}),this._transferables.add(t.featureIds.buffer),this._transferables.add(t.globalTransforms.buffer),this._transferables.add(t.localTransforms.buffer)}removeLodInstances(e,t){this._commands.push({id:"remove-lod-instances",lodRendererId:e,featureIds:t}),this._transferables.add(t.buffer)}async dispatch(){const e=this._commands,t=Array.from(this._transferables);this._clearCommandBuffer(),this._context.dispatchRenderCommands(e,t)}_clearCommandBuffer(){this._commands=[],this._transferables.clear()}},Fl=class{constructor(e){this._idCounter=0,this._bufferWriters=new Map,this._dispatchRenderCommandsCallback=async()=>{},this.globalViewingMode=!1,this.globalViewingMode=e.viewingMode===ne.Global,this._dispatchRenderCommandsCallback=e.dispatchRenderCommandsCallback}generateId(e=""){return`${e}${this._idCounter++}`}createEncoder(){return new Pl(this)}async dispatchRenderCommands(e,t){this._dispatchRenderCommandsCallback(e,t)}registerRenderGeometryBufferWriter(e,t){this._bufferWriters.set(e,t)}getRenderGeometryBufferWriter(e){return this._bufferWriters.get(e)}};var q;(function(e){e[e.OBJECT_ID=0]="OBJECT_ID",e[e.PARTITION_ID=1]="PARTITION_ID",e[e.GEOMETRY_MAP_COORDINATES=2]="GEOMETRY_MAP_COORDINATES",e[e.GEOMETRY_RENDER_COORDINATES=3]="GEOMETRY_RENDER_COORDINATES",e[e.TILE_CENTER_RENDER_COORDINATES=4]="TILE_CENTER_RENDER_COORDINATES"})(q||(q={}));async function Ll(e,t){const{numFeatures:r,tile:i,partitionInfo:s}=e,{pages:n}=i;if(n.length===0||r===0)return new Uint32Array;const a=new Uint32Array(r);if(s){const o=n.reduce((h,{featureCount:u})=>h+u,0),l=new Uint32Array(o);let c=0;for(const h of n)c=h.readAllObjectIds(l,c);const d=s.tileIndices;for(let h=0;hh+u,0),l=new Float64Array(3*o);let c=0;for(const h of n)c=h.readAllCoordinates(l,c);const d=s.tileIndices;for(let h=0;h=0;o--){const l=e[o];let c;const d=l!=null,h=o===0&&!n&&!d,u=r[o];l==="symbol-value"||h?c=u!==0?t[o]/u:1:d&&l!=="proportional"&&isFinite(l)&&(c=u!==0?l/u:1),c!=null&&(s[o]=c,n=c,a=Math.max(a,Math.abs(c)))}for(let o=2;o>=0;o--)s[o]==null?s[o]=n:s[o]===0&&(s[o]=.001*a)}for(let n=2;n>=0;n--)s[n]/=i;return $t(s)}function Ki(e){const t=new Map;for(const[r,i]of e)t.set(r,{...i,indices:Js(i.indices)});return t}var mi;(function(e){function t(a,o){const l=a[o],c=a[o+1],d=a[o+2];return Math.sqrt(l*l+c*c+d*d)}function r(a,o){const l=a[o],c=a[o+1],d=a[o+2],h=1/Math.sqrt(l*l+c*c+d*d);a[o]*=h,a[o+1]*=h,a[o+2]*=h}function i(a,o,l){a[o]*=l,a[o+1]*=l,a[o+2]*=l}function s(a,o,l,c,d,h=o){(d=d||a)[h]=a[o]+l[c],d[h+1]=a[o+1]+l[c+1],d[h+2]=a[o+2]+l[c+2]}function n(a,o,l,c,d,h=o){(d=d||a)[h]=a[o]-l[c],d[h+1]=a[o+1]-l[c+1],d[h+2]=a[o+2]-l[c+2]}e.length=t,e.normalize=r,e.scale=i,e.add=s,e.subtract=n})(mi||(mi={}));const Vl=new Array(36);for(let e=0;e<6;e++)for(let t=0;t<6;t++)Vl[6*e+t]=e;const Ie=new Array(36);for(let e=0;e<6;e++)Ie[6*e]=0,Ie[6*e+1]=1,Ie[6*e+2]=2,Ie[6*e+3]=2,Ie[6*e+4]=3,Ie[6*e+5]=0;const Bt=re(-.5,0,-.5),Gt=re(.5,0,-.5),Vt=re(0,0,.5),jt=re(0,.5,0),Ce=Ye(),Te=Ye(),Se=Ye(),Oe=Ye(),Re=Ye();Y(Ce,Bt,jt),Y(Te,Bt,Gt),$e(Se,Ce,Te),he(Se,Se),Y(Ce,Gt,jt),Y(Te,Gt,Vt),$e(Oe,Ce,Te),he(Oe,Oe),Y(Ce,Vt,jt),Y(Te,Vt,Bt),$e(Re,Ce,Te),he(Re,Re),Se[0],Se[1],Se[2],Oe[0],Oe[1],Oe[2],Re[0],Re[1],Re[2];function jl(e,t,r,i,s=!0,n=!0){let a=0;const o=t,l=e;let c=re(0,a,0),d=re(0,a+l,0),h=re(0,-1,0),u=re(0,1,0);const f=[d,c],_=[h,u],g=r+2,C=Math.sqrt(l*l+o*o);for(let y=0;y({levels:i.map(a=>{const o=Ki(s(a.tesselation));return n&&Ul(o),{components:[{attributes:o,objectAndLayerIdColor:void 0,transformation:null,materialId:t}],minScreenSpaceRadius:a.minScreenSpaceRadius}})});switch(e){case"cone":return r($l,i=>jl(1,.5,i),!0);case"sphere":case"cube":case"inverted-cone":case"cylinder":case"tetrahedron":case"diamond":throw new Error("not implemented");default:return}}function Ul(e){const t=e,r=t.get(p.POSITION).data,i=t.get(p.NORMAL).data;if(i){const s=gi(e,p.NORMAL).data;for(let n=0;n{const n=await this._provisionSymbol(s.partitionInfo?.index,r);n&&await n.add(s,r)}))}async remove(t,r){const i=t.partitions;if(!i)throw new Error("partitioned featureset expected");await Promise.all(i.map(async s=>{const n=await this._provisionSymbol(s.partitionInfo?.index,r);n&&await n.remove(s,r)}))}async _provisionFeatureData(t,r){await t.provision([q.PARTITION_ID,q.OBJECT_ID],r)}async _provisionSymbol(t,r){if(t==null)return null;const i=this._symbols.get(t);return i?(i.loaded||await i.load(r),i):null}_partition(t){const{numFeatures:r,objectIds:i,partitionIds:s}=t,n=[[],[]];for(let a=0;aa.length>0).map((a,o)=>{const l=a.length,c={index:o,tileIndices:new Uint32Array(a)};return new Zi(t.tile,l,c)}),t.partitions}}function Yl(e,t,r){return!!gt(e,t,ct,r.spatialReference)&&(r.x=ct[0],r.y=ct[1],r.z=ct[2],!0)}const ct=A();function Ql(e){const{value:t,operations:r}=e;return{operations:r,value:r.create(t)}}function Jl(e,t,r){return e.operations.setExtent(e.value,t,r.value),r}function Xl(e,t){return e.operations.getExtent(e.value,t),t}function Zl(e){return{operations:e,value:e.create()}}function es(e,t,r=Zl(e)){return r.operations=e,e.copy(t,r.value),r}function Kl(e){return es(ma,pa(0,0,0,Ci(e).radius))}const _i=2**50;function ec(){return es(Ra,Oa([0,0,0],[_i,0,0],[0,_i,0]))}function tc(e,t,r){return e.operations.axisAt(e.value,t,je.Z,r)}function rc(e,t,r,i){return e.operations.axisAt(e.value,t,r,i)}function ic(e,t,r){return e.operations.intersectRay(e.value,t,r)}function sc(e,t,r){return e.operations.intersectRayClosestSilhouette(e.value,t,r)}function nc(e,t){return e.operations.altitudeAt(e.value,t)}function ts(e,t,r,i){return e.operations.setAltitudeAt(e.value,t,r,i)}function ac(e,t,r,i){return t!==i&&ce(i,t),ie(Ae,i[12],i[13],i[14]),ts(e,Ae,r,Ae),i[12]=Ae[0],i[13]=Ae[1],i[14]=Ae[2],i}function Ht(e,t,r){return e.operations.elevate(e.value,t,r.value)}const Ae=A();function vi(e){return e.type==="point"}class bt{constructor(t,r,i,s){this.viewingMode=t,this.spatialReference=r,this.unitInMeters=i,this._coordinateSystem=s,this._tmpCoordinateSystem=Ql(s),this.referenceEllipsoid=Ci(r),this.sphericalPCPF=Ha(r)}set extent(t){t&&Jl(this._coordinateSystem,t,this._coordinateSystem)}get extent(){return Xl(this._coordinateSystem,Ii())}getAltitude(t){return nc(this._coordinateSystem,t)}setAltitude(t,r,i=t){return ts(this._coordinateSystem,i,r,t)}setAltitudeOfTransformation(t,r){ac(this._coordinateSystem,r,t,r)}worldUpAtPosition(t,r){return tc(this._coordinateSystem,t,r)}worldBasisAtPosition(t,r,i){return rc(this._coordinateSystem,t,r,i)}basisMatrixAtPosition(t,r){const i=this.worldBasisAtPosition(t,je.X,de.get()),s=this.worldBasisAtPosition(t,je.Y,de.get()),n=this.worldBasisAtPosition(t,je.Z,de.get());return ia(r,i[0],i[1],i[2],0,s[0],s[1],s[2],0,n[0],n[1],n[2],0,0,0,0,1),r}headingAtPosition(t,r){const i=this.worldUpAtPosition(t,de.get()),s=this.worldBasisAtPosition(t,je.Y,de.get()),n=ya(r,s,i);return Ls(n)}intersectManifoldClosestSilhouette(t,r,i){return Ht(this._coordinateSystem,r,this._tmpCoordinateSystem),sc(this._tmpCoordinateSystem,t,i),i}intersectManifold(t,r,i){Ht(this._coordinateSystem,r,this._tmpCoordinateSystem);const s=de.get();return ic(this._tmpCoordinateSystem,t,s)?j(i,s):null}intersectInfiniteManifold(t,r,i){if(this.viewingMode===ne.Global)return this.intersectManifold(t,r,i);Ht(this._coordinateSystem,r,this._tmpCoordinateSystem);const s=this._tmpCoordinateSystem.value,n=de.get();return wa(s.plane,t,n)?j(i,n):null}toRenderCoords(t,r,i){return vi(t)?Ua(t,r,this.spatialReference):gt(t,r,i,this.spatialReference)}fromRenderCoords(t,r,i=null){return vi(r)?(i!=null&&(r.spatialReference=i),Yl(t,this.spatialReference,r)?r:null):gt(t,this.spatialReference,r,i)?r:null}static create(t,r){switch(t){case ne.Local:return new bt(ne.Local,r,Ns(r),ec());case ne.Global:return new bt(ne.Global,r,1,Kl(r))}}static renderUnitScaleFactor(t,r){return Ir(t)/Ir(r)}}class oc{constructor(t){this._tileFeatureData=new Map,this._context={viewSpatialReference:t.viewSpatialReference,renderSpatialReference:t.renderSpatialReference,renderCoordsHelper:bt.create(t.viewingMode,t.renderSpatialReference)}}async add(t,r){this._featureRenderer||(this._featureRenderer=new Wl(this._context),await this._featureRenderer.load());const i=this._addTileFeatureData(t);await this._featureRenderer.add(i,r)}async remove(t,r){const i=this._getFeatureSetFromTileId(t);i&&(this._featureRenderer&&this._featureRenderer.remove(i,r),this._removeTileFeatureData(t))}_getFeatureSetFromTileId(t){return this._tileFeatureData.get(t)}_addTileFeatureData(t){const r=t.descriptor.id,i=t.pages.reduce((n,{featureCount:a})=>n+a,0),s=new Zi(t,i);return this._tileFeatureData.set(r,s),s}_removeTileFeatureData(t){const r=this._tileFeatureData.get(t);r&&(r.dispose(),this._tileFeatureData.delete(t))}}let ut=class extends ar.EventedAccessor{constructor(){super(...arguments),this.remoteClient=null,this._featureStore=new Ya,this._tileManager=new fe({addTile:(e,t)=>this._addTile(e,t),removeTiles:e=>this._removeTiles(e)}),this._renderCommandContext=null,this._fetcher=null,this._symbolizer=null,this._queryEngine=null,this._defaultQueryJSON=null}get updating(){return this._tileManager.updating}destroy(){this._featureStore.clear(),this._tileManager.destroy()}async setup({viewSpatialReference:e,renderSpatialReference:t,viewingMode:r,baseQuery:i,url:s,objectIdField:n,capabilities:a,fieldsIndex:o,timeInfo:l}){this._renderCommandContext=new Fl({viewingMode:r,dispatchRenderCommandsCallback:(h,u)=>this.remoteClient.invoke("dispatchRenderCommands",h,{transferList:u})});const c=wr.fromJSON(e),d=wr.fromJSON(t);return this._fetcher=new ro(c,Cr.fromJSON(i),s,n,a),this._symbolizer=new oc({viewSpatialReference:c,renderSpatialReference:d,viewingMode:r}),this._queryEngine=new Gs({hasZ:!0,hasM:!1,geometryType:"esriGeometryPoint",objectIdField:n,fieldsIndex:o,availableFields:[n],spatialReference:e,featureStore:this._featureStore,timeInfo:l}),this._defaultQueryJSON=new Cr({outSpatialReference:c}).toJSON(),this.addHandles(ns(()=>this.updating,async h=>{this.emit("notify-updating",{updating:h})}),as),yi}async executeQuery(e,t){return{result:await this._queryEngine.executeQuery(this._ensureQuery(e),t)}}async executeQueryForIds(e,t){const r=await this._queryEngine.executeQueryForIdSet(this._ensureQuery(e),t);return{result:Array.from(r)}}async executeQueryForCount(e,t){return{result:await this._queryEngine.executeQueryForCount(this._ensureQuery(e),t)}}async executeQueryForExtent(e,t){return{result:await this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t)}}async executeQueryForLatestObservations(e,t){return{result:await this._queryEngine.executeQueryForLatestObservations(this._ensureQuery(e),t)}}async onTileTreeChange(e){return await this._tileManager.onTileTreeChange(e),yi}async _addTile(e,t){const r=await this._fetcher.fetch(e,t);ve(t),this._featureStore.addTile(r);const i=this._renderCommandContext.createEncoder();return await this._symbolizer.add(r,i),await i.dispatch(),r}async _removeTiles(e){const t=this._renderCommandContext.createEncoder(),r=this._featureStore,i=this._symbolizer;for(const s of e)r.removeTile(s.tileId),await i.remove(s.tileId,t);await t.dispatch()}_ensureQuery(e){return e??this._defaultQueryJSON}};m([v()],ut.prototype,"updating",null),ut=m([K("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorker")],ut);const lc=ut,yi={result:void 0},Kh=Object.freeze(Object.defineProperty({__proto__:null,default:lc},Symbol.toStringTag,{value:"Module"})),ed=Object.freeze(Object.defineProperty({__proto__:null,build:sn},Symbol.toStringTag,{value:"Module"})),td=Object.freeze(Object.defineProperty({__proto__:null,build:nn,getRadius:an},Symbol.toStringTag,{value:"Module"})),rd=Object.freeze(Object.defineProperty({__proto__:null,build:on},Symbol.toStringTag,{value:"Module"})),id=Object.freeze(Object.defineProperty({__proto__:null,build:ln},Symbol.toStringTag,{value:"Module"})),cc=Object.freeze(Object.defineProperty({__proto__:null,build:Wi,calculateAnchorPosForRendering:We,shaderSettings:gr},Symbol.toStringTag,{value:"Module"}));export{rd as D,Kh as F,id as R,ed as S,td as a};
diff --git a/fix-191/assets/HeightModelInfo-C5vFqzyF-B3QZnpVY.js b/fix-191/assets/HeightModelInfo-C5vFqzyF-B3QZnpVY.js
deleted file mode 100644
index 9ec2e5f8..00000000
--- a/fix-191/assets/HeightModelInfo-C5vFqzyF-B3QZnpVY.js
+++ /dev/null
@@ -1 +0,0 @@
-import{cr as c,cJ as p,v as s,S as l,ac as v,a0 as a,e as y,cK as m,cL as w,b0 as g,i as S}from"./story-DULt3Rma.js";var n;const h=c()({orthometric:"gravity-related-height",gravity_related_height:"gravity-related-height",ellipsoidal:"ellipsoidal"}),u=h.jsonValues.slice();p(u,"orthometric");const o=c()({meter:"meters",foot:"feet","us-foot":"us-feet","clarke-foot":"clarke-feet","clarke-yard":"clarke-yards","clarke-link":"clarke-links","sears-yard":"sears-yards","sears-foot":"sears-feet","sears-chain":"sears-chains","benoit-1895-b-chain":"benoit-1895-b-chains","indian-yard":"indian-yards","indian-1937-yard":"indian-1937-yards","gold-coast-foot":"gold-coast-feet","sears-1922-truncated-chain":"sears-1922-truncated-chains","50-kilometers":"50-kilometers","150-kilometers":"150-kilometers"});let r=n=class extends y{constructor(e){super(e),this.heightModel="gravity-related-height",this.heightUnit="meters",this.vertCRS=null}writeHeightModel(e,t,i){return h.write(e,t,i)}readHeightModel(e,t,i){return h.read(e)||(i?.messages&&i.messages.push(f(e,{context:i})),null)}readHeightUnit(e,t,i){return o.read(e)||(i?.messages&&i.messages.push(d(e,{context:i})),null)}readHeightUnitService(e,t,i){return m(e)||o.read(e)||(i?.messages&&i.messages.push(d(e,{context:i})),null)}readVertCRS(e,t){return t.vertCRS||t.ellipsoid||t.geoid}clone(){return new n({heightModel:this.heightModel,heightUnit:this.heightUnit,vertCRS:this.vertCRS})}equals(e){return!!e&&(this===e||this.heightModel===e.heightModel&&this.heightUnit===e.heightUnit&&this.vertCRS===e.vertCRS)}static deriveUnitFromSR(e,t){const i=w(t);return new n({heightModel:e.heightModel,heightUnit:i??void 0,vertCRS:e.vertCRS})}write(e,t){return t={origin:"web-scene",...t},super.write(e,t)}static fromJSON(e){if(!e)return null;const t=new n;return t.read(e,{origin:"web-scene"}),t}};function d(e,t){return new g("height-unit:unsupported",`Height unit of value '${e}' is not supported`,t)}function f(e,t){return new g("height-model:unsupported",`Height model of value '${e}' is not supported`,t)}s([l({type:h.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:u,default:"ellipsoidal"}}}})],r.prototype,"heightModel",void 0),s([v("web-scene","heightModel")],r.prototype,"writeHeightModel",null),s([a(["web-scene","service"],"heightModel")],r.prototype,"readHeightModel",null),s([l({type:o.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:o.jsonValues,write:o.write}}}})],r.prototype,"heightUnit",void 0),s([a("web-scene","heightUnit")],r.prototype,"readHeightUnit",null),s([a("service","heightUnit")],r.prototype,"readHeightUnitService",null),s([l({type:String,constructOnly:!0,json:{origins:{"web-scene":{write:!0}}}})],r.prototype,"vertCRS",void 0),s([a("service","vertCRS",["vertCRS","ellipsoid","geoid"])],r.prototype,"readVertCRS",null),r=n=s([S("esri.geometry.HeightModelInfo")],r);const U=r;export{U as M};
diff --git a/fix-191/assets/HighlightCounter-DFWq7PnG-L3ompOf4.js b/fix-191/assets/HighlightCounter-DFWq7PnG-L3ompOf4.js
deleted file mode 100644
index 4322ddeb..00000000
--- a/fix-191/assets/HighlightCounter-DFWq7PnG-L3ompOf4.js
+++ /dev/null
@@ -1 +0,0 @@
-const r=new Set;class u{constructor(){this._idToCounters=new Map}get empty(){return this._idToCounters.size===0}addGroup(n,e){for(const o of n){let t=this._idToCounters.get(o);t||(t=new Map,this._idToCounters.set(o,t)),t.set(e,(t.get(e)||0)+1)}}deleteGroup(n,e){for(const o of n){const t=this._idToCounters.get(o);if(!t)continue;let s=t.get(e);if(s==null)return;s--,s>0?t.set(e,s):t.delete(e),t.size===0&&this._idToCounters.delete(o)}}getHighlightGroups(n){const e=this._idToCounters.get(n);if(!e)return r;const o=new Set;for(const[t,s]of e)s>0&&o.add(t);return o}ids(){return this._idToCounters.keys()}}export{u as i};
diff --git a/fix-191/assets/HighlightGraphicContainer-Dt5r6lMq-CApzVsMQ.js b/fix-191/assets/HighlightGraphicContainer-Dt5r6lMq-CApzVsMQ.js
deleted file mode 100644
index f9997494..00000000
--- a/fix-191/assets/HighlightGraphicContainer-Dt5r6lMq-CApzVsMQ.js
+++ /dev/null
@@ -1 +0,0 @@
-import{v as i,i as s}from"./story-DULt3Rma.js";import{E as a,h,R as n}from"./MapView-BGOJJ8ch-D1TWNssr.js";import{K as l}from"./AGraphicContainer-LUCT6Gle-Dcauzal2.js";let r=class extends l{get hasHighlight(){return this.children.some(e=>e.hasData)}renderChildren(e){this.attributeView.update(),e.drawPhase===a.HIGHLIGHT&&this.children.some(t=>t.hasData)&&(super.renderChildren(e),e.context.setColorMask(!0,!0,!0,!0),h(e,!0,t=>{this._renderChildren(t,n.All)},0))}};r=i([s("esri.views.2d.layers.graphics.HighlightGraphicContainer")],r);const m=r;export{m as l};
diff --git a/fix-191/assets/I3SBinaryReader-DEbI3cKZ-DNxJmfIw.js b/fix-191/assets/I3SBinaryReader-DEbI3cKZ-DNxJmfIw.js
deleted file mode 100644
index f391d15b..00000000
--- a/fix-191/assets/I3SBinaryReader-DEbI3cKZ-DNxJmfIw.js
+++ /dev/null
@@ -1,2 +0,0 @@
-import{o as f,a1 as D,P as S}from"./story-DULt3Rma.js";import{T as U}from"./VertexAttribute-DqD5S0a2-3q90nikV.js";const d=!0,m={identifierOffset:0,identifierLength:10,versionOffset:10,checksumOffset:12,byteCount:16};function z(t,e,r){return{identifier:String.fromCharCode.apply(null,new Uint8Array(t,r+m.identifierOffset,m.identifierLength)),version:e.getUint16(r+m.versionOffset,d),checksum:e.getUint32(r+m.checksumOffset,d)}}const y={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 k(t,e){return{sizeLo:t.getUint32(e+y.sizeLo,d),sizeHi:t.getUint32(e+y.sizeHi,d),minX:t.getFloat64(e+y.minX,d),minY:t.getFloat64(e+y.minY,d),minZ:t.getFloat64(e+y.minZ,d),maxX:t.getFloat64(e+y.maxX,d),maxY:t.getFloat64(e+y.maxY,d),maxZ:t.getFloat64(e+y.maxZ,d),errorX:t.getFloat64(e+y.errorX,d),errorY:t.getFloat64(e+y.errorY,d),errorZ:t.getFloat64(e+y.errorZ,d),count:t.getUint32(e+y.count,d),reserved:t.getUint32(e+y.reserved,d)}}function q(t){const e=new DataView(t,0);let r=0;const{identifier:c,version:o}=z(t,e,r);if(r+=m.byteCount,c!=="LEPCC ")throw new f("lepcc-decode-error","Bad identifier");if(o>1)throw new f("lepcc-decode-error","Unknown version");const n=k(e,r);if(r+=y.byteCount,n.sizeHi*2**32+n.sizeLo!==t.byteLength)throw new f("lepcc-decode-error","Bad size");const s=new Float64Array(3*n.count),a=[],i=[],u=[],l=[];if(r=I(t,r,a),r=I(t,r,i),r=I(t,r,u),r=I(t,r,l),r!==t.byteLength)throw new f("lepcc-decode-error","Bad length");let g=0,w=0;for(let b=0;b>6;let i=0;if(a===0)i=c.getUint32(1,d),e+=5;else if(a===1)i=c.getUint16(1,d),e+=3;else{if(a!==2)throw new f("lepcc-decode-error","Bad count type");i=c.getUint8(1),e+=2}if(s)throw new f("lepcc-decode-error","LUT not implemented");const u=Math.ceil(i*n/8),l=new Uint8Array(t,e,u);let g=0,w=0,b=0;const v=-1>>>32-n;for(let C=0;C>>=n,w-=n,w+n>32&&(g|=l[b-1]>>8-w)}return e+b}const h={sizeLo:0,sizeHi:4,count:8,colorMapCount:12,lookupMethod:14,compressionMethod:15,byteCount:16};function Y(t,e){return{sizeLo:t.getUint32(e+h.sizeLo,d),sizeHi:t.getUint32(e+h.sizeHi,d),count:t.getUint32(e+h.count,d),colorMapCount:t.getUint16(e+h.colorMapCount,d),lookupMethod:t.getUint8(e+h.lookupMethod),compressionMethod:t.getUint8(e+h.compressionMethod)}}function V(t){const e=new DataView(t,0);let r=0;const{identifier:c,version:o}=z(t,e,r);if(r+=m.byteCount,c!=="ClusterRGB")throw new f("lepcc-decode-error","Bad identifier");if(o>1)throw new f("lepcc-decode-error","Unknown version");const n=Y(e,r);if(r+=h.byteCount,n.sizeHi*2**32+n.sizeLo!==t.byteLength)throw new f("lepcc-decode-error","Bad size");if((n.lookupMethod===2||n.lookupMethod===1)&&n.compressionMethod===0){if(3*n.colorMapCount+n.count+r!==t.byteLength||n.colorMapCount>256)throw new f("lepcc-decode-error","Bad count");const s=new Uint8Array(t,r,3*n.colorMapCount),a=new Uint8Array(t,r+3*n.colorMapCount,n.count),i=new Uint8Array(3*n.count);for(let u=0;u1)throw new f("lepcc-decode-error","Unknown version");const n=X(e,r);if(r+=p.byteCount,n.sizeHi*2**32+n.sizeLo!==t.byteLength)throw new f("lepcc-decode-error","Bad size");const s=new Uint16Array(n.count);if(n.bitsPerPoint===8){if(n.count+r!==t.byteLength)throw new f("lepcc-decode-error","Bad size");const a=new Uint8Array(t,r,n.count);for(let i=0;iD.getLogger("esri.views.3d.layers.i3s.I3SBinaryReader");function H(t,e,r){let c="",o=0;for(;o=192&&n<224){if(o+1>=r)throw new f("utf8-decode-error","UTF-8 Decode failed. Two byte character was truncated.");const s=(31&n)<<6|63&t[e+o+1];c+=String.fromCharCode(s),o+=2}else if(n>=224&&n<240){if(o+2>=r)throw new f("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const s=(15&n)<<12|(63&t[e+o+1])<<6|63&t[e+o+2];c+=String.fromCharCode(s),o+=3}else{if(!(n>=240&&n<248))throw new f("utf8-decode-error","UTF-8 Decode failed. Invalid multi byte sequence.");{if(o+3>=r)throw new f("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const s=(7&n)<<18|(63&t[e+o+1])<<12|(63&t[e+o+2])<<6|63&t[e+o+3];if(s>=65536){const a=55296+(s-65536>>10),i=56320+(1023&s);c+=String.fromCharCode(a,i)}else c+=String.fromCharCode(s);o+=4}}}return c}function B(t,e){const r={byteOffset:0,byteCount:0,fields:Object.create(null)};let c=0;for(let o=0;o{const o=c?Date.parse(c):null;return o==null||Number.isNaN(o)?null:o})}function T(t,e,r){const c=[];let o,n,s=0;for(n=0;n0){if(c.push(H(r,s,o-1)),r[s+o-1]!==0)throw new f("string-array-error","Invalid string array: missing null termination.")}else c.push(null);s+=o}return c}function F(t,e){return new L[e.valueType](t,e.byteOffset,e.count*e.valuesPerElement)}function j(t,e){return new Uint8Array(t,e.byteOffset,e.byteCount)}function R(t,e,r){const c=e.header!=null?B(t,e.header):{byteOffset:0,byteCount:0,fields:{count:r}},o={header:c,byteOffset:c.byteCount,byteCount:0,entries:Object.create(null)};let n=c.byteCount;for(let s=0;snew DataView(t,0).getFloat32(e,!0),Float64:(t,e)=>new DataView(t,0).getFloat64(e,!0),UInt8:(t,e)=>new DataView(t,0).getUint8(e),Int8:(t,e)=>new DataView(t,0).getInt8(e),UInt16:(t,e)=>new DataView(t,0).getUint16(e,!0),Int16:(t,e)=>new DataView(t,0).getInt16(e,!0),UInt32:(t,e)=>new DataView(t,0).getUint32(e,!0),Int32:(t,e)=>new DataView(t,0).getInt32(e,!0)};function P(t){return L.hasOwnProperty(t)}function A(t){return P(t)?L[t].BYTES_PER_ELEMENT:0}export{J as $,F,K as G,q as Y};
diff --git a/fix-191/assets/I3SLayerDefinitions-CwLXCKtU-sBYkHFhL.js b/fix-191/assets/I3SLayerDefinitions-CwLXCKtU-sBYkHFhL.js
deleted file mode 100644
index 5e94bdb6..00000000
--- a/fix-191/assets/I3SLayerDefinitions-CwLXCKtU-sBYkHFhL.js
+++ /dev/null
@@ -1 +0,0 @@
-import{v as e,S as t,i,bz as l,e as p}from"./story-DULt3Rma.js";let y=class extends p{constructor(){super(...arguments),this.nodesPerPage=null,this.rootIndex=0,this.lodSelectionMetricType=null}};e([t({type:Number})],y.prototype,"nodesPerPage",void 0),e([t({type:Number})],y.prototype,"rootIndex",void 0),e([t({type:String})],y.prototype,"lodSelectionMetricType",void 0),y=e([i("esri.layers.support.I3SLayerDefinitions.I3SNodePageDefinition")],y);let n=class extends p{constructor(){super(...arguments),this.factor=1}};e([t({type:Number,json:{read:{source:"textureSetDefinitionId"}}})],n.prototype,"id",void 0),e([t({type:Number})],n.prototype,"factor",void 0),n=e([i("esri.layers.support.I3SLayerDefinitions.I3SMaterialTexture")],n);let a=class extends p{constructor(){super(...arguments),this.baseColorFactor=[1,1,1,1],this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.metallicFactor=1,this.roughnessFactor=1}};e([t({type:[Number]})],a.prototype,"baseColorFactor",void 0),e([t({type:n})],a.prototype,"baseColorTexture",void 0),e([t({type:n})],a.prototype,"metallicRoughnessTexture",void 0),e([t({type:Number})],a.prototype,"metallicFactor",void 0),e([t({type:Number})],a.prototype,"roughnessFactor",void 0),a=e([i("esri.layers.support.I3SLayerDefinitions.I3SMaterialPBRMetallicRoughness")],a);let o=class extends p{constructor(){super(...arguments),this.alphaMode="opaque",this.alphaCutoff=.25,this.doubleSided=!1,this.cullFace="none",this.normalTexture=null,this.occlusionTexture=null,this.emissiveTexture=null,this.emissiveFactor=null,this.pbrMetallicRoughness=null}};e([l({opaque:"opaque",mask:"mask",blend:"blend"})],o.prototype,"alphaMode",void 0),e([t({type:Number})],o.prototype,"alphaCutoff",void 0),e([t({type:Boolean})],o.prototype,"doubleSided",void 0),e([l({none:"none",back:"back",front:"front"})],o.prototype,"cullFace",void 0),e([t({type:n})],o.prototype,"normalTexture",void 0),e([t({type:n})],o.prototype,"occlusionTexture",void 0),e([t({type:n})],o.prototype,"emissiveTexture",void 0),e([t({type:[Number]})],o.prototype,"emissiveFactor",void 0),e([t({type:a})],o.prototype,"pbrMetallicRoughness",void 0),o=e([i("esri.layers.support.I3SLayerDefinitions.I3SMaterialDefinition")],o);let u=class extends p{};e([t({type:String,json:{read:{source:["name","index"],reader:(v,f)=>v??`${f.index}`}}})],u.prototype,"name",void 0),e([l({jpg:"jpg",png:"png",dds:"dds","ktx-etc2":"ktx-etc2",ktx2:"ktx2",basis:"basis"})],u.prototype,"format",void 0),u=e([i("esri.layers.support.I3SLayerDefinitions.I3STextureFormat")],u);let c=class extends p{constructor(){super(...arguments),this.atlas=!1}};e([t({type:[u]})],c.prototype,"formats",void 0),e([t({type:Boolean})],c.prototype,"atlas",void 0),c=e([i("esri.layers.support.I3SLayerDefinitions.I3STextureSetDefinition")],c);let s=class extends p{};e([l({Float32:"Float32",UInt64:"UInt64",UInt32:"UInt32",UInt16:"UInt16",UInt8:"UInt8"})],s.prototype,"type",void 0),e([t({type:Number})],s.prototype,"component",void 0),s=e([i("esri.layers.support.I3SLayerDefinitions.I3SGeometryAttribute")],s);let d=class extends p{};e([l({draco:"draco"})],d.prototype,"encoding",void 0),e([t({type:[String]})],d.prototype,"attributes",void 0),d=e([i("esri.layers.support.I3SLayerDefinitions.I3SGeometryCompressedAttributes")],d);let r=class extends p{constructor(){super(...arguments),this.offset=0}};e([t({type:Number})],r.prototype,"offset",void 0),e([t({type:s})],r.prototype,"position",void 0),e([t({type:s})],r.prototype,"normal",void 0),e([t({type:s})],r.prototype,"uv0",void 0),e([t({type:s})],r.prototype,"color",void 0),e([t({type:s})],r.prototype,"uvRegion",void 0),e([t({type:s})],r.prototype,"featureId",void 0),e([t({type:s})],r.prototype,"faceRange",void 0),e([t({type:d})],r.prototype,"compressedAttributes",void 0),r=e([i("esri.layers.support.I3SLayerDefinitions.I3SGeometryBuffer")],r);let m=class extends p{};e([l({triangle:"triangle"})],m.prototype,"topology",void 0),e([t()],m.prototype,"geometryBuffers",void 0),m=e([i("esri.layers.support.I3SLayerDefinitions.I3SGeometryDefinition")],m);export{c as d,m,o,y};
diff --git a/fix-191/assets/I3SUtil-Bq8KpP2j-DnmF0d2J.js b/fix-191/assets/I3SUtil-Bq8KpP2j-DnmF0d2J.js
deleted file mode 100644
index e5014ddd..00000000
--- a/fix-191/assets/I3SUtil-Bq8KpP2j-DnmF0d2J.js
+++ /dev/null
@@ -1 +0,0 @@
-import{bh as s,f as C,ia as y,ib as A}from"./story-DULt3Rma.js";import"./mat4-DX7gBViE-DBcL5Ayd.js";import"./mat4f64-Dn1WEGBx-C99QVUMW.js";import"./vec32-D9GsKZ1t-BK5Q1Wvx.js";import"./projectBuffer-CvCBvJ6W-Cc8J4MEJ.js";import"./projectVectorToVector-sIYLNlex-CkwN7cTX.js";import"./sphere-BenPORjV-YNNBQG3r.js";import"./Query-BrwMGK8U-DaHaJHm8.js";import{G as d}from"./I3SBinaryReader-DEbI3cKZ-DNxJmfIw.js";import{e as h}from"./vec4f64-hf2nxvhQ-CaAr8PTM.js";import"./floatRGBA-4pIJN00G-B4XKFXqE.js";import"./NormalAttribute.glsl-axtNsUxo-DMkZydQa.js";import"./interfaces-DN2-jsJC-DzMTiT5R.js";import"./BindType-9iOk18Ed-CRW1cdX4.js";import"./VertexAttribute-DqD5S0a2-3q90nikV.js";import{i as g}from"./orientedBoundingBox-oHezdpWm-BNWfTJhF.js";var o;(function(t){t[t.TRANSPARENT=0]="TRANSPARENT",t[t.OPAQUE=1]="OPAQUE"})(o||(o={}));var u;(function(t){t[t.Uniform=0]="Uniform",t[t.Varying=1]="Varying",t[t.COUNT=2]="COUNT"})(u||(u={}));var f,S;(function(t){t[t.Solid=0]="Solid",t[t.Sketch=1]="Sketch",t[t.Mixed=2]="Mixed",t[t.COUNT=3]="COUNT"})(f||(f={})),function(t){t[t.REGULAR=0]="REGULAR",t[t.SILHOUETTE=1]="SILHOUETTE"}(S||(S={}));function D(t){return{...P,...t,type:f.Solid}}const P={color:h(0,0,0,.2),size:1,extensionLength:0,opacity:1,objectTransparency:o.OPAQUE,hasSlicePlane:!1};o.OPAQUE,s();var m;async function K(t,a,n,p,I,N,U,R){const E=[];for(const r of a)if(r&&I.includes(r.name)){const i=`${t}/nodes/${n}/attributes/${r.key}/0`;E.push({url:i,storageInfo:r})}const c=await Promise.allSettled(E.map(r=>C(r.url,{responseType:"array-buffer",query:{...U,token:N},signal:R?.signal}).then(i=>d(r.storageInfo,i.data)))),T=[];for(const r of p){const i={};for(let e=0;ei.map(i=>d[i]);
-import{_ as C}from"./main-Bm7g2Jde.js";import{v as u,S as _,i as z,I as ne,M as ae,z as ue,e as he,a as $,b as E,E as D,o as A,x as pe,s as R,c as b,f as P,u as j,T as H,L as F,X as ee,H as _e,Z as te,C as J,k as fe,A as ge,N,Y as se,y as me,V}from"./story-DULt3Rma.js";import{_ as re,R as ve,k as we,P as O,x as Se,X as Ie}from"./themeUtils-YjM7iIiX-Dxg99YfT.js";import{b as ye}from"./substitute-j49H6mVR-zz_7aBna.js";import"./uuid-Dj9mdEVg-BaKSCiyT.js";const W="esri-identity-modal",G={base:W,info:`${W}__info`,notice:`${W}__notice`},ke="ArcGIS Online";let T=class extends ve{constructor(d,e){super(d,e),this.container=document.createElement("div"),this.error=null,this.oAuthPrompt=!1,this.open=!1,this.signingIn=!1,this.server=null,this.resource=null,this._usernameInputNode=null,this._passwordInputNode=null,document.body.appendChild(this.container)}loadDependencies(){return we({button:()=>C(()=>import("./calcite-button-Cm9_TJei-CviGJ5Jc.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),import.meta.url),dialog:()=>C(()=>import("./calcite-dialog-DAngwHC1-BtHnywVZ.js"),__vite__mapDeps([20,1,2,3,4,5,6,8,21,19,14,12,22,9,13,15,11,16,17,18,23,24,25,26,27,28]),import.meta.url),input:()=>C(()=>import("./calcite-input-BKRd7MCS-CWJjrCQh.js"),__vite__mapDeps([29,30,1,2,3,4,5,6,8,7,9,14,10,11,12,13,15,16,17]),import.meta.url),label:()=>C(()=>import("./calcite-label-DMj3M4QR-uSGkJ3Pp.js"),__vite__mapDeps([31,1,2,3,4,5,6,10,8,11]),import.meta.url),notice:()=>C(()=>import("./calcite-notice-DeAGopAs-C_7pdeVo.js"),__vite__mapDeps([32,1,2,3,4,5,6,33,15,8,12,13,14,16,25,11,17]),import.meta.url)})}get title(){return this.commonMessages?.auth.signIn}render(){const{open:d,title:e,messages:s,signingIn:t,oAuthPrompt:r,server:i,resource:n,error:h}=this,{info:p,oAuthInfo:o,lblItem:l,invalidUser:c,noAuthService:a,lblUser:f,lblPwd:g,lblCancel:v,lblSigning:w,lblOk:k}=s;return O("div",{class:this.classes(G.base,Se())},O("form",{bind:this,onsubmit:this._submit},O("calcite-dialog",{bind:this,heading:e,modal:!0,open:d,outsideCloseDisabled:!0,scale:"s",widthScale:"s",onCalciteDialogClose:this._cancel,onCalciteDialogOpen:this._focusUsernameInput},O("div",{class:G.info},ye(r?o:p,{server:i&&/\.arcgis\.com/i.test(i)?ke:i,resource:`(${n||l})`})),h?O("calcite-notice",{class:G.notice,icon:"exclamation-mark-triangle",kind:"danger",open:!0},O("div",{slot:"message"},h.details?.httpStatus?c:a)):null,r?null:[O("calcite-label",null,f,O("calcite-input",{afterCreate:m=>this._usernameInputNode=m,autocomplete:"off",bind:this,name:"username",required:!0,spellcheck:!1,type:"text",value:""})),O("calcite-label",null,g,O("calcite-input",{afterCreate:m=>this._passwordInputNode=m,bind:this,name:"password",required:!0,type:"password",value:""}))],O("calcite-button",{appearance:"outline",bind:this,onclick:this._cancel,slot:"footer-end",type:"button"},v),O("calcite-button",{loading:!!t,slot:"footer-end",type:"submit"},t?w:k))))}_focusUsernameInput(){return Ie(()=>this._usernameInputNode)}_cancel(){this._set("signingIn",!1),this.open=!1,this._usernameInputNode&&(this._usernameInputNode.value=""),this._passwordInputNode&&(this._passwordInputNode.value=""),this.emit("cancel")}_submit(d){d.preventDefault(),this._set("signingIn",!0);const e=this.oAuthPrompt?{}:{username:this._usernameInputNode?.value,password:this._passwordInputNode?.value};this.emit("submit",e)}};u([_({readOnly:!0})],T.prototype,"container",void 0),u([_(),re("esri/t9n/common")],T.prototype,"commonMessages",void 0),u([_()],T.prototype,"error",void 0),u([_(),re("esri/identity/t9n/identity")],T.prototype,"messages",void 0),u([_()],T.prototype,"oAuthPrompt",void 0),u([_()],T.prototype,"open",void 0),u([_()],T.prototype,"signingIn",void 0),u([_()],T.prototype,"server",void 0),u([_({readOnly:!0})],T.prototype,"title",null),u([_()],T.prototype,"resource",void 0),T=u([z("esri.identity.IdentityModal")],T);const ie=T,X="esriJSAPIOAuth";class K{constructor(e,s){this.oAuthInfo=null,this.storage=null,this.appId=null,this.codeVerifier=null,this.expires=null,this.refreshToken=null,this.ssl=null,this.stateUID=null,this.token=null,this.userId=null,this.oAuthInfo=e,this.storage=s,this._init()}isValid(){let e=!1;if(this.oAuthInfo&&this.userId&&(this.refreshToken||this.token)){if(this.expires==null&&this.refreshToken)e=!0;else if(this.expires){const s=Date.now();this.expires>s&&(this.expires-s)/1e3>60*this.oAuthInfo.minTimeUntilExpiration&&(e=!0)}}return e}save(){if(!this.storage)return!1;const e=this._load(),s=this.oAuthInfo;if(s?.authNamespace&&s.portalUrl){let t=e[s.authNamespace];t||(t=e[s.authNamespace]={}),this.appId||(this.appId=s.appId),t[s.portalUrl]={appId:this.appId,codeVerifier:this.codeVerifier,expires:this.expires,refreshToken:this.refreshToken,ssl:this.ssl,stateUID:this.stateUID,token:this.token,userId:this.userId};try{this.storage.setItem(X,JSON.stringify(e))}catch(r){return console.warn(r),!1}return!0}return!1}destroy(){const e=this._load(),s=this.oAuthInfo;if(s?.appId&&s?.portalUrl&&(this.expires==null||this.expires>Date.now())&&(this.refreshToken||this.token)){const t=s.portalUrl.replace(/^http:/i,"https:")+"/sharing/rest/oauth2/revokeToken",r=new FormData;if(r.append("f","json"),r.append("auth_token",this.refreshToken||this.token),r.append("client_id",s.appId),r.append("token_type_hint",this.refreshToken?"refresh_token":"access_token"),typeof navigator.sendBeacon=="function")navigator.sendBeacon(t,r);else{const i=new XMLHttpRequest;i.open("POST",t),i.send(r)}}if(s?.authNamespace&&s.portalUrl&&this.storage){const t=e[s.authNamespace];if(t){delete t[s.portalUrl];try{this.storage.setItem(X,JSON.stringify(e))}catch(r){console.log(r)}}}s&&(s._oAuthCred=null,this.oAuthInfo=null)}_init(){const e=this._load(),s=this.oAuthInfo;if(s?.authNamespace&&s.portalUrl){let t=e[s.authNamespace];t&&(t=t[s.portalUrl],t&&(this.appId=t.appId,this.codeVerifier=t.codeVerifier,this.expires=t.expires,this.refreshToken=t.refreshToken,this.ssl=t.ssl,this.stateUID=t.stateUID,this.token=t.token,this.userId=t.userId))}}_load(){let e={};if(this.storage){const s=this.storage.getItem(X);if(s)try{e=JSON.parse(s)}catch(t){console.warn(t)}}return e}}K.prototype.declaredClass="esri.identity.OAuthCredential";var Q;let U=Q=class extends he{constructor(d){super(d),this._oAuthCred=null,this.appId=null,this.authNamespace="/",this.expiration=20160,this.flowType="auto",this.forceLogin=!1,this.forceUserId=!1,this.locale=null,this.minTimeUntilExpiration=30,this.popup=!1,this.popupCallbackUrl="oauth-callback.html",this.popupWindowFeatures="height=490,width=800,resizable,scrollbars,status",this.portalUrl="https://www.arcgis.com",this.preserveUrlHash=!1,this.userId=null}clone(){return Q.fromJSON(this.toJSON())}};u([_({json:{write:!0}})],U.prototype,"appId",void 0),u([_({json:{write:!0}})],U.prototype,"authNamespace",void 0),u([_({json:{write:!0}})],U.prototype,"expiration",void 0),u([_({json:{write:!0}})],U.prototype,"flowType",void 0),u([_({json:{write:!0}})],U.prototype,"forceLogin",void 0),u([_({json:{write:!0}})],U.prototype,"forceUserId",void 0),u([_({json:{write:!0}})],U.prototype,"locale",void 0),u([_({json:{write:!0}})],U.prototype,"minTimeUntilExpiration",void 0),u([_({json:{write:!0}})],U.prototype,"popup",void 0),u([_({json:{write:!0}})],U.prototype,"popupCallbackUrl",void 0),u([_({json:{write:!0}})],U.prototype,"popupWindowFeatures",void 0),u([_({json:{write:!0}})],U.prototype,"portalUrl",void 0),u([_({json:{write:!0}})],U.prototype,"preserveUrlHash",void 0),u([_({json:{write:!0}})],U.prototype,"userId",void 0),U=Q=u([z("esri.identity.OAuthInfo")],U);const oe=U;let x=class extends he{constructor(d){super(d),this.adminTokenServiceUrl=null,this.currentVersion=null,this.hasPortal=null,this.hasServer=null,this.owningSystemUrl=null,this.owningTenant=null,this.server=null,this.shortLivedTokenValidity=null,this.tokenServiceUrl=null,this.webTierAuth=null}};u([_({json:{write:!0}})],x.prototype,"adminTokenServiceUrl",void 0),u([_({json:{write:!0}})],x.prototype,"currentVersion",void 0),u([_({json:{write:!0}})],x.prototype,"hasPortal",void 0),u([_({json:{write:!0}})],x.prototype,"hasServer",void 0),u([_({json:{write:!0}})],x.prototype,"owningSystemUrl",void 0),u([_({json:{write:!0}})],x.prototype,"owningTenant",void 0),u([_({json:{write:!0}})],x.prototype,"server",void 0),u([_({json:{write:!0}})],x.prototype,"shortLivedTokenValidity",void 0),u([_({json:{write:!0}})],x.prototype,"tokenServiceUrl",void 0),u([_({json:{write:!0}})],x.prototype,"webTierAuth",void 0),x=u([z("esri.identity.ServerInfo")],x);const Y=x,L={},le=d=>{const e=new b(d.owningSystemUrl).host,s=new b(d.server).host,t=/.+\.arcgis\.com$/i;return t.test(e)&&t.test(s)},Z=(d,e)=>!!(le(d)&&e&&e.some(s=>s.test(d.server)));let M=null,B=null;try{M=window.localStorage,B=window.sessionStorage}catch{}class ce extends ne{constructor(){super(),this._portalConfig=globalThis.esriGeowConfig,this.serverInfos=[],this.oAuthInfos=[],this.credentials=[],this._soReqs=[],this._xoReqs=[],this._portals=[],this._defaultOAuthInfo=null,this._defaultTokenValidity=60,this.dialog=null,this.tokenValidity=null,this.normalizeWebTierAuth=!1,this._appOrigin=window.origin!=="null"?window.origin:window.location.origin,this._appUrlObj=$(window.location.href),this._busy=null,this._rejectOnPersistedPageShow=!1,this._oAuthLocationParams=null,this._gwTokenUrl="/sharing/rest/generateToken",this._agsRest="/rest/services",this._agsPortal=/\/sharing(\/|$)/i,this._agsAdmin=/(https?:\/\/[^/]+\/[^/]+)\/admin\/?(\/.*)?$/i,this._adminSvcs=/\/rest\/admin\/services(\/|$)/i,this._gwDomains=[{regex:/^https?:\/\/www\.arcgis\.com/i,customBaseUrl:"maps.arcgis.com",tokenServiceUrl:"https://www.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/(?:dev|[a-z\d-]+\.mapsdev)\.arcgis\.com/i,customBaseUrl:"mapsdev.arcgis.com",tokenServiceUrl:"https://dev.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/(?:devext|[a-z\d-]+\.mapsdevext)\.arcgis\.com/i,customBaseUrl:"mapsdevext.arcgis.com",tokenServiceUrl:"https://devext.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/(?:qaext|[a-z\d-]+\.mapsqa)\.arcgis\.com/i,customBaseUrl:"mapsqa.arcgis.com",tokenServiceUrl:"https://qaext.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/[a-z\d-]+\.maps\.arcgis\.com/i,customBaseUrl:"maps.arcgis.com",tokenServiceUrl:"https://www.arcgis.com/sharing/rest/generateToken"}],this._legacyFed=[],this._regexSDirUrl=/http.+\/rest\/services\/?/gi,this._regexServerType=/(\/(FeatureServer|GPServer|GeoDataServer|GeocodeServer|GeoenrichmentServer|GeometryServer|GlobeServer|ImageServer|KnowledgeGraphServer|MapServer|MissionServer|MobileServer|NAServer|NetworkDiagramServer|OGCFeatureServer|ParcelFabricServer|RelationalCatalogServer|SceneServer|StreamServer|UtilityNetworkServer|ValidationServer|VectorTileServer|VersionManagementServer|VideoServer)).*/gi,this._gwUser=/http.+\/users\/([^/]+).*/i,this._gwItem=/http.+\/items\/([^/]+).*/i,this._gwGroup=/http.+\/groups\/([^/]+).*/i,this._rePortalTokenSvc=/\/sharing(\/rest)?\/generatetoken/i,this._createDefaultOAuthInfo=!0,this._hasTestedIfAppIsOnPortal=!1,this._getPlatformSelfError=null,this._getOAuthLocationParams(),window.addEventListener("pageshow",e=>{this._pageShowHandler(e)})}registerServers(e){const s=this.serverInfos;s?(e=e.filter(t=>!this.findServerInfo(t.server)),this.serverInfos=s.concat(e)):this.serverInfos=e,e.forEach(t=>{t.owningSystemUrl&&this._portals.push(t.owningSystemUrl),t.hasPortal&&this._portals.push(t.server)})}registerOAuthInfos(e){const s=this.oAuthInfos;if(s){for(const t of e){const r=this.findOAuthInfo(t.portalUrl);r&&s.splice(s.indexOf(r),1)}this.oAuthInfos=s.concat(e)}else this.oAuthInfos=e}registerToken(e){e={...e};const s=this._sanitizeUrl(e.server),t=this._isServerRsrc(s);let r,i=this.findServerInfo(s),n=!0;i||(i=new Y,i.server=this._getServerInstanceRoot(s),t?i.hasServer=!0:(i.tokenServiceUrl=this._getTokenSvcUrl(s),i.hasPortal=!0),this.registerServers([i])),r=this._findCredential(s),r?(delete e.server,Object.assign(r,e),n=!1):(r=new I({userId:e.userId,server:i.server??void 0,token:e.token,expires:e.expires,ssl:e.ssl,scope:t?"server":"portal"}),r.resources=[s],this.credentials.push(r)),r.emitTokenChange(!1),n||r.refreshServerTokens()}toJSON(){return ae({serverInfos:this.serverInfos.map(e=>e.toJSON()),oAuthInfos:this.oAuthInfos.map(e=>e.toJSON()),credentials:this.credentials.map(e=>e.toJSON())})}initialize(e){if(!e)return;typeof e=="string"&&(e=JSON.parse(e));const s=e.serverInfos,t=e.oAuthInfos,r=e.credentials;if(s){const i=[];s.forEach(n=>{n.server&&n.tokenServiceUrl&&i.push(n.declaredClass?n:new Y(n))}),i.length&&this.registerServers(i)}if(t){const i=[];t.forEach(n=>{n.appId&&i.push(n.declaredClass?n:new oe(n))}),i.length&&this.registerOAuthInfos(i)}r&&r.forEach(i=>{i.server&&i.token&&i.expires&&i.expires>Date.now()&&((i=i.declaredClass?i:new I(i)).emitTokenChange(),this.credentials.push(i))})}findServerInfo(e){let s;e=this._sanitizeUrl(e);for(const t of this.serverInfos)if(this._hasSameServerInstance(t.server,e)){s=t;break}return s}findOAuthInfo(e){let s;e=this._sanitizeUrl(e);for(const t of this.oAuthInfos)if(this._hasSameServerInstance(t.portalUrl,e)){s=t;break}return s}findCredential(e,s){if(!e)return;let t;e=this._sanitizeUrl(e);const r=this._isServerRsrc(e)?"server":"portal";if(s){for(const i of this.credentials)if(this._hasSameServerInstance(i.server,e)&&s===i.userId&&i.scope===r){t=i;break}}else for(const i of this.credentials)if(this._hasSameServerInstance(i.server,e)&&this._getIdenticalSvcIdx(e,i)!==-1&&i.scope===r){t=i;break}return t}getCredential(e,s){let t,r,i=!0;s&&(t=!!s.token,r=s.error,i=s.prompt!==!1),s={...s},e=this._sanitizeUrl(e);const n=new AbortController,h=E();if(s.signal&&D(s.signal,()=>{n.abort()}),D(n,()=>{h.reject(new A("identity-manager:user-aborted","ABORTED"))}),pe(n))return h.promise;s.signal=n.signal;const p=this._isAdminResource(e),o=t?this.findCredential(e):null;let l;if(o&&r&&r.details&&r.details.httpStatus===498)o.destroy();else if(o)return l=new A("identity-manager:not-authorized","You are currently signed in as: '"+o.userId+"'. You do not have access to this resource: "+e,{error:r}),h.reject(l),h.promise;const c=this._findCredential(e,s);if(c)return h.resolve(c),h.promise;let a=this.findServerInfo(e);if(a)!a.hasPortal&&a.server&&a.owningSystemUrl&&this._hasSameServerInstance(a.server,a.owningSystemUrl)&&(a.hasPortal=!0),!a.hasServer&&this._isServerRsrc(e)&&(a._restInfoPms=this._getTokenSvcUrl(e),a.hasServer=!0);else{const f=this._getTokenSvcUrl(e);if(!f)return l=new A("identity-manager:unknown-resource","Unknown resource - could not find token service endpoint."),h.reject(l),h.promise;a=new Y,a.server=this._getServerInstanceRoot(e),typeof f=="string"?(a.tokenServiceUrl=f,a.hasPortal=!0):(a._restInfoPms=f,a.hasServer=!0),this.registerServers([a])}return a.hasPortal&&a._selfReq===void 0&&(i||R(a.tokenServiceUrl,this._appOrigin)||this._gwDomains.some(f=>f.tokenServiceUrl===a.tokenServiceUrl))&&(a._selfReq={owningTenant:s?.owningTenant,selfDfd:this._getPortalSelf(a.tokenServiceUrl.replace(this._rePortalTokenSvc,"/sharing/rest/portals/self"),e)}),this._enqueue(e,a,s,h,p)}getResourceName(e){return this._isRESTService(e)?e.replace(this._regexSDirUrl,"").replace(this._regexServerType,"")||"":this._gwUser.test(e)&&e.replace(this._gwUser,"$1")||this._gwItem.test(e)&&e.replace(this._gwItem,"$1")||this._gwGroup.test(e)&&e.replace(this._gwGroup,"$1")||""}generateToken(e,s,t){const r=this._rePortalTokenSvc.test(e.tokenServiceUrl),i=new b(this._appOrigin),n=e.shortLivedTokenValidity;let h,p,o,l,c,a,f,g;s&&(g=this.tokenValidity||n||this._defaultTokenValidity,g>n&&n>0&&(g=n)),t&&(h=t.isAdmin,p=t.serverUrl,o=t.token,a=t.signal,f=t.ssl,e.customParameters=t.customParameters),h?l=e.adminTokenServiceUrl:(l=e.tokenServiceUrl,c=new b(l.toLowerCase()),e.webTierAuth&&t?.serverUrl&&!f&&i.scheme==="http"&&(R(i.uri,l,!0)||c.scheme==="https"&&i.host===c.host&&i.port==="7080"&&c.port==="7443")&&(l=l.replace(/^https:/i,"http:").replace(/:7443/i,":7080")));const v={query:{request:"getToken",username:s?.username,password:s?.password,serverUrl:p,token:o,expiration:g,referer:h||r?this._appOrigin:null,client:h?"referer":null,f:"json",...e.customParameters},method:"post",authMode:"anonymous",useProxy:this._useProxy(e,t),signal:a,...t?.ioArgs};return r||(v.withCredentials=!1),P(l,v).then(w=>{const k=w.data;if(!k?.token)return new A("identity-manager:authentication-failed","Unable to generate token");const m=e.server;return L[m]||(L[m]={}),s&&(L[m][s.username]=s.password),k.validity=g,k})}isBusy(){return!!this._busy}async checkSignInStatus(e){return(await this.checkAppAccess(e,"")).credential}checkAppAccess(e,s,t){let r=!1;return this.getCredential(e,{prompt:!1}).then(i=>{let n;const h={f:"json"};if(i.scope==="portal")if(s&&(this._doPortalSignIn(e)||t?.force))n=i.server+"/sharing/rest/oauth2/validateAppAccess",h.client_id=s;else{if(!i.token)return{credential:i};n=i.server+"/sharing/rest"}else{if(!i.token)return{credential:i};n=i.server+"/rest/services"}return i.token&&(h.token=i.token),P(n,{query:h,authMode:"anonymous"}).then(p=>{if(p.data.valid===!1)throw new A("identity-manager:not-authorized",`You are currently signed in as: '${i.userId}'.`,p.data);return r=!!p.data.viewOnlyUserTypeApp,{credential:i}}).catch(p=>{if(p.name==="identity-manager:not-authorized")throw p;const o=p.details?.httpStatus;if(o===498)throw i.destroy(),new A("identity-manager:not-authenticated","User is not signed in.");if(o===400)throw new A("identity-manager:invalid-request");return{credential:i}})}).then(i=>({credential:i.credential,viewOnly:r}))}setOAuthResponseHash(e){e&&(e.charAt(0)==="#"&&(e=e.slice(1)),this._processOAuthPopupParams(j(e)))}setOAuthRedirectionHandler(e){this._oAuthRedirectFunc=e}setProtocolErrorHandler(e){this._protocolFunc=e}signIn(e,s,t={}){const r=E(),i=()=>{p?.remove(),o?.remove(),this.dialog?.destroy(),this.dialog=p=o=null},n=()=>{i(),this._oAuthDfd=null,r.reject(new A("identity-manager:user-aborted","ABORTED"))};t.signal&&D(t.signal,()=>{n()});const h=new ie({open:!0,resource:this.getResourceName(e),server:s.server});this.dialog=h,this.emit("dialog-create");let p=h.on("cancel",n),o=h.on("submit",l=>{this.generateToken(s,l,{isAdmin:t.isAdmin,signal:t.signal}).then(c=>{i();const a=new I({userId:l.username,server:s.server??void 0,token:c.token,expires:c.expires!=null?Number(c.expires):null,ssl:!!c.ssl,isAdmin:t.isAdmin,validity:c.validity});r.resolve(a)}).catch(c=>{h.error=c,h.signingIn=!1})});return r.promise}oAuthSignIn(e,s,t,r){this._oAuthDfd=E();const i=this._oAuthDfd;let n;r?.signal&&D(r.signal,()=>{const a=this._oAuthDfd&&this._oAuthDfd.oAuthWin_;a&&!a.closed?a.close():this.dialog&&l()}),i.resUrl_=e,i.sinfo_=s,i.oinfo_=t;const h=t._oAuthCred;if(h.storage&&(t.flowType==="authorization-code"||t.flowType==="auto"&&s.currentVersion>=8.4)){let a=crypto.getRandomValues(new Uint8Array(32));n=H(a),h.codeVerifier=n,a=crypto.getRandomValues(new Uint8Array(32)),h.stateUID=H(a),h.save()||(h.codeVerifier=n=null)}else h.codeVerifier=null;let p,o;this._getCodeChallenge(n).then(a=>{const f=!r||r.oAuthPopupConfirmation!==!1;if(!t.popup||!f)return void this._doOAuthSignIn(e,s,t,a);const g=new ie({oAuthPrompt:!0,server:s.server,open:!0});this.dialog=g,this.emit("dialog-create"),p=g.on("cancel",l),o=g.on("submit",()=>{c(),this._doOAuthSignIn(e,s,t,a)})});const l=()=>{c(),this._oAuthDfd=null,i.reject(new A("identity-manager:user-aborted","ABORTED"))},c=()=>{p?.remove(),o?.remove(),this.dialog?.destroy(),this.dialog=null};return i.promise}destroyCredentials(){this.credentials&&this.credentials.slice().forEach(e=>{e.destroy()}),this.emit("credentials-destroy")}enablePostMessageAuth(e="https://www.arcgis.com/sharing/rest"){this._postMessageAuthHandle&&this._postMessageAuthHandle.remove(),this._postMessageAuthHandle=F(window,"message",s=>{if((s.origin===this._appOrigin||s.origin.endsWith(".arcgis.com"))&&s.data?.type==="arcgis:auth:requestCredential"){const t=s.source;this.getCredential(e).then(r=>{t.postMessage({type:"arcgis:auth:credential",credential:{expires:r.expires,server:r.server,ssl:r.ssl,token:r.token,userId:r.userId}},s.origin)}).catch(r=>{t.postMessage({type:"arcgis:auth:error",error:{name:r.name,message:r.message}},s.origin)})}})}disablePostMessageAuth(){this._postMessageAuthHandle&&(this._postMessageAuthHandle.remove(),this._postMessageAuthHandle=null)}_getOAuthLocationParams(){let e=window.location.hash;if(e){e.charAt(0)==="#"&&(e=e.slice(1));const t=j(e);let r=!1;if(t.access_token&&t.expires_in&&t.state&&t.hasOwnProperty("username"))try{t.state=JSON.parse(t.state),t.state.portalUrl&&(this._oAuthLocationParams=t,r=!0)}catch{}else if(t.error&&t.error_description&&(console.log("IdentityManager OAuth Error: ",t.error," - ",t.error_description),t.error==="access_denied"&&(r=!0,t.state)))try{t.state=JSON.parse(t.state)}catch{}r&&(window.location.hash=t.state?.hash||"")}let s=window.location.search;if(s){s.charAt(0)==="?"&&(s=s.slice(1));const t=j(s);let r=!1;if(t.code&&t.state)try{t.state=JSON.parse(t.state),t.state.portalUrl&&t.state.uid&&(this._oAuthLocationParams=t,r=!0)}catch{}else if(t.error&&t.error_description&&(console.log("IdentityManager OAuth Error: ",t.error," - ",t.error_description),t.error==="access_denied"&&(r=!0,t.state)))try{t.state=JSON.parse(t.state)}catch{}if(r){const i={...t};["code","error","error_description","message_code","persist","state"].forEach(p=>{delete i[p]});const n=ee(i),h=window.location.pathname+(n?`?${n}`:"")+(t.state?.hash||"");window.history.replaceState(window.history.state,"",h)}}}_getOAuthToken(e,s,t,r,i){return e=e.replace(/^http:/i,"https:"),P(`${e}/sharing/rest/oauth2/token`,{authMode:"anonymous",method:"post",query:r&&i?{grant_type:"authorization_code",code:s,redirect_uri:r,client_id:t,code_verifier:i}:{grant_type:"refresh_token",refresh_token:s,client_id:t}}).then(n=>n.data)}async _getCodeChallenge(e){if(e&&globalThis.isSecureContext){const s=new TextEncoder().encode(e),t=await crypto.subtle.digest("SHA-256",s);return H(new Uint8Array(t))}return null}_pageShowHandler(e){if(e.persisted&&this.isBusy()&&this._rejectOnPersistedPageShow){const s=new A("identity-manager:user-aborted","ABORTED");this._errbackFunc(s)}}_findCredential(e,s){let t,r,i,n,h=-1;const p=s?.token,o=s?.resource,l=this._isServerRsrc(e)?"server":"portal",c=this.credentials.filter(a=>this._hasSameServerInstance(a.server,e)&&a.scope===l);if(e=o||e,c.length)if(c.length===1){if(t=c[0],i=this.findServerInfo(t.server),r=i?.owningSystemUrl,n=r?this.findCredential(r,t.userId):void 0,h=this._getIdenticalSvcIdx(e,t),!p)return h===-1&&t.resources.push(e),this._addResource(e,n),t;h!==-1&&(t.resources.splice(h,1),this._removeResource(e,n))}else{let a,f;if(c.some(g=>(f=this._getIdenticalSvcIdx(e,g),f!==-1&&(a=g,i=this.findServerInfo(a.server),r=i?.owningSystemUrl,n=r?this.findCredential(r,a.userId):void 0,h=f,!0))),p)a&&(a.resources.splice(h,1),this._removeResource(e,n));else if(a)return this._addResource(e,n),a}}_findOAuthInfo(e){let s=this.findOAuthInfo(e);if(!s){for(const t of this.oAuthInfos)if(this._isIdProvider(t.portalUrl,e)){s=t;break}}return s}_addResource(e,s){s&&this._getIdenticalSvcIdx(e,s)===-1&&s.resources.push(e)}_removeResource(e,s){let t=-1;s&&(t=this._getIdenticalSvcIdx(e,s),t>-1&&s.resources.splice(t,1))}_useProxy(e,s){return s?.isAdmin&&!R(e.adminTokenServiceUrl,this._appOrigin)||!this._isPortalDomain(e.tokenServiceUrl)&&String(e.currentVersion)==="10.1"&&!R(e.tokenServiceUrl,this._appOrigin)}_getOrigin(e){const s=new b(e);return s.scheme+"://"+s.host+(s.port!=null?":"+s.port:"")}_getServerInstanceRoot(e){const s=e.toLowerCase();let t=s.indexOf(this._agsRest);return t===-1&&this._isAdminResource(e)&&(t=this._agsAdmin.test(e)?e.replace(this._agsAdmin,"$1").length:e.search(this._adminSvcs)),t!==-1||_e(s)||(t=s.indexOf("/sharing")),t===-1&&s.endsWith("/")&&(t=s.length-1),t>-1?e.slice(0,t):e}_hasSameServerInstance(e,s){return e.endsWith("/")&&(e=e.slice(0,-1)),e=e.toLowerCase(),s=this._getServerInstanceRoot(s).toLowerCase(),e=te(e),s=te(s),(e=e.slice(Math.max(0,e.indexOf(":"))))===(s=s.slice(Math.max(0,s.indexOf(":"))))}_sanitizeUrl(e){const s=(J.request.proxyUrl||"").toLowerCase(),t=s?e.toLowerCase().indexOf(s+"?"):-1;return t!==-1&&(e=e.slice(t+s.length+1)),e=fe(e),$(e).path}_isRESTService(e){return e.includes(this._agsRest)}_isAdminResource(e){return this._agsAdmin.test(e)||this._adminSvcs.test(e)}_isServerRsrc(e){return this._isRESTService(e)||this._isAdminResource(e)}_isIdenticalService(e,s){let t=!1;if(this._isRESTService(e)&&this._isRESTService(s)){const r=this._getSuffix(e).toLowerCase(),i=this._getSuffix(s).toLowerCase();if(t=r===i,!t){const n=/(.*)\/(MapServer|FeatureServer|UtilityNetworkServer).*/gi;t=r.replaceAll(n,"$1")===i.replaceAll(n,"$1")}}else this._isAdminResource(e)&&this._isAdminResource(s)?t=!0:this._isServerRsrc(e)||this._isServerRsrc(s)||!this._isPortalDomain(e)||(t=!0);return t}_isPortalDomain(e){const s=new b(e.toLowerCase()),t=this._portalConfig;let r=this._gwDomains.some(i=>i.regex.test(s.uri));return!r&&t&&(r=this._hasSameServerInstance(this._getServerInstanceRoot(t.restBaseUrl),s.uri)),r||J.portalUrl&&(r=R(s,J.portalUrl,!0)),r||(r=this._portals.some(i=>this._hasSameServerInstance(i,s.uri))),r=r||this._agsPortal.test(s.path),r}_isIdProvider(e,s){let t=-1,r=-1;this._gwDomains.forEach((n,h)=>{t===-1&&n.regex.test(e)&&(t=h),r===-1&&n.regex.test(s)&&(r=h)});let i=!1;if(t>-1&&r>-1&&(t===0||t===4?r!==0&&r!==4||(i=!0):t===1?r!==1&&r!==2||(i=!0):t===2?r===2&&(i=!0):t===3&&r===3&&(i=!0)),!i){const n=this.findServerInfo(s),h=n?.owningSystemUrl;h&&le(n)&&this._isPortalDomain(h)&&this._isIdProvider(e,h)&&(i=!0)}return i}_getIdenticalSvcIdx(e,s){let t=-1;for(let r=0;rn.data),{adminUrl:s,promise:t}}if(this._isPortalDomain(e)){let i="";if(this._gwDomains.some(n=>(n.regex.test(e)&&(i=n.tokenServiceUrl),!!i)),i||this._portals.some(n=>(this._hasSameServerInstance(n,e)&&(i=n+this._gwTokenUrl),!!i)),i||(r=e.toLowerCase().indexOf("/sharing"),r!==-1&&(i=e.slice(0,r)+this._gwTokenUrl)),i||(i=this._getOrigin(e)+this._gwTokenUrl),i){const n=new b(e).port;/^http:\/\//i.test(e)&&n==="7080"&&(i=i.replace(/:7080/i,":7443")),i=i.replace(/http:/i,"https:")}return i}}_processOAuthResponseParams(e,s,t){const r=s._oAuthCred;if(e.code){const n=r.codeVerifier;return r.codeVerifier=null,r.stateUID=null,r.save(),this._getOAuthToken(t.server,e.code,s.appId,this._getRedirectURI(s,!0),n).then(h=>{const p=new I({userId:h.username,server:t.server??void 0,token:h.access_token,expires:Date.now()+1e3*h.expires_in,ssl:h.ssl,oAuthState:e.state,_oAuthCred:r});return s.userId=p.userId,r.storage=h.persist?M:B,r.refreshToken=h.refresh_token,r.token=null,r.expires=h.refresh_token_expires_in?Date.now()+1e3*h.refresh_token_expires_in:null,r.userId=p.userId,r.ssl=p.ssl,r.save(),p})}const i=new I({userId:e.username,server:t.server??void 0,token:e.access_token,expires:Date.now()+1e3*Number(e.expires_in),ssl:e.ssl==="true",oAuthState:e.state,_oAuthCred:r});return s.userId=i.userId,r.storage=e.persist?M:B,r.refreshToken=null,r.token=i.token,r.expires=i.expires,r.userId=i.userId,r.ssl=i.ssl,r.save(),Promise.resolve(i)}_processOAuthPopupParams(e){const s=this._oAuthDfd;if(this._oAuthDfd=null,s)if(clearInterval(this._oAuthIntervalId),this._oAuthOnPopupHandle?.remove(),e.error){const t=e.error==="access_denied",r=new A(t?"identity-manager:user-aborted":"identity-manager:authentication-failed",t?"ABORTED":"OAuth: "+e.error+" - "+e.error_description);s.reject(r)}else this._processOAuthResponseParams(e,s.oinfo_,s.sinfo_).then(t=>{s.resolve(t)}).catch(t=>{s.reject(t)})}_setOAuthResponseQueryString(e){e&&(e.charAt(0)==="?"&&(e=e.slice(1)),this._processOAuthPopupParams(j(e)))}async _exchangeToken(e,s,t){return(await P(`${e}/sharing/rest/oauth2/exchangeToken`,{authMode:"anonymous",method:"post",query:{f:"json",client_id:s,token:t}})).data.token}async _getPlatformSelf(e,s){if(this._getPlatformSelfError&&Date.now()-this._getPlatformSelfError[1]<1e3)throw this._getPlatformSelfError[0];e=e.replace(/^http:/i,"https:");try{const t=await P(`${e}/sharing/rest/oauth2/platformSelf`,{authMode:"anonymous",headers:{"X-Esri-Auth-Client-Id":s,"X-Esri-Auth-Redirect-Uri":window.location.href.replace(/#.*$/,"")},method:"post",query:{f:"json",expiration:30},withCredentials:!0});return this._getPlatformSelfError=null,t.data}catch(t){throw t.details?.messageCode==="OAUTH_0066"&&(this._getPlatformSelfError=[t,Date.now()]),t}}_getPortalSelf(e,s){let t;return this._gwDomains.some(r=>(r.regex.test(e)&&(t=r.customBaseUrl),!!t)),t?Promise.resolve({allSSL:!0,currentVersion:"8.4",customBaseUrl:t,portalMode:"multitenant",supportsOAuth:!0}):(this._appOrigin.startsWith("https:")?e=e.replace(/^http:/i,"https:").replace(/:7080/i,":7443"):/^http:/i.test(s)&&(e=e.replace(/^https:/i,"http:").replace(/:7443/i,":7080")),P(e,{query:{f:"json"},authMode:"anonymous",withCredentials:!0}).then(r=>r.data))}_doPortalSignIn(e){const s=this._portalConfig,t=window.location.href,r=this.findServerInfo(e);return!(!s&&!this._isPortalDomain(t)||!(r?r.hasPortal||r.owningSystemUrl&&this._isPortalDomain(r.owningSystemUrl):this._isPortalDomain(e))||!(this._isIdProvider(t,e)||s&&(this._hasSameServerInstance(this._getServerInstanceRoot(s.restBaseUrl),e)||this._isIdProvider(s.restBaseUrl,e))||R(t,e,!0)))}_checkProtocol(e,s,t,r){let i=!0;const n=r?s.adminTokenServiceUrl:s.tokenServiceUrl;return n.trim().toLowerCase().startsWith("https:")&&!this._appOrigin.startsWith("https:")&&ge(n)&&(i=!!this._protocolFunc&&!!this._protocolFunc({resourceUrl:e,serverInfo:s}),!i)&&t(new A("identity-manager:aborted","Aborted the Sign-In process to avoid sending password over insecure connection.")),i}_enqueue(e,s,t,r,i,n){return r||(r=E()),r.resUrl_=e,r.sinfo_=s,r.options_=t,r.admin_=i,r.refresh_=n,this._busy?this._hasSameServerInstance(this._getServerInstanceRoot(e),this._busy.resUrl_)?(this._oAuthDfd&&this._oAuthDfd.oAuthWin_&&this._oAuthDfd.oAuthWin_.focus(),this._soReqs.push(r)):this._xoReqs.push(r):this._doSignIn(r),r.promise}_doSignIn(e){this._busy=e,this._rejectOnPersistedPageShow=!1;const s=o=>{const l=e.options_?.resource,c=e.resUrl_,a=e.refresh_;let f=!1;this.credentials.includes(o)||(a&&this.credentials.includes(a)?(a.userId=o.userId,a.token=o.token,a.expires=o.expires,a.validity=o.validity,a.ssl=o.ssl,a.creationTime=o.creationTime,f=!0,o=a):this.credentials.push(o)),o.resources||(o.resources=[]),o.resources.includes(l||c)||o.resources.push(l||c),o.scope=this._isServerRsrc(c)?"server":"portal",o.emitTokenChange();const g=this._soReqs,v={};this._soReqs=[],g.forEach(w=>{if(!this._isIdenticalService(c,w.resUrl_)){const k=this._getSuffix(w.resUrl_);v[k]||(v[k]=!0,o.resources.push(w.resUrl_))}}),e.resolve(o),g.forEach(w=>{this._hasSameServerInstance(this._getServerInstanceRoot(c),w.resUrl_)?w.resolve(o):this._soReqs.push(w)}),this._busy=e.resUrl_=e.sinfo_=e.refresh_=null,f||this.emit("credential-create",{credential:o}),this._soReqs.length?this._doSignIn(this._soReqs.shift()):this._xoReqs.length&&this._doSignIn(this._xoReqs.shift())},t=o=>{e.reject(o),this._busy=e.resUrl_=e.sinfo_=e.refresh_=null,this._soReqs.length?this._doSignIn(this._soReqs.shift()):this._xoReqs.length&&this._doSignIn(this._xoReqs.shift())},r=(o,l,c,a)=>{const f=e.sinfo_,g=!e.options_||e.options_.prompt!==!1,v=f.hasPortal&&this._findOAuthInfo(e.resUrl_);let w,k;if(o)s(new I({userId:o,server:f.server??void 0,token:c??void 0,expires:a!=null?Number(a):null,ssl:!!l}));else if(window!==window.parent&&this._appUrlObj.query?.["arcgis-auth-origin"]&&this._appUrlObj.query?.["arcgis-auth-portal"]&&this._hasSameServerInstance(this._getServerInstanceRoot(this._appUrlObj.query["arcgis-auth-portal"]),e.resUrl_)){window.parent.postMessage({type:"arcgis:auth:requestCredential"},this._appUrlObj.query["arcgis-auth-origin"]);const m=F(window,"message",y=>{y.source===window.parent&&y.data&&(y.data.type==="arcgis:auth:credential"?(m.remove(),y.data.credential.expires{m.remove()})}else if(v){let m=v._oAuthCred;if(!m){const y=new K(v,M),S=new K(v,B);y.isValid()&&S.isValid()?y.expires>S.expires?(m=y,S.destroy()):(m=S,y.destroy()):m=y.isValid()?y:S,v._oAuthCred=m}if(m.isValid()){w=new I({userId:m.userId??void 0,server:f.server??void 0,token:m.token??void 0,expires:m.expires,ssl:m.ssl??void 0,_oAuthCred:m});const y=v.appId!==m.appId&&this._doPortalSignIn(e.resUrl_);y||m.refreshToken?(e._pendingDfd=m.refreshToken?this._getOAuthToken(f.server,m.refreshToken,m.appId).then(S=>(w.expires=Date.now()+1e3*S.expires_in,w.token=S.access_token,w)):Promise.resolve(w),e._pendingDfd.then(S=>y?this._exchangeToken(S.server,v.appId,S.token).then(q=>(S.token=q,S)).catch(()=>S):S).then(S=>{s(S)}).catch(S=>{const q=S.details?.httpStatus;q>0&&q!==404?(m.destroy(),r()):t(S)})):s(w)}else if(this._oAuthLocationParams&&this._hasSameServerInstance(v.portalUrl,this._oAuthLocationParams.state.portalUrl)&&(this._oAuthLocationParams.access_token||this._oAuthLocationParams.code&&this._oAuthLocationParams.state.uid===m.stateUID&&m.codeVerifier)){const y=this._oAuthLocationParams;this._oAuthLocationParams=null,e._pendingDfd=this._processOAuthResponseParams(y,v,f).then(S=>{s(S)}).catch(t)}else{const y=()=>{g?e._pendingDfd=this.oAuthSignIn(e.resUrl_,f,v,e.options_).then(s,t):(k=new A("identity-manager:not-authenticated","User is not signed in."),t(k))};this._doPortalSignIn(e.resUrl_)?e._pendingDfd=this._getPlatformSelf(f.server,v.appId).then(S=>{R(S.portalUrl,this._appOrigin,!0)?(w=new I({userId:S.username,server:f.server??void 0,expires:Date.now()+1e3*S.expires_in,token:S.token}),s(w)):y()}).catch(y):y()}}else if(g){if(this._checkProtocol(e.resUrl_,f,t,e.admin_)){let m=e.options_;e.admin_&&(m=m||{},m.isAdmin=!0),e._pendingDfd=this.signIn(e.resUrl_,f,m).then(s,t)}}else k=new A("identity-manager:not-authenticated","User is not signed in."),t(k)},i=()=>{const o=e.sinfo_,l=o.owningSystemUrl,c=e.options_;let a,f,g,v;if(c&&(a=c.token,f=c.error,g=c.prompt),v=this._findCredential(l,{token:a,resource:e.resUrl_}),!v){for(const w of this.credentials)if(this._isIdProvider(l,w.server)){v=w;break}}if(v){const w=this.findCredential(e.resUrl_,v.userId);if(w)s(w);else if(Z(o,this._legacyFed)){const k=v.toJSON();k.server=o.server,k.resources=null,s(new I(k))}else(e._pendingDfd=this.generateToken(this.findServerInfo(v.server),null,{serverUrl:e.resUrl_,token:v.token,signal:e.options_.signal,ssl:v.ssl})).then(k=>{s(new I({userId:v?.userId,server:o.server??void 0,token:k.token,expires:k.expires!=null?Number(k.expires):null,ssl:!!k.ssl,isAdmin:e.admin_,validity:k.validity}))},t)}else this._busy=null,a&&(e.options_.token=null),(e._pendingDfd=this.getCredential(l.replace(/\/?$/,"/sharing"),{resource:e.resUrl_,owningTenant:o.owningTenant,signal:e.options_.signal,token:a,error:f,prompt:g})).then(()=>{this._enqueue(e.resUrl_,e.sinfo_,e.options_,e,e.admin_)},w=>{e.resUrl_=e.sinfo_=e.refresh_=null,e.reject(w)})};this._errbackFunc=t;const n=e.sinfo_.owningSystemUrl,h=this._isServerRsrc(e.resUrl_),p=e.sinfo_._restInfoPms;p?p.promise.then(o=>{const l=e.sinfo_;if(l._restInfoPms){l.adminTokenServiceUrl=l._restInfoPms.adminUrl,l._restInfoPms=null,l.tokenServiceUrl=(N("authInfo.tokenServicesUrl",o)||N("authInfo.tokenServiceUrl",o)||N("tokenServiceUrl",o))??null,l.shortLivedTokenValidity=N("authInfo.shortLivedTokenValidity",o)??null,l.currentVersion=o.currentVersion,l.owningTenant=o.owningTenant;const c=l.owningSystemUrl=o.owningSystemUrl;c&&this._portals.push(c)}h&&l.owningSystemUrl?i():r()},()=>{e.sinfo_._restInfoPms=null;const o=new A("identity-manager:server-identification-failed","Unknown resource - could not find token service endpoint.");t(o)}):h&&n?i():e.sinfo_._selfReq?e.sinfo_._selfReq.selfDfd.then(o=>{const l={};let c,a,f,g;return o&&(c=o.user?.username,l.username=c,l.allSSL=o.allSSL,a=o.supportsOAuth,g=parseFloat(o.currentVersion),o.portalMode==="multitenant"&&(f=o.customBaseUrl),e.sinfo_.currentVersion=g),e.sinfo_.webTierAuth=!!c,c&&this.normalizeWebTierAuth?this.generateToken(e.sinfo_,null,{ssl:l.allSSL}).catch(()=>null).then(v=>(l.portalToken=v?.token,l.tokenExpiration=v?.expires,l)):!c&&a&&g>=4.4&&!this._findOAuthInfo(e.resUrl_)?this._generateOAuthInfo({portalUrl:e.sinfo_.server,customBaseUrl:f,owningTenant:e.sinfo_._selfReq.owningTenant}).catch(()=>null).then(()=>l):l}).catch(()=>null).then(o=>{e.sinfo_._selfReq=null,o?r(o.username,o.allSSL,o.portalToken,o.tokenExpiration):r()}):r()}_generateOAuthInfo(e){let s,t=null,r=e.portalUrl;const i=e.customBaseUrl,n=e.owningTenant,h=!this._defaultOAuthInfo&&this._createDefaultOAuthInfo&&!this._hasTestedIfAppIsOnPortal;if(h){t=window.location.href;let p=t.indexOf("?");p>-1&&(t=t.slice(0,p)),p=t.search(/\/(apps|home)\//),t=p>-1?t.slice(0,p):null}return h&&t?(this._hasTestedIfAppIsOnPortal=!0,s=P(t+"/sharing/rest",{query:{f:"json"}}).then(()=>{this._defaultOAuthInfo=new oe({appId:"arcgisonline",popupCallbackUrl:t+"/home/oauth-callback.html"})})):s=Promise.resolve(),s.then(()=>{if(this._defaultOAuthInfo)return r=r.replace(/^http:/i,"https:"),P(r+"/sharing/rest/oauth2/validateRedirectUri",{query:{accountId:n,client_id:this._defaultOAuthInfo.appId,redirect_uri:se(this._defaultOAuthInfo.popupCallbackUrl),f:"json"}}).then(p=>{if(p.data.valid){const o=this._defaultOAuthInfo.clone();p.data.urlKey&&i?o.portalUrl="https://"+p.data.urlKey.toLowerCase()+"."+i:o.portalUrl=r,o.popup=window!==window.top||!(R(r,this._appOrigin)||this._gwDomains.some(l=>l.regex.test(r)&&l.regex.test(this._appOrigin))),this.oAuthInfos.push(o)}})})}_doOAuthSignIn(e,s,t,r){const i=t._oAuthCred,n={portalUrl:t.portalUrl};!t.popup&&t.preserveUrlHash&&window.location.hash&&(n.hash=window.location.hash),i.stateUID&&(n.uid=i.stateUID);const h={client_id:t.appId,response_type:i.codeVerifier?"code":"token",state:JSON.stringify(n),expiration:t.expiration,locale:t.locale,redirect_uri:this._getRedirectURI(t,!!i.codeVerifier)};t.forceLogin&&(h.force_login=!0),t.forceUserId&&t.userId&&(h.prepopulatedusername=t.userId),!t.popup&&this._doPortalSignIn(e)&&(h.redirectToUserOrgUrl=!0),i.codeVerifier&&(h.code_challenge=r||i.codeVerifier,h.code_challenge_method=r?"S256":"plain");const p=t.portalUrl.replace(/^http:/i,"https:")+"/sharing/oauth2/authorize",o=p+"?"+ee(h);if(t.popup){const l=window.open(o,"esriJSAPIOAuth",t.popupWindowFeatures);if(l)l.focus(),this._oAuthDfd.oAuthWin_=l,this._oAuthIntervalId=setInterval(()=>{if(l.closed){clearInterval(this._oAuthIntervalId),this._oAuthOnPopupHandle.remove();const c=this._oAuthDfd;if(c){const a=new A("identity-manager:user-aborted","ABORTED");c.reject(a)}}},500),this._oAuthOnPopupHandle=F(window,["arcgis:auth:hash","arcgis:auth:location:search"],c=>{c.type==="arcgis:auth:hash"?this.setOAuthResponseHash(c.detail):this._setOAuthResponseQueryString(c.detail)});else{const c=new A("identity-manager:popup-blocked","ABORTED");this._oAuthDfd.reject(c)}}else this._rejectOnPersistedPageShow=!0,this._oAuthRedirectFunc?this._oAuthRedirectFunc({authorizeParams:h,authorizeUrl:p,resourceUrl:e,serverInfo:s,oAuthInfo:t}):window.location.href=o}_getRedirectURI(e,s){const t=window.location.href.replace(/#.*$/,"");if(e.popup)return se(e.popupCallbackUrl);if(s){const r=$(t);return r.query&&["code","error","error_description","message_code","persist","state"].forEach(i=>{delete r.query[i]}),me(r.path,r.query)}return t}}ce.prototype.declaredClass="esri.identity.IdentityManagerBase";let I=class extends ne.EventedAccessor{constructor(d){super(d),this._oAuthCred=null,this.tokenRefreshBuffer=2,d?._oAuthCred&&(this._oAuthCred=d._oAuthCred)}initialize(){this.resources=this.resources||[],this.creationTime==null&&(this.creationTime=Date.now())}refreshToken(){const d=V,e=d.findServerInfo(this.server),s=e?.owningSystemUrl,t=!!s&&this.scope==="server",r=t&&Z(e,d._legacyFed),i=e.webTierAuth,n=i&&d.normalizeWebTierAuth,h=L[this.server],p=h?.[this.userId];let o,l=this.resources&&this.resources[0],c=t?d.findServerInfo(s):null,a={username:this.userId,password:p};if(i&&!n)return;t&&!c&&d.serverInfos.some(g=>(d._isIdProvider(s,g.server)&&(c=g),!!c));const f=c?d.findCredential(c.server,this.userId):null;if(!t||f){if(!r){if(t)o={serverUrl:l,token:f?.token,ssl:f?.ssl};else if(n)a=null,o={ssl:this.ssl};else{if(!p){let g;return l&&(l=d._sanitizeUrl(l),this._enqueued=1,g=d._enqueue(l,e,null,null,this.isAdmin,this),g.then(()=>{this._enqueued=0,this.refreshServerTokens()}).catch(()=>{this._enqueued=0})),g}this.isAdmin&&(o={isAdmin:!0})}return d.generateToken(t?c:e,t?null:a,o).then(g=>{this.token=g.token,this.expires=g.expires!=null?Number(g.expires):null,this.creationTime=Date.now(),this.validity=g.validity,this.emitTokenChange(),this.refreshServerTokens()}).catch(()=>{})}f?.refreshToken()}}refreshServerTokens(){if(this.scope==="portal"){const d=V;d.credentials.forEach(e=>{const s=d.findServerInfo(e.server),t=s?.owningSystemUrl;e!==this&&e.userId===this.userId&&t&&e.scope==="server"&&(d._hasSameServerInstance(this.server,t)||d._isIdProvider(t,this.server))&&(Z(s,d._legacyFed)?(e.token=this.token,e.expires=this.expires,e.creationTime=this.creationTime,e.validity=this.validity,e.emitTokenChange()):e.refreshToken())})}}emitTokenChange(d){clearTimeout(this._refreshTimer);const e=V,s=this.server?e.findServerInfo(this.server):null,t=s?.owningSystemUrl,r=t?e.findServerInfo(t):null;d===!1||t&&this.scope!=="portal"&&(!r?.webTierAuth||e.normalizeWebTierAuth)||this.expires==null&&this.validity==null||this._startRefreshTimer(),this.emit("token-change")}destroy(){this.userId=this.server=this.token=this.expires=this.validity=this.resources=this.creationTime=null,this._oAuthCred&&(this._oAuthCred.destroy(),this._oAuthCred=null);const d=V,e=d.credentials.indexOf(this);e>-1&&d.credentials.splice(e,1),this.emitTokenChange(),this.emit("destroy")}toJSON(){const d=ae({userId:this.userId,server:this.server,token:this.token,expires:this.expires,validity:this.validity,ssl:this.ssl,isAdmin:this.isAdmin,creationTime:this.creationTime,scope:this.scope}),e=this.resources;return e&&e.length>0&&(d.resources=e.slice()),d}_startRefreshTimer(){clearTimeout(this._refreshTimer);const d=6e4*this.tokenRefreshBuffer,e=2**31-1;let s=(this.validity?this.creationTime+6e4*this.validity:this.expires)-Date.now();s<0?s=0:s>e&&(s=e),this._refreshTimer=setTimeout(this.refreshToken.bind(this),s>d?s-d:s)}};u([_()],I.prototype,"creationTime",void 0),u([_()],I.prototype,"expires",void 0),u([_()],I.prototype,"isAdmin",void 0),u([_()],I.prototype,"oAuthState",void 0),u([_()],I.prototype,"resources",void 0),u([_()],I.prototype,"scope",void 0),u([_()],I.prototype,"server",void 0),u([_()],I.prototype,"ssl",void 0),u([_()],I.prototype,"token",void 0),u([_()],I.prototype,"tokenRefreshBuffer",void 0),u([_()],I.prototype,"userId",void 0),u([_()],I.prototype,"validity",void 0),I=u([z("esri.identity.Credential")],I);class de extends ce{}de.prototype.declaredClass="esri.identity.IdentityManager";const Ae=new de;ue(Ae);export{Ae as default};
diff --git a/fix-191/assets/ImageryLayer-B-bJb8lU-Be87VD4V.js b/fix-191/assets/ImageryLayer-B-bJb8lU-Be87VD4V.js
deleted file mode 100644
index 12634dfb..00000000
--- a/fix-191/assets/ImageryLayer-B-bJb8lU-Be87VD4V.js
+++ /dev/null
@@ -1,2 +0,0 @@
-const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./imageryUtils-6MVSqijr-1Tgq6Wjf.js","./utils-BVWK2jiA-D_Oj_AG8.js","./story-DULt3Rma.js","./main-Bm7g2Jde.js","./main-DIDVYkhz.css","./story-DBsbaiEU.css","./originUtils-BLsWtgV9-B4sclfuf.js","./multiOriginJSONSupportUtils-DGETddQl-BrWaY9_8.js","./PortalItem-CctGdnxF-Dbw3pVTD.js","./jsonContext-BA8GHqVk-DqGWyE2_.js","./portalItemUtils-B8bw6SAG-CEVZt8QT.js","./projection-BA9M1R7d-DvHr0GeG.js","./projectBuffer-CvCBvJ6W-Cc8J4MEJ.js","./saveUtils-CIYk-dsQ-CKT8D_08.js"])))=>i.map(i=>d[i]);
-import{_ as $t}from"./main-Bm7g2Jde.js";import{v as s,S as a,ac as I,i as R,aa as fe,e as F,w as V,J as re,bB as Le,aK as zt,af as ne,bH as ge,bI as et,bJ as tt,a0 as E,bK as Y,g as ee,bz as Ut,bp as Ht,W as Bt,o as b,bL as Qt,P as C,l as ut,n as Ee,G as kt,a as Wt,a1 as It,f as x,bM as pt,aO as M,ah as Kt,bi as Zt,bN as Xt,ab as Yt}from"./story-DULt3Rma.js";import{m as er}from"./MultiOriginJSONSupport-DKRh9P6w-tF-GNPM3.js";import{D as tr}from"./Layer-ChoECxvZ-DQ-28MDL.js";import{p as he,d as qe,M as H,k as S,J as rr,A as ir,l as sr,c as nr,u as nt,a as ar,E as Ft,P as or,V as lr,j as ur,v as pr,w as cr,S as mr,b as dr,f as yr,Z as hr}from"./RasterPresetRendererMixin-D6W9pUY6-B8ohE660.js";import{_ as gr,X as fr,E as wr,Z as Rr}from"./commonProperties-BtIqvFU_-CfGSai59.js";import{E as at,z as vr,g as br,j as Sr}from"./multidimensionalUtils-BwTugeu7-BQuWE_eb.js";import{n as xr,D as ot,R as Ir,x as Fr}from"./dataUtils-BkPy4R3C-Cbeh7cC8.js";import{W as Nt,K as _t,i as Ot,Y as Dr,B as Tr,a as Pr,t as jr,V as Dt,b as Nr,c as _r}from"./RasterSymbolizer-BVys6HkM-gLqgffM8.js";import{G as Or}from"./UniqueValueRenderer-fS5V0Ej1-BykZGEgA.js";import{y as we}from"./Field-C6hA1tZj-DdgmWWCq.js";import{o as Cr}from"./FieldsIndex-HmzMbJQG-nfgmohOl.js";import{i as Tt}from"./imageBitmapUtils-DA36kg39-34fvgt3I.js";import{B as xe}from"./normalizeUtils-Bxmy9MNI-CZMTs6Vg.js";import{y as q,n as L,a as $}from"./utils-9sQxfkoa-CjNZjdKD.js";import{s as Ar,b as lt}from"./Query-BrwMGK8U-DaHaJHm8.js";import{k as bt}from"./TimeExtent-Cn0Jofqr-DWlRQ-Qn.js";import{O as Ct}from"./FeatureSet-BkVNthuN-DUN6SnMl.js";import{e as Vr,i as Mr}from"./executeForIds-Z1gkLduF-C792PfbX.js";import{u as Jr}from"./executeQueryJSON-CcHnccia-DA_VWVEh.js";import{a as Er}from"./ArcGISService-BYA-y6X6-C5W37jug.js";import{u as qr}from"./BlendLayer-D1WkSmwP-BHrWqYGA.js";import{i as Gr}from"./CustomParametersMixin-vdKsTHer-ByoZbxFR.js";import{E as Lr}from"./OperationalLayer-B5IXiMa2-BCAq75zB.js";import{C as $r}from"./PortalLayer-CElnYuSQ-jChQE2im.js";import{T as zr}from"./RefreshableLayer-a8BQ58Xh-D8rhwboV.js";import{S as Ur}from"./ScaleRangeLayer-Bz0DcnvM-BoX1P84V.js";import{x as Hr}from"./TemporalLayer-CpOrN_w9-Obih3ZXC.js";import{a as Br}from"./versionUtils-LZYZz-38-DkG6K7PB.js";import{w as Qr}from"./popupUtils-B0uZcXX0-CcOxvXQU.js";import{E as Ue}from"./interfaces-Cwm0pihk-Ptzy6gTd.js";import"./workers-PiCjreoO-CABaMBvC.js";import"./RendererLegendOptions-K3md58-X-DR3I9sq7.js";import"./ClassBreaksDefinition-bYRgYgPp-fywCcmFq.js";import"./colorRamps-q0bZVhs2-DkXm9F7X.js";import"./visualVariableUtils-D3kZJRyn-PuRGVqRl.js";import"./compilerUtils-CV1QYWI8-5SsZKq4e.js";import"./lengthUtils-DKpMe5qR-BEdWsC7X.js";import"./sizeVariableUtils-t52KcLLi-D0hbQF8b.js";import"./utils-DPtQ14k3-DaIPbUGN.js";import"./parser-DyDJ-rlI-8QTzeGdu.js";import"./mat4f32-CiZjBg9k-CUm34GoR.js";import"./mat4-DX7gBViE-DBcL5Ayd.js";import"./common-CYWrYyJl-E8-sukrT.js";import"./cimSymbolUtils-CKIzBgMU-CBWRf2E1.js";import"./utils-SPbpQbmm-BoVqh098.js";import"./enums-CpSG_SL3-BMD3Tb1v.js";import"./LRUCache-C3erQTWv-CBR8rG5i.js";import"./ElevationInfo-yv2-9tj6-B5v76p2q.js";import"./_commonjsHelpers-BITg13Vk-KnjfkSck.js";import"./colorUtils-Cthpxcks-CToOrmBC.js";import"./vec42-D8CJyqHG-DnfLTeQH.js";import"./vec4f64-hf2nxvhQ-CaAr8PTM.js";import"./diffUtils-Cz3Fi8Xb-Dx3TppL9.js";import"./styleUtils-BtpNqZyT-nGAxWjLn.js";import"./fieldType-CD2CL2hr-BeIaxmP1.js";import"./UnknownTimeZone-C--TOcPG-C3cinqRV.js";import"./normalizeUtilsCommon-CRJlkfEA-CgRBIB_J.js";import"./utils-Bq23Xwmj-DhZYu3yh.js";import"./query-DFW9-NG_-DqquB_ii.js";import"./pbfQueryUtils-F4ZE8-K8-DpF92BrR.js";import"./pbf-D-y3_eZO-D-TFO35M.js";import"./OptimizedFeature-EIithYlr-Cq64mIT3.js";import"./OptimizedFeatureSet-DfZGBuxJ-C08BOAgi.js";import"./queryZScale-BiYV6Pr6-CHuA90gs.js";import"./projection-BA9M1R7d-DvHr0GeG.js";import"./projectBuffer-CvCBvJ6W-Cc8J4MEJ.js";import"./arcgisLayerUrl-HNYh8jvG-CTcC0GBx.js";import"./jsonUtils-wIllKWI4-CU3QWWOb.js";import"./PortalItem-CctGdnxF-Dbw3pVTD.js";import"./portalItemUtils-B8bw6SAG-CEVZt8QT.js";import"./TimeInfo-w_HB2CsF-CGuO-bD4.js";const kr={StretchFunction:{arguments:{ComputeGamma:{isDataset:!1,isPublic:!1,name:"ComputeGamma",type:"RasterFunctionVariable",value:!1},DRA:{isDataset:!1,isPublic:!1,name:"DRA",type:"RasterFunctionVariable",value:!1},EstimateStatsHistogram:{isDataset:!1,isPublic:!1,name:"EstimateStatsHistogram",type:"RasterFunctionVariable",value:!1},Gamma:{displayName:"Gamma",isDataset:!1,isPublic:!1,name:"Gamma",type:"RasterFunctionVariable"},Histograms:{isDataset:!1,isPublic:!1,name:"Histograms",type:"RasterFunctionVariable"},Max:{isDataset:!1,isPublic:!1,name:"Max",type:"RasterFunctionVariable",value:255},MaxPercent:{isDataset:!1,isPublic:!1,name:"MaxPercent",type:"RasterFunctionVariable",value:.5},Min:{isDataset:!1,isPublic:!1,name:"Min",type:"RasterFunctionVariable",value:0},MinPercent:{isDataset:!1,isPublic:!1,name:"MinPercent",type:"RasterFunctionVariable",value:.25},NumberOfStandardDeviations:{isDataset:!1,isPublic:!1,name:"NumberOfStandardDeviation",type:"RasterFunctionVariable",value:2},Raster:{isDataset:!0,isPublic:!1,name:"Raster",type:"RasterFunctionVariable"},SigmoidStrengthLevel:{isDataset:!1,isPublic:!1,name:"SigmoidStrengthLevel",type:"RasterFunctionVariable",value:2},Statistics:{isDataset:!1,isPublic:!1,name:"Statistics",type:"RasterFunctionVariable"},StretchType:{isDataset:!1,isPublic:!1,name:"StretchType",type:"RasterFunctionVariable",value:0},type:"StretchFunctionArguments",UseGamma:{isDataset:!1,isPublic:!1,name:"UseGamma",type:"RasterFunctionVariable",value:!1}},description:"Enhances an image by adjusting the range of values displayed. This does not alter the underlying pixel values. If a pixel has a value outside of the specified range, it will appear as either the minimum or maximum value.",function:{description:"Enhances an image by adjusting the range of values displayed. This does not alter the underlying pixel values. If a pixel has a value outside of the specified range, it will appear as either the minimum or maximum value.",name:"Stretch",pixelType:"UNKNOWN",type:"StretchFunction"},functionType:0,name:"Stretch",thumbnail:""},RemapFunction:{name:"Remap",description:"Changes pixel values by assigning new values to ranges of pixel values or using an external table.",function:{type:"RemapFunction",pixelType:"UNKNOWN",name:"Remap",description:"Changes pixel values by assigning new values to ranges of pixel values or using an external table."},arguments:{Raster:{name:"Raster",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},UseTable:{name:"UseTable",isPublic:!1,isDataset:!1,value:!1,type:"RasterFunctionVariable"},InputRanges:{name:"InputRanges",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable",displayName:"Input Ranges"},OutputValues:{name:"OutputValues",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable",displayName:"Output Values"},NoDataRanges:{name:"NoDataRanges",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable",displayName:"NoData Ranges"},Table:{name:"Table",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},InputField:{name:"InputField",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},OutputField:{name:"OutputField",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},InputMaxField:{name:"InputMaxField",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},RemapTableType:{name:"RemapTableType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},AllowUnmatched:{name:"AllowUnmatched",isPublic:!1,isDataset:!1,value:!0,type:"RasterFunctionVariable"},type:"RemapFunctionArguments"},functionType:0,thumbnail:""},ColormapFunction:{name:"Colormap",description:"Changes pixel values to display the raster data as either a grayscale or a red, green, blue (RGB) image, based on a colormap or a color ramp.",function:{type:"ColormapFunction",pixelType:"UNKNOWN",name:"Colormap",description:"Changes pixel values to display the raster data as either a grayscale or a red, green, blue (RGB) image, based on a colormap or a color ramp."},arguments:{Raster:{name:"Raster",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},ColorSchemeType:{name:"ColorSchemeType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},Colormap:{name:"Colormap",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},ColormapName:{name:"ColormapName",isPublic:!1,isDataset:!1,value:"Gray",type:"RasterFunctionVariable"},ColorRamp:{name:"ColorRamp",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},type:"ColormapFunctionArguments"},functionType:0,thumbnail:""},ShadedReliefFunction:{name:"Shaded Relief",description:"Creates a multiband, color coded, 3D representation of the surface, with the sun's relative position taken into account for shading the image.",function:{type:"ShadedReliefFunction",pixelType:"UNKNOWN",name:"Shaded Relief",description:"Creates a multiband, color coded, 3D representation of the surface, with the sun's relative position taken into account for shading the image."},arguments:{Raster:{name:"Raster",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},ColorSchemeType:{name:"ColorSchemeType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},ColorRamp:{name:"ColorRamp",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},HillshadeType:{name:"HillshadeType",isPublic:!1,isDataset:!1,value:0,type:"RasterFunctionVariable"},Colormap:{name:"Colormap",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},Azimuth:{name:"Azimuth",isPublic:!1,isDataset:!1,value:315,type:"RasterFunctionVariable"},Altitude:{name:"Altitude",isPublic:!1,isDataset:!1,value:45,type:"RasterFunctionVariable"},SlopeType:{name:"SlopeType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},ZFactor:{name:"ZFactor",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},PSPower:{name:"PSPower",isPublic:!1,isDataset:!1,value:.664,type:"RasterFunctionVariable"},PSZFactor:{name:"PSZFactor",isPublic:!1,isDataset:!1,value:.024,type:"RasterFunctionVariable"},RemoveEdgeEffect:{name:"RemoveEdgeEffect",isPublic:!1,isDataset:!1,value:!1,type:"RasterFunctionVariable"},type:"ShadedReliefFunctionArguments"},functionType:0,thumbnail:""},HillshadeFunction:{name:"Hillshade",description:"Creates a 3D representation of the surface, with the sun's relative position taken into account for shading the image",function:{type:"HillshadeFunction",pixelType:"UNKNOWN",name:"Hillshade",description:"Creates a 3D representation of the surface, with the sun's relative position taken into account for shading the image"},arguments:{DEM:{name:"DEM",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},HillshadeType:{name:"HillshadeType",isPublic:!1,isDataset:!1,value:0,type:"RasterFunctionVariable"},Azimuth:{name:"Azimuth",isPublic:!1,isDataset:!1,value:315,type:"RasterFunctionVariable"},Altitude:{name:"Altitude",isPublic:!1,isDataset:!1,value:45,type:"RasterFunctionVariable"},SlopeType:{name:"SlopeType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},ZFactor:{name:"ZFactor",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},PSPower:{name:"PSPower",isPublic:!1,isDataset:!1,value:.664,type:"RasterFunctionVariable"},PSZFactor:{name:"PSZFactor",isPublic:!1,isDataset:!1,value:.024,type:"RasterFunctionVariable"},RemoveEdgeEffect:{name:"RemoveEdgeEffect",isPublic:!1,isDataset:!1,value:!1,type:"RasterFunctionVariable"},type:"HillshadeFunctionArguments"},functionType:0,thumbnail:""},ResampleFunction:{name:"Resample",description:"Changes the cell size of a raster.",function:{type:"ResampleFunction",pixelType:"UNKNOWN",name:"Resample",description:"Changes the cell size of a raster."},arguments:{Raster:{name:"Raster",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},ResamplingType:{name:"ResamplingType",isPublic:!1,isDataset:!1,value:0,type:"RasterFunctionVariable"},InputCellSize:{name:"InputCellsize",isPublic:!1,isDataset:!1,value:{x:0,y:0},type:"RasterFunctionVariable"},OutputCellSize:{name:"OutputCellsize",isPublic:!1,isDataset:!1,value:{x:0,y:0},type:"RasterFunctionVariable"},type:"ResampleFunctionArguments"},functionType:0,thumbnail:""}},Wr=new Set(["u1","u2","u4","u8","s8","u16","s16"]),Kr={simple_scalar:"Simple Scalar",wind_barb:"Wind Barb",single_arrow:"Single Arrow",beaufort_kn:"Beaufort Wind (Knots)",beaufort_m:"Beaufort Wind (MetersPerSecond)",ocean_current_m:"Ocean Current (MetersPerSecond)",ocean_current_kn:"Ocean Current (Knots)"},Zr=new Set(["raster-stretch","unique-value","class-breaks","raster-shaded-relief","vector-field","raster-colormap"]);function At(i){return Zr.has(i.type)}function ct(i,t){if(!i||!t)return C(i||t);const o=C(i);if(o.functionDefinition&&t.rasterFunctionDefinition){const e=t.rasterFunctionDefinition;(e.thumbnail||e.thumbnailEx)&&(e.thumbnail=e.thumbnailEx=void 0),Vt(o.functionDefinition.arguments,t),o.rasterFunctionDefinition=o.functionDefinition.toJSON()}else t.functionName?.toLowerCase()!=="none"&&(Mt(o.functionArguments).Raster=t);return o}function Vt(i,t){for(const o in i)o.toLowerCase()==="raster"&&(i[o].type==="RasterFunctionVariable"?(i[o]=t.rasterFunctionDefinition,i[o].type="RasterFunctionTemplate"):i[o].type==="RasterFunctionTemplate"&&Vt(i[o].arguments,t))}function ie(i){const t=C(kr[i.functionName+"Function"]),o=i.functionArguments;for(const e in o)e.toLowerCase()==="raster"?(t.arguments[e]=ie(o[e]),t.arguments[e].type="RasterFunctionTemplate"):e.toLowerCase()==="colormap"?(t.arguments[e].value=ni(o[e]),t.arguments.ColorSchemeType.value=0):t.arguments[e].value=o[e];return t}function Xr(i,t){switch(t=t||{},i.type){case"raster-stretch":return ti(i,t);case"class-breaks":return ri(i,t);case"unique-value":return ii(i,t);case"raster-colormap":return si(i,t);case"vector-field":return Yr(i,t);case"raster-shaded-relief":return ei(i,t);case"flow":throw new Error("Unsupported rendering rule.")}}function Mt(i){const t=i?.Raster??i?.raster;return t&&t.declaredClass==="esri.layers.support.RasterFunction"?Mt(t.functionArguments):i}const Ce={none:0,standardDeviation:3,histogramEqualization:4,minMax:5,percentClip:6,sigmoid:9};function Yr(i,t){const o=new S;o.functionName="VectorFieldRenderer";const{dataType:e,bandNames:r}=t,n=e==="vector-uv";let l,u;if(r&&r.length===2){const h=r.map(f=>f.toLowerCase());l=h.indexOf("magnitude"),u=h.indexOf("direction")}l!==-1&&l!==null||(l=0,u=1);const p=i.rotationType==="arithmetic"?1:2,m=i.flowRepresentation==="flow-from"?0:1,c=i.visualVariables?i.visualVariables.find(h=>h.field==="Magnitude"):new Or,d={magnitudeBandID:l,directionBandID:u,isUVComponents:n,referenceSystem:p,massFlowAngleRepresentation:m,symbolTileSize:50,symbolTileSizeUnits:100,calculationMethod:"Vector Average",symbologyName:Kr[i.style.toLowerCase().replace("-","_")],minimumMagnitude:c.minDataValue,maximumMagnitude:c.maxDataValue,minimumSymbolSize:c.minSize,maximumSymbolSize:c.maxSize};o.functionArguments=d;const g=ie(o);return t.convertToRFT?S.fromJSON({rasterFunctionDefinition:g}):o}function ei(i,t){const o=t.convertToRFT;if(t.dataType!=="elevation"&&(t.dataType!=="generic"||t.bandCount!==1||t.pixelType!=="s16"&&t.pixelType!=="s32"&&t.pixelType!=="f32"&&t.pixelType!=="f64"))return new S;const e=new S;e.functionName="Hillshade";const r=i.hillshadeType==="traditional"?0:1,n=i.scalingType==="none"?1:3,l={HillshadeType:r,SlopeType:n,ZFactor:i.zFactor};return r===0&&(l.Azimuth=i.azimuth,l.Altitude=i.altitude),n===3&&(l.PSPower=i.pixelSizePower,l.PSZFactor=i.pixelSizeFactor),e.functionArguments=l,e.variableName="Raster",i.colorRamp&&(e.functionName="ShadedRelief",o?l.ColorRamp=_t(i.colorRamp):l.Colormap=Ot(i.colorRamp)),o?new S({rasterFunctionDefinition:ie(e)}):e}function ti(i,t){const o=t.convertToRFT,e=new S;e.functionName="Stretch";const r=Ce[Dr.toJSON(i.stretchType)],n="u8",l=i.customStatistics?.map(p=>[p.min,p.max,p.avg??0,p.stddev??1]),u={StretchType:r,Statistics:l,DRA:i.dynamicRangeAdjustment,UseGamma:i.useGamma,Gamma:i.gamma,ComputeGamma:i.computeGamma};if(i.outputMin!=null&&(u.Min=i.outputMin),i.outputMax!=null&&(u.Max=i.outputMax),r===Ce.standardDeviation?(u.NumberOfStandardDeviations=i.numberOfStandardDeviations,e.outputPixelType=n):r===Ce.percentClip?(u.MinPercent=i.minPercent,u.MaxPercent=i.maxPercent,e.outputPixelType=n):r===Ce.minMax?e.outputPixelType=n:r===Ce.sigmoid&&(u.SigmoidStrengthLevel=i.sigmoidStrengthLevel),e.functionArguments=u,e.variableName="Raster",i.colorRamp){const p=i.colorRamp,m=new S;if(o)m.functionArguments={ColorRamp:_t(p)};else{const c=Tr(p,!0);if(c)m.functionArguments={colorRampName:c};else if(!t.convertColorRampToColormap||p.type!=="algorithmic"&&p.type!=="multipart"){const d=i.colorRamp.toJSON();d.type==="algorithmic"?d.algorithm=d.algorithm||"esriCIELabAlgorithm":d.type==="multipart"&&d.colorRamps?.length&&d.colorRamps.forEach(g=>g.algorithm=g.algorithm||"esriCIELabAlgorithm"),m.functionArguments={colorRamp:d}}else m.functionArguments={Colormap:Ot(p)}}return m.variableName="Raster",m.functionName="Colormap",m.functionArguments.Raster=e,o?new S({rasterFunctionDefinition:ie(m)}):m}return o?new S({rasterFunctionDefinition:ie(e)}):e}function ri(i,t){const o=[],e=[],r=[],n=[],{pixelType:l,rasterAttributeTable:u}=t,p=u==null?null:u.features,m=Jt(u);if(m&&p&&Array.isArray(p)&&i.classBreakInfos){i.classBreakInfos.forEach((y,v)=>{const w=y.symbol?.color;let T;w?.a&&y.minValue!=null&&y.maxValue!=null&&p.forEach(j=>{y.minValue!=null&&y.maxValue!=null&&(T=j.attributes[i.field],(T>=y.minValue&&T=y.minValue)&&n.push([j.attributes[m],w.r,w.g,w.b]))})});const h=l?rt(n,l):n,f=new S;return f.functionName="Colormap",f.functionArguments={},f.functionArguments.Colormap=h,f.variableName="Raster",t.convertToRFT?new S({rasterFunctionDefinition:ie(f)}):f}i.classBreakInfos.forEach((h,f)=>{if(h.minValue==null||h.maxValue==null)return;const y=h.symbol&&h.symbol.color;y?.a?(f===0?o.push(h.minValue,h.maxValue+1e-4):o.push(h.minValue+1e-4,h.maxValue+1e-4),e.push(f),n.push([f,y.r,y.g,y.b])):r.push(h.minValue,h.maxValue)});const c=l?rt(n,l):n,d=new S;d.functionName="Remap",d.functionArguments={InputRanges:o,OutputValues:e,NoDataRanges:r},d.variableName="Raster";const g=new S;return g.functionName="Colormap",g.functionArguments={Colormap:c,Raster:d},t.convertToRFT?new S({rasterFunctionDefinition:ie(g)}):g}function rt(i,t){const o=Wr.has(t)?xr(t):null;return o&&i.push([Math.floor(o[0]-1),0,0,0],[Math.ceil(o[1]+1),0,0,0]),i}function Jt(i){if(i==null)return;const{fields:t}=i;return t?.find(o=>o?.name&&o.name.toLowerCase()==="value")?.name}function ii(i,t){const o=[],{pixelType:e,rasterAttributeTable:r}=t,n=r==null?null:r.features,l=Jt(r),u=i.defaultSymbol?.color?.toRgb(),p=i.uniqueValueInfos;if(p)if(n){if(l){const d=new Map;p.forEach(h=>{const f=h.value,y=Pt(h);f!=null&&y?.a&&d.set(String(f),y.toRgb())});const g=i.field;g&&n.forEach(({attributes:h})=>{const f=String(h[g]),y=h[l],v=d.get(f);v?o.push([y,...v]):u&&o.push([y,...u])})}}else for(let d=0;dt.type==="fill")?.material?.color:i.symbol?.color}function si(i,t){const o=i.extractColormap();if(!o||o.length===0)return null;const{pixelType:e}=t,r=e?rt(o,e):o,n=new S;return n.functionName="Colormap",n.functionArguments={},n.functionArguments.Colormap=r,t.convertToRFT?new S({rasterFunctionDefinition:ie(n)}):n}function ni(i){const t=[],o=[];return i.forEach(e=>{t.push(e[0]),o.push(Pr([...e.slice(1),255]))}),{type:"RasterColormap",values:t,colors:o}}let _=class extends F{constructor(){super(...arguments),this.layer=null,this.compression=void 0,this.pixelType=void 0,this.lercVersion=2}get adjustAspectRatio(){return this.layer.adjustAspectRatio}writeAdjustAspectRatio(i,t,o){this.layer.version<10.3||(t[o]=i)}get bandIds(){return this.layer.bandIds}get compressionQuality(){return this.layer.compressionQuality}writeCompressionQuality(i,t,o){this.format&&this.format.toLowerCase().includes("jpg")&&i!=null&&(t[o]=i)}get compressionTolerance(){return this.layer.compressionTolerance}writeCompressionTolerance(i,t,o){this.format==="lerc"&&i!=null&&(t[o]=i)}get format(){return this.layer.renderer?.type==="vector-field"?"lerc":this.layer.format}get interpolation(){return this.layer.interpolation}get noData(){return this.layer.noData}get noDataInterpretation(){return this.layer.noDataInterpretation}writeLercVersion(i,t,o){this.format==="lerc"&&this.layer.version>=10.5&&(t[o]=i)}get version(){const i=this.layer;return i.commitProperty("bandIds"),i.commitProperty("format"),i.commitProperty("compressionQuality"),i.commitProperty("compressionTolerance"),i.commitProperty("interpolation"),i.commitProperty("noData"),i.commitProperty("noDataInterpretation"),i.commitProperty("mosaicRule"),i.commitProperty("rasterFunction"),i.commitProperty("adjustAspectRatio"),i.commitProperty("pixelFilter"),i.commitProperty("definitionExpression"),i.commitProperty("multidimensionalSubset"),(this._get("version")||0)+1}set version(i){this._set("version",i)}get mosaicRule(){const i=this.layer;let t=i.mosaicRule;const o=i.definitionExpression;return t?o&&o!==t.where&&(t=t.clone(),t.where=o):o&&(t=new H({where:o})),t}get rasterFunction(){const i=this.layer;let{rasterFunction:t}=i;const o=i.pixelFilter,e=!i.format||i.format.includes("jpg")||i.format.includes("png");t=this._addResampleRasterFunction(t);const r=i.multidimensionalSubset?.areaOfInterest;return r&&(t=ai(t,r)),e&&!o&&i.renderer?.type!=="vector-field"&&(t=this.combineRendererWithRenderingRule(t)),t}combineRendererWithRenderingRule(i){const t=this.layer,{rasterInfo:o,renderer:e}=t;return i=i||t.rasterFunction,!e||!At(e)?i:ct(Xr(e,{rasterAttributeTable:o.attributeTable,pixelType:o.pixelType,dataType:o.dataType,bandNames:o.bandInfos.map(({name:r})=>r),convertColorRampToColormap:t.version<10.6,convertToRFT:!!i?.rasterFunctionDefinition,bandCount:o.bandCount}),i)}_addResampleRasterFunction(i){if(this.layer.renderer?.type!=="vector-field"||i?.functionName==="Resample")return i;const t=this.layer.serviceDataType==="esriImageServiceDataTypeVector-UV"?7:10,o=this.layer.serviceRasterInfo.pixelSize;let e=new S({functionName:"Resample",functionArguments:{ResamplingType:t,InputCellSize:o}});return e=i?.rasterFunctionDefinition?new S({rasterFunctionDefinition:ie(e)}):e,ct(e,i)}};function ai(i,t){const o=new S({functionName:"Clip",functionArguments:{ClippingGeometry:t.toJSON(),ClippingType:1}});return ct(o,i)}s([a()],_.prototype,"layer",void 0),s([a({json:{write:!0}})],_.prototype,"adjustAspectRatio",null),s([I("adjustAspectRatio")],_.prototype,"writeAdjustAspectRatio",null),s([a({json:{write:!0}})],_.prototype,"bandIds",null),s([a({json:{write:!0}})],_.prototype,"compression",void 0),s([a({json:{write:!0}})],_.prototype,"compressionQuality",null),s([I("compressionQuality")],_.prototype,"writeCompressionQuality",null),s([a({json:{write:!0}})],_.prototype,"compressionTolerance",null),s([I("compressionTolerance")],_.prototype,"writeCompressionTolerance",null),s([a({json:{write:!0}})],_.prototype,"format",null),s([a({type:String,json:{read:{reader:he.read},write:{writer:he.write}}})],_.prototype,"interpolation",null),s([a({json:{write:!0}})],_.prototype,"noData",null),s([a({type:String,json:{read:{reader:qe.read},write:{writer:qe.write}}})],_.prototype,"noDataInterpretation",null),s([a({json:{write:!0}})],_.prototype,"pixelType",void 0),s([a({json:{write:!0}})],_.prototype,"lercVersion",void 0),s([I("lercVersion")],_.prototype,"writeLercVersion",null),s([a({type:Number})],_.prototype,"version",null),s([a({json:{write:!0}})],_.prototype,"mosaicRule",null),s([a({json:{write:!0,name:"renderingRule"}})],_.prototype,"rasterFunction",null),_=s([R("esri.layers.support.ExportImageServiceParameters")],_);let ce=class extends fe(F){constructor(){super(...arguments),this.fromGeometry=null,this.toGeometry=null,this.objectIds=null,this.where=null,this.maxCount=null}};s([a({type:V,json:{read:!0}})],ce.prototype,"fromGeometry",void 0),s([a({type:V,json:{read:!0,write:!0}})],ce.prototype,"toGeometry",void 0),s([a({json:{write:!0}})],ce.prototype,"objectIds",void 0),s([a({type:String,json:{write:!0}})],ce.prototype,"where",void 0),s([a({type:Number,json:{write:!0}})],ce.prototype,"maxCount",void 0),ce=s([R("esri.rest.support.FindImagesParameters")],ce);const oi=ce,Et=i=>{let t=class extends i{constructor(){super(...arguments),this.make=null,this.model=null,this.focalLength=null,this.pixelSize=null,this.rows=null,this.cols=null}};return s([a({json:{write:!0}})],t.prototype,"make",void 0),s([a({json:{write:!0}})],t.prototype,"model",void 0),s([a({json:{write:!0}})],t.prototype,"focalLength",void 0),s([a({json:{write:!0}})],t.prototype,"pixelSize",void 0),s([a({json:{write:!0}})],t.prototype,"rows",void 0),s([a({json:{write:!0}})],t.prototype,"cols",void 0),t=s([R("esri.rest.support.CameraInfoMixin")],t),t};let W=class extends Et(F){constructor(){super(...arguments),this.id=null,this.referenceUri=null,this.acquisitionDate=null,this.cameraID=null,this.center=null,this.perspectiveCenter=null,this.orientation=null}writeAcquisitionDate(i,t){t.acquisitionDate=i?.getTime()}};s([a({json:{write:!0}})],W.prototype,"id",void 0),s([a({json:{name:"uri",write:!0}})],W.prototype,"referenceUri",void 0),s([a({type:Date,json:{write:!0}})],W.prototype,"acquisitionDate",void 0),s([I("acquisitionDate")],W.prototype,"writeAcquisitionDate",null),s([a({json:{write:!0}})],W.prototype,"cameraID",void 0),s([a({type:V,json:{write:!0}})],W.prototype,"center",void 0),s([a({type:V,json:{write:!0}})],W.prototype,"perspectiveCenter",void 0),s([a({json:{write:!0}})],W.prototype,"orientation",void 0),W=s([R("esri.rest.support.ImageInspectionInfo")],W);const li=W;let He=class extends F{constructor(){super(...arguments),this.images=null}};s([a({type:[li],json:{write:!0}})],He.prototype,"images",void 0),He=s([R("esri.rest.support.FindImagesResult")],He);const ui=He;var mt;let Re=mt=class extends F{constructor(i){super(i),this.angleNames=null,this.point=null,this.spatialReference=null,this.rasterId=null}clone(){return new mt(C({angleNames:this.angleNames,point:this.point,spatialReference:this.spatialReference,rasterId:this.rasterId}))}};s([a({type:[String],json:{name:"angleName",write:!0}})],Re.prototype,"angleNames",void 0),s([a({type:V,json:{write:!0}})],Re.prototype,"point",void 0),s([a({type:re,json:{write:!0}})],Re.prototype,"spatialReference",void 0),s([a({type:Le,json:{write:!0}})],Re.prototype,"rasterId",void 0),Re=mt=s([R("esri.rest.support.ImageAngleParameters")],Re);const pi=Re;let Fe=class extends F{constructor(i){super(i),this.north=null,this.up=null,this.spatialReference=null}};s([a({type:Number,json:{write:!0}})],Fe.prototype,"north",void 0),s([a({type:Number,json:{write:!0}})],Fe.prototype,"up",void 0),s([a({type:re,json:{write:!0}})],Fe.prototype,"spatialReference",void 0),Fe=s([R("esri.rest.support.ImageAngleResult")],Fe);const ci=Fe,B=new zt({esriMensurationPoint:"point",esriMensurationCentroid:"centroid",esriMensurationDistanceAndAngle:"distance-and-angle",esriMensurationAreaAndPerimeter:"area-and-perimeter",esriMensurationHeightFromBaseAndTop:"base-and-top",esriMensurationHeightFromBaseAndTopShadow:"base-and-top-shadow",esriMensurationHeightFromTopAndTopShadow:"top-and-top-shadow",esriMensurationPoint3D:"point-3D",esriMensurationCentroid3D:"centroid-3D",esriMensurationDistanceAndAngle3D:"distance-and-angle-3D",esriMensurationAreaAndPerimeter3D:"area-and-perimeter-3D"});let X=class extends F{constructor(){super(...arguments),this.type=null,this.measureOperation=null,this.mosaicRule=null,this.pixelSize=null,this.raster=void 0}};s([a()],X.prototype,"type",void 0),s([a({type:B.apiValues,json:{read:B.read,write:B.write}})],X.prototype,"measureOperation",void 0),s([a({type:H,json:{write:!0}})],X.prototype,"mosaicRule",void 0),s([a({type:V,json:{write:!0}})],X.prototype,"pixelSize",void 0),s([a({json:{write:!0}})],X.prototype,"raster",void 0),X=s([R("esri.rest.support.BaseImageMeasureParameters")],X);var dt;let ae=dt=class extends X{constructor(){super(...arguments),this.type="area-perimeter",this.geometry=null,this.is3D=!1,this.linearUnit="meters",this.areaUnit="square-meters"}writeGeometry(i,t,o){i!=null&&(t.geometryType=Y(i),t[o]=i.toJSON())}get measureOperation(){return this.is3D?"area-and-perimeter-3D":"area-and-perimeter"}clone(){return new dt(C({geometry:this.geometry,is3D:this.is3D,linearUnit:this.linearUnit,areaUnit:this.areaUnit,mosaicRule:this.mosaicRule,pixelSize:this.pixelSize,raster:this.raster}))}};s([a({types:ne,json:{name:"fromGeometry",read:!0,write:!0}})],ae.prototype,"geometry",void 0),s([I("geometry")],ae.prototype,"writeGeometry",null),s([a({type:B.apiValues,json:{write:B.write}})],ae.prototype,"measureOperation",null),s([a({json:{read:!0}})],ae.prototype,"is3D",void 0),s([a({type:String,json:{read:ge.read,write:ge.write}})],ae.prototype,"linearUnit",void 0),s([a({type:String,json:{read:et.read,write:et.write}})],ae.prototype,"areaUnit",void 0),ae=dt=s([R("esri.rest.support.ImageAreaParameters")],ae);const mi=ae;let de=class extends F{constructor(){super(...arguments),this.value=null,this.displayValue=null,this.uncertainty=null}};s([a({type:Number,json:{read:!0,write:!0}})],de.prototype,"value",void 0),s([a({type:String,json:{read:!0,write:!0}})],de.prototype,"displayValue",void 0),s([a({type:Number,json:{read:!0,write:!0}})],de.prototype,"uncertainty",void 0),de=s([R("esri.rest.support.BaseImageMeasureResult.BaseImageMeasureResultValue")],de);let Ne=class extends de{constructor(){super(...arguments),this.unit=null}};s([a({type:String,json:{read:ge.read,write:ge.write}})],Ne.prototype,"unit",void 0),Ne=s([R("esri.rest.support.BaseImageMeasureResult.ImageMeasureResultLengthValue")],Ne);let Be=class extends de{constructor(){super(...arguments),this.unit=null}};s([a({type:String,json:{read:et.read,write:et.write}})],Be.prototype,"unit",void 0),Be=s([R("esri.rest.support.BaseImageMeasureResult.ImageMeasureResultAreaValue")],Be);let Ge=class extends de{constructor(){super(...arguments),this.unit=null}};s([a({type:String,json:{read:tt.read,write:tt.write}})],Ge.prototype,"unit",void 0),Ge=s([R("esri.rest.support.BaseImageMeasureResult.ImageMeasureResultAngleValue")],Ge);let ye=class extends F{constructor(){super(...arguments),this.name=null,this.sensorName=null}};s([a({type:String,json:{read:!0,write:!0}})],ye.prototype,"name",void 0),s([a({type:String,json:{read:!0,write:!0}})],ye.prototype,"sensorName",void 0),ye=s([R("esri.rest.support.BaseImageMeasureResult")],ye);let Ae=class extends ye{constructor(){super(...arguments),this.area=null,this.perimeter=null}};s([a({type:Be,json:{read:!0,write:!0}})],Ae.prototype,"area",void 0),s([a({type:Ne,json:{read:!0,write:!0}})],Ae.prototype,"perimeter",void 0),Ae=s([R("esri.rest.support.ImageAreaResult")],Ae);const di=Ae;let Qe=class extends fe(F){constructor(){super(...arguments),this.outSpatialReference=null}};s([a({type:re,json:{name:"outSR",write:!0}})],Qe.prototype,"outSpatialReference",void 0),Qe=s([R("esri.rest.support.ImageBoundaryParameters")],Qe);const yi=Qe;let De=class extends F{constructor(){super(...arguments),this.area=null,this.geometry=null}readGeometry(i,t){return i==null?null:i.rings?ut.fromJSON(i):Ee.fromJSON(i)}};s([a({type:Number,json:{write:!0}})],De.prototype,"area",void 0),s([a({json:{name:"shape",write:!0}})],De.prototype,"geometry",void 0),s([E("geometry")],De.prototype,"readGeometry",null),De=s([R("esri.rest.support.ImageBoundaryResult")],De);const hi=De;var yt;let te=yt=class extends X{constructor(){super(...arguments),this.type="distance-angle",this.fromGeometry=null,this.toGeometry=null,this.is3D=!1,this.linearUnit="meters",this.angularUnit="degrees"}writeFromGeometry(i,t,o){i!=null&&(t.geometryType=Y(i),t[o]=i.toJSON())}get measureOperation(){return this.is3D?"distance-and-angle-3D":"distance-and-angle"}clone(){return new yt(C({fromGeometry:this.fromGeometry,toGeometry:this.toGeometry,is3D:this.is3D,linearUnit:this.linearUnit,angularUnit:this.angularUnit,mosaicRule:this.mosaicRule,pixelSize:this.pixelSize,raster:this.raster}))}};s([a({type:V,json:{read:!0,write:!0}})],te.prototype,"fromGeometry",void 0),s([I("fromGeometry")],te.prototype,"writeFromGeometry",null),s([a({type:V,json:{read:!0,write:!0}})],te.prototype,"toGeometry",void 0),s([a({type:B.apiValues,json:{write:B.write}})],te.prototype,"measureOperation",null),s([a({json:{read:!0}})],te.prototype,"is3D",void 0),s([a({type:String,json:{read:ge.read,write:ge.write}})],te.prototype,"linearUnit",void 0),s([a({type:String,json:{read:tt.read,write:tt.write}})],te.prototype,"angularUnit",void 0),te=yt=s([R("esri.rest.support.ImageDistanceParameters")],te);const gi=te;let Te=class extends ye{constructor(){super(...arguments),this.distance=null,this.azimuthAngle=null,this.elevationAngle=null}};s([a({type:Ne,json:{read:!0,write:!0}})],Te.prototype,"distance",void 0),s([a({type:Ge,json:{read:!0,write:!0}})],Te.prototype,"azimuthAngle",void 0),s([a({type:Ge,json:{read:!0,write:!0}})],Te.prototype,"elevationAngle",void 0),Te=s([R("esri.rest.support.ImageDistanceResult")],Te);const fi=Te;let oe=class extends fe(F){constructor(){super(...arguments),this.geometry=null,this.objectIds=null,this.spatialRelationship="intersects",this.timeExtent=null,this.where=null}writeGeometry(i,t,o){i!=null&&(t.geometryType=Y(i),t[o]=JSON.stringify(i.toJSON()))}};s([a({types:ne,json:{read:ee,write:!0}})],oe.prototype,"geometry",void 0),s([I("geometry")],oe.prototype,"writeGeometry",null),s([a({json:{write:!0}})],oe.prototype,"objectIds",void 0),s([Ut(Ar,{ignoreUnknown:!1,name:"spatialRel"})],oe.prototype,"spatialRelationship",void 0),s([a({type:bt,json:{name:"time",write:!0}})],oe.prototype,"timeExtent",void 0),s([a({type:String,json:{write:!0}})],oe.prototype,"where",void 0),oe=s([R("esri.rest.support.ImageGPSInfoParameters")],oe);const wi=oe;let ke=class extends Et(F){constructor(){super(...arguments),this.id=null}};s([a({json:{write:!0}})],ke.prototype,"id",void 0),ke=s([R("esri.rest.support.CameraInfo")],ke);const Ri=ke;let K=class extends F{constructor(){super(...arguments),this.id=null,this.name=null,this.acquisitionDate=null,this.cameraID=null,this.center=null,this.gps=null,this.orientation=null}writeAcquisitionDate(i,t){t.acquisitionDate=i?.getTime()}};s([a({json:{write:!0}})],K.prototype,"id",void 0),s([a({json:{write:!0}})],K.prototype,"name",void 0),s([a({type:Date,json:{write:!0}})],K.prototype,"acquisitionDate",void 0),s([I("acquisitionDate")],K.prototype,"writeAcquisitionDate",null),s([a({json:{write:!0}})],K.prototype,"cameraID",void 0),s([a({type:V,json:{write:!0}})],K.prototype,"center",void 0),s([a({json:{write:!0}})],K.prototype,"gps",void 0),s([a({json:{write:!0}})],K.prototype,"orientation",void 0),K=s([R("esri.rest.support.ImageGPSInfo")],K);const vi=K;let Ve=class extends F{constructor(){super(...arguments),this.images=null,this.cameras=null}};s([a({type:[vi],json:{write:!0}})],Ve.prototype,"images",void 0),s([a({type:[Ri],json:{write:!0}})],Ve.prototype,"cameras",void 0),Ve=s([R("esri.rest.support.ImageGPSInfoResult")],Ve);const bi=Ve;var ht;let le=ht=class extends X{constructor(){super(...arguments),this.type="height",this.fromGeometry=null,this.toGeometry=null,this.operationType="base-and-top",this.linearUnit="meters"}writeFromGeometry(i,t,o){i!=null&&(t.geometryType=Y(i),t[o]=i.toJSON())}get measureOperation(){return this.operationType}clone(){return new ht(C({fromGeometry:this.fromGeometry,toGeometry:this.toGeometry,operationType:this.operationType,linearUnit:this.linearUnit,mosaicRule:this.mosaicRule,pixelSize:this.pixelSize,raster:this.raster}))}};s([a({type:V,json:{read:!0}})],le.prototype,"fromGeometry",void 0),s([I("fromGeometry")],le.prototype,"writeFromGeometry",null),s([a({type:V,json:{read:!0,write:!0}})],le.prototype,"toGeometry",void 0),s([a({type:B.apiValues,json:{write:B.write}})],le.prototype,"measureOperation",null),s([a({json:{read:!0}})],le.prototype,"operationType",void 0),s([a({type:String,json:{read:ge.read,write:ge.write}})],le.prototype,"linearUnit",void 0),le=ht=s([R("esri.rest.support.ImageHeightParameters")],le);const Si=le;let We=class extends ye{constructor(){super(...arguments),this.height=null}};s([a({type:Ne,json:{read:!0,write:!0}})],We.prototype,"height",void 0),We=s([R("esri.rest.support.ImageHeightResult")],We);const xi=We;var gt;let O=gt=class extends F{constructor(){super(...arguments),this.geometry=null,this.rasterFunctions=null,this.pixelSize=null,this.returnGeometry=!0,this.returnCatalogItems=!0,this.returnPixelValues=!0,this.maxItemCount=null,this.timeExtent=null,this.raster=void 0,this.viewId=void 0,this.processAsMultidimensional=!1}writeGeometry(i,t,o){i!=null&&(t.geometryType=Y(i),t[o]=JSON.stringify(i.toJSON()))}set mosaicRule(i){let t=i;t?.mosaicMethod&&(t=H.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}writeMosaicRule(i,t,o){i!=null&&(t[o]=JSON.stringify(i.toJSON()))}set rasterFunction(i){let t=i;t?.rasterFunction&&(t=S.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}writeRasterFunction(i,t,o){i!=null&&(t[o]=JSON.stringify(i.toJSON())),i.rasterFunctionDefinition&&(t[o]=JSON.stringify(i.rasterFunctionDefinition))}writeRasterFunctions(i,t,o){i!=null&&(t[o]=JSON.stringify(i.map(e=>e.rasterFunctionDefinition||e.toJSON())))}writePixelSize(i,t,o){i!=null&&(t[o]=JSON.stringify(i))}writeTimeExtent(i,t,o){if(i!=null){const e=i.start!=null?i.start.getTime():null,r=i.end!=null?i.end.getTime():null;t[o]=e!=null?r!=null?`${e},${r}`:`${e}`:null}}clone(){return new gt(C({geometry:this.geometry,mosaicRule:this.mosaicRule,rasterFunction:this.rasterFunction,rasterFunctions:this.rasterFunctions,pixelSize:this.pixelSize,returnGeometry:this.returnGeometry,returnCatalogItems:this.returnCatalogItems,returnPixelValues:this.returnPixelValues,maxItemCount:this.maxItemCount,processAsMultidimensional:this.processAsMultidimensional,raster:this.raster,viewId:this.viewId,timeExtent:this.timeExtent}))}};s([a({json:{write:!0}})],O.prototype,"geometry",void 0),s([I("geometry")],O.prototype,"writeGeometry",null),s([a({type:H,json:{write:!0}})],O.prototype,"mosaicRule",null),s([I("mosaicRule")],O.prototype,"writeMosaicRule",null),s([a({type:S,json:{write:!0,name:"renderingRule"}})],O.prototype,"rasterFunction",null),s([I("rasterFunction")],O.prototype,"writeRasterFunction",null),s([a({type:[S],json:{write:!0,name:"renderingRules"}})],O.prototype,"rasterFunctions",void 0),s([I("rasterFunctions")],O.prototype,"writeRasterFunctions",null),s([a({type:V,json:{write:!0}})],O.prototype,"pixelSize",void 0),s([I("pixelSize")],O.prototype,"writePixelSize",null),s([a({type:Boolean,json:{write:!0}})],O.prototype,"returnGeometry",void 0),s([a({type:Boolean,json:{write:!0}})],O.prototype,"returnCatalogItems",void 0),s([a({type:Boolean,json:{write:!0}})],O.prototype,"returnPixelValues",void 0),s([a({type:Number,json:{write:!0}})],O.prototype,"maxItemCount",void 0),s([a({type:bt,json:{write:{target:"time"}}})],O.prototype,"timeExtent",void 0),s([I("timeExtent")],O.prototype,"writeTimeExtent",null),s([a({json:{write:!0}})],O.prototype,"raster",void 0),s([a({json:{write:!0}})],O.prototype,"viewId",void 0),s([a({type:Boolean,json:{write:!0}})],O.prototype,"processAsMultidimensional",void 0),O=gt=s([R("esri.rest.support.ImageIdentifyParameters")],O);const qt=O;let Z=class extends F{constructor(){super(...arguments),this.catalogItemVisibilities=null,this.catalogItems=null,this.location=null,this.name=null,this.objectId=null,this.processedValues=null,this.properties=null,this.value=null}};s([a({json:{write:!0}})],Z.prototype,"catalogItemVisibilities",void 0),s([a({type:Ct,json:{write:!0}})],Z.prototype,"catalogItems",void 0),s([a({type:V,json:{write:!0}})],Z.prototype,"location",void 0),s([a({json:{write:!0}})],Z.prototype,"name",void 0),s([a({json:{write:!0}})],Z.prototype,"objectId",void 0),s([a({json:{write:!0}})],Z.prototype,"processedValues",void 0),s([a({json:{write:!0}})],Z.prototype,"properties",void 0),s([a({json:{write:!0}})],Z.prototype,"value",void 0),Z=s([R("esri.rest.support.ImageIdentifyResult")],Z);const Ii=Z;var ft;let Pe=ft=class extends F{constructor(){super(...arguments),this.geometries=null,this.rasterId=null}writeGeometry(i,t,o){t.geometries={geometryType:"esriGeometryPoint",geometries:i.map(e=>e.toJSON())}}clone(){return new ft({geometries:this.geometries?.map(i=>i.clone())??[],rasterId:this.rasterId})}};s([a({type:[V],json:{write:!0}})],Pe.prototype,"geometries",void 0),s([I("geometries")],Pe.prototype,"writeGeometry",null),s([a({type:Le,json:{write:!0}})],Pe.prototype,"rasterId",void 0),Pe=ft=s([R("esri.rest.support.ImagePixelLocationParameters")],Pe);const Fi=Pe;let Ke=class extends F{constructor(){super(...arguments),this.geometries=null}};s([a({json:{write:!0}})],Ke.prototype,"geometries",void 0),Ke=s([R("esri.rest.support.ImagePixelLocationResult")],Ke);const Di=Ke;var wt;let ve=wt=class extends X{constructor(){super(...arguments),this.type="point",this.geometry=null,this.is3D=!1}writeGeometry(i,t,o){i!=null&&(t.geometryType=Y(i),t[o]=i.toJSON())}get measureOperation(){const{is3D:i,geometry:t}=this;return t.type==="point"?i?"point-3D":"point":i?"centroid-3D":"centroid"}clone(){return new wt(C({geometry:this.geometry,is3D:this.is3D,mosaicRule:this.mosaicRule,pixelSize:this.pixelSize,raster:this.raster}))}};s([a({types:ne,json:{name:"fromGeometry",read:ee}})],ve.prototype,"geometry",void 0),s([I("geometry")],ve.prototype,"writeGeometry",null),s([a({type:B.apiValues,json:{read:B.read,write:B.write}})],ve.prototype,"measureOperation",null),s([a({json:{read:!0}})],ve.prototype,"is3D",void 0),ve=wt=s([R("esri.rest.support.ImagePointParameters")],ve);const Ti=ve;let Ze=class extends ye{constructor(){super(...arguments),this.point=null}};s([a({type:V,json:{name:"point.value",read:!0,write:!0}})],Ze.prototype,"point",void 0),Ze=s([R("esri.rest.support.ImagePointResult")],Ze);const Pi=Ze;var Rt;let G=Rt=class extends F{constructor(){super(...arguments),this.geometry=null,this.interpolation="nearest",this.mosaicRule=null,this.outFields=null,this.pixelSize=null,this.returnFirstValueOnly=!0,this.sampleDistance=null,this.sampleCount=null,this.sliceId=null,this.timeExtent=null}writeGeometry(i,t,o){i!=null&&(t.geometryType=Y(i),t[o]=i.toJSON())}set locations(i){if(i?.length){const t=new kt({spatialReference:i[0].spatialReference,points:i.map(({x:o,y:e})=>[o,e])});this._set("locations",i),this.geometry=t}}clone(){return new Rt(C({geometry:this.geometry,locations:this.locations,interpolation:this.interpolation,mosaicRule:this.mosaicRule,outFields:this.outFields,raster:this.raster,returnFirstValueOnly:this.returnFirstValueOnly,sampleDistance:this.sampleDistance,sampleCount:this.sampleCount,sliceId:this.sliceId,pixelSize:this.pixelSize,timeExtent:this.timeExtent}))}};s([a({types:ne,json:{read:ee}})],G.prototype,"geometry",void 0),s([I("geometry")],G.prototype,"writeGeometry",null),s([a()],G.prototype,"locations",null),s([a({type:String,json:{type:he.jsonValues,read:he.read,write:he.write}})],G.prototype,"interpolation",void 0),s([a({type:H,json:{write:!0}})],G.prototype,"mosaicRule",void 0),s([a({type:[String],json:{write:!0}})],G.prototype,"outFields",void 0),s([a({type:V,json:{write:!0}})],G.prototype,"pixelSize",void 0),s([a({type:String,json:{write:!0}})],G.prototype,"raster",void 0),s([a({type:Boolean,json:{write:!0}})],G.prototype,"returnFirstValueOnly",void 0),s([a({type:Number,json:{write:!0}})],G.prototype,"sampleDistance",void 0),s([a({type:Number,json:{write:!0}})],G.prototype,"sampleCount",void 0),s([a({type:Number,json:{write:!0}})],G.prototype,"sliceId",void 0),s([a({type:bt,json:{read:{source:"time"},write:{target:"time"}}})],G.prototype,"timeExtent",void 0),G=Rt=s([R("esri.rest.support.ImageSampleParameters")],G);const ji=G;let ue=class extends F{constructor(){super(...arguments),this.attributes=null,this.location=null,this.locationId=null,this.rasterId=null,this.resolution=null,this.pixelValue=null}};s([a({json:{write:!0}})],ue.prototype,"attributes",void 0),s([a({type:V,json:{write:!0}})],ue.prototype,"location",void 0),s([a({json:{write:!0}})],ue.prototype,"locationId",void 0),s([a({json:{write:!0}})],ue.prototype,"rasterId",void 0),s([a({json:{write:!0}})],ue.prototype,"resolution",void 0),s([a({json:{write:!0}})],ue.prototype,"pixelValue",void 0),ue=s([R("esri.rest.support.ImageSample")],ue);const Ni=ue;let Xe=class extends F{constructor(){super(...arguments),this.samples=null}};s([a({type:[Ni],json:{write:!0}})],Xe.prototype,"samples",void 0),Xe=s([R("esri.rest.support.ImageSampleResult")],Xe);const _i=Xe;let be=class extends fe(F){constructor(){super(...arguments),this.geometries=[],this.rasterIds=null,this.outSpatialReference=null}writeGeometries(i,t,o){t.geometries=i?.length?{geometryType:Y(i[0]),geometries:i.map(e=>({...e.toJSON(),spatialReference:void 0}))}:null}};s([a({types:[ne]})],be.prototype,"geometries",void 0),s([I("geometries")],be.prototype,"writeGeometries",null),s([a({type:[Le],json:{write:!0}})],be.prototype,"rasterIds",void 0),s([a({type:re,json:{name:"outSR",write:!0}})],be.prototype,"outSpatialReference",void 0),be=s([R("esri.rest.support.ImageToMapMultirayParameters")],be);const Oi=be;let pe=class extends fe(F){constructor(){super(...arguments),this.geometry=null,this.rasterId=null,this.outSpatialReference=null,this.depthOffset=0,this.adjust=!1}writeGeometry(i,t,o){i!=null&&(t.geometryType=Y(i),t[o]={...i.toJSON(),spatialReference:void 0})}};s([a({types:ne,json:{read:ee,write:!0}})],pe.prototype,"geometry",void 0),s([I("geometry")],pe.prototype,"writeGeometry",null),s([a({json:{write:!0}})],pe.prototype,"rasterId",void 0),s([a({type:re,json:{name:"outSR",write:!0}})],pe.prototype,"outSpatialReference",void 0),s([a({json:{name:"options.DOff",write:!0}})],pe.prototype,"depthOffset",void 0),s([a({json:{name:"options.Adjust",write:!0}})],pe.prototype,"adjust",void 0),pe=s([R("esri.rest.support.ImageToMapParameters")],pe);const Ci=pe;let Me=class extends fe(F){constructor(){super(...arguments),this.referenceUri=null,this.rasterId=null}};s([a({type:String,json:{name:"uri",write:!0}})],Me.prototype,"referenceUri",void 0),s([a({type:Number,json:{write:!0}})],Me.prototype,"rasterId",void 0),Me=s([R("esri.rest.support.ImageUrlParameters")],Me);const Ai=Me;let Ye=class extends F{constructor(){super(...arguments),this.url=null}};s([a({json:{name:"imageURL",write:!0}})],Ye.prototype,"url",void 0),Ye=s([R("esri.rest.support.ImageUrlResult")],Ye);const Vi=Ye;let Se=class extends fe(F){constructor(){super(...arguments),this.geometry=null,this.rasterId=null,this.visibleOnly=!1}writeGeometry(i,t,o){i!=null&&(t.geometryType=Y(i),t[o]=JSON.stringify(i))}};s([a({types:ne,json:{read:ee,write:!0}})],Se.prototype,"geometry",void 0),s([I("geometry")],Se.prototype,"writeGeometry",null),s([a({json:{write:!0}})],Se.prototype,"rasterId",void 0),s([a({json:{name:"options.VisibleOnly",write:!0}})],Se.prototype,"visibleOnly",void 0),Se=s([R("esri.rest.support.MapToImageParameters")],Se);const Mi=Se;let me=class extends F{constructor(){super(...arguments),this.geometry=null,this.length=null,this.area=null,this.center=null}readCenter(i,t){return i.spatialReference||(i={...i,spatialReference:t.Shape.spatialReference}),V.fromJSON(i)}};s([a({types:ne,json:{name:"Shape",read:ee,write:!0}})],me.prototype,"geometry",void 0),s([a({json:{name:"Length",write:!0}})],me.prototype,"length",void 0),s([a({json:{name:"Area",write:!0}})],me.prototype,"area",void 0),s([a({json:{name:"Center",write:!0}})],me.prototype,"center",void 0),s([E("center")],me.prototype,"readCenter",null),me=s([R("esri.rest.support.MeasureAreaFromImageResult")],me);const Ji=me;var vt;let je=vt=class extends F{constructor(){super(...arguments),this.geometry=null,this.rasterId=void 0}writeGeometry(i,t,o){i!=null&&(t.geometryType=Y(i),t[o]={...i.toJSON(),spatialReference:void 0})}clone(){const i=C({geometry:this.geometry,rasterId:this.rasterId});return new vt(i)}};s([a({types:ne,json:{name:"fromGeometry",read:ee,write:!0}})],je.prototype,"geometry",void 0),s([I("geometry")],je.prototype,"writeGeometry",null),s([a({json:{write:!0}})],je.prototype,"rasterId",void 0),je=vt=s([R("esri.rest.support.MeasureFromImageParameters")],je);const Ei=je;let Je=class extends F{constructor(){super(...arguments),this.geometry=null,this.length=null}};s([a({types:ne,json:{name:"Shape",read:ee,write:!0}})],Je.prototype,"geometry",void 0),s([a({json:{name:"Length",write:!0}})],Je.prototype,"length",void 0),Je=s([R("esri.rest.support.MeasureLengthFromImageResult")],Je);const qi=Je;function St(i){const t=i?.time;if(t&&(t.start!=null||t.end!=null)){const o=[];t.start!=null&&o.push(t.start),t.end==null||o.includes(t.end)||o.push(t.end),i.time=o.join(",")}}async function Gt(i,t,o){t=M(hr,t);const e=q(i),r=t.geometry?[t.geometry]:[],n=await xe(r),l=t.toJSON();St(l);const u=n?.[0];u!=null&&(l.geometry=se(u));const p=L({...e.query,f:"json",...l});return $(p,o)}async function Gi(i,t,o){const e=(t=M(pi,t)).toJSON();e.angleName!=null&&(e.angleName=e.angleName.join(",")),t?.point?.spatialReference?.imageCoordinateSystem&&(e.point.spatialReference=st(t.point.spatialReference)),t?.spatialReference?.imageCoordinateSystem&&(e.spatialReference=_e(t.spatialReference));const r=q(i),n=L({...r.query,f:"json",...e}),l=$(n,o),{data:u}=await x(`${r.path}/computeAngles`,l);return u.spatialReference=u.spatialReference?u.spatialReference.geodataXform!=null?new re({wkid:0,imageCoordinateSystem:u.spatialReference}):re.fromJSON(u.spatialReference):null,u.north==="NaN"&&(u.north=null),u.up==="NaN"&&(u.up=null),new ci(u)}async function Li(i,t,o){const e=(t=M(Fi,t)).toJSON(),{geometries:r}=t;if(r)for(let m=0;m{u.avg=u.mean,u.stddev=u.standardDeviation}),{statistics:l,histograms:n.histograms}}async function zi(i,t,o){const e=await Gt(i,t,o),r=q(i),{data:n}=await x(`${r.path}/computeHistograms`,e);return{histograms:n.histograms}}async function Ui(i,t,o){const e=(t=M(ji,t)).toJSON();St(e),e.outFields?.length&&(e.outFields=e.outFields.join(","));const r=await xe(t.geometry),n=r?.[0];n!=null&&(e.geometry=se(n));const l=q(i),u=L({...l.query,f:"json",...e}),p=$(u,o),{data:m}=await x(`${l.path}/getSamples`,p),c=m?.samples?.map(d=>{const g=d.value==="NaN"||d.value===""?null:d.value.split(" ").map(h=>Number(h));return{...d,pixelValue:g}});return _i.fromJSON({samples:c})}async function jt(i,t,o){t=M(qt,t);const e=q(i),r=t.geometry?[t.geometry]:[];return xe(r).then(n=>{const l=t.toJSON(),u=n?.[0];u!=null&&(l.geometry=JSON.stringify(se(u)));const p=L({...e.query,f:"json",...l}),m=$(p,o);return x(e.path+"/identify",m)}).then(n=>Ii.fromJSON(n.data))}async function Hi(i,t,o){t=M(Si,t);const e=await it(i,t,[t.fromGeometry,t.toGeometry],o);return xi.fromJSON(e)}async function Bi(i,t,o){t=M(mi,t);const e=await it(i,t,[t.geometry],o);return di.fromJSON(e)}async function Qi(i,t,o){t=M(Ti,t);const e=await it(i,t,[t.geometry],o);return Pi.fromJSON(e)}async function ki(i,t,o){t=M(gi,t);const e=await it(i,t,[t.fromGeometry,t.toGeometry],o);return fi.fromJSON(e)}async function it(i,t,o,e){const r=q(i),n=await xe(o),l=t.toJSON();n[0]!=null&&(l.fromGeometry=JSON.stringify(se(n[0]))),n[1]!=null&&(l.toGeometry=JSON.stringify(se(n[1])));const u=L({...r.query,f:"json",...l}),p=$(u,e),{data:m}=await x(r.path+"/measure",p);return m}async function Wi(i,t,o){const e=await Lt(i,t,o);return qi.fromJSON(e)}async function Ki(i,t,o){const e=await Lt(i,t,o);return Ji.fromJSON(e)}async function Lt(i,t,o){t=M(Ei,t);const e=q(i),r=t.toJSON(),n=L({...e.query,f:"json",...r}),l=$(n,o),{data:u}=await x(e.path+"/measureFromImage",l);return u}function se(i){const t=i.toJSON();return i.spatialReference?.imageCoordinateSystem&&(t.spatialReference=st(i.spatialReference)),t}function st(i){const{imageCoordinateSystem:t}=i;if(t){const{id:o,referenceServiceName:e}=t;return o!=null?e?{icsid:o,icsns:e}:{icsid:o}:{ics:t}}return i.toJSON()}function _e(i,t){if(!i.imageCoordinateSystem)return pt(i);const o=st(i),{icsid:e,icsns:r}=o;return e==null||r!=null&&!t?.toLowerCase().includes("/"+r.toLowerCase()+"/")?JSON.stringify(o):`0:${e}`}async function Zi(i,t,o){t=M(yi,t);const e=q(i),r=t.toJSON();t.outSpatialReference&&(r.outSR=_e(t.outSpatialReference));const n=L({...e.query,f:"json",...r}),l=$(n,o),{data:u}=await x(e.path+"/queryBoundary",l);return hi.fromJSON(u)}async function Xi(i,t,o){const e=(t=M(wi,t)).toJSON();St(e),e.objectIds?.length&&(e.objectIds=e.objectIds.join(",")),e.geometry||e.objectIds||e.time||e.where||(e.where="1=1");const r=await xe(t.geometry),n=r?.[0];n!=null&&(e.geometry=se(n));const l=n?.spatialReference??t.geometry?.spatialReference;l&&(e.inSR=_e(l));const u=q(i),p=L({...u.query,f:"json",...e}),m=$(p,o),{data:c}=await x(`${u.path}/queryGPSInfo`,m);return bi.fromJSON(c)}async function Yi(i,t,o){const e=(t=M(Ci,t)).toJSON();t.geometry.spatialReference.imageCoordinateSystem&&(e.geometry=se(t.geometry)),t.depthOffset&&t.adjust||delete e.options;const r=q(i),n=L({...r.query,f:"json",...e}),l=$(n,o),{data:u}=await x(`${r.path}/imageToMap`,l);return ee(u)}async function es(i,t,o){const e=(t=M(Oi,t)).toJSON();t.rasterIds?.length&&(e.rasterIds=t.rasterIds.join(","));const r=q(i),n=L({...r.query,f:"json",...e}),l=$(n,o),{data:u}=await x(`${r.path}/imageToMapMultiray`,l);return ee(u)}async function ts(i,t,o){const e=(t=M(Mi,t)).toJSON(),r=await xe(t.geometry),n=r?.[0];n!=null&&(e.geometry=se(n)),t.visibleOnly||delete e.options;const l=n?.spatialReference??t.geometry?.spatialReference;l&&(e.inSR=_e(l));const u=q(i),p=L({...u.query,f:"json",...e}),m=$(p,o),{data:c}=await x(`${u.path}/mapToImage`,m);return ee(c)}async function rs(i,t,o){const e=(t=M(Ai,t)).toJSON(),r=q(i),n=L({...r.query,f:"json",...e}),l=$(n,o),{data:u}=await x(`${r.path}/getImageUrl`,l);return Vi.fromJSON(u)}async function is(i,t,o){const e=(t=M(oi,t)).toJSON(),r=await xe([t.fromGeometry,t.toGeometry]);r[0]!=null&&(e.fromGeometry=se(r[0]),r[0].spatialReference&&(e.inSR=_e(r[0].spatialReference))),r[1]!=null&&(e.toGeometry=se(r[1])),t.objectIds?.length&&(e.objectIds=e.objectIds.join(","));const n=q(i),l=L({...n.query,f:"json",...e}),u=$(l,o),{data:p}=await x(`${n.path}/find`,u);return ui.fromJSON(p)}async function ss(i,t,o){const e=q(i),r=L({...e?.query,f:"json"}),n=$(r,o),l=`${e?.path}/${t}/info`,u=x(`${l}`,n),p=x(`${l}/keyProperties`,n),m=await Promise.allSettled([u,p]),c=m[0].status==="fulfilled"?m[0].value.data:null,d=m[1].status==="fulfilled"?m[1].value.data:null;let g=null;c.statistics?.length&&(g=c.statistics.map(J=>({min:J[0],max:J[1],avg:J[2],stddev:J[3]})));const h=Ee.fromJSON(c.extent),f=Math.ceil(h.width/c.pixelSizeX-.1),y=Math.ceil(h.height/c.pixelSizeY-.1),v=h.spatialReference,w=new V({x:c.pixelSizeX,y:c.pixelSizeY,spatialReference:v}),T=c.histograms?.length?c.histograms:null,j=new _r({origin:c.origin,blockWidth:c.blockWidth,blockHeight:c.blockHeight,firstPyramidLevel:c.firstPyramidLevel,maximumPyramidLevel:c.maxPyramidLevel});return new Nt({width:f,height:y,bandCount:c.bandCount,extent:h,spatialReference:v,pixelSize:w,pixelType:c.pixelType.toLowerCase(),statistics:g,histograms:T,keyProperties:d,storageInfo:j})}const ns=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),as=Xt(Yt,{min:0,max:255});function os(i){const t=JSON.stringify(i),o=t.includes('"rasterFunctionDefinition":{'),e=o?t.match(/"type":"(.*?FunctionArguments")/gi):t.match(/"rasterFunction":"(.*?")/gi),r=e?.map(n=>o?n.slice(8,-18):n.slice(18,-1));return r?r.join("/"):null}const ls=i=>{let t=class extends i{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._cachedRendererJson=null,this._serviceSupportsMosaicRule=null,this._rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new _({layer:this}))}readServiceSupportsMosaicRule(e,r){return this._isMosaicRuleSupported(r)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.length<1||this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.forEach(r=>{e.set(r.name.toLowerCase().replaceAll(/ /gi,"_"),r.name)}),e}readBandIds(e,r){if(Array.isArray(e)&&e.length>0&&e.every(n=>typeof n=="number"))return e}readCapabilities(e,r){return this._readCapabilities(r)}writeCompressionQuality(e,r,n){e!=null&&this.format!=="lerc"&&(r[n]=e)}writeCompressionTolerance(e,r,n){this.format==="lerc"&&e!=null&&(r[n]=e)}readDefaultMosaicRule(e,r){return this._serviceSupportsMosaicRule?H.fromJSON(r):null}get fieldsIndex(){return this.fields?new Cr(this.fields):null}set format(e){e&&ns.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,r){return r.serviceDataType==="esriImageServiceDataTypeVector-UV"||r.serviceDataType==="esriImageServiceDataTypeVector-MagDir"||this.pixelFilter!=null?"lerc":"jpgpng"}readMinScale(e,r){return r.minLOD!=null&&r.maxLOD!=null?e:0}readMaxScale(e,r){return r.minLOD!=null&&r.maxLOD!=null?e:0}set mosaicRule(e){let r=e;r?.mosaicMethod&&(r=H.fromJSON({...r.toJSON(),mosaicMethod:r.mosaicMethod,mosaicOperation:r.mosaicOperation})),this._set("mosaicRule",r)}readMosaicRule(e,r){const n=e||r.mosaicRule;return n?H.fromJSON(n):this._isMosaicRuleSupported(r)?H.fromJSON(r):null}writeMosaicRule(e,r,n){let l=this.mosaicRule;const u=this.definitionExpression;l?u&&u!==l.where&&(l=l.clone(),l.where=u):u&&(l=new H({where:u})),this._isValidCustomizedMosaicRule(l)&&(r[n]=l.toJSON())}writeNoData(e,r,n){e!=null&&typeof e=="number"&&(r[n]=as(e))}readObjectIdField(e,r){return e||(e=r.fields.find(n=>n.type==="esriFieldTypeOID"||n.type==="oid")?.name),e}get parsedUrl(){return Wt(this.url)}readSourceType(e,r){return this._isMosaicDataset(r)?"mosaic-dataset":"raster-dataset"}get renderer(){const{activePresetRendererName:e,presetRenderers:r}=this;return e?r?.find(({name:n})=>n===e)?.renderer.clone():this.internalRenderer}set renderer(e){this.activePresetRendererName=null,this.internalRenderer=e}set internalRenderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("internalRenderer",e)}readRenderer(e,r,n){const l=r?.layerDefinition?.drawingInfo?.renderer,u=ar(l,n);return u==null?null:(u.type==="vector-field"&&r.symbolTileSize&&!l.symbolTileSize&&(u.symbolTileSize=r.symbolTileSize),At(u)||It.getLogger(this).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),u)}writeRenderer(e,r,n){r.layerDefinition=r.layerDefinition||{},r.layerDefinition.drawingInfo=r.layerDefinition.drawingInfo||{},r.layerDefinition.drawingInfo.renderer=e.toJSON(),e.type==="vector-field"&&(r.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this._rasterAttributeTableFieldPrefix,r=new we({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),n=new we({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),l=new we({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let u=this.fields?C(this.fields):[];u.push(n),this.capabilities?.operations.supportsQuery&&this.fields&&this.fields.length>0&&u.push(r),this.version>=10.4&&this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.some(m=>m.name.toLowerCase()==="none")&&u.push(l),this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.filter(m=>m.name.toLowerCase()!=="none").forEach(m=>{u.push(new we({name:"Raster.ServicePixelValue."+m.name,alias:m.name,domain:null,editable:!1,length:50,type:"string"}))}),this._isVectorDataSet()&&(u.push(new we({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),u.push(new we({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:p}=this.rasterInfo??{};if(p!=null){const m=p.fields.filter(c=>c.type!=="esriFieldTypeOID"&&c.name.toLowerCase()!=="value").map(c=>{const d=C(c);return d.name=e+c.name,d});u=u.concat(m)}return u}set rasterFunction(e){let r=e;r?.rasterFunction&&(r=S.fromJSON({...r.toJSON(),rasterFunction:r.rasterFunction,rasterFunctionArguments:r.rasterFunctionArguments})),this._set("rasterFunction",r)}readRasterFunction(e,r){const n=r.rasterFunctionInfos;return r.renderingRule||n?.length&&n[0].name!=="None"?this._isRFTJson(r.renderingRule)?S.fromJSON({rasterFunctionDefinition:r.renderingRule}):S.fromJSON(r.renderingRule||{rasterFunctionInfos:r.rasterFunctionInfos}):null}readSpatialReference(e,r){const n=e||r.extent.spatialReference;return n?re.fromJSON(n):null}readPixelType(e){return nt.fromJSON(e)||e}writePixelType(e,r,n){this.serviceRasterInfo!=null&&this.pixelType===this.serviceRasterInfo.pixelType||(r[n]=nt.toJSON(e))}readVersion(e,r){let n=r.currentVersion;return n||(n=r.hasOwnProperty("fields")||r.hasOwnProperty("timeInfo")?10:9.3),n}applyFilter(e){let r=e;return this.pixelFilter&&(r=this._clonePixelData(e),this.pixelFilter(r)),r}async applyRenderer(e,r){let n=e;const{renderer:l,symbolizer:u,pixelFilter:p,bandIds:m}=this;if(!this._isPicture()&&l&&u&&!p){const c=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(l.toJSON()),d=this._rasterJobHandler.instance;if(d){c&&(u.bind(),await d.updateSymbolizer(u,r),this._cachedRendererJson=l.toJSON());const g=await d.symbolize({bandIds:m,...e},r);n={extent:e.extent,pixelBlock:g}}else n={extent:e.extent,pixelBlock:u.symbolize({bandIds:m,...e})}}return n}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,r){if(!(await this._fetchCapabilities(r?.signal)).operations.supportsComputeAngles)throw new b("imagery-layer:compute-angles","this operation is not supported on the input image service");return Gi(this.url,e,this._getRequestOptions(r))}async computePixelSpaceLocations(e,r){if(!(await this._fetchCapabilities(r?.signal)).operations.supportsComputePixelLocation)throw new b("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return Li(this.url,e,this._getRequestOptions(r))}async computeHistograms(e,r){if(!(await this._fetchCapabilities(r?.signal)).operations.supportsComputeHistograms)throw new b("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=C(e),this._applyMosaicAndRenderingRules(e),zi(this.url,e,this._getRequestOptions(r))}async computeStatisticsHistograms(e,r){if(!(await this._fetchCapabilities(r?.signal)).operations.supportsComputeStatisticsHistograms)throw new b("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=C(e),this._applyMosaicAndRenderingRules(e),$i(this.url,e,this._getRequestOptions(r))}async measureHeight(e,r){const n=await this._fetchCapabilities(r?.signal);if(!(e.operationType==="base-and-top"?n.mensuration.supportsHeightFromBaseAndTop:e.operationType==="base-and-top-shadow"?n.mensuration.supportsHeightFromBaseAndTopShadow:n.mensuration.supportsHeightFromTopAndTopShadow))throw new b("imagery-layer:measure-height","this operation is not supported on the input image service");return e=C(e),this._applyMosaicAndRenderingRules(e),Hi(this.url,e,this._getRequestOptions(r))}async measureAreaAndPerimeter(e,r){const n=await this._fetchCapabilities(r?.signal);if(!(n.mensuration.supportsAreaAndPerimeter&&(!e.is3D||n.mensuration.supports3D)))throw new b("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=C(e),this._applyMosaicAndRenderingRules(e),Bi(this.url,e,this._getRequestOptions(r))}async measureDistanceAndAngle(e,r){const n=await this._fetchCapabilities(r?.signal);if(!(n.mensuration.supportsDistanceAndAngle&&(!e.is3D||n.mensuration.supports3D)))throw new b("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=C(e),this._applyMosaicAndRenderingRules(e),ki(this.url,e,this._getRequestOptions(r))}async measurePointOrCentroid(e,r){const n=await this._fetchCapabilities(r?.signal);if(!(n.mensuration.supportsPointOrCentroid&&(!e.is3D||n.mensuration.supports3D)))throw new b("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=C(e),this._applyMosaicAndRenderingRules(e),Qi(this.url,e,this._getRequestOptions(r))}async measureLengthFromImage(e,r){if(!(await this._fetchCapabilities(r?.signal)).operations.supportsMeasureFromImage)throw new b("imagery-layer:measure-length-from-image","this operation is not supported on the input image service");if(e.geometry.type!=="polyline")throw new b("imagery-layer:measure-length-from-image","this input geometry must be a polyline");return Wi(this.url,e,this._getRequestOptions(r))}async measureAreaFromImage(e,r){if(!(await this._fetchCapabilities(r?.signal)).operations.supportsMeasureFromImage)throw new b("imagery-layer:measure-area-from-image","this operation is not supported on the input image service");if(e.geometry.type!=="polygon")throw new b("imagery-layer:measure-area-from-image","this input geometry must be a polygon");return Ki(this.url,e,this._getRequestOptions(r))}getField(e){const{fieldsIndex:r}=this;return r?.get(e)}getFieldDomain(e,r){const n=this.getField(e);return n?n.domain:null}async fetchImage(e,r,n,l={}){if(e==null||r==null||n==null)throw new b("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");if(this.renderer||this.symbolizer){const d=await this._generateRasterInfo(this.rasterFunction,{signal:l.signal});d&&(this.rasterInfo=d)}const u=this.getExportImageServiceParameters(e,r,n,l.timeExtent);if(u==null){if(l.requestAsImageElement&&this._canRequestImageElement(this.format)){const w=document.createElement("canvas");return w.width=r,w.height=n,l.returnImageBitmap?{imageBitmap:await Tt(w,`${o(this.parsedUrl)}/exportImage`,l.signal)}:{imageOrCanvasElement:w}}const{bandIds:d,rasterInfo:g}=this,h=(d?.length||g.bandCount)??0,f=r*n,y=g.pixelType,v=[];for(let w=0;w=10.3?e?.rasterFunction:null})}).then(r=>r.data)}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new b("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):x(o(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(r=>Ct.fromJSON(r.data))}getCatalogItemRasterInfo(e,r){const n={...r,query:this._getQueryParams()};return ss(o(this.parsedUrl),e,n)}async getCatalogItemICSInfo(e,r){const{data:n}=await x(o(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...r}),l=n?.ics;if(!l)return;let u=null;try{u=(await x(o(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...r})).data.extent}catch{}if(!u?.spatialReference)return{ics:l,icsToPixelTransform:null,icsExtent:null,northDirection:null};const p=this.version>=10.7?x(o(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...r}).then(P=>P.data).catch(()=>({})):{},m=u.spatialReference,c={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[u]}),inSR:pt(m),outSR:"0:"+e},d=x(o(this.parsedUrl)+"/project",{query:this._getQueryParams(c),...r}).then(P=>P.data).catch(()=>({})),g=5,h=(u.xmin+u.xmax)/2,f=(u.ymax-u.ymin)/(g+1),y=u.ymin+f,v=[];for(let P=0;PP.data).catch(()=>({})),j=await Promise.all([p,d,T]);let J=j[0].ipxf;if(J==null){const P=l.geodataXform?.xf_0;P?.name?.toLowerCase()==="topup"&&P?.coefficients?.length===6&&(J={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:P.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const N=Ee.fromJSON(j[1]?.geometries?.[0]);N&&(N.spatialReference=new re({wkid:0,imageCoordinateSystem:l}));const D=j[2].geometries?j[2].geometries.filter(P=>P?.x!=null&&P.y!=null&&P.x!=="NaN"&&P.y!=="NaN"):[],A=D.length;if(A<3)return{ics:l,icsToPixelTransform:J,icsExtent:N,northDirection:null};let U=0,Oe=0,$e=0,ze=0;for(let P=0;PD[0].x,xt=D[g-1].y>D[0].y;return Q===1/0?k=xt?90:270:Q===0?k=Ie?0:180:Q>0?k=Ie?180*Math.atan(Q)/Math.PI:180*Math.atan(Q)/Math.PI+180:Q<0&&(k=xt?180+180*Math.atan(Q)/Math.PI:360+180*Math.atan(Q)/Math.PI),{ics:l,icsToPixelTransform:J,icsExtent:N,northDirection:k}}async generateRasterInfo(e,r){e=M(S,e);const n={...r,query:this._getQueryParams()};if(!e||e.functionName?.toLowerCase()==="none"||this._isVectorFieldResampleFunction(e))return this.serviceRasterInfo??Ft(o(this.parsedUrl),this.sourceJSON,n);const l=os(e);if(!l)throw new b("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[l])return this._functionRasterInfos[l];const u=or(o(this.parsedUrl),e,n);this._functionRasterInfos[l]=u;try{return await u}catch(p){throw this._functionRasterInfos[l]=null,p}}getExportImageServiceParameters(e,r,n,l){e=e.clone().shiftCentralMeridian();const u=_e(e.spatialReference,o(this.parsedUrl));this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const p=this.exportImageServiceParameters.toJSON(),{bandIds:m,noData:c}=p;let{renderingRule:d}=p;const g=this.rasterFunction?.rasterFunctionDefinition,h=this.renderer?.type,f=!h||h==="raster-stretch"||h==="raster-colormap"||h==="unique-value"||h==="class-breaks"||h==="raster-shaded-relief";if(m?.length&&this._hasRasterFunction(this.rasterFunction)&&!g&&f){const w={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:m}};if(d.rasterFunction==="Stretch")w.rasterFunctionArguments.Raster=d.rasterFunctionArguments.Raster,d.rasterFunctionArguments.Raster=w;else if(d.rasterFunction==="Colormap"){const T=d.rasterFunctionArguments.Raster;T?.rasterFunction==="Stretch"?(w.rasterFunctionArguments.Raster=T.rasterFunctionArguments.Raster,T.rasterFunctionArguments.Raster=w):(w.rasterFunctionArguments.Raster=T,d.rasterFunctionArguments.Raster=w)}else w.rasterFunctionArguments.Raster=d,d=w;p.bandIds=void 0}else p.bandIds=m?.join(",");Array.isArray(c)&&c.length>0&&(p.noData=c.join(","));const y=this._processMultidimensionalIntersection(null,l,this.exportImageServiceParameters.mosaicRule);if(y.isOutSide)return null;p.mosaicRule=y.mosaicRule!=null?JSON.stringify(y.mosaicRule):null,l=y.timeExtent,p.renderingRule=this._getRenderingRuleString(S.fromJSON(d));const v={};if(l!=null){const{start:w,end:T}=l.toJSON();w&&T&&w===T?v.time=""+w:w==null&&T==null||(v.time=`${w??"null"},${T??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:u,imageSR:u,size:r+","+n,...p,...v}}async getSamples(e,r){if(!(await this._fetchCapabilities(r?.signal))?.operations.supportsGetSamples)throw new b("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=C(e);const{raster:n}=this;return n&&e.raster==null&&(e.raster=n),Ui(this.url,e,this._getRequestOptions(r))}async identify(e,r){if(!(await this._fetchCapabilities(r?.signal)).operations.supportsIdentify)throw new b("imagery-layer:identify","identify operation is not supported on the input image service");e=C(e),this.version<10.91&&e.geometry?.type==="extent"&&(e.geometry=ut.fromExtent(e.geometry));const n=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(n.isOutSide)throw new b("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=n.timeExtent,e.mosaicRule=n.mosaicRule;const{raster:l,rasterFunction:u}=this;return u&&e.rasterFunction==null&&(e.rasterFunction=u),l&&e.raster==null&&(e.raster=l),jt(this.url,e,this._getRequestOptions(r))}async imageToMap(e,r){if(!(await this._fetchCapabilities(r?.signal)).operations.supportsImageToMap)throw new b("imagery-layer:image-to-map","imageToMap operation is not supported on the input image service");return Yi(o(this.parsedUrl),e,this._getRequestOptions(r))}async imageToMapMultiray(e,r){if(!(await this._fetchCapabilities(r?.signal)).operations.supportsImageToMapMultiray)throw new b("imagery-layer:image-to-map-multiray","imageToMapMultiray operation is not supported on the input image service");return es(o(this.parsedUrl),e,this._getRequestOptions(r))}async mapToImage(e,r){if(!(await this._fetchCapabilities(r?.signal)).operations.supportsMapToImage)throw new b("imagery-layer:map-to-image","mapToImage operation is not supported on the input image service");return ts(o(this.parsedUrl),e,this._getRequestOptions(r))}async findImages(e,r){if(!(await this._fetchCapabilities(r?.signal)).operations.supportsFindImages)throw new b("imagery-layer:find-images","findImages operation is not supported on the input image service");return is(o(this.parsedUrl),e,this._getRequestOptions(r))}async getImageUrl(e,r){if(!(await this._fetchCapabilities(r?.signal)).operations.supportsGetImageUrl)throw new b("imagery-layer:get-image-url","getImageUrl operation is not supported on the input image service");return rs(o(this.parsedUrl),e,this._getRequestOptions(r))}createQuery(){return new lt({outFields:["*"],returnGeometry:!0,where:this.definitionExpression||"1=1"})}async queryBoundary(e,r){if(!(await this._fetchCapabilities(r?.signal)).operations.supportsQueryBoundary)throw new b("imagery-layer:query-boundary","queryBoundary operation is not supported on the input image service");return e=e??{outSpatialReference:this.spatialReference},Zi(o(this.parsedUrl),e,this._getRequestOptions(r))}async queryRasters(e,r){return{query:e,requestOptions:r}=await this._prepareForQuery(e,r),Jr(this.url,e,r)}async queryObjectIds(e,r){return{query:e,requestOptions:r}=await this._prepareForQuery(e,r),Vr(this.url,e,r)}async queryGPSInfo(e,r){if(!(await this._fetchCapabilities(r?.signal)).operations.supportsQueryGPSInfo)throw new b("imagery-layer:query-gps-info","queryGPSInfo operation is not supported on the input image service");return e=e??{where:"1=1"},Xi(o(this.parsedUrl),e,this._getRequestOptions(r))}async queryRasterCount(e,r){return{query:e,requestOptions:r}=await this._prepareForQuery(e,r),Mr(this.url,e,r)}async queryVisibleRasters(e,r){if(!e)throw new b("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:n,returnDomainValues:l,returnTopmostRaster:u,showNoDataRecords:p}=r||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let m=!1,c=null,d=null;const g="raster.servicepixelvalue",h=this._rasterFunctionNamesIndex;if(e.outFields!=null&&(m=e.outFields.some(N=>!N.toLowerCase().includes(g)),this.version>=10.4)){const N=e.outFields.filter(A=>A.toLowerCase().includes(g)&&A.length>g.length).map(A=>{const U=A.slice(g.length+1);return[this._updateRenderingRulesFunctionName(U,h),U]});c=N.map(A=>new S({functionName:A[0]})),d=N.map(A=>A[1]);const{rasterFunction:D}=this;c.length===0?D?.functionName?(c.push(D),d.push(D.functionName)):c=null:D?.functionName&&!c.some(A=>A.functionName===D.functionName)&&(c.push(D),d.push(D.functionName))}const f=e.outSpatialReference==null||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:y}=this;let v=e.timeExtent||this.timeExtent;if(y){const{isOutside:N,intersection:D}=at(y,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(N)throw new b("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");D?.timeExtent!=null&&(v=D.timeExtent)}const w=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,v);let T=e.geometry;this.version<10.91&&T?.type==="extent"&&(T=ut.fromExtent(T));const j=this._getQueryParams({geometry:T,timeExtent:v,mosaicRule:w,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:c,pixelSize:n,returnCatalogItems:m,returnGeometry:f,raster:this.raster,maxItemCount:u?1:null});delete j.f;const J=new qt(j);try{await this._generateRasterInfo(this.rasterFunction);const N=await jt(this.url,J,{signal:r?.signal,query:{...this.customParameters}}),D=e.outFields,A=N.value!=null&&N.value.toLowerCase().includes("nodata");if(!(m&&!f&&N?.catalogItems?.features.length&&(p||!A)))return this._processVisibleRastersResponse(N,{returnDomainValues:l,templateRRFunctionNames:d,showNoDataRecords:p,templateFields:D});const U=this.objectIdField||"ObjectId",Oe=N.catalogItems?.features??[],$e=Oe.map(k=>k.attributes?.[U]),ze=new lt({objectIds:$e,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[U]}),Q=await this.queryRasters(ze);return Q?.features?.length&&Q.features.forEach(k=>{Oe.forEach(Ie=>{Ie.attributes[U]===k.attributes[U]&&k.geometry&&(Ie.geometry=k.geometry.clone(),e.outSpatialReference!=null&&(Ie.geometry.spatialReference=e.outSpatialReference))})}),this._processVisibleRastersResponse(N,{returnDomainValues:l,templateRRFunctionNames:d,showNoDataRecords:p,templateFields:D})}catch{throw new b("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,r){const n=x(o(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:r}).then(p=>p.data?.statistics),l=x(o(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:r}).then(p=>p.data?.histograms),u=await Promise.all([n,l]);return u[0]&&u[0].forEach(p=>{p.avg=p.mean,p.stddev=p.standardDeviation}),{statistics:u[0]||null,histograms:u[1]||null}}async createFlowMesh(e,r){const n=this._rasterJobHandler.instance;return n?n.createFlowMesh(e,r):Ir(e.meshType,e.simulationSettings,e.flowData,r.signal!=null?r.signal:new AbortController().signal)}getMultidimensionalSubsetVariables(e){const r=e??this.serviceRasterInfo.multidimensionalInfo;return vr(this.multidimensionalSubset,r)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const r=this.sourceJSON,n=this.serviceRasterInfo!=null?Promise.resolve(this.serviceRasterInfo):Ft(o(this.parsedUrl),r,{signal:e,query:this._getQueryParams()}).then(p=>(this._set("serviceRasterInfo",p),this._set("multidimensionalInfo",p.multidimensionalInfo),lr(p,r),p)),l=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):null,u=this._getRasterFunctionInfos();return Promise.all([n,l,u]).then(p=>{p[1]?this._set("rasterInfo",p[1]):this._set("rasterInfo",p[0]),p[2]&&this._set("rasterFunctionInfos",p[2]),this.internalRenderer&&!this._isSupportedRenderer(this.internalRenderer)&&(this._set("internalRenderer",null),It.getLogger(this).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("internalRenderer",this._configRenderer(this.renderer)),this.addHandles([Kt(()=>this.rasterFunction,c=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(c).then(d=>{d&&(this.rasterInfo=d)})})]);const{serviceRasterInfo:m}=this;m.multidimensionalInfo!=null&&this._updateMultidimensionalDefinition(m)})}_combineMosaicRuleWithTimeExtent(e,r){const n=this.timeInfo,{multidimensionalInfo:l}=this.serviceRasterInfo;if(e==null||l==null||r==null||n?.startField==null)return e;const{startField:u}=n,p=l.variables.some(y=>y.dimensions.some(v=>v.name===u))?u:"StdTime";if(e=e.clone(),this.sourceType==="mosaic-dataset")return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter(y=>y.dimensionName!==p),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const m=e.multidimensionalDefinition.filter(y=>y.dimensionName===p),c=r.start!=null?r.start.getTime():null,d=r.end!=null?r.end.getTime():null,g=c==null||d==null||c===d,h=g?[c||d]:[[c,d]],f=this.version>=10.8;if(m.length)m.forEach(y=>{y.dimensionName===p&&(f?(y.dimensionName=null,y.isSlice=!1,y.values=[]):(y.isSlice=g,y.values=h))});else if(!f){const y=e.multidimensionalDefinition.filter(v=>v.variableName!=null&&v.dimensionName==null);y.length?y.forEach(v=>{v.dimensionName=p,v.isSlice=g,v.values=h}):e.multidimensionalDefinition.push(new br({variableName:"",dimensionName:p,isSlice:g,values:h}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return e==null?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter(r=>!(!r.variableName&&!r.dimensionName)),e.multidimensionalDefinition.length===0&&(e.multidimensionalDefinition=null)),this.sourceType!=="mosaic-dataset"&&e.multidimensionalDefinition==null?null:e)}async _prepareForQuery(e,r){if(!(await this._fetchCapabilities(r?.signal)).operations.supportsQuery)throw new b("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=e!=null?M(lt,e):this.createQuery(),r=this._getRequestOptions(r),this.raster&&(r.query={...r.query,raster:this.raster}),{query:e,requestOptions:r}}async _initJobHandler(){if(this._rasterJobHandler.connectionPromise!=null)return this._rasterJobHandler.connectionPromise;const e=new yr;this._rasterJobHandler.connectionPromise=e.initialize().then(()=>{this._rasterJobHandler.instance=e},()=>{}),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null}_isSupportedRenderer(e){const{rasterInfo:r,rasterFunction:n}=this;return e.type==="unique-value"&&this._hasRasterFunction(n)&&r?.bandCount===1&&["u8","s8"].includes(r.pixelType)||r!=null&&e!=null&&ur(r).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let r=this.sourceJSON;if(!r){const{data:n,ssl:l}=await x(o(this.parsedUrl),{query:this._getQueryParams(),signal:e});r=n,this.sourceJSON=r,l&&(this.url=this.url.replace(/^http:/i,"https:"))}if(r.capabilities?.toLowerCase().split(",").map(n=>n.trim()).indexOf("tilesonly")>-1)throw new b("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(r,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?e.serviceSourceType==="esriImageServiceSourceTypeMosaicDataset":e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const r=this._isMosaicDataset(e),n=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return r||n}_isVectorFieldResampleFunction(e){if(e==null)return!1;const{functionName:r,functionArguments:n}=e,l=r?.toLowerCase()==="resample",u=n?.ResampleType||n?.resampleType;return l&&(u===7||u===10)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const r=this._isPicture(),{rasterInfo:n}=this;if(!r&&!this.pixelFilter||this._isVectorDataSet()){const l=this.mosaicRule?.multidimensionalDefinition?.[0].variableName,u=pr({variableName:l,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&n.bandCount>=3){const m=u?.bandIds??cr(n);!m||n.bandCount===3&&m[0]===0&&m[1]===1&&m[2]===2||(this.bandIds=m)}e||(e=u?.renderer??mr(n,{bandIds:this.bandIds,variableName:this.rasterFunction?null:l}));const p=dr(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=p,this.symbolizer.rasterInfo=n):this.symbolizer=new jr({rendererJSON:p,rasterInfo:n}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return e==null?e:{extent:e.extent&&e.extent.clone(),pixelBlock:e.pixelBlock!=null?e.pixelBlock.clone():null}}_getQueryParams(e){e?.renderingRule!=null&&typeof e.renderingRule!="string"&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:r,viewId:n}=this;return{raster:r,viewId:n,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,r,n){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:r}):Dt(e,r,n)}async _getRasterFunctionInfos(e){const r=this.sourceJSON.rasterFunctionInfos;return this.loaded?r:r&&this.version>=10.3?r.length===1&&r[0].name.toLowerCase()==="none"?r:(await x(o(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data?.rasterFunctionInfos:null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:r,requestAsImageElement:n,returnImageBitmap:l,signal:u}=e;if(n&&this._canRequestImageElement(r.format)){const f=`${o(this.parsedUrl)}/exportImage`,{data:y}=await x(f,{responseType:l?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:u});return y instanceof Blob?{imageBitmap:await Tt(y,f,u),params:r}:{imageOrCanvasElement:y,params:r}}const p=this._initJobHandler(),m=x(o(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:u}),c=(await Promise.all([m,p]))[0].data,d=r.format||"jpgpng";let g=d;if(g!=="bsq"&&g!=="bip"&&(g=Nr(c)),!g)throw new b("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(c)));const h={signal:u};return{pixelData:{pixelBlock:await(d==="gif"||d==="bmp"||d.includes("png")&&(g==="png"||g==="jpg")?Dt(c,{useCanvas:!0,...r},h):this._decodePixelBlock(c,{width:r.width,height:r.height,planes:null,pixelType:null,noDataValue:null,format:d},h)),extent:r.extent},params:r}}_generateRasterInfo(e,r){return this.generateRasterInfo(e,r).catch(()=>null)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let r=Sr(e,{multidimensionalSubset:this.multidimensionalSubset});if(r!=null&&r.length>0){this.mosaicRule=this.mosaicRule||new H;const n=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&this.rasterFunction.functionName?.toLowerCase()!=="none"&&r.forEach(l=>l.variableName=""),r=r.filter(({variableName:l,dimensionName:u})=>l&&l!=="*"||u),!n?.length&&r.length&&(this.mosaicRule.multidimensionalDefinition=r)}}_processVisibleRastersResponse(e,r){r=r||{};const n=e.value,{templateRRFunctionNames:l,showNoDataRecords:u,returnDomainValues:p,templateFields:m}=r,c=e.processedValues;let d=e.catalogItems?.features,g=e.properties?.Values?.map(j=>j.replaceAll(/ /gi,", "))||[];const h=this.objectIdField||"ObjectId",f=typeof n=="string"&&n.toLowerCase().includes("nodata"),y=[];if(n&&!d&&!f){const j={};j[h]=0,g=[n],d=[new Zt({geometry:this.fullExtent,attributes:j})]}if(!d)return[];let v,w,T;this._updateResponseFieldNames(d,m),f&&!u&&(d=[]);for(let j=0;j0&&l&&l.length>0&&l.includes(this.rasterFunction.functionName)?c[l.indexOf(this.rasterFunction.functionName)]:n,w.toLowerCase()==="nodata"&&!u)continue;const J="Raster.ItemPixelValue",N="Raster.ServicePixelValue";v.attributes[J]=w,v.attributes[N]=T,this._updateFeatureWithMagDirValues(v,w);const D=this.fields&&this.fields.length>0;let A=this.rasterFunction&&this.serviceRasterInfo.attributeTable!=null?D?w:n:T;this.rasterFunction||(A=D?w:n),this._updateFeatureWithRasterAttributeTableValues(v,A)}if(v.sourceLayer=v.layer=this,p&&this._updateFeatureWithDomainValues(v),l&&c&&l.length===c.length)for(let J=0;Jc.name).find(c=>c.toLowerCase()==="value");if(!p)return;const m=l.filter(c=>c.attributes[p]===(r!=null?parseInt(r,10):null));m&&m[0]&&u.forEach(c=>{const d=this._rasterAttributeTableFieldPrefix+c.name;e.attributes[d]=m[0].attributes[c.name]})}_updateFeatureWithMagDirValues(e,r){if(!this._isVectorDataSet())return;const n=r.split(/,\s*/).map(c=>parseFloat(c)),l=n.map(c=>[c]),u=n.map(c=>({minValue:c,maxValue:c,noDataValue:null})),p=new ot({height:1,width:1,pixelType:"f32",pixels:l,statistics:u});this.pixelFilter!=null&&this.pixelFilter({pixelBlock:p,extent:new Ee(0,0,0,0,this.spatialReference)});const m=this.serviceDataType==="esriImageServiceDataTypeVector-MagDir"?[p.pixels[0][0],p.pixels[1][0]]:Fr([p.pixels[0][0],p.pixels[1][0]]);e.attributes["Raster.Magnitude"]=m[0],e.attributes["Raster.Direction"]=m[1]}_updateFeatureWithDomainValues(e){(this.fields&&this.fields.filter(r=>r.domain&&r.domain.type==="coded-value"))?.forEach(r=>{const n=e.attributes[r.name];if(n!=null){const l=r.domain.codedValues.find(u=>u.code===n);l&&(e.attributes[r.name]=l.name)}})}_updateResponseFieldNames(e,r){if(!r||r.length<1)return;const n=this.fieldsIndex;n!=null&&e.forEach(l=>{if(l?.attributes)for(const u of r){const p=n.get(u)?.name;p&&p!==u&&(l.attributes[u]=l.attributes[p],delete l.attributes[p])}})}_getRenderingRuleString(e){if(e){let r=e.toJSON();return r=r.rasterFunctionDefinition??r,(r.thumbnail||r.thumbnailEx)&&(r.thumbnail=r.thumbnailEx=null),JSON.stringify(r)}return null}_hasRasterFunction(e){return e?.functionName!=null&&e.functionName.toLowerCase()!=="none"}_updateRenderingRulesFunctionName(e,r){if(!e||e.length<1)return;if(e==="Raw")return e.replace("Raw","None");const n=e.toLowerCase().replaceAll(/ /gi,"_");return r.has(n)?r.get(n):e}_isRFTJson(e){return e?.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return this.serviceDataType==="esriImageServiceDataTypeVector-UV"||this.serviceDataType==="esriImageServiceDataTypeVector-MagDir"}_applyMosaicAndRenderingRules(e){const{raster:r,mosaicRule:n,rasterFunction:l}=this;l&&"rasterFunction"in e&&e.rasterFunction==null&&(e.rasterFunction=l),n&&e.mosaicRule==null&&(e.mosaicRule=n),r&&e.raster==null&&(e.raster=r)}_readCapabilities(e){const r=e.capabilities?e.capabilities.toLowerCase().split(",").map(w=>w.trim()):["image","catalog"],{currentVersion:n,advancedQueryCapabilities:l,maxRecordCount:u}=e,p=r.includes("image"),m=e.serviceDataType==="esriImageServiceDataTypeElevation",c=!(!e.spatialReference&&!e.extent?.spatialReference),d=r.includes("edit"),g=r.includes("mensuration")&&c,h=e.mensurationCapabilities==null?[]:e.mensurationCapabilities.toLowerCase().split(",").map(w=>w.trim()),f=g&&h.includes("basic"),y=this._isMosaicDataset(e)&&r.includes("catalog"),v=r.includes("download");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:p,supportsExportImage:p,supportsIdentify:p,supportsImageToMap:n>=11.2&&y,supportsImageToMapMultiray:n>=11.2&&y,supportsMapToImage:n>=11.2&&y,supportsFindImages:n>=11.2&&y,supportsGetImageUrl:n>=11.3&&v,supportsMeasure:g,supportsMeasureFromImage:n>=11.2,supportsDownload:v,supportsQuery:y&&e.fields&&e.fields.length>0,supportsGetSamples:n>=10.2&&p,supportsProject:n>=10.3&&p,supportsComputeStatisticsHistograms:n>=10.4&&p,supportsQueryBoundary:n>=10.6&&p,supportsCalculateVolume:n>=10.7&&m,supportsComputePixelLocation:n>=10.7&&y,supportsComputeAngles:n>=10.91,supportsQueryGPSInfo:n>=11.2&&y,supportsAdd:d,supportsDelete:d,supportsEditing:d,supportsUpdate:d,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryBins:!1,supportsQueryTopFeatures:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:u,maxRecordCountFactor:void 0,supportsStatistics:!!l?.supportsStatistics,supportsOrderBy:!!l?.supportsOrderBy,supportsDistinct:!!l?.supportsDistinct,supportsPagination:!!l?.supportsPagination,supportsStandardizedQueriesOnly:!!l?.useStandardizedQueries,supportsPercentileStatistics:!!l?.supportsPercentileStatistics,supportsCentroid:!!l?.supportsReturningGeometryCentroid,supportsDistance:!!l?.supportsQueryWithDistance,supportsExtent:!!l?.supportsReturningQueryExtent,supportsGeometryProperties:!!l?.supportsReturningGeometryProperties,supportsHavingClause:!!l?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!l?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0},mensuration:{supportsDistanceAndAngle:f,supportsAreaAndPerimeter:f,supportsPointOrCentroid:f,supportsHeightFromBaseAndTop:g&&h.includes("base-top height"),supportsHeightFromBaseAndTopShadow:g&&h.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:g&&h.includes("top-top shadow height"),supports3D:g&&h.includes("3d")}}}};function o(e){return e?.path??""}return s([a({clonable:!1})],t.prototype,"_functionRasterInfos",void 0),s([a({clonable:!1})],t.prototype,"_rasterJobHandler",void 0),s([a({clonable:!1})],t.prototype,"_cachedRendererJson",void 0),s([a({readOnly:!0})],t.prototype,"_serviceSupportsMosaicRule",void 0),s([E("_serviceSupportsMosaicRule",["currentVersion","fields"])],t.prototype,"readServiceSupportsMosaicRule",null),s([a({readOnly:!0})],t.prototype,"_rasterAttributeTableFieldPrefix",void 0),s([a({readOnly:!0})],t.prototype,"_rasterFunctionNamesIndex",null),s([a()],t.prototype,"adjustAspectRatio",void 0),s([a({type:[Le],json:{write:!0}})],t.prototype,"bandIds",void 0),s([E("bandIds")],t.prototype,"readBandIds",null),s([a({readOnly:!0,json:{read:!1}})],t.prototype,"capabilities",void 0),s([E("service","capabilities",["capabilities","currentVersion","serviceDataType"])],t.prototype,"readCapabilities",null),s([a({type:Number})],t.prototype,"compressionQuality",void 0),s([I("compressionQuality")],t.prototype,"writeCompressionQuality",null),s([a({type:Number})],t.prototype,"compressionTolerance",void 0),s([I("compressionTolerance")],t.prototype,"writeCompressionTolerance",null),s([a({json:{read:{source:"copyrightText"}}})],t.prototype,"copyright",void 0),s([a({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],t.prototype,"defaultMosaicRule",void 0),s([E("defaultMosaicRule",["defaultMosaicMethod"])],t.prototype,"readDefaultMosaicRule",null),s([a({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],t.prototype,"definitionExpression",void 0),s([a({readOnly:!0,constructOnly:!0})],t.prototype,"exportImageServiceParameters",void 0),s([a()],t.prototype,"rasterInfo",void 0),s([a({readOnly:!0,type:[we]})],t.prototype,"fields",void 0),s([a({readOnly:!0})],t.prototype,"fieldsIndex",null),s([a({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff","bip","bsq"],json:{write:!0}})],t.prototype,"format",null),s([E("service","format",["serviceDataType"])],t.prototype,"readFormat",null),s([a({type:Ee})],t.prototype,"fullExtent",void 0),s([a({readOnly:!0})],t.prototype,"hasMultidimensions",void 0),s([a({json:{read:{source:"maxImageHeight"}}})],t.prototype,"imageMaxHeight",void 0),s([a({json:{read:{source:"maxImageWidth"}}})],t.prototype,"imageMaxWidth",void 0),s([a({type:String,json:{type:he.jsonValues,read:he.read,write:he.write}})],t.prototype,"interpolation",void 0),s([a()],t.prototype,"minScale",void 0),s([E("service","minScale")],t.prototype,"readMinScale",null),s([a()],t.prototype,"maxScale",void 0),s([E("service","maxScale")],t.prototype,"readMaxScale",null),s([a({type:H})],t.prototype,"mosaicRule",null),s([E("mosaicRule",["mosaicRule","defaultMosaicMethod"])],t.prototype,"readMosaicRule",null),s([I("mosaicRule")],t.prototype,"writeMosaicRule",null),s([a()],t.prototype,"multidimensionalInfo",void 0),s([a({type:ir,json:{write:!0}})],t.prototype,"multidimensionalSubset",void 0),s([a({json:{type:Le}})],t.prototype,"noData",void 0),s([I("noData")],t.prototype,"writeNoData",null),s([a({type:String,json:{type:qe.jsonValues,read:qe.read,write:qe.write}})],t.prototype,"noDataInterpretation",void 0),s([a({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],t.prototype,"objectIdField",void 0),s([E("objectIdField")],t.prototype,"readObjectIdField",null),s([a({readOnly:!0})],t.prototype,"geometryType",void 0),s([a({})],t.prototype,"typeIdField",void 0),s([a({})],t.prototype,"types",void 0),s([a({readOnly:!0})],t.prototype,"parsedUrl",null),s([a({type:Function})],t.prototype,"pixelFilter",void 0),s([a()],t.prototype,"raster",void 0),s([a({readOnly:!0})],t.prototype,"sourceType",void 0),s([E("sourceType",["serviceSourceType","fields"])],t.prototype,"readSourceType",null),s([a()],t.prototype,"viewId",void 0),s([a()],t.prototype,"renderer",null),s([a({types:sr,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:nr,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&e.type!=="vector-field"&&e.type!=="flow"})}}}}})],t.prototype,"internalRenderer",null),s([E("internalRenderer")],t.prototype,"readRenderer",null),s([I("internalRenderer")],t.prototype,"writeRenderer",null),s([a({clonable:!1})],t.prototype,"symbolizer",void 0),s([a(wr)],t.prototype,"opacity",void 0),s([a({readOnly:!0})],t.prototype,"rasterFields",null),s([a({constructOnly:!0})],t.prototype,"rasterFunctionInfos",void 0),s([a({type:S,json:{name:"renderingRule"}})],t.prototype,"rasterFunction",null),s([E("rasterFunction",["renderingRule","rasterFunctionInfos"])],t.prototype,"readRasterFunction",null),s([a({readOnly:!0})],t.prototype,"serviceDataType",void 0),s([a({readOnly:!0,type:re})],t.prototype,"spatialReference",void 0),s([E("spatialReference",["spatialReference","extent"])],t.prototype,"readSpatialReference",null),s([a({json:{type:nt.jsonValues}})],t.prototype,"pixelType",void 0),s([E("pixelType")],t.prototype,"readPixelType",null),s([I("pixelType")],t.prototype,"writePixelType",null),s([a({constructOnly:!0,type:Nt})],t.prototype,"serviceRasterInfo",void 0),s([a()],t.prototype,"sourceJSON",void 0),s([a(Rr)],t.prototype,"url",void 0),s([a({readOnly:!0})],t.prototype,"version",void 0),s([E("version",["currentVersion","fields","timeInfo"])],t.prototype,"readVersion",null),t=s([R("esri.layers.mixins.ArcGISImageService")],t),t};let z=class extends qr(Hr(Ur(Lr($r(rr(ls(zr(Gr(Er(er(fe(tr)))))))))))){constructor(...i){super(...i),this.isReference=null,this.operationalLayerType="ArcGISImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.type="imagery",this._debouncedSaveOperations=Ht(async(t,o,e)=>{const{save:r,saveAs:n}=await $t(()=>import("./imageryUtils-6MVSqijr-1Tgq6Wjf.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url);switch(t){case Ue.SAVE:return r(this,o);case Ue.SAVE_AS:return n(this,e,o)}})}normalizeCtorArgs(i,t){return typeof i=="string"?{url:i,...t}:i}load(i){const t=i!=null?i.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},i).catch(Bt).then(()=>this._fetchService(t))),Promise.resolve(this)}get legendEnabled(){return!this._isPreviewLayer&&(this._get("legendEnabled")??!0)}set legendEnabled(i){this._set("legendEnabled",i)}get listMode(){return this._isPreviewLayer?"hide":this._get("listMode")}set listMode(i){this._set("listMode",i)}writeOperationalLayerType(i,t,o){const e=this.renderer?.type==="vector-field";t[o]=e?"ArcGISImageServiceVectorLayer":"ArcGISImageServiceLayer"}get defaultPopupTemplate(){return this.createPopupTemplate()}get _isPreviewLayer(){return!(!this.raster||!this.url?.toLowerCase().includes("/rasterrendering/imageserver"))}createPopupTemplate(i){const t=this.rasterFields,o=this.title,e=new Set;let r=!1,n=!1;this.capabilities&&(r=this.capabilities.operations.supportsQuery&&this.fields&&this.fields.length>0,n=this.serviceDataType==="esriImageServiceDataTypeVector-UV"||this.serviceDataType==="esriImageServiceDataTypeVector-MagDir");const l=new Set;r&&l.add("raster.itempixelvalue");for(const p of t){const m=p.name.toLowerCase();l.has(m)||m.includes("raster.servicepixelvalue.")||e.add(p.name)}n&&e.add("raster.magnitude").add("raster.direction");const u=Qr({fields:t,title:o},{...i,visibleFieldNames:e});return u?.fieldInfos&&this.rasterInfo?.pixelType.startsWith("f")&&u.fieldInfos.forEach(({format:p,fieldName:m})=>{p&&m&&/^raster\.(item|service)pixelvalue/i.test(m)&&(p.places=2)}),u}queryFeatures(i,t){return this.queryRasters(i,t).then(o=>{if(o?.features)for(const e of o.features)e.layer=e.sourceLayer=this;return o})}queryFeatureCount(i,t){return this.queryRasterCount(i,t)}redraw(){this.emit("redraw")}async save(i){return this._debouncedSaveOperations(Ue.SAVE,i)}async saveAs(i,t){return this._debouncedSaveOperations(Ue.SAVE_AS,t,i)}serviceSupportsSpatialReference(i){return Br(this,i)}write(i,t){if(!this._isPreviewLayer)return super.write(i,t);if(t?.messages){const o=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new b("layer:unsupported",`Imagery preview layer (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${o}'`,{layer:this}))}return null}};s([a(gr)],z.prototype,"legendEnabled",null),s([a({type:["show","hide"]})],z.prototype,"listMode",null),s([a({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],z.prototype,"isReference",void 0),s([a({type:["ArcGISImageServiceLayer"],json:{origins:{"web-map":{type:["ArcGISImageServiceLayer","ArcGISImageServiceVectorLayer"],read:!1,write:{target:"layerType",ignoreOrigin:!0}}}}})],z.prototype,"operationalLayerType",void 0),s([I("web-map","operationalLayerType")],z.prototype,"writeOperationalLayerType",null),s([a(fr)],z.prototype,"popupEnabled",void 0),s([a({type:Qt,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],z.prototype,"popupTemplate",void 0),s([a({readOnly:!0})],z.prototype,"defaultPopupTemplate",null),s([a({readOnly:!0,json:{read:!1}})],z.prototype,"type",void 0),s([a({readOnly:!0})],z.prototype,"_isPreviewLayer",null),z=s([R("esri.layers.ImageryLayer")],z);const Pn=z;export{Pn as default};
diff --git a/fix-191/assets/ImageryLayerView2D-CVDvTIGY-Csu20ClY.js b/fix-191/assets/ImageryLayerView2D-CVDvTIGY-Csu20ClY.js
deleted file mode 100644
index 52de763b..00000000
--- a/fix-191/assets/ImageryLayerView2D-CVDvTIGY-Csu20ClY.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import{v as s,S as o,i as w,ah as f,av as V,ag as E,bi as b,a2 as S,K as F,j as R,aU as _,a1 as P,bp as I,n as D,ax as $,f as A,bM as U,o as C,$ as L,w as q}from"./story-DULt3Rma.js";import{o as M}from"./GraphicsCollection-CWTXNZOX-DHToCUr-.js";import{o as N,c as O,l as j}from"./RasterVFDisplayObject-CnriTVT9-B6xWctLn.js";import{X as H,Y as G}from"./LayerView-Bish-E63-BuRTInx3.js";import{X as J}from"./GraphicsView2D-C4wYE2ut-YaHOk0G5.js";import{l as W}from"./HighlightGraphicContainer-Dt5r6lMq-CApzVsMQ.js";import{z as X,P as K,w as Q}from"./dataUtils-BkPy4R3C-Cbeh7cC8.js";import{d as Y}from"./BitmapContainer-BC8fvmFc-e8Jk-8-i.js";import{x as Z}from"./Container-BcuL1ZEG-B_CYK192.js";import{d as tt}from"./Bitmap-CcqmzvfR-Dfe_fKlS.js";import{K as et}from"./ExportStrategy-BNE7Gp0u-DV7tmxPY.js";import{o as it}from"./rasterProjectionHelper-Calp0o_1-BRylUHz3.js";import{E as B}from"./MapView-BGOJJ8ch-D1TWNssr.js";import{N as rt}from"./WGLContainer-LxgEo4I_-CsRH2D6t.js";import{T as st}from"./timeSupport-ohWmWReZ-rSwSjOuI.js";import{b as at}from"./Query-BrwMGK8U-DaHaJHm8.js";import{m as ot}from"./popupUtils-nV1O8RUO-vr1W8TrN.js";import{n as nt}from"./RefreshableLayerView-BdQpGYly-3_FrG89b.js";import"./main-Bm7g2Jde.js";import"./BufferObject-BM_7mcDb-Bve6V6Hz.js";import"./Texture-BCt2hphT-Tabr9F2Q.js";import"./enums-DBi1-Mm2-CUS1pvQe.js";import"./VertexArrayObject-M4iRGGoi-CgmBRrBK.js";import"./VertexElementDescriptor-BAy1DPb3-BOhpDZGx.js";import"./mat3-CC4Foazl-BWjyqE2v.js";import"./common-CYWrYyJl-E8-sukrT.js";import"./vec2f32-CVhmN3Me-DxoqVD7C.js";import"./LabelMetric-BeluzH3o-gRzb7KR4.js";import"./enums-CpSG_SL3-BMD3Tb1v.js";import"./Program-DLVwTiPA-DnEcW3oW.js";import"./layerViewUtils-DURAPenP-B_msxcGA.js";import"./UpdatingHandles-CUu3u1ms-C-zZs-35.js";import"./FieldsIndex-HmzMbJQG-nfgmohOl.js";import"./UnknownTimeZone-C--TOcPG-C3cinqRV.js";import"./UpdateTracking2D-Du_WIf4G-D2PpCov4.js";import"./BidiEngine-Bdqv5H5j-Dyqh9XG-.js";import"./OptimizedFeature-EIithYlr-Cq64mIT3.js";import"./GeometryUtils-NHgB9gGQ-CFw4-bSu.js";import"./utils-SPbpQbmm-BoVqh098.js";import"./definitions-DJSdSb77-DkoRHaVx.js";import"./Tile-D75RMC64-6QC6K6en.js";import"./TileKey-C5IL-JBr-DX55j9sZ.js";import"./vec2-tHZ6OaOy-xCj1obDt.js";import"./QueueProcessor-DbfV9fLy-Cb_v9ly0.js";import"./workers-PiCjreoO-CABaMBvC.js";import"./ReactiveMap-CFk6jPfN-D0CsM6VZ.js";import"./signal-CETehA7D-Cb8aw_q5.js";import"./quickselect-DHTstthl-Ds_Aj0x5.js";import"./Rect-DD6XS68q-D_hsV3ag.js";import"./BindType-9iOk18Ed-CRW1cdX4.js";import"./Util-BjGjeg6f-08Szkf4F.js";import"./vec2f64-CeODonrJ-CkkJCdRC.js";import"./vec42-D8CJyqHG-DnfLTeQH.js";import"./vec4f64-hf2nxvhQ-CaAr8PTM.js";import"./OverrideHelper-DWRbVlj1-CckXmRiC.js";import"./colorUtils-Cthpxcks-CToOrmBC.js";import"./quantizationUtils-bJy1cRwp-DKHwdnl5.js";import"./AttributeStore-DjyP9U7y-B4SfjpJ9.js";import"./TimeOnly-DSMefxKy-BAXliSDH.js";import"./timeSupport-jPViR5jn-Blw8tou2.js";import"./featureConversionUtils-D6hFQ4Af-Cb3HkUwF.js";import"./OptimizedFeatureSet-DfZGBuxJ-C08BOAgi.js";import"./queryUtils-Brxu6254-UOAsUqfL.js";import"./projection-BA9M1R7d-DvHr0GeG.js";import"./projectBuffer-CvCBvJ6W-Cc8J4MEJ.js";import"./normalizeUtils-Bxmy9MNI-CZMTs6Vg.js";import"./normalizeUtilsCommon-CRJlkfEA-CgRBIB_J.js";import"./utils-9sQxfkoa-CjNZjdKD.js";import"./utils-Bq23Xwmj-DhZYu3yh.js";import"./json-BI97KiBB-Ce5cWfI2.js";import"./labelUtils-BW14kBqX-CwFoWB4r.js";import"./diffUtils-Cz3Fi8Xb-Dx3TppL9.js";import"./FeatureCommandQueue-DzV-HBIG-CZbfy6TK.js";import"./constants-Bqe1QJ4u-F8oTIn7N.js";import"./lengthUtils-DKpMe5qR-BEdWsC7X.js";import"./capabilities-agoTWNzb-CtsNgRyk.js";import"./normalizeUtilsSync-CBU7m8rm-fmmSahg-.js";import"./AGraphicContainer-LUCT6Gle-Dcauzal2.js";import"./TechniqueInstance-DGTKoOL6-4HwqbTFw.js";import"./TileContainer-D48pXXgL-3qcmtXL9.js";import"./vec3f32-BS0cezmI-B_madU1n.js";import"./parser-DyDJ-rlI-8QTzeGdu.js";import"./mat4f32-CiZjBg9k-CUm34GoR.js";import"./mat4-DX7gBViE-DBcL5Ayd.js";import"./TileInfo-CWIRDhZl-1qRzvaVI.js";import"./TileKey-B_6qmYK--BtZdR-Xy.js";import"./Cyclical-C_9rKUUQ-BTshTtlN.js";import"./CollectionFlattener-DkHuHn5E-CAzLWmFf.js";import"./themeUtils-YjM7iIiX-Dxg99YfT.js";import"./uuid-Dj9mdEVg-BaKSCiyT.js";import"./Map-1zd11DKO-DXcvys-y.js";import"./Basemap-BEqqSTw9-B8z1wR1c.js";import"./loadAll-e978YItg-Sr8yCS6_.js";import"./PortalItem-CctGdnxF-Dbw3pVTD.js";import"./writeUtils-D5qlLkwk-B7Zow5Ob.js";import"./compilerUtils-CV1QYWI8-5SsZKq4e.js";import"./TablesMixin-C8RojhYs-C4TS9tnz.js";import"./Layer-ChoECxvZ-DQ-28MDL.js";import"./TimeExtent-Cn0Jofqr-DWlRQ-Qn.js";import"./HeightModelInfo-C5vFqzyF-B3QZnpVY.js";import"./arcgisLayerUrl-HNYh8jvG-CTcC0GBx.js";import"./ViewingMode-CyR_b1T8-_s7_Gbsk.js";import"./unitBezier-CGtWxaCq-BRwEDigF.js";import"./Scheduler-B7UX7Wr5-Bw_5FpBi.js";import"./vec32-D9GsKZ1t-BK5Q1Wvx.js";import"./imageUtils-BA2D6Uf1-mQylXFz2.js";import"./Version-CoKzbupV-BJLwrorf.js";import"./ColorBackground-gVZldRLm-S6_H1D84.js";import"./Field-C6hA1tZj-DdgmWWCq.js";import"./fieldType-CD2CL2hr-BeIaxmP1.js";import"./ProgramTemplate-DQOm6Omy-BzE6z6ri.js";import"./StyleDefinition-Ct4HIk9T-B82pTf0h.js";import"./config-nuMERBvb-MDUrh2eL.js";import"./earcut-XDcq3zAf-BcwyrT7l.js";let h=class extends R{constructor(){super(...arguments),this.attached=!1,this.container=new Z,this.updateRequested=!1,this.type="imagery",this._bitmapView=new Y}destroy(){this.attached&&(this.detach(),this.attached=!1),this.updateRequested=!1}get updating(){return!this.attached||this.isUpdating()}update(t){this.strategy.update(t).catch(e=>{_(e)||P.getLogger(this).error(e)})}hitTest(t){return new b({attributes:{},geometry:t.clone(),layer:this.layer})}attach(){this.container.addChild(this._bitmapView);const t=this.layer.version>=10,e=this.layer.version>=10.1?this.layer.imageMaxHeight:2048,i=this.layer.version>=10.1?this.layer.imageMaxWidth:2048;this.strategy=new et({container:this._bitmapView,imageNormalizationSupported:t,imageMaxHeight:e,imageMaxWidth:i,fetchSource:this._fetchImage.bind(this),requestUpdate:()=>this.requestUpdate()})}detach(){this.strategy.destroy(),this._bitmapView.removeAllChildren(),this.container.removeAllChildren(),this.updateRequested=!1}redraw(){this.strategy.updateExports(async t=>{const{source:e}=t;if(!e||e instanceof ImageBitmap)return;const i=await this.layer.applyRenderer({extent:e.extent,pixelBlock:e.originalPixelBlock??e.pixelBlock});e.filter=r=>this.layer.pixelFilter?this.layer.applyFilter(r):{...i,extent:e.extent}}).catch(t=>{_(t)||P.getLogger(this).error(t)})}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.view.requestUpdate())}isUpdating(){return this.strategy.updating||this.updateRequested}getPixelData(){if(this.updating)return null;const t=this.strategy.bitmaps;if(t.length===1&&t[0].source)return{extent:t[0].source.extent,pixelBlock:t[0].source.originalPixelBlock};if(t.length>1){const e=this.view.extent,i=t.map(a=>a.source).filter(a=>a.extent&&a.extent.intersects(e)).map(a=>({extent:a.extent,pixelBlock:a.originalPixelBlock})),r=X(i,e);return r!=null?{extent:r.extent,pixelBlock:r.pixelBlock}:null}return null}async _fetchImage(t,e,i,r){(r=r||{}).timeExtent=this.timeExtent,r.requestAsImageElement=!0,r.returnImageBitmap=!0;const a=await this.layer.fetchImage(t,e,i,r);if(a.imageBitmap)return a.imageBitmap;const n=await this.layer.applyRenderer(a.pixelData,{signal:r.signal}),l=new tt(n.pixelBlock,n.extent?.clone(),a.pixelData.pixelBlock);return l.filter=u=>this.layer.applyFilter(u),l}};s([o()],h.prototype,"attached",void 0),s([o()],h.prototype,"container",void 0),s([o()],h.prototype,"layer",void 0),s([o()],h.prototype,"strategy",void 0),s([o()],h.prototype,"timeExtent",void 0),s([o()],h.prototype,"view",void 0),s([o()],h.prototype,"updateRequested",void 0),s([o()],h.prototype,"updating",null),s([o()],h.prototype,"type",void 0),h=s([w("esri.views.2d.layers.imagery.ImageryView2D")],h);const lt=h;class ht extends rt{constructor(){super(...arguments),this.symbolTypes=["triangle"]}prepareRenderPasses(e){const i=e.registerRenderPass({name:"imagery (vf)",brushes:[j],target:()=>this.children,drawPhase:B.MAP});return[...super.prepareRenderPasses(e),i]}doRender(e){this.visible&&e.drawPhase===B.MAP&&this.symbolTypes.forEach(i=>{e.renderPass=i,super.doRender(e)})}}let y=class extends R{constructor(t){super(t),this._loading=null,this.update=I((e,i)=>this._update(e,i).catch(r=>{_(r)||P.getLogger(this).error(r)}))}get updating(){return!!this._loading}redraw(t){if(!this.container.children.length)return;const e=this.container.children[0];e.symbolizerParameters=t,e.invalidateVAO(),this.container.symbolTypes=t.style==="wind_speed"?["scalar","triangle"]:t.style==="simple_scalar"?["scalar"]:["triangle"],this.container.requestRender()}async _update(t,e,i){if(!t.stationary)return;const{extent:r,spatialReference:a}=t.state,n=new D({xmin:r.xmin,ymin:r.ymin,xmax:r.xmax,ymax:r.ymax,spatialReference:a}),[l,u]=t.state.size;this._loading=this.fetchPixels(n,l,u,i);const m=await this._loading;this._addToDisplay(m,e,t.state),this._loading=null}_addToDisplay(t,e,i){if(t.pixelBlock==null)return this.container.children.forEach(l=>l.destroy()),void this.container.removeAllChildren();const{extent:r,pixelBlock:a}=t,n=new O(a);n.offset=[0,0],n.symbolizerParameters=e,n.rawPixelData=t,n.invalidateVAO(),n.x=r.xmin,n.y=r.ymax,n.pixelRatio=i.pixelRatio,n.rotation=i.rotation,n.resolution=i.resolution,n.width=a.width*e.symbolTileSize,n.height=a.height*e.symbolTileSize,this.container.children.forEach(l=>l.destroy()),this.container.removeAllChildren(),this.container.symbolTypes=e.style==="wind_speed"?["scalar","triangle"]:e.style==="simple_scalar"?["scalar"]:["triangle"],this.container.addChild(n)}};s([o()],y.prototype,"fetchPixels",void 0),s([o()],y.prototype,"container",void 0),s([o()],y.prototype,"_loading",void 0),s([o()],y.prototype,"updating",null),y=s([w("esri.views.2d.layers.imagery.ImageryVFStrategy")],y);const pt=y;let p=class extends R{constructor(){super(...arguments),this.attached=!1,this.container=new ht,this.type="imageryVF",this._dataParameters={exportParametersVersion:0,bbox:"",symbolTileSize:0,time:""},this._fetchpixels=async(t,e,i,r)=>{const a=await this._projectFullExtentPromise,{symbolTileSize:n}=this.layer.renderer,{extent:l,width:u,height:m}=K(t,e,i,n,a);if(a!=null&&!a.intersects(t))return{extent:l,pixelBlock:null};const d={bbox:`${l.xmin}, ${l.ymin}, ${l.xmax}, ${l.ymax}`,exportParametersVersion:this.layer.exportImageServiceParameters.version,symbolTileSize:n,time:JSON.stringify(this.timeExtent||"")};if(this._canReuseVectorFieldData(d)){const c=this.getPixelData();if(c!=null&&`${c.extent.xmin}, ${c.extent.ymin}, ${c.extent.xmax}, ${c.extent.ymax}`===d.bbox)return c}const{pixelData:v}=await this.layer.fetchImage(l,u,m,{timeExtent:this.timeExtent,requestAsImageElement:!1,signal:r});this._dataParameters=d;const g=v?.pixelBlock;return g==null?{extent:l,pixelBlock:null}:{extent:l,pixelBlock:this.layer.rasterInfo.dataType==="vector-uv"?Q(g,"vector-uv"):g}}}get updating(){return!this.attached||this._strategy.updating}attach(){this._projectFullExtentPromise=this._getProjectedFullExtent(this.view.spatialReference),this._strategy=new pt({container:this.container,fetchPixels:this._fetchpixels}),this.addHandles(f(()=>this.layer.renderer,t=>this._updateSymbolizerParams(t),$),"attach")}detach(){this._strategy.destroy(),this.container.children.forEach(t=>t.destroy()),this.container.removeAllChildren(),this.removeHandles("attach"),this._strategy=this.container=this._projectFullExtentPromise=null}getPixelData(){const t=this.container.children[0]?.rawPixelData;if(this.updating||!t)return null;const{extent:e,pixelBlock:i}=t;return{extent:e,pixelBlock:i}}hitTest(t){return new b({attributes:{},geometry:t.clone(),layer:this.layer})}update(t){this._strategy.update(t,this._symbolizerParams).catch(e=>{_(e)||P.getLogger(this).error(e)})}redraw(){const{renderer:t}=this.layer;t&&(this._updateSymbolizerParams(t),this._strategy.redraw(this._symbolizerParams))}_canReuseVectorFieldData(t){const e=this._dataParameters.exportParametersVersion===t.exportParametersVersion,i=this._dataParameters.time===t.time,r=this._dataParameters.symbolTileSize===t.symbolTileSize,a=this._dataParameters.bbox===t.bbox;return e&&i&&r&&a}async _getProjectedFullExtent(t){try{return it(this.layer.fullExtent,t)}catch{try{const e=(await A(this.layer.url,{query:{option:"footprints",outSR:U(t),f:"json"}})).data.featureCollection.layers[0].layerDefinition.extent;return e?D.fromJSON(e):null}catch{return null}}}_updateSymbolizerParams(t){t.type==="vector-field"&&(this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null}))}};s([o()],p.prototype,"attached",void 0),s([o()],p.prototype,"container",void 0),s([o()],p.prototype,"layer",void 0),s([o()],p.prototype,"timeExtent",void 0),s([o()],p.prototype,"type",void 0),s([o()],p.prototype,"view",void 0),s([o()],p.prototype,"updating",null),p=s([w("esri.views.2d.layers.imagery.VectorFieldView2D")],p);const mt=p,dt=t=>{let e=class extends t{constructor(){super(...arguments),this.view=null}get timeExtent(){return st(this.layer,this.view?.timeExtent,this._get("timeExtent"))}async fetchPopupFeaturesAtLocation(i,r){const{layer:a}=this;if(!i)throw new C("imagerylayerview:fetchPopupFeatures","Nothing to fetch without area",{layer:a});const{popupEnabled:n}=a,l=ot(a,r);if(!n||l==null)return[];const u=await l.getRequiredFields();L(r);const m=new at;m.timeExtent=this.timeExtent,m.geometry=i,m.outFields=u,m.outSpatialReference=i.spatialReference;const{resolution:d,spatialReference:v}=this.view,g=this.view.type==="2d"?new q(d,d,v):new q(.5*d,.5*d,v),{returnTopmostRaster:c,showNoDataRecords:k}=l.layerOptions||{returnTopmostRaster:!0,showNoDataRecords:!1},z={returnDomainValues:!0,returnTopmostRaster:c,pixelSize:g,showNoDataRecords:k,signal:r?.signal};return a.queryVisibleRasters(m,z).then(T=>T)}canResume(){return!!super.canResume()&&!this.timeExtent?.isEmpty}};return s([o()],e.prototype,"layer",void 0),s([o()],e.prototype,"suspended",void 0),s([o({readOnly:!0})],e.prototype,"timeExtent",null),s([o()],e.prototype,"view",void 0),e=s([w("esri.views.layers.ImageryLayerView")],e),e};let x=class extends dt(nt(H(G))){constructor(){super(...arguments),this._exportImageVersion=-1,this._highlightGraphics=new M,this._highlightView=void 0,this.layer=null,this.subview=null}get pixelData(){const{subview:t}=this;return this.updating||!t?null:"getPixelData"in t?t.getPixelData():null}update(t){this.subview?.update(t)}attach(){this.layer.increaseRasterJobHandlerUsage(),this._setSubView(),this.view&&(this._highlightView=new J({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new W(this.view.featuresTilingScheme)}),this.container.addChild(this._highlightView.container)),this.addAttachHandles([f(()=>this.layer.exportImageServiceParameters.version,t=>{t&&this._exportImageVersion!==t&&(this._exportImageVersion=t,this.requestUpdate())},V),f(()=>this.timeExtent,t=>{const{subview:e}=this;e&&(e.timeExtent=t,"redraw"in e?this.requestUpdate():e.redrawOrRefetch())},V),this.layer.on("redraw",()=>{const{subview:t}=this;t&&("redraw"in t?t.redraw():t.redrawOrRefetch())}),f(()=>this.layer.renderer,()=>this._setSubView())])}detach(){this.layer.decreaseRasterJobHandlerUsage(),this.container.removeAllChildren(),this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null,this._highlightView?.destroy(),this._exportImageVersion=-1}viewChange(){}moveEnd(){this.requestUpdate()}highlight(t,e){if(!((Array.isArray(t)?t[0]:E.isCollection(t)?t.at(0):t)instanceof b))return S();let i=[];return Array.isArray(t)||E.isCollection(t)?i=t.map(r=>r.clone()):t instanceof b&&(i=[t.clone()]),this._highlightGraphics.addMany(i),S(()=>this._highlightGraphics.removeMany(i))}async doRefresh(){this.requestUpdate()}isUpdating(){const t=!this.subview||this.subview.updating||!!this._highlightView?.updating;return F("esri-2d-log-updating")&&console.log(`Updating ImageryLayerView2D (${this.layer.id}): ${t}
--> subview ${!this.subview||this.subview.updating}
--> higlightView ${this._highlightView?.updating}
-`),t}_setSubView(){if(!this.view)return;const t=this.layer.renderer?.type;let e="imagery";if(t==="vector-field"?e="imageryVF":t==="flow"&&(e="flow"),this.subview){const{type:i}=this.subview;if(i===e)return this._attachSubview(this.subview),void(i==="flow"?this.subview.redrawOrRefetch():i==="imagery"&&this.layer.format==="lerc"?this.subview.redraw():this.requestUpdate());this._detachSubview(this.subview),this.subview?.destroy()}this.subview=e==="imagery"?new lt({layer:this.layer,view:this.view,timeExtent:this.timeExtent}):e==="imageryVF"?new mt({layer:this.layer,view:this.view,timeExtent:this.timeExtent}):new N({layer:this.layer,layerView:this}),this._attachSubview(this.subview),this.requestUpdate()}_attachSubview(t){t&&!t.attached&&(t.attach(),t.attached=!0,this.container.addChildAt(t.container,0))}_detachSubview(t){t?.attached&&(this.container.removeChild(t.container),t.detach(),t.attached=!1)}};s([o()],x.prototype,"pixelData",null),s([o()],x.prototype,"subview",void 0),x=s([w("esri.views.2d.layers.ImageryLayerView2D")],x);const vi=x;export{vi as default};
diff --git a/fix-191/assets/ImageryTileLayer-DixyNESc-BnMG58QK.js b/fix-191/assets/ImageryTileLayer-DixyNESc-BnMG58QK.js
deleted file mode 100644
index f8b38a36..00000000
--- a/fix-191/assets/ImageryTileLayer-DixyNESc-BnMG58QK.js
+++ /dev/null
@@ -1,3 +0,0 @@
-const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./geometryEngine-CdPoFSE4-BRT3diG0.js","./story-DULt3Rma.js","./main-Bm7g2Jde.js","./main-DIDVYkhz.css","./story-DBsbaiEU.css","./geometryEngineBase-DueYg7ux-CCeespPx.js","./_commonjsHelpers-BITg13Vk-KnjfkSck.js","./hydrated-CplJC1Fs-DkY0Bobn.js","./imageryUtils-6MVSqijr-1Tgq6Wjf.js","./utils-BVWK2jiA-D_Oj_AG8.js","./originUtils-BLsWtgV9-B4sclfuf.js","./multiOriginJSONSupportUtils-DGETddQl-BrWaY9_8.js","./PortalItem-CctGdnxF-Dbw3pVTD.js","./jsonContext-BA8GHqVk-DqGWyE2_.js","./portalItemUtils-B8bw6SAG-CEVZt8QT.js","./projection-BA9M1R7d-DvHr0GeG.js","./projectBuffer-CvCBvJ6W-Cc8J4MEJ.js","./saveUtils-CIYk-dsQ-CKT8D_08.js"])))=>i.map(i=>d[i]);
-import{_ as at}from"./main-Bm7g2Jde.js";import{v as w,S as b,i as K,aa as wt,bp as It,W as bt,aO as Ae,o as C,ah as Rt,a1 as ne,bL as vt,e as St,w as A,n as W,f as ot,J as L,E as Tt,l as _t,bB as Ft,bz as kt,a0 as Ct,iF as lt,K as Ot,aS as Pt,O as Mt,a as Nt,aq as Me,eC as Dt,aG as Et,jz as Bt,ar as Jt,cB as At}from"./story-DULt3Rma.js";import{m as Lt}from"./MultiOriginJSONSupport-DKRh9P6w-tF-GNPM3.js";import{D as Ht}from"./Layer-ChoECxvZ-DQ-28MDL.js";import{a as zt}from"./ArcGISService-BYA-y6X6-C5W37jug.js";import{u as Wt}from"./BlendLayer-D1WkSmwP-BHrWqYGA.js";import{i as Gt}from"./CustomParametersMixin-vdKsTHer-ByoZbxFR.js";import{J as $t,k as Ne,p as qt,A as Vt,l as jt,c as Ut,V as Yt,E as Kt,a as Xt,Z as Qt,b as je,I as Ue,T as Zt,v as ei,w as ti,C as ii,S as Ye,f as si}from"./RasterPresetRendererMixin-D6W9pUY6-B8ohE660.js";import{j as ct}from"./arcgisLayerUrl-HNYh8jvG-CTcC0GBx.js";import{Z as ut,_ as ri}from"./commonProperties-BtIqvFU_-CfGSai59.js";import{R as ht,J as mt,Y as ni,I as ai,g as Le,j as Ke,p as oi,T as Xe,z as li}from"./multidimensionalUtils-BwTugeu7-BQuWE_eb.js";import{V as ee,d as ci}from"./TileInfo-CWIRDhZl-1qRzvaVI.js";import{V as ui,c as Re,W as ve,S as hi,d as He,s as ze,b as mi,u as fi,v as pi,A as di,D as yi,E as pe,F as gi,H as xi,N as wi,J as Ii,t as bi,L as Qe}from"./RasterSymbolizer-BVys6HkM-gLqgffM8.js";import{K as Ze,U as et,V as tt,X as Ri,Q as vi}from"./RawBlockCache-Cj_tmHDm-D_u1fkyX.js";import{f as Te,A as ft,M as Si,v as Ti,x as _i,b as Fi,k as ki,y as Ci,E as Oi,D as we,w as Pi,R as Mi,K as Ni}from"./dataUtils-BkPy4R3C-Cbeh7cC8.js";import{k as de,L as De,n as it,Q as st,X as Di,s as _e,o as Ie,K as Ei,Y as Bi,W as Ji,F as Ee}from"./rasterProjectionHelper-Calp0o_1-BRylUHz3.js";import{k as Ai}from"./QueueProcessor-DbfV9fLy-Cb_v9ly0.js";import{D as Li,h as pt,E as Be,v as We,x as Hi,B as zi}from"./PolynomialTransform-C3nWCu0l-CPzjDg5h.js";import{O as Ge}from"./FeatureSet-BkVNthuN-DUN6SnMl.js";import{E as Wi}from"./OperationalLayer-B5IXiMa2-BCAq75zB.js";import{C as Gi}from"./PortalLayer-CElnYuSQ-jChQE2im.js";import{T as $i}from"./RefreshableLayer-a8BQ58Xh-D8rhwboV.js";import{S as qi}from"./ScaleRangeLayer-Bz0DcnvM-BoX1P84V.js";import{x as Vi}from"./TemporalLayer-CpOrN_w9-Obih3ZXC.js";import{y as ce}from"./Field-C6hA1tZj-DdgmWWCq.js";import{f as ji}from"./TilemapCache-CRRxws77-DjXEnVKw.js";import{w as Ui}from"./popupUtils-B0uZcXX0-CcOxvXQU.js";import{E as ye}from"./interfaces-Cwm0pihk-Ptzy6gTd.js";import"./TimeExtent-Cn0Jofqr-DWlRQ-Qn.js";import"./jsonUtils-wIllKWI4-CU3QWWOb.js";import"./parser-DyDJ-rlI-8QTzeGdu.js";import"./mat4f32-CiZjBg9k-CUm34GoR.js";import"./mat4-DX7gBViE-DBcL5Ayd.js";import"./common-CYWrYyJl-E8-sukrT.js";import"./workers-PiCjreoO-CABaMBvC.js";import"./UniqueValueRenderer-fS5V0Ej1-BykZGEgA.js";import"./RendererLegendOptions-K3md58-X-DR3I9sq7.js";import"./diffUtils-Cz3Fi8Xb-Dx3TppL9.js";import"./colorRamps-q0bZVhs2-DkXm9F7X.js";import"./sizeVariableUtils-t52KcLLi-D0hbQF8b.js";import"./visualVariableUtils-D3kZJRyn-PuRGVqRl.js";import"./compilerUtils-CV1QYWI8-5SsZKq4e.js";import"./lengthUtils-DKpMe5qR-BEdWsC7X.js";import"./styleUtils-BtpNqZyT-nGAxWjLn.js";import"./ClassBreaksDefinition-bYRgYgPp-fywCcmFq.js";import"./utils-9sQxfkoa-CjNZjdKD.js";import"./normalizeUtils-Bxmy9MNI-CZMTs6Vg.js";import"./normalizeUtilsCommon-CRJlkfEA-CgRBIB_J.js";import"./utils-Bq23Xwmj-DhZYu3yh.js";import"./utils-DPtQ14k3-DaIPbUGN.js";import"./cimSymbolUtils-CKIzBgMU-CBWRf2E1.js";import"./utils-SPbpQbmm-BoVqh098.js";import"./enums-CpSG_SL3-BMD3Tb1v.js";import"./LRUCache-C3erQTWv-CBR8rG5i.js";import"./ElevationInfo-yv2-9tj6-B5v76p2q.js";import"./TileKey-B_6qmYK--BtZdR-Xy.js";import"./_commonjsHelpers-BITg13Vk-KnjfkSck.js";import"./colorUtils-Cthpxcks-CToOrmBC.js";import"./vec42-D8CJyqHG-DnfLTeQH.js";import"./vec4f64-hf2nxvhQ-CaAr8PTM.js";import"./projection-BA9M1R7d-DvHr0GeG.js";import"./projectBuffer-CvCBvJ6W-Cc8J4MEJ.js";import"./ReactiveMap-CFk6jPfN-D0CsM6VZ.js";import"./signal-CETehA7D-Cb8aw_q5.js";import"./PortalItem-CctGdnxF-Dbw3pVTD.js";import"./portalItemUtils-B8bw6SAG-CEVZt8QT.js";import"./TimeInfo-w_HB2CsF-CGuO-bD4.js";import"./fieldType-CD2CL2hr-BeIaxmP1.js";import"./ByteSizeUnit-DL8UhsB0-B2-AmVRx.js";const rt=8,Yi=256;let Ki=0,B=class extends St{constructor(){super(...arguments),this._tileFetchQueue=new Ai({concurrency:32,process:(t,e)=>this._fetchRawTile(t.pyramidLevel,t.row,t.col,{...t.options,signal:e})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}normalizeCtorArgs(t){return t?.ioConfig&&(t={...t,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:ee.create(),...t.ioConfig}}),t}get _isGlobalWrappableSource(){const{rasterInfo:t}=this,e=de(t.spatialReference);return e!=null&&t.extent.width>=e/2}get _hasNoneOrGCSShiftTransform(){const{transform:t}=this.rasterInfo;return t==null||t.type==="gcs-shift"}set rasterJobHandler(t){this._set("rasterJobHandler",t),this.datasetFormat==="Function"&&this.primaryRasters?.rasters?.forEach(e=>e.rasterJobHandler=t)}get rasterId(){return this.url||"rasterId-"+Ki++}set url(t){this._set("url",ct(t,ne.getLogger(this)))}async open(t){return this._openPromise??=De().then(()=>this._open(t)),this._openPromise}async fetchTile(t,e,r,i={}){const s=i.tileInfo||this.rasterInfo.storageInfo.tileInfo,a=this.getTileExtentFromTileInfo(t,e,r,s);return i={noClip:!0,...i},this.fetchPixels(a,s.size[0],s.size[1],i)}async identify(t,e={}){t=Ae(A,t).clone().normalize();const{multidimensionalDefinition:r,timeExtent:i}=e,{rasterInfo:s}=this,{hasMultidimensionalTranspose:a,multidimensionalInfo:n}=s;let{transposedVariableName:l}=e;const o=n!=null&&a&&(i!=null||ht(r));o&&!l&&(l=r!=null&&r.length>0?r[0].variableName??void 0:n.variables[0].name,e={...e,transposedVariableName:l}),e=this._getRequestOptionsWithSliceId(e);const{spatialReference:c,extent:u}=s,{datumTransformation:f}=e;let h=it(t,c,f);if(!u.intersects(h))return{location:h,value:null};if(s.transform!=null){const F=s.transform.inverseTransform(h);if(!s.nativeExtent.intersects(F))return{location:F,value:null};h=F}let m=0;const y=l!=null&&n!=null&&s.hasMultidimensionalTranspose;if(this.datasetFormat==="Function"){const F=this.primaryRasters.rasters[0];if(y)return F.identify(h,e);const{pixelSize:M}=s,O=3,N=M.x*O/2,D=M.y*O/2,J=new W({xmin:h.x-N,xmax:h.x+N,ymin:h.y-D,ymax:h.y+D,spatialReference:c}),z={interpolation:"nearest",multidimensionalDefinition:r,sliceId:e.sliceId},{pixelBlock:j}=await F.fetchPixels(J,O,O,z),{pixelBlock:G}=await this.fetchPixels(J,O,O,z);if(j==null)return{location:h,value:null};const $=Math.floor(O*O*.5),X=!j.mask||j.mask[$]?j.pixels.map(V=>V[$]):null;let te;return G!=null&&(te=!G.mask||G.mask[$]?G.pixels.map(V=>V[$]):void 0),{location:h,value:X,processedValue:te,pyramidLevel:0}}if(!y){if(e.srcResolution)m=st(e.srcResolution,s,this.ioConfig.sampling).pyramidLevel;else if(m=await this.computeBestPyramidLevelForLocation(t,e),m==null)return{location:h,value:null}}const g=this.identifyPixelLocation(h,m,null,y);if(g===null)return{location:h,value:null};const{row:p,col:d,rowOffset:x,colOffset:I,blockWidth:R}=g,S=l??e.sliceId,T=Ze(this.rasterId,S),v=`${m}/${p}/${d}`;let k=et(T,null,v);k==null&&(k=this.fetchRawTile(m,p,d,e),tt(T,null,v,k));const _=await k;if(!_?.pixels?.length)return{location:h,value:null};const P=x*R+I;return this._processIdentifyResult(_,{srcLocation:h,position:P,pyramidLevel:m,useTransposedTile:!!y,requestSomeSlices:o,identifyOptions:e})}async fetchPixels(t,e,r,i={}){t=Di(t),i=this._getRequestOptionsWithSliceId(i);const{_hasNoneOrGCSShiftTransform:s}=this;if(i.requestRawData&&s)return this._fetchPixels(t,e,r,i);const a=de(t.spatialReference),n=_e(t);if(a==null||n===0||n===1&&this._isGlobalWrappableSource&&s)return this._fetchPixels(t,e,r,i);if(n>=3)return{extent:t,pixelBlock:null};const l=[],{xmin:o,xmax:c}=t,u=Math.round(a/(c-o)*e),f=u-Math.round((a/2-o)/(c-o)*e);let h=0;const m=[];for(let d=0;d<=n;d++){const x=new W({xmin:d===0?o:-a/2,xmax:d===n?c-a*d:a/2,ymin:t.ymin,ymax:t.ymax,spatialReference:t.spatialReference}),I=d===0?u-f:d===n?e-h:u;h+=I,m.push(I);const R=i.disableWrapAround&&d>0?null:this._fetchPixels(x,I,r,i);l.push(R)}const y=(await Promise.all(l)).map(d=>d?.pixelBlock);let g=null;const p={width:e,height:r};return this.rasterJobHandler?g=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:y,srcMosaicSize:p,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:m},i)).pixelBlock:g=Te(y,p,{blockWidths:m}),{extent:t,srcExtent:Ie(t,this.rasterInfo.spatialReference,i.datumTransformation),pixelBlock:g}}async fetchRawPixels(t,e,r,i={}){e={x:Math.floor(e.x),y:Math.floor(e.y)};const s=await this._fetchRawTiles(t,e,r,i),{nativeExtent:a,nativePixelSize:n,storageInfo:l}=this.rasterInfo,o=2**t,c=n.x*o,u=n.y*o,f=new W({xmin:a.xmin+c*e.x,xmax:a.xmin+c*(e.x+r.width-1),ymin:a.ymax-u*(e.y+r.height-1),ymax:a.ymax-u*e.y,spatialReference:a.spatialReference});if(!s)return{extent:f,srcExtent:f,pixelBlock:null};const{pixelBlocks:h,mosaicSize:m}=s;if(h.length===1&&h[0]!=null&&h[0].width===r.width&&h[0].height===r.height)return{extent:f,srcExtent:f,pixelBlock:s.pixelBlocks[0]};const y=t>0?l.pyramidBlockWidth:l.blockWidth,g=t>0?l.pyramidBlockHeight:l.blockHeight,p={x:e.x%y,y:e.y%g};let d;return this.rasterJobHandler?d=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:m,destDimension:r,clipOffset:p,clipSize:r,coefs:null,sampleSpacing:null,interpolation:i.interpolation,alignmentInfo:null,blockWidths:null},i)).pixelBlock:d=Te(h,m,{clipOffset:p,clipSize:r}),{extent:f,srcExtent:f,pixelBlock:d}}fetchRawTile(t,e,r,i){throw new C("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(t){return Ie(this.rasterInfo.extent,t)}decodePixelBlock(t,e){return!this.rasterJobHandler||e.useCanvas?ui(t,e):this.rasterJobHandler.decode({data:t,options:e})}async request(t,e,r=0){const{customFetchParameters:i}=this.ioConfig,{range:s,query:a,headers:n}=e;r=r??e.retryCount??this.ioConfig.retryCount;const l=s?{Range:`bytes=${s.from}-${s.to}`}:null;try{return await ot(t,{...e,query:{...a,...i},headers:{...n,...l}})}catch(o){if(r>0)return r--,this.request(t,e,r);throw o}}getSliceIndex(t){const{multidimensionalInfo:e}=this.rasterInfo;return e==null||t==null||t.length===0?null:mt(t,e)}getTileExtentFromTileInfo(t,e,r,i){const s=i.lodAt(t);return this.getTileExtent({x:s.resolution,y:s.resolution},e,r,i.origin,i.spatialReference,i.size)}updateTileInfo(){const{storageInfo:t,spatialReference:e,extent:r,pixelSize:i}=this.rasterInfo,{pyramidResolutions:s}=t;if(!t.tileInfo){const a=[],n=t.maximumPyramidLevel||0;let l=(i.x+i.y)/2,o=1/.0254*96*l;for(let u=0;u<=n&&(a.unshift(new ci({level:n-u,resolution:l,scale:o})),u!==n);u++)if(s){const f=(s[u].x+s[u].y)/2;o*=f/l,l=f}else l*=2,o*=2;const c=new A({x:r.xmin,y:r.ymax,spatialReference:e});t.tileInfo=new ee({origin:c,size:[t.blockWidth,t.blockHeight],spatialReference:e,lods:a}),t.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(t,e=512,r=512,i){const{width:s,height:a,nativeExtent:n,pixelSize:l,spatialReference:o}=t,c=new A({x:n.xmin,y:n.ymax,spatialReference:o});i==null&&(i=Math.max(0,Math.round(Math.log(Math.max(s,a))/Math.LN2-8)));const u=this.computeBlockBoundary(n,512,512,{x:n.xmin,y:n.ymax},[l],i);t.storageInfo=new Re({blockWidth:e,blockHeight:r,pyramidBlockWidth:e,pyramidBlockHeight:r,origin:c,firstPyramidLevel:1,maximumPyramidLevel:i,blockBoundary:u})}async computeBestPyramidLevelForLocation(t,e={}){return 0}computeBlockBoundary(t,e,r,i,s,a=0,n=2){if(s.length===1&&a>0){s=[...s];let{x:u,y:f}=s[0];for(let h=0;hl)return null;const m=this.getPyramidPixelSize(e),{x:y,y:g}=m,p=(o.y-h.y)/g/f,d=(h.x-o.x)/y/u,x=Math.min(f-1,Math.floor((p-Math.floor(p))*f)),I=Math.min(u-1,Math.floor((d-Math.floor(d))*u));return{pyramidLevel:e,row:Math.floor(p),col:Math.floor(d),rowOffset:x,colOffset:I,blockWidth:u,srcLocation:h}}getTileExtent(t,e,r,i,s,a){const[n,l]=a,o=i.x+r*n*t.x,c=o+n*t.x,u=i.y-e*l*t.y,f=u-l*t.y;return new W({xmin:o,xmax:c,ymin:f,ymax:u,spatialReference:s})}getBlockWidthHeight(t){return{blockWidth:t>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:t>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(t,e,r){const i=this.rasterInfo.storageInfo.blockBoundary[t];return!i||i.maxRowe||i.minCol>r}updateImageSpaceRasterInfo(t){const{pixelSize:e}=t,{width:r,height:i}=t,s=L.WebMercator;t.spatialReference=s,t.extent=t.nativeExtent=new W({xmin:-.5,ymax:.5,xmax:r-.5,ymin:.5-i,spatialReference:s}),t.isPseudoSpatialReference=!0,t.transform=null,t.pixelSize=new A({x:1,y:1,spatialReference:s});const{extent:a,storageInfo:n}=t;if(n){n.origin=new A({x:a.xmin,y:a.ymax,spatialReference:s});const{pyramidResolutions:l,tileInfo:o}=n;if(l&&l.forEach(c=>{c.x/=e.x,c.y/=e.y}),o){o.origin=n.origin;const c=(t.nativePixelSize.x+t.nativePixelSize.y)/2;o.lods.forEach((u,f)=>{u.resolution=c*2**f,u.scale=96*u.resolution/.0254})}}}async _fetchPixels(t,e,r,i={}){let s=_e(t);if(s>=2)return{extent:t,pixelBlock:null};const a=this._getSourceDataInfo(t,e,r,i),{pyramidLevel:n,srcResolution:l,srcExtent:o,srcWidth:c,srcHeight:u,ul:f}=a;if(c===0||u===0)return{extent:t,srcExtent:o,pixelBlock:null};const{rasterInfo:h}=this,m=h.transform,y=m?.type==="gcs-shift",g=de(t.spatialReference)!=null;!y&&g||(s=_e(a.srcExtent,y));const p=await this._fetchRawTiles(n,f,{width:c,height:u,wrapCount:s},i);if(!p)return{extent:t,srcExtent:o,pixelBlock:null};const d=h.storageInfo,x=n>0?d.pyramidBlockWidth:d.blockWidth,I=n>0?d.pyramidBlockHeight:d.blockHeight;let{x:R,y:S}=h.pixelSize;if(n>0){const{pyramidResolutions:Q,pyramidScalingFactor:xt}=d;if(Q!=null&&Q[n-1])({x:R,y:S}=Q[n-1]);else{const Ve=xt**n;R*=Ve,S*=Ve}}const T=h.spatialReference,v=new A({x:R,y:S,spatialReference:T}),k=x===c&&I===u&&f.x%x==0&&f.y%I==0,_=new A({x:(t.xmax-t.xmin)/e,y:(t.ymax-t.ymin)/r,spatialReference:t.spatialReference}),P=!t.spatialReference.equals(T),F=T.isGeographic?1e-9:1e-4,{datumTransformation:M}=i;if(!P&&k&&p.pixelBlocks.length===1&&x===e&&I===r&&Xi(l,_,F))return{extent:t,srcExtent:o,srcTilePixelSize:v,pixelBlock:p.pixelBlocks[0]};const O=g&&de(o.spatialReference)!=null&&this._hasNoneOrGCSShiftTransform,N=i.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");N&&!this.rasterJobHandler&&await De();const D=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:t,srcBufferExtent:p.extent,pixelSize:_.toJSON(),datumTransformation:M,rasterTransform:m,hasWrapAround:s>0||O,isAdaptive:this.ioConfig.optimizeProjectionAccuracy!==!1,includeGCSGrid:N},i):Ei({projectedExtent:t,srcBufferExtent:p.extent,pixelSize:_,datumTransformation:M,rasterTransform:m,hasWrapAround:s>0||O,isAdaptive:!1,includeGCSGrid:N});let J;const z=!i.requestRawData,j={rows:D.spacing[0],cols:D.spacing[1]},G=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(n,p.extent.xmin):void 0,{pixelBlocks:$,mosaicSize:X,isPartiallyFilled:te}=p;let V=null;if(this.rasterJobHandler)({pixelBlock:J,localNorthDirections:V}=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:$,srcMosaicSize:X,destDimension:z?{width:e,height:r}:null,coefs:z?D.coefficients:null,sampleSpacing:z?j:null,projectDirections:N,gcsGrid:N?D.gcsGrid:null,isUV:this.rasterInfo.dataType==="vector-uv",interpolation:i.interpolation,alignmentInfo:G,blockWidths:null},i));else{const Q=Te($,X,{alignmentInfo:G});J=z?ft(Q,{width:e,height:r},D.coefficients,j,i.interpolation):Q,N&&D.gcsGrid&&(V=Si({width:e,height:r},D.gcsGrid),J=Ti(J,this.rasterInfo.dataType,V))}return i.requestRawData||N?{extent:t,srcExtent:o,srcTilePixelSize:v,pixelBlock:J,transformGrid:D,localNorthDirections:V,isPartiallyFilled:te}:{extent:t,srcExtent:o,srcTilePixelSize:v,pixelBlock:J}}async _fetchRawTiles(t,e,r,i){const{origin:s,blockBoundary:a}=this.rasterInfo.storageInfo,{blockWidth:n,blockHeight:l}=this.getBlockWidthHeight(t);let{x:o,y:c}=e,{width:u,height:f,wrapCount:h}=r;const m=this._getRasterTileAlignmentInfo(t,0);i.buffer&&(o-=i.buffer.cols,c-=i.buffer.rows,u+=2*i.buffer.cols,f+=2*i.buffer.rows);let y=0,g=0,p=0;h&&m!=null&&({worldColumnCountFromOrigin:g,originColumnOffset:p,rightPadding:y}=m,g*m.blockWidth-y>=o+u&&(y=0));const d=Math.floor(o/n),x=Math.floor(c/l),I=Math.floor((o+u+y-1)/n),R=Math.floor((c+f+y-1)/l),S=a[t];if(!S)return null;const{minRow:T,minCol:v,maxCol:k,maxRow:_}=S;if(h===0&&(R_||d>k))return null;const P=new Array;let F=!1;const M=this.ioConfig.allowPartialFill==null?i.allowPartialFill:this.ioConfig.allowPartialFill;for(let G=x;G<=R;G++)for(let $=d;$<=I;$++){let X=$;if(!i.disableWrapAround&&h&&m!=null&&g<=$&&(X=$-g-p),G>=T&&X>=v&&_>=G&&k>=X){const te=this._tileFetchQueue.push({pyramidLevel:t,row:G,col:X,options:i},{signal:i.signal});M?P.push(new Promise(V=>{te.then(Q=>V(Q)).catch(()=>{F=!0,V(null)})})):P.push(te)}else P.push(Promise.resolve(null))}if(P.length===0)return null;const O=await Promise.all(P),N={height:(R-x+1)*l,width:(I-d+1)*n},{spatialReference:D}=this.rasterInfo,J=this.getPyramidPixelSize(t),{x:z,y:j}=J;return{extent:new W({xmin:s.x+d*n*z,xmax:s.x+(I+1)*n*z,ymin:s.y-(R+1)*l*j,ymax:s.y-x*l*j,spatialReference:D}),pixelBlocks:O,mosaicSize:N,isPartiallyFilled:F}}_fetchRawTile(t,e,r,i){const s=this.rasterInfo.storageInfo.blockBoundary[t];if(!s)return Promise.resolve(null);const{minRow:a,minCol:n,maxCol:l,maxRow:o}=s;if(eo||r>l)return Promise.resolve(null);const c=Ze(this.rasterId,i.sliceId),u=`${t}/${e}/${r}`;let f=et(c,i.registryId,u);if(f==null){const h=new AbortController;f=this.fetchRawTile(t,e,r,{...i,signal:h.signal}),tt(c,i.registryId,u,f,h),f.catch(()=>Ri(c,i.registryId,u))}return i.signal&&Tt(i,()=>{vi(c,i.registryId,u)}),f}_computeMagDirValues(t){const{bandCount:e,dataType:r}=this.rasterInfo;if(!(e===2&&r==="vector-magdir"||r==="vector-uv")||t?.length!==2||!t[0]?.length)return null;const i=t[0].length;if(r==="vector-magdir"){const o=t[1].map(c=>(c+360)%360);return[t[0],o]}const[s,a]=t,n=[],l=[];for(let o=0;o=16,h=o===a&&this._requireTooManySrcTiles(n,l,e,r);if(f||h||n===0||l===0){const m=new A({x:(t.xmax-t.xmin)/e,y:(t.ymax-t.ymin)/r,spatialReference:t.spatialReference});let y=Ji(m,this.rasterInfo.spatialReference,t,s.datumTransformation);const g=!y||i.srcResolution&&y.x+y.y=p){const d=2**p;y={x:i.srcResolution.x*d,y:i.srcResolution.y*d}}}y&&(s.srcResolution=y,this._updateSourceDataInfo(t,s))}return this._requireTooManySrcTiles(s.srcWidth,s.srcHeight,e,r)&&(s.srcWidth=0,s.srcHeight=0),s}_requireTooManySrcTiles(t,e,r,i){const{tileInfo:s}=this.rasterInfo.storageInfo,a=Math.ceil(t/s.size[0])*Math.ceil(e/s.size[1]),n=t/r,l=e/i,o=Math.max(1,(r+i)/1024);return a>=Yi*o||n>rt||l>rt}_updateSourceDataInfo(t,e){e.srcWidth=0,e.srcHeight=0;const{rasterInfo:r}=this,i=r.spatialReference,{srcResolution:s,datumTransformation:a}=e,{pyramidLevel:n,pyramidResolution:l,excessiveReading:o}=st(s,r,this.ioConfig.sampling);if(o)return;let c=e.srcExtent||Ie(t,i,a);if(c==null)return;const u=r.transform;u&&(c=u.inverseTransform(c)),e.srcExtent=c;const{x:f,y:h}=r.storageInfo.origin,m=Math.floor((c.xmin-f)/l.x+.1),y=Math.floor((h-c.ymax)/l.y+.1),g=Math.floor((c.xmax-f)/l.x-.1),p=Math.floor((h-c.ymin)/l.y-.1),d=c.width<.1*l.x?0:g-m+1,x=c.height<.1*l.y?0:p-y+1;e.pyramidLevel=n,e.pyramidResolution=l,e.srcWidth=d,e.srcHeight=x,e.ul={x:m,y}}_getRequestOptionsWithSliceId(t){return this.rasterInfo.multidimensionalInfo!=null&&t.sliceId==null&&(t={...t,sliceId:this.getSliceIndex(t.multidimensionalDefinition)}),t}_processIdentifyResult(t,e){const{srcLocation:r,position:i,pyramidLevel:s,useTransposedTile:a}=e,n=t.pixels[0].length/t.width/t.height;if(!(!t.mask||t.mask[i]))return{location:r,value:null};const{multidimensionalInfo:l}=this.rasterInfo;if(l==null||!a){const p=t.pixels.map(I=>I[i]),d={location:r,value:p,pyramidLevel:s},x=this._computeMagDirValues(p.map(I=>[I]));return x?.length&&(d.magdirValue=x.map(I=>I[0])),d}let o=t.pixels.map(p=>p.slice(i*n,i*n+n)),c=this._computeMagDirValues(o);const{requestSomeSlices:u,identifyOptions:f}=e;let h=ni(l,f.transposedVariableName);if(u){const p=ai(h,f.multidimensionalDefinition,f.timeExtent);o=o.map(d=>p.map(x=>d[x])),c=c?.map(d=>p.map(x=>d[x])),h=p.map(d=>h[d])}const m=t.noDataValues||this.rasterInfo.noDataValue,y={pixels:o,pixelType:t.pixelType};let g;return m!=null&&(Fi(y,m),g=y.mask),{location:r,value:null,dataSeries:h.map((p,d)=>{const x={value:g?.[d]===0?null:o.map(I=>I[d]),multidimensionalDefinition:p.multidimensionalDefinition.map(I=>new Le({...I,isSlice:!0}))};return c?.length&&(x.magdirValue=[c[0][d],c[1][d]]),x}),pyramidLevel:s}}};function Xi(t,e,r){return Math.abs(t.x-e.x)I.fetchPixels(t,e,r,i)),u=await Promise.all(c),f=u.map(I=>I.pixelBlock),h=n||i.requestRawData?u.map(I=>I.srcTilePixelSize):null;if(i.skipRasterFunction||f.every(I=>I==null))return u[0];const m=u.find(I=>I.pixelBlock!=null)?.extent??t;let y=this.rasterJobHandler?await this.rasterJobHandler.process({extent:m,primaryPixelBlocks:f,primaryPixelSizes:h,primaryRasterIds:a}):this.rasterFunction.process({extent:m,primaryPixelBlocks:f,primaryPixelSizes:h,primaryRasterIds:a});const{transformGrid:g}=u[0];if(!n||y==null||g==null){const I=i.noClip?null:this.getClippingGeometry(m.spatialReference);return i.noClip||i.requestRawData||y==null||!I||(y=await Be(y,m,I)),{...u[0],pixelBlock:y}}const p={rows:g.spacing[0],cols:g.spacing[1]};let d;this.rasterJobHandler?d=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:[y],srcMosaicSize:{width:y.width,height:y.height},destDimension:{width:e,height:r},coefs:g.coefficients,sampleSpacing:p,projectDirections:!1,gcsGrid:null,isUV:!1,interpolation:l,alignmentInfo:void 0,blockWidths:null},i)).pixelBlock:d=ft(y,{width:e,height:r},g.coefficients,p,l);const x=i.noClip?null:this.getClippingGeometry(t.spatialReference);return i.noClip||i.requestRawData||d==null||x==null||(d=await Be(d,t,x)),{extent:t,srcExtent:u[0].srcExtent,pixelBlock:d}}getClippingGeometry(t){const e=this._clippingGeometry.get("0");if(!t||!e)return e;const r=es(t);let i=this._clippingGeometry.get(r);return i!=null||(i=t.equals(e.spatialReference)?e:Ee(e,t),this._clippingGeometry.set(r,i)),i}async _open(t){const{rasterFunction:e}=this;this.primaryRasters?.rasters?.length?e.sourceRasters=this.primaryRasters.rasters:(this.primaryRasters=e.getPrimaryRasters(),this.rasterJobHandler&&this.primaryRasters.rasters?.forEach(c=>c.rasterJobHandler=this.rasterJobHandler));const{rasters:r,rasterIds:i}=this.primaryRasters,s=r.map(c=>c.rasterInfo?void 0:c.open(t));await Promise.all(s);const a=r.map(({rasterInfo:c})=>c),n=e.bind({rasterInfos:a,rasterIds:i});if(e.rawSourceRasterInfos=a,!n.success||a.length===0)throw new C("raster-function:open",`cannot bind the function: ${n.error??""}`);const l=e.functionName==="Table"?e:e.functionArguments?.raster;l?.functionName==="Table"&&(e.rasterInfo.attributeTable=Ge.fromJSON(l.functionArguments.attributeTableAsRecordSet)),await this.syncJobHandler();const o=a[0];this.hasUniqueSourceStorageInfo=a.length===1||a.slice(1).every(c=>Zi(c,o)),this.set("sourceJSON",r[0].sourceJSON),this.set("rasterInfo",e.rasterInfo),await this._updateClipGeometry()}async syncJobHandler(){return this.rasterJobHandler?.updateRasterFunction(this.rasterFunction)}async _updateClipGeometry(){const t=this.rasterFunction.getClippingGeometries()[0];let e=t?.clippingGeometry;if(e&&t.clippingType==="inside"){const{extent:r}=this.rasterInfo,{difference:i,densify:s}=await at(async()=>{const{difference:n,densify:l}=await import("./geometryEngine-CdPoFSE4-BRT3diG0.js");return{difference:n,densify:l}},__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url);let a=s(_t.fromExtent(r),2*(r.width+r.height)/Qi);a=Ee(a,e.spatialReference),e=i(a,e)}this._clippingGeometry.clear(),e&&this._clippingGeometry.set("0",e)}};w([b({type:String,json:{write:!0}})],ie.prototype,"datasetFormat",void 0),w([b()],ie.prototype,"tileType",void 0),w([b()],ie.prototype,"rasterFunction",void 0),w([b()],ie.prototype,"primaryRasters",void 0),ie=w([K("esri.layers.support.rasterDatasets.FunctionRaster")],ie);const dt=ie;function Zi(t,e){const{storageInfo:r,pixelSize:i,spatialReference:s,extent:a}=t,{storageInfo:n,pixelSize:l,spatialReference:o,extent:c}=e;return i.x===l.x&&i.y===l.y&&s.equals(o)&&a.equals(c)&&r.blockHeight===n.blockHeight&&r.blockWidth===n.blockWidth&&r.maximumPyramidLevel===n.maximumPyramidLevel}function es(t){return String(t.wkid??t.wkt??t.wkt2)}const ts=t=>{let e=class extends t{constructor(...i){super(...i),this._isConstructedFromFunctionRaster=!1,this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.interpolation=null,this.multidimensionalSubset=null,this.raster=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster=i[0]?.raster?.datasetFormat==="Function"}get fullExtent(){return this.serviceRasterInfo?.extent}set multidimensionalDefinition(i){this._set("multidimensionalDefinition",i),this.updateRenderer()}set rasterFunction(i){i?.functionName?.toLowerCase()==="none"&&(i=void 0),this._set("rasterFunction",i),this.updateRasterFunction()}get rasterInfo(){return Dt(ne.getLogger(this),"rasterInfo",{replacement:"serviceRasterInfo",version:"4.29",warnOnce:!0}),this._get("serviceRasterInfo")}set url(i){this._set("url",ct(i,ne.getLogger(this)))}get renderer(){if(this.type!=="imagery-tile")return this.internalRenderer;const{activePresetRendererName:i,presetRenderers:s}=this;return i?s?.find(({name:a})=>a===i)?.renderer.clone():this.internalRenderer}set renderer(i){this.type==="imagery-tile"&&(this.activePresetRendererName=null),this.internalRenderer=i}set internalRenderer(i){i==null&&this.rasterFunction==null?this._configDefaultRenderer("override"):(this._set("internalRenderer",i),this.updateRenderer())}readRenderer(i,s,a){const n=s?.layerDefinition?.drawingInfo?.renderer;return Xt(n,a)||void 0}async convertVectorFieldData(i,s){const{serviceRasterInfo:a}=this;if(i==null||!a)return null;const n=this._rasterJobHandler.instance,l=a.dataType;return n?n.convertVectorFieldData({pixelBlock:i,dataType:l},s):Pi(i,l)}async computeStatisticsHistograms(i,s){await this.load(s),i=Ae(Qt,i).clone();const{serviceRasterInfo:a}=this;if(a==null)throw new C("imagery-tile-mixin:compute-statistics-histograms","serviceRasterInfo must be specified");const{geometry:n}=i;if(n==null)throw new C("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let l=n;const{spatialReference:o}=a;n.spatialReference.equals(o)||(await De(),l=n.type==="extent"?Ie(n,o):Ee(n,o));const c=i.pixelSize??new A({x:a.pixelSize.x,y:a.pixelSize.y,spatialReference:o}),{extent:u,width:f,height:h}=zi(a,l,c),m=await this.fetchPixels(u,f,h,{...s,interpolation:"nearest"});if(m.pixelBlock==null)throw new C("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const y=await Be(m.pixelBlock,u,l),g=this._rasterJobHandler.instance;return g?g.computeStatisticsHistograms({pixelBlock:y},s):He(y)}async createFlowMesh(i,s){const a=this._rasterJobHandler.instance;return a?a.createFlowMesh(i,s):Mi(i.meshType,i.simulationSettings,i.flowData,s.signal!=null?s.signal:new AbortController().signal)}normalizeRasterFetchOptions(i){const{multidimensionalInfo:s}=this.serviceRasterInfo??{};if(s==null)return i;let a=i.multidimensionalDefinition||this.multidimensionalDefinition;a?.length||(a=Ke(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset}));const n=i.timeExtent||this.timeExtent;if(a!=null&&n!=null&&(n.start!=null||n.end!=null)){a=a.map(g=>g.clone());const l=s.variables.find(({name:g})=>g===a[0].variableName)?.dimensions?.find(({name:g})=>g==="StdTime"),o=a.find(({dimensionName:g})=>g==="StdTime");if(!l||!o)return{...i,multidimensionalDefinition:null};const{start:c,end:u}=n,f=c==null?null:c.getTime(),h=u==null?null:u.getTime(),m=f??h,y=h??f;if(l.values!=null){const g=l.values.filter(p=>{if(Array.isArray(p)){if(m===y)return p[0]<=m&&p[1]>=m;const d=p[0]<=m&&p[1]>m||p[0]=y,x=p[0]>=m&&p[1]<=y||p[0]y;return d||x}return m===y?p===m:p>=m&&p<=y});if(g.length){const p=g.sort((d,x)=>{const I=Array.isArray(d)?d[0]:d,R=Array.isArray(d)?d[1]:d,S=Array.isArray(x)?x[0]:x,T=Array.isArray(x)?x[1]:x;return m===y?I-S:Math.abs(R-y)-Math.abs(T-y)})[0];o.values=[p]}else a=null}else if(l.hasRegularIntervals&&l.extent){const[g,p]=l.extent;m>p||y1&&i.forEach(m=>u[m.url]=m);const f=pt(n.functionDefinition?.toJSON()??n.toJSON(),u),h=new dt({rasterFunction:f});h.rasterJobHandler=this._rasterJobHandler.instance,await h.open(),this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this.raster=h}else this.raster=s,this._cachedRasterFunctionJson=null,await s.open();if(this._cachedRendererJson=null,!a&&!n)return;const{bandIds:l}=this,{bandCount:o}=this.raster.rasterInfo,c=l?.length?l.some(u=>u>=o):o>=3;l&&(c||this.renderer&&this.renderer.type!=="raster-stretch")&&this._set("bandIds",null),this._configDefaultRenderer("auto")}async updateRenderer(){const{loaded:i,symbolizer:s}=this;if(!i||!s||!this.renderer)return;const{rasterInfo:a}=this.raster,n=Xe(a,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),l=n?.name,o=je({...this.renderer.toJSON(),variableName:l});if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(o))return;const c=this._rasterJobHandler.instance;c&&(s.rasterInfo=Ue(a,l),s.rendererJSON=o,s.bind(),await c.updateSymbolizer(s),this._cachedRendererJson=o)}async applyRenderer(i,s){const a=i?.pixelBlock;if(!(a!=null&&a.pixels&&a.pixels.length>0))return null;let n;await this.updateRenderer();const l=this._rasterJobHandler.instance,o=this.bandIds??[];return n=l?await l.symbolize({...i,simpleStretchParams:s,bandIds:o}):this.symbolizer.symbolize({...i,simpleStretchParams:s,bandIds:o}),n}getTileUrl(i,s,a){return this.raster.datasetFormat==="RasterTileServer"?`${this.url}/tile/${i}/${s}/${a}`:""}getCompatibleTileInfo(i,s,a=!1){if(!this.loaded||s==null)return null;if(a&&i.equals(this.spatialReference))return this.tileInfo;const n=Et(i);return ee.create({size:256,spatialReference:i,origin:n?{x:n.origin[0],y:n.origin[1]}:{x:s.xmin,y:s.ymax}})}getCompatibleFullExtent(i){return this.loaded?(this._compatibleFullExtent?.spatialReference.equals(i)||(this._compatibleFullExtent=this.raster.computeExtent(i)),this._compatibleFullExtent):null}async fetchTile(i,s,a,n={}){if(r(this),n.requestAsImageElement){const o=this.getTileUrl(i,s,a);return ot(o,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:n.signal}).then(c=>c.data)}const{serviceRasterInfo:l}=this;if(l.multidimensionalInfo!=null&&(n=this.normalizeRasterFetchOptions(n)).multidimensionalDefinition==null){const o=n.tileInfo||l.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(i,s,a,o),pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),this.renderer?.type==="raster-shaded-relief"&&(n={...n,buffer:{cols:1,rows:1}}),this.raster.fetchTile(i,s,a,n)}async fetchPixels(i,s,a,n={}){return this.serviceRasterInfo.multidimensionalInfo!=null&&(n=this.normalizeRasterFetchOptions(n)).multidimensionalDefinition==null?{extent:i,pixelBlock:null}:(await this._initJobHandler(),await this.updateRasterFunction(),s=Math.round(s),a=Math.round(a),this.raster.fetchPixels(i,s,a,n))}async identify(i,s={}){await this.load();const{raster:a,serviceRasterInfo:n}=this;if(n?.multidimensionalInfo!=null&&!(n.hasMultidimensionalTranspose&&(ht(s.multidimensionalDefinition)||s.transposedVariableName||s.timeExtent))&&(s=this.normalizeRasterFetchOptions(s)).multidimensionalDefinition==null)return{location:i,value:null};const l=this.multidimensionalSubset?.areaOfInterest;if(l&&!l.contains(i))throw new C("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");return a.identify(i,s)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){const i=this.serviceRasterInfo?.multidimensionalInfo;if(i==null||this.serviceRasterInfo?.dataType!=="standard-time")return!1;const s=this.multidimensionalDefinition,a=s?.[0]?.variableName;return i.variables.some(n=>n.name===a&&(!s?.[0].dimensionName||n.dimensions.some(l=>l.name==="StdTime")))}getStandardTimeValue(i){return new Date(24*(i-25569)*3600*1e3).toString()}getMultidimensionalSubsetVariables(i){const s=i??this.serviceRasterInfo?.multidimensionalInfo;return li(this.multidimensionalSubset,s)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=Ke(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this.rasterFunction&&this.raster.datasetFormat==="Function"&&(this._cachedRasterFunctionJson=this.rasterFunction.toJSON()),this._configDefaultRenderer()}_initJobHandler(){if(this._rasterJobHandler.connectionPromise!=null)return this._rasterJobHandler.connectionPromise;const i=new si;return this._rasterJobHandler.connectionPromise=i.initialize().then(async()=>{r(this),this._rasterJobHandler.instance=i,this.raster.rasterJobHandler=i,this.raster.datasetFormat==="Function"&&this.raster.syncJobHandler(),this.rasterFunction&&await this.updateRasterFunction().catch(()=>{}),this.renderer&&this.updateRenderer()}).catch(()=>{}),this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null,this.raster&&(this.raster.rasterJobHandler=null)}_configDefaultInterpolation(){if(this.interpolation==null){r(this);const{raster:i}=this,s=Zt(i.rasterInfo,i.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",s)}}_configDefaultRenderer(i="no"){r(this);const{rasterInfo:s}=this.raster,a=Xe(s,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),n=a?.name,l=ei({variableName:n,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&s.bandCount>1&&(this.bandIds=l?.bandIds??ti(s)),!this.renderer||i==="override"){const f=ii(this.raster),h=l?.renderer??Ye(s,{bandIds:this.bandIds,variableName:n,rasterFunctionColorRamp:f}),m=s.statistics,y=m&&m.length>0?m[0]:null,g=y?.max??0,p=y?.min??0;this.raster.datasetFormat==="WCSServer"&&h.type==="raster-stretch"&&(g>1e24||p<-1e24)&&(h.dynamicRangeAdjustment=!0,h.customStatistics=null,h.stretchType==="none"&&(h.stretchType="min-max")),this.renderer=h}const o=je({...this.renderer.toJSON(),variableName:n}),c=Ue(s,n);this.symbolizer?(this.symbolizer.rendererJSON=o,this.symbolizer.rasterInfo=c):this.symbolizer=new bi({rendererJSON:o,rasterInfo:c});const u=this.symbolizer.bind();if(u.success){if(i==="auto"){const{colormap:f}=this.raster.rasterInfo,h=this.renderer;if(f!=null&&h.type==="raster-colormap"){const m=Ye(this.raster.rasterInfo);JSON.stringify(m)!==JSON.stringify(h)&&this._configDefaultRenderer("override")}else if(h.type==="raster-stretch"){const m=this.bandIds?.length,y=h.customStatistics?.length;!h.dynamicRangeAdjustment&&y&&m&&y!==m&&this._configDefaultRenderer("override")}}}else ne.getLogger(this).warn("imagery-tile-mixin",u.error||"The given renderer is not supported by the layer."),i==="auto"&&this._configDefaultRenderer("override")}};function r(i){if(!i.raster||!i.serviceRasterInfo)throw new C("imagery-tile","no raster")}return w([b({clonable:!1})],e.prototype,"_cachedRendererJson",void 0),w([b({clonable:!1})],e.prototype,"_cachedRasterFunctionJson",void 0),w([b({clonable:!1})],e.prototype,"_compatibleFullExtent",void 0),w([b({clonable:!1})],e.prototype,"_isConstructedFromFunctionRaster",void 0),w([b({clonable:!1})],e.prototype,"_rasterJobHandler",void 0),w([b({type:[Ft],json:{write:{overridePolicy(){return{enabled:!this.loaded||this.raster.tileType==="Raster"||this.bandIds?.join(",")!=="0,1,2"}}}}})],e.prototype,"bandIds",void 0),w([b({json:{origins:{service:{read:{source:"copyrightText"}}}}})],e.prototype,"copyright",void 0),w([b({json:{read:!1}})],e.prototype,"fullExtent",null),w([b({json:{write:{overridePolicy(){return{enabled:!this.loaded||this.raster.tileType==="Raster"||this.interpolation!=="bilinear"}}}}}),kt(qt)],e.prototype,"interpolation",void 0),w([b()],e.prototype,"ioConfig",void 0),w([b({type:[Le],json:{write:!0}})],e.prototype,"multidimensionalDefinition",null),w([b({type:Vt,json:{write:!0}})],e.prototype,"multidimensionalSubset",void 0),w([b()],e.prototype,"raster",void 0),w([b({type:Ne,json:{name:"renderingRule",write:!0}})],e.prototype,"rasterFunction",null),w([b({readOnly:!0})],e.prototype,"rasterInfo",null),w([b()],e.prototype,"serviceRasterInfo",void 0),w([b()],e.prototype,"sourceJSON",void 0),w([b({readOnly:!0,type:L,json:{read:!1}})],e.prototype,"spatialReference",void 0),w([b({type:ee})],e.prototype,"tileInfo",void 0),w([b(ut)],e.prototype,"url",null),w([b()],e.prototype,"renderer",null),w([b({types:jt,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){const i=this.renderer?.type==="raster-stretch"&&this.renderer.stretchType==="none"&&!this.renderer.useGamma;return{enabled:!this.loaded||this.raster.tileType==="Raster"||!i}}},origins:{"web-scene":{types:Ut,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:i=>({enabled:i&&i.type!=="vector-field"&&i.type!=="flow"})}}}}})],e.prototype,"internalRenderer",null),w([Ct("internalRenderer")],e.prototype,"readRenderer",null),w([b({clonable:!1})],e.prototype,"symbolizer",void 0),e=w([K("esri.layers.mixins.ImageryTileMixin")],e),e};function yt(t){return["x","e","east","long","longitude"].includes(t.toLowerCase())}function gt(t){return["y","n","west","lat","latitude"].includes(t.toLowerCase())}function is(t){const{axes:e}=t.domain,r=Object.keys(e),i=[],s=[];let a=-1,n=-1,l=[];for(let x=0;xS.push(typeof v=="string"?new Date(v).getTime():v));const T=S[1]-S[0];i.push([S[0]-.5*T,S[S.length-1]+.5*T]),s.push(T)}else{const{start:T,stop:v,num:k}=R,_=(v-T)/(k-1);i.push([T-.5*_,v+.5*_]),s.push(_);for(let P=0;P-1&&n===-1?n=a===0?1:0:n>-1&&a===-1?a=n===0?1:0:n===-1&&a===-1&&(a=0,n=1),l=l.filter((x,I)=>!(I===a||I===n));const{referencing:o}=t.domain,c=o.find(x=>x.coordinates.includes(r[a])).system.id,u=c?.slice(c.lastIndexOf("/")+1),f=u==null||u==="CRS84"?4326:Number(u),h=new L({wkid:f}),[m,y]=i[a],[g,p]=i[n],d=new W({xmin:m,xmax:y,ymin:g,ymax:p,spatialReference:h});return{width:Math.round(d.width/s[a]),height:Math.round(d.height/s[n]),extent:d,dimensions:l}}function Fe(t){const e=At();return e?t[e]??Object.values(t)[0]:Object.values(t)[0]}function ke(){return Math.round(255*Math.random())}function ss(t){const e={},{parameters:r}=t;if(!r)return e;for(const[i,s]of Object.entries(r)){const{type:a,description:n,unit:l,categoryEncoding:o,observedProperty:c}=s;if(a==="Parameter"&&(e[i]={},n&&(e[i].description=Fe(n)),l&&(e[i].unit=l.label?Fe(l.label):null,e[i].symbol=l.symbol?.value),o)){const u=Object.entries(o).map((m,y)=>({OID:y,Value:Number(m[1]),ClassName:m[0].slice(m[0].lastIndexOf("/")+1),Count:1}));let f=!1;c?.categories?.length&&(c.categories.forEach(m=>{if(!m.id)return;const y=m.id.slice(m.id.lastIndexOf("/")+1),g=u.find(d=>d.ClassName===y);if(!g)return;const p=m.label?Fe(m.label):null;if(g.Label=p,m.preferredColor){const d=Jt.fromHex(m.preferredColor);d&&(f=!0,g.Red=d.r,g.Green=d.g,g.Blue=d.b)}}),f&&u.forEach(m=>{m.Red==null&&(m.Red=ke(),m.Green=ke(),m.Blue=ke())}));const h={objectIdFieldName:"",fields:[{name:"OID",type:"esriFieldTypeOID",alias:"OID",domain:null},{name:"Value",type:"esriFieldTypeInteger",alias:"Value",domain:null},{name:"Count",type:"esriFieldTypeDouble",alias:"Count",domain:null},{name:"ClassName",type:"esriFieldTypeString",alias:"ClassName",domain:null,length:50},{name:"Label",type:"esriFieldTypeString",alias:"Label",domain:null,length:50}],features:u.map(m=>({attributes:m}))};f&&h.fields.push({name:"Red",type:"esriFieldTypeInteger",alias:"Red",domain:null},{name:"Green",type:"esriFieldTypeInteger",alias:"Green",domain:null},{name:"Blue",type:"esriFieldTypeInteger",alias:"Blue",domain:null}),e[i].attributeTable=h}}return e}function rs(t){let e=Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let i=0;ir&&(r=s))}return Ni(e,r)}function ns(t,e,r){const i=t.map((o,c)=>({name:o,count:e[c]})).sort((o,c)=>o.name>c.name?-1:1),s=(a=1,o=>a*=o.count);var a;const n=[...i.slice(1),{name:"",count:1}].reverse().map(s).reverse();let l=0;for(let o=t.length-1;o>=0;o--)l+=n[i.findIndex(({name:c})=>c===t[o])]*(r%e[o]),r=Math.floor(r/e[o]);return l}function as(t){const{width:e,height:r,extent:i,dimensions:s}=is(t),{ranges:a}=t,n=Object.keys(a).sort((h,m)=>ho[h.name]&&Object.assign(h,o[h.name]));const c=l.length?{variables:l}:void 0,u=[];for(let h=0;h2?h*d.slice(0,-2).reduce((k,_)=>k*_):0,I=p.slice(0,-2),R=d.slice(0,-2),S=g==="float"?"f32":rs(y),T=e*r,v=y.length/T;for(let k=0;kh.attributeTable)?.attributeTable;return{extent:i,pixelBlocks:u,multidimensionalInfo:c,attributeTable:f,bandNames:c?void 0:n}}let oe=class extends ae{constructor(){super(...arguments),this.datasetFormat="MEMORY",this.source=null}get url(){return""}fetchRawTile(t,e,r,i={}){if(!this._pixelBlockTiles){const{rasterInfo:a}=this,[n,l]=a.storageInfo.tileInfo.size,{sliceId:o}=i,{pixelBlocks:c}=this.source,u={pixelBlock:o==null?c[0]:c[o],useBilinear:a.dataType!=="thematic",tileSize:{width:n,height:l},level:t,row:e,col:r},f=this.rasterJobHandler?this.rasterJobHandler.clipTile(u,i):ki(u);return Promise.resolve(f)}const s=this._pixelBlockTiles.get(`${t}/${e}/${r}`);return Promise.resolve(s)}async _open(t){const e=this.source,{pixelBlocks:r,attributeTable:i,statistics:s,histograms:a,name:n,nativeExtent:l,transform:o}=e,c=r[0],{width:u,height:f,pixelType:h}=c,m=e.extent??new W({xmin:-.5,ymin:.5,xmax:u-.5,ymax:f-.5,spatialReference:new L({wkid:3857})}),y=e.isPseudoSpatialReference??!e.extent,g={x:m.width/u,y:m.height/f},p={...e.keyProperties};i&&(p.DataType="Thematic");const d=new ve({width:u,height:f,pixelType:h,extent:m,nativeExtent:l,attributeTable:i,transform:o,pixelSize:g,spatialReference:m.spatialReference,bandCount:c.pixels.length,keyProperties:p,multidimensionalInfo:e.multidimensionalInfo,statistics:s,isPseudoSpatialReference:y,histograms:a});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(d),this.createRemoteDatasetStorageInfo(d,512,512),this._set("rasterInfo",d),this.updateTileInfo(),d.multidimensionalInfo?await this._buildMDimStats(e.pixelBlocks,d.multidimensionalInfo):await this._buildInMemoryRaster(c,{width:512,height:512},t),d.multidimensionalInfo||(this.source=null),this.datasetName=n}async _buildInMemoryRaster(t,e,r){const{rasterInfo:i}=this,s=i.storageInfo.maximumPyramidLevel??0,a=i.dataType!=="thematic",n=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:t,tileSize:e,maximumPyramidLevel:s,useBilinear:a},r):Promise.resolve(Ci(t,e,s,a)),l=i.statistics!=null,o=i.histograms!=null,c=this.ioConfig.skipStatistics||l?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:t},r):Promise.resolve(hi(t)),u=await lt([n,c]);if(!u[0].value&&u[1].value)throw new C("inmemory-raster:open","failed to build in memory raster");this._pixelBlockTiles=u[0].value,l||(i.statistics=u[1].value?.statistics),o||(i.histograms=u[1].value?.histograms)}async _buildMDimStats(t,e,r){for(let i=0;inew Le({variableName:s.name,dimensionName:c.name,values:[c.values?.[0]??c.extent?.[0]],isSlice:!0})),n=mt(a,e),l=n==null?null:t[n];if(l==null)continue;const o=this.rasterJobHandler?await this.rasterJobHandler.computeStatisticsHistograms({pixelBlock:l},r):He(l);s.statistics=o.statistics,s.histograms||(s.histograms=o.histograms)}}};w([b({type:String,json:{write:!0}})],oe.prototype,"datasetFormat",void 0),w([b()],oe.prototype,"source",void 0),w([b()],oe.prototype,"url",null),oe=w([K("esri.layers.support.rasterDatasets.InMemoryRaster")],oe);const $e=oe;let he=class extends ae{constructor(){super(...arguments),this.datasetFormat="CovJSON"}fetchRawTile(t,e,r,i={}){return this._inMemoryRaster.fetchRawTile(t,e,r,i)}async _open(t){const{extent:e,pixelBlocks:r,multidimensionalInfo:i,attributeTable:s,bandNames:a}=await this._fetchData(t),{statistics:n,histograms:l}=He(r[0]),o=a?.map(h=>({BandName:h})),c={DataType:s?"Thematic":i?"Scientific":"Generic",BandProperties:o},u=new $e({source:{extent:e,pixelBlocks:r,attributeTable:s?Ge.fromJSON(s):null,multidimensionalInfo:i,statistics:n,histograms:l,keyProperties:c,isPseudoSpatialReference:!1}});await u.open(),this._inMemoryRaster=u;const f=this.source?"":this.url.slice(this.url.lastIndexOf("/")+1);this._set("datasetName",f.slice(0,f.indexOf("."))),this._set("rasterInfo",u.rasterInfo)}async _fetchData(t){const e=this.source??(await this.request(this.url,{signal:t?.signal})).data,r="imagery-tile-layer:open-coverage-json";if(e.type?.toLowerCase()!=="coverage"||e.domain?.domainType?.toLowerCase()!=="grid")throw new C(r,"Only coverage with Grid domain type is supported");if(!e.ranges)throw new C(r,"Missing ranges in the grid coverage data");if(!e.domain.referencing?.length)throw new C(r,"Missing domain referencing in the grid coverage data");const i=Object.values(e.ranges);for(let s=0;si.push(l));return i}const s=t.getElementsByTagNameNS("*",r);if(!s||s.length===0)return[];for(let a=0;a0?e?q(i[0],e):i[0]:null}function Y(t,e=null){const r=e?q(t,e):t;let i;return r?(i=r.textContent||r.nodeValue,i?i.trim():null):null}function ls(t,e){const r=ue(t,e),i=[];let s;for(let a=0;aNumber(r))}function re(t,e){const r=Y(t,e);return Number(r)}function Ce(t,e){const r=t?.nodeName?.toLowerCase(),i=e.toLowerCase();return r.slice(r.lastIndexOf(":")+1)===i}function nt(t,e){if(!t||!e)return null;const r=[];for(let i=0;iNumber(h));let l,o,c,u;ue(t,"Metadata/MDI").forEach(h=>{const m=Number(h.textContent??h.nodeValue);switch(h.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":l=m;break;case"STATISTICS_MAXIMUM":o=m;break;case"STATISTICS_MEAN":c=m;break;case"STATISTICS_STDDEV":u=m}});const f=re(t,"Metadata/SourceBandIndex");return{noDataValue:e,histogram:n?.length&&i!=null&&s!=null?{min:i,max:s,size:a||n.length,counts:n}:null,sourceBandIndex:f,statistics:l!=null&&o!=null?{min:l,max:o,avg:c,stddev:u}:null}}function Se(t){if(!t)return null;let e=Number(t);if(!isNaN(e)&&e!==0)return new L({wkid:e});if(t=String(t).trim(),Bt(t))return new L({wkt2:t});const r=t.toUpperCase();if(r.startsWith("COMPD_CS")){if(!r.includes("VERTCS")||!r.includes("GEOGCS")&&!r.startsWith("PROJCS"))return null;const i=r.indexOf("VERTCS"),s=r.indexOf("PROJCS"),a=s>-1?s:r.indexOf("GEOGCS");if(a===-1)return null;const n=t.slice(a,t.lastIndexOf("]",i)+1).trim(),l=t.slice(i,t.lastIndexOf("]")).trim();e=Oe(n);const o=new L(e?{wkid:e}:{wkt:n}),c=Oe(l);return c&&(o.vcsWkid=c),o}return r.startsWith("GEOGCS")||r.startsWith("PROJCS")?(e=Oe(t),new L(e!==0?{wkid:e}:{wkt:t})):null}function Oe(t){const e=t.replaceAll("]","[").replaceAll('"',"").split("[").map(s=>s.trim()).filter(s=>s!==""),r=e[e.length-1].split(","),i=r[0]?.toLowerCase();if((i==="epsg"||i==="esri")&&t.endsWith('"]]')){const s=Number(r[1]);if(!isNaN(s)&&s!==0)return s}return 0}function qe(t){if(t?.documentElement.tagName?.toLowerCase()!=="pamdataset")return{};const e={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};t.documentElement.childNodes.forEach(i=>{if(i.nodeType===1){if(Ce(i,"SRS")){if(!e.spatialReference){const s=Y(i);e.spatialReference=Se(s)}}else if(Ce(i,"Metadata"))if(i.getAttribute("domain")==="xml:ESRI"){const{spatialReference:s,transform:a}=cs(i);e.transform=a,e.spatialReference||(e.spatialReference=s)}else ue(i,"MDI").forEach(s=>e.metadata[s.getAttribute("key")]=Y(s));else if(Ce(i,"PAMRasterBand")){const s=us(i);s.sourceBandIndex!=null&&e.rasterBands[s.sourceBandIndex]==null?e.rasterBands[s.sourceBandIndex]=s:e.rasterBands.push(s)}}});const r=e.rasterBands;if(r.length){const i=!!r[0].statistics;e.statistics=i?r.map(a=>a.statistics).filter(Me):null;const s=!!r[0].histogram;e.histograms=s?r.map(a=>a.histogram).filter(Me):null}return e}let be=class extends ae{fetchRawTile(t,e,r,i={}){return this._inMemoryRaster.fetchRawTile(t,e,r,i)}async _open(t){const e=await this._fetchData(t);let{spatialReference:r,statistics:i,histograms:s,transform:a}=await this._fetchAuxiliaryData(t);const n=!r;n&&(r=new L({wkid:3857})),s?.length&&i==null&&(i=ze(s));const{width:l,height:o}=e;let c=new W({xmin:-.5,ymin:.5-o,xmax:l-.5,ymax:.5,spatialReference:r});const u=a?a.forwardTransform(c):c;let f=!0;if(a){const m=a.forwardCoefficients;f=m&&m[1]===0&&m[2]===0,f&&(a=null,c=u)}const h=new $e({source:{extent:u,nativeExtent:c,transform:a,pixelBlocks:[e],statistics:i,histograms:s,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:n},ioConfig:{sampling:"closest",skipStatistics:!0}});this.ioConfig.skipMapInfo&&(h.ioConfig.skipMapInfo=!0),await h.open(),h.source=null,this._set("rasterInfo",h.rasterInfo),this._inMemoryRaster=h}async _fetchData(t){const{data:e}=await this.request(this.url,{responseType:"array-buffer",signal:t?.signal}),r=mi(e).toUpperCase();if(r!=="JPG"&&r!=="PNG"&&r!=="GIF"&&r!=="BMP")throw new C("image-aux-raster:open","the data is not a supported format");this._set("datasetFormat",r);const i=r.toLowerCase(),s=i==="gif"||i==="bmp"||!Ot("ios"),a=await this.decodePixelBlock(e,{format:i,useCanvas:s,hasNoZlibMask:!0});if(a==null)throw new C("image-aux-raster:open","the data cannot be decoded");return a}async _fetchAuxiliaryData(t){const e=t?.signal,{skipExtensions:r=[],skipMapInfo:i}=this.ioConfig,s=i||r.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:e}),a=this.datasetFormat,n=a==="JPG"?"jgw":a==="PNG"?"pgw":a==="BMP"?"bpw":null,l=n&&r.includes(n)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+n,{responseType:"text",signal:e}),o=await lt([s,l]);if(e?.aborted)throw Pt();const c=qe(o[0].value?.data);if(!c.transform){const u=o[1].value?o[1].value.data.split(`
-`).slice(0,6).map(f=>Number(f)):null;c.transform=u?.length===6?new We({forwardCoefficients:[u[4],u[5],u[0],-u[1],u[2],-u[3]]}):null}return c}};w([b({type:String,json:{write:!0}})],be.prototype,"datasetFormat",void 0),be=w([K("esri.layers.support.rasterDatasets.ImageAuxRaster")],be);const xe=be;let me=class extends ae{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async fetchRawTile(t,e,r,i={}){const{storageInfo:s,extent:a}=this.rasterInfo,{transposeInfo:n}=s,l=n!=null&&!!i.transposedVariableName;if(this._slices&&!l&&i.sliceId==null)return null;const o=l?0:s.maximumPyramidLevel-t+this._levelOffset,c=`${this.url}/tile/${o}/${e}/${r}`,u=this._slices?l?{variable:i.transposedVariableName}:{sliceId:i.sliceId||0}:null,{data:f}=await this.request(c,{query:u,responseType:"array-buffer",signal:i.signal});if(!f)return null;const h=l?n.tileSize:s.tileInfo.size,m=await this.decodePixelBlock(f,{width:h[0],height:h[1],planes:null,pixelType:null,isPoint:this.tileType==="Elevation",returnInterleaved:l,noDataValue:this.rasterInfo.noDataValue});if(m==null)return null;const y=s.blockBoundary[t];if(s.compression!=="jpg"||r>y.minCol&&ry.minRow&&e{const a=e.find(n=>s.variableName===n.variableName&&n.dimensionName===s.dimensionName);return a?(Array.isArray(s.values[0])?`${s.values[0][0]}-${s.values[0][1]}`:s.values[0])!==(Array.isArray(a.values[0])?`${a.values[0][0]}-${a.values[0][1]}`:a.values[0]):!0}))return r}return null}async fetchVariableStatisticsHistograms(t,e){const r=this.request(this.url+"/statistics",{query:{variable:t,f:"json"},signal:e}).then(a=>a.data?.statistics),i=this.request(this.url+"/histograms",{query:{variable:t,f:"json"},signal:e}).then(a=>a.data?.histograms),s=await Promise.all([r,i]);return s[0]&&s[0].forEach(a=>{a.avg=a.mean,a.stddev=a.standardDeviation}),s[1]?.[0]?.counts?.length||(s[1]=null),{statistics:s[0]||null,histograms:s[1]||null}}async computeBestPyramidLevelForLocation(t,e={}){if(!this._tilemapCache)return 0;let r=this.identifyPixelLocation(t,0,e.datumTransformation);if(r===null)return null;let i=0;const{maximumPyramidLevel:s}=this.rasterInfo.storageInfo;let a=s-i+this._levelOffset;const n=r.srcLocation;for(;a>=0;){try{if(await this._tilemapCache.fetchAvailability(a,r.row,r.col,e)==="available")break}catch{}if(a--,i++,r=this.identifyPixelLocation(n,i,e.datumTransformation),r===null)return null}return a===-1||r==null?null:i}async _open(t){const e=t?.signal,r=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:e});r.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const i=r.data;if(this.sourceJSON=i,!i)throw new C("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!i.tileInfo)throw new C("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();const s=["jpg","jpeg","png","png8","png24","png32","mixed"];this.tileType=i.cacheType,this.tileType==null&&(s.includes(i.tileInfo.format.toLowerCase())?this.tileType="Map":i.tileInfo.format.toLowerCase()==="lerc"?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=i.name?.slice(i.name.indexOf("/")+1)??"";const a=await this._fetchRasterInfo({signal:e});if(a==null)throw new C("image-server-raster:open","cannot initialize image service");Yt(a,i);const n=this.tileType==="Map"?hs(i.tileInfo,i):ee.fromJSON(i.tileInfo);Mt(n);const[l,o]=this._computeMinMaxLOD(a,n),{extent:c,pixelSize:u}=a,f=.5/a.width*u.x,h=Math.max(u.x,u.y),{lods:m}=n;(this.tileType!=="Map"&&i.maxScale!==0||Math.abs(u.x-u.y)>f||!m.some(v=>Math.abs(v.resolution-h){v.level>=o.level&&v.level<=l.level&&d.push({x:v.resolution,y:v.resolution}),kv.x-k.x);const I=this.computeBlockBoundary(c,g,p,n.origin,d,y),R=d.length>1?d.slice(1):null;let S;i.transposeInfo&&(S={tileSize:[i.transposeInfo.rows,i.transposeInfo.cols],packetSize:a.keyProperties?._yxs.PacketSize??0});const T=x.length<=1||x.length>=3&&x.slice(0,-1).every(v=>v===x[0])?x[0]??2:Math.round(10/(o.resolution/l.resolution)**(-1/y))/10;if(a.storageInfo=new Re({blockWidth:n.size[0],blockHeight:n.size[1],pyramidBlockWidth:n.size[0],pyramidBlockHeight:n.size[1],pyramidResolutions:R,pyramidScalingFactor:T,compression:n.format,origin:n.origin,firstPyramidLevel:1,maximumPyramidLevel:y,tileInfo:n,transposeInfo:S,blockBoundary:I}),ms(a),this._set("rasterInfo",a),i.capabilities.toLowerCase().includes("tilemap")){const v={tileInfo:a.storageInfo.tileInfo,parsedUrl:Nt(this.url),url:this.url,tileServers:[]};this._tilemapCache=new ji({layer:v})}}async _fetchRasterInfo(t){const e=this.sourceJSON;if(this.tileType==="Map"){const n=e.fullExtent||e.extent,l=Math.ceil((n.xmax-n.xmin)/e.pixelSizeX-.1),o=Math.ceil((n.ymax-n.ymin)/e.pixelSizeY-.1),c=L.fromJSON(e.spatialReference||n.spatialReference),u=new A({x:e.pixelSizeX,y:e.pixelSizeY,spatialReference:c});return new ve({width:l,height:o,bandCount:3,extent:W.fromJSON(n),spatialReference:c,pixelSize:u,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}const{signal:r}=t,i=Kt(this.url,this.sourceJSON,{signal:r,query:this.ioConfig.customFetchParameters}),s=e.hasMultidimensions?this.request(`${this.url}/slices`,{query:{f:"json"},signal:r}).then(n=>n.data?.slices).catch(()=>null):null,a=await Promise.all([i,s]);return this._slices=a[1],a[0]}_fixScaleInServiceInfo(){const{sourceJSON:t}=this;t.minScale&&t.minScale<0&&(t.minScale=0),t.maxScale&&t.maxScale<0&&(t.maxScale=0)}_computeMinMaxLOD(t,e){const{pixelSize:r}=t,i=.5/t.width*r.x,{lods:s}=e,a=e.lodAt(Math.max.apply(null,s.map(h=>h.level))),n=e.lodAt(Math.min.apply(null,s.map(h=>h.level))),{tileType:l}=this;if(l==="Map")return this._levelOffset=s[0].level,[a,n];if(l==="Raster")return[s.find(h=>h.resolution===r.x)??a,n];const{minScale:o,maxScale:c}=this.sourceJSON;let u=a;c>0&&(u=s.find(h=>Math.abs(h.scale-c)h.scale>c).sort((h,m)=>h.scale>m.scale?1:-1)[0]??a));let f=n;return o>0&&(f=s.find(h=>Math.abs(h.scale-o)n!=null&&n>=s&&n<=a)});if(r!==0&&i!==0){const n=c=>Math.round(1e4*c)/1e4,l=r?n(r):1/0,o=i?n(i):-1/0;return ee.fromJSON({...t,lods:t.lods.filter(c=>{const u=n(c.scale);return u<=l&&u>=o})})}return ee.fromJSON(t)}function ms(t){const{extent:e,spatialReference:r}=t;e.xmin>-1&&e.xmax>181&&r?.wkid&&r.isGeographic&&(t.nativeExtent=t.extent,t.transform=new Hi,t.extent=t.transform.forwardTransform(e))}w([b({type:String,json:{write:!0}})],me.prototype,"datasetFormat",void 0),w([b()],me.prototype,"tileType",void 0),me=w([K("esri.layers.support.rasterDatasets.ImageServerRaster")],me);const fs=me,U=new Map;U.set("Int8","s8"),U.set("UInt8","u8"),U.set("Int16","s16"),U.set("UInt16","u16"),U.set("Int32","s32"),U.set("UInt32","u32"),U.set("Float32","f32"),U.set("Float64","f32"),U.set("Double64","f32");const Z=new Map;Z.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),Z.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),Z.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),Z.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"});let le=class extends ae{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this.datasetFormat="MRF"}async fetchRawTile(t,e,r,i={}){const{blockWidth:s,blockHeight:a,blockBoundary:n}=this.rasterInfo.storageInfo,l=n[t];if(!l||l.maxRowe||l.minCol>r)return null;const{bandCount:o,pixelType:c}=this.rasterInfo,{ranges:u,actualTileWidth:f,actualTileHeight:h}=this._getTileLocation(t,e,r);if(!u||u.length===0)return null;if(u[0].from===0&&u[0].to===0){const F=new Uint8Array(s*a);return new we({width:s,height:a,pixels:void 0,mask:F,validPixelCount:0})}const{bandIds:m}=this.ioConfig,y=this._getBandSegmentCount(),g=[];let p=0;for(p=0;pF.data.byteLength).reduce((F,M)=>F+M),I=new Uint8Array(x),R=[];let S=0;for(p=0;p