@arcgis/core 4.21.0-next.20210916 → 4.21.0

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 (32) hide show
  1. package/EULA.pdf +0 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/836e8ed3f37b014670ec.js +1 -0
  4. package/assets/esri/core/workers/chunks/a1d5d196d14b194636ee.js +1 -0
  5. package/assets/esri/core/workers/chunks/dd33c0ef52ad555092bd.js +1 -0
  6. package/assets/esri/core/workers/chunks/ee32a34cce5d2f65d01c.js +1 -0
  7. package/assets/esri/core/workers/chunks/f57c8fc116d64723c16c.js +1 -0
  8. package/config.js +1 -1
  9. package/interfaces.d.ts +47 -123
  10. package/layers/ImageryTileLayer.js +1 -1
  11. package/layers/mixins/ArcGISImageService.js +1 -1
  12. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  13. package/package.json +1 -1
  14. package/support/revision.js +1 -1
  15. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  16. package/views/2d/layers/features/controllers/support/sourceAdapters.js +1 -1
  17. package/views/2d/layers/features/schemaUtils.js +1 -1
  18. package/views/2d/layers/features/sources/BaseFeatureSource.js +1 -1
  19. package/views/2d/layers/features/sources/DataTileSource.js +1 -1
  20. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  21. package/views/3d/layers/analysis/LineOfSight/LineOfSightController.js +1 -1
  22. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  23. package/views/draw/support/Reshape.js +1 -1
  24. package/widgets/BasemapLayerList/BasemapLayerListViewModel.js +1 -1
  25. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  26. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  27. package/assets/esri/core/workers/chunks/05ad927ed6b27c8134b4.js +0 -1
  28. package/assets/esri/core/workers/chunks/42f1ea5f61521156e044.js +0 -1
  29. package/assets/esri/core/workers/chunks/5ec6930af98cbccc6a9a.js +0 -1
  30. package/assets/esri/core/workers/chunks/62f264baf3cbd76ecac6.js +0 -1
  31. package/assets/esri/core/workers/chunks/d4a77cf8f298d94879d6.js +0 -1
  32. package/views/2d/layers/features/controllers/support/sources.js +0 -5
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[3142,4599],{96794:(e,t,s)=>{s.d(t,{r:()=>i});var r=s(88764);function i(e,t){if(!(this instanceof i))return new i(e,t);this._maxEntries=Math.max(4,e||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),t&&("function"==typeof t?this.toBBox=t:this._initFormat(t)),this.clear()}function n(e,t,s){if(!s)return t.indexOf(e);for(var r=0;r<t.length;r++)if(s(e,t[r]))return r;return-1}function o(e,t){a(e,0,e.children.length,t,e)}function a(e,t,s,r,i){i||(i=m(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var n,o=t;o<s;o++)n=e.children[o],h(i,e.leaf?r(n):n);return i}function h(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function l(e,t){return e.minX-t.minX}function c(e,t){return e.minY-t.minY}function u(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function d(e){return e.maxX-e.minX+(e.maxY-e.minY)}function p(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function g(e,t){var s=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),i=Math.min(e.maxX,t.maxX),n=Math.min(e.maxY,t.maxY);return Math.max(0,i-s)*Math.max(0,n-r)}function f(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function _(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function m(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function y(e,t,s,i,n){for(var o,a=[t,s];a.length;)(s=a.pop())-(t=a.pop())<=i||(o=t+Math.ceil((s-t)/i/2)*i,(0,r.q)(e,o,t,s,n),a.push(t,o,o,s))}i.prototype={all:function(){return this._all(this.data,[])},search:function(e){var t=this.data,s=[],r=this.toBBox;if(!_(e,t))return s;for(var i,n,o,a,h=[];t;){for(i=0,n=t.children.length;i<n;i++)o=t.children[i],_(e,a=t.leaf?r(o):o)&&(t.leaf?s.push(o):f(e,a)?this._all(o,s):h.push(o));t=h.pop()}return s},collides:function(e){var t=this.data,s=this.toBBox;if(!_(e,t))return!1;for(var r,i,n,o,a=[];t;){for(r=0,i=t.children.length;r<i;r++)if(n=t.children[r],_(e,o=t.leaf?s(n):n)){if(t.leaf||f(e,o))return!0;a.push(n)}t=a.pop()}return!1},load:function(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(var t=0,s=e.length;t<s;t++)this.insert(e[t]);return this}var r=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===r.height)this._splitRoot(this.data,r);else{if(this.data.height<r.height){var i=this.data;this.data=r,r=i}this._insert(r,this.data.height-r.height-1,!0)}else this.data=r;return this},insert:function(e){return e&&this._insert(e,this.data.height-1),this},clear:function(){return this.data=m([]),this},remove:function(e,t){if(!e)return this;for(var s,r,i,o,a=this.data,h=this.toBBox(e),l=[],c=[];a||l.length;){if(a||(a=l.pop(),r=l[l.length-1],s=c.pop(),o=!0),a.leaf&&-1!==(i=n(e,a.children,t)))return a.children.splice(i,1),l.push(a),this._condense(l),this;o||a.leaf||!f(a,h)?r?(s++,a=r.children[s],o=!1):a=null:(l.push(a),c.push(s),s=0,r=a,a=a.children[0])}return this},toBBox:function(e){return e},compareMinX:l,compareMinY:c,toJSON:function(){return this.data},fromJSON:function(e){return this.data=e,this},_all:function(e,t){for(var s=[];e;)e.leaf?t.push.apply(t,e.children):s.push.apply(s,e.children),e=s.pop();return t},_build:function(e,t,s,r){var i,n=s-t+1,a=this._maxEntries;if(n<=a)return o(i=m(e.slice(t,s+1)),this.toBBox),i;r||(r=Math.ceil(Math.log(n)/Math.log(a)),a=Math.ceil(n/Math.pow(a,r-1))),(i=m([])).leaf=!1,i.height=r;var h,l,c,u,d=Math.ceil(n/a),p=d*Math.ceil(Math.sqrt(a));for(y(e,t,s,p,this.compareMinX),h=t;h<=s;h+=p)for(y(e,h,c=Math.min(h+p-1,s),d,this.compareMinY),l=h;l<=c;l+=d)u=Math.min(l+d-1,c),i.children.push(this._build(e,l,u,r-1));return o(i,this.toBBox),i},_chooseSubtree:function(e,t,s,r){for(var i,n,o,a,h,l,c,d;r.push(t),!t.leaf&&r.length-1!==s;){for(c=d=1/0,i=0,n=t.children.length;i<n;i++)h=u(o=t.children[i]),(l=p(e,o)-h)<d?(d=l,c=h<c?h:c,a=o):l===d&&h<c&&(c=h,a=o);t=a||t.children[0]}return t},_insert:function(e,t,s){var r=this.toBBox,i=s?e:r(e),n=[],o=this._chooseSubtree(i,this.data,t,n);for(o.children.push(e),h(o,i);t>=0&&n[t].children.length>this._maxEntries;)this._split(n,t),t--;this._adjustParentBBoxes(i,n,t)},_split:function(e,t){var s=e[t],r=s.children.length,i=this._minEntries;this._chooseSplitAxis(s,i,r);var n=this._chooseSplitIndex(s,i,r),a=m(s.children.splice(n,s.children.length-n));a.height=s.height,a.leaf=s.leaf,o(s,this.toBBox),o(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(s,a)},_splitRoot:function(e,t){this.data=m([e,t]),this.data.height=e.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},_chooseSplitIndex:function(e,t,s){var r,i,n,o,h,l,c,d;for(l=c=1/0,r=t;r<=s-t;r++)o=g(i=a(e,0,r,this.toBBox),n=a(e,r,s,this.toBBox)),h=u(i)+u(n),o<l?(l=o,d=r,c=h<c?h:c):o===l&&h<c&&(c=h,d=r);return d},_chooseSplitAxis:function(e,t,s){var r=e.leaf?this.compareMinX:l,i=e.leaf?this.compareMinY:c;this._allDistMargin(e,t,s,r)<this._allDistMargin(e,t,s,i)&&e.children.sort(r)},_allDistMargin:function(e,t,s,r){e.children.sort(r);var i,n,o=this.toBBox,l=a(e,0,t,o),c=a(e,s-t,s,o),u=d(l)+d(c);for(i=t;i<s-t;i++)n=e.children[i],h(l,e.leaf?o(n):n),u+=d(l);for(i=s-t-1;i>=t;i--)n=e.children[i],h(c,e.leaf?o(n):n),u+=d(c);return u},_adjustParentBBoxes:function(e,t,s){for(var r=s;r>=0;r--)h(t[r],e)},_condense:function(e){for(var t,s=e.length-1;s>=0;s--)0===e[s].children.length?s>0?(t=e[s-1].children).splice(t.indexOf(e[s]),1):this.clear():o(e[s],this.toBBox)},_initFormat:function(e){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(e[0])),this.compareMinY=new Function("a","b",t.join(e[1])),this.toBBox=new Function("a","return {minX: a"+e[0]+", minY: a"+e[1]+", maxX: a"+e[2]+", maxY: a"+e[3]+"};")}}},8557:(e,t,s)=>{s.d(t,{Z:()=>i});var r=s(70586);class i{constructor(e){this.size=0,this._start=0,this.maxSize=e,this._buffer=new Array(e)}get entries(){return this._buffer}enqueue(e){if(this.size===this.maxSize){const t=this._buffer[this._start];return this._buffer[this._start]=e,this._start=(this._start+1)%this.maxSize,t}return this._buffer[(this._start+this.size++)%this.maxSize]=e,null}dequeue(){if(0===this.size)return null;const e=this._buffer[this._start];return this._buffer[this._start]=null,this.size--,this._start=(this._start+1)%this.maxSize,e}peek(){return 0===this.size?null:this._buffer[this._start]}find(e){if(0===this.size)return null;for(const t of this._buffer)if((0,r.pC)(t)&&e(t))return t;return null}clear(e){let t=this.dequeue();for(;(0,r.pC)(t);)e&&e(t),t=this.dequeue()}}},3920:(e,t,s)=>{s.d(t,{r:()=>c,p:()=>l});var r=s(43697),i=s(18855),n=s(61247),o=s(5600),a=s(52525),h=s(89749);const l=e=>{let t=class extends e{destroy(){this.destroyed||(this.handles.destroy(),this.updatingHandles.destroy())}get handles(){return this._get("handles")||new n.Z}get updatingHandles(){return this._get("updatingHandles")||new h.t}};return(0,r._)([(0,o.Cb)({readOnly:!0})],t.prototype,"handles",null),(0,r._)([(0,o.Cb)({readOnly:!0})],t.prototype,"updatingHandles",null),t=(0,r._)([(0,a.j)("esri.core.HandleOwner")],t),t};let c=class extends(l(i.Z)){};c=(0,r._)([(0,a.j)("esri.core.HandleOwner")],c)},61247:(e,t,s)=>{s.d(t,{Z:()=>c});var r=s(43697),i=s(18855),n=s(81049),o=s(70586),a=s(5600),h=s(52525);let l=class extends i.Z{constructor(e){super(e),this._groups=new Map}destroy(){this.removeAll()}get size(){let e=0;return this._groups.forEach((t=>{e+=t.length})),e}add(e,t){if(!this._isHandle(e)&&!Array.isArray(e)&&!n.Z.isCollection(e))return this;const s=this._getOrCreateGroup(t);return Array.isArray(e)||n.Z.isCollection(e)?e.forEach((e=>this._isHandle(e)&&s.push(e))):s.push(e),this.notifyChange("size"),this}forEach(e,t){if("function"==typeof e)this._groups.forEach((t=>t.forEach(e)));else{const s=this._getGroup(e);s&&t&&s.forEach(t)}}has(e){return this._groups.has(this._ensureGroupKey(e))}remove(e){if(Array.isArray(e)||n.Z.isCollection(e))return e.forEach(this.remove,this),this;if(!this.has(e))return this;const t=this._getGroup(e);for(let e=0;e<t.length;e++)t[e].remove();return this._deleteGroup(e),this.notifyChange("size"),this}removeAll(){return this._groups.forEach((e=>{for(let t=0;t<e.length;t++)e[t].remove()})),this._groups.clear(),this.notifyChange("size"),this}_isHandle(e){return e&&!!e.remove}_getOrCreateGroup(e){if(this.has(e))return this._getGroup(e);const t=[];return this._groups.set(this._ensureGroupKey(e),t),t}_getGroup(e){return(0,o.j0)(this._groups.get(this._ensureGroupKey(e)))}_deleteGroup(e){return this._groups.delete(this._ensureGroupKey(e))}_ensureGroupKey(e){return e||"_default_"}};(0,r._)([(0,a.Cb)({readOnly:!0})],l.prototype,"size",null),l=(0,r._)([(0,h.j)("esri.core.Handles")],l);var c=l},45091:(e,t,s)=>{s.d(t,{Z:()=>h});var r=s(80442),i=s(71143);const n=4294967296,o=(0,r.Z)("esri-text-decoder")?new TextDecoder("utf-8"):null,a=(0,r.Z)("safari")||(0,r.Z)("ios")?6:(0,r.Z)("ff")?12:32;class h{constructor(e,t,s=0,r=(e?e.byteLength:0)){this._tag=0,this._dataType=99,this.init(e,t,s,r)}init(e,t,s,r){this._data=e,this._dataView=t,this._pos=s,this._end=r}clone(){return new h(this._data,this._dataView,this._pos,this._end)}pos(){return this._pos}move(e){this._pos=e}nextTag(e){for(;;){if(this._pos===this._end)return!1;const t=this._decodeVarint();if(this._tag=t>>3,this._dataType=7&t,!e||e===this._tag)break;this.skip()}return!0}next(){if(this._pos===this._end)return!1;const e=this._decodeVarint();return this._tag=e>>3,this._dataType=7&e,!0}empty(){return this._pos>=this._end}tag(){return this._tag}getInt32(){return this._decodeVarint()}getInt64(){return this._decodeVarint()}getUInt32(){let e=4294967295;return e=(127&this._data[this._pos])>>>0,this._data[this._pos++]<128?e:(e=(e|(127&this._data[this._pos])<<7)>>>0,this._data[this._pos++]<128?e:(e=(e|(127&this._data[this._pos])<<14)>>>0,this._data[this._pos++]<128?e:(e=(e|(127&this._data[this._pos])<<21)>>>0,this._data[this._pos++]<128?e:(e=(e|(15&this._data[this._pos])<<28)>>>0,this._data[this._pos++]<128?e:void 0))))}getUInt64(){return this._decodeVarint()}getSInt32(){const e=this.getUInt32();return e>>>1^-(1&e)|0}getSInt64(){return this._decodeSVarint()}getBool(){const e=0!==this._data[this._pos];return this._skip(1),e}getEnum(){return this._decodeVarint()}getFixed64(){const e=this._dataView,t=this._pos,s=e.getUint32(t,!0)+e.getUint32(t+4,!0)*n;return this._skip(8),s}getSFixed64(){const e=this._dataView,t=this._pos,s=e.getUint32(t,!0)+e.getInt32(t+4,!0)*n;return this._skip(8),s}getDouble(){const e=this._dataView.getFloat64(this._pos,!0);return this._skip(8),e}getFixed32(){const e=this._dataView.getUint32(this._pos,!0);return this._skip(4),e}getSFixed32(){const e=this._dataView.getInt32(this._pos,!0);return this._skip(4),e}getFloat(){const e=this._dataView.getFloat32(this._pos,!0);return this._skip(4),e}getString(){const e=this._getLength(),t=this._pos,s=this._toString(this._data,t,t+e);return this._skip(e),s}getBytes(){const e=this._getLength(),t=this._pos,s=this._toBytes(this._data,t,t+e);return this._skip(e),s}getLength(){return this._getLengthUnsafe()}processMessageWithArgs(e,t,s,r){const i=this.getMessage(),n=e(i,t,s,r);return i.release(),n}processMessage(e){const t=this.getMessage(),s=e(t);return t.release(),s}getMessage(){const e=this._getLength(),t=h.pool.acquire();return t.init(this._data,this._dataView,this._pos,this._pos+e),this._skip(e),t}release(){h.pool.release(this)}dataType(){return this._dataType}skip(){switch(this._dataType){case 0:this._decodeVarint();break;case 1:this._skip(8);break;case 2:this._skip(this._getLength());break;case 5:this._skip(4);break;default:throw new Error("Invalid data type!")}}skipLen(e){this._skip(e)}_skip(e){if(this._pos+e>this._end)throw new Error("Attempt to skip past the end of buffer!");this._pos+=e}_decodeVarint(){const e=this._data;let t,s=this._pos,r=0;if(this._end-s>=10)do{if(t=e[s++],r|=127&t,0==(128&t))break;if(t=e[s++],r|=(127&t)<<7,0==(128&t))break;if(t=e[s++],r|=(127&t)<<14,0==(128&t))break;if(t=e[s++],r|=(127&t)<<21,0==(128&t))break;if(t=e[s++],r+=268435456*(127&t),0==(128&t))break;if(t=e[s++],r+=34359738368*(127&t),0==(128&t))break;if(t=e[s++],r+=4398046511104*(127&t),0==(128&t))break;if(t=e[s++],r+=562949953421312*(127&t),0==(128&t))break;if(t=e[s++],r+=72057594037927940*(127&t),0==(128&t))break;if(t=e[s++],r+=0x8000000000000000*(127&t),0==(128&t))break;throw new Error("Varint too long!")}while(0);else{let i=1;for(;s!==this._end&&(t=e[s],0!=(128&t));)++s,r+=(127&t)*i,i*=128;if(s===this._end)throw new Error("Varint overrun!");++s,r+=t*i}return this._pos=s,r}_decodeSVarint(){const e=this._decodeVarint();return e%2?-(e+1)/2:e/2}_getLength(){if(2!==this._dataType)throw new Error("Not a delimited data type!");return this._decodeVarint()}_getLengthUnsafe(){return this.getUInt32()}_toString(e,t,s){if((s=Math.min(this._end,s))-t>a&&o){const r=e.subarray(t,s);return o.decode(r)}let r="",i="";for(let n=t;n<s;++n){const t=e[n];128&t?i+="%"+t.toString(16):(r+=decodeURIComponent(i)+String.fromCharCode(t),i="")}return i.length&&(r+=decodeURIComponent(i)),r}_toBytes(e,t,s){return s=Math.min(this._end,s),new Uint8Array(e.buffer,t,s-t)}}h.pool=new i.Z(h,null,(e=>{e._data=null,e._dataView=null}))},43050:(e,t,s)=>{s.d(t,{S1:()=>o,on:()=>u,OY:()=>c,cm:()=>h,N1:()=>a,LR:()=>l,tH:()=>d});var r=s(91460),i=(s(22974),s(95330));const n=/\?(\.|$)/g;function o(e,t,s,r){const i=Array.isArray(t)?t:t.indexOf(",")>-1?t.split(","):[t],o=function(e,t,s,r){return e.watch(t,s,r)}(e,t,s,r);for(const t of i){const r=t.trim().replace(n,"$1"),i=e.get(r);s.call(e,i,i,r,e)}return o}function a(e,t,s,r){return d(e,t,p,s,r)}function h(e,t,s,r){return d(e,t,g,s,r)}function l(e,t,s,r){return d(e,t,f,s,r)}function c(e,t,s,r){return d(e,t,_,s,r)}function u(e,t,s,i,n,a,h){const l={};function c(t){const r=l[t];r&&(a&&a(r.target,t,e,s),r.handle.remove(),delete l[t])}const u=o(e,t,((t,o,a)=>{c(a),(0,r.vT)(t)&&(l[a]={handle:(0,r.on)(t,s,i),target:t},n&&n(t,a,e,s))}),h);return{remove(){u.remove();for(const e in l)c(e)}}}function d(e,t,s,r,n){const o="function"==typeof r?r:null,a="object"==typeof r?r:null;"boolean"==typeof r&&(n=r);let h,l=!1;function c(){h&&(h.remove(),h=null)}const u=(0,i.dD)();(0,i.fu)(a,(()=>{c(),u.reject((0,i.zE)())}));const d={then:u.promise.then.bind(u.promise),catch:u.promise.catch.bind(u.promise),remove:c};return Object.freeze(d),h=function(e,t,s,r,i){const n=e.watch(t,((t,i,n,o)=>{s&&!s(t)||null==r||r.call(e,t,i,n,o)}),i);if(Array.isArray(t))for(const i of t){const n=e.get(i);s&&s(n)&&(null==r||r.call(e,n,n,t,e))}else{const i=e.get(t);s&&s(i)&&(null==r||r.call(e,i,i,t,e))}return n}(e,t,s,((t,s,r,i)=>{l=!0,c(),o&&o.call(e,t,s,r,i),u.resolve({value:t,oldValue:s,propertyName:r,target:i})}),n),l&&c(),d}function p(e){return!!e}function g(e){return!e}function f(e){return!0===e}function _(e){return!1===e}},49385:(e,t,s)=>{s.d(t,{bA:()=>W,Mz:()=>G});var r=s(20102),i=s(80442),n=s(95330),o=s(50758),a=s(92604),h=s(25045);const l=a.Z.getLogger("esri.core.workers.Connection");class c{constructor(){this._clients=new Array,this._clientPromises=new Array,this._clientIdx=0}destroy(){this.close()}get closed(){return!this._clients||!this._clients.length}open(e,t){return new Promise(((s,r)=>{let i=!0;const o=e=>{(0,n.k_)(t.signal),i&&(i=!1,e())};this._clients.length=e.length,this._clientPromises.length=e.length;for(let i=0;i<e.length;++i){const a=e[i];(0,n.y8)(a)?this._clientPromises[i]=a.then((e=>(this._clients[i]=new h.default(e,t),o(s),this._clients[i])),(()=>(o(r),null))):(this._clients[i]=new h.default(a,t),this._clientPromises[i]=Promise.resolve(this._clients[i]),o(s))}}))}broadcast(e,t,s){const r=new Array(this._clientPromises.length);for(let i=0;i<this._clientPromises.length;++i){const n=this._clientPromises[i];r[i]=n.then((r=>r.invoke(e,t,s)))}return r}close(){for(const e of this._clientPromises)e.then((e=>e.close()));this._clients.length=0,this._clientPromises.length=0}getAvailableClient(){let e;for(let t=0;t<this._clients.length;++t){const s=this._clients[t];if(s){if(!s.isBusy())return Promise.resolve(s)}else e=e||[],e.push(this._clientPromises[t])}return e?Promise.race(e):(this._clientIdx=(this._clientIdx+1)%this._clients.length,Promise.resolve(this._clients[this._clientIdx]))}invoke(e,t,s){let r=null;return Array.isArray(s)?(l.warn("invoke()","The transferList parameter is deprecated, use the options object instead"),r={transferList:s}):r=s,this.closed?Promise.reject(new Error("Connection closed")):this.getAvailableClient().then((s=>s.invoke(e,t,r)))}on(e,t){return Promise.all(this._clientPromises).then((()=>(0,o.AL)(this._clients.map((s=>s.on(e,t))))))}openPorts(){return new Promise((e=>{const t=new Array(this._clientPromises.length);let s=t.length;for(let r=0;r<this._clientPromises.length;++r)this._clientPromises[r].then((i=>{t[r]=i.openPort(),0==--s&&e(t)}))}))}get test(){return{numClients:this._clients.length}}}var u=s(40330),d=s(94362),p=s(99880),g=s(68773),f=(s(2587),s(17452));const _={};function m(e){var t;const s={async:e.async,isDebug:e.isDebug,locale:e.locale,baseUrl:e.baseUrl,has:{...e.has},map:{...e.map},packages:e.packages&&e.packages.concat()||[],paths:{...e.paths}};return e.hasOwnProperty("async")||(s.async=!0),e.hasOwnProperty("isDebug")||(s.isDebug=!1),e.baseUrl||(s.baseUrl=_.baseUrl),null==(t=_.packages)||t.forEach((e=>{!function(e,t){for(const s of e)if(s.name===t.name)return;e.push(t)}(s.packages,e)})),s}var y=s(16358);class b{constructor(){const e=document.createDocumentFragment();["addEventListener","dispatchEvent","removeEventListener"].forEach((t=>{this[t]=(...s)=>e[t](...s)}))}}const I=y.Z.MutationObserver||y.Z.WebKitMutationObserver,v=function(){let e;if(y.Z.process&&y.Z.process.nextTick)e=e=>{y.Z.process.nextTick(e)};else if(y.Z.Promise)e=e=>{y.Z.Promise.resolve().then(e)};else if(I){const t=[],s=document.createElement("div");new I((()=>{for(;t.length>0;)t.shift()()})).observe(s,{attributes:!0}),e=e=>{t.push(e),s.setAttribute("queueStatus","1")}}return e}(),x=(()=>{const e=y.Z.MessageEvent;try{new e("message",{data:null})}catch{return(e,t={})=>{const{data:s,bubbles:r=!1,cancelable:i=!1}=t,n=document.createEvent("Event");return n.initEvent(e,r,i),n.data=s,n}}return(t,s)=>new e(t,s)})();class w{constructor(){this._dispatcher=new b,this._workerPostMessage({type:d.Cs.HANDSHAKE})}terminate(){}get onmessage(){return this._onmessageHandler}set onmessage(e){this._onmessageHandler&&this.removeEventListener("message",this._onmessageHandler),this._onmessageHandler=e,e&&this.addEventListener("message",e)}get onmessageerror(){return this._onmessageerrorHandler}set onmessageerror(e){this._onmessageerrorHandler&&this.removeEventListener("messageerror",this._onmessageerrorHandler),this._onmessageerrorHandler=e,e&&this.addEventListener("messageerror",e)}get onerror(){return this._onerrorHandler}set onerror(e){this._onerrorHandler&&this.removeEventListener("error",this._onerrorHandler),this._onerrorHandler=e,e&&this.addEventListener("error",e)}postMessage(e){v((()=>{this._workerMessageHandler(x("message",{data:e}))}))}dispatchEvent(e){return this._dispatcher.dispatchEvent(e)}addEventListener(e,t,s){this._dispatcher.addEventListener(e,t,s)}removeEventListener(e,t,s){this._dispatcher.removeEventListener(e,t,s)}_workerPostMessage(e){v((()=>{this.dispatchEvent(x("message",{data:e}))}))}async _workerMessageHandler(e){const t=(0,d.QM)(e);if(t&&t.type===d.Cs.OPEN){const{modulePath:e,jobId:s}=t;let r=await h.default.loadWorker(e);r||(r=await import(e));const i=h.default.connect(r);this._workerPostMessage({type:d.Cs.OPENED,jobId:s,data:i})}}}var S=s(70171),C=s(17202);const T=a.Z.getLogger("esri.core.workers"),{HANDSHAKE:F}=d.Cs;let k,M;const E="Failed to create Worker. Fallback to execute module in main thread";async function A(e){return new Promise((t=>{function s(i){const n=(0,d.QM)(i);n&&n.type===F&&(e.removeEventListener("message",s),e.removeEventListener("error",r),t(e))}function r(t){t.preventDefault(),e.removeEventListener("message",s),e.removeEventListener("error",r),T.warn("Failed to create Worker. Fallback to execute module in main thread",t),(e=new w).addEventListener("message",s),e.addEventListener("error",r)}e.addEventListener("message",s),e.addEventListener("error",r)}))}let R=0;const O=a.Z.getLogger("esri.core.workers"),{ABORT:L,INVOKE:P,OPEN:D,OPENED:N,RESPONSE:U}=d.Cs;class q{constructor(e,t){this._outJobs=new Map,this._inJobs=new Map,this.worker=e,this.id=t,e.addEventListener("message",this._onMessage.bind(this)),e.addEventListener("error",(e=>{e.preventDefault(),O.error(e)}))}static async create(e){const t=await async function(){if(!(0,i.Z)("esri-workers"))return A(new w);if(!k&&!M)try{const e='let globalId=0;const outgoing=new Map,configuration=JSON.parse("{CONFIGURATION}");self.esriConfig=configuration.esriConfig;const workerPath=self.esriConfig.workers.workerPath,HANDSHAKE=0,OPEN=1,OPENED=2,RESPONSE=3,INVOKE=4,ABORT=5;function createAbortError(){const e=new Error("Aborted");return e.name="AbortError",e}function receiveMessage(e){return e&&e.data?"string"==typeof e.data?JSON.parse(e.data):e.data:null}function invokeStaticMessage(e,o,r){const t=r&&r.signal,n=globalId++;return new Promise(((r,i)=>{if(t){if(t.aborted)return i(createAbortError());t.addEventListener("abort",(()=>{outgoing.get(n)&&(outgoing.delete(n),self.postMessage({type:5,jobId:n}),i(createAbortError()))}))}outgoing.set(n,{resolve:r,reject:i}),self.postMessage({type:4,jobId:n,methodName:e,abortable:null!=t,data:o})}))}let workerRevisionChecked=!1;function checkWorkerRevision(e){if(!workerRevisionChecked&&e.kernelInfo){workerRevisionChecked=!0;const{revision:o,buildDate:r,version:t}=configuration.kernelInfo,{revision:n,buildDate:i,version:s}=e.kernelInfo;o!==n&&console.warn(`[esri.core.workers] Version mismatch detected between ArcGIS API for JavaScript and assets:\nAPI version: ${t} [Date: ${r}, Revision: ${o.slice(0,8)}]\nAssets version: ${s} [Date: ${i}, Revision: ${n.slice(0,8)}]`)}}function messageHandler(e){const o=receiveMessage(e);if(!o)return;const r=o.jobId;switch(o.type){case 1:let e;function t(o){const t=e.connect(o);self.postMessage({type:2,jobId:r,data:t},[t])}"function"==typeof define&&define.amd?require([workerPath],(r=>{e=r.default||r,checkWorkerRevision(e),e.loadWorker(o.modulePath).then((e=>e||new Promise((e=>{require([o.modulePath],e)})))).then(t)})):"System"in self&&"function"==typeof System.import?System.import(workerPath).then((r=>(e=r.default,checkWorkerRevision(e),e.loadWorker(o.modulePath)))).then((e=>e||System.import(o.modulePath))).then(t):(self.RemoteClient||importScripts(workerPath),e=self.RemoteClient.default||self.RemoteClient,checkWorkerRevision(e),e.loadWorker(o.modulePath).then(t));break;case 3:if(outgoing.has(r)){const e=outgoing.get(r);outgoing.delete(r),o.error?e.reject(JSON.parse(o.error)):e.resolve(o.data)}}}self.dojoConfig=configuration.loaderConfig,esriConfig.workers.loaderUrl&&(self.importScripts(esriConfig.workers.loaderUrl),"function"==typeof require&&"function"==typeof require.config&&require.config(configuration.loaderConfig)),self.addEventListener("message",messageHandler),self.postMessage({type:0});'.replace('"{CONFIGURATION}"',`'${function(){let e;if(null!=g.Z.default){const t={...g.Z};delete t.default,e=JSON.parse(JSON.stringify(t))}else e=JSON.parse(JSON.stringify(g.Z));e.assetsPath=(0,f.hF)(e.assetsPath),e.request.interceptors=[],e.log.interceptors=[],e.locale=(0,S.Kd)(),e.has={"csp-restrictions":(0,i.Z)("csp-restrictions"),"esri-2d-debug":!1,"esri-2d-update-debug":(0,i.Z)("esri-2d-update-debug"),"esri-2d-query-centroid-enabled":(0,i.Z)("esri-2d-query-centroid-enabled"),"featurelayer-pbf":(0,i.Z)("featurelayer-pbf"),"esri-atomics":(0,i.Z)("esri-atomics"),"esri-shared-array-buffer":(0,i.Z)("esri-shared-array-buffer"),"esri-tiles-debug":(0,i.Z)("esri-tiles-debug"),"esri-workers-arraybuffer-transfer":(0,i.Z)("esri-workers-arraybuffer-transfer"),"host-webworker":1},e.workers.loaderUrl&&(e.workers.loaderUrl=(0,f.hF)(e.workers.loaderUrl)),e.workers.workerPath?e.workers.workerPath=(0,f.hF)(e.workers.workerPath):e.workers.workerPath=(0,f.hF)((0,p.V)("esri/core/workers/RemoteClient.js"));const t=g.Z.workers.loaderConfig,s=m({baseUrl:null==t?void 0:t.baseUrl,locale:(0,S.Kd)(),has:{"csp-restrictions":(0,i.Z)("csp-restrictions"),"dojo-test-sniff":0,"host-webworker":1,...null==t?void 0:t.has},map:{...null==t?void 0:t.map},paths:{...null==t?void 0:t.paths},packages:(null==t?void 0:t.packages)||[]}),r={version:u.i8,buildDate:C.r,revision:C.$};return JSON.stringify({esriConfig:e,loaderConfig:s,kernelInfo:r})}()}'`);k=URL.createObjectURL(new Blob([e],{type:"text/javascript"}))}catch(e){M=e||{}}let e;if(k)try{e=new Worker(k,{name:"esri-worker-"+R++})}catch(t){T.warn(E,M),e=new w}else T.warn(E,M),e=new w;return A(e)}();return new q(t,e)}terminate(){this.worker.terminate()}async open(e,t={}){const{signal:s}=t,r=(0,d.jt)();return new Promise(((t,i)=>{const o={resolve:t,reject:i,abortHandle:(0,n.$F)(s,(()=>{this._outJobs.delete(r),this._post({type:L,jobId:r})}))};this._outJobs.set(r,o),this._post({type:D,jobId:r,modulePath:e})}))}_onMessage(e){const t=(0,d.QM)(e);if(t)switch(t.type){case N:this._onOpenedMessage(t);break;case U:this._onResponseMessage(t);break;case L:this._onAbortMessage(t);break;case P:this._onInvokeMessage(t)}}_onAbortMessage(e){const t=this._inJobs,s=e.jobId,r=t.get(s);r&&(r.controller&&r.controller.abort(),t.delete(s))}_onInvokeMessage(e){const{methodName:t,jobId:s,data:r,abortable:i}=e,o=i?(0,n.yi)():null,a=this._inJobs,h=u.Nv[t];let l;try{if("function"!=typeof h)throw new TypeError(`${t} is not a function`);l=h.call(null,r,{signal:o?o.signal:null})}catch(e){return void this._post({type:U,jobId:s,error:(0,d.AB)(e)})}(0,n.y8)(l)?(a.set(s,{controller:o,promise:l}),l.then((e=>{a.has(s)&&(a.delete(s),this._post({type:U,jobId:s},e))}),(e=>{a.has(s)&&(a.delete(s),e||(e={message:"Error encountered at method"+t}),(0,n.D_)(e)||this._post({type:U,jobId:s,error:(0,d.AB)(e||{message:`Error encountered at method ${t}`})}))}))):this._post({type:U,jobId:s},l)}_onOpenedMessage(e){var t;const{jobId:s,data:r}=e,i=this._outJobs.get(s);i&&(this._outJobs.delete(s),null==(t=i.abortHandle)||t.remove(),i.resolve(r))}_onResponseMessage(e){var t;const{jobId:s,error:i,data:n}=e,o=this._outJobs.get(s);o&&(this._outJobs.delete(s),null==(t=o.abortHandle)||t.remove(),i?o.reject(r.Z.fromJSON(JSON.parse(i))):o.resolve(n))}_post(e,t,s){return(0,d.oi)(this.worker,e,t,s)}}let z=(0,i.Z)("esri-workers-debug")?1:(0,i.Z)("host-browser")?navigator.hardwareConcurrency-1:0;z||(z=(0,i.Z)("safari")&&(0,i.Z)("mac")||(0,i.Z)("trident")?7:2);let Z=0;const B=[];function G(e,t){return j(e,{client:t})}async function j(e,t){const s=new c;return await s.open(e,t),s}async function W(e,t={}){if("string"!=typeof e)throw new r.Z("workers:undefined-module","modulePath is missing");let s=t.strategy||"distributed";if((0,i.Z)("host-webworker")&&!(0,i.Z)("esri-workers")&&(s="local"),"local"===s){let s=await h.default.loadWorker(e);s||(s=await import(e)),(0,n.k_)(t.signal);const r=t.client||s;return j([h.default.connect(s)],{...t,client:r})}if(await async function(){if(V)return V;X=(0,n.yi)();const e=[];for(let t=0;t<z;t++){const s=q.create(t).then((e=>(B[t]=e,e)));e.push(s)}return V=Promise.all(e),V}(),(0,n.k_)(t.signal),"dedicated"===s){const s=Z++%z;return j([await B[s].open(e,t)],t)}if(t.maxNumWorkers&&t.maxNumWorkers>0){const s=Math.min(t.maxNumWorkers,z);if(s<z){const r=new Array(s);for(let i=0;i<s;++i){const s=Z++%z;r[i]=B[s].open(e,t)}return j(r,t)}}return j(B.map((s=>s.open(e,t))),t)}let X,V=null},39450:(e,t,s)=>{s.d(t,{Z:()=>c});var r,i=s(43697),n=s(10736),o=s(5600),a=(s(80442),s(75215)),h=(s(92604),s(52525));let l=r=class extends n.wq{constructor(e){super(e),this.cols=null,this.level=0,this.levelValue=null,this.resolution=0,this.rows=null,this.scale=0}clone(){return new r({cols:this.cols,level:this.level,levelValue:this.levelValue,resolution:this.resolution,rows:this.rows,scale:this.scale})}};(0,i._)([(0,o.Cb)({type:Number,json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],l.prototype,"cols",void 0),(0,i._)([(0,o.Cb)({type:a.z8,json:{write:!0}})],l.prototype,"level",void 0),(0,i._)([(0,o.Cb)({type:String,json:{write:!0}})],l.prototype,"levelValue",void 0),(0,i._)([(0,o.Cb)({type:Number,json:{write:!0}})],l.prototype,"resolution",void 0),(0,i._)([(0,o.Cb)({type:Number,json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],l.prototype,"rows",void 0),(0,i._)([(0,o.Cb)({type:Number,json:{write:!0}})],l.prototype,"scale",void 0),l=r=(0,i._)([(0,h.j)("esri.layers.support.LOD")],l);var c=l},11145:(e,t,s)=>{s.d(t,{Z:()=>x});var r,i=s(43697),n=s(35454),o=s(10736),a=s(70586),h=s(67900),l=s(5600),c=(s(80442),s(75215)),u=(s(92604),s(71715)),d=s(52525),p=s(30556),g=s(13473),f=s(82971),_=s(24470),m=s(8744),y=s(40488),b=s(39450);const I=new n.Xn({PNG:"png",PNG8:"png8",PNG24:"png24",PNG32:"png32",JPEG:"jpg",JPG:"jpg",DIB:"dib",TIFF:"tiff",EMF:"emf",PS:"ps",PDF:"pdf",GIF:"gif",SVG:"svg",SVGZ:"svgz",Mixed:"mixed",MIXED:"mixed",LERC:"lerc",LERC2D:"lerc2d",RAW:"raw",pbf:"pbf"});let v=r=class extends o.wq{constructor(e){super(e),this.dpi=96,this.format=null,this.origin=null,this.minScale=0,this.maxScale=0,this.size=null,this.spatialReference=null}static create(e={}){const{resolutionFactor:t=1,scales:s,size:i=256,spatialReference:n=f.Z.WebMercator,numLODs:o=24}=e;if(!(0,m.JY)(n)){const e=[];if(s)for(let t=0;t<s.length;t++){const r=s[t];e.push({level:t,scale:r,resolution:r})}else{let t=5e-4;for(let s=o-1;s>=0;s--)e.unshift({level:s,scale:t,resolution:t}),t*=2}return new r({dpi:96,lods:e,origin:new g.Z(0,0,n),size:[i,i],spatialReference:n})}const a=(0,m.C5)(n),l=e.origin?new g.Z({x:e.origin.x,y:e.origin.y,spatialReference:n}):new g.Z(a?{x:a.origin[0],y:a.origin[1],spatialReference:n}:{x:0,y:0,spatialReference:n}),c=1/(39.37*(0,h.c9)(n)*96),u=[];if(s)for(let e=0;e<s.length;e++){const t=s[e],r=t*c;u.push({level:e,scale:t,resolution:r})}else{let e=(0,m.sT)(n)?512/i*591657527.5917094:256/i*591657527.591555;const s=Math.ceil(o/t);u.push({level:0,scale:e,resolution:e*c});for(let r=1;r<s;r++){const s=e/2**t,i=s*c;u.push({level:r,scale:s,resolution:i}),e=s}}return new r({dpi:96,lods:u,origin:l,size:[i,i],spatialReference:n})}get isWrappable(){const{spatialReference:e,origin:t}=this;if(e&&t){const s=(0,m.C5)(e);return e.isWrappable&&Math.abs(s.origin[0]-t.x)<=s.dx}return!1}readOrigin(e,t){return g.Z.fromJSON({spatialReference:t.spatialReference,...e})}set lods(e){let t=0,s=0;const r=[];this._levelToLOD={},e&&(t=-1/0,s=1/0,e.forEach((e=>{r.push(e.scale),t=e.scale>t?e.scale:t,s=e.scale<s?e.scale:s,this._levelToLOD[e.level]=e}))),this._set("scales",r),this._set("minScale",t),this._set("maxScale",s),this._set("lods",e),this._initializeUpsampleLevels()}readSize(e,t){return[t.cols,t.rows]}writeSize(e,t){t.cols=e[0],t.rows=e[1]}zoomToScale(e){const t=this.scales;if(e<=0)return t[0];if(e>=t.length-1)return t[t.length-1];{const s=Math.floor(e),r=s+1;return t[s]/(t[s]/t[r])**(e-s)}}scaleToZoom(e){const t=this.scales,s=t.length-1;let r=0;for(;r<s;r++){const s=t[r],i=t[r+1];if(s<=e)return r;if(i===e)return r+1;if(s>e&&i<e)return r+Math.log(s/e)/Math.log(s/i)}return r}snapScale(e,t=.95){const s=this.scaleToZoom(e);return s%Math.floor(s)>=t?this.zoomToScale(Math.ceil(s)):this.zoomToScale(Math.floor(s))}tileAt(e,t,s,r){const i=this.lodAt(e);if(!i)return null;let n,o;if("number"==typeof t)n=t,o=s;else if((0,m.fS)(t.spatialReference,this.spatialReference))n=t.x,o=t.y,r=s;else{const e=(0,y.iV)(t,this.spatialReference);if((0,a.Wi)(e))return null;n=e.x,o=e.y,r=s}const h=i.resolution*this.size[0],l=i.resolution*this.size[1];return r||(r={id:null,level:0,row:0,col:0,extent:(0,_.Ue)()}),r.level=e,r.row=Math.floor((this.origin.y-o)/l+.001),r.col=Math.floor((n-this.origin.x)/h+.001),this.updateTileInfo(r),r}updateTileInfo(e,t=0){let s=this.lodAt(e.level);if(!s&&1===t){const t=this.lods[this.lods.length-1];t.level<e.level&&(s=t)}if(!s)return;const r=e.level-s.level,i=s.resolution*this.size[0]/2**r,n=s.resolution*this.size[1]/2**r;e.id=`${e.level}/${e.row}/${e.col}`,e.extent||(e.extent=(0,_.Ue)()),e.extent[0]=this.origin.x+e.col*i,e.extent[1]=this.origin.y-(e.row+1)*n,e.extent[2]=e.extent[0]+i,e.extent[3]=e.extent[1]+n}upsampleTile(e){const t=this._upsampleLevels[e.level];return!(!t||-1===t.parentLevel||(e.level=t.parentLevel,e.row=Math.floor(e.row/t.factor+.001),e.col=Math.floor(e.col/t.factor+.001),this.updateTileInfo(e),0))}getTileBounds(e,t){const{resolution:s}=this.lodAt(t.level),r=s*this.size[0],i=s*this.size[1];return e[0]=this.origin.x+t.col*r,e[1]=this.origin.y-(t.row+1)*i,e[2]=e[0]+r,e[3]=e[1]+i,e}lodAt(e){return this._levelToLOD&&this._levelToLOD[e]||null}clone(){return r.fromJSON(this.write({}))}_initializeUpsampleLevels(){const e=this.lods;this._upsampleLevels=[];let t=null;for(let s=0;s<e.length;s++){const r=e[s];this._upsampleLevels[r.level]={parentLevel:t?t.level:-1,factor:t?t.resolution/r.resolution:0},t=r}}};(0,i._)([(0,l.Cb)({type:Number,json:{write:!0}})],v.prototype,"compressionQuality",void 0),(0,i._)([(0,l.Cb)({type:Number,json:{write:!0}})],v.prototype,"dpi",void 0),(0,i._)([(0,l.Cb)({type:String,json:{read:I.read,write:I.write,origins:{"web-scene":{read:!1,write:!1}}}})],v.prototype,"format",void 0),(0,i._)([(0,l.Cb)({readOnly:!0})],v.prototype,"isWrappable",null),(0,i._)([(0,l.Cb)({type:g.Z,json:{write:!0}})],v.prototype,"origin",void 0),(0,i._)([(0,u.r)("origin")],v.prototype,"readOrigin",null),(0,i._)([(0,l.Cb)({type:[b.Z],value:null,json:{write:!0}})],v.prototype,"lods",null),(0,i._)([(0,l.Cb)({readOnly:!0})],v.prototype,"minScale",void 0),(0,i._)([(0,l.Cb)({readOnly:!0})],v.prototype,"maxScale",void 0),(0,i._)([(0,l.Cb)({readOnly:!0})],v.prototype,"scales",void 0),(0,i._)([(0,l.Cb)({cast:e=>Array.isArray(e)?e:"number"==typeof e?[e,e]:[256,256]})],v.prototype,"size",void 0),(0,i._)([(0,u.r)("size",["rows","cols"])],v.prototype,"readSize",null),(0,i._)([(0,p.c)("size",{cols:{type:c.z8},rows:{type:c.z8}})],v.prototype,"writeSize",null),(0,i._)([(0,l.Cb)({type:f.Z,json:{write:!0}})],v.prototype,"spatialReference",void 0),v=r=(0,i._)([(0,d.j)("esri.layers.support.TileInfo")],v);var x=v},66677:(e,t,s)=>{s.d(t,{ld:()=>g,B5:()=>u,M8:()=>_,G:()=>I,Qc:()=>d,DR:()=>p,Nm:()=>m,XG:()=>y,a7:()=>f,wH:()=>b});var r=s(70586),i=s(17452),n=s(25929);const o={mapserver:"MapServer",imageserver:"ImageServer",featureserver:"FeatureServer",sceneserver:"SceneServer",streamserver:"StreamServer",vectortileserver:"VectorTileServer"},a=Object.values(o),h=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),l=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/([^\\/\\n]+)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),c=/(.*?)\/(?:layers\/)?(\d+)\/?$/i;function u(e){return!!h.test(e)}function d(e){const t=(0,i.mN)(e),s=t.path.match(h)||t.path.match(l);if(!s)return null;const[,r,n,a,c]=s,u=n.indexOf("/");return{title:g(-1!==u?n.slice(u+1):n),serverType:o[a.toLowerCase()],sublayer:null!=c&&""!==c?parseInt(c,10):null,url:{path:r}}}function p(e){const t=(0,i.mN)(e).path.match(c);return t?{serviceUrl:t[1],sublayerId:Number(t[2])}:null}function g(e){return(e=e.replace(/\s*[/_]+\s*/g," "))[0].toUpperCase()+e.slice(1)}function f(e,t){const s=[];if(e){const t=d(e);(0,r.pC)(t)&&t.title&&s.push(t.title)}if(t){const e=g(t);s.push(e)}if(2===s.length){if(-1!==s[0].toLowerCase().indexOf(s[1].toLowerCase()))return s[0];if(-1!==s[1].toLowerCase().indexOf(s[0].toLowerCase()))return s[1]}return s.join(" - ")}function _(e){if(!e)return!1;const t=-1!==(e=e.toLowerCase()).indexOf(".arcgis.com/"),s=-1!==e.indexOf("//services")||-1!==e.indexOf("//tiles")||-1!==e.indexOf("//features");return t&&s}function m(e,t){return e?(0,i.Qj)((0,i.Hu)(e,t)):e}function y(e){let{url:t}=e;if(!t)return{url:t};t=(0,i.Hu)(t,e.logger);const s=(0,i.mN)(t),n=d(s.path);let o;if((0,r.pC)(n))null!=n.sublayer&&null==e.layer.layerId&&(o=n.sublayer),t=n.url.path;else if(e.nonStandardUrlAllowed){const e=p(s.path);(0,r.pC)(e)&&(t=e.serviceUrl,o=e.sublayerId)}return{url:(0,i.Qj)(t),layerId:o}}function b(e,t,s,r,o){(0,n.w)(t,r,"url",o),r.url&&null!=e.layerId&&(r.url=(0,i.v_)(r.url,s,e.layerId.toString()))}function I(e){if(!e)return!1;const t=e.toLowerCase(),s=-1!==t.indexOf("/services/"),r=-1!==t.indexOf("/mapserver/wmsserver"),i=-1!==t.indexOf("/imageserver/wmsserver"),n=-1!==t.indexOf("/wmsserver");return s&&(r||i||n)}},77863:(e,t,s)=>{s.d(t,{K9:()=>M,O7:()=>u,G$:()=>S});var r=s(20102),i=s(70586),n=s(45091),o=s(5428),a=s(78760);const h=["esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeString","esriFieldTypeDate","esriFieldTypeOID","esriFieldTypeGeometry","esriFieldTypeBlob","esriFieldTypeRaster","esriFieldTypeGUID","esriFieldTypeGlobalID","esriFieldTypeXML"],l=["sqlTypeBigInt","sqlTypeBinary","sqlTypeBit","sqlTypeChar","sqlTypeDate","sqlTypeDecimal","sqlTypeDouble","sqlTypeFloat","sqlTypeGeometry","sqlTypeGUID","sqlTypeInteger","sqlTypeLongNVarchar","sqlTypeLongVarbinary","sqlTypeLongVarchar","sqlTypeNChar","sqlTypeNVarchar","sqlTypeOther","sqlTypeReal","sqlTypeSmallInt","sqlTypeSqlXml","sqlTypeTime","sqlTypeTimestamp","sqlTypeTimestamp2","sqlTypeTinyInt","sqlTypeVarbinary","sqlTypeVarchar"],c=["upperLeft","lowerLeft"];function u(e){return e>=h.length?null:h[e]}function d(e){return e>=l.length?null:l[e]}function p(e){return e>=c.length?null:c[e]}function g(e,t){return t>=e.geometryTypes.length?null:e.geometryTypes[t]}function f(e,t,s){const r=t.createPointGeometry(s);for(;e.next();)switch(e.tag()){case 3:{const s=e.getUInt32(),i=e.pos()+s;let n=0;for(;e.pos()<i;)t.addCoordinatePoint(r,e.getSInt64(),n++);break}default:e.skip()}return r}function _(e,t,s){const r=t.createGeometry(s),i=2+(s.hasZ?1:0)+(s.hasM?1:0);for(;e.next();)switch(e.tag()){case 2:{const s=e.getUInt32(),i=e.pos()+s;let n=0;for(;e.pos()<i;)t.addLength(r,e.getUInt32(),n++);break}case 3:{const s=e.getUInt32(),n=e.pos()+s;let o=0;for(t.allocateCoordinates(r);e.pos()<n;)t.addCoordinate(r,e.getSInt64(),o),o++,o===i&&(o=0);break}default:e.skip()}return r}function m(e){const t=new o.Z;let s="esriGeometryPoint";for(;e.next();)switch(e.tag()){case 2:{const s=e.getUInt32(),r=e.pos()+s;for(;e.pos()<r;)t.lengths.push(e.getUInt32());break}case 3:{const s=e.getUInt32(),r=e.pos()+s;for(;e.pos()<r;)t.coords.push(e.getSInt64());break}case 1:s=a.A[e.getEnum()];break;default:e.skip()}return{queryGeometry:t,queryGeometryType:s}}function y(e){for(;e.next();)switch(e.tag()){case 1:return e.getString();case 2:return e.getFloat();case 3:return e.getDouble();case 4:return e.getSInt32();case 5:return e.getUInt32();case 6:return e.getInt64();case 7:return e.getUInt64();case 8:return e.getSInt64();case 9:return e.getBool();default:return e.skip(),null}return null}function b(e){const t={type:u(0)};for(;e.next();)switch(e.tag()){case 1:t.name=e.getString();break;case 2:t.type=u(e.getEnum());break;case 3:t.alias=e.getString();break;case 4:t.sqlType=d(e.getEnum());break;case 5:e.skip();break;case 6:t.defaultValue=e.getString();break;default:e.skip()}return t}function I(e){const t={};for(;e.next();)switch(e.tag()){case 1:t.name=e.getString();break;case 2:t.isSystemMaintained=e.getBool();break;default:e.skip()}return t}function v(e,t,s,r){const i=t.createFeature(s);let n=0;for(;e.next();)switch(e.tag()){case 1:{const t=r[n++].name;i.attributes[t]=e.processMessage(y);break}case 2:i.geometry=e.processMessageWithArgs(_,t,s);break;case 4:i.centroid=e.processMessageWithArgs(f,t,s);break;default:e.skip()}return i}function x(e){const t=[1,1,1,1];for(;e.next();)switch(e.tag()){case 1:t[0]=e.getDouble();break;case 2:t[1]=e.getDouble();break;case 4:t[2]=e.getDouble();break;case 3:t[3]=e.getDouble();break;default:e.skip()}return t}function w(e){const t=[0,0,0,0];for(;e.next();)switch(e.tag()){case 1:t[0]=e.getDouble();break;case 2:t[1]=e.getDouble();break;case 4:t[2]=e.getDouble();break;case 3:t[3]=e.getDouble();break;default:e.skip()}return t}function S(e){const t={originPosition:p(0)};for(;e.next();)switch(e.tag()){case 1:t.originPosition=p(e.getEnum());break;case 2:t.scale=e.processMessage(x);break;case 3:t.translate=e.processMessage(w);break;default:e.skip()}return t}function C(e){const t={};for(;e.next();)switch(e.tag()){case 1:t.shapeAreaFieldName=e.getString();break;case 2:t.shapeLengthFieldName=e.getString();break;case 3:t.units=e.getString();break;default:e.skip()}return t}function T(e,t){const s=t.createSpatialReference();for(;e.next();)switch(e.tag()){case 1:s.wkid=e.getUInt32();break;case 5:s.wkt=e.getString();break;case 2:s.latestWkid=e.getUInt32();break;case 3:s.vcsWkid=e.getUInt32();break;case 4:s.latestVcsWkid=e.getUInt32();break;default:e.skip()}return s}function F(e,t){const s=t.createFeatureResult();s.geometryType=g(t,0);let r=!1;for(;e.next();)switch(e.tag()){case 1:s.objectIdFieldName=e.getString();break;case 3:s.globalIdFieldName=e.getString();break;case 4:s.geohashFieldName=e.getString();break;case 5:s.geometryProperties=e.processMessage(C);break;case 7:s.geometryType=g(t,e.getEnum());break;case 8:s.spatialReference=e.processMessageWithArgs(T,t);break;case 10:s.hasZ=e.getBool();break;case 11:s.hasM=e.getBool();break;case 12:s.transform=e.processMessage(S);break;case 9:{const t=e.getBool();s.exceededTransferLimit=t;break}case 13:t.addField(s,e.processMessage(b));break;case 15:r||(t.prepareFeatures(s),r=!0),t.addFeature(s,e.processMessageWithArgs(v,t,s,s.fields));break;case 2:s.uniqueIdField=e.processMessage(I);break;default:e.skip()}return t.finishFeatureResult(s),s}function k(e,t){const s={};let r=null;for(;e.next();)switch(e.tag()){case 4:r=e.processMessageWithArgs(m);break;case 1:s.featureResult=e.processMessageWithArgs(F,t);break;default:e.skip()}return(0,i.pC)(r)&&s.featureResult&&t.addQueryGeometry(s,r),s}function M(e,t){try{const s=2,r=new n.Z(new Uint8Array(e),new DataView(e)),i={};for(;r.next();)r.tag()===s?i.queryResult=r.processMessageWithArgs(k,t):r.skip();return i}catch(e){throw new r.Z("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:e})}}},78760:(e,t,s)=>{s.d(t,{A:()=>h,J:()=>l});var r=s(67900),i=s(8744),n=s(70272),o=s(44876),a=s(5428);const h=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"];class l{constructor(e){this.options=e,this.geometryTypes=h,this._coordinatePtr=0,this._vertexDimension=0}createFeatureResult(){return new o.Z}prepareFeatures(e){this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&this._vertexDimension++}finishFeatureResult(e){if(!e||!e.features||!e.hasZ||!this.options.sourceSpatialReference||!e.spatialReference||(0,i.fS)(e.spatialReference,this.options.sourceSpatialReference)||e.spatialReference.vcsWkid)return;const t=(0,r._R)(this.options.sourceSpatialReference)/(0,r._R)(e.spatialReference);if(1!==t)for(const s of e.features){if(!(0,n.S6)(s))continue;const e=s.geometry.coords;for(let s=2;s<e.length;s+=3)e[s]*=t}}addFeature(e,t){e.features.push(t)}createFeature(){return new n.ZP}createSpatialReference(){return{wkid:0}}createGeometry(){return new a.Z}addField(e,t){e.fields.push(t)}allocateCoordinates(e){e.coords.length=e.lengths.reduce(((e,t)=>e+t),0)*this._vertexDimension,this._coordinatePtr=0}addCoordinate(e,t){e.coords[this._coordinatePtr++]=t}addCoordinatePoint(e,t){e.coords.push(t)}addLength(e,t){e.lengths.push(t)}addQueryGeometry(e,t){e.queryGeometry=t.queryGeometry,e.queryGeometryType=t.queryGeometryType}createPointGeometry(){return new a.Z}}},45178:(e,t,s)=>{s.d(t,{C:()=>i});var r=s(77863);function i(e,t){const s=(0,r.K9)(e,t),i=s.queryResult.featureResult,n=s.queryResult.queryGeometry,o=s.queryResult.queryGeometryType;if(i&&i.features&&i.features.length&&i.objectIdFieldName){const e=i.objectIdFieldName;for(const t of i.features)t.attributes&&(t.objectId=t.attributes[e])}return i&&(i.queryGeometry=n,i.queryGeometryType=o),i}},34599:(e,t,s)=>{s.r(t),s.d(t,{executeQuery:()=>p,executeQueryForCount:()=>m,executeQueryForExtent:()=>y,executeQueryForIds:()=>_,executeQueryPBF:()=>g,executeQueryPBFBuffer:()=>f,queryToQueryStringParameters:()=>d,runQuery:()=>b});var r=s(3172),i=s(70586),n=s(17452),o=s(33955),a=s(38581),h=s(45178),l=s(28694),c=s(99306);const u="Layer does not support extent calculation.";function d(e,t){const s=e.geometry,r=e.toJSON(),n=r;if((0,i.pC)(s)&&(n.geometry=JSON.stringify(s),n.geometryType=(0,o.Ji)(s),n.inSR=s.spatialReference.wkid||JSON.stringify(s.spatialReference)),r.groupByFieldsForStatistics&&(n.groupByFieldsForStatistics=r.groupByFieldsForStatistics.join(",")),r.objectIds&&(n.objectIds=r.objectIds.join(",")),r.orderByFields&&(n.orderByFields=r.orderByFields.join(",")),!r.outFields||!r.returnDistinctValues&&(null!=t&&t.returnCountOnly||null!=t&&t.returnExtentOnly||null!=t&&t.returnIdsOnly)?delete n.outFields:-1!==r.outFields.indexOf("*")?n.outFields="*":n.outFields=r.outFields.join(","),r.outSR?n.outSR=r.outSR.wkid||JSON.stringify(r.outSR):s&&(r.returnGeometry||r.returnCentroid)&&(n.outSR=n.inSR),r.returnGeometry&&delete r.returnGeometry,r.outStatistics&&(n.outStatistics=JSON.stringify(r.outStatistics)),r.pixelSize&&(n.pixelSize=JSON.stringify(r.pixelSize)),r.quantizationParameters&&(n.quantizationParameters=JSON.stringify(r.quantizationParameters)),r.parameterValues&&(n.parameterValues=JSON.stringify(r.parameterValues)),r.rangeValues&&(n.rangeValues=JSON.stringify(r.rangeValues)),r.dynamicDataSource&&(n.layer=JSON.stringify({source:r.dynamicDataSource}),delete r.dynamicDataSource),r.timeExtent){const e=r.timeExtent,{start:t,end:s}=e;null==t&&null==s||(n.time=t===s?t:`${null==t?"null":t},${null==s?"null":s}`),delete r.timeExtent}return n}async function p(e,t,s,r){const n=(0,i.pC)(t.timeExtent)&&t.timeExtent.isEmpty?{data:{features:[]}}:await b(e,t,"json",r);return(0,l.p)(t,s,n.data),n}async function g(e,t,s,r){if((0,i.pC)(t.timeExtent)&&t.timeExtent.isEmpty)return Promise.resolve({data:s.createFeatureResult()});const n=await f(e,t,r),o=n;return o.data=(0,h.C)(n.data,s),o}function f(e,t,s){return b(e,t,"pbf",s)}function _(e,t,s){return(0,i.pC)(t.timeExtent)&&t.timeExtent.isEmpty?Promise.resolve({data:{objectIds:[]}}):b(e,t,"json",s,{returnIdsOnly:!0})}function m(e,t,s){return(0,i.pC)(t.timeExtent)&&t.timeExtent.isEmpty?Promise.resolve({data:{count:0}}):b(e,t,"json",s,{returnIdsOnly:!0,returnCountOnly:!0})}function y(e,t,s){return(0,i.pC)(t.timeExtent)&&t.timeExtent.isEmpty?Promise.resolve({data:{count:0,extent:null}}):b(e,t,"json",s,{returnExtentOnly:!0,returnCountOnly:!0}).then((e=>{const t=e.data;if(t.hasOwnProperty("extent"))return e;if(t.features)throw new Error(u);if(t.hasOwnProperty("count"))throw new Error(u);return e}))}function b(e,t,s,o={},h={}){const l="string"==typeof e?(0,n.mN)(e):e,u=t.geometry?[t.geometry]:[];return o.responseType="pbf"===s?"array-buffer":"json",(0,a.aX)(u,null,o).then((e=>{const a=e&&e[0];(0,i.pC)(a)&&((t=t.clone()).geometry=a);const u=(0,c.A)({...l.query,f:s,...h,...d(t,h)});return(0,r.default)((0,n.v_)(l.path,"query"),{...o,query:{...u,...o.query}})}))}},28694:(e,t,s)=>{s.d(t,{p:()=>i});var r=s(50459);function i(e,t,s){if(!s||!s.features||!s.hasZ)return;const i=(0,r.k)(s.geometryType,t,e.outSpatialReference);if(i)for(const e of s.features)i(e.geometry)}},50459:(e,t,s)=>{s.d(t,{k:()=>o,P:()=>h});var r=s(70586),i=s(67900),n=s(8744);function o(e,t,s){if((0,r.Wi)(t)||(0,r.Wi)(s)||s.vcsWkid||(0,n.fS)(t,s))return null;const o=(0,i._R)(t)/(0,i._R)(s);if(1===o)return null;switch(e){case"point":case"esriGeometryPoint":return e=>function(e,t){e&&null!=e.z&&(e.z*=t)}(e,o);case"polyline":case"esriGeometryPolyline":return e=>function(e,t){if(e)for(const s of e.paths)for(const e of s)e.length>2&&(e[2]*=t)}(e,o);case"polygon":case"esriGeometryPolygon":return e=>function(e,t){if(e)for(const s of e.rings)for(const e of s)e.length>2&&(e[2]*=t)}(e,o);case"multipoint":case"esriGeometryMultipoint":return e=>function(e,t){if(e)for(const s of e.points)s.length>2&&(s[2]*=t)}(e,o);default:return null}}function a(e,t,s){if(null==e.hasM||e.hasZ)for(const e of t)for(const t of e)t.length>2&&(t[2]*=s)}function h(e,t,s){if(!e&&!t||!s)return;const r=(0,i._R)(s);l(e,s,r),l(t,s,r)}function l(e,t,s){if(e)for(const r of e)c(r.geometry,t,s)}function c(e,t,s){if((0,r.Wi)(e)||!e.spatialReference||(0,n.fS)(e.spatialReference,t))return;const o=(0,i._R)(e.spatialReference)/s;if(1!==o)if("x"in e)null!=e.z&&(e.z*=o);else if("rings"in e)a(e,e.rings,o);else if("paths"in e)a(e,e.paths,o);else if("points"in e&&(null==e.hasM||e.hasZ))for(const t of e.points)t.length>2&&(t[2]*=o)}},99306:(e,t,s)=>{function r(e){const t={};for(const s in e){if("declaredClass"===s)continue;const i=e[s];if(null!=i&&"function"!=typeof i)if(Array.isArray(i)){t[s]=[];for(let e=0;e<i.length;e++)t[s][e]=r(i[e])}else"object"==typeof i?i.toJSON&&(t[s]=JSON.stringify(i)):t[s]=i}return t}s.d(t,{A:()=>r})},29996:(e,t,s)=>{s.d(t,{ws:()=>S,xV:()=>C,UK:()=>T,$_:()=>x,hj:()=>w});var r=s(20102),i=s(92604),n=(s(22021),s(37720),s(66039)),o=s(71143);class a{constructor(){this.color=[0,0,0,0],this.haloColor=[0,0,0,0],this.haloSize=0,this.size=12,this.angle=0,this.offsetX=0,this.offsetY=0,this.hAnchor=0,this.vAnchor=0}acquire(e,t,s,r,i,n,o,a,h){this.color=e,this.haloColor=t,this.haloSize=s,this.size=r,this.angle=i,this.offsetX=n,this.offsetY=o,this.hAnchor=a,this.vAnchor=h}release(){this.color[0]=this.color[1]=this.color[2]=this.color[3]=0,this.haloColor[0]=this.haloColor[1]=this.haloColor[2]=this.haloColor[3]=0,this.haloSize=0,this.size=0,this.angle=0,this.offsetX=0,this.offsetY=0,this.hAnchor=0,this.vAnchor=0}}a.pool=new o.Z(a),s(75656);const h=i.Z.getLogger("esri.views.2d.engine.webgl.Utils"),l="geometry",c=[{name:l,strideInBytes:36,divisor:0}],u=[{name:l,strideInBytes:12,divisor:0}],d=[{name:l,strideInBytes:40,divisor:0}],p=[{name:l,strideInBytes:36,divisor:0}],g=[{name:l,strideInBytes:36,divisor:0}];function f(e){const t={};for(const s of e)t[s.name]=s.strideInBytes;return t}const _=f([{name:l,strideInBytes:36,divisor:0}]),m=f(c),y=f(u),b=f(d),I=f(p),v=f(g);function x(e,t){switch(e){case n.LW.MARKER:return _;case n.LW.FILL:return t?y:m;case n.LW.LINE:return b;case n.LW.TEXT:return I;case n.LW.LABEL:return v}}function w(e){return"number"==typeof e}function S(e){switch(e){case"butt":return 0;case"round":return 1;case"square":return 2;default:return h.error(new r.Z("mapview-invalid-type",`Cap type ${e} is not a valid option. Defaulting to round`)),1}}function C(e){switch(e){case"miter":return 2;case"bevel":return 0;case"round":return 1;default:return h.error(new r.Z("mapview-invalid-type",`Join type ${e} is not a valid option. Defaulting to round`)),1}}function T(e){switch(e){case 5121:return Uint8Array;case 32819:return Uint16Array;case 5126:return Float32Array;default:return void h.error(new r.Z("webgl-utils",`Unable to handle type ${e}`))}}new Map},37720:(e,t,s)=>{s.d(t,{t2:()=>i,aH:()=>n});var r=s(12142);function i(e){if(!e)return 0;const{r:t,g:s,b:i,a:n}=e;return(0,r.Jz)(t*n,s*n,i*n,255*n)}function n(e){if(!e)return 0;const[t,s,i,n]=e;return(0,r.Jz)(t*(n/255),s*(n/255),i*(n/255),n)}},16534:(e,t,s)=>{s.d(t,{xl:()=>l,aK:()=>c,eF:()=>h,XJ:()=>f,uG:()=>d,xm:()=>o,m4:()=>u,MI:()=>m,AI:()=>r,Ip:()=>_,ru:()=>i,fL:()=>g,Iw:()=>a,tQ:()=>p,I_:()=>n});const r=1e-30,i=4294967295,n=512,o=29,a=8,h={metrics:{width:15,height:17,left:0,top:-7,advance:14}},l=1,c=2,u=2,d=1,p=1.05,g=2,f=8,_=500,m=10},66039:(e,t,s)=>{var r,i,n,o,a,h,l;s.d(t,{LW:()=>r,X:()=>a,mf:()=>h}),function(e){e[e.FILL=0]="FILL",e[e.LINE=1]="LINE",e[e.MARKER=2]="MARKER",e[e.TEXT=3]="TEXT",e[e.LABEL=4]="LABEL"}(r||(r={})),function(e){e[e.SUCCEEDED=0]="SUCCEEDED",e[e.FAILED_OUT_OF_MEMORY=1]="FAILED_OUT_OF_MEMORY"}(i||(i={})),function(e){e[e.NONE=0]="NONE",e[e.MAP=1]="MAP",e[e.LABEL=2]="LABEL",e[e.LABEL_ALPHA=4]="LABEL_ALPHA",e[e.HITTEST=8]="HITTEST",e[e.HIGHLIGHT=16]="HIGHLIGHT",e[e.CLIP=32]="CLIP",e[e.DEBUG=64]="DEBUG",e[e.NUM_DRAW_PHASES=9]="NUM_DRAW_PHASES"}(n||(n={})),function(e){e[e.SIZE=0]="SIZE",e[e.COLOR=1]="COLOR",e[e.OPACITY=2]="OPACITY",e[e.ROTATION=3]="ROTATION"}(o||(o={})),function(e){e[e.NONE=0]="NONE",e[e.OPACITY=1]="OPACITY",e[e.COLOR=2]="COLOR",e[e.ROTATION=4]="ROTATION",e[e.SIZE_MINMAX_VALUE=8]="SIZE_MINMAX_VALUE",e[e.SIZE_SCALE_STOPS=16]="SIZE_SCALE_STOPS",e[e.SIZE_FIELD_STOPS=32]="SIZE_FIELD_STOPS",e[e.SIZE_UNIT_VALUE=64]="SIZE_UNIT_VALUE"}(a||(a={})),function(e){e[e.MINMAX_TARGETS_OUTLINE=128]="MINMAX_TARGETS_OUTLINE",e[e.SCALE_TARGETS_OUTLINE=256]="SCALE_TARGETS_OUTLINE",e[e.FIELD_TARGETS_OUTLINE=512]="FIELD_TARGETS_OUTLINE",e[e.UNIT_TARGETS_OUTLINE=1024]="UNIT_TARGETS_OUTLINE"}(h||(h={})),function(e){e[e.SPRITE=0]="SPRITE",e[e.GLYPH=1]="GLYPH"}(l||(l={}))},12142:(e,t,s)=>{s.d(t,{UJ:()=>i,Jz:()=>n});const r=new Float32Array(1);function i(e,t){return 65535&e|t<<16}function n(e,t,s,r){return 255&e|(255&t)<<8|(255&s)<<16|r<<24}new Uint32Array(r.buffer)},40660:(e,t,s)=>{s.d(t,{a:()=>h});var r=s(20102),i=s(92604),n=s(66039),o=s(29996);const a=i.Z.getLogger("esri.views.2d.engine.webgl");function h(e){return(0,o.hj)(e.minDataValue)&&(0,o.hj)(e.maxDataValue)&&null!=e.minSize&&null!=e.maxSize?n.X.SIZE_MINMAX_VALUE:(e.expression&&"view.scale"===e.expression||e.valueExpression&&"$view.scale"===e.valueExpression)&&Array.isArray(e.stops)?n.X.SIZE_SCALE_STOPS:(null!=e.field||e.expression&&"view.scale"!==e.expression||e.valueExpression&&"$view.scale"!==e.valueExpression)&&(Array.isArray(e.stops)||"levels"in e&&e.levels)?n.X.SIZE_FIELD_STOPS:(null!=e.field||e.expression&&"view.scale"!==e.expression||e.valueExpression&&"$view.scale"!==e.valueExpression)&&null!=e.valueUnit?n.X.SIZE_UNIT_VALUE:(a.error(new r.Z("mapview-bad-type","Found invalid size VisualVariable",e)),n.X.NONE)}},74259:(e,t,s)=>{s.d(t,{p:()=>g,k:()=>p});var r=s(8557),i=s(32448),n=(s(80442),s(70586)),o=s(96794),a=s(60437),h=s(59999),l=s(61800);function c(e,t){return e<<16|t}function u(e){return(4294901760&e)>>>16}function d(e){return 65535&e}const p={getObjectId:e=>e.getObjectId(),getAttributes:e=>e.readAttributes(),getAttribute:(e,t)=>e.readAttribute(t),cloneWithGeometry:(e,t)=>e,getGeometry:e=>e.readHydratedGeometry(),getCentroid:(e,t)=>e.readCentroid()};class g extends h.J{constructor(e,t,s){super(e,t),this.featureAdapter=p,this.events=new i.Z,this._featureSetsByInstance=new Map,this._objectIdToDisplayId=new Map,this._spatialIndexInvalid=!0,this._indexSearchCache=new r.Z(50),this._index=(0,o.r)(9,(e=>({minX:this._storage.getXMin(e),minY:this._storage.getYMin(e),maxX:this._storage.getXMax(e),maxY:this._storage.getYMax(e)}))),this._storage=t,this.mode=s}get storage(){return this._storage}get storeStatistics(){let e=0,t=0,s=0;return this.forEach((r=>{const i=r.readGeometry();i&&(t+=i.isPoint?1:i.lengths.reduce(((e,t)=>e+t),0),s+=i.isPoint?1:i.lengths.length,e+=1)})),{featureCount:e,vertexCount:t,ringCount:s}}hasInstance(e){return this._featureSetsByInstance.has(e)}onTileData(e,t){if((0,n.Wi)(t.addOrUpdate))return t;if(t.addOrUpdate.attachStorage(this._storage),"snapshot"===this.mode){const s=t.addOrUpdate.getCursor();for(;s.next();){const t=s.getDisplayId();this.setComputedAttributes(this._storage,s,t,e.scale)}return t}this._featureSetsByInstance.set(t.addOrUpdate.instance,t.addOrUpdate);const s=t.addOrUpdate.getCursor();for(;s.next();)this._insertFeature(s,e.scale);return this._spatialIndexInvalid=!0,this.events.emit("changed"),t}search(e){this._rebuildIndex();const t=e.id,s=this._indexSearchCache.find((e=>e.tileId===t));if((0,n.pC)(s))return s.readers;const r=new Map,i=this._searchIndex(e.bounds),o=[];for(const e of i){const t=this._storage.getInstanceId(e),s=u(t),i=d(t);r.has(s)||r.set(s,[]),r.get(s).push(i)}return r.forEach(((e,t)=>{const s=this._featureSetsByInstance.get(t);o.push(l.t.from(s,e))})),this._indexSearchCache.enqueue({tileId:t,readers:o}),o}insert(e){const t=e.getCursor(),s=this._storage;for(;t.next();){var r;const e=c(t.instance,t.getIndex()),i=t.getObjectId(),n=null!=(r=this._objectIdToDisplayId.get(i))?r:this._storage.createDisplayId();t.setDisplayId(n),s.setInstanceId(n,e),this._objectIdToDisplayId.set(i,n)}this._featureSetsByInstance.set(e.instance,e),this._spatialIndexInvalid=!0}remove(e){const t=this._objectIdToDisplayId.get(e);if(!t)return;const s=this._storage.getInstanceId(t),r=d(s),i=u(s),n=this._featureSetsByInstance.get(i);this._objectIdToDisplayId.delete(e),this._storage.releaseDisplayId(t),n.removeAtIndex(r),n.isEmpty&&this._featureSetsByInstance.delete(i),this._spatialIndexInvalid=!0}forEach(e){this._objectIdToDisplayId.forEach((t=>{const s=this._storage.getInstanceId(t),r=this._lookupFeature(s);e(r)}))}forEachUnsafe(e){this._objectIdToDisplayId.forEach((t=>{const s=this._storage.getInstanceId(t),r=u(s),i=d(s),n=this._getFeatureSet(r);n.setIndex(i),e(n)}))}forEachInBounds(e,t){const s=this._searchIndex(e);for(const e of s){const s=this.lookupFeatureByDisplayId(e,this._storage);t((0,n.Wg)(s))}}forEachBounds(e,t,s){this._rebuildIndex();const r=[0,0,0,0];for(const i of e){if(!i.readGeometry())continue;const e=i.getDisplayId();r[0]=this._storage.getXMin(e),r[1]=this._storage.getYMin(e),r[2]=this._storage.getXMax(e),r[3]=this._storage.getYMax(e),t((0,a.JR)(s,r))}}sweepFeatures(e,t,s){this._spatialIndexInvalid=!0,this._objectIdToDisplayId.forEach(((r,i)=>{e.has(r)||(t.releaseDisplayId(r),s&&s.unsetAttributeData(r),this._objectIdToDisplayId.delete(i))})),this.events.emit("changed")}sweepFeatureSets(e){this._spatialIndexInvalid=!0,this._featureSetsByInstance.forEach(((t,s)=>{e.has(s)||this._featureSetsByInstance.delete(s)}))}lookupObjectId(e,t){const s=this.lookupFeatureByDisplayId(e,t);return(0,n.Wi)(s)?null:s.getObjectId()}lookupDisplayId(e){return this._objectIdToDisplayId.get(e)}lookupFeatureByDisplayId(e,t){const s=t.getInstanceId(e);return this._lookupFeature(s)}lookupByDisplayIdUnsafe(e){const t=this._storage.getInstanceId(e),s=u(t),r=d(t),i=this._getFeatureSet(s);return i?(i.setIndex(r),i):null}_insertFeature(e,t){const s=this._storage,r=e.getObjectId(),i=c(e.instance,e.getIndex());s.getInstanceId(e.getDisplayId());let n=this._objectIdToDisplayId.get(r);n||(n=s.createDisplayId(),this._objectIdToDisplayId.set(r,n),this._spatialIndexInvalid=!0),e.setDisplayId(n),s.setInstanceId(n,i),this.setComputedAttributes(s,e,n,t)}_searchIndex(e){this._rebuildIndex();const t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this._index.search(t)}_rebuildIndex(){if(!this._spatialIndexInvalid)return;const e=[];"snapshot"===this.mode?this._featureSetsByInstance.forEach((t=>{const s=t.getCursor();for(;s.next();){const t=s.getDisplayId();this._storage.setBounds(t,s)&&e.push(t)}})):this._objectIdToDisplayId.forEach((t=>{const s=this._storage.getInstanceId(t);this._storage.setBounds(t,this._lookupFeature(s))&&e.push(t)})),this._index.clear(),this._index.load(e),this._indexSearchCache.clear(),this._spatialIndexInvalid=!1}_lookupFeature(e){const t=u(e),s=d(e),r=this._getFeatureSet(t);if(!r)return null;const i=r.getCursor();return i.setIndex(s),i}_getFeatureSet(e){return this._featureSetsByInstance.get(e)}}},53142:(e,t,s)=>{s.r(t),s.d(t,{default:()=>_t,getInstances:()=>gt});var r=s(43697),i=s(3920),n=s(80442),o=s(5600),a=(s(75215),s(92604)),h=s(52525),l=s(11145),c=s(70586),u=s(95330),d=s(43050),p=s(98732),g=s(51980),f=s(99514),_=s(74259),m=s(66677),y=s(3172),b=s(20102),I=s(49385),v=s(82397),x=s(16467),w=s(34599),S=s(70272),C=s(87554);class T extends C.s{constructor(e,t,s){super(e),this._featureIndex=-1,this._dateFields=new Set,this._geometryType=s,this._features=t}static fromFeatures(e,t,s){const r=(0,p.Yn)([],e,t,!1,!1,s);for(let t=0;t<r.length;t++)r[t].displayId=e[t].displayId;return T.fromOptimizedFeatures(r,t)}static fromFeatureSet(e,t){const s=(0,p.h_)(e,t);return T.fromOptimizedFeatureSet(s)}static fromOptimizedFeatureSet(e){const{features:t,geometryType:s}=e,r=T.fromOptimizedFeatures(t,s);r._exceededTransferLimit=e.exceededTransferLimit,r._transform=e.transform;for(const t of e.fields)"esriFieldTypeDate"===t.type&&r._dateFields.add(t.name);return r}static fromOptimizedFeatures(e,t,s){const r=C.s.createInstance(),i=new T(r,e,t);return i._transform=s,i}get _current(){return this._features[this._featureIndex]}get geometryType(){return this._geometryType}get hasFeatures(){return!!this._features.length}get hasNext(){return this._featureIndex+1<this._features.length}get exceededTransferLimit(){return this._exceededTransferLimit}get hasZ(){return!1}get hasM(){return!1}removeIds(e){const t=new Set(e);this._features=this._features.filter((e=>!t.has(e.objectId)))}append(e){for(const t of e)this._features.push(t)}getSize(){return this._features.length}getCursor(){return this.copy()}getQuantizationTransform(){return this._transform}getAttributeHash(){let e="";for(const t in this._current.attributes)e+=this._current.attributes[t];return e}getIndex(){return this._featureIndex}setIndex(e){this._featureIndex=e}getObjectId(){return this._current.objectId}getDisplayId(){return this._current.displayId}setDisplayId(e){this._current.displayId=e}getGroupId(){return this._current.groupId}setGroupId(e){this._current.groupId=e}copy(){const e=new T(this.instance,this._features,this.geometryType);return this.copyInto(e),e}next(){for(;++this._featureIndex<this._features.length&&!this._getExists(););return this._featureIndex<this._features.length}readLegacyFeature(){return(0,p.EI)(this._current,this.geometryType,this.hasZ,this.hasM)}readOptimizedFeature(){return this._current}readLegacyPointGeometry(){return this.readGeometry()?{x:this.getX(),y:this.getY()}:null}readLegacyGeometry(){const e=this.readGeometry();return(0,p.di)(e,this.geometryType,this.hasZ,this.hasM)}readLegacyCentroid(){const e=this.readCentroid();return(0,c.Wi)(e)?null:{x:e.coords[0]*this._sx+this._tx,y:e.coords[1]*this._sy+this._ty}}readGeometryArea(){return(0,S.S6)(this._current)?(0,p.lz)(this._current.geometry,2):0}readUnquantizedGeometry(){const e=this.readGeometry();if("esriGeometryPoint"===this.geometryType||!e)return e;const t=e.clone();return function({coords:e,lengths:t}){let s=0;for(const r of t){for(let t=1;t<r;t++)e[2*(s+t)]+=e[2*(s+t)-2],e[2*(s+t)+1]+=e[2*(s+t)-1];s+=r}}(t),t}readHydratedGeometry(){const e=this._current.geometry;if((0,c.Wi)(e))return null;const t=e.clone();return(0,c.pC)(this._transform)&&(0,p.$g)(t,t,this.hasZ,this.hasM,this._transform),t}getXHydrated(){if(!(0,S.S6)(this._current))return 0;const e=this._current.geometry.coords[0],t=this.getQuantizationTransform();return(0,c.Wi)(t)?e:e*t.scale[0]+t.translate[0]}getYHydrated(){if(!(0,S.S6)(this._current))return 0;const e=this._current.geometry.coords[1],t=this.getQuantizationTransform();return(0,c.Wi)(t)?e:t.translate[1]-e*t.scale[1]}getX(){return(0,S.S6)(this._current)?this._current.geometry.coords[0]*this._sx+this._tx:0}getY(){return(0,S.S6)(this._current)?this._current.geometry.coords[1]*this._sy+this._ty:0}readGeometry(){if(!(0,S.S6)(this._current))return null;const e=this._current.geometry.clone();if(e.isPoint)return e.coords[0]=e.coords[0]*this._sx+this._tx,e.coords[1]=e.coords[1]*this._sy+this._ty,e;let t=0;for(const s of e.lengths)e.coords[2*t]=e.coords[2*t]*this._sx+this._tx,e.coords[2*t+1]=e.coords[2*t+1]*this._sy+this._ty,t+=s;return e}readCentroid(){if(!(0,S.S6)(this._current))return null;if(!this._current.centroid){const e=this._computeCentroid();if(!e)return null;e.coords[0]=(e.coords[0]-this._tx)/this._sx,e.coords[1]=(e.coords[1]-this._ty)/this._sy,this._current.centroid=e}const e=this._current.centroid.clone();return e.coords[0]=e.coords[0]*this._sx+this._tx,e.coords[1]=e.coords[1]*this._sx+this._ty,e}_readAttribute(e,t){const s=this._current.attributes[e];if(void 0!==s)return null!=s&&t&&this._dateFields.has(e)?new Date(s):s;const r=this.readAttributes(),i=e.toLocaleLowerCase().trim();for(const e in r)if(e.toLocaleLowerCase().trim()===i){const s=this._current.attributes[e];return null!=s&&t&&this._dateFields.has(e)?new Date(s):s}}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._transform=this._transform,e._dateFields=this._dateFields}_readAttributes(){return this._current.attributes}}var F=s(45091),k=s(5428),M=s(77863);const E=268435455;class A{constructor(){this.fieldMap=new Map,this.fields=[],this.hasFeatures=!1,this.fieldCount=0,this.featureCount=0,this.objectIdFieldIndex=0,this.offsets={attributes:new Array,geometry:new Array},this.centroid=new Array}hasField(e){return this.fieldMap.has(e)}isDateField(e){var t;return null==(t=this.fieldMap.get(e))?void 0:t.isDate}getFieldIndex(e){var t;return null==(t=this.fieldMap.get(e))?void 0:t.index}}function R(e){const t=e.getLength(),s=e.pos()+t,r={name:"",isDate:!1};for(;e.pos()<s&&e.next();)switch(e.tag()){case 1:r.name=e.getString();break;case 2:"esriFieldTypeDate"===(0,M.O7)(e.getEnum())&&(r.isDate=!0);break;default:e.skip()}return r}function O(e){return e.toLowerCase().trim()}function L(e,t,s=!1){const r=e.pos(),i=new A;let n=0,o=0,a=null,h=null,l=null,c=!1;for(;e.next();)switch(e.tag()){case 1:a=e.getString();break;case 3:h=e.getString();break;case 12:l=e.processMessage(M.G$);break;case 9:if(i.exceededTransferLimit=e.getBool(),i.exceededTransferLimit){i.offsets.geometry=s?new Float64Array(8e3):new Int32Array(8e3),i.centroid=s?new Float64Array(16e3):new Int32Array(16e3);for(let e=0;e<i.centroid.length;e++)i.centroid[e]=E}break;case 13:{const t=R(e),s=t.name,r=O(t.name),o={fieldName:s,index:n++,isDate:t.isDate};i.fields.push(o),i.fieldMap.set(t.name,o),i.fieldMap.set(r,o);break}case 15:{const r=e.getLength(),a=e.pos()+r;if(!i.exceededTransferLimit){const e=i.offsets.geometry,t=i.centroid;e.push(0),t.push(E),t.push(E)}!c&&i.exceededTransferLimit&&(c=!0,i.offsets.attributes=s?new Float64Array(8e3*n):new Uint32Array(8e3*n));let h=o*n;for(;e.pos()<a&&e.next();)switch(e.tag()){case 1:{c?i.offsets.attributes[h++]=e.pos():i.offsets.attributes.push(e.pos());const t=e.getLength();e.skipLen(t);break}case 2:if(t){const t=e.getLength(),s=e.pos()+t;for(;e.pos()<s&&e.next();)switch(e.tag()){case 3:{e.getUInt32();const t=e.getSInt64(),s=e.getSInt64();i.centroid[2*o]=t,i.centroid[2*o+1]=s;break}default:e.skip()}}else{i.offsets.geometry[o]=e.pos();const t=e.getLength();e.skipLen(t)}break;case 4:{const t=e.getLength(),s=e.pos()+t;for(;e.pos()<s&&e.next();)switch(e.tag()){case 3:{e.getUInt32();const t=e.getSInt64(),s=e.getSInt64();i.centroid[2*o]=t,i.centroid[2*o+1]=s;break}default:e.skip()}break}default:e.skip()}o++,i.hasFeatures=!0;break}default:e.skip()}const u=a||h;if(!u)throw new b.Z("FeatureSet has no objectId or globalId field name");return i.featureCount=o,i.fieldCount=n,i.objectIdFieldIndex=i.getFieldIndex(u),i.transform=l,i.displayIds=new Uint32Array(i.featureCount),i.groupIds=new Uint16Array(i.featureCount),e.move(r),i}const P=a.Z.getLogger("esri.view.2d.layers.features.support.FeatureSetReaderPBF"),D=268435455,N=128e3,U={small:{delta:new Int32Array(128),decoded:new Int32Array(128)},large:{delta:new Int32Array(N),decoded:new Int32Array(N)}};function q(e){return e<=U.small.delta.length?U.small:(e<=U.large.delta.length||(U.large.delta=new Int32Array(Math.round(1.25*e)),U.large.decoded=new Int32Array(Math.round(1.25*e))),U.large)}function z(e){for(;e.next();){if(1===e.tag())return e.getMessage();e.skip()}return null}function Z(e,t,s,r,i,n){return.5*Math.abs(e*r+s*n+i*t-e*n-s*t-i*r)}function B(e,t,s,r){return 0==e*r-s*t&&e*s+t*r>0}class G extends C.s{constructor(e,t,s,r){super(e),this._hasNext=!1,this._isPoints=!1,this._featureIndex=-1,this._featureOffset=0,this._cache={area:0,unquantGeometry:void 0,geometry:void 0,centroid:void 0,legacyFeature:void 0,optFeature:void 0},this._geometryType=r,this._reader=t,this._header=s,this._hasNext=s.hasFeatures,this._isPoints="esriGeometryPoint"===r}static fromBuffer(e,t,s=!1){const r=function(e){try{const t=2,s=new F.Z(new Uint8Array(e),new DataView(e));for(;s.next();){if(s.tag()===t)return z(s.getMessage());s.skip()}}catch(e){const t=new b.Z("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:e});P.error(t)}return null}(e),i=L(r,"esriGeometryPoint"===t,s),n=C.s.createInstance();return new G(n,r,i,t)}get geometryType(){return this._geometryType}get size(){return this._header.featureCount}get hasZ(){return!1}get hasM(){return!1}get stride(){return 2+(this.hasZ?1:0)+(this.hasM?1:0)}get hasFeatures(){return this._header.hasFeatures}get hasNext(){return this._hasNext}get exceededTransferLimit(){return this._header.exceededTransferLimit}getSize(){return this.size}getQuantizationTransform(){return this._header.transform}getCursor(){return this.copy()}getIndex(){return this._featureIndex}setIndex(e){this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0,this._featureIndex=e}getAttributeHash(){let e="";return this._header.fields.forEach((({index:t})=>{e+=this._readAttributeAtIndex(t)+"."})),e}getObjectId(){return this._readAttributeAtIndex(this._header.objectIdFieldIndex)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(e){this._header.displayIds[this._featureIndex]=e}getGroupId(){return this._header.groupIds[this._featureIndex]}setGroupId(e){this._header.groupIds[this._featureIndex]=e}readLegacyFeature(){if(void 0===this._cache.legacyFeature){var e;const t=this.readCentroid(),s={attributes:this.readAttributes(),geometry:this._isPoints?this.readLegacyPointGeometry():this.readLegacyGeometry(),centroid:null!=(e=t&&{x:t.coords[0],y:t.coords[1]})?e:null};return this._cache.legacyFeature=s,s}return this._cache.legacyFeature}readOptimizedFeature(){if(void 0===this._cache.optFeature){const e=new S.ZP(this.readGeometry(),this.readAttributes(),this.readCentroid());return e.objectId=this.getObjectId(),e.displayId=this.getDisplayId(),this._cache.optFeature=e,e}return this._cache.optFeature}getXHydrated(){const e=this._header.centroid[2*this._featureIndex],t=this.getQuantizationTransform();return(0,c.Wi)(t)?e:e*t.scale[0]+t.translate[0]}getYHydrated(){const e=this._header.centroid[2*this._featureIndex+1],t=this.getQuantizationTransform();return(0,c.Wi)(t)?e:t.translate[1]-e*t.scale[1]}getX(){return this._header.centroid[2*this._featureIndex]*this._sx+this._tx}getY(){return this._header.centroid[2*this._featureIndex+1]*this._sy+this._ty}readLegacyPointGeometry(){return{x:this.getX(),y:this.getY()}}readLegacyGeometry(e){const t=this.readGeometry(e);return(0,p.di)(t,this.geometryType,!1,!1)}readLegacyCentroid(){const e=this.readCentroid();if(!e)return null;const[t,s]=e.coords;return{x:t,y:s}}readGeometryArea(){return this._cache.area||this.readGeometry(!0),this._cache.area}readUnquantizedGeometry(e=!1){if(void 0===this._cache.unquantGeometry){const t=this.readGeometry(e);if(!t)return this._cache.unquantGeometry=null,null;const s=q(t.coords.length).decoded,r=t.clone(s),i=r.coords;let n=0;for(const e of r.lengths){for(let t=1;t<e;t++){const e=2*(n+t),s=2*(n+t-1);i[e]+=i[s],i[e+1]+=i[s+1]}n+=e}return this._cache.unquantGeometry=r,r}return this._cache.unquantGeometry}readHydratedGeometry(){if(this._isPoints){if(this._header.centroid[2*this._featureIndex]===D)return null;const e=this.getXHydrated(),t=this.getYHydrated();return new k.Z([],[e,t])}const e=this.readGeometry();if(!e)return null;const t=e.clone(),s=this.getQuantizationTransform();return(0,c.pC)(s)&&(0,p.$g)(t,t,this.hasZ,this.hasM,s),t}readGeometry(e=!1){if(void 0===this._cache.geometry){let t=null;if(this._isPoints){if(this._header.centroid[2*this._featureIndex]===D)return null;const e=this.getX(),s=this.getY();t=new k.Z([],[e,s])}else{const s=this._header.offsets.geometry[this._featureIndex],r=this._reader;if(0===s)return null;r.move(s);try{t=e?this._parseGeometryForDisplay(r):this._parseGeometry(r)}catch(e){return console.error("Failed to parse geometry!",e),null}}return this._cache.geometry=t,t}return this._cache.geometry}readCentroid(){if(void 0===this._cache.centroid){let e=null;const t=this._header.centroid[2*this._featureIndex]+this._tx,s=this._header.centroid[2*this._featureIndex+1]+this._ty;return t===D?(e=this._computeCentroid(),e&&(this._header.centroid[2*this._featureIndex]=e.coords[0]-this._tx,this._header.centroid[2*this._featureIndex+1]=e.coords[1]-this._ty)):e=new k.Z([],[t,s]),this._cache.centroid=e,e}return this._cache.centroid}copy(){const e=this._reader.clone(),t=new G(this.instance,e,this._header,this.geometryType);return this.copyInto(t),t}next(){for(this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0;++this._featureIndex<this.size&&!this._getExists(););return this._featureIndex<this.size}_readAttribute(e,t){const s=this._header.hasField(e)?e:function(e){return e.toLowerCase().trim()}(e),r=this._header.getFieldIndex(s);if(null==r)return;const i=this._readAttributeAtIndex(r);return t?null==i?i:this._header.isDateField(s)?new Date(i):i:i}_readAttributes(){const e={};return this._header.fields.forEach((({fieldName:t,index:s})=>{e[t]=this._readAttributeAtIndex(s)})),e}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._featureOffset=this._featureOffset,e._hasNext=this._hasNext}_readAttributeAtIndex(e){const t=this._header.offsets.attributes[this._featureIndex*this._header.fieldCount+e],s=this._reader;return s.move(t),function(e){const t=e.getLength(),s=e.pos()+t;for(;e.pos()<s&&e.next();)switch(e.tag()){case 1:return e.getString();case 2:return e.getFloat();case 3:return e.getDouble();case 4:return e.getSInt32();case 5:return e.getUInt32();case 6:return e.getInt64();case 7:return e.getUInt64();case 8:return e.getSInt64();case 9:return e.getBool();default:return e.skip(),null}return null}(s)}_parseGeometry(e){const t=e.getLength(),s=e.pos()+t,r=[],i=[];for(;e.pos()<s&&e.next();)switch(e.tag()){case 2:{const t=e.getUInt32(),s=e.pos()+t;for(;e.pos()<s;)i.push(e.getUInt32());break}case 3:{const t=e.getUInt32(),s=e.pos()+t;for(r.push(e.getSInt32()+this._tx),r.push(e.getSInt32()+this._ty),this.hasZ&&e.getSInt32(),this.hasM&&e.getSInt32();e.pos()<s;)r.push(e.getSInt32()),r.push(e.getSInt32()),this.hasZ&&e.getSInt32(),this.hasM&&e.getSInt32();break}default:e.skip()}return new k.Z(i,r)}_parseGeometryForDisplay(e){const t=e.getLength(),s=e.pos()+t,r=[],i=[];let n=0,o=0,a=null,h=0;const l="esriGeometryPolyline"===this.geometryType;for(;e.pos()<s&&e.next();)switch(e.tag()){case 2:{const t=e.getUInt32(),s=e.pos()+t;for(;e.pos()<s;){const t=e.getUInt32();r.push(t),n+=t}a=q(2*n).delta;break}case 3:{e.getUInt32();const t=2+(this.hasZ?1:0)+(this.hasM?1:0);for(const s of r)if(o+t*s>a.length)for(let t=0;t<s;t++)e.getSInt32(),e.getSInt32(),this.hasZ&&e.getSInt32(),this.hasM&&e.getSInt32();else if(l){let t=0,r=e.getSInt32(),n=e.getSInt32();this.hasZ&&e.getSInt32(),this.hasM&&e.getSInt32(),a[o++]=r,a[o++]=n,t+=1;for(let i=1;i<s;i++){const s=e.getSInt32(),l=e.getSInt32(),c=r+s,u=n+l;h+=-.5*(c-r)*(u+n),this.hasZ&&e.getSInt32(),this.hasM&&e.getSInt32(),i>2&&B(a[o-2],a[o-1],s,l)?(a[o-2]+=s,a[o-1]+=l):(a[o++]=s,a[o++]=l,t+=1),r=c,n=u}i.push(t)}else{const t=this.getAreaSimplificationThreshold(s);let r=2,n=1;const l=!1;let c=e.getSInt32(),u=e.getSInt32();a[o++]=c,a[o++]=u,this.hasZ&&e.getSInt32(),this.hasM&&e.getSInt32();let d=e.getSInt32(),p=e.getSInt32();for(this.hasZ&&e.getSInt32(),this.hasM&&e.getSInt32();r<s;){let s=e.getSInt32(),i=e.getSInt32();this.hasZ&&e.getSInt32(),this.hasM&&e.getSInt32();const l=c+d,g=u+p;Z(c,u,l,g,l+s,g+i)>=t?(h+=-.5*(l-c)*(g+u),n>1&&B(a[o-2],a[o-1],d,p)?(a[o-2]+=d,a[o-1]+=p):(a[o++]=d,a[o++]=p,n++),c=l,u=g):(s+=d,i+=p),d=s,p=i,r++}n<3||l?o-=2*n:(h+=-.5*(c+d-c)*(u+p+u),B(a[o-2],a[o-1],d,p)?(a[o-2]+=d,a[o-1]+=p,i.push(n)):(a[o++]=d,a[o++]=p,i.push(++n)))}break}default:e.skip()}if(this._cache.area=h,!i.length)return null;if(this._tx||this._ty){let e=0;for(const t of i)a[2*e]+=this._tx,a[2*e+1]+=this._ty,e+=t}return new k.Z(i,a)}}class j{constructor(e){this.service=e}destroy(){}}class W extends j{constructor(e){super(e),this._portsOpen=(0,I.Mz)(e.source).then((e=>this.client=e))}destroy(){this.client.close(),this.client=null}async executeQuery(e,t){await this._portsOpen;const s=await this.client.invoke("queryFeatures",e.toJSON(),t);return T.fromFeatureSet(s,this.service.objectIdField)}}class X extends j{async executeQuery(e,t){const{data:s}=await(0,w.executeQueryPBFBuffer)(this.service.source,e,t),r=!e.quantizationParameters;return G.fromBuffer(s,this.service.geometryType,r)}}class V extends j{async executeQuery(e,t){const{source:s,capabilities:r,spatialReference:i,objectIdField:n}=this.service;if((0,c.pC)(e.quantizationParameters)&&!r.query.supportsQuantization){const r=e.clone(),o=(0,v.vY)((0,c.Wg)(r.quantizationParameters));r.quantizationParameters=null;const{data:a}=await(0,w.executeQuery)(s,r,i,t),h=(0,p.h_)(a,n);return(0,p.RZ)(o,h),T.fromOptimizedFeatureSet(h)}const{data:o}=await(0,w.executeQuery)(s,e,this.service.spatialReference,t);return T.fromFeatureSet(o,this.service.objectIdField)}}class Y extends j{async executeQuery(e,t){const{capabilities:s}=this.service;if(e.quantizationParameters&&!s.query.supportsQuantization){const s=e.clone(),r=(0,v.vY)((0,c.Wg)(s.quantizationParameters));s.quantizationParameters=null;const i=await(0,x.WW)(this.service.source,e,t);return(0,p.RZ)(r,i),T.fromOptimizedFeatureSet(i)}const r=await(0,x.WW)(this.service.source,e,t);return T.fromOptimizedFeatureSet(r)}}var H=s(92835),Q=s(32448),J=s(22862),$=s(57444),K=s(8557);class ee{constructor(){this.source=!1,this.targets={feature:!1,aggregate:!1},this.storage={filters:!1,data:!1},this.mesh=!1,this.queryFilter=!1,this.why={mesh:[],source:[]}}static create(e){const t=new ee;for(const s in e){const r=e[s];if("object"==typeof r)for(const e in r){const i=r[e];t[s][e]=i}t[s]=r}return t}static empty(){return ee.create({})}static all(){return ee.create({source:!0,targets:{feature:!0,aggregate:!0},storage:{filters:!0,data:!0},mesh:!0})}unset(e){e.source&&(this.source=!1),e.targets.feature&&(this.targets.feature=!1),e.targets.aggregate&&(this.targets.aggregate=!1),e.storage.filters&&(this.storage.filters=!1),e.storage.data&&(this.storage.data=!1),e.mesh&&(this.mesh=!1),e.queryFilter&&(this.queryFilter=!1)}any(){return this.source||this.mesh||this.storage.filters||this.storage.data||this.targets.feature||this.targets.aggregate||this.queryFilter}describe(){let e=0,t="";if(this.mesh){e+=20,t+="-> (20) Mesh needs update\n";for(const e of this.why.mesh)t+=` + ${e}\n`}if(this.source){e+=10,t+="-> (10) The source needs update\n";for(const e of this.why.source)t+=` + ${e}\n`}this.targets.feature&&(e+=5,t+="-> (5) Feature target parameters changed\n"),this.storage.filters&&(e+=5,t+="-> (5) Feature filter parameters changed\n"),this.targets.aggregate&&(e+=4,t+="-> (4) Aggregate target parameters changed\n"),this.storage.data&&(e+=1,t+="-> (1) Texture storage parameters changed");const s=e<5?"Fastest":e<10?"Fast":e<15?"Moderate":e<20?"Slow":"Very Slow";console.debug(`Applying ${s} update of cost ${e}/45 `),console.debug(t)}toJSON(){return{queryFilter:this.queryFilter,source:this.source,targets:this.targets,storage:this.storage,mesh:this.mesh}}}class te{constructor(e){this.requests={done:new Array,stream:new K.Z(10)},this._edits=null,this._abortController=new AbortController,this._done=!1,this.didSend=!1,this.tile=e}get signal(){return this._abortController.signal}get options(){return{signal:this._abortController.signal}}get empty(){return!this.requests.done.length}get edits(){return this._edits}get done(){return this._done}end(){this._done=!0}clear(){this.requests.done=[]}applyUpdate(e){this.requests.done.forEach((t=>t.message.status.unset(e))),(0,c.pC)(this._edits)&&this._edits.status.unset(e)}add(e){var t;e.message.status=null!=(t=e.message.status)?t:ee.empty(),e.message.end&&this.requests.done.forEach((e=>{(0,c.pC)(e.message)&&e.message.end&&(e.message.end=!1)})),this.requests.done.push(e)}edit(e,t){const s=e.getQuantizationTransform(),r=e.geometryType,i=Array.from(e.features()),n=[...t,...i.map((e=>e.objectId))];this.removeIds(n),this._invalidate(),(0,c.Wi)(this._edits)?this._edits={type:"append",addOrUpdate:T.fromOptimizedFeatures(i,r,(0,c.Wg)(s)),id:this.tile.id,status:ee.empty(),end:!0}:(this.requests.done.forEach((e=>e.message.end=!1)),(0,c.Wg)(this._edits.addOrUpdate).append(e.features()))}*readers(){for(const{message:e}of this.requests.done)(0,c.pC)(e.addOrUpdate)&&(yield e.addOrUpdate);(0,c.pC)(this._edits)&&(0,c.pC)(this._edits.addOrUpdate)&&(yield this._edits.addOrUpdate)}_invalidate(){for(const e of this.requests.done)e.message.status=ee.empty();(0,c.pC)(this._edits)&&(this._edits.status=ee.empty())}removeIds(e){this._invalidate();for(const{message:t}of this.requests.done){const s=t.addOrUpdate;(0,c.pC)(s)&&(s.removeIds(e),s.isEmpty&&(t.addOrUpdate=null))}(0,c.pC)(this._edits)&&(0,c.pC)(this._edits.addOrUpdate)&&this._edits.addOrUpdate.removeIds(e),this.requests.done=this.requests.done.filter((e=>e.message.addOrUpdate||e.message.end))}abort(){this._abortController.abort()}}class se{constructor(e){this.events=new Q.Z,this._resolver=(0,u.hh)(),this._didEdit=!1,this._subscriptions=new Map,this._outSR=e.outSR,this._serviceInfo=e.serviceInfo,this._onTileUpdateMessage=e.onMessage}destroy(){}async _onMessage(e){var t;const s=this._subscriptions.get(e.id);if(!s)return;const r={...e,remove:null!=(t=e.remove)?t:[],status:e.status};return this._onTileUpdateMessage(r,s.options)}update(e,t){var s;const r=t.fields.length;t.outFields=function(e,t){const s=new Set;return e&&e.forEach((e=>s.add(e))),t&&t.forEach((e=>s.add(e))),s.has("*")?["*"]:Array.from(s)}(null==(s=this._schema)?void 0:s.outFields,t.outFields),t.outFields=t.outFields.length>=.75*r?["*"]:t.outFields,t.outFields.sort();const i=(0,J.Hg)(this._schema,t);if(!i)return;(0,n.Z)("esri-2d-update-debug")&&console.debug("Applying Update - Source:",i);const o="orderByFields"in this._serviceInfo&&this._serviceInfo.orderByFields?this._serviceInfo.orderByFields:this._serviceInfo.objectIdField+" ASC",a={returnCentroid:(0,n.Z)("esri-2d-query-centroid-enabled")&&"esriGeometryPolygon"===this._serviceInfo.geometryType,returnGeometry:!0,timeReferenceUnknownClient:"stream"!==this._serviceInfo.type&&this._serviceInfo.timeReferenceUnknownClient,outFields:t.outFields,outSpatialReference:this._outSR,orderByFields:[o],where:t.definitionExpression||"1=1",gdbVersion:t.gdbVersion,historicMoment:t.historicMoment,timeExtent:H.Z.fromJSON(t.timeExtent),customParameters:t.customParameters},h=this._schema&&(0,J.uD)(i,"outFields");this._schema&&(0,J.V7)(i,["timeExtent","definitionExpression","gdbVersion","historicMoment","customParameters"])&&(e.why.mesh.push("Layer filter and/or custom parameters changed"),e.why.source.push("Layer filter and/or custom parameters changed"),e.mesh=!0,e.source=!0,e.queryFilter=!0),h&&(e.why.source.push("Layer required fields changed"),e.source=!0),(0,J.Hg)(a,this._queryInfo)&&(this._queryInfo=a),this._schema=t,this._resolver.resolve()}whenInitialized(){return this._resolver.promise}async applyUpdate(e){if(e.queryFilter||e.source&&this._didEdit)return this.refresh(),void(this._didEdit=!1);this._subscriptions.forEach((t=>t.applyUpdate(e))),await this.resend()}refresh(){for(const e of this._tiles())this.unsubscribe(e),this.subscribe(e)}subscribe(e){const t=new te(e);this._subscriptions.set(e.id,t)}unsubscribe(e){const t=this.get(e.id);(0,c.pC)(t)&&t.abort(),this._subscriptions.delete(e.id)}createQuery(e={}){const t=this._queryInfo.historicMoment?new Date(this._queryInfo.historicMoment):null;return new $.Z({...this._queryInfo,historicMoment:t,...e})}get(e){return this._subscriptions.has(e)?this._subscriptions.get(e):null}async queryLastEditDate(){throw new Error("Service does not support query type")}async query(e){throw new Error("Service does not support query")}*_tiles(){const e=Array.from(this._subscriptions.values());for(const t of e)yield t.tile}async edit(e,t){const s=Array.from(this._subscriptions.values()),r=s.map((({tile:e})=>e));for(const e of s)e.removeIds(t);if(e.length){const s=r.map((t=>{const s=this.createTileQuery(t);return s.objectIds=e,{tile:t,query:s}})).map((async({tile:e,query:t})=>({tile:e,result:await this.query(t),query:t}))),i=(await(0,u.WW)(s)).map((async({tile:s,result:r})=>{if(!r.hasFeatures&&!t.length&&!e.length)return;const i=this._subscriptions.get(s.key.id);i&&i.edit(r,e)}));await(0,u.as)(i)}this._didEdit=!0}}var re=s(34084);const ie=a.Z.getLogger("esri.views.2d.layers.features.sources.BaseFeatureSource");class ne extends se{constructor(e){super(e),this.type="feature",this.mode="on-demand",this._adapter=function(e){const{capabilities:t}=e;return(s=e.source)&&s.capabilities&&s.collection&&s.layerDefinition?new Y(e):function(e){return Array.isArray(e.source)}(e)?new W(e):t.query.supportsFormatPBF&&(0,n.Z)("featurelayer-pbf")?new X(e):new V(e);var s}(e.serviceInfo),this._queue=new re.e({concurrency:8,process:async e=>{if((0,u.k_)(e),(0,c.pC)(e.tile)){const t=e.tile.key.id,{signal:s}=e,r=(0,n.Z)("esri-tiles-debug")?{tile:t.replace(/\//g,"."),depth:e.depth}:void 0,i=await this._adapter.executeQuery(e.query,{signal:s,query:{...r,...this._schema.customParameters}});return i.level=e.tile.key.level,i}return this._adapter.executeQuery(e.query,{...e,query:this._schema.customParameters})}}),this._patchQueue=new re.e({concurrency:8,process:async e=>{if((0,u.k_)(e),(0,c.pC)(e.tile)){const t=e.tile.key.id,{signal:s}=e,r=(0,n.Z)("esri-tiles-debug")?{tile:t.replace(/\//g,"."),depth:e.depth}:void 0,i=await this._adapter.executeQuery(e.query,{signal:s,query:{...r,...this._schema.customParameters}});return i.level=e.tile.key.level,i}return this._adapter.executeQuery(e.query,{...e,query:this._schema.customParameters})}})}destroy(){super.destroy(),this._adapter.destroy(),this._queue.destroy(),this._patchQueue.destroy()}get updating(){return!!this._queue.length||Array.from(this._subscriptions.values()).some((e=>!e.done))}get maxRecordCountFactor(){const{query:e}=this._serviceInfo.capabilities;return e.supportsMaxRecordCountFactor?4:null}get maxPageSize(){var e;const{query:t}=this._serviceInfo.capabilities;return(null!=(e=t.maxRecordCount)?e:8e3)*(0,c.Pt)(this.maxRecordCountFactor,1)}get pageSize(){return Math.min(8e3,this.maxPageSize)}enableEvent(e,t){}subscribe(e){super.subscribe(e);const t=this._subscriptions.get(e.id);this._fetchDataTile(e).catch((t=>{(0,u.D_)(t)||ie.error(new b.Z("mapview-query-error","Encountered error when fetching tile",{tile:e,error:t}))})).then((()=>t.end()))}unsubscribe(e){super.unsubscribe(e)}readers(e){return this._subscriptions.get(e).readers()}async query(e){return this._adapter.executeQuery(e,{query:this._schema.customParameters})}async queryLastEditDate(){const e=this._serviceInfo.source,t={...e.query,f:"json"};return(await(0,y.default)(e.path,{query:t,responseType:"json"})).data.editingInfo.lastEditDate}createTileQuery(e,t={}){var s;const r=this.createQuery(t);return r.quantizationParameters=null!=(s=t.quantizationParameters)?s:e.getQuantizationParameters(),r.resultType="tile",r.geometry=e.extent,r.quantizationParameters&&"esriGeometryPolyline"===this._serviceInfo.geometryType&&(r.maxAllowableOffset=e.resolution),r}async _executePatchQuery(e,t,s,r){const i=t.clone();i.outFields=[this._serviceInfo.objectIdField,...s],i.returnCentroid=!1,i.returnGeometry=!1;const n=(0,c.pC)(i.start)?i.start/8e3:0,o=r.signal;return this._patchQueue.push({tile:e,query:i,signal:o,depth:n})}async _resend(e,t){const{query:s,message:r}=e,i=(0,c.pC)(s.outFields)?s.outFields:[],n=this._queryInfo.outFields,o=n.filter((e=>-1===i.indexOf(e)));if((0,c.Wi)(r.addOrUpdate))this._onMessage({...r,type:"append"});else if(o.length)try{const e=this._subscriptions.get(r.id).tile,i=await this._executePatchQuery(e,s,o,t);(0,u.k_)(t),s.outFields=n,r.addOrUpdate.joinAttributes(i),this._onMessage({...r,end:r.end,type:"append"})}catch(e){}else this._onMessage({...r,type:"append"})}async _resendSubscription(e){if(e.empty)return this._onMessage({id:e.tile.id,addOrUpdate:null,end:!1,type:"append"});const t=e.signal;for(const s of e.requests.done)await this._resend(s,{signal:t});return(0,c.pC)(e.edits)?this._onMessage(e.edits):void 0}async resend(){const e=Array.from(this._subscriptions.values());await Promise.all(e.map((e=>this._resendSubscription(e))))}}const oe=(0,n.Z)("esri-mobile"),ae={maxDrillLevel:oe?1:4,maxRecordCountFactor:oe?1:3};class he extends ne{constructor(e){super(e)}async _fetchDataTile(e){const t=this._serviceInfo.capabilities.query.supportsMaxRecordCountFactor,s=this._subscriptions.get(e.key.id),r=s.signal,i=e.getQuantizationParameters();let n=0;const o=async(a,h)=>{const l=this._queryInfo,c=this.createTileQuery(a,{maxRecordCountFactor:t?ae.maxRecordCountFactor:void 0,returnExceededLimitFeatures:!1,quantizationParameters:i});n++;try{const t=await this._queue.push({tile:e,query:c,signal:r,depth:h});if(n--,(0,u.k_)(r),!t)return;if(l!==this._queryInfo)return void o(a,h);if(t.exceededTransferLimit&&h<ae.maxDrillLevel){for(const e of a.createChildTiles())o(e,h+1);return}const i={id:e.id,addOrUpdate:t,end:0===n,type:"append"};s.add({query:c,message:i}),this._onMessage(i)}catch(t){(0,u.D_)(t)||this._onMessage({id:e.id,addOrUpdate:null,end:!0,type:"append"})}};o(e,0)}}var le=s(96794),ce=s(22021);class ue{constructor(e,t,s,r,i=128){this._trackIdToObservations=new Map,this._idCounter=0,this._lastPurge=performance.now(),this._addOrUpdated=new Map,this._removed=[],this._maxAge=0,this._timeInfo=s,this._purgeOptions=r,this.store=e,this.objectIdField=t,this.purgeInterval=i,this._useGeneratedIds="__esri_stream_id__"===this.objectIdField}add(e){if(this._useGeneratedIds){const t=this._nextId();e.attributes[this.objectIdField]=t,e.objectId=t}else e.objectId=e.attributes[this.objectIdField];if(this._addOrUpdated.set(e.objectId,e),this._maxAge=Math.max(this._maxAge,e.attributes[this._timeInfo.startTimeField]),!this._timeInfo.trackIdField)return(0,c.Wi)(this._trackIdLessObservations)&&(this._trackIdLessObservations=new K.Z(1e5)),void this._trackIdLessObservations.enqueue(e.objectId);const t=e.attributes[this._timeInfo.trackIdField];if(!this._trackIdToObservations.has(t)){const e=(0,c.pC)(this._purgeOptions)&&null!=this._purgeOptions.maxObservations?this._purgeOptions.maxObservations:1e3,s=(0,ce.uZ)(e,0,1e3);this._trackIdToObservations.set(t,new K.Z(s))}const s=this._trackIdToObservations.get(t).enqueue(e.objectId);(0,c.pC)(s)&&(this._addOrUpdated.has(s)?this._addOrUpdated.delete(s):this._removed.push(s))}checkForUpdates(){const e=this._getToAdd(),t=this._getToRemove(),s=performance.now();s-this._lastPurge>=this.purgeInterval&&(this._purge(s),this._lastPurge=s);const r=[];if((0,c.pC)(t))for(const e of t){const t=this.store.removeById(e);(0,c.pC)(t)&&r.push(t)}if((0,c.pC)(e))for(const t of e)t.attributes.__esri_timestamp__=s,this.store.add(t);(e||r)&&this.store.update(e,r)}_getToAdd(){if(!this._addOrUpdated.size)return null;const e=new Array(this._addOrUpdated.size);let t=0;return this._addOrUpdated.forEach((s=>e[t++]=s)),this._addOrUpdated.clear(),e}_getToRemove(){const e=this._removed;return this._removed.length?(this._removed=[],e):null}_nextId(){const e=this._idCounter;return this._idCounter=(this._idCounter+1)%4294967294+1,e}_purge(e){const t=this._purgeOptions;(0,c.pC)(t)&&(this._purgeSomeByDisplayCount(t),this._purgeByAge(t),this._purgeByAgeReceived(e,t),this._purgeTracks())}_purgeSomeByDisplayCount(e){if(!e.displayCount)return;let t=this.store.size;if(t>e.displayCount){if(this._timeInfo.trackIdField)for(const s of this._trackIdToObservations.values())if(t>e.displayCount&&s.size){const e=(0,c.Wg)(s.dequeue());this._removed.push(e),t--}if((0,c.pC)(this._trackIdLessObservations)){let s=t-e.displayCount;for(;s-- >0;){const e=this._trackIdLessObservations.dequeue();(0,c.pC)(e)&&this._removed.push(e)}}}}_purgeByAge(e){var t;if(!e.age||null==(t=this._timeInfo)||!t.startTimeField)return;const s=60*e.age*1e3,r=this._maxAge-s;this.store.forEach((e=>{e.attributes[this._timeInfo.startTimeField]<r&&this._removed.push(e.objectId)}))}_purgeByAgeReceived(e,t){if(!t.ageReceived)return;const s=e-60*t.ageReceived*1e3;this.store.forEach((e=>{e.attributes.__esri_timestamp__<s&&this._removed.push(e.objectId)}))}_purgeTracks(){this._trackIdToObservations.forEach(((e,t)=>{0===e.size&&this._trackIdToObservations.delete(t)}))}}s(66577);let de=class extends(Q.Z.EventedMixin(i.r)){onFeature(e){this.emit("feature",e)}};de=(0,r._)([(0,h.j)("esri.layers.graphics.sources.connections.StreamConnection")],de);var pe=de,ge=s(50459);const fe=a.Z.getLogger("esri.layers.graphics.sources.connections.WebSocketConnection");var _e,me;(me=_e||(_e={}))[me.CONNECTING=0]="CONNECTING",me[me.OPEN=1]="OPEN",me[me.CLOSING=2]="CLOSING",me[me.CLOSED=3]="CLOSED";let ye=class extends pe{constructor(e){super(),this.errorString=null;const{geometryType:t,spatialReference:s,sourceSpatialReference:r}=e;this._config=e,this._featureZScaler=(0,ge.k)(t,r,s),this._open()}async _open(){await this._tryCreateWebSocket(),this.destroyed||await this._handshake()}destroy(){(0,c.pC)(this._websocket)&&(this._websocket.onopen=null,this._websocket.onclose=null,this._websocket.onerror=null,this._websocket.onmessage=null,this._websocket.close()),this._websocket=null}get connectionStatus(){if((0,c.Wi)(this._websocket))return"disconnected";switch(this._websocket.readyState){case _e.CONNECTING:case _e.OPEN:return"connected";case _e.CLOSING:case _e.CLOSED:return"disconnected"}}async _tryCreateWebSocket(e=this._config.source.path,t=1e3,s=0){try{if(this.destroyed)return;this._websocket=await this._createWebSocket(e),this.notifyChange("connectionStatus")}catch(r){const i=t/1e3;return this._config.maxReconnectionAttempts&&s>=this._config.maxReconnectionAttempts?(fe.error(new b.Z("websocket-connection","Exceeded maxReconnectionAttempts attempts. No further attempts will be made")),void this.destroy()):(fe.error(new b.Z("websocket-connection",`Failed to connect. Attempting to reconnect in ${i}s`,r)),await(0,u.e4)(t),this._tryCreateWebSocket(e,Math.min(1.5*t,1e3*this._config.maxReconnectionInterval),s+1))}}_createWebSocket(e){const t=new WebSocket(e),s=new Promise(((e,s)=>{t.onopen=()=>e(t),t.onclose=e=>s(e)}));return s.then((()=>{if(this.destroyed)return t.onclose=()=>{},void t.close();t.onclose=e=>this._onClose(e),t.onerror=e=>this._onError(e),t.onmessage=e=>this._onMessage(e)})),s}async _handshake(e=1e4){const t=this._websocket;if((0,c.Wi)(t))return;const s=(0,u.hh)(),r=t.onmessage,{filter:i,outFields:n,spatialReference:o}=this._config;return s.timeout(e),t.onmessage=e=>{var a;let h=null;try{h=JSON.parse(e.data)}catch(e){}h&&"object"==typeof h||(fe.error(new b.Z("websocket-connection","Protocol violation. Handshake failed - malformed message",e.data)),s.reject(),this.destroy()),(null==(a=h.spatialReference)?void 0:a.wkid)!==(null==o?void 0:o.wkid)&&(fe.error(new b.Z("websocket-connection",`Protocol violation. Handshake failed - expected wkid of ${o.wkid}`,e.data)),s.reject(),this.destroy()),"json"!==h.format&&(fe.error(new b.Z("websocket-connection","Protocol violation. Handshake failed - format is not set",e.data)),s.reject(),this.destroy()),i&&h.filter!==i&&fe.error(new b.Z("websocket-connection","Tried to set filter, but server doesn't support it")),n&&h.outFields!==n&&fe.error(new b.Z("websocket-connection","Tried to set outFields, but server doesn't support it")),t.onmessage=r,s.resolve()},t.send(JSON.stringify({filter:i,outFields:n,format:"json",spatialReference:{wkid:o.wkid}})),s.promise}_onMessage(e){try{const t=JSON.parse(e.data);if("featureResult"!==t.type)throw new b.Z("websocket-connection","Protocol violation - Expected to find message of type 'featureResult'",t);for(const e of t.features)this._featureZScaler&&this._featureZScaler(e.geometry),this.onFeature(e)}catch(e){return fe.error(new b.Z("websocket-connection","Failed to parse message",e)),void this.destroy()}}_onError(e){const t="Encountered an error over WebSocket connection";this._set("errorString",t),fe.error("websocket-connection",t)}_onClose(e){this._websocket=null,this.notifyChange("connectionStatus"),1e3!==e.code&&fe.error("websocket-connection",`WebSocket closed unexpectedly with error code ${e.code}`),this.destroyed||this._open()}};(0,r._)([(0,o.Cb)()],ye.prototype,"connectionStatus",null),(0,r._)([(0,o.Cb)()],ye.prototype,"errorString",void 0),ye=(0,r._)([(0,h.j)("esri.layers.graphics.sources.connections.WebSocketConnection")],ye);var be=s(33955),Ie=s(82971);const ve=a.Z.getLogger("esri.layers.graphics.sources.connections.GeoEventConnection"),xe={maxQueryDepth:5,maxRecordCountFactor:3};let we=class extends ye{constructor(e){super({...xe,...e})}async _open(){const e=await this._fetchServiceDefinition(this._config.source);e.timeInfo.trackIdField||ve.warn("GeoEvent service was configured without a TrackIdField. This may result in certain functionality being disabled. The purgeOptions.maxObservations property will have no effect.");const t=await this._fetchWebSocketUrl(e.streamUrls,this._config.spatialReference);this._buddyServicesQuery||(this._buddyServicesQuery=this._queryBuddyServices()),await this._buddyServicesQuery,await this._tryCreateWebSocket(t);const{filter:s,outFields:r}=this._config;this.destroyed||this._setFilter(s,r)}_onMessage(e){let t;try{t=this._enrich(JSON.parse(e.data)),this._featureZScaler&&this._featureZScaler(t.geometry)}catch(e){return void ve.error(new b.Z("geoevent-connection","Failed to parse message",e))}this.onFeature(t)}async _fetchServiceDefinition(e){const t=(0,y.default)(e.path,{query:{f:"json"},responseType:"json"}),s=(await t).data;return this._serviceDefinition=s,s}async _fetchWebSocketUrl(e,t){const s=e[0],{urls:r,token:i}=s;return`${this._inferWebSocketBaseUrl(r)}/subscribe?outSR=${t.wkid}${i?"&token="+i:""}`}_inferWebSocketBaseUrl(e){if(1===e.length)return e[0];for(const t of e)if(-1!==t.indexOf("wss"))return t;return ve.error(new b.Z("geoevent-connection","Unable to infer WebSocket url",e)),null}async _setFilter(e,t){const s=this._websocket;if((0,c.Wi)(s)||(0,c.Wi)(e)&&(0,c.Wi)(t))return;const r=JSON.stringify({filter:this._serializeFilter(e,t)});let i=!1;const n=(0,u.hh)();return s.onmessage=e=>{const t=JSON.parse(e.data);t.filter&&(t.error&&(ve.error(new b.Z("geoevent-connection","Failed to set service filter",t.error)),this._set("errorString",`Could not set service filter - ${t.error}`),n.reject(t.error)),s.onmessage=this._onMessage.bind(this),i=!0,n.resolve())},s.send(r),setTimeout((()=>{i||(this.destroyed||this._websocket!==s||ve.error(new b.Z("geoevent-connection","Server timed out when setting filter")),n.reject())}),1e4),n.promise}_serializeFilter(e,t){const s={};if((0,c.Wi)(e)&&(0,c.Wi)(t))return s;if((0,c.pC)(e)&&e.geometry)try{const t=(0,be.im)(e.geometry);if("extent"!==t.type)throw new b.Z(`Expected extent but found type ${t.type}`);s.geometry=JSON.stringify(t.shiftCentralMeridian())}catch(e){ve.error(new b.Z("geoevent-connection","Encountered an error when setting connection geometryDefinition",e))}return(0,c.pC)(e)&&e.where&&"1 = 1"!==e.where&&(s.where=e.where),(0,c.pC)(t)&&(s.outFields=t.join(",")),s}_enrich(e){if(!this._relatedFeatures)return e;const t=this._serviceDefinition.relatedFeatures.joinField,s=e.attributes[t];if(!this._relatedFeatures.has(s))return ve.warn("geoevent-connection","Feature join failed. Is the join field configured correctly?",e),e;const{attributes:r,geometry:i}=this._relatedFeatures.get(s);for(const t in r)e.attributes[t]=r[t];return i&&(e.geometry=i),e.geometry||e.centroid||ve.error(new b.Z("geoevent-connection","Found malformed feature - no geometry found",e)),e}async _queryBuddyServices(){try{const{relatedFeatures:e,keepLatestArchive:t}=this._serviceDefinition,s=this._queryRelatedFeatures(e),r=this._queryArchive(t);await s;const i=await r;if(!i)return;for(const e of i.features)this.onFeature(this._enrich(e))}catch(e){ve.error(new b.Z("geoevent-connection","Encountered an error when querying buddy services",{error:e}))}}async _queryRelatedFeatures(e){if(!e)return;const t=await this._queryBuddy(e.featuresUrl);this._addRelatedFeatures(t)}async _queryArchive(e){if(e)return this._queryBuddy(e.featuresUrl)}async _queryBuddy(e){const t=new((await Promise.all([s.e(1302),s.e(2812),s.e(3812),s.e(8711),s.e(7593),s.e(4241)]).then(s.bind(s,37593))).default)({url:e}),{capabilities:r}=await t.load(),i=r.query.supportsMaxRecordCountFactor,n=r.query.supportsPagination,o=r.query.supportsCentroid,a=this._config.maxRecordCountFactor,h=t.capabilities.query.maxRecordCount,l=i?h*a:h,u=new $.Z;if(u.outFields=(0,c.Pt)(this._config.outFields,["*"]),u.where=(0,c.Pt)((0,c.U2)(this._config.filter,"where"),"1=1"),u.returnGeometry=!0,u.returnExceededLimitFeatures=!0,u.outSpatialReference=Ie.Z.fromJSON(this._config.spatialReference),o&&(u.returnCentroid=!0),i&&(u.maxRecordCountFactor=a),n)return u.num=l,t.destroy(),this._queryPages(e,u);const d=await(0,w.executeQuery)(e,u,this._config.sourceSpatialReference);return t.destroy(),d.data}async _queryPages(e,t,s=[],r=0){t.start=(0,c.pC)(t.num)?r*t.num:null;const{data:i}=await(0,w.executeQuery)(e,t,this._config.sourceSpatialReference);return i.exceededTransferLimit&&r<this._config.maxQueryDepth?(i.features.forEach((e=>s.push(e))),this._queryPages(e,t,s,r+1)):(s.forEach((e=>i.features.push(e))),i)}_addRelatedFeatures(e){const t=new Map,s=e.features,r=this._serviceDefinition.relatedFeatures.joinField;for(const e of s){const s=e.attributes[r];t.set(s,e)}this._relatedFeatures=t}};we=(0,r._)([(0,h.j)("esri.layers.graphics.sources.connections.GeoEventConnection")],we);var Se=we;function Ce(e,t,s,r,i,n,o){const a=0===e.path.indexOf("wss://")||0===e.path.indexOf("ws://"),h={source:e,sourceSpatialReference:t,spatialReference:s,geometryType:r,filter:i,maxReconnectionAttempts:n,maxReconnectionInterval:o};return a?new ye(h):new Se(h)}function Te(e,t){const s=e.weakClone();if((0,c.pC)(e.geometry)){const r=(0,p.Jd)(t,e.geometry.coords[0]),i=(0,p.IN)(t,e.geometry.coords[1]);s.geometry=new k.Z([],[r,i])}return s}class Fe{constructor(e,t){this.onUpdate=e,this._geometryType=t,this._objectIdToFeature=new Map}get _features(){const e=[];return this._objectIdToFeature.forEach((t=>e.push(t))),e}add(e){this._objectIdToFeature.set(e.objectId,e),this._index=null}get(e){return this._objectIdToFeature.has(e)?this._objectIdToFeature.get(e):null}forEach(e){this._objectIdToFeature.forEach(e)}search(e){return this._index||(this._index=function(e,t){const s=(0,le.r)(9,function(e){return"esriGeometryPoint"===e?e=>(0,c.pC)(e.geometry)?{minX:e.geometry.coords[0],minY:e.geometry.coords[1],maxX:e.geometry.coords[0],maxY:e.geometry.coords[1]}:{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}:e=>{let t=1/0,s=1/0,r=-1/0,i=-1/0;return(0,c.pC)(e.geometry)&&e.geometry.forEachVertex(((e,n)=>{t=Math.min(t,e),s=Math.min(s,n),r=Math.max(r,e),i=Math.max(i,n)})),{minX:t,minY:s,maxX:r,maxY:i}}}(t));return s.load(e),s}(this._features,this._geometryType)),function(e,t){return e.search({minX:t.bounds[0],minY:t.bounds[1],maxX:t.bounds[2],maxY:t.bounds[3]})}(this._index,e)}removeById(e){const t=this._objectIdToFeature.get(e);return t?(this._objectIdToFeature.delete(e),this._index=null,t):null}update(e,t){this.onUpdate(e,t)}get size(){return this._objectIdToFeature.size}}class ke extends se{constructor(e){super(e),this.type="geoevent",this._dataReceiveEventEnabled=!1,this._level=0,this._updateInfo={websocket:0,client:0};const{outSR:t}=e,{geometryType:s,objectIdField:r,timeInfo:i,purgeOptions:n,source:o,spatialReference:a,serviceFilter:h,maxReconnectionAttempts:l,maxReconnectionInterval:c,updateInterval:u,enableDataReceived:d}=e.serviceInfo,g=new Fe(this._onUpdate.bind(this),s),f=new ue(g,r,i,n),_=Ce(o,a,t,s,h,l,c);this._store=g,this._manager=f,this._connection=_,this._quantize=function(e){return"esriGeometryPoint"===e?Te:(t,s)=>{const r=t.weakClone(),i=new k.Z,n=(0,p.Nh)(i,t.geometry,!1,!1,e,s,!1,!1);return r.geometry=n,r}}(s),this._dataReceiveEventEnabled=d,this._handles=[this._connection.on("feature",(e=>this._onFeature(e))),this._connection.watch("connectionStatus",(e=>this.events.emit("connectionStatus",e))),this._connection.watch("errorString",(e=>this.events.emit("errorString",e)))];let m=performance.now();this._updateIntervalId=setInterval((()=>{const t=performance.now(),s=t-m;if(s>2500){m=t;const e=Math.round(this._updateInfo.client/(s/1e3)),r=Math.round(this._updateInfo.websocket/(s/1e3));this._updateInfo.client=0,this._updateInfo.websocket=0,this.events.emit("updateRate",{client:e,websocket:r})}e.canAcceptRequest()&&this._manager.checkForUpdates()}),u)}destroy(){super.destroy(),clearInterval(this._updateIntervalId),this._handles.forEach((e=>e.remove())),this._connection.destroy()}_fetchDataTile(){}resume(){}enableEvent(e,t){"data-received"===e&&(this._dataReceiveEventEnabled=t)}get updating(){return!1}subscribe(e){super.subscribe(e);const t=this._subscriptions.get(e.id);this._level=e.level;const s=this._getTileFeatures(e);this._onMessage({type:"append",id:e.key.id,addOrUpdate:s,end:!0}),t.didSend=!0}unsubscribe(e){super.unsubscribe(e)}*readers(e){const t=this._subscriptions.get(e),{tile:s}=t;yield this._getTileFeatures(s);for(const e of t.requests.stream.entries)(0,c.pC)(e)&&(0,c.pC)(e.addOrUpdate)&&(yield e.addOrUpdate)}createTileQuery(e){throw new Error("Service does not support tile queries")}async resend(){this._subscriptions.forEach((e=>{const{tile:t}=e,s={type:"append",id:t.id,addOrUpdate:this._getTileFeatures(t),end:!0};this._onMessage(s)}))}_getTileFeatures(e){const t=this._store.search(e).map((t=>this._quantize(t,e.transform)));return T.fromOptimizedFeatures(t,this._serviceInfo.geometryType,e.transform)}_onFeature(e){this._updateInfo.websocket++;try{this._dataReceiveEventEnabled&&this.events.emit("feature",e);const t=(0,p.XA)(e,this._serviceInfo.geometryType,!1,!1,this._serviceInfo.objectIdField);this._manager.add(t)}catch(e){}}_onUpdate(e,t){(0,c.pC)(e)&&(this._updateInfo.client+=e.length),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,clear:!0,end:!1})})),this._subscriptions.forEach(((e,t)=>{if(!e.didSend||e.tile.level!==this._level)return;const s=e.tile,r={type:"append",id:t,addOrUpdate:this._getTileFeatures(s),remove:[],end:!0,status:ee.empty()};e.requests.stream.enqueue(r),this._onMessage(r)}))}}const Me=a.Z.getLogger("esri.views.2d.layers.features.sources.FeatureSource");class Ee extends ne{constructor(e){super(e)}async _fetchDataTile(e){const t=this._subscriptions.get(e.key.id);let s=!1,r=0,i=0;const n=(r,n)=>{i--,(0,u.k_)(t);const o=e.id,a=r.reader,h=r.query;if(!a.exceededTransferLimit){if(s=!0,0!==n&&!a.hasFeatures){const e={id:o,addOrUpdate:a,end:0===i,type:"append"};return t.add({message:e,query:h}),void this._onMessage(e)}const e={id:o,addOrUpdate:a,end:0===i,type:"append"};return t.add({message:e,query:h}),void this._onMessage(e)}const l={id:o,addOrUpdate:a,end:s&&0===i,type:"append"};t.add({message:l,query:h}),this._onMessage(l)};let o=0,a=0;for(;!s&&a++<20;){let a;for(let h=0;h<o+1;h++){const o=r++;i++,a=this._fetchDataTilePage(e,o,t).then((e=>e&&n(e,o))).catch((t=>{s=!0,(0,u.D_)(t)||(Me.error(new b.Z("mapview-query-error","Encountered error when fetching tile",{tile:e,error:t})),this._onMessage({id:e.id,addOrUpdate:null,end:s,type:"append"}))}))}await a,(0,u.k_)(t),o=Math.min(o+2,6)}}async _fetchDataTilePage(e,t,s){const r=this._queryInfo,i={start:this.pageSize*t,num:this.pageSize,returnExceededLimitFeatures:!0,quantizationParameters:e.getQuantizationParameters()};(0,c.pC)(this.maxRecordCountFactor)&&(i.maxRecordCountFactor=this.maxRecordCountFactor);const n=this.createTileQuery(e,i);try{const i=s.signal,o=await this._queue.push({tile:e,query:n,signal:i,depth:t});return(0,u.k_)(s),o?r!==this._queryInfo?this._fetchDataTilePage(e,t,s):{reader:o,query:n}:null}catch(e){return(0,u.H9)(e),null}}}var Ae=s(77734),Re=s(61800);const Oe=a.Z.getLogger("esri.views.2d.layers.features.sources.SnapshotFeatureSource");function Le(e,t,s){const r=e.getXHydrated(),i=e.getYHydrated(),n=t.getColumnForX(r),o=Math.floor(t.normalizeCol(n));return`${s}/${Math.floor(t.getRowForY(i))}/${o}`}function Pe(e,t){if((0,c.Wi)(e))return null;const s=t.transform,r=e.getQuantizationTransform();if((0,c.Wi)(r)){const[t,r]=s.scale,[i,n]=s.translate,o=-i/t,a=1/t,h=n/r,l=1/-r;return e.transform(o,h,a,l)}const[i,n]=r.scale,[o,a]=r.translate,[h,l]=s.scale,[u,d]=s.translate,p=i/h,g=(o-u)/h,f=n/l,_=(-a+d)/l;return e.transform(g,_,p,f)}class De extends ne{constructor(e){super(e),this.mode="snapshot",this._loading=!0,this._controller=new AbortController,this._downloadPromise=null,this._didSendEnd=!1,this._queries=new Array,this._invalidated=!1,this._hasAggregates=!1,this._random=new Ae.Z(1e3),this._featureCount=e.featureCount,this._store=e.store,this._markedIdsBufId=this._store.storage.createBitset()}destroy(){super.destroy(),this._controller.abort()}get loading(){return this._loading}get _signal(){return this._controller.signal}update(e,t){super.update(e,t),this._hasAggregates=e.targets.aggregate}async resend(e=!1){if(await this._downloadPromise,this._invalidated||e)return this._invalidated=!1,this._subscriptions.forEach((e=>e.clear())),this._downloadPromise=this._download(this._featureCount),void await this._downloadPromise;const t=this._queries.map((({query:e,reader:t})=>this._sendPatchQuery(e,t)));await Promise.all(t),this._subscriptions.forEach((e=>{e.requests.done.forEach((e=>this._onMessage(e.message)))}))}async refresh(){await this.resend(!0)}async _sendPatchQuery(e,t){const s=(0,c.pC)(e.outFields)?e.outFields:[],r=this._queryInfo.outFields,i=r.filter((e=>-1===s.indexOf(e)));if(!i.length)return;const n=e.clone(),o=this._signal;n.returnGeometry=!1,n.returnCentroid=!1,n.outFields=i,e.outFields=r;const a=await this._queue.push({query:n,depth:0,signal:o});(0,u.k_)({signal:o}),t.joinAttributes(a)}async _fetchDataTile(e){this._downloadPromise||(this._downloadPromise=this._download(this._featureCount));const t=this._store.search(e),s=this._subscriptions.get(e.key.id),r=t.length-1;for(let i=0;i<r;i++){const r=Pe(t[i],e),n={type:"append",id:e.id,addOrUpdate:r,end:!1,status:ee.empty()};s.add({query:null,message:n}),this._hasAggregates||await(0,u.e4)(1),this._onMessage(n)}const i=Pe(r>=0?t[r]:null,e),n=this._didSendEnd,o={type:"append",id:e.id,addOrUpdate:i,end:n,status:ee.empty()};s.add({query:null,message:o}),this._onMessage(o)}async _download(e){try{await this.whenInitialized();const t=this._store.storage.getBitset(this._markedIdsBufId),s=new Set;t.clear();const r=Math.ceil(e/this.pageSize),i=Array.from({length:r},((e,t)=>t)).sort(((e,t)=>this._random.getInt()-this._random.getInt())).map((e=>this._downloadPage(e,t,s)));await Promise.all(i),this._store.sweepFeatures(t,this._store.storage),this._store.sweepFeatureSets(s)}catch(e){Oe.error("mapview-snapshot-source","Encountered and error when downloading feature snapshot",e)}this._sendEnd(),this._loading=!1}async _downloadPage(e,t,s){const r=this.pageSize,i={start:e*r,num:r,cacheHint:!0};(0,c.pC)(this.maxRecordCountFactor)&&(i.maxRecordCountFactor=this.maxRecordCountFactor);const n=this.createQuery(i),o=this._signal,a=await this._queue.push({query:n,depth:e,signal:o});(0,u.k_)({signal:o}),this._queries.push({query:n,reader:a}),this._store.insert(a),s.add(a.instance);const h=a.getCursor();for(;h.next();)t.set(h.getDisplayId());this._send(a)}_send(e){if(!this._subscriptions.size)return;let t=null;const s=new Map,r=new Set,i=new Map;this._subscriptions.forEach((e=>{var n;const o=e.tile;s.set(o.key.id,null),t=o.tileInfoView,r.add(o.level);const{row:a,col:h}=o.key,l=`${o.level}/${a}/${h}`,c=null!=(n=i.get(l))?n:[];c.push(e),i.set(l,c)}));for(const n of r){const r=t.getLODInfoAt(n),o=e.getCursor();for(;o.next();){const e=Le(o,r,n),t=o.getIndex();if(i.has(e))for(const r of i.get(e)){const e=r.tile.id;let i=s.get(e);(0,c.Wi)(i)&&(i=[],s.set(e,i)),i.push(t)}}}s.forEach(((t,s)=>{if((0,c.pC)(t)){const r=this._subscriptions.get(s),i={type:"append",id:s,addOrUpdate:Pe(Re.t.from(e,t),r.tile),end:!1,status:ee.empty()};r.add({query:null,message:i}),this._onMessage(i)}}))}_sendEnd(){this._subscriptions.forEach((e=>{const t={type:"append",id:e.tile.id,addOrUpdate:null,end:!0,status:ee.empty()};e.add({query:null,message:t}),this._onMessage(t)})),this._didSendEnd=!0}}var Ne=s(20315);function Ue(e,t,s,r){r%2&&(r+=1);let i=0,n=0,o=-90,a=90,h=-180,l=180;for(let e=0;e<r/2;e++){for(let t=0;t<5;t++){const r=(h+l)/2,n=s>r?1:0;i|=n<<29-(t+5*e),h=(1-n)*h+n*r,l=(1-n)*r+n*l}for(let s=0;s<5;s++){const r=(o+a)/2,i=t>r?1:0;n|=i<<29-(s+5*e),o=(1-i)*o+i*r,a=(1-i)*r+i*a}}e.geohashX=i,e.geohashY=n}function qe(e,t,s,r,i){i%2&&(i+=1);let n=0,o=0,a=-90,h=90,l=-180,c=180;for(let e=0;e<i/2;e++){for(let t=0;t<5;t++){const s=(l+c)/2,i=r>s?1:0;n|=i<<29-(t+5*e),l=(1-i)*l+i*s,c=(1-i)*s+i*c}for(let t=0;t<5;t++){const r=(a+h)/2,i=s>r?1:0;o|=i<<29-(t+5*e),a=(1-i)*a+i*r,h=(1-i)*r+i*h}}e[2*t]=n,e[2*t+1]=o}new Float64Array(2),new Float64Array(2);class ze{constructor(e=[],t=8096){this._nodes=0,this._root=new Ze(0,0,0),this._statisticFields=e,this._pool=t?new K.Z(8096):null}_acquire(e,t,s){this._nodes++;let r=null;return(0,c.pC)(this._pool)&&(r=this._pool.dequeue()),(0,c.pC)(r)?r.realloc(e,t,s):new Ze(e,t,s)}_release(e){this._nodes--,(0,c.pC)(this._pool)&&this._pool.enqueue(e)}get count(){return this._root.count}get size(){return this._nodes}get poolSize(){return(0,c.R2)(this._pool,0,(e=>e.size))}get depth(){let e=0;return this._forEachNode((t=>e=Math.max(e,t.depth))),e}dropLevels(e){this._forEachNode((t=>{if(t.depth>=e)for(let e=0;e<t.children.length;e++){const s=t.children[e];t.children[e]=null,s&&this._release(s)}}))}clear(){this.dropLevels(0)}insert(e,t,s=0){const r=T.fromOptimizedFeatures([e],"esriGeometryPoint").getCursor();r.next();const i=r.readGeometry();if(!i)return;const[n,o]=i.coords,a=e.geohashX,h=e.geohashY;this.insertCursor(r,e.displayId,n,o,a,h,t,s)}insertCursor(e,t,s,r,i,n,o,a=0){let h=this._root,l=0,c=0,u=0;for(;null!==h;){if(h.depth>=a&&(h.count+=1,h.xTotal+=s,h.yTotal+=r,h.xGeohashTotal+=i,h.yGeohashTotal+=n,h.displayId=t,this._updateStatisticsCursor(e,h,1)),l>=o)return void h.add(t);const d=Math.ceil((l+1)/2),p=Math.floor((l+1)/2),g=1-l%2,f=30-(3*d+2*p),_=30-(2*d+3*p),m=(i&7*g+3*(1-g)<<f)>>f,y=(n&3*g+7*(1-g)<<_)>>_,b=m+y*(8*g+4*(1-g));c=c<<3*g+2*(1-g)|m,u=u<<2*g+3*(1-g)|y,null==h.children[b]&&(h.children[b]=this._acquire(c,u,l+1)),l+=1,h=h.children[b]}}remove(e,t){const s=T.fromOptimizedFeatures([e],"esriGeometryPoint").getCursor();s.next();const r=s.readGeometry();if(!r)return;const[i,n]=r.coords,o=e.geohashX,a=e.geohashY;this.removeCursor(s,i,n,o,a,t)}removeCursor(e,t,s,r,i,n){let o=this._root,a=0;for(;null!==o;){if(o.count-=1,o.xTotal-=t,o.yTotal-=s,o.xGeohashTotal-=r,o.yGeohashTotal-=i,this._updateStatisticsCursor(e,o,-1),a>=n)return void o.remove(e.getDisplayId());const h=Math.ceil((a+1)/2),l=Math.floor((a+1)/2),c=1-a%2,u=30-(3*h+2*l),d=30-(2*h+3*l),p=((r&7*c+3*(1-c)<<u)>>u)+((i&3*c+7*(1-c)<<d)>>d)*(8*c+4*(1-c)),g=o.children[p];1===g.count&&(this._release(g),o.children[p]=null),a+=1,o=g}}find(e,t,s){return this._root.find(e,t,s,0,0,0)}findSingleOccupancyNode(e,t,s,r,i){let n=this._root;for(;null!==n;){const o=n.depth,a=n.xNode,h=n.yNode,l=1-o%2,c=n.xGeohashTotal/n.count,u=n.yGeohashTotal/n.count;if(1===n.count&&e<c&&c<=s&&t<u&&u<=r)return n;if(o>=i){n=n.next;continue}const d=Math.ceil((o+1)/2),p=Math.floor((o+1)/2),g=30-(3*d+2*p),f=30-(2*d+3*p),_=~((1<<g)-1),m=~((1<<f)-1),y=(e&_)>>g,b=(t&m)>>f,I=(s&_)>>g,v=(r&m)>>f,x=a<<3*l+2*(1-l),w=h<<2*l+3*(1-l),S=x+8*l+4*(1-l),C=w+4*l+8*(1-l),T=Math.max(x,y),F=Math.max(w,b),k=Math.min(S,I),M=Math.min(C,v);let E=null,A=null;for(let e=F;e<=M;e++)for(let t=T;t<=k;t++){const s=t-x+(e-w)*(8*l+4*(1-l)),r=n.children[s];r&&(E||(E=r,E.next=n.next),A&&(A.next=r),A=r,r.next=n.next)}n=E||n.next}return null}getRegionDisplayIds(e,t,s,r,i){let n=this._root;const o=[];for(;null!==n;){const a=n.depth,h=n.xNode,l=n.yNode;if(a>=i){const i=n.xGeohashTotal/n.count,a=n.yGeohashTotal/n.count;e<=i&&i<=s&&t<=a&&a<=r&&n.displayIds.forEach((e=>o.push(e))),n=n.next;continue}const c=Math.ceil((a+1)/2),u=Math.floor((a+1)/2),d=1-a%2,p=30-(3*c+2*u),g=30-(2*c+3*u),f=~((1<<p)-1),_=~((1<<g)-1),m=(e&f)>>p,y=(t&_)>>g,b=(s&f)>>p,I=(r&_)>>g,v=h<<3*d+2*(1-d),x=l<<2*d+3*(1-d),w=v+8*d+4*(1-d),S=x+4*d+8*(1-d),C=Math.max(v,m),T=Math.max(x,y),F=Math.min(w,b),k=Math.min(S,I);let M=null,E=null;for(let e=T;e<=k;e++)for(let t=C;t<=F;t++){const s=t-v+(e-x)*(8*d+4*(1-d)),r=n.children[s];r&&(M||(M=r,M.next=n.next),E&&(E.next=r),E=r,r.next=n.next)}n=M||n.next}return o}getRegionStatistics(e,t,s,r,i){let n=this._root,o=0,a=0,h=0;const l={};let c=0;for(;null!==n;){const u=n.depth,d=n.xNode,p=n.yNode;if(u>=i){const i=n.xGeohashTotal/n.count,u=n.yGeohashTotal/n.count;e<i&&i<=s&&t<u&&u<=r&&(o+=n.count,a+=n.xTotal,h+=n.yTotal,1===n.count&&(c=n.displayId),this._aggregateStatistics(l,n.statistics)),n=n.next;continue}const g=Math.ceil((u+1)/2),f=Math.floor((u+1)/2),_=1-u%2,m=30-(3*g+2*f),y=30-(2*g+3*f),b=~((1<<m)-1),I=~((1<<y)-1),v=(e&b)>>m,x=(t&I)>>y,w=(s&b)>>m,S=(r&I)>>y,C=d<<3*_+2*(1-_),T=p<<2*_+3*(1-_),F=C+8*_+4*(1-_),k=T+4*_+8*(1-_),M=Math.max(C,v),E=Math.max(T,x),A=Math.min(F,w),R=Math.min(k,S);let O=null,L=null;for(let i=E;i<=R;i++)for(let u=M;u<=A;u++){const d=u-C+(i-T)*(8*_+4*(1-_)),p=n.children[d];if(p){if(i!==E&&i!==R&&u!==M&&u!==A){const i=p.xGeohashTotal/p.count,n=p.yGeohashTotal/p.count;e<i&&i<=s&&t<n&&n<=r&&(o+=p.count,a+=p.xTotal,h+=p.yTotal,1===p.count&&(c=p.displayId),this._aggregateStatistics(l,p.statistics));continue}O||(O=p,O.next=n.next),L&&(L.next=p),L=p,p.next=n.next}}n=O||n.next}return{count:o,attributes:this._normalizeStatistics(l,o),xTotal:a,yTotal:h,referenceId:c}}_forEachNode(e){let t=this._root;for(;null!==t;){const s=this._linkChildren(t)||t.next;e(t),t=s}}_linkChildren(e){let t=null,s=null;for(let r=0;r<=e.children.length;r++){const i=e.children[r];i&&(t||(t=i,t.next=e.next),s&&(s.next=i),s=i,i.next=e.next)}return t}_updateStatisticsCursor(e,t,s){for(const r of this._statisticFields){const i=r.name,n=r.inField?e.readAttribute(r.inField):e.getComputedNumericAtIndex(r.inFieldIndex);switch(r.statisticType){case"norm":{t.statistics[i]||(t.statistics[i]={});const o=r.inNormalizationField,a=e.readAttribute(o),h=t.statistics[i].onStatisticField||0,l=t.statistics[i].onStatisticNormalizationField||0;null==n||isNaN(n)||null==a||0===a||isNaN(a)||(t.statistics[i].onStatisticField=h+s*n,t.statistics[i].onStatisticNormalizationField=l+s*a);break}case"sum":case"avg":{t.statistics[i]||(t.statistics[i]={value:0,nanCount:0});const e=t.statistics[i].value,r=t.statistics[i].nanCount;null==n||isNaN(n)?t.statistics[i].nanCount=r+s:t.statistics[i].value=e+s*n;break}case"avg_angle":{t.statistics[i]||(t.statistics[i]={x:0,y:0,nanCount:0});const e=t.statistics[i].x,r=t.statistics[i].y,o=t.statistics[i].nanCount,a=Math.PI/180;null==n||isNaN(n)?t.statistics[i].nanCount=o+s:(t.statistics[i].x=e+s*Math.cos(n*a),t.statistics[i].y=r+s*Math.sin(n*a));break}case"mode":{t.statistics[i]||(t.statistics[i]={});const e=t.statistics[i][n]||0;t.statistics[i][n]=e+s;break}}}}_aggregateStatistics(e,t){for(const s of this._statisticFields){const r=s.name;switch(s.statisticType){case"sum":case"avg":case"avg_angle":case"mode":case"norm":e[r]||(e[r]={});for(const s in t[r]){const i=e[r][s]||0;e[r][s]=i+t[r][s]}}}}_normalizeStatistics(e,t){const s={};for(const r of this._statisticFields){const i=r.name;switch(r.statisticType){case"norm":{const r=e[i];if(t&&null==r.onStatisticNormalizationField)break;if(t&&r.onStatisticNormalizationField){s[i]=r.onStatisticField/r.onStatisticNormalizationField;break}s[i]=0;break}case"sum":{if(!t)break;const{value:r,nanCount:n}=e[i];if(!(t-n))break;s[i]=r;break}case"avg":{if(!t)break;const{value:r,nanCount:n}=e[i];if(!(t-n))break;s[i]=r/(t-n);break}case"avg_angle":{if(!t)break;const{x:r,y:n,nanCount:o}=e[i];if(!(t-o))break;const a=r/(t-o),h=n/(t-o),l=180/Math.PI,c=Math.atan2(h,a)*l;s[i]=c;break}case"mode":{const t=e[i];let r=0,n=null;for(const e in t){const s=t[e];s>r&&(r=s,n=e)}s[i]="null"===n?null:n;break}}}return s}}class Ze{constructor(e,t,s){this.count=0,this.xTotal=0,this.yTotal=0,this.statistics={},this.displayId=0,this.displayIds=new Set,this.next=null,this.depth=0,this.xNode=0,this.yNode=0,this.xGeohashTotal=0,this.yGeohashTotal=0,this.children=new Array(32);for(let e=0;e<this.children.length;e++)this.children[e]=null;this.xNode=e,this.yNode=t,this.depth=s}realloc(e,t,s){for(let e=0;e<this.children.length;e++)this.children[e]=null;return this.xNode=e,this.yNode=t,this.depth=s,this.next=null,this.xGeohashTotal=0,this.yGeohashTotal=0,this.xTotal=0,this.yTotal=0,this.count=0,this.statistics={},this.displayIds.clear(),this}add(e){this.displayIds.add(e)}remove(e){this.displayIds.delete(e)}getLngLatBounds(){const e=this.depth,t=Math.ceil(e/2),s=Math.floor(e/2),r=30-(3*t+2*s),i=30-(2*t+3*s);return function(e,t){let s=-90,r=90,i=-180,n=180;for(let o=0;o<t;o++){const t=Math.ceil((o+1)/2),a=Math.floor((o+1)/2),h=1-o%2,l=30-(3*t+2*a),c=30-(2*t+3*a),u=2*h+3*(1-h),d=(7*h+3*(1-h)<<l&e.geohashX)>>l,p=(3*h+7*(1-h)<<c&e.geohashY)>>c;for(let e=3*h+2*(1-h)-1;e>=0;e--){const t=(i+n)/2,s=d&1<<e?1:0;i=(1-s)*i+s*t,n=(1-s)*t+s*n}for(let e=u-1;e>=0;e--){const t=(s+r)/2,i=p&1<<e?1:0;s=(1-i)*s+i*t,r=(1-i)*t+i*r}}return[i,s,n,r]}({geohashX:this.xNode<<r,geohashY:this.yNode<<i},this.depth)}find(e,t,s,r,i,n){if(r>=s)return this;const o=1-r%2,a=3*o+2*(1-o),h=2*o+3*(1-o),l=30-i-a,c=30-n-h,u=((e&7*o+3*(1-o)<<l)>>l)+((t&3*o+7*(1-o)<<c)>>c)*(8*o+4*(1-o)),d=this.children[u];return null==d?null:d.find(e,t,s,r+1,i+a,n+h)}}var Be=s(68441),Ge=s(8744),je=s(37427),We=s(16534),Xe=s(59999);class Ve extends S.nd{constructor(e,t,s,r,i){super(new k.Z([],[t,s]),r,null,e),this.geohashBoundsInfo=i}get count(){return this.attributes.cluster_count}static create(e,t,s,r,i,n,o,a){const h=new Ve(t,s,r,n,o);return h.displayId=e.createDisplayId(!0),h.referenceId=a,h.tileLevel=i,h}update(e,t,s,r,i,n){return this.geometry.coords[0]=e,this.geometry.coords[1]=t,this.tileLevel=s,this.attributes=r,this.geohashBoundsInfo=i,this.referenceId=null,this.referenceId=n,this}toJSON(){return{objectId:this.objectId,referenceId:1===this.attributes.cluster_count?this.referenceId:null,attributes:{...this.attributes,clusterId:this.objectId},geometry:{x:this.geometry.coords[0],y:this.geometry.coords[1]}}}}function Ye(e){return 57.29577951308232*e}class He extends Xe.J{constructor(e,t,s){super(e,s),this.events=new Q.Z,this._geohashLevel=0,this._tileLevel=0,this._aggregateValueRanges={},this._aggregateValueRangesChanged=!1,this._geohashBuf=[],this._clusters=new Map,this._tiles=new Map,this.geometryInfo=e.geometryInfo,this._spatialReference=t,this._projectionSupportCheck=(0,je._W)(t,Ie.Z.WGS84),this._bitsets.geohash=s.getBitset(s.createBitset()),this._bitsets.inserted=s.getBitset(s.createBitset())}async updateSchema(e,t){const s=this._schema;try{await super.updateSchema(e,t),await this._projectionSupportCheck}catch(e){}const r=(0,J.Hg)(s,t);t&&(!(0,c.Wi)(r)||e.source||e.storage.filters)?(((0,J.uD)(r,"params.fields")||!this._tree||e.source)&&(this._tree=new ze(this._statisticFields),this._rebuildTree(),(0,n.Z)("esri-2d-update-debug")&&console.debug("Aggregate mesh needs update due to tree changing")),(0,n.Z)("esri-2d-update-debug")&&console.debug("Applying Update - ClusterStore:",r),e.targets[t.name]=!0,e.mesh=!1,this._aggregateValueRanges={}):s&&(e.mesh=!0)}clear(){this._rebuildTree()}sweepFeatures(e,t){this._bitsets.inserted.forEachSet((s=>{if(!e.has(s)){const e=t.lookupByDisplayIdUnsafe(s);this._remove(e)}}))}sweepClusters(e,t,s){this._clusters.forEach(((r,i)=>{r&&r.tileLevel!==s&&(e.releaseDisplayId(r.displayId),t.unsetAttributeData(r.displayId),this._clusters.delete(i))}))}onTileData(e,t,s,r,i=!0){if(!this._schema||(0,c.Wi)(t.addOrUpdate))return t;const n=this._getTransforms(e,this._spatialReference);{const e=t.addOrUpdate.getCursor();for(;e.next();)this._update(e,r)}if(t.status.mesh||!i)return t;const o=new Array,a=this._schema.params.clusterRadius;this._getClustersForTile(o,e,a,s,n),t.addOrUpdate=T.fromOptimizedFeatures(o,"esriGeometryPoint"),t.addOrUpdate.attachStorage(s),t.end=!0;{const r=t.addOrUpdate.getCursor();for(;r.next();){const t=r.getDisplayId();this._bitsets.computed.unset(t),this.setComputedAttributes(s,r,t,e.scale)}}return this._aggregateValueRangesChanged&&t.end&&(this.events.emit("valueRangesChanged",{valueRanges:this._aggregateValueRanges}),this._aggregateValueRangesChanged=!1),t}onTileUpdate({added:e,removed:t}){if(e.length){const t=e[0].level;this._tileLevel=t,this._setGeohashLevel(t)}if(!this._schema)return;const s=this._schema.params.clusterRadius;t.forEach((e=>{this._tiles.delete(e.key.id),this._markTileClustersForDeletion(e,s)}))}getAggregate(e){let t=null;return this._clusters.forEach((s=>{s&&s.displayId===e&&(t=s.toJSON())})),t}getAggregates(){const e=[];return this._clusters.forEach((t=>{t&&t.tileLevel===this._tileLevel&&e.push(t.toJSON())})),e}getDisplayId(e){const t=this._clusters.get(e);return t?t.displayId:null}getFeatureDisplayIdsForAggregate(e){const t=this._clusters.get(e);if(!t)return[];const s=t.geohashBoundsInfo;return this._tree.getRegionDisplayIds(s.xLL,s.yLL,s.xTR,s.yTR,s.level)}getDisplayIdForReferenceId(e){let t;return this._clusters.forEach((s=>{s&&s.referenceId===e&&(t=s.displayId)})),t}getAggregateValueRanges(){return this._aggregateValueRanges}forEach(e){this._clusters.forEach(((t,s)=>{t&&e(t,s)}))}size(){let e=0;return this.forEach((t=>e++)),e}_rebuildTree(){this._bitsets.computed.clear(),this._bitsets.inserted.clear(),this._tree&&this._tree.clear()}_remove(e){const t=e.getDisplayId(),s=e.getXHydrated(),r=e.getYHydrated(),i=this._geohashBuf[2*t],n=this._geohashBuf[2*t+1];this._bitsets.inserted.has(t)&&(this._bitsets.inserted.unset(t),this._tree.removeCursor(e,s,r,i,n,this._geohashLevel))}_update(e,t){const s=e.getDisplayId(),r=this._bitsets.inserted,i=t.isVisible(s);if(i===r.has(s))return;if(!i)return void this._remove(e);const n=e.getXHydrated(),o=e.getYHydrated();if(!this._setGeohash(s,n,o))return;const a=this._geohashBuf[2*s],h=this._geohashBuf[2*s+1];this._tree.insertCursor(e,s,n,o,a,h,this._geohashLevel),r.set(s)}_setGeohash(e,t,s){if(this._bitsets.geohash.has(e))return!0;const r=this._geohashBuf;if(this._spatialReference.isWebMercator){const i=Ye(t/Be.sv.radius),n=i-360*Math.floor((i+180)/360);qe(r,e,Ye(Math.PI/2-2*Math.atan(Math.exp(-s/Be.sv.radius))),n,12)}else{const i=(0,je.iV)({x:t,y:s},this._spatialReference,Ie.Z.WGS84);if(!i)return!1;qe(r,e,i.y,i.x,12)}return this._bitsets.geohash.set(e),!0}_getClustersForTile(e,t,s,r,i,n=!0){const o=this._schema.params.clusterPixelBuffer,a=2*s,h=this._getGeohashLevel(t.key.level),l=Math.ceil(2**t.key.level*We.I_/a),u=Math.ceil(o/a)+0,d=Math.ceil(We.I_/a),{row:g,col:f}=t.key,_=f*We.I_,m=g*We.I_,y=Math.floor(_/a)-u,b=Math.floor(m/a)-u,I=y+d+2*u,v=b+d+2*u,x=t.tileInfoView.getLODInfoAt(t.key.level);for(let s=y;s<=I;s++)for(let o=b;o<=v;o++){let a=s;x.wrap&&(a=s<0?s+l:s%l);const u=x.wrap&&s<0,d=x.wrap&&s%l!==s,g=this._lookupCluster(r,x,t.key.level,a,o,h);if((0,c.pC)(g)){const t=(0,c.Po)(i,(e=>u?e.left:d?e.right:e.tile));if(n&&(0,c.Wi)(t))continue;if(!g.count)continue;if((0,c.pC)(t)&&n){const s=g.geometry.clone();let r=g.attributes;s.coords[0]=(0,p.Jd)(t,s.coords[0]),s.coords[1]=(0,p.IN)(t,s.coords[1]),1===g.count&&(0,c.pC)(g.referenceId)&&(r={...g.attributes,referenceId:g.referenceId});const i=new S.ZP(s,r);i.displayId=g.displayId,e.push(i)}}}}_getGeohashLevel(e){return Math.min(Math.ceil(e/2+2),12)}_setGeohashLevel(e){const t=this._getGeohashLevel(e),s=1*(Math.floor(t/1)+1)-1;if(this._geohashLevel!==s)return this._geohashLevel=s,this._rebuildTree(),void this._bitsets.geohash.clear()}_getTransforms(e,t){const s={originPosition:"upperLeft",scale:[e.resolution,e.resolution],translate:[e.bounds[0],e.bounds[3]]},r=(0,Ge.C5)(t);if(!r)return{tile:s,left:null,right:null};const[i,n]=r.valid;return{tile:s,left:{...s,translate:[n,e.bounds[3]]},right:{...s,translate:[i-n+e.bounds[0],e.bounds[3]]}}}_getClusterId(e,t,s){return(15&e)<<28|(16383&t)<<14|16383&s}_markForDeletion(e,t,s){const r=this._getClusterId(e,t,s);this._clusters.delete(r)}_getClusterBounds(e,t,s){const r=this._schema.params.clusterRadius,i=2*r;let n=s%2?t*i:t*i-r;const o=s*i;let a=n+i;const h=o-i,l=2**e.level*We.I_;e.wrap&&n<0&&(n=0),e.wrap&&a>l&&(a=l);const c=n/We.I_,u=o/We.I_,d=a/We.I_,p=h/We.I_;return[e.getXForColumn(c),e.getYForRow(u),e.getXForColumn(d),e.getYForRow(p)]}_lookupCluster(e,t,s,r,i,n){const o=this._getClusterId(s,r,i),a=this._clusters.get(o),[h,l,u,d]=this._getClusterBounds(t,r,i),p={x:h,y:l},g={x:u,y:d};let f=0,_=0,m=0,y=0;if(this._spatialReference.isWebMercator){{const e=Ye(p.x/Be.sv.radius);f=e-360*Math.floor((e+180)/360),_=Ye(Math.PI/2-2*Math.atan(Math.exp(-p.y/Be.sv.radius)))}{const e=Ye(g.x/Be.sv.radius);m=e-360*Math.floor((e+180)/360),y=Ye(Math.PI/2-2*Math.atan(Math.exp(-g.y/Be.sv.radius)))}}else{const e=(0,je.iV)(p,this._spatialReference,Ie.Z.WGS84),t=(0,je.iV)(g,this._spatialReference,Ie.Z.WGS84);if(!e||!t)return null;f=e.x,_=e.y,m=t.x,y=t.y}const b={geohashX:0,geohashY:0},I={geohashX:0,geohashY:0};Ue(b,_,f,n),Ue(I,y,m,n);const v=b.geohashX,x=b.geohashY,w=I.geohashX,S=I.geohashY,C={xLL:v,yLL:x,xTR:w,yTR:S,level:n},T=this._tree.getRegionStatistics(v,x,w,S,n),{count:F,xTotal:k,yTotal:M,referenceId:E}=T,A=F?k/F:0,R=F?M/F:0;if(0===F)return this._clusters.set(o,null),null;const O={cluster_count:F,...T.attributes},L=(0,c.pC)(a)?a.update(A,R,s,O,C,E):Ve.create(e,o,A,R,s,O,C,E);return 0===F&&(L.geometry.coords[0]=(h+u)/2,L.geometry.coords[1]=(l+d)/2),this._clusters.set(o,L),this._updateAggregateValueRangeForCluster(L,L.tileLevel),L}_updateAggregateValueRangeForCluster(e,t){const s=this._aggregateValueRanges[t]||{minValue:1/0,maxValue:0},r=s.minValue,i=s.maxValue;s.minValue=Math.min(r,e.count),s.maxValue=Math.max(i,e.count),this._aggregateValueRanges[t]=s,r===s.minValue&&i===s.maxValue||(this._aggregateValueRangesChanged=!0)}_markTileClustersForDeletion(e,t){const s=2*t,r=Math.ceil(We.I_/s),{row:i,col:n}=e.key,o=n*We.I_,a=i*We.I_,h=Math.floor(o/s),l=Math.floor(a/s);for(let t=h;t<h+r;t++)for(let s=l;s<l+r;s++)this._markForDeletion(e.key.level,t,s)}}class Qe{constructor(){this._freeIds=[],this._idCounter=1}createId(e=!1){return function(e,t){return((t?2147483648:0)|e)>>>0}(this._getFreeId(),e)}releaseId(e){this._freeIds.push(e)}_getFreeId(){return this._freeIds.length?this._freeIds.pop():this._idCounter++}}var Je=s(93054);function $e(e,t,s){if(!(e.length>t))for(;e.length<=t;)e.push(s)}const Ke=2147483647;class et{constructor(){this._numerics=[],this._strings=[],this._idGenerator=new Qe,this._allocatedSize=256,this._bitsets=[],this._instanceIds=[],this._bounds=[]}createBitset(){const e=this._bitsets.length;return this._bitsets.push(Je.p.create(this._allocatedSize,Ke)),e+1}getBitset(e){return this._bitsets[e-1]}_expand(){this._allocatedSize<<=1;for(const e of this._bitsets)e.resize(this._allocatedSize)}_ensureNumeric(e,t){this._numerics[e]||(this._numerics[e]=[]),$e(this._numerics[e],t,0)}_ensureInstanceId(e){$e(this._instanceIds,e,0)}_ensureString(e,t){this._strings[e]||(this._strings[e]=[]),$e(this._strings[e],t,null)}createDisplayId(e=!1){const t=this._idGenerator.createId();return t>this._allocatedSize&&this._expand(),((e,t)=>((t?2147483648:0)|e)>>>0)(t,e)}releaseDisplayId(e){for(const t of this._bitsets)t.unset(e);return this._idGenerator.releaseId(e&Ke)}getComputedNumeric(e,t){return this.getComputedNumericAtIndex(e&Ke,0)}setComputedNumeric(e,t,s){return this.setComputedNumericAtIndex(e&Ke,s,0)}getComputedString(e,t){return this.getComputedStringAtIndex(e&Ke,0)}setComputedString(e,t,s){return this.setComputedStringAtIndex(e&Ke,0,s)}getComputedNumericAtIndex(e,t){const s=e&Ke;return this._ensureNumeric(t,s),this._numerics[t][s]}setComputedNumericAtIndex(e,t,s){const r=e&Ke;this._ensureNumeric(t,r),this._numerics[t][r]=s}getInstanceId(e){const t=e&Ke;return this._ensureInstanceId(t),this._instanceIds[t]}setInstanceId(e,t){const s=e&Ke;this._ensureInstanceId(s),this._instanceIds[s]=t}getComputedStringAtIndex(e,t){const s=e&Ke;return this._ensureString(t,s),this._strings[t][s]}setComputedStringAtIndex(e,t,s){const r=e&Ke;this._ensureString(t,r),this._strings[t][r]=s}getXMin(e){return this._bounds[4*(e&Ke)]}getYMin(e){return this._bounds[4*(e&Ke)+1]}getXMax(e){return this._bounds[4*(e&Ke)+2]}getYMax(e){return this._bounds[4*(e&Ke)+3]}setBounds(e,t){const s=t.readHydratedGeometry();if(!s||!s.coords.length)return!1;let r=1/0,i=1/0,n=-1/0,o=-1/0;s.forEachVertex(((e,t)=>{r=Math.min(r,e),i=Math.min(i,t),n=Math.max(n,e),o=Math.max(o,t)}));const a=e&Ke;return $e(this._bounds,4*a+4,0),this._bounds[4*a]=r,this._bounds[4*a+1]=i,this._bounds[4*a+2]=n,this._bounds[4*a+3]=o,!0}}function tt(e){if(!(0,u.D_)(e)&&!function(e){return"worker:port-closed"===e.name}(e))throw e}function st(e){return"feature"===e.type&&"snapshot"===e.mode}let rt=class extends i.r{constructor(){super(...arguments),this._storage=new et,this._markedIdsBufId=this._storage.createBitset(),this._lastCleanup=performance.now(),this._cleanupNeeded=!1,this._invalidated=!1,this._tileToResolver=new Map,this._didEdit=!1,this.tileStore=null,this.config=null,this.processor=null,this.remoteClient=null,this.service=null}initialize(){this._initAttributeStore(),this._initStores(),this._initQueryEngine(),this._initSource(),this._updateQueue=new re.e({concurrency:"geoevent"===this._source.type?1:4,process:(e,t)=>this._onTileMessage(e,{signal:t})}),this.handles.add([this.tileStore.on("update",this.onTileUpdate.bind(this)),this.watch("updating",(e=>!e&&this.onIdle()))]),this._checkUpdating=setInterval((()=>this.notifyChange("updating")),300)}async startup(){this._initAttributeStore(),this.tileStore.tiles.forEach((e=>this._source.subscribe(e)))}_initSource(){const e=this.tileStore.tileScheme;this._source=function(e,t,s,r,i,n){const o=function(e,t,s,r,i,n){switch(e.type){case"snapshot":return{type:"feature",origin:"snapshot",featureCount:(0,c.Pt)(e.featureCount,0),serviceInfo:e,onMessage:r,outSR:t,tileInfoView:s,canAcceptRequest:i,store:n};case"stream":return{type:"geoevent",serviceInfo:e,onMessage:r,outSR:t,canAcceptRequest:i};case"memory":case"on-demand":return{type:"feature",serviceInfo:e,onMessage:r,outSR:t,origin:function(e){return Array.isArray(e)?"local":"path"in e&&(0,m.M8)(e.path)?"hosted":"unknown"}(e.source),tileInfoView:s,canAcceptRequest:i}}}(e,t,s,r,i,n);switch(o.type){case"feature":switch(o.origin){case"hosted":case"local":return new Ee(o);case"snapshot":return new De(o);case"unknown":return new he(o)}case"geoevent":return new ke(o)}}(this.service,this.spatialReference,e,((e,t)=>(this._invalidated=!0,this._patchTile(e,t))),(()=>this._updateQueue.length<50),this.featureStore),this._proxyEvents()}_proxyEvents(){if("geoevent"===this._source.type){const e=this._source.events;this.handles.add([e.on("connectionStatus",(e=>this.remoteClient.invoke("setProperty",{propertyName:"connectionStatus",value:e}).catch(tt))),e.on("errorString",(e=>this.remoteClient.invoke("setProperty",{propertyName:"errorString",value:e}).catch(tt))),e.on("feature",(e=>this.remoteClient.invoke("emitEvent",{name:"data-received",event:{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry}}).catch(tt))),e.on("updateRate",(e=>this.remoteClient.invoke("emitEvent",{name:"update-rate",event:{...e}}).catch(tt)))])}}_initAttributeStore(){this.attributeStore?this.attributeStore.invalidateResources():this.attributeStore=new Ne.ZP({type:"remote",initialize:(e,t)=>(0,u.R8)(this.remoteClient.invoke("tileRenderer.featuresView.attributeView.initialize",e,{signal:t}).catch(tt)),update:(e,t)=>(0,u.R8)(this.remoteClient.invoke("tileRenderer.featuresView.attributeView.requestUpdate",e,{signal:t}).catch(tt)),render:e=>(0,u.R8)(this.remoteClient.invoke("tileRenderer.featuresView.requestRender",void 0,{signal:e}).catch(tt))},this.config)}_initStores(){const e="snapshot"===this.service.type?"snapshot":"on-demand",t={geometryInfo:{geometryType:this.service.geometryType,hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.featureStore=new _.p(t,this._storage,e),this.aggregateStore=new He(t,this.spatialReference,this._storage),this.handles.add(this.aggregateStore.events.on("valueRangesChanged",(e=>{this.remoteClient.invoke("emitEvent",{name:"valueRangesChanged",event:{valueRanges:e.valueRanges}}).catch(tt)})))}_initQueryEngine(){var e;const t=this;null==(e=this.queryEngine)||e.destroy(),this.queryEngine=new g.Z({definitionExpression:this.config.definitionExpression,fields:this.service.fields,geometryType:this.service.geometryType,objectIdField:this.service.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!0,featureStore:this.featureStore,aggregateAdapter:{getFeatureObjectIds:e=>t.aggregateStore.getFeatureDisplayIdsForAggregate(e).map((e=>t.getObjectId(e)))},timeInfo:this.service.timeInfo})}destroy(){this._updateQueue.destroy(),this._source.destroy(),this.queryEngine.destroy(),this.attributeStore&&this.attributeStore.destroy(),clearInterval(this._checkUpdating)}get fieldsIndex(){return new f.Z(this.service.fields)}get hasAggregates(){return!!this.config.schema.targets.aggregate}get spatialReference(){return this.tileStore.tileScheme.spatialReference}get updating(){return this.isUpdating()}isUpdating(){return this._source.updating||!!this._updateQueue.length}enableEvent(e){this._source.enableEvent(e.name,e.value)}pause(){this._updateQueue.pause(),this._updateQueue.clear()}async update(e,t){this._set("config",t),this._schema=t.schema,this._initQueryEngine(),await Promise.all([this._source.update(e,t.schema.source),this.featureStore.updateSchema(e,t.schema.targets.feature),this.attributeStore.update(e,t),this.attributeStore.updateFilters(e,this)]),await this.aggregateStore.updateSchema(e,t.schema.targets.aggregate),(0,n.Z)("esri-2d-update-debug")&&e.describe()}async applyUpdate(e){e.mesh&&this.clearTiles(),this._updateQueue.resume(),await this._source.applyUpdate(e),this.notifyChange("updating"),await(0,d.OY)(this,"updating",!0),this.hasAggregates&&(await(0,u.e4)(10),await(0,d.OY)(this,"updating",!0))}async onEdits({edits:e}){(0,n.Z)("esri-2d-update-debug")&&console.debug("Applying Edit:",e),this._didEdit=!0;try{const t=e.removed.map((e=>e.objectId&&-1!==e.objectId?e.objectId:this._lookupObjectIdByGlobalId(e.globalId))),s=e.addOrModified.map((({objectId:e})=>e));this.featureStore.invalidate(),await this._source.edit(s,t),this.clearTiles(),this.notifyChange("updating"),this.aggregateStore.clear(),await this._source.resend(),await(0,d.OY)(this,"updating",!0)}catch(e){}}async refresh(){this.featureStore.invalidate(),this.clearTiles(),this._source.refresh(),this._cleanupNeeded=!0,this.notifyChange("updating"),await(0,d.OY)(this,"updating",!0)}clearTiles(){for(const e of this.tileStore.tiles)this.processor.onTileClear(e)}onTileUpdate(e){this.aggregateStore.onTileUpdate(e);for(const t of e.added)this._source.subscribe(t),this._level=t.level;for(const t of e.removed)this._source.unsubscribe(t),this._cleanupNeeded=!0,this._tileToResolver.has(t.id)&&(this._tileToResolver.get(t.id).resolve(),this._tileToResolver.delete(t.id));this.notifyChange("updating")}onIdle(){this._invalidated&&((this.hasAggregates||"heatmap"===this.processor.type)&&this._repushCurrentLevelTiles(),this._invalidated=!1),this._markAndSweep()}async querySummaryStatistics({query:e,params:t}){return this.queryEngine.executeQueryForSummaryStatistics(e,t)}queryExtent(e){return this.queryEngine.executeQueryForExtent(e)}queryFeatures(e){return this.queryEngine.executeQuery(e)}queryFeatureCount(e){return this.queryEngine.executeQueryForCount(e)}queryLatestObservations(e){return this.queryEngine.executeQueryForLatestObservations(e)}queryObjectIds(e){return this.queryEngine.executeQueryForIds(e)}async queryStatistics(){return this.featureStore.storeStatistics}getObjectId(e){return this.featureStore.lookupObjectId(e,this._storage)}getDisplayId(e){if(this._schema.targets.aggregate){const t=this.aggregateStore.getDisplayId(e);if((0,c.Wi)(t)){const t=this.featureStore.lookupDisplayId(e);return this.aggregateStore.getDisplayIdForReferenceId(t)}return t}return this.featureStore.lookupDisplayId(e)}getFeature(e){const t=this.featureStore.lookupFeatureByDisplayId(e,this._storage);if((0,c.Wi)(t))return null;const s=t.readHydratedGeometry(),r=(0,p.di)(s,t.geometryType,t.hasZ,t.hasM);return{attributes:t.readAttributes(),geometry:r}}getAggregate(e){return this.aggregateStore.getAggregate(e)}getAggregates(){return this.aggregateStore.getAggregates()}async setHighlight(e){const t=e.map((e=>this.getDisplayId(e)));return this.attributeStore.setHighlight(e,t)}_lookupObjectIdByGlobalId(e){const t=this.service.globalIdField;if((0,c.Wi)(t))throw new Error("Expected globalIdField to be defined");let s=null;if(this.featureStore.forEach((r=>{e===r.readAttribute(t)&&(s=r.getObjectId())})),(0,c.Wi)(s))throw new Error(`Expected to find a feature with globalId ${e}`);return s}_repushCurrentLevelTiles(){const e=this.tileStore.tiles.filter((e=>e.level===this._level));for(const t of e)this._patchTile({type:"append",id:t.key.id,addOrUpdate:T.fromOptimizedFeatures([],this.service.geometryType),remove:[],end:!0,status:ee.empty()})}_maybeForceCleanup(){performance.now()-this._lastCleanup>5e3&&this._markAndSweep()}_patchTile(e,t){const s=this._updateQueue.push(e,t).then((()=>{this.notifyChange("updating")})).catch((e=>{this.notifyChange("updating")}));return this.notifyChange("updating"),s}async _onTileMessage(e,t){(0,u.k_)(t);const s=this.tileStore.get(e.id);if(!s)return;if(e.clear)return this.processor.onTileClear(s);const r=e.status;this._cleanupNeeded=!0;const i=[];for(const t of e.remove){const e=this.featureStore.lookupDisplayId(t);e&&i.push(e)}e.remove=i;try{if((0,c.Wi)(e.addOrUpdate))return void this.processor.onTileMessage(s,{...e,addOrUpdate:null},this.hasAggregates,t).catch(u.H9);if(e.addOrUpdate.setArcadeSpatialReference(this.spatialReference),this.featureStore.hasInstance(e.addOrUpdate.instance)&&r.targets.feature||(r.targets.feature=!0,this.featureStore.onTileData(s,e)),r.storage.data&&r.storage.filters||(r.storage.data=!0,r.storage.filters=!0,this.attributeStore.onTileData(s,e),"geoevent"===this._source.type||this._didEdit?(await this.attributeStore.sendUpdates(),(0,u.k_)(t)):this.attributeStore.sendUpdates()),this.hasAggregates&&!r.targets.aggregate){r.targets.aggregate=!0;const t=st(this._source)&&this._source.loading,i=!st(this._source)||t||e.end;if(this.aggregateStore.onTileData(s,e,this._storage,this.attributeStore,i),!i)return;r.mesh||(this.attributeStore.onTileData(s,e),await this.attributeStore.sendUpdates(),this.processor.onTileClear(s))}r.mesh||(r.mesh=!0,await this.processor.onTileMessage(s,e,this.hasAggregates,t),(0,u.k_)(t)),this._maybeForceCleanup()}catch(e){(0,u.H9)(e)}}_mark(e,t,s){const r=(4294901760&this._storage.getInstanceId(e))>>>16;e&&(t.add(r),s.set(e))}_markAndSweep(){if(this._lastCleanup=performance.now(),"feature"===this._source.type&&"snapshot"===this._source.mode||"geoevent"!==this._source.type&&!this._cleanupNeeded)return;this._cleanupNeeded=!1;const e=this._storage.getBitset(this._markedIdsBufId),t=new Set;e.clear();for(const s of this.tileStore.tiles)for(const r of this._source.readers(s.id)){const s=r.getCursor();for(;s.next();){let r=s.getDisplayId();if(!r){const e=s.getObjectId();r=this.featureStore.lookupDisplayId(e)}this._mark(r,t,e)}}"symbol"===this.processor.type&&this.processor.forEachBufferId((s=>{this._mark(s,t,e)})),this._updateQueue.forEach((s=>{for(const r of s.remove){const s=this.featureStore.lookupDisplayId(r);this._mark(s,t,e)}})),this.config.schema.targets.aggregate&&(this.aggregateStore.sweepFeatures(e,this.featureStore),this.aggregateStore.sweepClusters(this._storage,this.attributeStore,this._level)),this.featureStore.sweepFeatures(e,this._storage,this.attributeStore),this.featureStore.sweepFeatureSets(t)}};(0,r._)([(0,o.Cb)({constructOnly:!0})],rt.prototype,"tileStore",void 0),(0,r._)([(0,o.Cb)()],rt.prototype,"config",void 0),(0,r._)([(0,o.Cb)({readOnly:!0})],rt.prototype,"fieldsIndex",null),(0,r._)([(0,o.Cb)()],rt.prototype,"processor",void 0),(0,r._)([(0,o.Cb)({constructOnly:!0})],rt.prototype,"remoteClient",void 0),(0,r._)([(0,o.Cb)({constructOnly:!0})],rt.prototype,"service",void 0),(0,r._)([(0,o.Cb)()],rt.prototype,"spatialReference",null),(0,r._)([(0,o.Cb)()],rt.prototype,"updating",null),rt=(0,r._)([(0,h.j)("esri.views.2d.layers.features.controllers.FeatureController2D")],rt);var it=rt,nt=s(3651),ot=s(67524),at=s(55415);const ht={added:[],removed:[]},lt=new Set,ct=new at.Z(0,0,0,0);class ut extends Q.Z{constructor(e){super(),this._tiles=new Map,this._index=(0,le.r)(9,(0,n.Z)("csp-restrictions")?e=>({minX:e.bounds[0],minY:e.bounds[1],maxX:e.bounds[2],maxY:e.bounds[3]}):[".bounds[0]",".bounds[1]",".bounds[2]",".bounds[3]"]),this.tiles=[],this.tileScheme=e}destroy(){this.clear()}clear(){this.tiles.length=0,this._tiles.clear(),this._index.clear()}has(e){return this._tiles.has(e)}get(e){return this._tiles.get(e)}boundsIntersections(e){return this._index.search({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]})}updateTiles(e){const t={added:[],removed:[]};for(const s of e.added)if(!this.has(s)){const e=new nt.n(this.tileScheme,s);this._tiles.set(s,e),this._index.insert(e),t.added.push(e)}for(const s of e.removed)if(this.has(s)){const e=this.get(s);this._tiles.delete(s),this._index.remove(e),t.removed.push(e)}this.tiles.length=0,this._tiles.forEach((e=>this.tiles.push(e))),(t.added.length||t.removed.length)&&this.emit("update",t)}setViewState(e){const t=this.tileScheme.getTileCoverage(e,0);if(!t)return;const{spans:s,lodInfo:r}=t,{level:i}=r;if(s.length>0)for(const{row:e,colFrom:t,colTo:n}of s)for(let s=t;s<=n;s++){const t=ct.set(i,e,r.normalizeCol(s),r.getWorldForColumn(s)).id;if(lt.add(t),!this.has(t)){const e=new nt.n(this.tileScheme,t);this._tiles.set(t,e),this._index.insert(e),this.tiles.push(e),ht.added.push(e)}}for(let e=this.tiles.length-1;e>=0;e--){const t=this.tiles[e];lt.has(t.id)||(this._tiles.delete(t.id),this.tiles.splice(e,1),this._index.remove(t),ht.removed.push(t))}(ht.added.length||ht.removed.length)&&this.emit("update",ht),ot.Z.pool.release(t),lt.clear(),ht.added.length=0,ht.removed.length=0}}var dt=s(83068);const pt=new Set;function gt(){return pt}let ft=class extends i.r{constructor(){super(...arguments),this.controller=null,this.processor=null,this.remoteClient=null,this.tileStore=null,this.service=null,this.viewState=null}initialize(){this.handles.add(this.watch("updating",(e=>{this.remoteClient.invoke("setUpdating",e).catch((e=>{}))})))}destroy(){var e,t,s;null==(e=this.controller)||e.destroy(),null==(t=this.processor)||t.destroy(),null==(s=this.tileStore)||s.destroy(),this.controller=this.processor=this.tileStore=this.remoteClient=null}get updating(){return!this.controller||this.controller.updating}async startup({service:e,config:t,tileInfo:s,tiles:r}){if(this.service=e,!this.tileStore){const e=new dt.Z(l.Z.fromJSON(s));this.tileStore=new ut(e)}this.tileStore.clear(),await this._createProcessorAndController(t),await this.update({config:t},!0),this.tileStore.updateTiles(r)}async updateTiles(e){this.tileStore.updateTiles(e)}async update({config:e},t=!1){const s=ee.empty();return t||this.controller.pause(),await Promise.all([this.processor.update(s,e),this.controller.update(s,e)]),s.toJSON()}async applyUpdate(e){return this.controller.applyUpdate(ee.create(e))}async _createProcessorAndController(e){await Promise.all([this._handleControllerConfig(e),this._handleProcessorConfig(e)]),this.controller.processor=this.processor}async _handleControllerConfig(e){const t=await this._createController(this.service,e);return await t.startup(),t}async _handleProcessorConfig(e){return this._createProcessor(this.service,e)}async _createController(e,t){this.controller&&this.controller.destroy();const{tileStore:s,remoteClient:r}=this,i=new it({service:e,config:t,tileStore:s,remoteClient:r});return this.controller=i,i}async _createProcessor(e,t){const r=t.schema.processors[0].type,i=(await function(e){return"heatmap"===e?s.e(2399).then(s.bind(s,12399)):Promise.all([s.e(2812),s.e(3812),s.e(6810),s.e(3117)]).then(s.bind(s,94751))}(r)).default,{remoteClient:n,tileStore:o}=this,a=new i({service:e,config:t,tileStore:o,remoteClient:n});return this.processor&&this.processor.destroy(),this.processor=a,a}};(0,r._)([(0,o.Cb)()],ft.prototype,"controller",void 0),(0,r._)([(0,o.Cb)()],ft.prototype,"processor",void 0),(0,r._)([(0,o.Cb)()],ft.prototype,"updating",null),(0,r._)([(0,o.Cb)()],ft.prototype,"viewState",void 0),ft=(0,r._)([(0,h.j)("esri.views.2d.layers.features.Pipeline")],ft);var _t=ft},59999:(e,t,s)=>{s.d(t,{J:()=>l});var r=s(80442),i=s(70586),n=s(22862),o=s(59266),a=s(92604);const h=s.e(4695).then(s.bind(s,14695));class l{constructor(e,t){this._canCacheExpressionValue=!1,this._sourceInfo=e,this._bitsets={computed:t.getBitset(t.createBitset())}}invalidate(){this._bitsets.computed.clear()}async updateSchema(e,t){const s=(0,n.Hg)(this._schema,t);if(this._schema=t,!t||(0,i.Wi)(s)||!(0,n.uD)(s,"attributes"))return;(0,r.Z)("esri-2d-update-debug")&&console.debug("Applying Update - Store:",s),this._bitsets.computed.clear(),e.targets[t.name]=!0;const o=t.attributes,a=[],h=[];for(const e in o){const t=o[e];switch(t.type){case"field":break;case"expression":a.push(this._createArcadeComputedField(t));break;case"label-expression":a.push(this._createLabelArcadeComputedField(t));break;case"statistic":h.push(t)}}this._computedFields=await Promise.all(a),this._canCacheExpressionValue=!this._computedFields.some((e=>"expression"===e.type&&e.expression.referencesScale())),this._statisticFields=h}setComputedAttributes(e,t,s,r){const i=this._bitsets.computed;if(!this._canCacheExpressionValue||!i.has(s)){i.set(s);for(const i of this._computedFields){const n=this._evaluateField(t,i,r);switch(i.resultType){case"numeric":e.setComputedNumericAtIndex(s,i.fieldIndex,n);break;case"string":e.setComputedStringAtIndex(s,i.fieldIndex,n)}}}}async _createArcadeComputedField(e){const t=this._sourceInfo.spatialReference,s=this._sourceInfo.fieldsIndex;return{...e,expression:await(0,o.Yi)(e.valueExpression,t,s)}}async _createLabelArcadeComputedField(e){const t=this._sourceInfo.spatialReference,s=this._sourceInfo.fieldsIndex,{createLabelFunction:r}=await h,i=await r(e.label,s,t);return{...e,builder:i}}_evaluateField(e,t,s){switch(t.type){case"label-expression":{const s=e.readArcadeFeature();return t.builder.evaluate(s)||""}case"expression":{const{expression:r}=t;return function(e,t,s){e.referencesGeometry();const r=t.readArcadeFeature();try{return e.evaluate({...s,$feature:r})}catch(e){return a.Z.getLogger("esri.views.2d.support.arcadeOnDemand").warn("Feature arcade evaluation failed:",e),null}}(r,e,{$view:{scale:s}})}}}}},20315:(e,t,s)=>{s.d(t,{ZP:()=>v,jL:()=>_,nE:()=>m});var r=s(20102),i=s(80442),n=s(92604),o=s(22021),a=s(70586),h=s(95330),l=s(22862),c=s(99514),u=s(16534),d=s(29996);s(37720),s(66039),s(40660);const p=n.Z.getLogger("esri.views.layers.2d.features.support.AttributeStore"),g=()=>null,f=e=>(2147483648&e)>>>31,_=e=>2147483647&e;function m(e){return 1===f(e)}const y={sharedArrayBuffer:(0,i.Z)("esri-shared-array-buffer"),atomics:(0,i.Z)("esri-atomics")};function b(e,t){return s=>t(e(s))}class I{constructor(e,t,s,r){this.size=0,this.texelSize=4;const{pixelType:i,layout:n,textureOnly:o}=r;this.textureOnly=o||!1,this.pixelType=i,this._ctype=t,this.layout=n,this._resetRange(),this._shared=e,this.size=s,o||(this.data=this._initData(i,s,e,t))}get buffer(){return(0,a.Po)(this.data,(e=>e.buffer))}unsetComponentAllTexels(e,t){const s=(0,a.Wg)(this.data);for(let r=0;r<this.size*this.size;r++)s[r*this.texelSize+e]&=~t;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(e,t){const s=(0,a.Wg)(this.data);for(let r=0;r<this.size*this.size;r++)s[r*this.texelSize+e]|=255&t;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(e,t,s){const r=(0,a.Wg)(this.data);for(const i of s)r[i*this.texelSize+e]|=t,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}setComponentTexel(e,t,s){(0,a.Wg)(this.data)[s*this.texelSize+e]|=t,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)}unsetComponentTexel(e,t,s){(0,a.Wg)(this.data)[s*this.texelSize+e]&=~t,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)}getData(e,t){const s=_(e);return(0,a.Wg)(this.data)[s*this.texelSize+t]}setData(e,t,s){const r=_(e),i=1<<t;0!=(this.layout&i)?(this.data[r*this.texelSize+t]=s,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)):p.error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}lock(){5121===this.pixelType&&this._shared&&y.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,1)}unlock(){5121===this.pixelType&&this._shared&&y.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,0)}expand(e){if(this.size=e,!this.textureOnly){const t=this._initData(this.pixelType,e,this._shared,this._ctype),s=(0,a.Wg)(this.data);t.set(s),this.data=t}}toMessage(){const e=this.dirtyStart,t=this.dirtyEnd,s=this.texelSize;if(e>t)return null;this._resetRange();const r=!(this._shared||"local"===this._ctype),i=this.pixelType,n=this.layout,o=(0,a.Wg)(this.data);return{start:e,end:t,data:r&&o.slice(e*s,(t+1)*s)||null,pixelType:i,layout:n}}_initData(e,t,s,r){const i=s&&"local"!==r?SharedArrayBuffer:ArrayBuffer,n=(0,d.UK)(e),o=new n(new i(t*t*4*n.BYTES_PER_ELEMENT));for(let e=0;e<o.length;e+=4)o[e+1]=255;return o}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class v{constructor(e,t){this._client=e,this.config=t,this._attributeComputeMap=new Map,this._blocks=new Array,this._filters=new Array(u.m4),this._targetType=0,this._abortController=(0,h.yi)(),this._hasScaleExpr=!1,this._size=32,this._idsToHighlight=new Set;const s=t.supportsTextureFloat?5126:5121;g(`Creating AttributeStore ${y.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:5121,layout:1},{pixelType:5121,layout:15,textureOnly:!0},{pixelType:s,layout:15},{pixelType:s,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}destroy(){this._abortController.abort()}get hasScaleExpr(){return this._hasScaleExpr}get _signal(){return this._abortController.signal}update(e,t){this.config=t;const s=t.schema.processors[0].storage,r=(0,l.Hg)(this._schema,s);if((e.targets.feature||e.targets.aggregate)&&(e.storage.data=!0),r&&((0,i.Z)("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:",r),e.storage.data=!0,this._schema=s,this._attributeComputeMap.clear(),!(0,a.Wi)(s))){switch(s.target){case"feature":this._targetType=0;break;case"aggregate":this._targetType=1}if("subtype"===s.type)for(const e in s.mapping){const t=s.mapping[e];if((0,a.pC)(t))for(const e of t.mapping)this._bindAttribute(e)}else for(const e of s.mapping)this._bindAttribute(e)}}onTileData(e,t){if((0,a.Wi)(t.addOrUpdate))return;const s=t.addOrUpdate.getCursor();for(;s.next();){const e=s.getDisplayId();this.setAttributeData(e,s)}}invalidateResources(){this._createResourcesPromise=null,this._abortController.abort(),this._abortController=(0,h.yi)()}async setHighlight(e,t){const s=this._getBlock(0),r=t.map((e=>_(e)));s.lock(),s.unsetComponentAllTexels(0,1),s.setComponent(0,1,r),s.unlock(),this._idsToHighlight.clear();for(const t of e)this._idsToHighlight.add(t);await this.sendUpdates()}async updateFilters(e,t){const{config:s,service:r,spatialReference:n}=t,{filters:o}=s,a=o.map(((e,t)=>this._updateFilter(e,t,r,n)));(await Promise.all(a)).some((e=>e))&&(e.storage.filters=!0,(0,i.Z)("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:","Filters changed"))}setData(e,t,s,r){const i=_(e);this._ensureSizeForTexel(i),this._getBlock(t).setData(e,s,r)}getData(e,t,s){return this._getBlock(t).getData(e,s)}getHighlightFlag(e){return this._idsToHighlight.has(e)?u.uG:0}unsetAttributeData(e){const t=_(e);this._getBlock(0).setData(t,0,0)}setAttributeData(e,t){const s=_(e);if(this._ensureSizeForTexel(s),this._getBlock(0).setData(s,0,this.getFilterFlags(t)),this._targetType!==f(e))return;const r=this._attributeComputeMap,i=this.config.supportsTextureFloat?1:2;r.size&&r.forEach(((e,r)=>{const n=r*i%4,a=Math.floor(r*i/4),h=this._getBlock(a+u.aK),l=e(t);if(this.config.supportsTextureFloat)h.setData(s,n,l);else if(l===u.AI)h.setData(s,n,255),h.setData(s,n+1,255);else{const e=(0,o.uZ)(Math.round(l),-32767,32766)+32768,t=255&e,r=(65280&e)>>8;h.setData(s,n,t),h.setData(s,n+1,r)}}))}sendUpdates(){if(this._nextUpdate)return this._nextUpdate.promise;if(this._currUpdate)return this._nextUpdate=(0,h.hh)(),this._nextUpdate.promise;const e={blocks:this._blocks.map((e=>(0,a.pC)(e)?e.toMessage():null))};return this._currUpdate=this._createResources().then((()=>{const t=()=>{if(this._currUpdate=null,this._nextUpdate){const e=this._nextUpdate;this._nextUpdate=null,this.sendUpdates().then((()=>e.resolve()))}},s=this._client.update(e,this._signal).then(t).catch(t);return this._client.render(this._signal),s})).catch((e=>(0,h.D_)(e)?(this._createResourcesPromise=null,this._createResources()):(p.error(new r.Z("mapview-attribute-store","Encountered an error during client update",e)),Promise.resolve()))),this._currUpdate}_ensureSizeForTexel(e){for(;e>=this._size*this._size;)if(this._expand())return}_bindAttribute(e){let t;if(null!=e.fieldIndex)e.normalizationField&&p.warn("mapview-arcade","Ignoring normalizationField specified with an arcade expression which is not supported."),t=t=>t.getComputedNumericAtIndex(e.fieldIndex);else{if(!e.field)return;t=e.normalizationField?t=>{const s=t.readAttribute(e.normalizationField);return s?t.readAttribute(e.field)/s:null}:t=>t.readAttribute(e.field)}e.valueRepresentation&&(t=b(t,(t=>function(e,t){if(!e||!t)return e;switch(t){case"radius":case"distance":return 2*e;case"diameter":case"width":return e;case"area":return Math.sqrt(e)}return e}(t,e.valueRepresentation)))),this._attributeComputeMap.set(e.binding,b(t,(e=>null===e||isNaN(e)||e===1/0?u.AI:e)))}_createResources(){if((0,a.pC)(this._createResourcesPromise))return this._createResourcesPromise;this._getBlock(u.xl),g("Initializing AttributeStore");const e={shared:y.sharedArrayBuffer&&!("local"===this._client.type),size:this._size,blocks:(0,a.Fd)(this._blocks,(e=>({textureOnly:e.textureOnly,buffer:e.buffer,pixelType:e.pixelType})))},t=this._client.initialize(e,this._signal).catch((e=>{(0,h.D_)(e)?this._createResourcesPromise=null:p.error(new r.Z("mapview-attribute-store","Encountered an error during client initialization",e))}));return this._createResourcesPromise=t,t.then((()=>(0,a.Wi)(this._createResourcesPromise)?this._createResources():void 0)),t}_getBlock(e){const t=this._blocks[e];if((0,a.pC)(t))return t;g(`Initializing AttributeBlock at index ${e}`);const s=y.sharedArrayBuffer,r=this._client.type,i=new I(s,r,this._size,this._blockDescriptors[e]);return this._blocks[e]=i,this._createResourcesPromise=null,i}_expand(){if(this._size<this.config.maxTextureSize){const e=this._size<<=1;return g("Expanding block size to",e,this._blocks),(0,a.JR)(this._blocks,(t=>t.expand(e))),this._createResourcesPromise=null,this._size=e,0}return p.error(new r.Z("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}async _updateFilter(e,t,s,r){const i=this._filters[t],n=(0,a.pC)(i)&&i.hash;if(!i&&!e)return!1;if(n===JSON.stringify(e))return!1;if((0,a.Wi)(e)){if(!i)return!1;const e=1<<t+1,s=this._getBlock(0);return this._filters[t]=null,s.setComponentAllTexels(0,e),this.sendUpdates(),!0}const o=await this._getFilter(t,s);return await o.update(e,r),!0}async _getFilter(e,t){const r=this._filters[e];if((0,a.pC)(r))return r;const{default:i}=await s.e(2392).then(s.bind(s,52392)),n=new i({geometryType:t.geometryType,hasM:!1,hasZ:!1,timeInfo:t.timeInfo,fieldsIndex:new c.Z(t.fields)});return this._filters[e]=n,n}isVisible(e){return!!(2&this._getBlock(0).getData(e,0))}getFilterFlags(e){let t=0;const s=(e=>1===f(e)?254:255)(e.getDisplayId());for(let r=0;r<this._filters.length;r++){const i=!!(s&1<<r),n=this._filters[r];t|=(!i||(0,a.Wi)(n)||n.check(e)?1:0)<<r}let r=0;if(this._idsToHighlight.size){const t=e.getObjectId();r=this.getHighlightFlag(t)}return t<<1|r}}},87554:(e,t,s)=>{s.d(t,{s:()=>c}),s(66577),s(80442);var r=s(70586),i=s(29730),n=s(98732),o=s(5428),a=s(93054),h=s(33955);let l=0;class c{constructor(e){this.type="FeatureSetReader",this.seen=!1,this.instance=0,this._tx=0,this._ty=0,this._sx=1,this._sy=1,this._deleted=null,this._joined=[],this._objectIdToIndex=null,this._level=0,this.instance=e}static createInstance(){return l++,l=l>65535?0:l,l}get isEmpty(){return(0,r.pC)(this._deleted)&&this._deleted.countSet()===this.getSize()}set level(e){this._level=e}getAreaSimplificationThreshold(e){let t=0;e>4e3?t=2:e>2e3?t=1:(e>100||e>15)&&(t=.5);let s=8;return this._level<4?s=1:this._level<5?s=2:this._level<6&&(s=4),t*s}setArcadeSpatialReference(e){this._arcadeSpatialReference=e}attachStorage(e){this._storage=e}getQuantizationTransform(){throw new Error("Unable to find transform for featureSet")}getStorage(){return this._storage}getComputedNumeric(e){return this.getComputedNumericAtIndex(0)}setComputedNumeric(e,t){return this.setComputedNumericAtIndex(t,0)}getComputedString(e){return this.getComputedStringAtIndex(0)}setComputedString(e,t){return this.setComputedStringAtIndex(0,t)}getComputedNumericAtIndex(e){return this._storage.getComputedNumericAtIndex(this.getDisplayId(),e)}setComputedNumericAtIndex(e,t){this._storage.setComputedNumericAtIndex(this.getDisplayId(),e,t)}getComputedStringAtIndex(e){return this._storage.getComputedStringAtIndex(this.getDisplayId(),e)}setComputedStringAtIndex(e,t){return this._storage.setComputedStringAtIndex(this.getDisplayId(),e,t)}transform(e,t,s,r){const i=this.copy();return i._tx+=e,i._ty+=t,i._sx*=s,i._sy*=r,i}readAttribute(e,t=!1){const s=this._readAttribute(e,t);if(void 0!==s)return s;for(const s of this._joined){s.setIndex(this.getIndex());const r=s._readAttribute(e,t);if(void 0!==r)return r}}readAttributes(){const e=this._readAttributes();for(const t of this._joined){t.setIndex(this.getIndex());const s=t._readAttributes();for(const t of Object.keys(s))e[t]=s[t]}return e}joinAttributes(e){this._joined.push(e)}readArcadeFeature(){return this}geometry(){const e=this.readHydratedGeometry(),t=(0,n.di)(e,this.geometryType,this.hasZ,this.hasM),s=(0,h.im)(t);return s&&(s.spatialReference=this._arcadeSpatialReference),s}field(e){return this.readAttribute(e,!0)}hasField(e){return!0}setField(e,t){}keys(){return[]}castToText(){return""}removeIds(e){if((0,r.Wi)(this._objectIdToIndex)){const e=new Map,t=this.getCursor();for(;t.next();)e.set(t.getObjectId(),t.getIndex());this._objectIdToIndex=e}const t=this._objectIdToIndex;for(const s of e)t.has(s)&&this.removeAtIndex(t.get(s))}removeAtIndex(e){(0,r.Wi)(this._deleted)&&(this._deleted=a.p.create(this.getSize())),this._deleted.set(e)}readGeometryForDisplay(){return this.readUnquantizedGeometry(!0)}readLegacyGeometryForDisplay(){return this.readLegacyGeometry(!0)}*features(){const e=this.getCursor();for(;e.next();)yield e.readOptimizedFeature()}_getExists(){return(0,r.Wi)(this._deleted)||!this._deleted.has(this.getIndex())}_computeCentroid(){if("esriGeometryPolygon"!==this.geometryType)return null;const e=this.readUnquantizedGeometry();if(!e||e.hasIndeterminateRingOrder)return null;const t=(0,r.Pt)(this.getQuantizationTransform(),null);return(0,i.Y)(new o.Z,e,this.hasM,this.hasZ,t)}copyInto(e){e.seen=this.seen,e._storage=this._storage,e._arcadeSpatialReference=this._arcadeSpatialReference,e._joined=this._joined,e._tx=this._tx,e._ty=this._ty,e._sx=this._sx,e._sy=this._sy,e._deleted=this._deleted,e._objectIdToIndex=this._objectIdToIndex}}},61800:(e,t,s)=>{s.d(t,{t:()=>i});var r=s(87554);class i extends r.s{constructor(e,t){super(r.s.createInstance()),this._currentIndex=-1,this._reader=e,this._indices=t}static from(e,t){return new i(e.copy(),t)}get hasNext(){return this._currentIndex+1<this._indices.length}getSize(){return this._indices.length}getCursor(){return this.copy()}copy(){const e=new i(this._reader.copy(),this._indices);return e._currentIndex=this._currentIndex,e}next(){for(;this._nextIndex()&&!this._reader._getExists(););return this._currentIndex<this._indices.length}_nextIndex(){return++this._currentIndex<this._indices.length&&(this._reader.setIndex(this._indices[this._currentIndex]),!0)}setArcadeSpatialReference(e){this._reader.setArcadeSpatialReference(e)}attachStorage(e){this._reader.attachStorage(e)}get geometryType(){return this._reader.geometryType}get hasFeatures(){return this._reader.hasFeatures}get exceededTransferLimit(){return this._reader.exceededTransferLimit}get hasZ(){return this._reader.hasZ}get hasM(){return this._reader.hasM}getStorage(){return this._reader.getStorage()}getComputedNumeric(e){return this._reader.getComputedNumericAtIndex(0)}setComputedNumeric(e,t){return this._reader.setComputedNumericAtIndex(t,0)}getComputedString(e){return this._reader.getComputedStringAtIndex(0)}setComputedString(e,t){return this._reader.setComputedStringAtIndex(0,t)}getComputedNumericAtIndex(e){return this._reader.getComputedNumericAtIndex(e)}setComputedNumericAtIndex(e,t){this._reader.setComputedNumericAtIndex(e,t)}getComputedStringAtIndex(e){return this._reader.getComputedStringAtIndex(e)}setComputedStringAtIndex(e,t){return this._reader.setComputedStringAtIndex(e,t)}transform(e,t,s,r){const i=this.copy();return i._reader=this._reader.transform(e,t,s,r),i}readAttribute(e,t=!1){return this._reader.readAttribute(e,t)}readAttributes(){return this._reader.readAttributes()}joinAttributes(e){return this._reader.joinAttributes(e)}readArcadeFeature(){return this._reader.readArcadeFeature()}geometry(){return this._reader.geometry()}field(e){return this.readAttribute(e,!0)}hasField(e){return this._reader.hasField(e)}setField(e,t){return this._reader.setField(e,t)}keys(){return this._reader.keys()}castToText(){return this._reader.castToText()}getQuantizationTransform(){return this._reader.getQuantizationTransform()}getAttributeHash(){return this._reader.getAttributeHash()}getObjectId(){return this._reader.getObjectId()}getDisplayId(){return this._reader.getDisplayId()}setDisplayId(e){return this._reader.setDisplayId(e)}getGroupId(){return this._reader.getGroupId()}setGroupId(e){return this._reader.setGroupId(e)}getXHydrated(){return this._reader.getXHydrated()}getYHydrated(){return this._reader.getYHydrated()}getX(){return this._reader.getX()}getY(){return this._reader.getY()}setIndex(e){return this._reader.setIndex(e)}getIndex(){return this._reader.getIndex()}readLegacyFeature(){return this._reader.readLegacyFeature()}readOptimizedFeature(){return this._reader.readOptimizedFeature()}readLegacyPointGeometry(){return this._reader.readLegacyPointGeometry()}readLegacyGeometry(){return this._reader.readLegacyGeometry()}readLegacyCentroid(){return this._reader.readLegacyCentroid()}readGeometryArea(){return this._reader.readGeometryArea()}readUnquantizedGeometry(){return this._reader.readUnquantizedGeometry()}readHydratedGeometry(){return this._reader.readHydratedGeometry()}readGeometry(){return this._reader.readGeometry()}readCentroid(){return this._reader.readCentroid()}_readAttribute(e,t){throw new Error("Error: Should not be called. Underlying _reader should be used instead")}_readAttributes(){throw new Error("Error: Should not be called. Underlying _reader should be used instead")}}},93054:(e,t,s)=>{s.d(t,{p:()=>r});class r{constructor(e,t){this._mask=0,this._buf=e,this._mask=t}static fromBuffer(e,t){return new r(e,t)}static create(e,t=4294967295){const s=new Uint32Array(Math.ceil(e/32));return new r(s,t)}_getIndex(e){return Math.floor(e/32)}has(e){const t=this._mask&e;return!!(this._buf[this._getIndex(t)]&1<<t%32)}hasRange(e,t){let s=e,r=t;for(;s%32&&s!==r;){if(this.has(s))return!0;s++}for(;r%32&&s!==r;){if(this.has(s))return!0;r--}if(s===r)return!1;for(let e=s/32;e!==r/32;e++)if(this._buf[e])return!0;return!1}set(e){const t=this._mask&e,s=this._getIndex(t),r=1<<t%32;this._buf[s]|=r}setRange(e,t){let s=e,r=t;for(;s%32&&s!==r;)this.set(s++);for(;r%32&&s!==r;)this.set(r--);if(s!==r)for(let e=s/32;e!==r/32;e++)this._buf[e]=4294967295}unset(e){const t=this._mask&e,s=this._getIndex(t),r=1<<t%32;this._buf[s]&=4294967295^r}resize(e){const t=this._buf,s=new Uint32Array(Math.ceil(e/32));s.set(t),this._buf=s}or(e){for(let t=0;t<this._buf.length;t++)this._buf[t]|=e._buf[t];return this}and(e){for(let t=0;t<this._buf.length;t++)this._buf[t]&=e._buf[t];return this}xor(e){for(let t=0;t<this._buf.length;t++)this._buf[t]^=e._buf[t];return this}ior(e){for(let t=0;t<this._buf.length;t++)this._buf[t]|=~e._buf[t];return this}iand(e){for(let t=0;t<this._buf.length;t++)this._buf[t]&=~e._buf[t];return this}ixor(e){for(let t=0;t<this._buf.length;t++)this._buf[t]^=~e._buf[t];return this}any(){for(let e=0;e<this._buf.length;e++)if(this._buf[e])return!0;return!1}copy(e){for(let t=0;t<this._buf.length;t++)this._buf[t]=e._buf[t];return this}clone(){return new r(this._buf.slice(),this._mask)}clear(){for(let e=0;e<this._buf.length;e++)this._buf[e]=0}forEachSet(e){for(let t=0;t<this._buf.length;t++){let s=this._buf[t],r=32*t;if(s)for(;s;)1&s&&e(r),s>>>=1,r++}}countSet(){let e=0;return this.forEachSet((t=>{e++})),e}}},3651:(e,t,s)=>{s.d(t,{n:()=>h});var r=s(3894),i=s(6570),n=s(24470),o=s(6388),a=s(55415);class h{constructor(e,t){this.key=new a.Z(0,0,0,0),this.bounds=(0,n.Ue)(),this.objectIds=new Set,this.key.set(t);const s=e.getLODInfoAt(this.key);this.tileInfoView=e,this.tileInfoView.getTileBounds(this.bounds,this.key,!0),this.resolution=s.resolution,this.scale=s.scale,this.level=s.level}get id(){return this.key.id}get extent(){return i.Z.fromBounds(this.bounds,this.tileInfoView.tileInfo.spatialReference)}get transform(){return{originPosition:"upperLeft",scale:[this.resolution,this.resolution],translate:[this.bounds[0],this.bounds[3]]}}createChildTiles(){const e=this.key.getChildKeys(),t=r.Z.acquire();for(let s=0;s<e.length;s++)t[s]=new h(this.tileInfoView,e[s]);return t}getQuantizationParameters(){return o.Z.fromJSON({mode:"view",originPosition:"upperLeft",tolerance:this.resolution,extent:{xmin:this.bounds[0],ymin:this.bounds[1],xmax:this.bounds[2],ymax:this.bounds[3],spatialReference:this.tileInfoView.tileInfo.spatialReference}})}}},67524:(e,t,s)=>{s.d(t,{Z:()=>i});var r=s(71143);class i{constructor(){this.spans=[]}acquire(e){this.lodInfo=e}release(){this.lodInfo=null,this.spans.length=0}forEach(e,t){const{spans:s,lodInfo:r}=this,{level:i}=r;if(0!==s.length)for(const{row:n,colFrom:o,colTo:a}of s)for(let s=o;s<=a;s++)e.call(t,i,n,r.normalizeCol(s),r.getWorldForColumn(s))}}i.pool=new r.Z(i)},83068:(e,t,s)=>{s.d(t,{Z:()=>g});var r=s(8744),i=s(55415);function n(e,t){return[e,t]}function o(e,t,s){return e[0]=t,e[1]=s,e}const a=new i.Z("0/0/0/0");class h{constructor(e,t,s,r,i,n,o,a,h,l,c,u){this.level=e,this.resolution=t,this.scale=s,this.origin=r,this.first=i,this.last=n,this.size=o,this.norm=a,this.worldStart=h,this.worldEnd=l,this.worldSize=c,this.wrap=u}static create(e,t,s){const i=(0,r.C5)(e.spatialReference),a=n(e.origin.x,e.origin.y),l=n(e.size[0]*t.resolution,e.size[1]*t.resolution),c=n(-1/0,-1/0),u=n(1/0,1/0),d=n(1/0,1/0);s&&(o(c,Math.max(0,Math.floor((s.xmin-a[0])/l[0])),Math.max(0,Math.floor((a[1]-s.ymax)/l[1]))),o(u,Math.max(0,Math.floor((s.xmax-a[0])/l[0])),Math.max(0,Math.floor((a[1]-s.ymin)/l[1]))),o(d,u[0]-c[0]+1,u[1]-c[1]+1));const{cols:p,rows:g}=t;let f,_,m,y;return!s&&p&&g&&(o(c,0,0),o(u,p-1,g-1),o(d,p,g)),e.isWrappable?(f=n(Math.ceil(Math.round((i.valid[1]-i.valid[0])/t.resolution)/e.size[0]),d[1]),_=n(Math.floor((i.origin[0]-a[0])/l[0]),c[1]),m=n(f[0]+_[0]-1,u[1]),y=!0):(_=c,m=u,f=d,y=!1),new h(t.level,t.resolution,t.scale,a,c,u,d,l,_,m,f,y)}normalizeCol(e){if(!this.wrap)return e;const t=this.worldSize[0];return e<0?t-1-Math.abs((e+1)%t):e%t}denormalizeCol(e,t){return this.wrap?this.worldSize[0]*t+e:e}getWorldForColumn(e){return this.wrap?Math.floor(e/this.worldSize[0]):0}getFirstColumnForWorld(e){return e*this.worldSize[0]+this.first[0]}getLastColumnForWorld(e){return e*this.worldSize[0]+this.first[0]+this.size[0]-1}getColumnForX(e){return(e-this.origin[0])/this.norm[0]}getXForColumn(e){return this.origin[0]+e*this.norm[0]}getRowForY(e){return(this.origin[1]-e)/this.norm[1]}getYForRow(e){return this.origin[1]-e*this.norm[1]}getTileBounds(e,t,s=!1){a.set(t);const r=s?a.col:this.denormalizeCol(a.col,a.world),i=a.row;return function(e,t,s,r,i){e[0]=t,e[1]=s,e[2]=r,e[3]=i}(e,this.getXForColumn(r),this.getYForRow(i+1),this.getXForColumn(r+1),this.getYForRow(i)),e}getTileCoords(e,t,s=!1){a.set(t);const r=s?a.col:this.denormalizeCol(a.col,a.world);return Array.isArray(e)?o(e,this.getXForColumn(r),this.getYForRow(a.row)):(e.x=this.getXForColumn(r),e.y=this.getYForRow(a.row)),e}}var l=s(67524);class c{constructor(e,t,s){this.row=e,this.colFrom=t,this.colTo=s}}const u=new i.Z("0/0/0/0");class d{constructor(e,t,s,r,i,n,o,a){this.x=e,this.ymin=t,this.ymax=s,this.invM=r,this.leftAdjust=i,this.rightAdjust=n,this.leftBound=o,this.rightBound=a}static create(e,t){e[1]>t[1]&&([e,t]=[t,e]);const[s,r]=e,[i,n]=t,o=i-s,a=n-r,h=0!==a?o/a:0,l=(Math.ceil(r)-r)*h,c=(Math.floor(r)-r)*h;return new d(s,Math.floor(r),Math.ceil(n),h,o<0?l:c,o<0?c:l,o<0?i:s,o<0?s:i)}incrRow(){this.x+=this.invM}getLeftCol(){return Math.max(this.x+this.leftAdjust,this.leftBound)}getRightCol(){return Math.min(this.x+this.rightAdjust,this.rightBound)}}const p=[[0,0],[0,0],[0,0],[0,0]];class g{constructor(e,t){this.tileInfo=e,this.fullExtent=t,this.scales=[],this._lodInfos=null,this._infoByScale={},this._infoByLevel={};const s=e.lods.slice();s.sort((function(e,t){return t.scale-e.scale}));const r=this._lodInfos=s.map((s=>h.create(e,s,t)));s.forEach(((e,t)=>{this._infoByLevel[e.level]=r[t],this._infoByScale[e.scale]=r[t],this.scales[t]=e.scale}),this),this._wrap=e.isWrappable}get spatialReference(){return this.tileInfo.spatialReference}getLODInfoAt(e){return this._infoByLevel["number"==typeof e?e:e.level]}getTileBounds(e,t,s=!1){u.set(t);const r=this._infoByLevel[u.level];return r?r.getTileBounds(e,u,s):e}getTileCoords(e,t,s=!1){u.set(t);const r=this._infoByLevel[u.level];return r?r.getTileCoords(e,u,s):e}getTileCoverage(e,t=192,s="closest"){const r="closest"===s?this.getClosestInfoForScale(e.scale):this.getSmallestInfoForScale(e.scale),i=l.Z.pool.acquire(r),n=this._wrap;let o,a,h,u=1/0,g=-1/0;const f=i.spans;p[0][0]=p[0][1]=p[1][1]=p[3][0]=-t,p[1][0]=p[2][0]=e.size[0]+t,p[2][1]=p[3][1]=e.size[1]+t;for(const t of p)e.toMap(t,t),t[0]=r.getColumnForX(t[0]),t[1]=r.getRowForY(t[1]);const _=[];let m=3;for(let e=0;e<4;e++){if(p[e][1]===p[m][1]){m=e;continue}const t=d.create(p[e],p[m]);u=Math.min(t.ymin,u),g=Math.max(t.ymax,g),void 0===_[t.ymin]&&(_[t.ymin]=[]),_[t.ymin].push(t),m=e}if(null==u||null==g||g-u>100)return null;let y=[];for(o=u;o<g;){null!=_[o]&&(y=y.concat(_[o])),a=1/0,h=-1/0;for(let e=y.length-1;e>=0;e--){const t=y[e];a=Math.min(a,t.getLeftCol()),h=Math.max(h,t.getRightCol())}if(a=Math.floor(a),h=Math.floor(h),o>=r.first[1]&&o<=r.last[1])if(n)if(r.size[0]<r.worldSize[0]){const e=Math.floor(h/r.worldSize[0]);for(let t=Math.floor(a/r.worldSize[0]);t<=e;t++)f.push(new c(o,Math.max(r.getFirstColumnForWorld(t),a),Math.min(r.getLastColumnForWorld(t),h)))}else f.push(new c(o,a,h));else a>r.last[0]||h<r.first[0]||(a=Math.max(a,r.first[0]),h=Math.min(h,r.last[0]),f.push(new c(o,a,h)));o+=1;for(let e=y.length-1;e>=0;e--){const t=y[e];t.ymax>=o?t.incrRow():y.splice(e,1)}}return i}getTileParentId(e){u.set(e);const t=this._infoByLevel[u.level],s=this._lodInfos.indexOf(t)-1;return s<0?null:(this._getTileIdAtLOD(u,this._lodInfos[s],u),u.id)}getTileResolution(e){const t=this._infoByLevel["object"==typeof e?e.level:e];return t?t.resolution:-1}getTileScale(e){const t=this._infoByLevel[e.level];return t?t.scale:-1}intersects(e,t){u.set(t);const s=this._infoByLevel[u.level],r=e.lodInfo;if(r.resolution>s.resolution){this._getTileIdAtLOD(u,r,u);const t=r.denormalizeCol(u.col,u.world);for(const s of e.spans)if(s.row===u.row&&s.colFrom<=t&&s.colTo>=t)return!0}if(r.resolution<s.resolution){const[t,i,n,o]=e.spans.reduce(((e,t)=>(e[0]=Math.min(e[0],t.row),e[1]=Math.max(e[1],t.row),e[2]=Math.min(e[2],t.colFrom),e[3]=Math.max(e[3],t.colTo),e)),[1/0,-1/0,1/0,-1/0]),a=s.denormalizeCol(u.col,u.world),h=r.getColumnForX(s.getXForColumn(a)),l=r.getRowForY(s.getYForRow(u.row)),c=r.getColumnForX(s.getXForColumn(a+1))-1,d=r.getRowForY(s.getYForRow(u.row+1))-1;return!(h>o||c<n||l>i||d<t)}const i=r.denormalizeCol(u.col,u.world);return e.spans.some((e=>e.row===u.row&&e.colFrom<=i&&e.colTo>=i))}normalizeBounds(e,t,s){if(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],this._wrap){const t=(0,r.C5)(this.tileInfo.spatialReference),i=-s*(t.valid[1]-t.valid[0]);e[0]+=i,e[2]+=i}return e}getSmallestInfoForScale(e){const t=this.scales;if(this._infoByScale[e])return this._infoByScale[e];if(e>t[0])return this._infoByScale[t[0]];for(let s=1;s<t.length-1;s++)if(e>t[s]+1e-6)return this._infoByScale[t[s-1]];return this._infoByScale[t[t.length-1]]}getClosestInfoForScale(e){const t=this.scales;return this._infoByScale[e]||(e=t.reduce(((t,s)=>Math.abs(s-e)<Math.abs(t-e)?s:t),t[0])),this._infoByScale[e]}scaleToLevel(e){const t=this.scales;if(this._infoByScale[e])return this._infoByScale[e].level;for(let s=t.length-1;s>=0;s--)if(e<t[s])return s===t.length-1?this._infoByScale[t[t.length-1]].level:this._infoByScale[t[s]].level+(t[s]-e)/(t[s]-t[s+1]);return this._infoByScale[t[0]].level}scaleToZoom(e){return this.tileInfo.scaleToZoom(e)}_getTileIdAtLOD(e,t,s){const r=this._infoByLevel[s.level];return e.set(s),t.resolution<r.resolution?null:(t.resolution===r.resolution||(e.level=t.level,e.col=Math.floor(s.col*r.resolution/t.resolution+.01),e.row=Math.floor(s.row*r.resolution/t.resolution+.01)),e)}}},55415:(e,t,s)=>{s.d(t,{Z:()=>i});var r=s(71143);class i{constructor(e,t,s,r){this.set(e,t,s,r)}static getId(e,t,s,r){return"object"==typeof e?`${e.level}/${e.row}/${e.col}/${e.world}`:`${e}/${t}/${s}/${r}`}get key(){return this}get id(){return this.toString()}set id(e){this.set(e)}get hash(){const e=4095&this.row,t=4095&this.col,s=63&this.level;return(3&this.world)<<30|t<<22|e<<8|s}acquire(e,t,s,r){this.set(e,t,s,r)}contains(e){const t=e.level-this.level;return this.row===e.row>>t&&this.col===e.col>>t&&this.world===e.world}equals(e){return this.level===e.level&&this.row===e.row&&this.col===e.col&&this.world===e.world}clone(){return new i(this)}release(){this.level=0,this.row=0,this.col=0,this.world=0}set(e,t,s,r){if(null==e)this.level=0,this.row=0,this.col=0,this.world=0;else if("object"==typeof e)this.level=e.level||0,this.row=e.row||0,this.col=e.col||0,this.world=e.world||0;else if("string"==typeof e){const[t,s,r,i]=e.split("/");this.level=parseFloat(t),this.row=parseFloat(s),this.col=parseFloat(r),this.world=parseFloat(i)}else this.level=+e,this.row=+t,this.col=+s,this.world=+r||0;return this}toString(){return`${this.level}/${this.row}/${this.col}/${this.world}`}getParentKey(){return this.level<=0?null:new i(this.level-1,this.row>>1,this.col>>1,this.world)}getChildKeys(){const e=this.level+1,t=this.row<<1,s=this.col<<1,r=this.world;return[new i(e,t,s,r),new i(e,t,s+1,r),new i(e,t+1,s,r),new i(e,t+1,s+1,r)]}compareRowMajor(e){return this.row<e.row?-1:this.row>e.row?1:this.col<e.col?-1:this.col>e.col?1:0}}i.pool=new r.Z(i,null,null,25,50)},34084:(e,t,s)=>{s.d(t,{e:()=>h});var r=s(70586),i=s(95330);class n{constructor(e=(e=>e.values().next().value)){this._peeker=e,this._items=new Set}get length(){return this._items.size}clear(){this._items.clear()}last(){if(0===this._items.size)return;let e;for(e of this._items);return e}peek(){if(0!==this._items.size)return this._peeker(this._items)}push(e){this.contains(e)||this._items.add(e)}contains(e){return this._items.has(e)}pop(){if(0===this.length)return;const e=this.peek();return this._items.delete((0,r.j0)(e)),e}popLast(){if(0===this.length)return;const e=this.last();return this._items.delete((0,r.j0)(e)),e}remove(e){this._items.delete(e)}filter(e){return this._items.forEach((t=>{e(t)||this._items.delete(t)})),this}}var o=s(90584);class a{constructor(e,t){this.item=e,this.controller=t,this.promise=null}}class h{constructor(e){this._deferreds=new Map,this._controllers=new Map,this._processingItems=new Map,this._isPaused=!1,this._schedule=null,this._task=null,this.concurrency=1,e.concurrency&&(this.concurrency=e.concurrency),this._queue=new n(e.peeker),this.process=e.process;const t=e.scheduler;e.priority&&(0,r.pC)(t)&&(this._task=t.registerTask(e.priority,this))}destroy(){this.clear(),this._schedule&&(this._schedule.remove(),this._schedule=null),this._task&&(this._task.remove(),this._task=null)}get length(){return this._processingItems.size+this._queue.length}abort(e){const t=this._controllers.get(e);t&&t.abort()}clear(){this._queue.clear();const e=[];this._controllers.forEach((t=>e.push(t))),this._controllers.clear(),e.forEach((e=>e.abort())),this._processingItems.clear(),this._cancelNext()}forEach(e){this._deferreds.forEach(((t,s)=>e(s)))}get(e){const t=this._deferreds.get(e);return t?t.promise:void 0}isOngoing(e){return this._processingItems.has(e)}has(e){return this._deferreds.has(e)}pause(){this._isPaused||(this._isPaused=!0,this._cancelNext())}push(e,t){const s=this.get(e);if(s)return s;const n=(0,i.yi)();let o=null;t&&(o=(0,i.fu)(t,(()=>n.abort())));const a=()=>{h.remove(),(0,r.pC)(o)&&o.remove(),this._deferreds.delete(e),this._controllers.delete(e),this._queue.remove(e),this._processingItems.delete(e),this._scheduleNext()},h=(0,i.$F)(n.signal,(()=>{const t=this._processingItems.get(e);t&&t.controller.abort(),a(),l.reject((0,i.zE)())})),l=(0,i.dD)();return this._deferreds.set(e,l),this._controllers.set(e,n),l.promise.then(a,a),this._queue.push(e),this._scheduleNext(),l.promise}last(){return this._queue.last()}peek(){return this._queue.peek()}popLast(){return this._queue.popLast()}reset(){const e=[];this._processingItems.forEach((t=>e.push(t))),this._processingItems.clear();for(const t of e)this._queue.push(t.item),t.controller.abort();this._scheduleNext()}resume(){this._isPaused&&(this._isPaused=!1,this._scheduleNext())}takeAll(){const e=[];for(;this._queue.length;)e.push(this._queue.pop());return this.clear(),e}get running(){return!this._isPaused&&this._queue.length>0&&this._processingItems.size<this.concurrency}runTask(e){for(;!e.done&&this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop()),e.madeProgress()}_scheduleNext(){this._task||this._isPaused||this._schedule||(this._schedule=(0,o.Os)((()=>{this._schedule=null,this._next()})))}_next(){for(;this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop())}_cancelNext(){this._schedule&&(this._schedule.remove(),this._schedule=null)}_processResult(e,t){this._canProcessFulfillment(e)&&(this._scheduleNext(),this._deferreds.get(e.item).resolve(t))}_processError(e,t){this._canProcessFulfillment(e)&&(this._scheduleNext(),this._deferreds.get(e.item).reject(t))}_canProcessFulfillment(e){return!!this._deferreds.get(e.item)&&this._processingItems.get(e.item)===e}_process(e){if((0,r.Wi)(e))return;let t;const s=(0,i.yi)(),n=new a(e,s);this._processingItems.set(e,n);try{t=this.process(e,s.signal)}catch(e){this._processError(n,e)}(0,i.y8)(t)?(n.promise=t,t.then((e=>this._processResult(n,e)),(e=>this._processError(n,e)))):this._processResult(n,t)}get test(){return{update:e=>this.runTask(e)}}}},89749:(e,t,s)=>{s.d(t,{t:()=>p});var r=s(43697),i=s(18855),n=s(61247),o=s(70586),a=s(90584),h=s(43050),l=s(67723),c=s(87538),u=s(5600),d=s(52525);let p=class extends i.Z{constructor(){super(...arguments),this.updating=!1,this.handleId=0,this.handles=new n.Z,this.scheduleHandleId=0,this.pendingPromises=new Set}destroy(){this.removeAll(),this.handles.destroy()}add(e,t,s,r=0){const i=0!=(1&r),n=++this.handleId;i||this.installSyncUpdatingWatch(e,t,n);const o=0!=(2&r)?(0,h.S1)(e,t,s,i):e.watch(t,s,i);return this.handles.add(o,n),{remove:()=>this.handles.remove(n)}}addOnCollectionPropertyChange(e,t,s,r=0){const i=0!=(2&r),n=++this.handleId;return this.handles.add([(0,h.on)(e,t,"after-changes",this.createSyncUpdatingCallback()),(0,h.on)(e,t,"change",s,i?e=>{s({added:e.items,removed:[],moved:[],target:e})}:void 0)],n),{remove:()=>{this.handles.remove(n)}}}addOnCollectionChange(e,t,s=0){const r=0!=(2&s),i=++this.handleId;return this.handles.add([e.on("after-changes",this.createSyncUpdatingCallback()),e.on("change",t)],i),r&&t({added:e.items,removed:[],moved:[],target:e}),{remove:()=>{this.handles.remove(i)}}}addPromise(e){if((0,o.Wi)(e))return e;const t=++this.handleId;this.handles.add({remove:()=>{this.pendingPromises.delete(e)&&(0!==this.pendingPromises.size||this.handles.has(g)||this._set("updating",!1))}},t),this.pendingPromises.add(e),this._set("updating",!0);const s=()=>this.handles.remove(t);return e.then(s,s),e}removeAll(){this.pendingPromises.clear(),this.handles.removeAll(),this._set("updating",!1)}installSyncUpdatingWatch(e,t,s){const r=this.createSyncUpdatingCallback(),i=(0,c.U5)((()=>(0,l.$z)(e,t)),r);return this.handles.add(i,s),i}createSyncUpdatingCallback(){return()=>{this.handles.remove(g),++this.scheduleHandleId;const e=this.scheduleHandleId;this._get("updating")||this._set("updating",!0),this.handles.add((0,a.Os)((()=>{e===this.scheduleHandleId&&(this._set("updating",this.pendingPromises.size>0),this.handles.remove(g))})),g)}}};(0,r._)([(0,u.Cb)({readOnly:!0})],p.prototype,"updating",void 0),p=(0,r._)([(0,d.j)("esri.views.support.WatchUpdatingTracking")],p);const g=-42},75656:(e,t,s)=>{s.d(t,{Z:()=>h});var r=s(22021),i=s(70586),n=s(49300),o=s(35371),a=s(46314);class h{constructor(e,t,s=null){this._context=e,this.type="texture",this._glName=null,this._descriptor=void 0,this._samplingModeDirty=!1,this._wrapModeDirty=!1,e.instanceCounter.increment(o._g.Texture,this),this._descriptor={target:3553,samplingMode:9729,wrapMode:10497,flipped:!1,hasMipmap:!1,isOpaque:!1,unpackAlignment:4,preMultiplyAlpha:!1,...t},34067===this._descriptor.target?this.setDataCubeMap(s):this.setData(s)}get glName(){return this._glName}get descriptor(){return this._descriptor}dispose(){this._context.gl&&this._glName&&(this._context.unbindTextureAllUnits(this),this._context.gl.deleteTexture(this._glName),this._glName=null,this._context.instanceCounter.decrement(o._g.Texture,this))}release(){this.dispose()}resize(e,t){const s=this._descriptor;s.width===e&&s.height===t||(s.width=e,s.height=t,34067===this._descriptor.target?this.setDataCubeMap(null):this.setData(null))}setDataCubeMap(e=null){for(let t=34069;t<=34074;t++)this.setData(e,t)}setData(e,t=3553){if(!this._context||!this._context.gl)return;const s=this._context.gl;this._glName||(this._glName=s.createTexture()),void 0===e&&(e=null),null===e&&(this._descriptor.width=this._descriptor.width||4,this._descriptor.height=this._descriptor.height||4);const r=this._context.bindTexture(this,h.TEXTURE_UNIT_FOR_UPDATES),o=this._descriptor;h._validateTexture(this._context,o),s.pixelStorei(s.UNPACK_ALIGNMENT,o.unpackAlignment),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,o.flipped?1:0),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.preMultiplyAlpha?1:0);const a=o.pixelFormat;let l=o.internalFormat?o.internalFormat:this._deriveInternalFormat(a,o.dataType);if(e instanceof ImageData||e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement){let r=e.width,i=e.height;e instanceof HTMLVideoElement&&(r=e.videoWidth,i=e.videoHeight),o.width&&o.height,s.texImage2D(t,0,l,a,o.dataType,e),(0,n.zu)(s),o.hasMipmap&&this.generateMipmap(),void 0===o.width&&(o.width=r),void 0===o.height&&(o.height=i)}else{null!=o.width&&null!=o.height||console.error("Width and height must be specified!"),s.DEPTH24_STENCIL8&&l===s.DEPTH_STENCIL&&(l=s.DEPTH24_STENCIL8);let r=o.width,h=o.height;if(function(e){return(0,i.pC)(e)&&"type"in e&&"compressed"===e.type}(e)){const i=Math.round(Math.log(Math.max(r,h))/Math.LN2)+1;o.hasMipmap=o.hasMipmap&&i===e.levels.length;for(let i=0;;++i){const n=e.levels[Math.min(i,e.levels.length-1)];if(s.compressedTexImage2D(t,i,l,r,h,0,n),1===r&&1===h||!o.hasMipmap)break;r=Math.max(1,r>>1),h=Math.max(1,h>>1)}}else if((0,i.pC)(e))s.texImage2D(t,0,l,r,h,0,a,o.dataType,e),(0,n.zu)(s),o.hasMipmap&&this.generateMipmap();else for(let e=0;s.texImage2D(t,e,l,r,h,0,a,o.dataType,null),(0,n.zu)(s),(1!==r||1!==h)&&o.hasMipmap;++e)r=Math.max(1,r>>1),h=Math.max(1,h>>1)}h._applySamplingMode(s,this._descriptor),h._applyWrapMode(s,this._descriptor),h._applyAnisotropicFilteringParameters(this._context,this._descriptor),(0,n.zu)(s),this._context.bindTexture(r,h.TEXTURE_UNIT_FOR_UPDATES)}updateData(e,t,s,r,i,n,o=3553){n||console.error("An attempt to use uninitialized data!"),this._glName||console.error("An attempt to update uninitialized texture!");const a=this._context.gl,l=this._descriptor,c=this._context.bindTexture(this,h.TEXTURE_UNIT_FOR_UPDATES);(t<0||s<0||r>l.width||i>l.height||t+r>l.width||s+i>l.height)&&console.error("An attempt to update out of bounds of the texture!"),a.pixelStorei(a.UNPACK_ALIGNMENT,l.unpackAlignment),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,l.flipped?1:0),a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,l.preMultiplyAlpha?1:0),n instanceof ImageData||n instanceof HTMLImageElement||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement?a.texSubImage2D(o,e,t,s,l.pixelFormat,l.dataType,n):a.texSubImage2D(o,e,t,s,r,i,l.pixelFormat,l.dataType,n),this._context.bindTexture(c,h.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const e=this._descriptor;e.hasMipmap||(e.hasMipmap=!0,this._samplingModeDirty=!0,h._validateTexture(this._context,e)),9729===e.samplingMode?(this._samplingModeDirty=!0,e.samplingMode=9985):9728===e.samplingMode&&(this._samplingModeDirty=!0,e.samplingMode=9984);const t=this._context.bindTexture(this,h.TEXTURE_UNIT_FOR_UPDATES);this._context.gl.generateMipmap(e.target),this._context.bindTexture(t,h.TEXTURE_UNIT_FOR_UPDATES)}setSamplingMode(e){e!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=e,this._samplingModeDirty=!0)}setWrapMode(e){e!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=e,h._validateTexture(this._context,this._descriptor),this._wrapModeDirty=!0)}applyChanges(){const e=this._context.gl,t=this._descriptor;this._samplingModeDirty&&(h._applySamplingMode(e,t),this._samplingModeDirty=!1),this._wrapModeDirty&&(h._applyWrapMode(e,t),this._wrapModeDirty=!1)}_deriveInternalFormat(e,t){if("webgl"===this._context.webglVersion)return e;if(5126===t)switch(e){case 6408:return 34836;case 6407:return 34837;default:throw new Error("Unable to derive format")}return e}static _validateTexture(e,t){(t.width<0||t.height<0)&&console.error("Negative dimension parameters are not allowed!");const s=(0,r.wt)(t.width)&&(0,r.wt)(t.height);(0,a.Z)(e.gl)||s||("number"==typeof t.wrapMode?33071!==t.wrapMode&&console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"):33071===t.wrapMode.s&&33071===t.wrapMode.t||console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"),t.hasMipmap&&console.error("Mipmapping requires power-of-two textures!"))}static _applySamplingMode(e,t){let s=t.samplingMode,r=t.samplingMode;9985===s||9987===s?(s=9729,t.hasMipmap||(r=9729)):9984!==s&&9986!==s||(s=9728,t.hasMipmap||(r=9728)),e.texParameteri(t.target,e.TEXTURE_MAG_FILTER,s),e.texParameteri(t.target,e.TEXTURE_MIN_FILTER,r)}static _applyWrapMode(e,t){"number"==typeof t.wrapMode?(e.texParameteri(t.target,e.TEXTURE_WRAP_S,t.wrapMode),e.texParameteri(t.target,e.TEXTURE_WRAP_T,t.wrapMode)):(e.texParameteri(t.target,e.TEXTURE_WRAP_S,t.wrapMode.s),e.texParameteri(t.target,e.TEXTURE_WRAP_T,t.wrapMode.t))}static _applyAnisotropicFilteringParameters(e,t){var s;const r=e.capabilities.textureFilterAnisotropic;r&&e.gl.texParameterf(t.target,r.TEXTURE_MAX_ANISOTROPY,null!=(s=t.maxAnisotropy)?s:1)}}h.TEXTURE_UNIT_FOR_UPDATES=0},46314:(e,t,s)=>{function r(e){return window.WebGL2RenderingContext&&e instanceof window.WebGL2RenderingContext}s.d(t,{Z:()=>r})},49300:(e,t,s)=>{s.d(t,{zu:()=>l,hZ:()=>a,CG:()=>h});var r=s(20102),i=s(80442);const n=s(92604).Z.getLogger("esri/views/webgl"),o=!!(0,i.Z)("enable-feature:webgl-debug");function a(){return o}function h(){return o}function l(e){if(a()){const t=e.getError();if(t){const s=function(e,t){switch(t){case e.INVALID_ENUM:return"Invalid Enum. An unacceptable value has been specified for an enumerated argument.";case e.INVALID_VALUE:return"Invalid Value. A numeric argument is out of range.";case e.INVALID_OPERATION:return"Invalid Operation. The specified command is not allowed for the current state.";case e.INVALID_FRAMEBUFFER_OPERATION:return"Invalid Framebuffer operation. The currently bound framebuffer is not framebuffer complete when trying to render to or to read from it.";case e.OUT_OF_MEMORY:return"Out of memory. Not enough memory is left to execute the command.";case e.CONTEXT_LOST_WEBGL:return"WebGL context has been lost";default:return"Unknown error"}}(e,t),i=(new Error).stack;n.error(new r.Z("webgl-error","WebGL error occured",{message:s,stack:i}))}}}},35371:(e,t,s)=>{var r,i;s.d(t,{Lu:()=>n,_g:()=>r}),(i=r||(r={}))[i.Texture=0]="Texture",i[i.Buffer=1]="Buffer",i[i.VAO=2]="VAO",i[i.Program=3]="Program",i[i.Framebuffer=4]="Framebuffer",i[i.Renderbuffer=5]="Renderbuffer",i[i.COUNT=6]="COUNT";const n=33306}}]);
package/config.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.21/esri/copyright.txt for details.
4
4
  */
5
- import e from"./core/global.js";import"./core/has.js";import{deepMerge as r}from"./core/object.js";import{buildDate as s}from"./support/revision.js";const t={apiKey:void 0,applicationUrl:e.location&&e.location.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryService:null,geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",portalUrl:"https://www.arcgis.com",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(e.esriConfig&&(r(t,e.esriConfig,!0),delete t.has),!t.assetsPath){const e="4.21.0";t.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}-next.${s}/assets`}t.baseUrl&&console.warn("[esri.config]","baseUrl has been replaced by assetsPath"),Object.defineProperty(t,"baseUrl",{set(){console.warn("[esri.config]","baseUrl has been replaced by assetsPath")}}),t.request.corsEnabledServers=[],t.request.corsEnabledServers.push=function(){return console.warn("[esri.config]","request.corsEnabledServers is not supported and will be removed in a future release. See http://esriurl.com/cors8664"),0};export{t as default};
5
+ import e from"./core/global.js";import"./core/has.js";import{deepMerge as r}from"./core/object.js";const s={apiKey:void 0,applicationUrl:e.location&&e.location.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryService:null,geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",portalUrl:"https://www.arcgis.com",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(e.esriConfig&&(r(s,e.esriConfig,!0),delete s.has),!s.assetsPath){const e="4.21.0";s.assetsPath=`https://js.arcgis.com/${e.slice(0,-2)}/@arcgis/core/assets`}s.baseUrl&&console.warn("[esri.config]","baseUrl has been replaced by assetsPath"),Object.defineProperty(s,"baseUrl",{set(){console.warn("[esri.config]","baseUrl has been replaced by assetsPath")}}),s.request.corsEnabledServers=[],s.request.corsEnabledServers.push=function(){return console.warn("[esri.config]","request.corsEnabledServers is not supported and will be removed in a future release. See http://esriurl.com/cors8664"),0};export{s as default};