@arcgis/core 5.2.0-next.97 → 5.2.0-next.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{1201bb22a2bfd7d7ecba.js → 3c0421a4a0ee3a3c63f8.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{d453627894e6e5b02023.js → 53a6bfebf3904dd7cad9.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{ca8061e0a6d78d646ebf.js → 89234e3c7917f1befe10.js} +1 -1
  5. package/assets/esri/core/workers/chunks/8f53053d26210837ec34.js +1 -0
  6. package/assets/esri/core/workers/chunks/{6ceb17eada151230abf7.js → a88aa26a7bee1fe7aea2.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{5d6733dcee9c2ef00072.js → c511af7afe08a78e2a4d.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{6319413b89e23f671487.js → cf49a13522d61da31d8f.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{5d7625eb9997cd0dff09.js → d785434bbeab89cd64ba.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{471027e4280bd51167b0.js → eb222dc01344ed07719e.js} +1 -1
  11. package/assets/esri/core/workers/chunks/efdb0bcdb8d547868ecb.js +1 -0
  12. package/assets/esri/core/workers/chunks/{374d726fdd0a9848cea5.js → f2cbcd1b0e77e733a8e0.js} +1 -1
  13. package/assets/esri/libs/librust-parquet/pkg/bundle_bg.wasm +0 -0
  14. package/chunks/bundle.js +1 -1
  15. package/config.js +1 -1
  16. package/kernel.js +1 -1
  17. package/layers/graphics/sources/parquet/FileProvider.js +1 -1
  18. package/layers/graphics/sources/parquet/ParquetFileInfo.js +1 -1
  19. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  20. package/layers/parquet.js +2 -0
  21. package/libs/{parquet → librust-parquet}/loadParquetModule.js +1 -1
  22. package/libs/{text → librust-text}/loadTextModule.js +1 -1
  23. package/package.json +2 -2
  24. package/support/revision.js +1 -1
  25. package/views/2d/engine/webgl/GlyphWorker.js +1 -1
  26. package/views/2d/layers/features/sources/strategies/ParquetSnapshotLoadStrategy.js +1 -1
  27. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  28. package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
  29. package/assets/esri/core/workers/chunks/6cc03ef97d7731153b9a.js +0 -1
  30. package/assets/esri/core/workers/chunks/93a7cf23f73b23fc7802.js +0 -1
  31. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  32. package/libs/parquet/parquet.js +0 -2
  33. /package/assets/esri/libs/{text → librust-text}/pkg/bundle_bg.wasm +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5471,9397],{66344(t,e,s){s.d(e,{q:()=>o});const i=!!(0,s(44208).A)("esri-tests-disable-gpu-memory-measurements");Symbol.iterator;class r{get size(){return this._size}constructor(t=10485760,e=.3){this._maxSize=t,this._maxClientSizeRatio=e,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._clients=new Map,this._sizeLimits=new Map}destroy(){this.clearAll(),this._sizeLimits.clear(),this._clients.clear(),this._db.clear()}register(t){this._clients.set(t.id.slice(0,-1),t)}deregister(t){this.clear(t),this._sizeLimits.delete(t),this._clients.delete(t.id.slice(0,-1))}get maxSize(){return this._maxSize}set maxSize(t){this._maxSize=Math.max(t,-1),this._checkSize()}get _maxClientSize(){return this._maxSize*this._maxClientSizeRatio}getSize(t,e){const s=this._db.get(t.id+e);return s?.size??0}put(t,e,s,r,a){e=t.id+e;const o=this._db.get(e);if(o&&(this._size-=o.size,t.size-=o.size,this._db.delete(e),o.entry!==s&&this._notifyRemove(e,o.entry,o.size,0)),r>this._maxSize)return void this._notifyRemove(e,s,r,0);if(void 0===s)return void console.warn("Refusing to cache undefined entry ");if(!r||r<0)return i||console.warn(`Refusing to cache entry with size ${r} for key ${e}`),void this._notifyRemove(e,s,0,0);const u=1+Math.max(a,-4)- -3;this._db.set(e,new n(s,r,u)),this._size+=r,t.size+=r,this._checkSize()}updateSize(t,e){e=t.id+e;const s=this._db.get(e);if(!s)return;this._size-=s.size,t.size-=s.size;let i=s.entry.usedMemory;for(;i>this._maxSize;){const t=this._notifyRemove(e,s.entry,i,1);if(!(null!=t&&t>0))return void this._db.delete(e);i=t}s.size=i,this._size+=i,t.size+=i,this._checkSize()}pop(t,e){e=t.id+e;const s=this._db.get(e);if(s)return this._size-=s.size,t.size-=s.size,this._db.delete(e),++this._hit,s.entry;++this._miss}get(t,e){e=t.id+e;const s=this._db.get(e);if(void 0!==s)return this._db.delete(e),s.lives=s.lifetime,this._db.set(e,s),++this._hit,s.entry;++this._miss}peek(t,e){const s=this._db.get(t.id+e);return s?++this._hit:++this._miss,s?.entry}get performanceInfo(){const t={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},e={},s=new Array;this._db.forEach((t,i)=>{const r=t.lifetime;s[r]=(s[r]||0)+t.size,this._clients.forEach(s=>{const{id:r,name:n}=s;if(i.startsWith(r)){const s=e[n]||0;e[n]=s+t.size}})});const i={};this._clients.forEach(t=>{const s=t.name;if("hitRate"in t&&"number"==typeof t.hitRate&&!isNaN(t.hitRate)&&t.hitRate>0){const r=e[s]||0;e[s]=r,i[s]=Math.round(100*t.hitRate)+"%"}else i[s]="0%"});const r=Object.keys(e);r.sort((t,s)=>e[s]-e[t]),r.forEach(s=>t[s]=Math.round(e[s]/2**20)+"MB / "+i[s]);for(let e=s.length-1;e>=0;--e){const i=s[e];i&&(t["Priority "+(e+-3-1)]=Math.round(i/this._size*100)+"%")}return t}resetStats(){this._hit=this._miss=0,this._clients.forEach(t=>t.resetHitRate())}clear(t){const e=t.id;this._db.forEach((t,s)=>{s.startsWith(e)&&(this._size-=t.size,this._db.delete(s),this._notifyRemove(s,t.entry,t.size,0))}),t.size=0}clearAll(){this._db.forEach((t,e)=>this._notifyRemove(e,t.entry,t.size,0)),this._clients.forEach(t=>t.size=0),this._size=0,this._db.clear()}*values(t){for(const[e,s]of this._db)e.startsWith(t.id)&&(yield s.entry)}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(t,e,s,i){const r=this._clients.get(t.split(a)[0])?.removeFunc,n=r?.(e,i,s);return"number"==typeof n?n:null}_checkSize(){this._sizeLimits.forEach((t,e)=>this._checkSizeLimits(t,e)),this._clients.forEach(t=>this._checkSizeLimits(this._maxClientSize,t)),this._checkSizeLimits(this.maxSize)}setMaxClientSize(t,e){null==e||e<=0?this._sizeLimits.delete(t):this._sizeLimits.set(t,e)}_checkSizeLimits(t,e){const s=e??this;if(s.size<=t)return;const i=e?.id;let r=!0;for(;r;){r=!1;for(const[n,o]of this._db)if(0===o.lifetime&&(!i||n.startsWith(i))){const i=e??this._clients.get(n.split(a)[0]);if(this._purgeItem(n,o,i),s.size<=.9*t)return;r||=this._db.has(n)}}for(const[r,n]of this._db)if(!i||r.startsWith(i)){const i=e??this._clients.get(r.split(a)[0]);if(this._purgeItem(r,n,i),s.size<=.9*t)return}}_purgeItem(t,e,s){if(this._db.delete(t),e.lives<=1){this._size-=e.size,s&&(s.size-=e.size);const i=this._notifyRemove(t,e.entry,e.size,1);null!=i&&i>0&&(this._size+=i,s&&(s.size+=i),e.lives=e.lifetime,e.size=i,this._db.set(t,e))}else--e.lives,this._db.set(t,e)}}new r(0);class n{constructor(t,e,s){this.entry=t,this.size=e,this.lifetime=s,this.lives=s}}const a=":";class o{constructor(t,e){this.removeFunc=e,this.id="",this.name="",this.size=0,this._storage=new r(t,1),this._storage.register(this)}destroy(){this._storage.deregister(this),this._storage.destroy()}put(t,e,s=1){this._storage.put(this,t,e,s,1)}pop(t){return this._storage.pop(this,t)}get(t){return this._storage.get(this,t)}clear(){this._storage.clearAll()}get maxSize(){return this._storage.maxSize}set maxSize(t){this._storage.maxSize=t}resetHitRate(){}}},9775(t,e,s){s.d(e,{A:()=>n});var i=s(62788),r=s(95488);class n{constructor(t=t=>t.values().next().value){this._peeker=t,this._observable=new r.I,this._items=new Set}get length(){return(0,i.gc)(this._observable),this._items.size}clear(){0!==this.length&&(this._items.clear(),this._observable.notify())}last(){if(0===this.length)return;let t;for(t of this._items);return t}peek(){if(0!==this.length)return this._peeker(this._items)}push(t){this.contains(t)||(this._items.add(t),this._observable.notify())}contains(t){return(0,i.gc)(this._observable),this._items.has(t)}pop(){if(0===this.length)return;const t=this.peek();return this._items.delete(t),this._observable.notify(),t}popLast(){if(0===this.length)return;const t=this.last();return this._items.delete(t),this._observable.notify(),t}remove(t){this.contains(t)&&(this._items.delete(t),this._observable.notify())}filter(t){const e=this.length;return this._items.forEach(e=>{t(e)||this._items.delete(e)}),e!==this._items.size&&this._observable.notify(),this}*[Symbol.iterator](){(0,i.gc)(this._observable),yield*this._items}}},69397(t,e,s){s.d(e,{Qf:()=>o,Qh:()=>n,lM:()=>r});var i=s(34275);function r(t){if(!t)return 0;let e=l;for(const s in t)t.hasOwnProperty(s)&&(e+=a(t[s],!1));return e}function n(t){if(!t)return 0;if("number"==typeof t[0])return o(t);if(Array.isArray(t))return function(t){const e=t.length;if(0===e||"number"==typeof t[0])return u(t,8);let s=h;for(let i=0;i<e;i++)s+=a(t[i]);return s}(t);let e=l;for(const s in t)t.hasOwnProperty(s)&&(e+=a(t[s]));return e}function a(t,e=!0){switch(typeof t){case"object":return e?n(t):l;case"string":return function(t){return 32+t.length}(t);case"number":return 16;case"boolean":return 4;default:return 8}}function o(...t){return t.reduce((t,e)=>t+(e?(0,i.iu)(e)?e.byteLength+c:Array.isArray(e)?u(e,16):0:0),0)}function u(t,e){return h+t.length*e}const l=32,h=16,c=145},36745(t,e,s){s.d(e,{z:()=>o});var i=s(4718),r=s(51118),n=s(60408),a=s(92722);class o{static fromOptimized(t,e,s=1){return(new u).initialize(t,e,s)}static fromJSON(t){const[e,s]=h(t),i=(0,n.Pv)(t),r=(0,n.W0)(t);return(new c).initialize(e,s,i,r,1)}static fromOptimizedCIM(t,e,s=1){return(new d).initialize(t,e,s)}static fromJSONCIM(t,e=1){const[s,i]=h(t),r=(0,n.Pv)(t),a=(0,n.W0)(t);return(new p).initialize(s,i,r,a,e)}static fromFeatureSetReader(t){const e=t.readGeometryForDisplay(),s=t.geometryType;return e&&s?this.fromOptimized(e,s):null}static fromFeatureSetReaderCIM(t){const e=t.readGeometryForDisplay(),s=t.geometryType;return e&&s?this.fromOptimizedCIM(e,s):null}static createEmptyOptimized(t,e=!1,s=!1,i=1){return(new d).initialize(new a.A([],[],e,s),t,i)}static createEmptyJSON(t,e=!1,s=!1){return(new c).initialize([],t,e,s,1)}static createEmptyOptimizedCIM(t,e=!1,s=!1,i=1){return(new d).initialize(new a.A([],[],e,s),t,i)}static createEmptyJSONCIM(t,e=!1,s=!1,i=1){return(new p).initialize([],t,e,s,i)}asJSON(){const t=(0,r.x)(this),{hasZ:e,hasM:s}=this;return"esriGeometryEnvelope"===this.geometryType?{xmin:t[0][0][0],ymin:t[0][0][1],xmax:t[0][2][0],ymax:t[0][2][1]}:"esriGeometryMultipoint"===this.geometryType?{points:t.flat(),hasZ:e,hasM:s}:"esriGeometryPoint"===this.geometryType?{x:t[0][0][0],y:t[0][0][1],z:e?t[0][0][2]:void 0,m:s?t[0][0][e?3:2]:void 0}:"esriGeometryPolygon"===this.geometryType?{rings:t,hasZ:e,hasM:s}:{paths:t,hasZ:e,hasM:s}}getCurrentRingArea(){if(this.pathSize<3)return 0;let t,e,s=0;if(this.seekPathStart(),!this.nextPoint())return 0;t=this.x,e=this.y;const i=t,r=e;for(;this.nextPoint();)s+=(t-this.x)*(e+this.y),t=this.x,e=this.y;return s+=(t-i)*(e+r),-.5*s}invertY(){this.yFactor*=-1}}class u extends o{constructor(){super(...arguments),this._end=-1}get hasZ(){return this._geometry?.hasZ}get hasM(){return this._geometry?.hasM}initialize(t,e,s){return this.geometryType=e,this._stride=t.stride,this._geometry=t,this._pathIndex=-1,this._pathOffset=0,this._pointOffset=-this._stride,this._end=-1,this.yFactor=s,this}reset(){this.initialize(this._geometry,this.geometryType,this.yFactor)}seekPath(t){if(t>=0&&t<this.totalSize){if(this._pathIndex<t)for(;this._pathIndex<t&&this.nextPath(););else if(this._pathIndex>t)for(;this._pathIndex>t&&this.prevPath(););return!0}return!1}seekPathStart(){this._pointOffset=this._pathOffset-this._stride}seekPathEnd(){this._pointOffset=this._end}seekInPath(t){const e=this._pathOffset+t*this._stride;return e>=0&&e<this._end&&(this._pointOffset=e,!0)}nextPoint(){return(this._pointOffset+=this._stride)<this._end}prevPoint(){return(this._pointOffset-=this._stride)>=this._pathOffset}nextPath(){return!(this.pathIndex>=this.totalSize-1||(this._pathIndex>=0&&(this._pathOffset+=this._stride*this.pathSize),this._pathIndex++,this._pointOffset=this._pathOffset-this._stride,this._end=this._pointOffset+this._stride+this._stride*this.pathSize,0))}prevPath(){return!(this.pathIndex<=0||(this._pathIndex--,this._end=this._pathOffset,this._pathOffset-=this._stride*this.pathSize,this._pointOffset=this._pathOffset-this._stride,0))}getCurrentPath(){const t=this._end,e=this._geometry.coords,s=this._pathOffset;return(new u).initialize(new a.A([this.pathSize],e.slice(s,t),this.hasZ,this.hasM),this.geometryType,this.yFactor)}pathLength(){const t=this._end,e=this._stride,s=this._geometry.coords;let i=0;for(let r=this._pathOffset+e;r<t;r+=e){const t=s[r-e],n=s[r-e+1],a=s[r]-t,o=s[r+1]-n;i+=Math.sqrt(a*a+o*o)}return i}startPath(){this._geometry.lengths.push(0)}pushPath(t){this.startPath(),this.pushPoints(t)}pushPoint(t){for(let e=0;e<this._stride;++e)this._geometry.coords.push(t[e]);this._geometry.lengths[this.totalSize-1]++}pushXY(t,e){this._geometry.coords.push(t,e),this._geometry.lengths[this.totalSize-1]++}pushPoints(t){for(const e of t)for(let t=0;t<this._stride;++t)this._geometry.coords.push(e[t]);this._geometry.lengths[this.totalSize-1]+=t.length}pushCursor(t){const e=t.asOptimized();this._geometry.coords.push(...e.coords),this._geometry.lengths.push(...e.lengths)}asOptimized(){const t=this._geometry.clone();if(1!==this.yFactor)for(let e=1;e<t.coords.length;e+=this._stride)t.coords[e]*=this.yFactor;return"esriGeometryPoint"===this.geometryType&&(t.lengths.length=0),t}isClosed(){const t=this._geometry.coords,e=this._pathOffset,s=this._end-this._stride;for(let i=0;i<this._stride;i++)if(t[e+i]!==t[s+i])return!1;return!0}clone(){return(new u).initialize(this._geometry.clone(),this.geometryType,this.yFactor)}get totalPoints(){return this._geometry.isPoint?1:this._geometry.lengths.reduce((t,e)=>t+e)}get pathSize(){const{lengths:t}=this._geometry;return this._geometry.isPoint?1:this._pathIndex<0||this._pathIndex>t.length-1?0:t[this._pathIndex]}get totalSize(){return this._geometry.isPoint?1:this._geometry.lengths.length}get x(){return this._geometry.coords[this._pointOffset]}set x(t){this._geometry.coords[this._pointOffset]=t}get y(){return this.yFactor*this._geometry.coords[this._pointOffset+1]}set y(t){this._geometry.coords[this._pointOffset+1]=this.yFactor*t}get z(){return this._geometry.coords[this._pointOffset+2]}set z(t){this._geometry.coords[this._pointOffset+2]=t}get m(){const t=this.hasZ?3:2;return this._geometry.coords[this._pointOffset+t]}set m(t){this._geometry.coords[this._pointOffset+3]=t}get pathIndex(){return this._pathIndex}get _coordIndex(){return this._pointOffset/this._stride}}function l(t){const e=[t.x,t.y];return t.z&&e.push(t.z),t.m&&e.push(t.m),e}function h(t){return(0,n.Bi)(t)?[t.rings,"esriGeometryPolygon"]:(0,n.Rg)(t)?[t.paths,"esriGeometryPolyline"]:(0,n.U9)(t)?[[t.points],"esriGeometryMultipoint"]:(0,n.ZC)(t)?[[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]],"esriGeometryEnvelope"]:(0,n.fT)(t)?[[[l(t)]],"esriGeometryPoint"]:[[],"esriGeometryPolyline"]}class c extends o{initialize(t,e,s,i,r){return this._paths=t,this.geometryType=e,this.hasZ=s,this.hasM=i,this._pathIndex=this._pointIndex=-1,this.yFactor=r,this._mIndex=this.hasZ?3:2,this}reset(){this._pathIndex=this._pointIndex=-1}seekPath(t){return this._pathIndex=t,this._pointIndex=-1,t>=0&&t<this.totalSize&&(this._currentPath=this._paths[t],!0)}seekPathStart(){this._pointIndex=-1}seekPathEnd(){this._pointIndex=this._currentPath.length}seekInPath(t){return t>=0&&t<this._currentPath.length&&(this._pointIndex=t,this._currentPoint=this._currentPath[this._pointIndex],!0)}nextPoint(){return this._currentPoint=this._currentPath[++this._pointIndex],this._pointIndex<this._currentPath.length}prevPoint(){return this._currentPoint=this._currentPath[--this._pointIndex],this._pointIndex>=0}nextPath(){return this._pointIndex=-1,this._currentPath=this._paths[++this._pathIndex],this._pathIndex<this.totalSize}prevPath(){return this.pathIndex>0&&(this._pointIndex=-1,this._pathIndex--,this._currentPath=this._paths[this._pathIndex],!0)}pathLength(){const t=this._currentPath.length,e=this._currentPath;let s=0;for(let i=1;i<t;i++){const t=e[i-1],r=e[i],n=t[0],a=t[1],o=r[0]-n,u=r[1]-a;s+=Math.sqrt(o*o+u*u)}return s}startPath(){this._paths.push([])}getCurrentPath(){return(new c).initialize([this._currentPath],this.geometryType,this.hasZ,this.hasM,this.yFactor)}pushPath(t){this._paths.push(t)}pushPoint(t){this._paths[this.totalSize-1].push(t)}pushXY(t,e){this._paths[this.totalSize-1].push([t,e])}pushPoints(t){this._paths[this.totalSize-1].push(...t)}pushCursor(t){const e=(0,r.x)(t);for(const t of e)this.pushPath(t)}asOptimized(){const{hasZ:t,hasM:e}=this,s=new a.A([],[],t,e),{coords:i,lengths:r}=s;if("esriGeometryPoint"===this.geometryType)i.push(...this._paths[0][0]),r.length=0;else for(const s of this._paths){for(const r of s)i.push(r[0]),i.push(r[1]*this.yFactor),t&&i.push(r[2]),e&&i.push(r[this._mIndex]);r.push(s.length)}return s}isClosed(){const t=this._currentPath[0],e=this._currentPath[this._currentPath.length-1];for(let s=0;s<t.length;s++)if(t[s]!==e[s])return!1;return!0}clone(){return(new c).initialize((0,i.o8)(this._paths),this.geometryType,this.hasZ,this.hasM,this.yFactor)}get totalPoints(){return this._paths.map(t=>t.length).reduce((t,e)=>t+e)}get pathSize(){return this._pathIndex<0||this._pathIndex>this.totalSize-1?-1:this._paths[this._pathIndex].length}get totalSize(){return this._paths.length}get x(){return this._currentPoint[0]}set x(t){this._currentPoint[0]=t}get y(){return this.yFactor*this._currentPoint[1]}set y(t){this._currentPoint[1]=this.yFactor*t}get z(){return this._currentPoint[2]}set z(t){this._currentPoint[2]=t}get m(){return this._currentPoint[this._mIndex]}set m(t){this._currentPoint[this._mIndex]=t}get pathIndex(){return this._pathIndex}}class d extends u{initialize(t,e,s){return super.initialize(t,e,s),this._controlPoints||(this._controlPoints=this._controlPoints=new Array(this.totalSize).fill(void 0).map(t=>new Set)),this}startPath(){super.startPath(),this._controlPoints.push(new Set)}clone(){const t=(new d).initialize(this._geometry.clone(),this.geometryType,this.yFactor);return t._controlPoints=this._controlPoints,t}setControlPoint(){this._controlPoints[this.pathIndex].add(this._coordIndex)}getControlPoint(){return this._controlPoints[this.pathIndex].has(this._coordIndex)}setControlPointAt(t){this._controlPoints[this.pathIndex].add(t)}getControlPointAt(t){return this._controlPoints[this.pathIndex].has(t)}}class p extends c{initialize(t,e,s,i,r){return super.initialize(t,e,s,i,r)}clone(){return(new p).initialize((0,i.o8)(this._paths),this.geometryType,this.hasZ,this.hasM,this.yFactor)}setControlPoint(){this._paths[this.pathIndex][this._pointIndex][4]=1}getControlPoint(){return 1===this._paths[this.pathIndex][this._pointIndex][4]}setControlPointAt(t){this._paths[this.pathIndex][t][4]=1}getControlPointAt(t){return 1===this._paths[this.pathIndex][t][4]}}},65864(t,e,s){s.d(e,{rS:()=>h,xD:()=>d});var i=s(5443),r=s(91075),n=s(48526),a=s(86738),o=s(39829),u=s(82799),l=s(60408);function h(t){return null==t?null:t instanceof r.A?t:(0,l.fT)(t)?a.A.fromJSON(t):(0,l.Rg)(t)?u.A.fromJSON(t):(0,l.Bi)(t)?o.A.fromJSON(t):(0,l.U9)(t)?n.A.fromJSON(t):(0,l.ZC)(t)?i.A.fromJSON(t):null}const c={esriGeometryPoint:a.A,esriGeometryPolyline:u.A,esriGeometryPolygon:o.A,esriGeometryEnvelope:i.A,esriGeometryMultipoint:n.A,esriGeometryMultiPatch:o.A};function d(t){return t&&c[t]||null}},78957(t,e,s){s.d(e,{d:()=>h,R:()=>F});class i{constructor(t=r){this._data=[],this._compare=t}get size(){return this._data.length}enqueue(t){if(null==t)return;const{_data:e,_compare:s}=this;e.push(t);let i=e.length-1>>>0;const r=e[i];for(;i>0;){const t=i-1>>1,n=e[t];if(!(s(n,r)<=0))break;e[t]=r,e[i]=n,i=t}}dequeue(){const{_data:t,_compare:e}=this,s=t[0],i=t.pop();if(0===t.length)return s;t[0]=i;let r=0;const n=t.length,a=t[0];let o,u,l=null;for(;;){const s=2*r+1,i=2*r+2;if(l=null,s<n&&(o=t[s],e(o,a)>0&&(l=s)),i<n&&(u=t[i],(null===l&&e(u,a)<=0||null!==l&&e(u,o)<=0)&&(l=i)),null===l)break;t[r]=t[l],t[l]=a,r=l}return s}}const r=(t,e)=>t<e?-1:t>e?1:0;var n=s(19419),a=s(537),o=s(12359),u=s(95108),l=s(12176);function h(t){if(0===t.totalSize)return null;const e=(0,a.z8)(t);if(!e)return null;const s=4*(Math.abs(e[0])+Math.abs(e[2])+Math.abs(e[1])+Math.abs(e[3])+1)*222045e-19;let i=0,r=0;t.reset();for(let e=0;t.nextPath();e++){const s=t.getCurrentRingArea();s>r&&(r=s,i=e)}if(t.seekPath(i),0===t.pathSize)return null;t.seekPathStart();const u=(0,a.B$)(t);if(Math.abs(r)<=2*s*s)return[(u[0]+u[2])/2,(u[1]+u[3])/2];t.seekPathStart();const l=(0,o.w2)(t,(0,n.vt)());if(null===l)return null;if(t.totalPoints<4)return l;const h=[[NaN,NaN],[NaN,NaN],[NaN,NaN],[NaN,NaN]],f=[NaN,NaN,NaN,NaN],m=[NaN,NaN,NaN,NaN];let y=!1,x=d(l,t,!0);0===x.distance&&(y=!0,h[0][0]=l[0],h[0][1]=l[1],x=d(l,t,!1)),f[0]=x.distance,m[0]=0;const F=[NaN,NaN];let S=!1,P=.25,v=-1,I=NaN;do{if(I=NaN,h[1]=p(t,_(u[0],u[2],P),0,e),isNaN(h[1][0])||isNaN(h[1][1])||(x=d(h[1],t,!1),I=x.distance),!isNaN(I)&&I>s&&c(h[1],t))S=!0,f[1]=I,m[1]=g(h[1],l);else if(!isNaN(I)&&I>v&&(v=I,F[0]=h[1][0],F[1]=h[1][1]),P-=.01,P<.1){if(!(v>=0))break;S=!0,f[1]=v,h[1][0]=F[0],h[1][1]=F[1],m[1]=g(h[1],l)}}while(!S);S=!1,P=.5,v=-1;let z=.01,b=1;do{if(I=NaN,h[2]=p(t,_(u[0],u[2],P),0,e),isNaN(h[2][0])||isNaN(h[2][1])||(x=d(h[2],t,!1),I=x.distance),!isNaN(I)&&I>s&&c(h[2],t))S=!0,f[2]=I,m[2]=g(h[2],l);else if(!isNaN(I)&&I>v)v=I,F[0]=h[2][0],F[1]=h[2][1];else if(I>v&&(v=I,F[0]=h[2][0],F[1]=h[2][1]),P=.5+z*b,z+=.01,b*=-1,P<.3||P>.7){if(!(v>=0))break;S=!0,f[2]=v,h[2][0]=F[0],h[2][1]=F[1],m[2]=g(h[2],l)}}while(!S);S=!1,P=.75,v=-1;do{if(I=NaN,h[3]=p(t,_(u[0],u[2],P),0,e),isNaN(h[3][0])||isNaN(h[3][1])||(x=d(h[3],t,!1),I=x.distance),!isNaN(I)&&I>s&&c(h[3],t))S=!0,f[3]=I,m[3]=g(h[3],l);else if(I>v&&(v=I,F[0]=h[3][0],F[1]=h[3][1]),P+=.01,P>.9){if(!(v>=0))break;S=!0,f[3]=v,h[3][0]=F[0],h[3][1]=F[1],m[3]=g(h[3],l)}}while(!S);const R=[0,1,2,3],C=y?0:1;let N;for(let t=C;t<4;t++)for(let t=C;t<3;t++){const e=m[t],s=m[t+1];w(e,s)>0&&(N=R[t],R[t]=R[t+1],R[t+1]=N,m[t]=s,m[t+1]=e)}let q=C,M=0,O=0;for(let t=C;t<4;t++){switch(t){case 0:O=2*f[R[t]];break;case 1:O=1.66666666*f[R[t]];break;case 2:O=1.33333333*f[R[t]];break;case 3:O=f[R[t]]}O>M&&(M=O,q=R[t])}return h[q]}function c(t,e){let s,i,r,n,a=0;for(e.reset();e.nextPath()&&e.nextPoint();)for(s=e.x,i=e.y;e.nextPoint();s=r,i=n)r=e.x,n=e.y,i>t[1]!=n>t[1]&&((r-s)*(t[1]-i)-(n-i)*(t[0]-s)>0?a++:a--);return 0!==a}function d(t,e,s){if(s&&c(t,e))return{coord:t,distance:0};let i=1/0,r=0,n=0,a=[0,0],o=[0,0];const l=[0,0];for(e.reset();e.nextPath()&&e.nextPoint();)if(!(e.pathSize<2))for(a[0]=e.x,a[1]=e.y;e.nextPoint();a=o){o=[e.x,e.y],(0,u.gR)(l,t,a,o);const s=g(t,l);s<i&&(i=s,r=l[0],n=l[1])}return{coord:[r,n],distance:Math.sqrt(i)}}function p(t,e,s,i){const r=[e,0];let a=1/0,o=1/0,u=!1,h=!1;const c=[[e,i[1]-1],[e,i[3]+1]],d=[0,0],p=[0,0],y=[0,0],_=[[0,0],[0,0]],g=(0,n.vt)();for(t.reset();t.nextPath()&&t.nextPoint();)if(!(t.pathSize<2))for(_[0][0]=t.x,_[0][1]=t.y;t.nextPoint();_[0][0]=_[1][0],_[0][1]=_[1][1]){if(_[1][0]=t.x,_[1][1]=t.y,null===f(g,_))continue;if(p[0]=c[0][0],p[1]=c[0][1],y[0]=c[1][0],y[1]=c[1][1],0===m(g,p,y))continue;if(!(0,l.Ql)(c[0],c[1],_[0],_[1],d))continue;const e=d[1];a>o?e<a&&(a=e,u=!0):e<o&&(o=e,h=!0)}return u&&h?r[1]=(a+o)/2:r[0]=r[1]=NaN,r}function f(t,e){if(e.length<2)return null;t||(t=(0,n.vt)());const[s,i]=e[0],[r,a]=e[1];return t[0]=Math.min(s,r),t[1]=Math.min(i,a),t[2]=Math.max(s,r),t[3]=Math.max(i,a),t}function m(t,e,s){let i=y(e,t),r=y(s,t);const n=t[0],a=t[1],o=t[2],u=t[3];if(i&r)return 0;if(!(i|r))return 4;const l=(i?1:0)|(r?2:0);do{const l=s[0]-e[0],h=s[1]-e[1];if(l>h)3&i?(1&i?(e[1]+=h*(n-e[0])/l,e[0]=n):(e[1]+=h*(o-e[0])/l,e[0]=o),i=y(e,t)):3&r?(1&r?(s[1]+=h*(n-s[0])/l,s[0]=n):(s[1]+=h*(o-s[0])/l,s[0]=o),r=y(s,t)):i?(4&i?(e[0]+=l*(a-e[1])/h,e[1]=a):(e[0]+=l*(u-e[1])/h,e[1]=u),i=y(e,t)):(4&r?(s[0]+=l*(a-s[1])/h,s[1]=a):(s[0]+=l*(u-s[1])/h,s[1]=u),r=y(s,t));else if(12&i?(4&i?(e[0]+=l*(a-e[1])/h,e[1]=a):(e[0]+=l*(u-e[1])/h,e[1]=u),i=y(e,t)):12&r?(4&r?(s[0]+=l*(a-s[1])/h,s[1]=a):(s[0]+=l*(u-s[1])/h,s[1]=u),r=y(s,t)):i?(1&i?(e[1]+=h*(n-e[0])/l,e[0]=n):(e[1]+=h*(o-e[0])/l,e[0]=o),i=y(e,t)):(1&r?(s[1]+=h*(n-s[0])/l,s[0]=n):(s[1]+=h*(o-s[0])/l,s[0]=o),r=y(s,t)),i&r)return 0}while(i|r);return l}function y(t,e){return(t[0]<e[0]?1:0)|(t[0]>e[2]?1:0)<<1|(t[1]<e[1]?1:0)<<2|(t[1]>e[3]?1:0)<<3}function _(t,e,s){return t+(e-t)*s}function g(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function w(t,e){if(t<e)return-1;if(t>e)return 1;if(t===e)return 0;const s=isNaN(t),i=isNaN(e);return s<i?-1:s>i?1:0}class x{constructor(t,e,s,i){this.x=t,this.y=e,this.cellSize=s,this.distancefromCellCenter=(0,u.Xf)(t,e,i),this.maxDistanceToPolygon=this.distancefromCellCenter+this.cellSize*Math.SQRT2}}function F(t){if(!t.nextPath()||!t.pathSize)return null;const e=(0,a.B$)(t),s=e[2]-e[0],r=e[3]-e[1];if(0===s||0===r)return[e[0]+s/2,e[1]+r/2];const n=Math.max(Math.min(s,r)/100,1),u=new i((t,e)=>e.maxDistanceToPolygon-t.maxDistanceToPolygon),l=Math.min(s,r);let h=l/2,c=0,d=0;for(c=e[0];c<e[2];c+=l)for(d=e[1];d<e[3];d+=l)u.enqueue(new x(c+h,d+h,h,t));t.reset(),t.nextPath();const p=(0,o.IK)(t);if(null===p)return null;let f,m=new x(p[0],p[1],0,t);for(;u.size>0;)f=u.dequeue(),f.distancefromCellCenter>m.distancefromCellCenter&&(m=f),f.maxDistanceToPolygon-m.distancefromCellCenter<=n||(h=f.cellSize/2,u.enqueue(new x(f.x-h,f.y-h,h,t)),u.enqueue(new x(f.x+h,f.y-h,h,t)),u.enqueue(new x(f.x-h,f.y+h,h,t)),u.enqueue(new x(f.x+h,f.y+h,h,t)));return[m.x,m.y]}},62815(t,e,s){s.d(e,{N:()=>o,d:()=>u});var i=s(86211),r=s(73941),n=s(21325),a=s(52006);function o(t,e,s){const i=u(e,s);if(1!==i)switch(t){case"point":case"esriGeometryPoint":return t=>function(t,e){null!=t?.z&&(t.z*=e)}(t,i);case"polyline":case"esriGeometryPolyline":return t=>function(t,e){if(t){if(t.curvePaths)for(const s of t.curvePaths)for(const t of s){const s=(0,a.yP)(t);s.length>2&&(s[2]*=e)}if(t.paths)for(const s of t.paths)for(const t of s)t.length>2&&(t[2]*=e)}}(t,i);case"polygon":case"esriGeometryPolygon":return t=>function(t,e){if(t){if(t.curveRings)for(const s of t.curveRings)for(const t of s){const s=(0,a.yP)(t);s.length>2&&(s[2]*=e)}if(t.rings)for(const s of t.rings)for(const t of s)t.length>2&&(t[2]*=e)}}(t,i);case"multipoint":case"esriGeometryMultipoint":return t=>function(t,e){if(t)for(const s of t.points)s.length>2&&(s[2]*=e)}(t,i);case"extent":case"esriGeometryEnvelope":return t=>function(t,e){t&&null!=t.zmin&&null!=t.zmax&&(t.zmin*=e,t.zmax*=e)}(t,i);default:return}}function u(t,e){return null==t||null==e||(0,n.aI)(t,e)||(0,r.xP)(t)||(0,r.xP)(e)?1:(0,i.G9)(t)/(0,i.G9)(e)}},24460(t,e,s){function i(t){const{minValue:e,maxValue:s,numValues:i,nullCount:r,distinctCount:n}=t;return null!=i&&r===i?{type:"null-only",nullCount:r,distinctCount:n}:"number"==typeof e&&Number.isFinite(e)&&"number"==typeof s&&Number.isFinite(s)&&e<=s?{type:"bounds",minValue:e,maxValue:s,nullCount:r,distinctCount:n}:null!=e||null!=s||null!=n||null!=r?{type:"unknown",nullCount:r,distinctCount:n}:null}function r(t){const e=new Map;for(const s of t.files){const t=n(s);e.set(s.name,t)}return e}function n(t){const e=new Map;for(const s of t.statistics??[]){const t=s.column.at(-1);if(null==t)continue;const r=i({minValue:s.minValue,maxValue:s.maxValue,numValues:null,nullCount:s.nullCount??0,distinctCount:s.distinctCount??null});null!=r&&e.set(t,r)}return new o(0,0,e)}function a(t){const e=t.minValue(),s=t.maxValue(),r=t.numValues(),n=t.distinctCount()??null;return i({minValue:e,maxValue:s,numValues:r,nullCount:t.nullCount()??null,distinctCount:n})}s.d(e,{Hk:()=>a,MB:()=>o,t8:()=>r});class o{static fromFile(t){const e=t.numRows(),s=t.byteLength(),i=new Map;for(const e of t.getColumnDescriptors()){const t=a(e);null!=t&&i.set(e.name(),t),e.free()}return new o(e,s,i)}constructor(t,e,s){this.rowCount=t,this.byteSize=e,this.statistics=s}}},95031(t,e,s){s.d(e,{M:()=>P});var i=s(11254),r=s(32198),n=s(49186),a=s(65529),o=s(44208),u=s(563),l=s(84952),h=s(24460),c=s(63892);class d{static async create(t,e,s,i,r){if(!r){const r=await(0,c.DV)(s,{geometryInfo:t,provider:e}),n=h.MB.fromFile(r);return new d(t,e,s,i,n,Promise.resolve(r))}return new d(t,e,s,i,r,null)}constructor(t,e,s,i,r,n){this._geometryInfo=t,this._provider=e,this.url=s,this.id=i,this.statistics=r,this._file=n}destroy(){null!=this._file&&this._file.then(t=>t.free())}get file(){return null==this._file&&(this._file=(0,c.DV)(this.url,{geometryInfo:this._geometryInfo,provider:this._provider})),this._file}async getDiagnosticsSnapshot(){return{...(await this.file).diagnosticsSnapshot(),fileId:this.id,fileName:this.url}}async getColumnIndex(t,e){return(await this.file).columnIndex(t,e)}async getOffsetIndex(t,e){return(await this.file).offsetIndex(t,e)}}const p="_spatial.json",f=new u.QueueProcessor({concurrency:12,process:async t=>{const{data:e}=await(0,i.A)(t.url,t.options);return e}});let m=1;class y{constructor(t,e=()=>{}){this._geometryInfo=t,this._getCustomParameters=e,this.events=new a.bk}async destroy(){await this.clear()}async clear(){if(this._infos){const t=await this._infos;for(const e of t.values())e.destroy();t.clear(),this._infos=null}}async getMetadata(){const t={stack:[],error:void 0,hasError:!1};try{const e=(await this._getParquetFileNames()).at(0);if(!e)return null;const s=(0,r.mS)(t,await(0,c.DV)(e,{provider:this}),!1);return(0,c._6)(s)}catch(e){t.error=e,t.hasError=!0}finally{(0,r.hk)(t)}}getGeometryInfo(){return this._geometryInfo}async getFiles(){const t=await this._getInfoMap();return Array.from(t.values())}async updateGeometryInfo(t){if(this._geometryInfo)throw new Error("GeometryInfo already set");await this.clear(),this._geometryInfo=t}async fetchLength(t){const{byteLength:e,cacheTag:s}=await this._fetchLengthAndTag(t);if(!(0,o.A)("parquetlayer-cache-enabled"))return e;try{await this._createOrResetCache(t,s)}catch(t){}return e}async fetchRange(t,e,s,i){const r={fileId:t,requestId:m++,range:{start:e,end:s+1}};this.events.emit("rangeRead",{...r,phase:"start"});try{const n=await this._fetchRangeWithCache(t,e,s,i);return this.events.emit("rangeRead",{...r,phase:"complete"}),n}catch(t){throw this.events.emit("rangeRead",{...r,phase:"error"}),t}}_getCacheFileName(t){return t}async _requestStatistics(t){const{data:e}=await(0,i.A)(t,{responseType:"json",query:this._getCustomParameters()});return e}async _fetchRange(t,e,s,i){const r={url:t,options:{responseType:"array-buffer",query:this._getCustomParameters()??{},cacheMode:"no-store",useQueue:!0,headers:{range:`bytes=${e}-${s}`}}},a=await f.push(r),o=s-e+1;if(a.byteLength!==o)throw new n.A("InvalidRangeRequest",`request returned ${a.byteLength} bytes for range ${e}-${s}, expected ${o}.`);return a}async _fetchLengthAndTag(t){if((0,l.w8)(t)){const{data:e}=await(0,i.A)(t,{responseType:"blob"});return{byteLength:e.size,cacheTag:null}}const e=await this._requestHead(t),s=e.headers.get("Content-Length");if(null==s)throw new Error("Unable to parse content length");const r=e.headers.get("etag")??e.headers.get("Last-Modified");return{byteLength:parseInt(s,10),cacheTag:r}}async _getInfoMap(){return this._infos||(this._infos=this._fetchParquetFiles()),this._infos}async _updateParquetFileInfos(t){const e=await this._getInfoMap(),s=new Set(t);for(const t of s)if(!e.get(t)){const s=e.size,i=await d.create(this.getGeometryInfo(),this,t,s,null);e.set(t,i)}for(const t of e.keys())if(!s.has(t))throw new Error("Deletion not supported")}async _getFileStatistics(t){this._statistics||(this._statistics=this._fetchStatistics());const e=await this._statistics,s=function(t){return t.split(/[?#]/)[0].split("/").at(-1)??t}(t);return e.get(s)}async _fetchParquetFiles(){const t=(await this._getParquetFileNames()).map(async(t,e)=>{const s=e,i=await this._getFileStatistics(t);return d.create(this.getGeometryInfo(),this,t,s,i)}),e=await Promise.all(t),s=new Map;for(const t of e)s.set(t.url,t);return s}async _fetchStatistics(){const t=await this._getStatisticsFileName();if(null==t)return new Map;const e=await this._resolveFileUrl(t),s=await this._requestStatistics(e);return(0,h.t8)(s)}async _requestHead(t){const{data:e}=await(0,i.A)(t,{responseType:"native",method:"head",query:this._getCustomParameters()});return e}async _openCache(t){return caches.open(this._getCacheName(t))}async _fetchRangeWithCache(t,e,s,i){if(!(0,o.A)("parquetlayer-cache-enabled"))return this._fetchRange(t,e,s,i);const r=new URL(this._getCacheFileName(t));r.searchParams.append("range",`${e}-${s}`);try{const n=await this._openCache(t),a=await n.match(r);if(a)return await a.arrayBuffer();const o=await this._fetchRange(t,e,s,i);return await n.put(r,new Response(o,{headers:{"Content-Type":"application/octet-stream","Content-Length":o.byteLength.toString()}})),o}catch(r){return this._fetchRange(t,e,s,i)}}_getCacheName(t){return`parquet.v1:${this._getCacheFileName(t)}`}async _createOrResetCache(t,e){const s=this._getCacheName(t),i=new URL(this._getCacheFileName(t));if(i.searchParams.append("metadata","true"),null==e)return void await caches.delete(s);let r=await caches.open(s);const n=await r.match(i),a=await(n?.json());a?.tag!==e&&(await caches.delete(s),r=await caches.open(s));const o=JSON.stringify({tag:e});await r.put(i,new Response(o,{headers:{"Content-Type":"application/json","Content-Length":o.length.toString()}}))}}function _(t){const e=t.split(/[?#]/)[0];return e===p||e.endsWith(p)}var g=s(39131);class w extends y{constructor(t,e,s){super(e,s),this._schema=t,this._isAgol=!!(0,g.py)(this._schema.itemUrl)}async update(t){throw new Error("Unsupported")}async _getParquetFileNames(){return[`${this._baseUrl}/data`]}async _getStatisticsFileName(){return null}_getCacheFileName(t){return`${this._baseUrl}/data`}async _resolveFileUrl(t){return this._resolvedUrl||(this._resolvedUrl=this._fetchResolvedUrl()),this._resolvedUrl}async _fetchLengthAndTag(t){const e=await super._fetchLengthAndTag(t);return e.cacheTag=this._schema.modified.getTime().toString(),e}async _fetchRange(t,e,s,i){try{const r=await this._resolveFileUrl(t);return await super._fetchRange(r,e,s,i)}catch{this._resolvedUrl=null}const r=await this._resolveFileUrl(t);return super._fetchRange(r,e,s,i)}get _baseUrl(){return this._schema.itemCdnUrl??this._schema.itemUrl}async _fetchResolvedUrl(){return this._isAgol?(await(0,i.A)(`${this._baseUrl}/data`,{query:{signedurl:!0,expiration:9,f:"json"}})).data.signedUrl:`${this._baseUrl}/data`}}var x=s(47828);class F extends y{constructor(t,e,s){super(e,s),this._schema=t,this._directoryChanged=!1}get _baseUrl(){return this._schema.itemCdnUrl??this._schema.itemUrl}async update(t){throw new Error("Unsupported")}async _getParquetFileNames(){const t=await this._getResources();return Array.from(t.keys()).filter(t=>t.endsWith(".parquet"))}async _getStatisticsFileName(){const t=await this._getResources();return Array.from(t.keys()).find(_)??null}_getCacheFileName(t){return`${this._baseUrl}/resources/${t}`}async _resolveFileUrl(t){const e=await this._getResource(t);return e.signedUrl?e.signedUrl:`${this._baseUrl}/resources/${t}`}async _fetchLengthAndTag(t){const e=await this._getResource(t),s=this._schema.itemMetadata.modified.getTime().toString();return{byteLength:e.size,cacheTag:s}}async _fetchRange(t,e,s,i){if(this._directoryChanged)throw(0,x.O)();try{const r=await this._resolveFileUrl(t);return await super._fetchRange(r,e,s,i)}catch{if("directory-changed"===await this._refetchResources())throw(0,x.O)()}const r=await this._resolveFileUrl(t);return super._fetchRange(r,e,s,i)}_refetchResources(){return this._directoryChanged?Promise.resolve("directory-changed"):(this._updateResourcesPromise||(this._updateResourcesPromise=this._executeRefetchResources().finally(()=>{this._updateResourcesPromise=null})),this._updateResourcesPromise)}async _executeRefetchResources(){return await this._refetchPortalItemMetadata()?(this.events.emit("sourceChanged"),this._directoryChanged=!0,"directory-changed"):(this._resources=this._fetchResources(),"ok")}async _refetchPortalItemMetadata(){const t=this._schema.itemMetadata.url,e=await(0,i.A)(this._schema.itemUrl,{responseType:"json",query:{f:"json"}}),{modified:s,url:r}=e.data;if(null==r)throw new Error("Portal item metadata must have a url defined.");if(null==s)throw new Error("Portal item metadata must have a modified timestamp defined.");return this._schema.itemMetadata={modified:new Date(s),url:r},t!==r}async _getResources(){return this._resources||(this._resources=this._fetchResources()),await this._resources}async _getResource(t){const e=(await this._getResources()).get(t);if(!e)throw new Error(`Resource ${t} not found.`);return e}async _fetchResources(){const t=new Map;let e=1;const s=function(t){const e=t.split("/").filter(Boolean),s=e.indexOf("resources");if(-1===s||s===e.length-1)throw new Error(`URL does not contain a resources directory name: ${t}`);return`${e.slice(s+1).map(t=>decodeURIComponent(t)).join("/")}/`}(this._schema.itemMetadata.url);for(;-1!==e;){const r=await(0,i.A)(`${this._baseUrl}/resources`,{query:{f:"json",start:e,num:100}});for(const e of r.data.resources)e.resource.startsWith(s)&&t.set(e.resource,e);e=r.data.nextStart}return t}}class S extends y{constructor(t,e=null,s=()=>{}){super(e,s),this._schema=t}async update(t){await this._updateParquetFileInfos(await this._getParquetFileNames()),this._schema=t}async _resolveFileUrl(t){return t}async _getParquetFileNames(){return this._schema.urls.filter(t=>!t.endsWith(".json"))}async _getStatisticsFileName(){return this._schema.urls.find(_)??null}}function P(t,e,s){switch(t.type){case"urls":return new S(t,e,s);case"portal-parquet-file":return new w(t,e,s);case"portal-parquet-layer":return new F(t,e,s)}}},6557(t,e,s){s.r(e),s.d(e,{default:()=>V});var i=s(32198),r=s(21818),n=s(49186),a=s(71511),o=s(44208),u=s(53966),l=s(17676),h=s(563),c=s(39516),d=s(86211),p=s(16930),f=s(70328),m=s(19419),y=s(21325),_=s(90708),g=s(29441),w=s(56390),x=s(99352),F=s(8384),S=s(58727),P=s(95031),v=s(24460),I=s(64714),z=s(17754),b=s(20437),R=s(95466),C=s(30524),N=s(50639),q=s(42760),M=s(39412),O=s(63892),A=s(30661),T=s(28923),E=s(44320),G=s(35258),k=s(16630);const U=new A.Z,Z="__OBJECTID",D=8e3;class B{constructor(t,e){this._files=t,this._createFileStream=e,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(t){for(await this._fill(t);this._pending.size>0;){(0,l.Te)(t),await this._fill(t);const e=await L(this._pending);if(this._pending.delete(e.read),this._resolvedCount++,null!=e.chunk)return e.chunk}return null}async _fill(t){for(this._removeDone();this._pending.size<8;){const e=this._getOrCreateNextStream(t);if(null==e)return;this._pending.add(e.read(t))}}_getOrCreateNextStream(t){const e=this._resolvedCount>=8?8:2;if(this._fileIndex<this._files.length&&this._streams.length<e){const e=this._files[this._fileIndex++],s=new Q(e.id,this._createFileStream(e,t));return this._streams.push(s),s}return this._getNextStream()}_getNextStream(){const t=this._streams.length;for(let e=0;e<t;e++){const s=(this._streamIndex+e)%t,i=this._streams[s];if(i.canRead)return this._streamIndex=(s+1)%t,i}return null}_removeDone(){let t=this._streamIndex;for(let e=this._streams.length-1;e>=0;e--)this._streams[e].done&&(this._streams.splice(e,1),e<t&&t--);this._streamIndex=this._streams.length>0?t%this._streams.length:0}}function L(t){return Promise.race(Array.from(t,async t=>({read:t,chunk:await t})))}class Q{constructor(t,e){this._fileId=t,this._stream=e,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&0===this._readCount}async read(t){this._readCount++;try{const e=await this._stream,s=await e.next(t);return null==s?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:s}}finally{this._readCount--}}}class V{constructor(){this._hasZ=!1,this._hasM=!1,this._queue=new h.QueueProcessor({concurrency:4,process:(t,e)=>this._executeQuery(t,e)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={},this._handles=new a.A}async load(t){const e=t.spatialReference?p.A.fromJSON(t.spatialReference):void 0;if(e&&!e.isWGS84&&!e.isWebMercator)throw new n.A("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");this._customParameters=t.customParameters,this._loadParameters=t,await this._updateProvider((0,P.M)(t.provider,null,()=>this._customParameters));const s=await this._provider.getMetadata(),i=await(0,q.nc)(s,{fields:t.fields?.map(t=>b.A.fromJSON(t)),geometryEncoding:t.geometryEncoding?(0,N.G)(t.geometryEncoding):null,geometryType:t.geometryType?(0,q.hG)(t.geometryType):null,displayOptimization:t.displayOptimization,spatialReference:e});if(this._hasZ=!!s?.hasZ,this._hasM=!!s?.hasM,!i.fields)throw new n.A("parquet:unsupported","Fields must be defined");let r;if(i.spatialReference&&i.geometryType){if(!i.spatialReference)throw new n.A("parquet:unsupported","SpatialReference must be defined");if(!i.spatialReference.isGeographic&&!i.spatialReference.isWebMercator)throw new n.A("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");i.spatialReference.isGeographic&&!i.spatialReference.isWGS84&&(u.A.getLogger("parquet:unsupported-projection").warn("Found a geographic projection that is not WGS84. Handling as WGS84.",{spatialReference:i.spatialReference}),i.spatialReference=p.A.WGS84),r={geometry:i.geometryEncoding?{geometryType:(0,q.sA)(i.geometryType),spatialReference:i.spatialReference.toJSON(),encoding:i.geometryEncoding.toJSON()}:null,displayOptimization:i.displayOptimization}}this.setCustomParameters(t.customParameters),this._displayOptimization=i.displayOptimization,await this._provider.updateGeometryInfo(r),this._capabilities=it(await this._getFileStatistics(),this._hasZ,this._hasM);const a=await this._provider.getFiles();if(!a.length)return{layerDefinition:{},capabilities:it(null,this._hasZ,this._hasM)};const o=await a[0].file;i.file=o;const{fields:l}=i;if(null==l)throw new n.A("parquet-layer:missing-metadata","Unable to create parquet source: cannot infer fields",l);l.push(new b.A({name:Z,type:"oid",alias:Z}));for(const t of l){const e=o.getColumnId(t.name);null!=e&&(this._indexMap[t.name]=e)}const h=new R.A(l.map(t=>t.toJSON()));this._fieldsIndex=h;const c=(0,q.sA)(i.geometryType??"point");return this._metadata=G.i.createFeature({fieldsIndex:h.toJSON(),geometryType:c,hasZ:this._hasZ,hasM:this._hasM,featureIdInfo:{type:"object-id",fieldName:Z},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:i.spatialReference,outSpatialReference:null,attributeSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:c,featureIdInfo:{type:"object-id",fieldName:Z},hasM:this._hasM,hasZ:this._hasZ,spatialReference:i.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=s?.extent?s.extent:await this._tryDeriveParquetFullExtent(i),{capabilities:this._capabilities,layerDefinition:{fields:i.fields?.map(t=>t.toJSON()),drawingInfo:(0,I.F0)(c),extent:this._fullExtent??void 0,geometryType:c,geometryEncoding:i.geometryEncoding?.toJSON(),displayOptimization:i.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(const{handle:t}of this._streams.values())t.remove();this._streams.clear(),this._indexMap={},this._handles.removeAll()}async reload(t){this.destroy(),await this.load(t)}set remoteClient(t){this._source=t.createInvokeProxy("")}setCustomParameters(t){this._customParameters=t}getIndexMap(){return this._indexMap}async updateFileProvider(t){this._loadParameters={...this._loadParameters,provider:t};const e=(0,P.M)(t,this._provider.getGeometryInfo(),()=>this._customParameters);await this._updateProvider(e)}async getDiagnosticsSnapshot(){const t=await this._provider.getFiles();return{files:await Promise.all(t.map(t=>t.getDiagnosticsSnapshot()))}}async getColumnIndex(t){return(await this._getFileInfoById(t.fileId)).getColumnIndex(t.rowGroupIndex,t.columnIndex)}async getOffsetIndex(t){return(await this._getFileInfoById(t.fileId)).getOffsetIndex(t.rowGroupIndex,t.columnIndex)}async queryFeatures(t,e){const s=await(0,S.T2)(t,null,this._queryEngineParams.spatialReference);return this._validateQuery(s),function(t){return!!(t.objectIds?.length||t.outStatistics||t.orderByFields?.length||t.returnDistinctValues)}(s)||(s.resultRecordCount=s.resultRecordCount?Math.min(s.resultRecordCount,D):D,s.resultOffset=s.resultOffset??0),s.outStatistics?this._queryStatistics(s,e):(s.returnDistinctValues&&(s.returnGeometry=void 0),(await this._enqueueQuery(s,e)).createQueryResponse())}async queryFeatureCount(t,e){const s=await(0,S.T2)(t,null,this._queryEngineParams.spatialReference);return this._validateQuery(s),J(s)?(s.outFields=void 0,s.returnGeometry=void 0,(await this._enqueueQuery(s,e)).createQueryResponseForCount()):this._getFeatureCount()}async queryObjectIds(t,e){const s=await(0,S.T2)(t,null,this._queryEngineParams.spatialReference);return this._validateQuery(s),J(s)?(s.resultRecordCount=s.resultRecordCount?Math.min(s.resultRecordCount,8e3):8e3,s.resultOffset=s.resultOffset??0,s.returnGeometry=void 0,s.outFields=void 0,(await this._enqueueQuery(s,e)).items.map(t=>t.getObjectId())):Array.from({length:await this._getFeatureCount()},(t,e)=>e)}async queryAttributeBins(t,e={}){throw new n.A("parquet:unsupported","queryAttributeBins not supported.")}async queryExtent(t,e){const s=await(0,S.T2)(t,null,this._queryEngineParams.spatialReference);if(this._validateQuery(s),this._fullExtent&&!J(s))return{count:await this._getFeatureCount(),extent:this._fullExtent};const i=(0,r.z)(this._metadata.spatialReference);s.returnGeometry=!0,s.outFields=void 0;const n=(0,f.hZ)((0,f.vt)(),f.qv),a=(0,f.vt)(),o=await this._enqueueQuery(s,e);let u=0;for(const t of o.items)t.getBounds(a)&&((0,f.RF)(n,a),u+=1);return{count:u,extent:(0,w.Wc)(n,i,s.outSR?(0,r.z)(s.outSR):i.toJSON(),i,!1)}}async queryStream(t,e){if(!e.signal)throw new Error("InternalError: AbortSignal must be passed");const s=await this._getCandidateFiles(t),i=new B(s,async(e,s)=>{const i=await e.file,r=await this._createParquetDisplayQuery(i,e.id,t);return i.executeQuery(r,D,s)}),r=this._streamIdCounter++,n=(0,l.NY)(e.signal,t=>{const e=this._streams.get(r);null!=e&&(e.handle.remove(),this._streams.delete(r))});return this._streams.set(r,{stream:i,handle:n}),r}async getStreamNext(t,e){if(!e.signal)throw new Error("InternalError: AbortSignal must be passed");const s=this._streams.get(t);if(!s)return{result:null};const i=await s.stream.next(e.signal);if(null==i)return s.handle.remove(),this._streams.delete(t),{result:null};const r=i.chunk.serialize().buffer,n={fileId:i.fileId,buffer:r};return r instanceof ArrayBuffer?{result:n,transferList:[r]}:{result:n}}async getStreamNextFeatures(t,e){const{result:s}=await this.getStreamNext(t,e);if(null==s)return null;const i=(await(0,M.N)()).ParquetChunk.deserialize(new Uint8Array(s.buffer)),r=new k.s(this._metadata,this._indexMap,i,s.fileId),n=[];for(;r.next();){const t=(0,_.zv)(r.readGeometryWorldSpace(),r.geometryType,r.hasZ,r.hasM),e=r.readAttributes();n.push({attributes:e,geometry:t})}return{features:n}}async createPatch(t,e,s,i,r){if(!r.signal)throw new Error("InternalError: AbortSignal must be passed");const n=await this._getFileInfoById(t),a=await n.file;return(await a.createChunkPatch(e,s,i,r.signal)).serialize().buffer}async _updateProvider(t){const e=this._provider;this._handles.removeAll(),this._provider=t,this._handles.add([t.events.on("rangeRead",t=>{this._source.onRangeRead(t)}),t.events.on("sourceChanged",async()=>{await this.reload(this._loadParameters),await this._source.onSourceChange()})]),await(e?.destroy())}async _getCandidateFiles(t){const e=await this._provider.getFiles(),s=await this._getSpatialFilePruning(t);if(null==s)return e;const i=e.filter(t=>this._mayIncludeFileForSpatialPruning(t,s));return"xz"===s.type?function(t,e){return t.slice().sort((t,s)=>{const i=st(t,e),r=st(s,e);return i===r?0:i<r?-1:1})}(i,s):i}async _queryStatistics(t,e){const s=await(0,S.T2)({...t},null,this._queryEngineParams.spatialReference);if(s.returnGeometry=void 0,function(t,e){return!!t.outStatistics?.length&&!J(t)&&!t.groupByFieldsForStatistics?.length&&!t.orderByFields?.length&&!t.returnDistinctValues&&!t.returnAggIds&&t.outStatistics.every(t=>function(t,e){switch(t.statisticType){case"count":return"1"===t.onStatisticField||null!=e.get(t.onStatisticField);case"min":case"max":{const s=e.get(t.onStatisticField);return null!=s&&(0,C.WA)(s)}default:return!1}}(t,e))}(s,this._fieldsIndex)){const t=await this._getStatisticsFromFiles(s);if(t)return t}return(await this._enqueueQuery(s,e)).createQueryResponse()}async _getStatisticsFromFiles(t){const e=await this._provider.getFiles(),s={},i=[];for(const r of t.outStatistics??[]){const t=X(r,e);if(!t.available)return null;s[r.outStatisticFieldName]=t.value,i.push(H(r,this._fieldsIndex))}return{fields:i,features:[{attributes:s}]}}async _getSpatialFilePruning(t){if("tile"!==t.type&&("arcade"!==t.type||null==t.extent))return null;const e=this._displayOptimization,s=e?.index;if(null==s)return null;const i=t.outSpatialReference.wkid;if(null==s.wkid||null==i)return null;const r=s.wkid,n=await(0,M.N)();switch(s.type){case"xz":return{type:"xz",fieldName:(0,O.FG)(s.code),intersects:(e,a)=>n.queryIntersectsXZStatistics(s.fullExtent,t.extent,i,r,s.maxLevel,e,a)};case"z":return{type:"xy",xFieldName:(0,O.FG)(s.xColumn),yFieldName:(0,O.FG)(s.yColumn),intersects:(e,s,a,o)=>n.queryIntersectsXYStatistics(t.extent,i,r,e,s,a,o)}}}_mayIncludeFileForSpatialPruning(t,e){switch(e.type){case"xz":{const s=et(t,e);return"null-only"!==s?.type&&("bounds"!==s?.type||e.intersects(s.minValue,s.maxValue))}case"xy":{const s=t.statistics.statistics.get(e.xFieldName),i=t.statistics.statistics.get(e.yFieldName);return"null-only"!==s?.type&&"null-only"!==i?.type&&("bounds"!==s?.type||"bounds"!==i?.type||e.intersects(s.minValue,s.maxValue,i.minValue,i.maxValue))}}}async _tryDeriveParquetFullExtent(t){if(!t.spatialReference)return null;if(null==this._fullExtent&&"location"===t.geometryEncoding?.type){const e=await this._provider.getFiles(),{xField:s,yField:r}=t.geometryEncoding,n=(0,f.hZ)((0,f.vt)(),f.qv);let a=!1;for(const t of e){const e=await t.file;for(const t of e.rowGroups()){const e={stack:[],error:void 0,hasError:!1};try{const o=(0,i.mS)(e,t.columnDescriptorForAttribute(s),!1),u=(0,i.mS)(e,t.columnDescriptorForAttribute(r),!1),l=(0,v.Hk)(o),h=(0,v.Hk)(u);if("bounds"===l?.type&&"bounds"===h?.type){const t=[l.minValue,h.minValue,l.maxValue,h.maxValue];(0,f.DC)(n,t),a=!0}t.free()}catch(t){e.error=t,e.hasError=!0}finally{(0,i.hk)(e)}}}return a?{xmin:n[0],ymin:n[1],xmax:n[3],ymax:n[4],spatialReference:t.spatialReference?.toJSON()}:null}return null}async _getFileInfoById(t){const e=await this._provider.getFiles();for(const s of e)if(s.id===t)return s;throw new Error(`InternalError: File ${t} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(t){return(await this._getFileInfoById(t)).file}async _createParquetQuery(t,e,s,i,r){const n=(await(0,M.N)()).Query.new();null!=s&&n.setPreFilterStart(s),null!=i&&n.setPreFilterCount(i),null!=r&&n.setPostFilterCount(r);const a=await this._getRequiredFields(t);n.setOutFields(a),(t.geometry||t.returnGeometry)&&n.setReturnGeometry(!0),n.setReturnZ(!!t.returnZ),n.setReturnM(!!t.returnM);const o=this._tryGetGeneralizedGeometryResolution(t);null!=o&&n.setSourceResolution(o);const u=t.geometry?.spatialReference??this._queryEngineParams.spatialReference,l=u.wkid;if(t.geometry&&((0,y.K8)(u)||(0,y.oT)(u))){const e=(0,m.C)((0,m.vt)(),m.qv);for(const s of(0,w.qo)(t.geometry))(0,m.DC)(e,s);n.setOutSpatialReference(l),n.setExtent({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3]})}if(t.where){const{id:s,file:i}=e;await this._setWhereClause(n,await i,s,t.where)}return n}async _createParquetDisplayQuery(t,e,s){const i=(await(0,M.N)()).Query.new();if("tile"===s.type){i.setExtent(s.extent),i.setQuantizationTransform(s.transform);const t=this._sourceResolution(s.resolution,s.outSpatialReference);null!=t&&i.setSourceResolution(t)}else"arcade"===s.type&&null!=s.extent&&i.setExtent(s.extent);return i.setOutFields(s.outFields.filter(t=>null!=this._indexMap[t])),i.setOutSpatialReference(s.outSpatialReference.wkid),i.setReturnGeometry(s.returnGeometry),i.setReturnZ(s.returnZ),i.setReturnM(s.returnM),s.where&&await this._setWhereClause(i,t,e,s.where),i}async _getFeatureCount(){return(await this._provider.getFiles()).map(t=>t.statistics.rowCount).reduce((t,e)=>t+e,0)}async _getByteLength(){return(await this._provider.getFiles()).map(t=>t.statistics.byteSize).reduce((t,e)=>t+e,0)}_validateQuery(t){if(!this._capabilities.query.supportsStatistics&&t.outStatistics)throw new n.A("parquet:unsupported","Statistics queries are not supported",{query:t});if(!this._capabilities.query.supportsOrderBy&&t.orderByFields?.length)throw new n.A("parquet:unsupported","Queries using orderBy are not supported",{query:t});if(!this._capabilities.query.supportsDistinct&&t.returnDistinctValues)throw new n.A("parquet:unsupported","Queries using returnDistinctValues are not supported",{query:t})}async _setWhereClause(t,e,s,i){const r=this._indexMap,a=this._fieldsIndex,o={getAttribute(t,i){const n=r[i];if(null==n){const e=a.get(i);if("__OBJECTID"===e?.name){const e=t.row+t.rowGroupStart;return(0,z.xb)(s,e)}return null}const o=a.get(i);return(0,O.LC)(e,t.rowGroup,t.row,n,o.type)}},u=await(0,c.GP)(i,this._fieldsIndex);if(!u.isStandardized)throw new n.A("sql-parse-error","expression is not standardized");const l=u.fieldNames.map(t=>a.get(t)).filter(t=>t&&null!=this._indexMap[t?.name]);t.setWhere(i),t.setWhereEvaluator((t,e,s)=>u.testFeatureCompiled({rowGroup:t,row:e,rowGroupStart:s},o,null)),t.setWhereFields(l.map(t=>t.name))}async*_streamFeatures(t,e,s,i,r){const n=await this._provider.getFiles();let a=0;for(const o of n){const n=a,u=a+o.statistics.rowCount;if(a+=o.statistics.rowCount,null!=e&&e>=u)continue;const l=null!=e?Math.max(e-n,0):null;let h=s;if(null!=s){const t=e??0,i=t+s,r=Math.max(t,n),a=Math.min(i,u);h=Math.max(a-r,0)}if(0===h)continue;const c=await this._createParquetQuery(t,o,l,h,i),d=await o.file,p=await d.executeQuery(c,D),f=async()=>{const t=await p.next(r);if(!t)return null;const e=new k.s(this._metadata,this._indexMap,t,o.id);return tt([new T.j(e,null,0,!1)],this._queryEngineParams)};let m=await f();for(;null!=m;)yield m,m=await f()}}async _queryFeaturesWithQueryEnginePagination(t,e){const s=[],i=this._streamFeatures(t,null,null,null,e);let r=await i.next();for(;!r.done;){const n=await r.value.executeQueryForOpaqueFeatures({...t,where:void 0},e);for(const t of n)s.push(t);r=await i.next()}return s}async _queryFeaturesWithUpfrontPagination(t,e){let s,i,r,n=t.resultOffset??0,a=t.resultRecordCount??D;!function(t){for(const e in t){const s=e;if($(s)&&null!==t[s])return!0}return!1}(t)?(n&&(s=n,n=0),i=t.resultRecordCount):function(t){for(const e in t){const s=e;if(j(s)&&null!==t[s])return!0}return!1}(t)||(r=n+a);const o=[],u=this._streamFeatures(t,s,i,r,e);let l=await u.next();for(;!l.done&&a>0;){const s=await l.value.executeQueryForOpaqueFeatures({...t,where:void 0},e);for(const t of s)if(n>0)n--;else if(o.push(t),--a<=0)return o;l=await u.next()}return o}_enqueueQuery(t,e){return this._queue.push(t,e)}async _executeQuery(t,e){if(t.objectIds?.length){const s=new Map;for(const e of t.objectIds){const t=(0,z.wY)(e),i=(0,z.gE)(e);let r=s.get(t);r||(r=[],s.set(t,r)),r.push(i)}const i=[];for(const[r,n]of s.entries()){const s=await this._executeFileIdQuery(t,r,n,e);for(const t of s)i.push(t)}return new F.G(i,t,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:U,featureIdInfo:this._queryEngineParams.featureIdInfo})}if("1=1"===t.where&&(t.where=null),t.resultOffset??=0,t.resultRecordCount??=await this._getFeatureCount(),t.resultRecordCount>2e7&&(!this._displayOptimization||!t.geometry))throw new n.A("parquet:cannot-execute-query","Unable to execute query, dataset is too large.");const s=!!t.orderByFields?.length||!!t.outStatistics?.length||!!t.returnDistinctValues,i=s?await this._queryFeaturesWithQueryEnginePagination(t,e):await this._queryFeaturesWithUpfrontPagination(t,e);return s||(t.resultOffset=0),new F.G(i,t,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:U,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(t,e,s,i){const r=await this._getRequiredFields(t),n=(await(0,M.N)()).Query.new();n.setOutFields(r),n.setReturnGeometry(!!t.returnGeometry),n.setReturnZ(!!t.returnZ),n.setReturnM(!!t.returnM),n.setIds(new Uint32Array(s));const a=await this._getFile(e),o=await a.executeQuery(n,D,i);let u=await o.next(i),l=0;const h=[];for(;null!=u;){const t=new k.s(this._metadata,this._indexMap,u,e),s=new T.j(t,null,l++,!1);h.push(s),u=await o.next(i)}return tt(h,this._queryEngineParams).executeQueryForOpaqueFeatures(t,i)}async _getRequiredFields(t){const e=new Set;if(t.outStatistics)for(const s of(0,g.g9)(this._fieldsIndex,t.outStatistics,t.groupByFieldsForStatistics))e.add(s);else if(t.outFields)for(const s of t.outFields)e.add(s);return(e.has("*")?this._fieldsIndex.fields.map(t=>t.name):Array.from(e)).filter(t=>null!=this._indexMap[t])}_tryGetGeneralizedGeometryResolution(t){if(!this._displayOptimization)return null;const e=t.outSR??this._queryEngineParams.spatialReference;if(!(0,y.K8)(e)&&!(0,y.oT)(e))return null;const s=t.quantizationParameters?.tolerance??t.maxAllowableOffset;return s?this._sourceResolution(s,e):null}_sourceResolution(t,e){const s=this._queryEngineParams.spatialReference,i=t*((0,d.GA)(e)/(0,d.GA)(s));return!Number.isFinite(i)||i<=0?null:i}}function W(t){switch(t){case"fullText":case"having":case"timeExtent":case"historicMoment":case"aggregateIds":case"uniqueIds":case"gdbVersion":case"objectIds":case"where":case"geometry":case"resultOffset":case"resultRecordCount":return!0;default:return!1}}function $(t){switch(t){case"fullText":case"having":case"timeExtent":case"historicMoment":case"aggregateIds":case"uniqueIds":case"gdbVersion":case"objectIds":case"where":case"geometry":return!0;default:return!1}}function j(t){switch(t){case"fullText":case"having":case"timeExtent":return!0;case"historicMoment":case"aggregateIds":case"uniqueIds":case"gdbVersion":case"objectIds":case"where":case"resultOffset":case"geometry":case"resultRecordCount":return!1}return!1}function J(t){for(const e in t){const s=e;if(W(s)&&null!==t[s])return!0}return!1}function H(t,e){const s="exceedslimit"!==t.statisticType?e.get(t.onStatisticField):null,i="min"!==t.statisticType&&"max"!==t.statisticType||"esriFieldTypeDate"!==s?.type?"esriFieldTypeDouble":s.type;return{name:t.outStatisticFieldName,alias:t.outStatisticFieldName,type:i}}function X(t,e){switch(t.statisticType){case"count":return function(t,e){if("count"!==t.statisticType)return{available:!1,value:null};if("1"===t.onStatisticField)return{available:!0,value:e.reduce((t,e)=>t+e.statistics.rowCount,0)};let s=0;for(const i of e){const e=i.statistics.statistics.get(t.onStatisticField);if(null==e||null==e.nullCount)return{available:!1,value:null};s+=i.statistics.rowCount-e.nullCount}return{available:!0,value:s}}(t,e);case"min":return Y(t,e,Math.min);case"max":return Y(t,e,Math.max);default:return{available:!1,value:null}}}function Y(t,e,s){if("min"!==t.statisticType&&"max"!==t.statisticType)return{available:!1,value:null};let i=null;const r="min"===t.statisticType?"minValue":"maxValue";for(const n of e){const e=n.statistics.statistics.get(t.onStatisticField);if(null==e)return{available:!1,value:null};switch(e.type){case"null-only":continue;case"unknown":return{available:!1,value:null};case"bounds":{const t=K(e[r]);if(null==t)return{available:!1,value:null};i=null==i?t:s(i,t);break}}}return{available:!0,value:i}}function K(t){return"number"==typeof t&&Number.isFinite(t)?t:null}function tt(t,e){const s=new E.I;for(const e of t)s.insert(e);return new w.do({...e,featureStore:s})}function et(t,e){return t.statistics.statistics.get(e.fieldName)??null}function st(t,e){const s=et(t,e);return"bounds"!==s?.type?Number.POSITIVE_INFINITY:s.maxValue-s.minValue}function it(t,e,s){const i=t?.featureCount;let r=!1;return null!=i&&i<(0,o.A)("parquetlayer-full-query-feature-count")&&(r=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:s,supportsTrueCurve:!1,supportsZ:e},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...x.F,maxRecordCount:D,supportsOrderBy:r,supportsDistinct:!0,supportsStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1}},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}},95466(t,e,s){s.d(e,{A:()=>l});var i=s(49186),r=s(53966),n=s(12195),a=s(30524),o=s(98623),u=s(56400);class l{static fromJSON(t){return new l(t.fields,t.timeZoneByFieldName)}static fromLayer(t){return new l(t.fields??[],c(t))}static fromLayerJSON(t){return new l(t.fields??[],c(t))}constructor(t=[],e){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=t||[],this._timeZoneByFieldName=e?new Map(e):null;const s=[];for(const t of this.fields){const e=t?.name,i=(0,a.GZ)(e);if(e&&i){const r=(0,a.NF)(e);this._fieldsMap.set(e,t),this._fieldsMap.set(r,t),this._normalizedFieldsMap.set(i,t),s.push(`${r}:${t.type}:${this._timeZoneByFieldName?.get(e)}`),(0,a.vE)(t)?(this.dateFields.push(t),this._dateFieldsSet.add(t)):(0,a.WA)(t)&&(this._numericFieldsSet.add(t),this.numericFields.push(t)),(0,a.te)(t)||(0,a.Xz)(t)||(t.editable=null==t.editable||!!t.editable,t.nullable=null==t.nullable||!!t.nullable)}}s.sort(),this.uid=s.join()}get requiredFields(){if(!this._requiredFields){this._requiredFields=[];for(const t of this.fields)(0,a.te)(t)||(0,a.Xz)(t)||t.nullable||void 0!==(0,a.lD)(t)||this._requiredFields.push(t)}return this._requiredFields}equals(t){return this.uid===t?.uid}has(t){return null!=this.get(t)}get(t){return(0,a.Vb)({fieldName:t,fieldsMap:this._fieldsMap,normalizedFieldsMap:this._normalizedFieldsMap})}getTimeZone(t){const e=this.get(t&&"string"!=typeof t?t.name:t);return e?this._timeZoneByFieldName?this._timeZoneByFieldName.get(e.name):"date"===e.type||"esriFieldTypeDate"===e.type?(r.A.getLogger("esri.layers.support.FieldsIndex").errorOnce(new i.A("getTimeZone:no-timezone-information",`no time zone information for field '${e.name}'`)),"UTC"):h.has(e.type)?o.L:null:null}isDateField(t){return this._dateFieldsSet.has(this.get(t))}isTimeOnlyField(t){return(0,a.OH)(this.get(t))}isNumericField(t){return this._numericFieldsSet.has(this.get(t))}normalizeFieldName(t){return this.get(t)?.name??void 0}toJSON(){return{fields:this.fields.map(t=>(0,n.W)(t)?t.toJSON():t),timeZoneByFieldName:this._timeZoneByFieldName?Array.from(this._timeZoneByFieldName.entries()):null}}}const h=new Set(["time-only","date-only","timestamp-offset","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"]);function c(t){const e=new Map;if(!t.fields)return e;const s=!0===t.datesInUnknownTimezone,{timeInfo:i,editFieldsInfo:r}=t,n=(i?"startField"in i?i.startField:i.startTimeField:"")??"",l=(i?"endField"in i?i.endField:i.endTimeField:"")??"",c=function(t){return"dateFieldsTimeZone"in t}(t)?t.dateFieldsTimeZone??null:t.dateFieldsTimeReference?(0,u.ZS)(t.dateFieldsTimeReference):null,d=r?function(t){return"timeZone"in t}(r)?r.timeZone??c:r.dateFieldsTimeReference?(0,u.ZS)(r.dateFieldsTimeReference):c??"UTC":null,p=i?function(t){return"timeZone"in t}(i)?i.timeZone??c:i.timeReference?(0,u.ZS)(i.timeReference):c:null,f=new Map([[(0,a.NF)(r?.creationDateField??""),d],[(0,a.NF)(r?.editDateField??""),d],[(0,a.NF)(n),p],[(0,a.NF)(l),p]]);for(const{name:i,type:r}of t.fields)if(h.has(r))e.set(i,o.L);else if("date"!==r&&"esriFieldTypeDate"!==r)e.set(i,null);else if(s)e.set(i,o.L);else{const t=f.get((0,a.NF)(i??""))??c;e.set(i,t)}return e}},34582(t,e,s){s.d(e,{A:()=>o});var i=s(32198),r=s(69540),n=s(25482),a=s(91429);let o=class extends((0,r.OU)(n.o)){constructor(t){super(t),this.type="wkb",this.field=null}};(0,i.Cg)([(0,a.MZ)({type:["wkb"],nonNullable:!0,readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],o.prototype,"type",void 0),(0,i.Cg)([(0,a.MZ)({type:["counter-clockwise"],json:{write:!0}})],o.prototype,"orientation",void 0),(0,i.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],o.prototype,"field",void 0),o=(0,i.Cg)([(0,a.$K)("esri.layers.support.GeometryEncodingWkb")],o)},56370(t,e,s){s.d(e,{A:()=>d});var i=s(32198),r=s(69540),n=s(7762),a=s(49186),o=s(25482),u=s(91429),l=s(64108),h=s(97159),c=s(43937);let d=class extends((0,o.T)(r.Pw)){constructor(t){super(t),this.type="files",this.urls=new n.A}writeUrls(t,e,s,i){const r=t.toArray().map(t=>(0,h.t)(t,i)).filter(t=>!!t);r.length?e.urls=r:i.messages?.push(new a.A("parquet-layer:missing-urls","Missing or empty 'urls'",{data:this}))}};(0,i.Cg)([(0,u.MZ)({type:["files"],nonNullable:!0,readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],d.prototype,"type",void 0),(0,i.Cg)([(0,u.MZ)({type:n.A.ofType(String),json:{write:{isRequired:!0}}})],d.prototype,"urls",void 0),(0,i.Cg)([(0,c.K)("urls")],d.prototype,"writeUrls",null),d=(0,i.Cg)([(0,l.$)("esri.layers.support.ParquetFilesData")],d)},50639(t,e,s){s.d(e,{G:()=>n});var i=s(9075),r=s(34582);function n(t){switch(t.type){case"wkb":return r.A.fromJSON(t);case"location":return i.A.fromJSON(t)}}},42760(t,e,s){s.d(e,{Dt:()=>f,hG:()=>d,nc:()=>p,sA:()=>c}),s(7762);var i=s(49186),r=s(44208),n=s(66552),a=s(16930),o=(s(95031),s(20437)),u=s(30524),l=s(50639);s(56370);const h=new n.J({esriGeometryPoint:"point",esriGeometryPolygon:"polygon",esriGeometryPolyline:"polyline",esriGeometryMultipoint:"multipoint"});function c(t){return h.toJSON(t)}function d(t){return h.fromJSON(t)}async function p(t,e){if(e.geometryType&&e.spatialReference&&e.geometryEncoding&&e.fields&&e.displayOptimization)return e;if(!t)throw new i.A("parquet:bad-input","No metadata found");const s={...e},n=t.fields.map(t=>o.A.fromJSON(t));if(null==s.fields)s.fields=n;else{const t=new Set(s.fields.map(t=>t.name));if(!(0,r.A)("parquetlayer-legacy-field-overrides-enabled"))for(const e of n)t.has(e.name)||s.fields.push(e)}if(null!=s.geometryEncoding){const t=s.geometryEncoding;switch(t.type){case"wkb":{const e=n.find(e=>e.name===t.field);if(!e)throw new i.A("parquet:unsupported",`Geometry encoding references field ${t.field} which does not exist`);if("blob"!==e.type)throw new i.A("parquet:unsupported",`Invalid field type for geometry encoding. Found ${e.type} but expected 'blob'`);break}case"location":for(const e of[t.xField,t.yField])if(null!=e){const t=n.find(t=>t.name===e);if(!t)throw new i.A("parquet:unsupported",`Geometry encoding references field ${e} which does not exist`);if(!(0,u.WA)(t))throw new i.A("parquet:unsupported",`Invalid field type for location geometry encoding. Found ${t.type} but expected a numeric`)}}}return null==s.geometryEncoding&&(s.geometryEncoding=t.geometryEncoding?(0,l.G)(t.geometryEncoding):null),s.fields=function(t,e){const s=e.geoMetadata;if(null==s)return t;const i=new Set(Object.keys(s.columns));return t.filter(t=>!i.has(t.name))}(s.fields,t),!s.displayOptimization&&t.displayOptimization&&(s.displayOptimization=t.displayOptimization),!s.geometryType&&t.geometryType&&(s.geometryType=d(t.geometryType)),!s.spatialReference&&t.spatialReference&&(s.spatialReference=a.A.fromJSON(t.spatialReference)),s}async function f(t,e){switch(t.type){case"files":return{type:"urls",urls:t.urls.toArray()};case"portal-item":{const s=await t.portalItem.load(e);switch(s.type){case"Apache Parquet":return{type:"portal-parquet-file",itemUrl:s.itemUrl,itemCdnUrl:s.itemCdnUrl,modified:s.modified,size:s.size};case"Parquet layer":case"Parquet Layer":case"Parquet feature layer":case"Parquet Feature Layer":if(!s.url)throw new i.A("parquet:bad-item",`Item of type ${s.type} must have a url defined`,s);return{type:"portal-parquet-layer",itemUrl:s.itemUrl,itemCdnUrl:s.itemCdnUrl,itemMetadata:{modified:s.modified,url:s.url}};default:throw new i.A("parquet:bad-item",`Item of type ${s.type} is not supported`,s)}}}}s.d(e,["ye",0,h])}}]);
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5471,9397],{66344(t,e,s){s.d(e,{q:()=>o});const i=!!(0,s(44208).A)("esri-tests-disable-gpu-memory-measurements");Symbol.iterator;class r{get size(){return this._size}constructor(t=10485760,e=.3){this._maxSize=t,this._maxClientSizeRatio=e,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._clients=new Map,this._sizeLimits=new Map}destroy(){this.clearAll(),this._sizeLimits.clear(),this._clients.clear(),this._db.clear()}register(t){this._clients.set(t.id.slice(0,-1),t)}deregister(t){this.clear(t),this._sizeLimits.delete(t),this._clients.delete(t.id.slice(0,-1))}get maxSize(){return this._maxSize}set maxSize(t){this._maxSize=Math.max(t,-1),this._checkSize()}get _maxClientSize(){return this._maxSize*this._maxClientSizeRatio}getSize(t,e){const s=this._db.get(t.id+e);return s?.size??0}put(t,e,s,r,a){e=t.id+e;const o=this._db.get(e);if(o&&(this._size-=o.size,t.size-=o.size,this._db.delete(e),o.entry!==s&&this._notifyRemove(e,o.entry,o.size,0)),r>this._maxSize)return void this._notifyRemove(e,s,r,0);if(void 0===s)return void console.warn("Refusing to cache undefined entry ");if(!r||r<0)return i||console.warn(`Refusing to cache entry with size ${r} for key ${e}`),void this._notifyRemove(e,s,0,0);const u=1+Math.max(a,-4)- -3;this._db.set(e,new n(s,r,u)),this._size+=r,t.size+=r,this._checkSize()}updateSize(t,e){e=t.id+e;const s=this._db.get(e);if(!s)return;this._size-=s.size,t.size-=s.size;let i=s.entry.usedMemory;for(;i>this._maxSize;){const t=this._notifyRemove(e,s.entry,i,1);if(!(null!=t&&t>0))return void this._db.delete(e);i=t}s.size=i,this._size+=i,t.size+=i,this._checkSize()}pop(t,e){e=t.id+e;const s=this._db.get(e);if(s)return this._size-=s.size,t.size-=s.size,this._db.delete(e),++this._hit,s.entry;++this._miss}get(t,e){e=t.id+e;const s=this._db.get(e);if(void 0!==s)return this._db.delete(e),s.lives=s.lifetime,this._db.set(e,s),++this._hit,s.entry;++this._miss}peek(t,e){const s=this._db.get(t.id+e);return s?++this._hit:++this._miss,s?.entry}get performanceInfo(){const t={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},e={},s=new Array;this._db.forEach((t,i)=>{const r=t.lifetime;s[r]=(s[r]||0)+t.size,this._clients.forEach(s=>{const{id:r,name:n}=s;if(i.startsWith(r)){const s=e[n]||0;e[n]=s+t.size}})});const i={};this._clients.forEach(t=>{const s=t.name;if("hitRate"in t&&"number"==typeof t.hitRate&&!isNaN(t.hitRate)&&t.hitRate>0){const r=e[s]||0;e[s]=r,i[s]=Math.round(100*t.hitRate)+"%"}else i[s]="0%"});const r=Object.keys(e);r.sort((t,s)=>e[s]-e[t]),r.forEach(s=>t[s]=Math.round(e[s]/2**20)+"MB / "+i[s]);for(let e=s.length-1;e>=0;--e){const i=s[e];i&&(t["Priority "+(e+-3-1)]=Math.round(i/this._size*100)+"%")}return t}resetStats(){this._hit=this._miss=0,this._clients.forEach(t=>t.resetHitRate())}clear(t){const e=t.id;this._db.forEach((t,s)=>{s.startsWith(e)&&(this._size-=t.size,this._db.delete(s),this._notifyRemove(s,t.entry,t.size,0))}),t.size=0}clearAll(){this._db.forEach((t,e)=>this._notifyRemove(e,t.entry,t.size,0)),this._clients.forEach(t=>t.size=0),this._size=0,this._db.clear()}*values(t){for(const[e,s]of this._db)e.startsWith(t.id)&&(yield s.entry)}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(t,e,s,i){const r=this._clients.get(t.split(a)[0])?.removeFunc,n=r?.(e,i,s);return"number"==typeof n?n:null}_checkSize(){this._sizeLimits.forEach((t,e)=>this._checkSizeLimits(t,e)),this._clients.forEach(t=>this._checkSizeLimits(this._maxClientSize,t)),this._checkSizeLimits(this.maxSize)}setMaxClientSize(t,e){null==e||e<=0?this._sizeLimits.delete(t):this._sizeLimits.set(t,e)}_checkSizeLimits(t,e){const s=e??this;if(s.size<=t)return;const i=e?.id;let r=!0;for(;r;){r=!1;for(const[n,o]of this._db)if(0===o.lifetime&&(!i||n.startsWith(i))){const i=e??this._clients.get(n.split(a)[0]);if(this._purgeItem(n,o,i),s.size<=.9*t)return;r||=this._db.has(n)}}for(const[r,n]of this._db)if(!i||r.startsWith(i)){const i=e??this._clients.get(r.split(a)[0]);if(this._purgeItem(r,n,i),s.size<=.9*t)return}}_purgeItem(t,e,s){if(this._db.delete(t),e.lives<=1){this._size-=e.size,s&&(s.size-=e.size);const i=this._notifyRemove(t,e.entry,e.size,1);null!=i&&i>0&&(this._size+=i,s&&(s.size+=i),e.lives=e.lifetime,e.size=i,this._db.set(t,e))}else--e.lives,this._db.set(t,e)}}new r(0);class n{constructor(t,e,s){this.entry=t,this.size=e,this.lifetime=s,this.lives=s}}const a=":";class o{constructor(t,e){this.removeFunc=e,this.id="",this.name="",this.size=0,this._storage=new r(t,1),this._storage.register(this)}destroy(){this._storage.deregister(this),this._storage.destroy()}put(t,e,s=1){this._storage.put(this,t,e,s,1)}pop(t){return this._storage.pop(this,t)}get(t){return this._storage.get(this,t)}clear(){this._storage.clearAll()}get maxSize(){return this._storage.maxSize}set maxSize(t){this._storage.maxSize=t}resetHitRate(){}}},9775(t,e,s){s.d(e,{A:()=>n});var i=s(62788),r=s(95488);class n{constructor(t=t=>t.values().next().value){this._peeker=t,this._observable=new r.I,this._items=new Set}get length(){return(0,i.gc)(this._observable),this._items.size}clear(){0!==this.length&&(this._items.clear(),this._observable.notify())}last(){if(0===this.length)return;let t;for(t of this._items);return t}peek(){if(0!==this.length)return this._peeker(this._items)}push(t){this.contains(t)||(this._items.add(t),this._observable.notify())}contains(t){return(0,i.gc)(this._observable),this._items.has(t)}pop(){if(0===this.length)return;const t=this.peek();return this._items.delete(t),this._observable.notify(),t}popLast(){if(0===this.length)return;const t=this.last();return this._items.delete(t),this._observable.notify(),t}remove(t){this.contains(t)&&(this._items.delete(t),this._observable.notify())}filter(t){const e=this.length;return this._items.forEach(e=>{t(e)||this._items.delete(e)}),e!==this._items.size&&this._observable.notify(),this}*[Symbol.iterator](){(0,i.gc)(this._observable),yield*this._items}}},69397(t,e,s){s.d(e,{Qf:()=>o,Qh:()=>n,lM:()=>r});var i=s(34275);function r(t){if(!t)return 0;let e=l;for(const s in t)t.hasOwnProperty(s)&&(e+=a(t[s],!1));return e}function n(t){if(!t)return 0;if("number"==typeof t[0])return o(t);if(Array.isArray(t))return function(t){const e=t.length;if(0===e||"number"==typeof t[0])return u(t,8);let s=h;for(let i=0;i<e;i++)s+=a(t[i]);return s}(t);let e=l;for(const s in t)t.hasOwnProperty(s)&&(e+=a(t[s]));return e}function a(t,e=!0){switch(typeof t){case"object":return e?n(t):l;case"string":return function(t){return 32+t.length}(t);case"number":return 16;case"boolean":return 4;default:return 8}}function o(...t){return t.reduce((t,e)=>t+(e?(0,i.iu)(e)?e.byteLength+c:Array.isArray(e)?u(e,16):0:0),0)}function u(t,e){return h+t.length*e}const l=32,h=16,c=145},36745(t,e,s){s.d(e,{z:()=>o});var i=s(4718),r=s(51118),n=s(60408),a=s(92722);class o{static fromOptimized(t,e,s=1){return(new u).initialize(t,e,s)}static fromJSON(t){const[e,s]=h(t),i=(0,n.Pv)(t),r=(0,n.W0)(t);return(new c).initialize(e,s,i,r,1)}static fromOptimizedCIM(t,e,s=1){return(new d).initialize(t,e,s)}static fromJSONCIM(t,e=1){const[s,i]=h(t),r=(0,n.Pv)(t),a=(0,n.W0)(t);return(new p).initialize(s,i,r,a,e)}static fromFeatureSetReader(t){const e=t.readGeometryForDisplay(),s=t.geometryType;return e&&s?this.fromOptimized(e,s):null}static fromFeatureSetReaderCIM(t){const e=t.readGeometryForDisplay(),s=t.geometryType;return e&&s?this.fromOptimizedCIM(e,s):null}static createEmptyOptimized(t,e=!1,s=!1,i=1){return(new d).initialize(new a.A([],[],e,s),t,i)}static createEmptyJSON(t,e=!1,s=!1){return(new c).initialize([],t,e,s,1)}static createEmptyOptimizedCIM(t,e=!1,s=!1,i=1){return(new d).initialize(new a.A([],[],e,s),t,i)}static createEmptyJSONCIM(t,e=!1,s=!1,i=1){return(new p).initialize([],t,e,s,i)}asJSON(){const t=(0,r.x)(this),{hasZ:e,hasM:s}=this;return"esriGeometryEnvelope"===this.geometryType?{xmin:t[0][0][0],ymin:t[0][0][1],xmax:t[0][2][0],ymax:t[0][2][1]}:"esriGeometryMultipoint"===this.geometryType?{points:t.flat(),hasZ:e,hasM:s}:"esriGeometryPoint"===this.geometryType?{x:t[0][0][0],y:t[0][0][1],z:e?t[0][0][2]:void 0,m:s?t[0][0][e?3:2]:void 0}:"esriGeometryPolygon"===this.geometryType?{rings:t,hasZ:e,hasM:s}:{paths:t,hasZ:e,hasM:s}}getCurrentRingArea(){if(this.pathSize<3)return 0;let t,e,s=0;if(this.seekPathStart(),!this.nextPoint())return 0;t=this.x,e=this.y;const i=t,r=e;for(;this.nextPoint();)s+=(t-this.x)*(e+this.y),t=this.x,e=this.y;return s+=(t-i)*(e+r),-.5*s}invertY(){this.yFactor*=-1}}class u extends o{constructor(){super(...arguments),this._end=-1}get hasZ(){return this._geometry?.hasZ}get hasM(){return this._geometry?.hasM}initialize(t,e,s){return this.geometryType=e,this._stride=t.stride,this._geometry=t,this._pathIndex=-1,this._pathOffset=0,this._pointOffset=-this._stride,this._end=-1,this.yFactor=s,this}reset(){this.initialize(this._geometry,this.geometryType,this.yFactor)}seekPath(t){if(t>=0&&t<this.totalSize){if(this._pathIndex<t)for(;this._pathIndex<t&&this.nextPath(););else if(this._pathIndex>t)for(;this._pathIndex>t&&this.prevPath(););return!0}return!1}seekPathStart(){this._pointOffset=this._pathOffset-this._stride}seekPathEnd(){this._pointOffset=this._end}seekInPath(t){const e=this._pathOffset+t*this._stride;return e>=0&&e<this._end&&(this._pointOffset=e,!0)}nextPoint(){return(this._pointOffset+=this._stride)<this._end}prevPoint(){return(this._pointOffset-=this._stride)>=this._pathOffset}nextPath(){return!(this.pathIndex>=this.totalSize-1||(this._pathIndex>=0&&(this._pathOffset+=this._stride*this.pathSize),this._pathIndex++,this._pointOffset=this._pathOffset-this._stride,this._end=this._pointOffset+this._stride+this._stride*this.pathSize,0))}prevPath(){return!(this.pathIndex<=0||(this._pathIndex--,this._end=this._pathOffset,this._pathOffset-=this._stride*this.pathSize,this._pointOffset=this._pathOffset-this._stride,0))}getCurrentPath(){const t=this._end,e=this._geometry.coords,s=this._pathOffset;return(new u).initialize(new a.A([this.pathSize],e.slice(s,t),this.hasZ,this.hasM),this.geometryType,this.yFactor)}pathLength(){const t=this._end,e=this._stride,s=this._geometry.coords;let i=0;for(let r=this._pathOffset+e;r<t;r+=e){const t=s[r-e],n=s[r-e+1],a=s[r]-t,o=s[r+1]-n;i+=Math.sqrt(a*a+o*o)}return i}startPath(){this._geometry.lengths.push(0)}pushPath(t){this.startPath(),this.pushPoints(t)}pushPoint(t){for(let e=0;e<this._stride;++e)this._geometry.coords.push(t[e]);this._geometry.lengths[this.totalSize-1]++}pushXY(t,e){this._geometry.coords.push(t,e),this._geometry.lengths[this.totalSize-1]++}pushPoints(t){for(const e of t)for(let t=0;t<this._stride;++t)this._geometry.coords.push(e[t]);this._geometry.lengths[this.totalSize-1]+=t.length}pushCursor(t){const e=t.asOptimized();this._geometry.coords.push(...e.coords),this._geometry.lengths.push(...e.lengths)}asOptimized(){const t=this._geometry.clone();if(1!==this.yFactor)for(let e=1;e<t.coords.length;e+=this._stride)t.coords[e]*=this.yFactor;return"esriGeometryPoint"===this.geometryType&&(t.lengths.length=0),t}isClosed(){const t=this._geometry.coords,e=this._pathOffset,s=this._end-this._stride;for(let i=0;i<this._stride;i++)if(t[e+i]!==t[s+i])return!1;return!0}clone(){return(new u).initialize(this._geometry.clone(),this.geometryType,this.yFactor)}get totalPoints(){return this._geometry.isPoint?1:this._geometry.lengths.reduce((t,e)=>t+e)}get pathSize(){const{lengths:t}=this._geometry;return this._geometry.isPoint?1:this._pathIndex<0||this._pathIndex>t.length-1?0:t[this._pathIndex]}get totalSize(){return this._geometry.isPoint?1:this._geometry.lengths.length}get x(){return this._geometry.coords[this._pointOffset]}set x(t){this._geometry.coords[this._pointOffset]=t}get y(){return this.yFactor*this._geometry.coords[this._pointOffset+1]}set y(t){this._geometry.coords[this._pointOffset+1]=this.yFactor*t}get z(){return this._geometry.coords[this._pointOffset+2]}set z(t){this._geometry.coords[this._pointOffset+2]=t}get m(){const t=this.hasZ?3:2;return this._geometry.coords[this._pointOffset+t]}set m(t){this._geometry.coords[this._pointOffset+3]=t}get pathIndex(){return this._pathIndex}get _coordIndex(){return this._pointOffset/this._stride}}function l(t){const e=[t.x,t.y];return t.z&&e.push(t.z),t.m&&e.push(t.m),e}function h(t){return(0,n.Bi)(t)?[t.rings,"esriGeometryPolygon"]:(0,n.Rg)(t)?[t.paths,"esriGeometryPolyline"]:(0,n.U9)(t)?[[t.points],"esriGeometryMultipoint"]:(0,n.ZC)(t)?[[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]],"esriGeometryEnvelope"]:(0,n.fT)(t)?[[[l(t)]],"esriGeometryPoint"]:[[],"esriGeometryPolyline"]}class c extends o{initialize(t,e,s,i,r){return this._paths=t,this.geometryType=e,this.hasZ=s,this.hasM=i,this._pathIndex=this._pointIndex=-1,this.yFactor=r,this._mIndex=this.hasZ?3:2,this}reset(){this._pathIndex=this._pointIndex=-1}seekPath(t){return this._pathIndex=t,this._pointIndex=-1,t>=0&&t<this.totalSize&&(this._currentPath=this._paths[t],!0)}seekPathStart(){this._pointIndex=-1}seekPathEnd(){this._pointIndex=this._currentPath.length}seekInPath(t){return t>=0&&t<this._currentPath.length&&(this._pointIndex=t,this._currentPoint=this._currentPath[this._pointIndex],!0)}nextPoint(){return this._currentPoint=this._currentPath[++this._pointIndex],this._pointIndex<this._currentPath.length}prevPoint(){return this._currentPoint=this._currentPath[--this._pointIndex],this._pointIndex>=0}nextPath(){return this._pointIndex=-1,this._currentPath=this._paths[++this._pathIndex],this._pathIndex<this.totalSize}prevPath(){return this.pathIndex>0&&(this._pointIndex=-1,this._pathIndex--,this._currentPath=this._paths[this._pathIndex],!0)}pathLength(){const t=this._currentPath.length,e=this._currentPath;let s=0;for(let i=1;i<t;i++){const t=e[i-1],r=e[i],n=t[0],a=t[1],o=r[0]-n,u=r[1]-a;s+=Math.sqrt(o*o+u*u)}return s}startPath(){this._paths.push([])}getCurrentPath(){return(new c).initialize([this._currentPath],this.geometryType,this.hasZ,this.hasM,this.yFactor)}pushPath(t){this._paths.push(t)}pushPoint(t){this._paths[this.totalSize-1].push(t)}pushXY(t,e){this._paths[this.totalSize-1].push([t,e])}pushPoints(t){this._paths[this.totalSize-1].push(...t)}pushCursor(t){const e=(0,r.x)(t);for(const t of e)this.pushPath(t)}asOptimized(){const{hasZ:t,hasM:e}=this,s=new a.A([],[],t,e),{coords:i,lengths:r}=s;if("esriGeometryPoint"===this.geometryType)i.push(...this._paths[0][0]),r.length=0;else for(const s of this._paths){for(const r of s)i.push(r[0]),i.push(r[1]*this.yFactor),t&&i.push(r[2]),e&&i.push(r[this._mIndex]);r.push(s.length)}return s}isClosed(){const t=this._currentPath[0],e=this._currentPath[this._currentPath.length-1];for(let s=0;s<t.length;s++)if(t[s]!==e[s])return!1;return!0}clone(){return(new c).initialize((0,i.o8)(this._paths),this.geometryType,this.hasZ,this.hasM,this.yFactor)}get totalPoints(){return this._paths.map(t=>t.length).reduce((t,e)=>t+e)}get pathSize(){return this._pathIndex<0||this._pathIndex>this.totalSize-1?-1:this._paths[this._pathIndex].length}get totalSize(){return this._paths.length}get x(){return this._currentPoint[0]}set x(t){this._currentPoint[0]=t}get y(){return this.yFactor*this._currentPoint[1]}set y(t){this._currentPoint[1]=this.yFactor*t}get z(){return this._currentPoint[2]}set z(t){this._currentPoint[2]=t}get m(){return this._currentPoint[this._mIndex]}set m(t){this._currentPoint[this._mIndex]=t}get pathIndex(){return this._pathIndex}}class d extends u{initialize(t,e,s){return super.initialize(t,e,s),this._controlPoints||(this._controlPoints=this._controlPoints=new Array(this.totalSize).fill(void 0).map(t=>new Set)),this}startPath(){super.startPath(),this._controlPoints.push(new Set)}clone(){const t=(new d).initialize(this._geometry.clone(),this.geometryType,this.yFactor);return t._controlPoints=this._controlPoints,t}setControlPoint(){this._controlPoints[this.pathIndex].add(this._coordIndex)}getControlPoint(){return this._controlPoints[this.pathIndex].has(this._coordIndex)}setControlPointAt(t){this._controlPoints[this.pathIndex].add(t)}getControlPointAt(t){return this._controlPoints[this.pathIndex].has(t)}}class p extends c{initialize(t,e,s,i,r){return super.initialize(t,e,s,i,r)}clone(){return(new p).initialize((0,i.o8)(this._paths),this.geometryType,this.hasZ,this.hasM,this.yFactor)}setControlPoint(){this._paths[this.pathIndex][this._pointIndex][4]=1}getControlPoint(){return 1===this._paths[this.pathIndex][this._pointIndex][4]}setControlPointAt(t){this._paths[this.pathIndex][t][4]=1}getControlPointAt(t){return 1===this._paths[this.pathIndex][t][4]}}},65864(t,e,s){s.d(e,{rS:()=>h,xD:()=>d});var i=s(5443),r=s(91075),n=s(48526),a=s(86738),o=s(39829),u=s(82799),l=s(60408);function h(t){return null==t?null:t instanceof r.A?t:(0,l.fT)(t)?a.A.fromJSON(t):(0,l.Rg)(t)?u.A.fromJSON(t):(0,l.Bi)(t)?o.A.fromJSON(t):(0,l.U9)(t)?n.A.fromJSON(t):(0,l.ZC)(t)?i.A.fromJSON(t):null}const c={esriGeometryPoint:a.A,esriGeometryPolyline:u.A,esriGeometryPolygon:o.A,esriGeometryEnvelope:i.A,esriGeometryMultipoint:n.A,esriGeometryMultiPatch:o.A};function d(t){return t&&c[t]||null}},78957(t,e,s){s.d(e,{d:()=>h,R:()=>F});class i{constructor(t=r){this._data=[],this._compare=t}get size(){return this._data.length}enqueue(t){if(null==t)return;const{_data:e,_compare:s}=this;e.push(t);let i=e.length-1>>>0;const r=e[i];for(;i>0;){const t=i-1>>1,n=e[t];if(!(s(n,r)<=0))break;e[t]=r,e[i]=n,i=t}}dequeue(){const{_data:t,_compare:e}=this,s=t[0],i=t.pop();if(0===t.length)return s;t[0]=i;let r=0;const n=t.length,a=t[0];let o,u,l=null;for(;;){const s=2*r+1,i=2*r+2;if(l=null,s<n&&(o=t[s],e(o,a)>0&&(l=s)),i<n&&(u=t[i],(null===l&&e(u,a)<=0||null!==l&&e(u,o)<=0)&&(l=i)),null===l)break;t[r]=t[l],t[l]=a,r=l}return s}}const r=(t,e)=>t<e?-1:t>e?1:0;var n=s(19419),a=s(537),o=s(12359),u=s(95108),l=s(12176);function h(t){if(0===t.totalSize)return null;const e=(0,a.z8)(t);if(!e)return null;const s=4*(Math.abs(e[0])+Math.abs(e[2])+Math.abs(e[1])+Math.abs(e[3])+1)*222045e-19;let i=0,r=0;t.reset();for(let e=0;t.nextPath();e++){const s=t.getCurrentRingArea();s>r&&(r=s,i=e)}if(t.seekPath(i),0===t.pathSize)return null;t.seekPathStart();const u=(0,a.B$)(t);if(Math.abs(r)<=2*s*s)return[(u[0]+u[2])/2,(u[1]+u[3])/2];t.seekPathStart();const l=(0,o.w2)(t,(0,n.vt)());if(null===l)return null;if(t.totalPoints<4)return l;const h=[[NaN,NaN],[NaN,NaN],[NaN,NaN],[NaN,NaN]],f=[NaN,NaN,NaN,NaN],m=[NaN,NaN,NaN,NaN];let y=!1,x=d(l,t,!0);0===x.distance&&(y=!0,h[0][0]=l[0],h[0][1]=l[1],x=d(l,t,!1)),f[0]=x.distance,m[0]=0;const F=[NaN,NaN];let S=!1,P=.25,v=-1,I=NaN;do{if(I=NaN,h[1]=p(t,_(u[0],u[2],P),0,e),isNaN(h[1][0])||isNaN(h[1][1])||(x=d(h[1],t,!1),I=x.distance),!isNaN(I)&&I>s&&c(h[1],t))S=!0,f[1]=I,m[1]=g(h[1],l);else if(!isNaN(I)&&I>v&&(v=I,F[0]=h[1][0],F[1]=h[1][1]),P-=.01,P<.1){if(!(v>=0))break;S=!0,f[1]=v,h[1][0]=F[0],h[1][1]=F[1],m[1]=g(h[1],l)}}while(!S);S=!1,P=.5,v=-1;let z=.01,b=1;do{if(I=NaN,h[2]=p(t,_(u[0],u[2],P),0,e),isNaN(h[2][0])||isNaN(h[2][1])||(x=d(h[2],t,!1),I=x.distance),!isNaN(I)&&I>s&&c(h[2],t))S=!0,f[2]=I,m[2]=g(h[2],l);else if(!isNaN(I)&&I>v)v=I,F[0]=h[2][0],F[1]=h[2][1];else if(I>v&&(v=I,F[0]=h[2][0],F[1]=h[2][1]),P=.5+z*b,z+=.01,b*=-1,P<.3||P>.7){if(!(v>=0))break;S=!0,f[2]=v,h[2][0]=F[0],h[2][1]=F[1],m[2]=g(h[2],l)}}while(!S);S=!1,P=.75,v=-1;do{if(I=NaN,h[3]=p(t,_(u[0],u[2],P),0,e),isNaN(h[3][0])||isNaN(h[3][1])||(x=d(h[3],t,!1),I=x.distance),!isNaN(I)&&I>s&&c(h[3],t))S=!0,f[3]=I,m[3]=g(h[3],l);else if(I>v&&(v=I,F[0]=h[3][0],F[1]=h[3][1]),P+=.01,P>.9){if(!(v>=0))break;S=!0,f[3]=v,h[3][0]=F[0],h[3][1]=F[1],m[3]=g(h[3],l)}}while(!S);const R=[0,1,2,3],C=y?0:1;let N;for(let t=C;t<4;t++)for(let t=C;t<3;t++){const e=m[t],s=m[t+1];w(e,s)>0&&(N=R[t],R[t]=R[t+1],R[t+1]=N,m[t]=s,m[t+1]=e)}let q=C,M=0,O=0;for(let t=C;t<4;t++){switch(t){case 0:O=2*f[R[t]];break;case 1:O=1.66666666*f[R[t]];break;case 2:O=1.33333333*f[R[t]];break;case 3:O=f[R[t]]}O>M&&(M=O,q=R[t])}return h[q]}function c(t,e){let s,i,r,n,a=0;for(e.reset();e.nextPath()&&e.nextPoint();)for(s=e.x,i=e.y;e.nextPoint();s=r,i=n)r=e.x,n=e.y,i>t[1]!=n>t[1]&&((r-s)*(t[1]-i)-(n-i)*(t[0]-s)>0?a++:a--);return 0!==a}function d(t,e,s){if(s&&c(t,e))return{coord:t,distance:0};let i=1/0,r=0,n=0,a=[0,0],o=[0,0];const l=[0,0];for(e.reset();e.nextPath()&&e.nextPoint();)if(!(e.pathSize<2))for(a[0]=e.x,a[1]=e.y;e.nextPoint();a=o){o=[e.x,e.y],(0,u.gR)(l,t,a,o);const s=g(t,l);s<i&&(i=s,r=l[0],n=l[1])}return{coord:[r,n],distance:Math.sqrt(i)}}function p(t,e,s,i){const r=[e,0];let a=1/0,o=1/0,u=!1,h=!1;const c=[[e,i[1]-1],[e,i[3]+1]],d=[0,0],p=[0,0],y=[0,0],_=[[0,0],[0,0]],g=(0,n.vt)();for(t.reset();t.nextPath()&&t.nextPoint();)if(!(t.pathSize<2))for(_[0][0]=t.x,_[0][1]=t.y;t.nextPoint();_[0][0]=_[1][0],_[0][1]=_[1][1]){if(_[1][0]=t.x,_[1][1]=t.y,null===f(g,_))continue;if(p[0]=c[0][0],p[1]=c[0][1],y[0]=c[1][0],y[1]=c[1][1],0===m(g,p,y))continue;if(!(0,l.Ql)(c[0],c[1],_[0],_[1],d))continue;const e=d[1];a>o?e<a&&(a=e,u=!0):e<o&&(o=e,h=!0)}return u&&h?r[1]=(a+o)/2:r[0]=r[1]=NaN,r}function f(t,e){if(e.length<2)return null;t||(t=(0,n.vt)());const[s,i]=e[0],[r,a]=e[1];return t[0]=Math.min(s,r),t[1]=Math.min(i,a),t[2]=Math.max(s,r),t[3]=Math.max(i,a),t}function m(t,e,s){let i=y(e,t),r=y(s,t);const n=t[0],a=t[1],o=t[2],u=t[3];if(i&r)return 0;if(!(i|r))return 4;const l=(i?1:0)|(r?2:0);do{const l=s[0]-e[0],h=s[1]-e[1];if(l>h)3&i?(1&i?(e[1]+=h*(n-e[0])/l,e[0]=n):(e[1]+=h*(o-e[0])/l,e[0]=o),i=y(e,t)):3&r?(1&r?(s[1]+=h*(n-s[0])/l,s[0]=n):(s[1]+=h*(o-s[0])/l,s[0]=o),r=y(s,t)):i?(4&i?(e[0]+=l*(a-e[1])/h,e[1]=a):(e[0]+=l*(u-e[1])/h,e[1]=u),i=y(e,t)):(4&r?(s[0]+=l*(a-s[1])/h,s[1]=a):(s[0]+=l*(u-s[1])/h,s[1]=u),r=y(s,t));else if(12&i?(4&i?(e[0]+=l*(a-e[1])/h,e[1]=a):(e[0]+=l*(u-e[1])/h,e[1]=u),i=y(e,t)):12&r?(4&r?(s[0]+=l*(a-s[1])/h,s[1]=a):(s[0]+=l*(u-s[1])/h,s[1]=u),r=y(s,t)):i?(1&i?(e[1]+=h*(n-e[0])/l,e[0]=n):(e[1]+=h*(o-e[0])/l,e[0]=o),i=y(e,t)):(1&r?(s[1]+=h*(n-s[0])/l,s[0]=n):(s[1]+=h*(o-s[0])/l,s[0]=o),r=y(s,t)),i&r)return 0}while(i|r);return l}function y(t,e){return(t[0]<e[0]?1:0)|(t[0]>e[2]?1:0)<<1|(t[1]<e[1]?1:0)<<2|(t[1]>e[3]?1:0)<<3}function _(t,e,s){return t+(e-t)*s}function g(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function w(t,e){if(t<e)return-1;if(t>e)return 1;if(t===e)return 0;const s=isNaN(t),i=isNaN(e);return s<i?-1:s>i?1:0}class x{constructor(t,e,s,i){this.x=t,this.y=e,this.cellSize=s,this.distancefromCellCenter=(0,u.Xf)(t,e,i),this.maxDistanceToPolygon=this.distancefromCellCenter+this.cellSize*Math.SQRT2}}function F(t){if(!t.nextPath()||!t.pathSize)return null;const e=(0,a.B$)(t),s=e[2]-e[0],r=e[3]-e[1];if(0===s||0===r)return[e[0]+s/2,e[1]+r/2];const n=Math.max(Math.min(s,r)/100,1),u=new i((t,e)=>e.maxDistanceToPolygon-t.maxDistanceToPolygon),l=Math.min(s,r);let h=l/2,c=0,d=0;for(c=e[0];c<e[2];c+=l)for(d=e[1];d<e[3];d+=l)u.enqueue(new x(c+h,d+h,h,t));t.reset(),t.nextPath();const p=(0,o.IK)(t);if(null===p)return null;let f,m=new x(p[0],p[1],0,t);for(;u.size>0;)f=u.dequeue(),f.distancefromCellCenter>m.distancefromCellCenter&&(m=f),f.maxDistanceToPolygon-m.distancefromCellCenter<=n||(h=f.cellSize/2,u.enqueue(new x(f.x-h,f.y-h,h,t)),u.enqueue(new x(f.x+h,f.y-h,h,t)),u.enqueue(new x(f.x-h,f.y+h,h,t)),u.enqueue(new x(f.x+h,f.y+h,h,t)));return[m.x,m.y]}},62815(t,e,s){s.d(e,{N:()=>o,d:()=>u});var i=s(86211),r=s(73941),n=s(21325),a=s(52006);function o(t,e,s){const i=u(e,s);if(1!==i)switch(t){case"point":case"esriGeometryPoint":return t=>function(t,e){null!=t?.z&&(t.z*=e)}(t,i);case"polyline":case"esriGeometryPolyline":return t=>function(t,e){if(t){if(t.curvePaths)for(const s of t.curvePaths)for(const t of s){const s=(0,a.yP)(t);s.length>2&&(s[2]*=e)}if(t.paths)for(const s of t.paths)for(const t of s)t.length>2&&(t[2]*=e)}}(t,i);case"polygon":case"esriGeometryPolygon":return t=>function(t,e){if(t){if(t.curveRings)for(const s of t.curveRings)for(const t of s){const s=(0,a.yP)(t);s.length>2&&(s[2]*=e)}if(t.rings)for(const s of t.rings)for(const t of s)t.length>2&&(t[2]*=e)}}(t,i);case"multipoint":case"esriGeometryMultipoint":return t=>function(t,e){if(t)for(const s of t.points)s.length>2&&(s[2]*=e)}(t,i);case"extent":case"esriGeometryEnvelope":return t=>function(t,e){t&&null!=t.zmin&&null!=t.zmax&&(t.zmin*=e,t.zmax*=e)}(t,i);default:return}}function u(t,e){return null==t||null==e||(0,n.aI)(t,e)||(0,r.xP)(t)||(0,r.xP)(e)?1:(0,i.G9)(t)/(0,i.G9)(e)}},24460(t,e,s){function i(t){const{minValue:e,maxValue:s,numValues:i,nullCount:r,distinctCount:n}=t;return null!=i&&r===i?{type:"null-only",nullCount:r,distinctCount:n}:"number"==typeof e&&Number.isFinite(e)&&"number"==typeof s&&Number.isFinite(s)&&e<=s?{type:"bounds",minValue:e,maxValue:s,nullCount:r,distinctCount:n}:null!=e||null!=s||null!=n||null!=r?{type:"unknown",nullCount:r,distinctCount:n}:null}function r(t){const e=new Map;for(const s of t.files){const t=n(s);e.set(s.name,t)}return e}function n(t){const e=new Map;for(const s of t.statistics??[]){const t=s.column.at(-1);if(null==t)continue;const r=i({minValue:s.minValue,maxValue:s.maxValue,numValues:null,nullCount:s.nullCount??0,distinctCount:s.distinctCount??null});null!=r&&e.set(t,r)}return new o(0,0,e)}function a(t){const e=t.minValue(),s=t.maxValue(),r=t.numValues(),n=t.distinctCount()??null;return i({minValue:e,maxValue:s,numValues:r,nullCount:t.nullCount()??null,distinctCount:n})}s.d(e,{Hk:()=>a,MB:()=>o,t8:()=>r});class o{static fromFile(t){const e=t.numRows(),s=t.byteLength(),i=new Map;for(const e of t.getColumnDescriptors()){const t=a(e);null!=t&&i.set(e.name(),t),e.free()}return new o(e,s,i)}constructor(t,e,s){this.rowCount=t,this.byteSize=e,this.statistics=s}}},95031(t,e,s){s.d(e,{M:()=>P});var i=s(11254),r=s(32198),n=s(49186),a=s(65529),o=s(44208),u=s(563),l=s(84952),h=s(53929),c=s(24460);class d{static async create(t,e,s,i,r){if(!r){const r=await(0,h.DV)(s,{geometryInfo:t,provider:e}),n=c.MB.fromFile(r);return new d(t,e,s,i,n,Promise.resolve(r))}return new d(t,e,s,i,r,null)}constructor(t,e,s,i,r,n){this._geometryInfo=t,this._provider=e,this.url=s,this.id=i,this.statistics=r,this._file=n}destroy(){null!=this._file&&this._file.then(t=>t.free())}get file(){return null==this._file&&(this._file=(0,h.DV)(this.url,{geometryInfo:this._geometryInfo,provider:this._provider})),this._file}async getDiagnosticsSnapshot(){return{...(await this.file).diagnosticsSnapshot(),fileId:this.id,fileName:this.url}}async getColumnIndex(t,e){return(await this.file).columnIndex(t,e)}async getOffsetIndex(t,e){return(await this.file).offsetIndex(t,e)}}const p="_spatial.json",f=new u.QueueProcessor({concurrency:12,process:async t=>{const{data:e}=await(0,i.A)(t.url,t.options);return e}});let m=1;class y{constructor(t,e=()=>{}){this._geometryInfo=t,this._getCustomParameters=e,this.events=new a.bk}async destroy(){await this.clear()}async clear(){if(this._infos){const t=await this._infos;for(const e of t.values())e.destroy();t.clear(),this._infos=null}}async getMetadata(){const t={stack:[],error:void 0,hasError:!1};try{const e=(await this._getParquetFileNames()).at(0);if(!e)return null;const s=(0,r.mS)(t,await(0,h.DV)(e,{provider:this}),!1);return(0,h._6)(s)}catch(e){t.error=e,t.hasError=!0}finally{(0,r.hk)(t)}}getGeometryInfo(){return this._geometryInfo}async getFiles(){const t=await this._getInfoMap();return Array.from(t.values())}async updateGeometryInfo(t){if(this._geometryInfo)throw new Error("GeometryInfo already set");await this.clear(),this._geometryInfo=t}async fetchLength(t){const{byteLength:e,cacheTag:s}=await this._fetchLengthAndTag(t);if(!(0,o.A)("parquetlayer-cache-enabled"))return e;try{await this._createOrResetCache(t,s)}catch(t){}return e}async fetchRange(t,e,s,i){const r={fileId:t,requestId:m++,range:{start:e,end:s+1}};this.events.emit("rangeRead",{...r,phase:"start"});try{const n=await this._fetchRangeWithCache(t,e,s,i);return this.events.emit("rangeRead",{...r,phase:"complete"}),n}catch(t){throw this.events.emit("rangeRead",{...r,phase:"error"}),t}}_getCacheFileName(t){return t}async _requestStatistics(t){const{data:e}=await(0,i.A)(t,{responseType:"json",query:this._getCustomParameters()});return e}async _fetchRange(t,e,s,i){const r={url:t,options:{responseType:"array-buffer",query:this._getCustomParameters()??{},cacheMode:"no-store",useQueue:!0,headers:{range:`bytes=${e}-${s}`}}},a=await f.push(r),o=s-e+1;if(a.byteLength!==o)throw new n.A("InvalidRangeRequest",`request returned ${a.byteLength} bytes for range ${e}-${s}, expected ${o}.`);return a}async _fetchLengthAndTag(t){if((0,l.w8)(t)){const{data:e}=await(0,i.A)(t,{responseType:"blob"});return{byteLength:e.size,cacheTag:null}}const e=await this._requestHead(t),s=e.headers.get("Content-Length");if(null==s)throw new Error("Unable to parse content length");const r=e.headers.get("etag")??e.headers.get("Last-Modified");return{byteLength:parseInt(s,10),cacheTag:r}}async _getInfoMap(){return this._infos||(this._infos=this._fetchParquetFiles()),this._infos}async _updateParquetFileInfos(t){const e=await this._getInfoMap(),s=new Set(t);for(const t of s)if(!e.get(t)){const s=e.size,i=await d.create(this.getGeometryInfo(),this,t,s,null);e.set(t,i)}for(const t of e.keys())if(!s.has(t))throw new Error("Deletion not supported")}async _getFileStatistics(t){this._statistics||(this._statistics=this._fetchStatistics());const e=await this._statistics,s=function(t){return t.split(/[?#]/)[0].split("/").at(-1)??t}(t);return e.get(s)}async _fetchParquetFiles(){const t=(await this._getParquetFileNames()).map(async(t,e)=>{const s=e,i=await this._getFileStatistics(t);return d.create(this.getGeometryInfo(),this,t,s,i)}),e=await Promise.all(t),s=new Map;for(const t of e)s.set(t.url,t);return s}async _fetchStatistics(){const t=await this._getStatisticsFileName();if(null==t)return new Map;const e=await this._resolveFileUrl(t),s=await this._requestStatistics(e);return(0,c.t8)(s)}async _requestHead(t){const{data:e}=await(0,i.A)(t,{responseType:"native",method:"head",query:this._getCustomParameters()});return e}async _openCache(t){return caches.open(this._getCacheName(t))}async _fetchRangeWithCache(t,e,s,i){if(!(0,o.A)("parquetlayer-cache-enabled"))return this._fetchRange(t,e,s,i);const r=new URL(this._getCacheFileName(t));r.searchParams.append("range",`${e}-${s}`);try{const n=await this._openCache(t),a=await n.match(r);if(a)return await a.arrayBuffer();const o=await this._fetchRange(t,e,s,i);return await n.put(r,new Response(o,{headers:{"Content-Type":"application/octet-stream","Content-Length":o.byteLength.toString()}})),o}catch(r){return this._fetchRange(t,e,s,i)}}_getCacheName(t){return`parquet.v1:${this._getCacheFileName(t)}`}async _createOrResetCache(t,e){const s=this._getCacheName(t),i=new URL(this._getCacheFileName(t));if(i.searchParams.append("metadata","true"),null==e)return void await caches.delete(s);let r=await caches.open(s);const n=await r.match(i),a=await(n?.json());a?.tag!==e&&(await caches.delete(s),r=await caches.open(s));const o=JSON.stringify({tag:e});await r.put(i,new Response(o,{headers:{"Content-Type":"application/json","Content-Length":o.length.toString()}}))}}function _(t){const e=t.split(/[?#]/)[0];return e===p||e.endsWith(p)}var g=s(39131);class w extends y{constructor(t,e,s){super(e,s),this._schema=t,this._isAgol=!!(0,g.py)(this._schema.itemUrl)}async update(t){throw new Error("Unsupported")}async _getParquetFileNames(){return[`${this._baseUrl}/data`]}async _getStatisticsFileName(){return null}_getCacheFileName(t){return`${this._baseUrl}/data`}async _resolveFileUrl(t){return this._resolvedUrl||(this._resolvedUrl=this._fetchResolvedUrl()),this._resolvedUrl}async _fetchLengthAndTag(t){const e=await super._fetchLengthAndTag(t);return e.cacheTag=this._schema.modified.getTime().toString(),e}async _fetchRange(t,e,s,i){try{const r=await this._resolveFileUrl(t);return await super._fetchRange(r,e,s,i)}catch{this._resolvedUrl=null}const r=await this._resolveFileUrl(t);return super._fetchRange(r,e,s,i)}get _baseUrl(){return this._schema.itemCdnUrl??this._schema.itemUrl}async _fetchResolvedUrl(){return this._isAgol?(await(0,i.A)(`${this._baseUrl}/data`,{query:{signedurl:!0,expiration:9,f:"json"}})).data.signedUrl:`${this._baseUrl}/data`}}var x=s(47828);class F extends y{constructor(t,e,s){super(e,s),this._schema=t,this._directoryChanged=!1}get _baseUrl(){return this._schema.itemCdnUrl??this._schema.itemUrl}async update(t){throw new Error("Unsupported")}async _getParquetFileNames(){const t=await this._getResources();return Array.from(t.keys()).filter(t=>t.endsWith(".parquet"))}async _getStatisticsFileName(){const t=await this._getResources();return Array.from(t.keys()).find(_)??null}_getCacheFileName(t){return`${this._baseUrl}/resources/${t}`}async _resolveFileUrl(t){const e=await this._getResource(t);return e.signedUrl?e.signedUrl:`${this._baseUrl}/resources/${t}`}async _fetchLengthAndTag(t){const e=await this._getResource(t),s=this._schema.itemMetadata.modified.getTime().toString();return{byteLength:e.size,cacheTag:s}}async _fetchRange(t,e,s,i){if(this._directoryChanged)throw(0,x.O)();try{const r=await this._resolveFileUrl(t);return await super._fetchRange(r,e,s,i)}catch{if("directory-changed"===await this._refetchResources())throw(0,x.O)()}const r=await this._resolveFileUrl(t);return super._fetchRange(r,e,s,i)}_refetchResources(){return this._directoryChanged?Promise.resolve("directory-changed"):(this._updateResourcesPromise||(this._updateResourcesPromise=this._executeRefetchResources().finally(()=>{this._updateResourcesPromise=null})),this._updateResourcesPromise)}async _executeRefetchResources(){return await this._refetchPortalItemMetadata()?(this.events.emit("sourceChanged"),this._directoryChanged=!0,"directory-changed"):(this._resources=this._fetchResources(),"ok")}async _refetchPortalItemMetadata(){const t=this._schema.itemMetadata.url,e=await(0,i.A)(this._schema.itemUrl,{responseType:"json",query:{f:"json"}}),{modified:s,url:r}=e.data;if(null==r)throw new Error("Portal item metadata must have a url defined.");if(null==s)throw new Error("Portal item metadata must have a modified timestamp defined.");return this._schema.itemMetadata={modified:new Date(s),url:r},t!==r}async _getResources(){return this._resources||(this._resources=this._fetchResources()),await this._resources}async _getResource(t){const e=(await this._getResources()).get(t);if(!e)throw new Error(`Resource ${t} not found.`);return e}async _fetchResources(){const t=new Map;let e=1;const s=function(t){const e=t.split("/").filter(Boolean),s=e.indexOf("resources");if(-1===s||s===e.length-1)throw new Error(`URL does not contain a resources directory name: ${t}`);return`${e.slice(s+1).map(t=>decodeURIComponent(t)).join("/")}/`}(this._schema.itemMetadata.url);for(;-1!==e;){const r=await(0,i.A)(`${this._baseUrl}/resources`,{query:{f:"json",start:e,num:100}});for(const e of r.data.resources)e.resource.startsWith(s)&&t.set(e.resource,e);e=r.data.nextStart}return t}}class S extends y{constructor(t,e=null,s=()=>{}){super(e,s),this._schema=t}async update(t){await this._updateParquetFileInfos(await this._getParquetFileNames()),this._schema=t}async _resolveFileUrl(t){return t}async _getParquetFileNames(){return this._schema.urls.filter(t=>!t.endsWith(".json"))}async _getStatisticsFileName(){return this._schema.urls.find(_)??null}}function P(t,e,s){switch(t.type){case"urls":return new S(t,e,s);case"portal-parquet-file":return new w(t,e,s);case"portal-parquet-layer":return new F(t,e,s)}}},6557(t,e,s){s.r(e),s.d(e,{default:()=>V});var i=s(32198),r=s(21818),n=s(49186),a=s(71511),o=s(44208),u=s(53966),l=s(17676),h=s(563),c=s(39516),d=s(86211),p=s(16930),f=s(70328),m=s(19419),y=s(21325),_=s(53929),g=s(90708),w=s(29441),x=s(56390),F=s(99352),S=s(8384),P=s(58727),v=s(95031),I=s(24460),z=s(64714),b=s(17754),R=s(20437),C=s(95466),N=s(30524),q=s(50639),M=s(42760),O=s(76248),A=s(30661),T=s(28923),E=s(44320),G=s(35258),k=s(16630);const U=new A.Z,Z="__OBJECTID",D=8e3;class B{constructor(t,e){this._files=t,this._createFileStream=e,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(t){for(await this._fill(t);this._pending.size>0;){(0,l.Te)(t),await this._fill(t);const e=await L(this._pending);if(this._pending.delete(e.read),this._resolvedCount++,null!=e.chunk)return e.chunk}return null}async _fill(t){for(this._removeDone();this._pending.size<8;){const e=this._getOrCreateNextStream(t);if(null==e)return;this._pending.add(e.read(t))}}_getOrCreateNextStream(t){const e=this._resolvedCount>=8?8:2;if(this._fileIndex<this._files.length&&this._streams.length<e){const e=this._files[this._fileIndex++],s=new Q(e.id,this._createFileStream(e,t));return this._streams.push(s),s}return this._getNextStream()}_getNextStream(){const t=this._streams.length;for(let e=0;e<t;e++){const s=(this._streamIndex+e)%t,i=this._streams[s];if(i.canRead)return this._streamIndex=(s+1)%t,i}return null}_removeDone(){let t=this._streamIndex;for(let e=this._streams.length-1;e>=0;e--)this._streams[e].done&&(this._streams.splice(e,1),e<t&&t--);this._streamIndex=this._streams.length>0?t%this._streams.length:0}}function L(t){return Promise.race(Array.from(t,async t=>({read:t,chunk:await t})))}class Q{constructor(t,e){this._fileId=t,this._stream=e,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&0===this._readCount}async read(t){this._readCount++;try{const e=await this._stream,s=await e.next(t);return null==s?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:s}}finally{this._readCount--}}}class V{constructor(){this._hasZ=!1,this._hasM=!1,this._queue=new h.QueueProcessor({concurrency:4,process:(t,e)=>this._executeQuery(t,e)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={},this._handles=new a.A}async load(t){const e=t.spatialReference?p.A.fromJSON(t.spatialReference):void 0;if(e&&!e.isWGS84&&!e.isWebMercator)throw new n.A("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");this._customParameters=t.customParameters,this._loadParameters=t,await this._updateProvider((0,v.M)(t.provider,null,()=>this._customParameters));const s=await this._provider.getMetadata(),i=await(0,M.nc)(s,{fields:t.fields?.map(t=>R.A.fromJSON(t)),geometryEncoding:t.geometryEncoding?(0,q.G)(t.geometryEncoding):null,geometryType:t.geometryType?(0,M.hG)(t.geometryType):null,displayOptimization:t.displayOptimization,spatialReference:e});if(this._hasZ=!!s?.hasZ,this._hasM=!!s?.hasM,!i.fields)throw new n.A("parquet:unsupported","Fields must be defined");let r;if(i.spatialReference&&i.geometryType){if(!i.spatialReference)throw new n.A("parquet:unsupported","SpatialReference must be defined");if(!i.spatialReference.isGeographic&&!i.spatialReference.isWebMercator)throw new n.A("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");i.spatialReference.isGeographic&&!i.spatialReference.isWGS84&&(u.A.getLogger("parquet:unsupported-projection").warn("Found a geographic projection that is not WGS84. Handling as WGS84.",{spatialReference:i.spatialReference}),i.spatialReference=p.A.WGS84),r={geometry:i.geometryEncoding?{geometryType:(0,M.sA)(i.geometryType),spatialReference:i.spatialReference.toJSON(),encoding:i.geometryEncoding.toJSON()}:null,displayOptimization:i.displayOptimization}}this.setCustomParameters(t.customParameters),this._displayOptimization=i.displayOptimization,await this._provider.updateGeometryInfo(r),this._capabilities=it(await this._getFileStatistics(),this._hasZ,this._hasM);const a=await this._provider.getFiles();if(!a.length)return{layerDefinition:{},capabilities:it(null,this._hasZ,this._hasM)};const o=await a[0].file;i.file=o;const{fields:l}=i;if(null==l)throw new n.A("parquet-layer:missing-metadata","Unable to create parquet source: cannot infer fields",l);l.push(new R.A({name:Z,type:"oid",alias:Z}));for(const t of l){const e=o.getColumnId(t.name);null!=e&&(this._indexMap[t.name]=e)}const h=new C.A(l.map(t=>t.toJSON()));this._fieldsIndex=h;const c=(0,M.sA)(i.geometryType??"point");return this._metadata=G.i.createFeature({fieldsIndex:h.toJSON(),geometryType:c,hasZ:this._hasZ,hasM:this._hasM,featureIdInfo:{type:"object-id",fieldName:Z},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:i.spatialReference,outSpatialReference:null,attributeSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:c,featureIdInfo:{type:"object-id",fieldName:Z},hasM:this._hasM,hasZ:this._hasZ,spatialReference:i.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=s?.extent?s.extent:await this._tryDeriveParquetFullExtent(i),{capabilities:this._capabilities,layerDefinition:{fields:i.fields?.map(t=>t.toJSON()),drawingInfo:(0,z.F0)(c),extent:this._fullExtent??void 0,geometryType:c,geometryEncoding:i.geometryEncoding?.toJSON(),displayOptimization:i.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(const{handle:t}of this._streams.values())t.remove();this._streams.clear(),this._indexMap={},this._handles.removeAll()}async reload(t){this.destroy(),await this.load(t)}set remoteClient(t){this._source=t.createInvokeProxy("")}setCustomParameters(t){this._customParameters=t}getIndexMap(){return this._indexMap}async updateFileProvider(t){this._loadParameters={...this._loadParameters,provider:t};const e=(0,v.M)(t,this._provider.getGeometryInfo(),()=>this._customParameters);await this._updateProvider(e)}async getDiagnosticsSnapshot(){const t=await this._provider.getFiles();return{files:await Promise.all(t.map(t=>t.getDiagnosticsSnapshot()))}}async getColumnIndex(t){return(await this._getFileInfoById(t.fileId)).getColumnIndex(t.rowGroupIndex,t.columnIndex)}async getOffsetIndex(t){return(await this._getFileInfoById(t.fileId)).getOffsetIndex(t.rowGroupIndex,t.columnIndex)}async queryFeatures(t,e){const s=await(0,P.T2)(t,null,this._queryEngineParams.spatialReference);return this._validateQuery(s),function(t){return!!(t.objectIds?.length||t.outStatistics||t.orderByFields?.length||t.returnDistinctValues)}(s)||(s.resultRecordCount=s.resultRecordCount?Math.min(s.resultRecordCount,D):D,s.resultOffset=s.resultOffset??0),s.outStatistics?this._queryStatistics(s,e):(s.returnDistinctValues&&(s.returnGeometry=void 0),(await this._enqueueQuery(s,e)).createQueryResponse())}async queryFeatureCount(t,e){const s=await(0,P.T2)(t,null,this._queryEngineParams.spatialReference);return this._validateQuery(s),J(s)?(s.outFields=void 0,s.returnGeometry=void 0,(await this._enqueueQuery(s,e)).createQueryResponseForCount()):this._getFeatureCount()}async queryObjectIds(t,e){const s=await(0,P.T2)(t,null,this._queryEngineParams.spatialReference);return this._validateQuery(s),J(s)?(s.resultRecordCount=s.resultRecordCount?Math.min(s.resultRecordCount,8e3):8e3,s.resultOffset=s.resultOffset??0,s.returnGeometry=void 0,s.outFields=void 0,(await this._enqueueQuery(s,e)).items.map(t=>t.getObjectId())):Array.from({length:await this._getFeatureCount()},(t,e)=>e)}async queryAttributeBins(t,e={}){throw new n.A("parquet:unsupported","queryAttributeBins not supported.")}async queryExtent(t,e){const s=await(0,P.T2)(t,null,this._queryEngineParams.spatialReference);if(this._validateQuery(s),this._fullExtent&&!J(s))return{count:await this._getFeatureCount(),extent:this._fullExtent};const i=(0,r.z)(this._metadata.spatialReference);s.returnGeometry=!0,s.outFields=void 0;const n=(0,f.hZ)((0,f.vt)(),f.qv),a=(0,f.vt)(),o=await this._enqueueQuery(s,e);let u=0;for(const t of o.items)t.getBounds(a)&&((0,f.RF)(n,a),u+=1);return{count:u,extent:(0,x.Wc)(n,i,s.outSR?(0,r.z)(s.outSR):i.toJSON(),i,!1)}}async queryStream(t,e){if(!e.signal)throw new Error("InternalError: AbortSignal must be passed");const s=await this._getCandidateFiles(t),i=new B(s,async(e,s)=>{const i=await e.file,r=await this._createParquetDisplayQuery(i,e.id,t);return i.executeQuery(r,D,s)}),r=this._streamIdCounter++,n=(0,l.NY)(e.signal,t=>{const e=this._streams.get(r);null!=e&&(e.handle.remove(),this._streams.delete(r))});return this._streams.set(r,{stream:i,handle:n}),r}async getStreamNext(t,e){if(!e.signal)throw new Error("InternalError: AbortSignal must be passed");const s=this._streams.get(t);if(!s)return{result:null};const i=await s.stream.next(e.signal);if(null==i)return s.handle.remove(),this._streams.delete(t),{result:null};const r=i.chunk.serialize().buffer,n={fileId:i.fileId,buffer:r};return r instanceof ArrayBuffer?{result:n,transferList:[r]}:{result:n}}async getStreamNextFeatures(t,e){const{result:s}=await this.getStreamNext(t,e);if(null==s)return null;const i=(await(0,O.N)()).ParquetChunk.deserialize(new Uint8Array(s.buffer)),r=new k.s(this._metadata,this._indexMap,i,s.fileId),n=[];for(;r.next();){const t=(0,g.zv)(r.readGeometryWorldSpace(),r.geometryType,r.hasZ,r.hasM),e=r.readAttributes();n.push({attributes:e,geometry:t})}return{features:n}}async createPatch(t,e,s,i,r){if(!r.signal)throw new Error("InternalError: AbortSignal must be passed");const n=await this._getFileInfoById(t),a=await n.file;return(await a.createChunkPatch(e,s,i,r.signal)).serialize().buffer}async _updateProvider(t){const e=this._provider;this._handles.removeAll(),this._provider=t,this._handles.add([t.events.on("rangeRead",t=>{this._source.onRangeRead(t)}),t.events.on("sourceChanged",async()=>{await this.reload(this._loadParameters),await this._source.onSourceChange()})]),await(e?.destroy())}async _getCandidateFiles(t){const e=await this._provider.getFiles(),s=await this._getSpatialFilePruning(t);if(null==s)return e;const i=e.filter(t=>this._mayIncludeFileForSpatialPruning(t,s));return"xz"===s.type?function(t,e){return t.slice().sort((t,s)=>{const i=st(t,e),r=st(s,e);return i===r?0:i<r?-1:1})}(i,s):i}async _queryStatistics(t,e){const s=await(0,P.T2)({...t},null,this._queryEngineParams.spatialReference);if(s.returnGeometry=void 0,function(t,e){return!!t.outStatistics?.length&&!J(t)&&!t.groupByFieldsForStatistics?.length&&!t.orderByFields?.length&&!t.returnDistinctValues&&!t.returnAggIds&&t.outStatistics.every(t=>function(t,e){switch(t.statisticType){case"count":return"1"===t.onStatisticField||null!=e.get(t.onStatisticField);case"min":case"max":{const s=e.get(t.onStatisticField);return null!=s&&(0,N.WA)(s)}default:return!1}}(t,e))}(s,this._fieldsIndex)){const t=await this._getStatisticsFromFiles(s);if(t)return t}return(await this._enqueueQuery(s,e)).createQueryResponse()}async _getStatisticsFromFiles(t){const e=await this._provider.getFiles(),s={},i=[];for(const r of t.outStatistics??[]){const t=X(r,e);if(!t.available)return null;s[r.outStatisticFieldName]=t.value,i.push(H(r,this._fieldsIndex))}return{fields:i,features:[{attributes:s}]}}async _getSpatialFilePruning(t){if("tile"!==t.type&&("arcade"!==t.type||null==t.extent))return null;const e=this._displayOptimization,s=e?.index;if(null==s)return null;const i=t.outSpatialReference.wkid;if(null==s.wkid||null==i)return null;const r=s.wkid,n=await(0,O.N)();switch(s.type){case"xz":return{type:"xz",fieldName:(0,_.FG)(s.code),intersects:(e,a)=>n.queryIntersectsXZStatistics(s.fullExtent,t.extent,i,r,s.maxLevel,e,a)};case"z":return{type:"xy",xFieldName:(0,_.FG)(s.xColumn),yFieldName:(0,_.FG)(s.yColumn),intersects:(e,s,a,o)=>n.queryIntersectsXYStatistics(t.extent,i,r,e,s,a,o)}}}_mayIncludeFileForSpatialPruning(t,e){switch(e.type){case"xz":{const s=et(t,e);return"null-only"!==s?.type&&("bounds"!==s?.type||e.intersects(s.minValue,s.maxValue))}case"xy":{const s=t.statistics.statistics.get(e.xFieldName),i=t.statistics.statistics.get(e.yFieldName);return"null-only"!==s?.type&&"null-only"!==i?.type&&("bounds"!==s?.type||"bounds"!==i?.type||e.intersects(s.minValue,s.maxValue,i.minValue,i.maxValue))}}}async _tryDeriveParquetFullExtent(t){if(!t.spatialReference)return null;if(null==this._fullExtent&&"location"===t.geometryEncoding?.type){const e=await this._provider.getFiles(),{xField:s,yField:r}=t.geometryEncoding,n=(0,f.hZ)((0,f.vt)(),f.qv);let a=!1;for(const t of e){const e=await t.file;for(const t of e.rowGroups()){const e={stack:[],error:void 0,hasError:!1};try{const o=(0,i.mS)(e,t.columnDescriptorForAttribute(s),!1),u=(0,i.mS)(e,t.columnDescriptorForAttribute(r),!1),l=(0,I.Hk)(o),h=(0,I.Hk)(u);if("bounds"===l?.type&&"bounds"===h?.type){const t=[l.minValue,h.minValue,l.maxValue,h.maxValue];(0,f.DC)(n,t),a=!0}t.free()}catch(t){e.error=t,e.hasError=!0}finally{(0,i.hk)(e)}}}return a?{xmin:n[0],ymin:n[1],xmax:n[3],ymax:n[4],spatialReference:t.spatialReference?.toJSON()}:null}return null}async _getFileInfoById(t){const e=await this._provider.getFiles();for(const s of e)if(s.id===t)return s;throw new Error(`InternalError: File ${t} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(t){return(await this._getFileInfoById(t)).file}async _createParquetQuery(t,e,s,i,r){const n=(await(0,O.N)()).Query.new();null!=s&&n.setPreFilterStart(s),null!=i&&n.setPreFilterCount(i),null!=r&&n.setPostFilterCount(r);const a=await this._getRequiredFields(t);n.setOutFields(a),(t.geometry||t.returnGeometry)&&n.setReturnGeometry(!0),n.setReturnZ(!!t.returnZ),n.setReturnM(!!t.returnM);const o=this._tryGetGeneralizedGeometryResolution(t);null!=o&&n.setSourceResolution(o);const u=t.geometry?.spatialReference??this._queryEngineParams.spatialReference,l=u.wkid;if(t.geometry&&((0,y.K8)(u)||(0,y.oT)(u))){const e=(0,m.C)((0,m.vt)(),m.qv);for(const s of(0,x.qo)(t.geometry))(0,m.DC)(e,s);n.setOutSpatialReference(l),n.setExtent({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3]})}if(t.where){const{id:s,file:i}=e;await this._setWhereClause(n,await i,s,t.where)}return n}async _createParquetDisplayQuery(t,e,s){const i=(await(0,O.N)()).Query.new();if("tile"===s.type){i.setExtent(s.extent),i.setQuantizationTransform(s.transform);const t=this._sourceResolution(s.resolution,s.outSpatialReference);null!=t&&i.setSourceResolution(t)}else"arcade"===s.type&&null!=s.extent&&i.setExtent(s.extent);return i.setOutFields(s.outFields.filter(t=>null!=this._indexMap[t])),i.setOutSpatialReference(s.outSpatialReference.wkid),i.setReturnGeometry(s.returnGeometry),i.setReturnZ(s.returnZ),i.setReturnM(s.returnM),s.where&&await this._setWhereClause(i,t,e,s.where),i}async _getFeatureCount(){return(await this._provider.getFiles()).map(t=>t.statistics.rowCount).reduce((t,e)=>t+e,0)}async _getByteLength(){return(await this._provider.getFiles()).map(t=>t.statistics.byteSize).reduce((t,e)=>t+e,0)}_validateQuery(t){if(!this._capabilities.query.supportsStatistics&&t.outStatistics)throw new n.A("parquet:unsupported","Statistics queries are not supported",{query:t});if(!this._capabilities.query.supportsOrderBy&&t.orderByFields?.length)throw new n.A("parquet:unsupported","Queries using orderBy are not supported",{query:t});if(!this._capabilities.query.supportsDistinct&&t.returnDistinctValues)throw new n.A("parquet:unsupported","Queries using returnDistinctValues are not supported",{query:t})}async _setWhereClause(t,e,s,i){const r=this._indexMap,a=this._fieldsIndex,o={getAttribute(t,i){const n=r[i];if(null==n){const e=a.get(i);if("__OBJECTID"===e?.name){const e=t.row+t.rowGroupStart;return(0,b.xb)(s,e)}return null}const o=a.get(i);return(0,_.LC)(e,t.rowGroup,t.row,n,o.type)}},u=await(0,c.GP)(i,this._fieldsIndex);if(!u.isStandardized)throw new n.A("sql-parse-error","expression is not standardized");const l=u.fieldNames.map(t=>a.get(t)).filter(t=>t&&null!=this._indexMap[t?.name]);t.setWhere(i),t.setWhereEvaluator((t,e,s)=>u.testFeatureCompiled({rowGroup:t,row:e,rowGroupStart:s},o,null)),t.setWhereFields(l.map(t=>t.name))}async*_streamFeatures(t,e,s,i,r){const n=await this._provider.getFiles();let a=0;for(const o of n){const n=a,u=a+o.statistics.rowCount;if(a+=o.statistics.rowCount,null!=e&&e>=u)continue;const l=null!=e?Math.max(e-n,0):null;let h=s;if(null!=s){const t=e??0,i=t+s,r=Math.max(t,n),a=Math.min(i,u);h=Math.max(a-r,0)}if(0===h)continue;const c=await this._createParquetQuery(t,o,l,h,i),d=await o.file,p=await d.executeQuery(c,D),f=async()=>{const t=await p.next(r);if(!t)return null;const e=new k.s(this._metadata,this._indexMap,t,o.id);return tt([new T.j(e,null,0,!1)],this._queryEngineParams)};let m=await f();for(;null!=m;)yield m,m=await f()}}async _queryFeaturesWithQueryEnginePagination(t,e){const s=[],i=this._streamFeatures(t,null,null,null,e);let r=await i.next();for(;!r.done;){const n=await r.value.executeQueryForOpaqueFeatures({...t,where:void 0},e);for(const t of n)s.push(t);r=await i.next()}return s}async _queryFeaturesWithUpfrontPagination(t,e){let s,i,r,n=t.resultOffset??0,a=t.resultRecordCount??D;!function(t){for(const e in t){const s=e;if($(s)&&null!==t[s])return!0}return!1}(t)?(n&&(s=n,n=0),i=t.resultRecordCount):function(t){for(const e in t){const s=e;if(j(s)&&null!==t[s])return!0}return!1}(t)||(r=n+a);const o=[],u=this._streamFeatures(t,s,i,r,e);let l=await u.next();for(;!l.done&&a>0;){const s=await l.value.executeQueryForOpaqueFeatures({...t,where:void 0},e);for(const t of s)if(n>0)n--;else if(o.push(t),--a<=0)return o;l=await u.next()}return o}_enqueueQuery(t,e){return this._queue.push(t,e)}async _executeQuery(t,e){if(t.objectIds?.length){const s=new Map;for(const e of t.objectIds){const t=(0,b.wY)(e),i=(0,b.gE)(e);let r=s.get(t);r||(r=[],s.set(t,r)),r.push(i)}const i=[];for(const[r,n]of s.entries()){const s=await this._executeFileIdQuery(t,r,n,e);for(const t of s)i.push(t)}return new S.G(i,t,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:U,featureIdInfo:this._queryEngineParams.featureIdInfo})}if("1=1"===t.where&&(t.where=null),t.resultOffset??=0,t.resultRecordCount??=await this._getFeatureCount(),t.resultRecordCount>2e7&&(!this._displayOptimization||!t.geometry))throw new n.A("parquet:cannot-execute-query","Unable to execute query, dataset is too large.");const s=!!t.orderByFields?.length||!!t.outStatistics?.length||!!t.returnDistinctValues,i=s?await this._queryFeaturesWithQueryEnginePagination(t,e):await this._queryFeaturesWithUpfrontPagination(t,e);return s||(t.resultOffset=0),new S.G(i,t,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:U,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(t,e,s,i){const r=await this._getRequiredFields(t),n=(await(0,O.N)()).Query.new();n.setOutFields(r),n.setReturnGeometry(!!t.returnGeometry),n.setReturnZ(!!t.returnZ),n.setReturnM(!!t.returnM),n.setIds(new Uint32Array(s));const a=await this._getFile(e),o=await a.executeQuery(n,D,i);let u=await o.next(i),l=0;const h=[];for(;null!=u;){const t=new k.s(this._metadata,this._indexMap,u,e),s=new T.j(t,null,l++,!1);h.push(s),u=await o.next(i)}return tt(h,this._queryEngineParams).executeQueryForOpaqueFeatures(t,i)}async _getRequiredFields(t){const e=new Set;if(t.outStatistics)for(const s of(0,w.g9)(this._fieldsIndex,t.outStatistics,t.groupByFieldsForStatistics))e.add(s);else if(t.outFields)for(const s of t.outFields)e.add(s);return(e.has("*")?this._fieldsIndex.fields.map(t=>t.name):Array.from(e)).filter(t=>null!=this._indexMap[t])}_tryGetGeneralizedGeometryResolution(t){if(!this._displayOptimization)return null;const e=t.outSR??this._queryEngineParams.spatialReference;if(!(0,y.K8)(e)&&!(0,y.oT)(e))return null;const s=t.quantizationParameters?.tolerance??t.maxAllowableOffset;return s?this._sourceResolution(s,e):null}_sourceResolution(t,e){const s=this._queryEngineParams.spatialReference,i=t*((0,d.GA)(e)/(0,d.GA)(s));return!Number.isFinite(i)||i<=0?null:i}}function W(t){switch(t){case"fullText":case"having":case"timeExtent":case"historicMoment":case"aggregateIds":case"uniqueIds":case"gdbVersion":case"objectIds":case"where":case"geometry":case"resultOffset":case"resultRecordCount":return!0;default:return!1}}function $(t){switch(t){case"fullText":case"having":case"timeExtent":case"historicMoment":case"aggregateIds":case"uniqueIds":case"gdbVersion":case"objectIds":case"where":case"geometry":return!0;default:return!1}}function j(t){switch(t){case"fullText":case"having":case"timeExtent":return!0;case"historicMoment":case"aggregateIds":case"uniqueIds":case"gdbVersion":case"objectIds":case"where":case"resultOffset":case"geometry":case"resultRecordCount":return!1}return!1}function J(t){for(const e in t){const s=e;if(W(s)&&null!==t[s])return!0}return!1}function H(t,e){const s="exceedslimit"!==t.statisticType?e.get(t.onStatisticField):null,i="min"!==t.statisticType&&"max"!==t.statisticType||"esriFieldTypeDate"!==s?.type?"esriFieldTypeDouble":s.type;return{name:t.outStatisticFieldName,alias:t.outStatisticFieldName,type:i}}function X(t,e){switch(t.statisticType){case"count":return function(t,e){if("count"!==t.statisticType)return{available:!1,value:null};if("1"===t.onStatisticField)return{available:!0,value:e.reduce((t,e)=>t+e.statistics.rowCount,0)};let s=0;for(const i of e){const e=i.statistics.statistics.get(t.onStatisticField);if(null==e||null==e.nullCount)return{available:!1,value:null};s+=i.statistics.rowCount-e.nullCount}return{available:!0,value:s}}(t,e);case"min":return Y(t,e,Math.min);case"max":return Y(t,e,Math.max);default:return{available:!1,value:null}}}function Y(t,e,s){if("min"!==t.statisticType&&"max"!==t.statisticType)return{available:!1,value:null};let i=null;const r="min"===t.statisticType?"minValue":"maxValue";for(const n of e){const e=n.statistics.statistics.get(t.onStatisticField);if(null==e)return{available:!1,value:null};switch(e.type){case"null-only":continue;case"unknown":return{available:!1,value:null};case"bounds":{const t=K(e[r]);if(null==t)return{available:!1,value:null};i=null==i?t:s(i,t);break}}}return{available:!0,value:i}}function K(t){return"number"==typeof t&&Number.isFinite(t)?t:null}function tt(t,e){const s=new E.I;for(const e of t)s.insert(e);return new x.do({...e,featureStore:s})}function et(t,e){return t.statistics.statistics.get(e.fieldName)??null}function st(t,e){const s=et(t,e);return"bounds"!==s?.type?Number.POSITIVE_INFINITY:s.maxValue-s.minValue}function it(t,e,s){const i=t?.featureCount;let r=!1;return null!=i&&i<(0,o.A)("parquetlayer-full-query-feature-count")&&(r=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:s,supportsTrueCurve:!1,supportsZ:e},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...F.F,maxRecordCount:D,supportsOrderBy:r,supportsDistinct:!0,supportsStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1}},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}},95466(t,e,s){s.d(e,{A:()=>l});var i=s(49186),r=s(53966),n=s(12195),a=s(30524),o=s(98623),u=s(56400);class l{static fromJSON(t){return new l(t.fields,t.timeZoneByFieldName)}static fromLayer(t){return new l(t.fields??[],c(t))}static fromLayerJSON(t){return new l(t.fields??[],c(t))}constructor(t=[],e){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=t||[],this._timeZoneByFieldName=e?new Map(e):null;const s=[];for(const t of this.fields){const e=t?.name,i=(0,a.GZ)(e);if(e&&i){const r=(0,a.NF)(e);this._fieldsMap.set(e,t),this._fieldsMap.set(r,t),this._normalizedFieldsMap.set(i,t),s.push(`${r}:${t.type}:${this._timeZoneByFieldName?.get(e)}`),(0,a.vE)(t)?(this.dateFields.push(t),this._dateFieldsSet.add(t)):(0,a.WA)(t)&&(this._numericFieldsSet.add(t),this.numericFields.push(t)),(0,a.te)(t)||(0,a.Xz)(t)||(t.editable=null==t.editable||!!t.editable,t.nullable=null==t.nullable||!!t.nullable)}}s.sort(),this.uid=s.join()}get requiredFields(){if(!this._requiredFields){this._requiredFields=[];for(const t of this.fields)(0,a.te)(t)||(0,a.Xz)(t)||t.nullable||void 0!==(0,a.lD)(t)||this._requiredFields.push(t)}return this._requiredFields}equals(t){return this.uid===t?.uid}has(t){return null!=this.get(t)}get(t){return(0,a.Vb)({fieldName:t,fieldsMap:this._fieldsMap,normalizedFieldsMap:this._normalizedFieldsMap})}getTimeZone(t){const e=this.get(t&&"string"!=typeof t?t.name:t);return e?this._timeZoneByFieldName?this._timeZoneByFieldName.get(e.name):"date"===e.type||"esriFieldTypeDate"===e.type?(r.A.getLogger("esri.layers.support.FieldsIndex").errorOnce(new i.A("getTimeZone:no-timezone-information",`no time zone information for field '${e.name}'`)),"UTC"):h.has(e.type)?o.L:null:null}isDateField(t){return this._dateFieldsSet.has(this.get(t))}isTimeOnlyField(t){return(0,a.OH)(this.get(t))}isNumericField(t){return this._numericFieldsSet.has(this.get(t))}normalizeFieldName(t){return this.get(t)?.name??void 0}toJSON(){return{fields:this.fields.map(t=>(0,n.W)(t)?t.toJSON():t),timeZoneByFieldName:this._timeZoneByFieldName?Array.from(this._timeZoneByFieldName.entries()):null}}}const h=new Set(["time-only","date-only","timestamp-offset","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"]);function c(t){const e=new Map;if(!t.fields)return e;const s=!0===t.datesInUnknownTimezone,{timeInfo:i,editFieldsInfo:r}=t,n=(i?"startField"in i?i.startField:i.startTimeField:"")??"",l=(i?"endField"in i?i.endField:i.endTimeField:"")??"",c=function(t){return"dateFieldsTimeZone"in t}(t)?t.dateFieldsTimeZone??null:t.dateFieldsTimeReference?(0,u.ZS)(t.dateFieldsTimeReference):null,d=r?function(t){return"timeZone"in t}(r)?r.timeZone??c:r.dateFieldsTimeReference?(0,u.ZS)(r.dateFieldsTimeReference):c??"UTC":null,p=i?function(t){return"timeZone"in t}(i)?i.timeZone??c:i.timeReference?(0,u.ZS)(i.timeReference):c:null,f=new Map([[(0,a.NF)(r?.creationDateField??""),d],[(0,a.NF)(r?.editDateField??""),d],[(0,a.NF)(n),p],[(0,a.NF)(l),p]]);for(const{name:i,type:r}of t.fields)if(h.has(r))e.set(i,o.L);else if("date"!==r&&"esriFieldTypeDate"!==r)e.set(i,null);else if(s)e.set(i,o.L);else{const t=f.get((0,a.NF)(i??""))??c;e.set(i,t)}return e}},34582(t,e,s){s.d(e,{A:()=>o});var i=s(32198),r=s(69540),n=s(25482),a=s(91429);let o=class extends((0,r.OU)(n.o)){constructor(t){super(t),this.type="wkb",this.field=null}};(0,i.Cg)([(0,a.MZ)({type:["wkb"],nonNullable:!0,readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],o.prototype,"type",void 0),(0,i.Cg)([(0,a.MZ)({type:["counter-clockwise"],json:{write:!0}})],o.prototype,"orientation",void 0),(0,i.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],o.prototype,"field",void 0),o=(0,i.Cg)([(0,a.$K)("esri.layers.support.GeometryEncodingWkb")],o)},56370(t,e,s){s.d(e,{A:()=>d});var i=s(32198),r=s(69540),n=s(7762),a=s(49186),o=s(25482),u=s(91429),l=s(64108),h=s(97159),c=s(43937);let d=class extends((0,o.T)(r.Pw)){constructor(t){super(t),this.type="files",this.urls=new n.A}writeUrls(t,e,s,i){const r=t.toArray().map(t=>(0,h.t)(t,i)).filter(t=>!!t);r.length?e.urls=r:i.messages?.push(new a.A("parquet-layer:missing-urls","Missing or empty 'urls'",{data:this}))}};(0,i.Cg)([(0,u.MZ)({type:["files"],nonNullable:!0,readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],d.prototype,"type",void 0),(0,i.Cg)([(0,u.MZ)({type:n.A.ofType(String),json:{write:{isRequired:!0}}})],d.prototype,"urls",void 0),(0,i.Cg)([(0,c.K)("urls")],d.prototype,"writeUrls",null),d=(0,i.Cg)([(0,l.$)("esri.layers.support.ParquetFilesData")],d)},50639(t,e,s){s.d(e,{G:()=>n});var i=s(9075),r=s(34582);function n(t){switch(t.type){case"wkb":return r.A.fromJSON(t);case"location":return i.A.fromJSON(t)}}},42760(t,e,s){s.d(e,{Dt:()=>f,hG:()=>d,nc:()=>p,sA:()=>c}),s(7762);var i=s(49186),r=s(44208),n=s(66552),a=s(16930),o=(s(95031),s(20437)),u=s(30524),l=s(50639);s(56370);const h=new n.J({esriGeometryPoint:"point",esriGeometryPolygon:"polygon",esriGeometryPolyline:"polyline",esriGeometryMultipoint:"multipoint"});function c(t){return h.toJSON(t)}function d(t){return h.fromJSON(t)}async function p(t,e){if(e.geometryType&&e.spatialReference&&e.geometryEncoding&&e.fields&&e.displayOptimization)return e;if(!t)throw new i.A("parquet:bad-input","No metadata found");const s={...e},n=t.fields.map(t=>o.A.fromJSON(t));if(null==s.fields)s.fields=n;else{const t=new Set(s.fields.map(t=>t.name));if(!(0,r.A)("parquetlayer-legacy-field-overrides-enabled"))for(const e of n)t.has(e.name)||s.fields.push(e)}if(null!=s.geometryEncoding){const t=s.geometryEncoding;switch(t.type){case"wkb":{const e=n.find(e=>e.name===t.field);if(!e)throw new i.A("parquet:unsupported",`Geometry encoding references field ${t.field} which does not exist`);if("blob"!==e.type)throw new i.A("parquet:unsupported",`Invalid field type for geometry encoding. Found ${e.type} but expected 'blob'`);break}case"location":for(const e of[t.xField,t.yField])if(null!=e){const t=n.find(t=>t.name===e);if(!t)throw new i.A("parquet:unsupported",`Geometry encoding references field ${e} which does not exist`);if(!(0,u.WA)(t))throw new i.A("parquet:unsupported",`Invalid field type for location geometry encoding. Found ${t.type} but expected a numeric`)}}}return null==s.geometryEncoding&&(s.geometryEncoding=t.geometryEncoding?(0,l.G)(t.geometryEncoding):null),s.fields=function(t,e){const s=e.geoMetadata;if(null==s)return t;const i=new Set(Object.keys(s.columns));return t.filter(t=>!i.has(t.name))}(s.fields,t),!s.displayOptimization&&t.displayOptimization&&(s.displayOptimization=t.displayOptimization),!s.geometryType&&t.geometryType&&(s.geometryType=d(t.geometryType)),!s.spatialReference&&t.spatialReference&&(s.spatialReference=a.A.fromJSON(t.spatialReference)),s}async function f(t,e){switch(t.type){case"files":return{type:"urls",urls:t.urls.toArray()};case"portal-item":{const s=await t.portalItem.load(e);switch(s.type){case"Apache Parquet":return{type:"portal-parquet-file",itemUrl:s.itemUrl,itemCdnUrl:s.itemCdnUrl,modified:s.modified,size:s.size};case"Parquet layer":case"Parquet Layer":case"Parquet feature layer":case"Parquet Feature Layer":if(!s.url)throw new i.A("parquet:bad-item",`Item of type ${s.type} must have a url defined`,s);return{type:"portal-parquet-layer",itemUrl:s.itemUrl,itemCdnUrl:s.itemCdnUrl,itemMetadata:{modified:s.modified,url:s.url}};default:throw new i.A("parquet:bad-item",`Item of type ${s.type} is not supported`,s)}}}}s.d(e,["ye",0,h])}}]);