@arcgis/core 4.28.4 → 4.28.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{80d9bb9f247ecdfa266f.js → 0695fcdc01f195c5ae8d.js} +1 -1
- package/assets/esri/core/workers/chunks/07cb7d142205f2eccc83.js +1 -0
- package/assets/esri/core/workers/chunks/0f6b766f08c648fd7b99.js +1 -0
- package/assets/esri/core/workers/chunks/16b56e541afa438dfb7f.js +1 -0
- package/assets/esri/core/workers/chunks/28c4a21cdddf2602ab97.js +1 -0
- package/assets/esri/core/workers/chunks/2cf2340ad817f3c27802.js +1 -0
- package/assets/esri/core/workers/chunks/319c222ce72254934060.js +1 -0
- package/assets/esri/core/workers/chunks/340ab726ba40fe3a99c8.js +1 -0
- package/assets/esri/core/workers/chunks/46b4a17ec898ab744861.js +1 -0
- package/assets/esri/core/workers/chunks/{7f3bc7a2de59e485f22f.js → 4f0412b52844aa9c7bd4.js} +1 -1
- package/assets/esri/core/workers/chunks/54867a094fb740a6f4d9.js +1 -0
- package/assets/esri/core/workers/chunks/5b17de91091fc17d9821.js +1 -0
- package/assets/esri/core/workers/chunks/5b80ae1eb79f1db75dc6.js +1 -0
- package/assets/esri/core/workers/chunks/80fcb63476829b6a48d2.js +1 -0
- package/assets/esri/core/workers/chunks/84725021c43f1122056a.js +1 -0
- package/assets/esri/core/workers/chunks/{9f0e8dd5c9bacfc0f03c.js → 908a5326b61843d6d2b3.js} +1 -1
- package/assets/esri/core/workers/chunks/9607460895182d31aef9.js +1 -0
- package/assets/esri/core/workers/chunks/9ef3746c545296565ef6.js +1 -0
- package/assets/esri/core/workers/chunks/{77f557359a5033d7e429.js → a0a86383e69932a25e50.js} +1 -1
- package/assets/esri/core/workers/chunks/a3bf50d9e24ad1de9847.js +1 -0
- package/assets/esri/core/workers/chunks/a5db3be5eeb3005df3c1.js +1 -0
- package/assets/esri/core/workers/chunks/a87ab14d6a6ccc9004a0.js +1 -0
- package/assets/esri/core/workers/chunks/ba00df2e707550939a6f.js +1 -0
- package/assets/esri/core/workers/chunks/ca43955065012d4b22e9.js +1 -0
- package/assets/esri/core/workers/chunks/e0382138cf58191a9697.js +1 -0
- package/assets/esri/core/workers/chunks/{e3950975030412ff6e20.js → f343db8dad71f3840610.js} +1 -1
- package/assets/esri/core/workers/chunks/{46ddc52fe9cdd573a614.js → fa5c69a0cdd78aa34ad7.js} +1 -1
- package/assets/esri/core/workers/chunks/fe0c6814ef56604540b3.js +1 -0
- package/core/sql/WhereClause.js +1 -1
- package/kernel.js +1 -1
- package/layers/save/featureLayerUtils.js +1 -1
- package/layers/support/fetchService.js +1 -1
- package/layers/support/vectorTileLayerLoader.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/features/sources/DataTileSubscription.js +1 -1
- package/widgets/FeatureForm/featureFormUtils.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/Features.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/support/dateUtils.js +1 -1
- package/assets/esri/core/workers/chunks/32fbd4355a4a649623a7.js +0 -1
- package/assets/esri/core/workers/chunks/41306b698f78001dda55.js +0 -1
- package/assets/esri/core/workers/chunks/4747741429e8ff7112bb.js +0 -1
- package/assets/esri/core/workers/chunks/49faa024bab1ba6e2bf0.js +0 -1
- package/assets/esri/core/workers/chunks/534726130ef1698ec89e.js +0 -1
- package/assets/esri/core/workers/chunks/846e5e51dc278bc3f80f.js +0 -1
- package/assets/esri/core/workers/chunks/8b541cbf82a5ba0317ee.js +0 -1
- package/assets/esri/core/workers/chunks/8e91be2e38010391e351.js +0 -1
- package/assets/esri/core/workers/chunks/90f96a2ddfb25d851d4d.js +0 -1
- package/assets/esri/core/workers/chunks/91a3181071874525ed44.js +0 -1
- package/assets/esri/core/workers/chunks/9d97a20f69047d0c47cc.js +0 -1
- package/assets/esri/core/workers/chunks/ac4636e82a103e2c27ca.js +0 -1
- package/assets/esri/core/workers/chunks/ae7ba94af6d4fd97dd8b.js +0 -1
- package/assets/esri/core/workers/chunks/b0653f63745e756f55fe.js +0 -1
- package/assets/esri/core/workers/chunks/bab0aa000c65d5c256b7.js +0 -1
- package/assets/esri/core/workers/chunks/c2199fb8f7a54a0ef18a.js +0 -1
- package/assets/esri/core/workers/chunks/c3f462d11ed570482e7a.js +0 -1
- package/assets/esri/core/workers/chunks/c8cb5fe1d23145c4842b.js +0 -1
- package/assets/esri/core/workers/chunks/ce409944221a784ddb61.js +0 -1
- package/assets/esri/core/workers/chunks/e8b7d1c586aff229484c.js +0 -1
- package/assets/esri/core/workers/chunks/eb5213ffb83d83a4dd05.js +0 -1
- package/assets/esri/core/workers/chunks/f520f093aa81d8ee1790.js +0 -1
- package/assets/esri/core/workers/chunks/fab4ee57b7c5376c9ccd.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[3742],{25929:(e,t,s)=>{s.d(t,{M:()=>p,a:()=>f,e:()=>d,f:()=>i,i:()=>u,p:()=>c,r:()=>o,t:()=>n,w:()=>a});var r=s(17452);function i(e,t){const s=t?.url?.path;if(e&&s&&(e=(0,r.hF)(e,s,{preserveProtocolRelative:!0}),t.portalItem&&t.readResourcePaths)){const s=(0,r.PF)(e,t.portalItem.itemUrl);null!=s&&l.test(s)&&t.readResourcePaths.push(t.portalItem.resourceFromPath(s).path)}return g(e,t?.portal)}function n(e,t,s=p.YES){if(null==e)return e;!(0,r.YP)(e)&&t?.blockedRelativeUrls&&t.blockedRelativeUrls.push(e);let i=(0,r.hF)(e);if(t){const s=t.verifyItemRelativeUrls?.rootPath||t.url?.path;if(s){const n=g(s,t.portal),o=g(i,t.portal);i=(0,r.PF)(o,n,n),null!=i&&i!==o&&i!==e&&t.verifyItemRelativeUrls&&t.verifyItemRelativeUrls.writtenUrls.push(i)}}return i=d(i,t?.portal),(0,r.YP)(i)&&(i=(0,r.Fv)(i)),t?.resources&&t?.portalItem&&!(0,r.YP)(i)&&!(0,r.HK)(i)&&s===p.YES&&t.resources.toKeep.push({resource:t.portalItem.resourceFromPath(i),compress:!1}),i}function o(e,t,s){return i(e,s)}function a(e,t,s,r){const i=n(e,r);void 0!==i&&(t[s]=i)}const h=/\/items\/([^\/]+)\/resources\/(.*)/,l=/^\.\/resources\//;function u(e){const t=e?.match(h)??null;return t?.[1]??null}function c(e){const t=e?.match(h)??null;if(null==t)return null;const s=t[2],i=s.lastIndexOf("/");if(-1===i){const{path:e,extension:t}=(0,r.fZ)(s);return{prefix:null,filename:e,extension:t}}const{path:n,extension:o}=(0,r.fZ)(s.slice(i+1));return{prefix:s.slice(0,i),filename:n,extension:o}}function d(e,t){return t&&!t.isPortal&&t.urlKey&&t.customBaseUrl?(0,r.Ie)(e,`${t.urlKey}.${t.customBaseUrl}`,t.portalHostname):e}function g(e,t){if(!t||t.isPortal||!t.urlKey||!t.customBaseUrl)return e;const s=`${t.urlKey}.${t.customBaseUrl}`,i=(0,r.TI)();return(0,r.D6)(i,`${i.scheme}://${s}`)?(0,r.Ie)(e,t.portalHostname,s):(0,r.Ie)(e,s,t.portalHostname)}var p,_;(_=p||(p={}))[_.YES=0]="YES",_[_.NO=1]="NO";const f=Object.freeze(Object.defineProperty({__proto__:null,get MarkKeep(){return p},ensureMainOnlineDomain:d,fromJSON:i,itemIdFromResourceUrl:u,prefixAndFilenameFromResourceUrl:c,read:o,toJSON:n,write:a},Symbol.toStringTag,{value:"Module"}))},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 u(e,t){return e.minY-t.minY}function c(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function d(e){return e.maxX-e.minX+(e.maxY-e.minY)}function g(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 p(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 _(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function f(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(!f(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],f(e,a=t.leaf?r(o):o)&&(t.leaf?s.push(o):_(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(!f(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],f(e,o=t.leaf?s(n):n)){if(t.leaf||_(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=[],u=[];a||l.length;){if(a||(a=l.pop(),r=l[l.length-1],s=u.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||!_(a,h)?r?(s++,a=r.children[s],o=!1):a=null:(l.push(a),u.push(s),s=0,r=a,a=a.children[0])}return this},toBBox:function(e){return e},compareMinX:l,compareMinY:u,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,u,c,d=Math.ceil(n/a),g=d*Math.ceil(Math.sqrt(a));for(y(e,t,s,g,this.compareMinX),h=t;h<=s;h+=g)for(y(e,h,u=Math.min(h+g-1,s),d,this.compareMinY),l=h;l<=u;l+=d)c=Math.min(l+d-1,u),i.children.push(this._build(e,l,c,r-1));return o(i,this.toBBox),i},_chooseSubtree:function(e,t,s,r){for(var i,n,o,a,h,l,u,d;r.push(t),!t.leaf&&r.length-1!==s;){for(u=d=1/0,i=0,n=t.children.length;i<n;i++)h=c(o=t.children[i]),(l=g(e,o)-h)<d?(d=l,u=h<u?h:u,a=o):l===d&&h<u&&(u=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,u,d;for(l=u=1/0,r=t;r<=s-t;r++)o=p(i=a(e,0,r,this.toBBox),n=a(e,r,s,this.toBBox)),h=c(i)+c(n),o<l?(l=o,d=r,u=h<u?h:u):o===l&&h<u&&(u=h,d=r);return d},_chooseSplitAxis:function(e,t,s){var r=e.leaf?this.compareMinX:l,i=e.leaf?this.compareMinY:u;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),u=a(e,s-t,s,o),c=d(l)+d(u);for(i=t;i<s-t;i++)n=e.children[i],h(l,e.leaf?o(n):n),c+=d(l);for(i=s-t-1;i>=t;i--)n=e.children[i],h(u,e.leaf?o(n):n),c+=d(u);return c},_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:()=>r});class r{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(null!=t&&e(t))return t;return null}clear(e){let t=this.dequeue();for(;null!=t;)e&&e(t),t=this.dequeue()}}},64830:(e,t,s)=>{s.d(t,{Z:()=>n});var r=s(58971),i=s(10661);class n{constructor(e=(e=>e.values().next().value)){this._peeker=e,this._observable=new i.s,this._items=new Set}get length(){return(0,r.it)(this._observable),this._items.size}clear(){0!==this.length&&(this._items.clear(),this._observable.notify())}last(){if(0===this.length)return;let e;for(e of this._items);return e}peek(){if(0!==this.length)return this._peeker(this._items)}push(e){this.contains(e)||(this._items.add(e),this._observable.notify())}contains(e){return(0,r.it)(this._observable),this._items.has(e)}pop(){if(0===this.length)return;const e=this.peek();return this._items.delete(e),this._observable.notify(),e}popLast(){if(0===this.length)return;const e=this.last();return this._items.delete(e),this._observable.notify(),e}remove(e){this.contains(e)&&(this._items.delete(e),this._observable.notify())}filter(e){const t=this.length;return this._items.forEach((t=>{e(t)||this._items.delete(t)})),t!==this._items.size&&this._observable.notify(),this}*[Symbol.iterator](){(0,r.it)(this._observable),yield*this._items}}},19402:(e,t,s)=>{s.d(t,{R:()=>u});var r=s(43697),i=s(92036),n=s(50758),o=s(17445),a=s(1654),h=s(5600),l=s(52011);let u=class extends i.Z{constructor(){super(...arguments),this.updating=!1,this._handleId=0,this._scheduleHandleId=0,this._pendingPromises=new Set}destroy(){this.removeAll()}add(e,t,s={}){return this._installWatch(e,t,s,o.YP)}addWhen(e,t,s={}){return this._installWatch(e,t,s,o.gx)}addOnCollectionChange(e,t,{initial:s=!1,final:r=!1}={}){const i=++this._handleId;return this.addHandles([(0,o.on)(e,"after-changes",this._createSyncUpdatingCallback(),o.Z_),(0,o.on)(e,"change",t,{onListenerAdd:s?e=>t({added:e.toArray(),removed:[]}):void 0,onListenerRemove:r?e=>t({added:[],removed:e.toArray()}):void 0})],i),(0,n.kB)((()=>this.removeHandles(i)))}addPromise(e){if(null==e)return e;const t=++this._handleId;this.addHandles((0,n.kB)((()=>{this._pendingPromises.delete(e)&&(0!==this._pendingPromises.size||this.hasHandles(c)||this._set("updating",!1))})),t),this._pendingPromises.add(e),this._set("updating",!0);const s=()=>this.removeHandles(t);return e.then(s,s),e}removeAll(){this._pendingPromises.clear(),this.removeAllHandles(),this._set("updating",!1)}_installWatch(e,t,s={},r){const i=++this._handleId;s.sync||this._installSyncUpdatingWatch(e,i);const o=r(e,t,s);return this.addHandles(o,i),(0,n.kB)((()=>this.removeHandles(i)))}_installSyncUpdatingWatch(e,t){const s=this._createSyncUpdatingCallback(),r=(0,o.YP)(e,s,{sync:!0,equals:()=>!1});return this.addHandles(r,t),r}_createSyncUpdatingCallback(){return()=>{this.removeHandles(c),++this._scheduleHandleId;const e=this._scheduleHandleId;this._get("updating")||this._set("updating",!0),this.addHandles((0,a.Os)((()=>{e===this._scheduleHandleId&&(this._set("updating",this._pendingPromises.size>0),this.removeHandles(c))})),c)}}};(0,r._)([(0,h.Cb)({readOnly:!0})],u.prototype,"updating",void 0),u=(0,r._)([(0,l.j)("esri.core.support.UpdatingHandles")],u);const c=-42},80903:(e,t,s)=>{s.d(t,{Z:()=>l});var r=s(50758),i=s(92604),n=s(95330),o=s(64830),a=s(18948),h=s(728);class l{constructor(){this._inUseClients=new Array,this._clients=new Array,this._clientPromises=new Array,this._ongoingJobsQueue=new o.Z}destroy(){this.close()}get closed(){return!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,this._inUseClients.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,this._ongoingJobsQueue),o(s),this._clients[i])),(()=>(o(r),null))):(this._clients[i]=new h.default(a,t,this._ongoingJobsQueue),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(){let e;for(;e=this._ongoingJobsQueue.pop();)e.resolver.reject((0,n.zE)(`Worker closing, aborting job calling '${e.methodName}'`));for(const e of this._clientPromises)e.then((e=>e?.close()));this._clients.length=0,this._clientPromises.length=0,this._inUseClients.length=0,(0,a.E)(this)}invoke(e,t,s){let r;Array.isArray(s)?(i.Z.getLogger("esri.core.workers.Connection").warn("invoke()","The transferList parameter is deprecated, use the options object instead"),r={transferList:s}):r=s;const o=(0,n.hh)();this._ongoingJobsQueue.push({methodName:e,data:t,invokeOptions:r,resolver:o});for(let e=0;e<this._clientPromises.length;e++){const t=this._clients[e];t?t.jobAdded():this._clientPromises[e].then((e=>e?.jobAdded()))}return o.promise}on(e,t){return Promise.all(this._clientPromises).then((()=>(0,r.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=>{i&&(t[r]=i.openPort()),0==--s&&e(t)}))}))}get test(){return{numClients:this._clients.length}}}},18948:(e,t,s)=>{s.d(t,{E:()=>n,z:()=>i});const r=new FinalizationRegistry((e=>{e.close()}));function i(e,t){r.register(e,t,t)}function n(e){r.unregister(e)}},84864:(e,t,s)=>{s.d(t,{bU:()=>u,fC:()=>g,tp:()=>d,v7:()=>c});const r=new Float64Array(2),i=new Float64Array(2),n="0123456789bcdefghjkmnpqrstuvwxyz";function o(e){return n[e]}function a(e){return(e[0]+e[1])/2}function h(e,t,s){return e[0]=t,e[1]=s,e}function l(e,t){const s=t>a(e);return function(e,t){const s=a(e),r=t,i=!t;e[0]=i*e[0]+r*s,e[1]=i*s+r*e[1]}(e,s),s}function u(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),u=30-(2*t+3*a),c=3*h+2*(1-h),d=2*h+3*(1-h),g=3*h+7*(1-h)<<u,p=(7*h+3*(1-h)<<l&e.geohashX)>>l,_=(g&e.geohashY)>>u;for(let e=c-1;e>=0;e--){const t=(i+n)/2,s=p&1<<e?1:0;i=(1-s)*i+s*t,n=(1-s)*t+s*n}for(let e=d-1;e>=0;e--){const t=(s+r)/2,i=_&1<<e?1:0;s=(1-i)*s+i*t,r=(1-i)*t+i*r}}return[i,s,n,r]}function c(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 d(e,t,s,r,i){i%2&&(i+=1);let n=0,o=0,a=-90,h=90,l=-180,u=180;for(let e=0;e<i/2;e++){for(let t=0;t<5;t++){const s=(l+u)/2,i=r>s?1:0;n|=i<<29-(t+5*e),l=(1-i)*l+i*s,u=(1-i)*s+i*u}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}function g(e,t,s){let n="";const a=h(r,-90,90),u=h(i,-180,180);for(let r=0;r<s;r++){let s=0;r%2?(s|=l(a,e)<<4,s|=l(u,t)<<3,s|=l(a,e)<<2,s|=l(u,t)<<1,s|=l(a,e)<<0):(s|=l(u,t)<<4,s|=l(a,e)<<3,s|=l(u,t)<<2,s|=l(a,e)<<1,s|=l(u,t)<<0),n+=o(s)}return n}},58835:(e,t,s)=>{s.d(t,{z:()=>a});var r=s(22974),i=s(95961),n=s(33955),o=s(5428);class a{static fromOptimized(e,t,s=!1,r=!1){return(new h).initialize(e,t,s,r,1)}static fromJSON(e,t=!1,s=!1){const[r,i]=u(e);return(new c).initialize(r,i,t,s,1)}static fromOptimizedCIM(e,t,s=!1,r=!1){return(new d).initialize(e,t,s,r,1)}static fromJSONCIM(e,t=!1,s=!1){const[r,i]=u(e);return(new g).initialize(r,i,t,s,1)}static fromFeatureSetReader(e){const t=e.readGeometryForDisplay(),s=e.geometryType;return t&&s?this.fromOptimized(t,s):null}static fromFeatureSetReaderCIM(e){const t=e.readGeometryForDisplay(),s=e.geometryType;return t&&s?this.fromOptimizedCIM(t,s):null}static createEmptyOptimized(e,t=!1,s=!1){return(new h).initialize(new o.Z,e,t,s,1)}static createEmptyJSON(e,t=!1,s=!1){return(new c).initialize([],e,t,s,1)}static createEmptyOptimizedCIM(e,t=!1,s=!1){return(new d).initialize(new o.Z,e,t,s,1)}static createEmptyJSONCIM(e,t=!1,s=!1){return(new g).initialize([],e,t,s,1)}asJSON(){const e=(0,i.M)(this);return"esriGeometryEnvelope"===this.geometryType?{xmin:e[0][0][0],ymin:e[0][0][1],xmax:e[0][2][0],ymax:e[0][2][1]}:"esriGeometryMultipoint"===this.geometryType?{points:e.flat()}:"esriGeometryPoint"===this.geometryType?{x:e[0][0][0],y:e[0][0][1]}:"esriGeometryPolygon"===this.geometryType?{rings:e}:{paths:e}}getCurrentRingArea(){if(!this||this.pathSize<3)return 0;let e,t,s=0;if(this.seekPathStart(),!this.nextPoint())return 0;e=this.x,t=this.y;const r=e,i=t;for(;this.nextPoint();)s+=(e-this.x)*(t+this.y),e=this.x,t=this.y;return s+=(e-r)*(t+i),-.5*s}invertY(){this.yFactor*=-1}}class h extends a{constructor(){super(...arguments),this._end=-1}initialize(e,t,s,r,i){return this.hasZ=s,this.hasM=r,this.geometryType=t,this._stride=2+Number(s)+Number(r),this._geometry=e,this._pathIndex=-1,this._pathOffset=0,this._pointOffset=-this._stride,this._end=-1,this.yFactor=i,this}reset(){this.initialize(this._geometry,this.geometryType,this.hasZ,this.hasM,this.yFactor)}seekPath(e){if(e>=0&&e<this.totalSize){if(this._pathIndex<e)for(;this._pathIndex<e&&this.nextPath(););else if(this._pathIndex>e)for(;this._pathIndex>e&&this.prevPath(););return!0}return!1}seekPathStart(){this._pointOffset=this._pathOffset-this._stride}seekPathEnd(){this._pointOffset=this._end}seekInPath(e){const t=this._pathOffset+e*this._stride;return t>=0&&t<this._end&&(this._pointOffset=t,!0)}nextPoint(){return(this._pointOffset+=this._stride)<this._end}prevPoint(){return(this._pointOffset-=this._stride)>=this._pathOffset}nextPath(){if(this._pathIndex>=0){const e=this._geometry.isPoint?1:this._geometry.lengths[this._pathIndex];this._pathOffset+=this._stride*e}this._pointOffset=this._pathOffset-this._stride;const e=this._geometry.isPoint?1:this._geometry.lengths[this._pathIndex+1];return this._end=this._pointOffset+this._stride+this._stride*e,++this._pathIndex<this.totalSize}prevPath(){this._end=this._pathOffset;const e=this._geometry.isPoint?1:this._geometry.lengths[this._pathIndex-1];return this._pathOffset-=this._stride*e,this._pointOffset=this._pathOffset-this._stride,--this._pathIndex>=0}pathLength(){const e=this._end,t=this._stride,s=this._geometry.coords;let r=0;for(let i=this._pathOffset+t;i<e;i+=t){const e=s[i-t],n=s[i-t+1],o=s[i]-e,a=s[i+1]-n;r+=Math.sqrt(o*o+a*a)}return r}startPath(){this._geometry.lengths.push(0)}pushPath(e){this.startPath(),this.pushPoints(e)}pushPoint(e){for(let t=0;t<this._stride;++t)this._geometry.coords.push(e[t]);this._geometry.lengths[this.totalSize-1]++}pushXY(e,t){this._geometry.coords.push(e,t),this._geometry.lengths[this.totalSize-1]++}pushPoints(e){for(const t of e)for(let e=0;e<this._stride;++e)this._geometry.coords.push(t[e]);this._geometry.lengths[this.totalSize-1]+=e.length}pushCursor(e){const t=e.asOptimized();this._geometry.coords.push(...t.coords),this._geometry.lengths.push(...t.lengths)}asOptimized(){const e=this._geometry.clone();if(1!==this.yFactor)for(let t=1;t<e.coords.length;t+=this._stride)e.coords[t]*=this.yFactor;return"esriGeometryPoint"===this.geometryType&&(e.lengths.length=0),e}isClosed(){const e=this._geometry.coords,t=this._pathOffset,s=this._end-this._stride;for(let r=0;r<this._stride;r++)if(e[t+r]!==e[s+r])return!1;return!0}clone(){return(new h).initialize(this._geometry.clone(),this.geometryType,this.hasZ,this.hasM,this.yFactor)}get totalPoints(){return this._geometry.coords.length/this._stride}get pathSize(){const{lengths:e}=this._geometry;return this._pathIndex<0||this._pathIndex>e.length-1?0:e[this._pathIndex]}get totalSize(){return this._geometry.lengths.length}get x(){return this._geometry.coords[this._pointOffset]}set x(e){this._geometry.coords[this._pointOffset]=e}get y(){return this.yFactor*this._geometry.coords[this._pointOffset+1]}set y(e){this._geometry.coords[this._pointOffset+1]=this.yFactor*e}get z(){return this._geometry.coords[this._pointOffset+2]}set z(e){this._geometry.coords[this._pointOffset+2]=e}get m(){const e=this.hasZ?3:2;return this._geometry.coords[this._pointOffset+e]}set m(e){this._geometry.coords[this._pointOffset+3]=e}get pathIndex(){return this._pathIndex}get _coordIndex(){return this._pointOffset/this._stride}}function l(e){const t=[e.x,e.y];return e.z&&t.push(e.z),e.m&&t.push(e.m),t}function u(e){return(0,n.oU)(e)?[e.rings,"esriGeometryPolygon"]:(0,n.l9)(e)?[e.paths,"esriGeometryPolyline"]:(0,n.aW)(e)?[[e.points],"esriGeometryMultipoint"]:(0,n.YX)(e)?[[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]],"esriGeometryEnvelope"]:(0,n.wp)(e)?[[[l(e)]],"esriGeometryPoint"]:[[],"esriGeometryPolyline"]}class c extends a{initialize(e,t,s,r,i){return this._paths=e,this.geometryType=t,this.hasZ=s,this.hasM=r,this._pathIndex=this._pointIndex=-1,this.yFactor=i,this._mIndex=this.hasZ?3:2,this}reset(){this._pathIndex=this._pointIndex=-1}seekPath(e){return e>=0&&e<this.totalSize&&(this._pathIndex=e,this._pointIndex=-1,this._currentPath=this._paths[e],!0)}seekPathStart(){this._pointIndex=-1}seekPathEnd(){this._pointIndex=this._currentPath.length}seekInPath(e){return e>=0&&e<this._currentPath.length&&(this._pointIndex=e,this._currentPoint=this._currentPath[this._pointIndex],!0)}nextPoint(){return this._currentPoint=this._currentPath[++this._pointIndex],this._pointIndex<this._currentPath.length}prevPoint(){return this._currentPoint=this._currentPath[--this._pointIndex],this._pointIndex>=0}nextPath(){return this._pointIndex=-1,this._currentPath=this._paths[++this._pathIndex],this._pathIndex<this.totalSize}prevPath(){return this._pointIndex=-1,this._currentPath=this._paths[--this._pathIndex],this._pathIndex>=0}pathLength(){const e=this._currentPath.length,t=this._currentPath;let s=0;for(let r=1;r<e;r++){const e=t[r-1],i=t[r],n=e[0],o=e[1],a=i[0]-n,h=i[1]-o;s+=Math.sqrt(a*a+h*h)}return s}startPath(){this._paths.push([])}pushPath(e){this._paths.push(e)}pushPoint(e){this._paths[this.totalSize-1].push(e)}pushXY(e,t){this._paths[this.totalSize-1].push([e,t])}pushPoints(e){this._paths[this.totalSize-1].push(...e)}pushCursor(e){const t=(0,i.M)(e);for(const e of t)this.pushPath(e)}asOptimized(){const e=new o.Z;if("esriGeometryPoint"===this.geometryType)e.coords.push(...this._paths[0][0]),e.lengths.length=0;else for(const t of this._paths){for(const s of t)e.coords.push(s[0]),e.coords.push(s[1]*this.yFactor),this.hasZ&&e.coords.push(s[2]),this.hasM&&e.coords.push(s[this._mIndex]);e.lengths.push(t.length)}return e}isClosed(){const e=this._currentPath[0],t=this._currentPath[this._currentPath.length-1];for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}clone(){return(new c).initialize((0,r.d9)(this._paths),this.geometryType,this.hasZ,this.hasM,this.yFactor)}get totalPoints(){return this._paths.map((e=>e.length)).reduce(((e,t)=>e+t))}get pathSize(){return this._pathIndex<0||this._pathIndex>this.totalSize-1?-1:this._paths[this._pathIndex].length}get totalSize(){return this._paths.length}get x(){return this._currentPoint[0]}set x(e){this._currentPoint[0]=e}get y(){return this.yFactor*this._currentPoint[1]}set y(e){this._currentPoint[1]=this.yFactor*e}get z(){return this._currentPoint[2]}set z(e){this._currentPoint[2]=e}get m(){return this._currentPoint[this._mIndex]}set m(e){this._currentPoint[this._mIndex]=e}get pathIndex(){return this._pathIndex}}class d extends h{initialize(e,t,s,r,i){return super.initialize(e,t,s,r,i),this._controlPoints||(this._controlPoints=this._controlPoints=new Array(this.totalSize).fill(void 0).map((e=>new Set))),this}startPath(){super.startPath(),this._controlPoints.push(new Set)}clone(){const e=(new d).initialize(this._geometry.clone(),this.geometryType,this.hasZ,this.hasM,this.yFactor);return e._controlPoints=this._controlPoints,e}setControlPoint(){this._controlPoints[this.pathIndex].add(this._coordIndex)}getControlPoint(){return this._controlPoints[this.pathIndex].has(this._coordIndex)}setControlPointAt(e){this._controlPoints[this.pathIndex].add(e)}getControlPointAt(e){return this._controlPoints[this.pathIndex].has(e)}}class g extends c{initialize(e,t,s,r,i){return super.initialize(e,t,s,r,i)}clone(){return(new g).initialize((0,r.d9)(this._paths),this.geometryType,this.hasZ,this.hasM,1)}setControlPoint(){this._paths[this.pathIndex][this._pointIndex][4]=1}getControlPoint(){return 1===this._paths[this.pathIndex][this._pointIndex][4]}setControlPointAt(e){this._paths[this.pathIndex][e][4]=1}getControlPointAt(e){return 1===this._paths[this.pathIndex][e][4]}}},32724:(e,t,s)=>{s.d(t,{r:()=>l});var r=s(24470),i=s(20322),n=s(35308),o=s(86662),a=s(87416);const h=222045e-19;function l(e){if(0===e.totalSize)return null;const t=(0,i.Cs)(e);if(!t)return null;const s=4*(Math.abs(t[0])+Math.abs(t[2])+Math.abs(t[1])+Math.abs(t[3])+1)*h;let o=0,a=0;e.reset();for(let t=0;e.nextPath();t++){const s=e.getCurrentRingArea();s>a&&(a=s,o=t)}if(e.seekPath(o),0===e.pathSize)return null;e.seekPathStart();const l=(0,i.qu)(e);if(Math.abs(a)<=2*s*s)return[(l[0]+l[2])/2,(l[1]+l[3])/2];e.seekPathStart();const g=(0,n.Zc)(e,(0,r.Ue)());if(null===g)return null;if(e.totalPoints<4)return g;const p=[[NaN,NaN],[NaN,NaN],[NaN,NaN],[NaN,NaN]],_=[NaN,NaN,NaN,NaN],f=[NaN,NaN,NaN,NaN];let m=!1,y=c(g,e,!0);0===y.distance&&(m=!0,p[0][0]=g[0],p[0][1]=g[1],y=c(g,e,!1)),_[0]=y.distance,f[0]=0;const I=[NaN,NaN];let S=!1,w=.25,T=-1,C=NaN;do{if(C=NaN,p[1]=d(e,b(l[0],l[2],w),0,t),isNaN(p[1][0])||isNaN(p[1][1])||(y=c(p[1],e,!1),C=y.distance),!isNaN(C)&&C>s&&u(p[1],e))S=!0,_[1]=C,f[1]=x(p[1],g);else if(!isNaN(C)&&C>T&&(T=C,I[0]=p[1][0],I[1]=p[1][1]),w-=.01,w<.1){if(!(T>=0))break;S=!0,_[1]=T,p[1][0]=I[0],p[1][1]=I[1],f[1]=x(p[1],g)}}while(!S);S=!1,w=.5,T=-1;let F=.01,A=1;do{if(C=NaN,p[2]=d(e,b(l[0],l[2],w),0,t),isNaN(p[2][0])||isNaN(p[2][1])||(y=c(p[2],e,!1),C=y.distance),!isNaN(C)&&C>s&&u(p[2],e))S=!0,_[2]=C,f[2]=x(p[2],g);else if(!isNaN(C)&&C>T)T=C,I[0]=p[2][0],I[1]=p[2][1];else if(C>T&&(T=C,I[0]=p[2][0],I[1]=p[2][1]),w=.5+F*A,F+=.01,A*=-1,w<.3||w>.7){if(!(T>=0))break;S=!0,_[2]=T,p[2][0]=I[0],p[2][1]=I[1],f[2]=x(p[2],g)}}while(!S);S=!1,w=.75,T=-1;do{if(C=NaN,p[3]=d(e,b(l[0],l[2],w),0,t),isNaN(p[3][0])||isNaN(p[3][1])||(y=c(p[3],e,!1),C=y.distance),!isNaN(C)&&C>s&&u(p[3],e))S=!0,_[3]=C,f[3]=x(p[3],g);else if(C>T&&(T=C,I[0]=p[3][0],I[1]=p[3][1]),w+=.01,w>.9){if(!(T>=0))break;S=!0,_[3]=T,p[3][0]=I[0],p[3][1]=I[1],f[3]=x(p[3],g)}}while(!S);const M=[0,1,2,3],E=m?0:1;let k;for(let e=E;e<4;e++)for(let e=E;e<3;e++){const t=f[e],s=f[e+1];v(t,s)>0&&(k=M[e],M[e]=M[e+1],M[e+1]=k,f[e]=s,f[e+1]=t)}let O=E,P=0,R=0;for(let e=E;e<4;e++){switch(e){case 0:R=2*_[M[e]];break;case 1:R=1.66666666*_[M[e]];break;case 2:R=1.33333333*_[M[e]];break;case 3:R=_[M[e]]}R>P&&(P=R,O=M[e])}return p[O]}function u(e,t){let s,r,i,n,o=0;for(t.reset();t.nextPath()&&t.nextPoint();)for(s=t.x,r=t.y;t.nextPoint();s=i,r=n)i=t.x,n=t.y,r>e[1]!=n>e[1]&&((i-s)*(e[1]-r)-(n-r)*(e[0]-s)>0?o++:o--);return 0!==o}function c(e,t,s){if(s&&u(e,t))return{coord:e,distance:0};let r=1/0,i=0,n=0,a=[0,0],h=[0,0];const l=[0,0];for(t.reset();t.nextPath()&&t.nextPoint();)if(!(t.pathSize<2))for(a[0]=t.x,a[1]=t.y;t.nextPoint();a=h){h=[t.x,t.y],(0,o.r8)(l,e,a,h);const s=x(e,l);s<r&&(r=s,i=l[0],n=l[1])}return{coord:[i,n],distance:Math.sqrt(r)}}function d(e,t,s,i){const n=[t,0];let o=1/0,h=1/0,l=!1,u=!1;const c=[[t,i[1]-1],[t,i[3]+1]],d=[0,0],p=[0,0],_=[0,0],f=[[0,0],[0,0]],m=(0,r.Ue)();for(e.reset();e.nextPath()&&e.nextPoint();)if(!(e.pathSize<2))for(f[0][0]=e.x,f[0][1]=e.y;e.nextPoint();f[0][0]=f[1][0],f[0][1]=f[1][1]){if(f[1][0]=e.x,f[1][1]=e.y,null===g(m,f))continue;if(p[0]=c[0][0],p[1]=c[0][1],_[0]=c[1][0],_[1]=c[1][1],0===y(m,p,_))continue;if(!(0,a.UT)(c[0],c[1],f[0],f[1],d))continue;const t=d[1];o>h?t<o&&(o=t,l=!0):t<h&&(h=t,u=!0)}return l&&u?n[1]=(o+h)/2:n[0]=n[1]=NaN,n}function g(e,t){if(t.length<2)return null;e||(e=(0,r.Ue)());const[s,i]=t[0],[n,o]=t[1];return e[0]=Math.min(s,n),e[1]=Math.min(i,o),e[2]=Math.max(s,n),e[3]=Math.max(i,o),e}const p=1,_=4,f=3,m=12;function y(e,t,s){let r=I(t,e),i=I(s,e);const n=e[0],o=e[1],a=e[2],h=e[3];if(r&i)return 0;if(!(r|i))return 4;const l=(r?1:0)|(i?2:0);do{const l=s[0]-t[0],u=s[1]-t[1];if(l>u)r&f?(r&p?(t[1]+=u*(n-t[0])/l,t[0]=n):(t[1]+=u*(a-t[0])/l,t[0]=a),r=I(t,e)):i&f?(i&p?(s[1]+=u*(n-s[0])/l,s[0]=n):(s[1]+=u*(a-s[0])/l,s[0]=a),i=I(s,e)):r?(r&_?(t[0]+=l*(o-t[1])/u,t[1]=o):(t[0]+=l*(h-t[1])/u,t[1]=h),r=I(t,e)):(i&_?(s[0]+=l*(o-s[1])/u,s[1]=o):(s[0]+=l*(h-s[1])/u,s[1]=h),i=I(s,e));else if(r&m?(r&_?(t[0]+=l*(o-t[1])/u,t[1]=o):(t[0]+=l*(h-t[1])/u,t[1]=h),r=I(t,e)):i&m?(i&_?(s[0]+=l*(o-s[1])/u,s[1]=o):(s[0]+=l*(h-s[1])/u,s[1]=h),i=I(s,e)):r?(r&p?(t[1]+=u*(n-t[0])/l,t[0]=n):(t[1]+=u*(a-t[0])/l,t[0]=a),r=I(t,e)):(i&p?(s[1]+=u*(n-s[0])/l,s[0]=n):(s[1]+=u*(a-s[0])/l,s[0]=a),i=I(s,e)),r&i)return 0}while(r|i);return l}function I(e,t){return(e[0]<t[0]?1:0)|(e[0]>t[2]?1:0)<<1|(e[1]<t[1]?1:0)<<2|(e[1]>t[3]?1:0)<<3}function b(e,t,s){return e+(t-e)*s}function x(e,t){return(e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])}function v(e,t){if(e<t)return-1;if(e>t)return 1;if(e===t)return 0;const s=isNaN(e),r=isNaN(t);return s<r?-1:s>r?1:0}},95047:(e,t,s)=>{s.r(t),s.d(t,{createConnection:()=>C});var r=s(43697),i=(s(66577),s(3172)),n=s(20102),o=s(92604),a=s(95330),h=s(17452),l=(s(75215),s(67676),s(80442),s(52011)),u=s(5600),c=s(69285),d=s(32448);let g=class extends d.Z.EventedAccessor{destroy(){this.emit("destroy")}get connectionError(){return this.errorString?new n.Z("stream-connection",this.errorString):null}onFeature(e){this.emit("data-received",e)}onMessage(e){this.emit("message-received",e)}};(0,r._)([(0,u.Cb)({readOnly:!0})],g.prototype,"connectionError",null),g=(0,r._)([(0,l.j)("esri.layers.support.StreamConnection")],g);const p=g;var _,f;(f=_||(_={}))[f.CONNECTING=0]="CONNECTING",f[f.OPEN=1]="OPEN",f[f.CLOSING=2]="CLOSING",f[f.CLOSED=3]="CLOSED";let m=class extends p{constructor(e){super(),this._outstandingMessages=[],this.errorString=null;const{geometryType:t,spatialReference:s,sourceSpatialReference:r}=e;this._config=e,this._featureZScaler=(0,c.k)(t,r,s),this._open()}async _open(){await this._tryCreateWebSocket(),this.destroyed||await this._handshake()}destroy(){super.destroy(),null!=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(null==this._websocket)return"disconnected";switch(this._websocket.readyState){case _.CONNECTING:case _.OPEN:return"connected";case _.CLOSING:case _.CLOSED:return"disconnected"}}sendMessageToSocket(e){null!=this._websocket?this._websocket.send(JSON.stringify(e)):this._outstandingMessages.push(e)}sendMessageToClient(e){this._onMessage(e)}updateCustomParameters(e){this._config.customParameters=e,null!=this._websocket&&this._websocket.close()}async _tryCreateWebSocket(e=this._config.source.path,t=1e3,s=0){try{if(this.destroyed)return;const t=(0,h.fl)(e,this._config.customParameters??{});this._websocket=await this._createWebSocket(t),this.notifyChange("connectionStatus")}catch(r){const i=t/1e3;return this._config.maxReconnectionAttempts&&s>=this._config.maxReconnectionAttempts?(o.Z.getLogger(this).error(new n.Z("websocket-connection","Exceeded maxReconnectionAttempts attempts. No further attempts will be made")),void this.destroy()):(o.Z.getLogger(this).error(new n.Z("websocket-connection",`Failed to connect. Attempting to reconnect in ${i}s`,r)),await(0,a.e4)(t),this._tryCreateWebSocket(e,Math.min(1.5*t,1e3*this._config.maxReconnectionInterval),s+1))}}_setWebSocketJSONParseHandler(e){e.onmessage=e=>{try{const t=JSON.parse(e.data);this._onMessage(t)}catch(e){return void o.Z.getLogger(this).error(new n.Z("websocket-connection","Failed to parse message, invalid JSON",{error:e}))}}}_createWebSocket(e){return new Promise(((t,s)=>{const r=new WebSocket(e);r.onopen=()=>{if(r.onopen=null,this.destroyed)return r.onclose=null,void r.close();r.onclose=e=>this._onClose(e),r.onerror=e=>this._onError(e),this._setWebSocketJSONParseHandler(r),t(r)},r.onclose=e=>{r.onopen=r.onclose=null,s(e)}}))}async _handshake(e=1e4){const t=this._websocket;if(null==t)return;const s=(0,a.hh)(),r=t.onmessage,{filter:i,outFields:h,spatialReference:l}=this._config;return s.timeout(e),t.onmessage=e=>{let a=null;try{a=JSON.parse(e.data)}catch(e){}a&&"object"==typeof a||(o.Z.getLogger(this).error(new n.Z("websocket-connection","Protocol violation. Handshake failed - malformed message",e.data)),s.reject(),this.destroy()),a.spatialReference?.wkid!==l?.wkid&&(o.Z.getLogger(this).error(new n.Z("websocket-connection",`Protocol violation. Handshake failed - expected wkid of ${l.wkid}`,e.data)),s.reject(),this.destroy()),"json"!==a.format&&(o.Z.getLogger(this).error(new n.Z("websocket-connection","Protocol violation. Handshake failed - format is not set",e.data)),s.reject(),this.destroy()),i&&a.filter!==i&&o.Z.getLogger(this).error(new n.Z("websocket-connection","Tried to set filter, but server doesn't support it")),h&&a.outFields!==h&&o.Z.getLogger(this).error(new n.Z("websocket-connection","Tried to set outFields, but server doesn't support it")),t.onmessage=r;for(const e of this._outstandingMessages)t.send(JSON.stringify(e));this._outstandingMessages=[],s.resolve()},t.send(JSON.stringify({filter:i,outFields:h,format:"json",spatialReference:{wkid:l.wkid}})),s.promise}_onMessage(e){if(this.onMessage(e),"type"in e)switch(e.type){case"features":case"featureResult":for(const t of e.features)null!=this._featureZScaler&&this._featureZScaler(t.geometry),this.onFeature(t)}}_onError(e){const t="Encountered an error over WebSocket connection";this._set("errorString",t),o.Z.getLogger(this).error("websocket-connection",t)}_onClose(e){this._websocket=null,this.notifyChange("connectionStatus"),1e3!==e.code&&o.Z.getLogger(this).error("websocket-connection",`WebSocket closed unexpectedly with error code ${e.code}`),this.destroyed||this._open()}};(0,r._)([(0,u.Cb)()],m.prototype,"connectionStatus",null),(0,r._)([(0,u.Cb)()],m.prototype,"errorString",void 0),m=(0,r._)([(0,l.j)("esri.layers.graphics.sources.connections.WebSocketConnection")],m);var y=s(34599),I=s(14165),b=s(33955),x=s(82971);const v={maxQueryDepth:5,maxRecordCountFactor:3};let S=class extends m{constructor(e){super({...v,...e}),this._buddyServicesQuery=null,this._relatedFeatures=null}async _open(){const e=await this._fetchServiceDefinition(this._config.source);e.timeInfo.trackIdField||o.Z.getLogger(this).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=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){if("attributes"in e){let t;try{t=this._enrich(e),null!=this._featureZScaler&&this._featureZScaler(t.geometry)}catch(e){return void o.Z.getLogger(this).error(new n.Z("geoevent-connection","Failed to parse message",e))}this.onFeature(t)}else this.onMessage(e)}async _fetchServiceDefinition(e){const t={f:"json",...this._config.customParameters},s=(0,i.Z)(e.path,{query:t,responseType:"json"}),r=(await s).data;return this._serviceDefinition=r,r}_fetchWebSocketUrl(e,t){const s=e[0],{urls:r,token:i}=s,n=this._inferWebSocketBaseUrl(r);return(0,h.fl)(`${n}/subscribe`,{outSR:""+t.wkid,token:i})}_inferWebSocketBaseUrl(e){if(1===e.length)return e[0];for(const t of e)if(t.includes("wss"))return t;return o.Z.getLogger(this).error(new n.Z("geoevent-connection","Unable to infer WebSocket url",e)),null}async _setFilter(e,t){const s=this._websocket;if(null==s||null==e&&null==t)return;const r=JSON.stringify({filter:this._serializeFilter(e,t)});let i=!1;const h=(0,a.hh)();return s.onmessage=e=>{const t=JSON.parse(e.data);t.filter&&(t.error&&(o.Z.getLogger(this).error(new n.Z("geoevent-connection","Failed to set service filter",t.error)),this._set("errorString",`Could not set service filter - ${t.error}`),h.reject(t.error)),this._setWebSocketJSONParseHandler(s),i=!0,h.resolve())},s.send(r),setTimeout((()=>{i||(this.destroyed||this._websocket!==s||o.Z.getLogger(this).error(new n.Z("geoevent-connection","Server timed out when setting filter")),h.reject())}),1e4),h.promise}_serializeFilter(e,t){const s={};if(null==e&&null==t)return s;if(e?.geometry)try{const t=(0,b.im)(e.geometry);if("extent"!==t.type)throw new n.Z(`Expected extent but found type ${t.type}`);s.geometry=JSON.stringify(t.shiftCentralMeridian())}catch(e){o.Z.getLogger(this).error(new n.Z("geoevent-connection","Encountered an error when setting connection geometryDefinition",e))}return e?.where&&"1 = 1"!==e.where&&"1=1"!==e.where&&(s.where=e.where),null!=t&&(s.outFields=t.join(",")),s}_enrich(e){if(!this._relatedFeatures)return e;const t=this._serviceDefinition.relatedFeatures.joinField,s=e.attributes[t],r=this._relatedFeatures.get(s);if(!r)return o.Z.getLogger(this).warn("geoevent-connection","Feature join failed. Is the join field configured correctly?",e),e;const{attributes:i,geometry:a}=r;for(const t in i)e.attributes[t]=i[t];return a&&(e.geometry=a),e.geometry||e.centroid||o.Z.getLogger(this).error(new n.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){o.Z.getLogger(this).error(new n.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(163),s.e(4609),s.e(9790),s.e(8775),s.e(7899),s.e(1423),s.e(3778),s.e(7215),s.e(4723),s.e(9238),s.e(3342)]).then(s.bind(s,19238))).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 I.Z;if(u.outFields=this._config.outFields??["*"],u.where=this._config.filter?.where??"1=1",u.returnGeometry=!0,u.returnExceededLimitFeatures=!0,u.outSpatialReference=x.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 c=await(0,y.JT)(e,u,this._config.sourceSpatialReference);return t.destroy(),c.data}async _queryPages(e,t,s=[],r=0){t.start=null!=t.num?r*t.num:null;const{data:i}=await(0,y.JT)(e,t,this._config.sourceSpatialReference);return i.exceededTransferLimit&&r<(this._config.maxQueryDepth??0)?(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}};S=(0,r._)([(0,l.j)("esri.layers.graphics.sources.connections.GeoEventConnection")],S);const w=S;let T=class extends p{constructor(e){super(),this.connectionStatus="connected",this.errorString=null;const{geometryType:t,spatialReference:s,sourceSpatialReference:r}=e;this._featureZScaler=(0,c.k)(t,r,s)}updateCustomParameters(e){}sendMessageToSocket(e){}sendMessageToClient(e){if("type"in e)switch(e.type){case"features":case"featureResult":for(const t of e.features)null!=this._featureZScaler&&this._featureZScaler(t.geometry),this.onFeature(t)}this.onMessage(e)}};function C(e,t,s,r,i,n,o,a){const h={source:e,sourceSpatialReference:t,spatialReference:s,geometryType:r,filter:i,maxReconnectionAttempts:n,maxReconnectionInterval:o,customParameters:a};return e?e.path.startsWith("wss://")||e.path.startsWith("ws://")?new m(h):new w(h):new T(h)}(0,r._)([(0,u.Cb)()],T.prototype,"connectionStatus",void 0),(0,r._)([(0,u.Cb)()],T.prototype,"errorString",void 0),T=(0,r._)([(0,l.j)("esri.layers.support.ClientSideConnection")],T)},39450:(e,t,s)=>{s.d(t,{Z:()=>u});var r,i=s(43697),n=s(96674),o=s(5600),a=s(75215),h=(s(67676),s(80442),s(52011));let l=r=class extends n.wq{constructor(e){super(e),this.cols=null,this.level=0,this.levelValue=null,this.origin=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)({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)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],l.prototype,"origin",void 0),(0,i._)([(0,o.Cb)({type:Number,json:{write:!0}})],l.prototype,"resolution",void 0),(0,i._)([(0,o.Cb)({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);const u=l},11145:(e,t,s)=>{s.d(t,{Z:()=>w});var r,i=s(43697),n=s(35454),o=s(96674),a=s(67900),h=s(5600),l=s(75215),u=(s(67676),s(80442),s(71715)),c=s(52011),d=s(30556),g=s(94139),p=s(82971),_=s(24470),f=s(8744),m=s(40488),y=s(39450),I=s(43077);const b=new n.X({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 x=r=class extends o.wq{static create(e={}){const{resolutionFactor:t=1,scales:s,size:i=256,spatialReference:n=p.Z.WebMercator,numLODs:o=24}=e;if(!(0,f.JY)(n)){const e=[];if(s)for(let t=0;t<s.length;t++){const r=s[t];e.push(new y.Z({level:t,scale:r,resolution:r}))}else{let t=5e-4;for(let s=o-1;s>=0;s--)e.unshift(new y.Z({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 h=(0,f.C5)(n),l=e.origin?new g.Z({x:e.origin.x,y:e.origin.y,spatialReference:n}):new g.Z(h?{x:h.origin[0],y:h.origin[1],spatialReference:n}:{x:0,y:0,spatialReference:n}),u=1/(39.37*(0,a.c9)(n)*96),c=[];if(s)for(let e=0;e<s.length;e++){const t=s[e],r=t*u;c.push(new y.Z({level:e,scale:t,resolution:r}))}else{let e=(0,f.sT)(n)?512/i*591657527.5917094:256/i*591657527.591555;const s=Math.ceil(o/t);c.push(new y.Z({level:0,scale:e,resolution:e*u}));for(let r=1;r<s;r++){const s=e/2**t,i=s*u;c.push(new y.Z({level:r,scale:s,resolution:i})),e=s}}return new r({dpi:96,lods:c,origin:l,size:[i,i],spatialReference:n})}constructor(e){super(e),this.dpi=96,this.format=null,this.origin=null,this.size=null,this.spatialReference=null}get isWrappable(){const{spatialReference:e,origin:t}=this;if(e&&t){const s=(0,f.C5)(e);return e.isWrappable&&!!s&&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=[],i=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,i[e.level]=e}))),this._set("scales",r),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,f.fS)(t.spatialReference,this.spatialReference))n=t.x,o=t.y,r=s;else{const e=(0,m.iV)(t,this.spatialReference);if(null==e)return null;n=e.x,o=e.y,r=s}const a=i.resolution*this.size[0],h=i.resolution*this.size[1];return r||(r=new I.f(null,0,0,0,(0,_.Ue)())),r.level=e,r.row=Math.floor((this.origin.y-o)/h+.001),r.col=Math.floor((n-this.origin.x)/a+.001),this.updateTileInfo(r),r}updateTileInfo(e,t=r.ExtrapolateOptions.NONE){let s=this.lodAt(e.level);if(!s&&t===r.ExtrapolateOptions.POWER_OF_TWO){const t=this.lods[this.lods.length-1];t.level<e.level&&(s=t)}if(!s)return;const i=e.level-s.level,n=s.resolution*this.size[0]/2**i,o=s.resolution*this.size[1]/2**i;e.id=`${e.level}/${e.row}/${e.col}`,e.extent||(e.extent=(0,_.Ue)()),e.extent[0]=this.origin.x+e.col*n,e.extent[1]=this.origin.y-(e.row+1)*o,e.extent[2]=e.extent[0]+n,e.extent[3]=e.extent[1]+o}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 s=this.lodAt(t.level);if(null==s)return null;const{resolution:r}=s,i=r*this.size[0],n=r*this.size[1];return e[0]=this.origin.x+t.col*i,e[1]=this.origin.y-(t.row+1)*n,e[2]=e[0]+i,e[3]=e[1]+n,e}lodAt(e){return this._levelToLOD?.[e]??null}clone(){return r.fromJSON(this.write({}))}getOrCreateCompatible(e,t){if(256===this.size[0]&&256===this.size[1])return 256===e?this:null;const s=[],i=this.lods.length;for(let e=0;e<i;e++){const r=this.lods[e],i=r.resolution*t;s.push(new y.Z({level:r.level,scale:r.scale,resolution:i}))}return new r({size:[e,e],dpi:this.dpi,format:this.format,compressionQuality:this.compressionQuality,origin:this.origin,spatialReference:this.spatialReference,lods:s})}_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}}};var v,S;(0,i._)([(0,h.Cb)({type:Number,json:{write:!0}})],x.prototype,"compressionQuality",void 0),(0,i._)([(0,h.Cb)({type:Number,json:{write:!0}})],x.prototype,"dpi",void 0),(0,i._)([(0,h.Cb)({type:String,json:{read:b.read,write:b.write,origins:{"web-scene":{read:!1,write:!1}}}})],x.prototype,"format",void 0),(0,i._)([(0,h.Cb)({readOnly:!0})],x.prototype,"isWrappable",null),(0,i._)([(0,h.Cb)({type:g.Z,json:{write:!0}})],x.prototype,"origin",void 0),(0,i._)([(0,u.r)("origin")],x.prototype,"readOrigin",null),(0,i._)([(0,h.Cb)({type:[y.Z],value:null,json:{write:!0}})],x.prototype,"lods",null),(0,i._)([(0,h.Cb)({readOnly:!0})],x.prototype,"scales",void 0),(0,i._)([(0,h.Cb)({cast:e=>Array.isArray(e)?e:"number"==typeof e?[e,e]:[256,256]})],x.prototype,"size",void 0),(0,i._)([(0,u.r)("size",["rows","cols"])],x.prototype,"readSize",null),(0,i._)([(0,d.c)("size",{cols:{type:l.z8},rows:{type:l.z8}})],x.prototype,"writeSize",null),(0,i._)([(0,h.Cb)({type:p.Z,json:{write:!0}})],x.prototype,"spatialReference",void 0),x=r=(0,i._)([(0,c.j)("esri.layers.support.TileInfo")],x),v=x||(x={}),(S=v.ExtrapolateOptions||(v.ExtrapolateOptions={}))[S.NONE=0]="NONE",S[S.POWER_OF_TWO=1]="POWER_OF_TWO";const w=x},43077:(e,t,s)=>{s.d(t,{f:()=>r});class r{constructor(e,t,s,r,i=void 0){this.id=e,this.level=t,this.row=s,this.col=r,this.extent=i}}},66677:(e,t,s)=>{s.d(t,{B5:()=>u,DR:()=>d,G:()=>I,M8:()=>_,Nm:()=>f,Qc:()=>c,XG:()=>m,a7:()=>p,ld:()=>g,wH:()=>y});var r=s(17452),i=s(25929);const n={mapserver:"MapServer",imageserver:"ImageServer",featureserver:"FeatureServer",sceneserver:"SceneServer",streamserver:"StreamServer",vectortileserver:"VectorTileServer"},o=Object.values(n),a=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${o.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),h=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/([^\\/\\n]+)\\/(${o.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),l=/(.*?)\/(?:layers\/)?(\d+)\/?$/i;function u(e){return!!a.test(e)}function c(e){if(null==e)return null;const t=(0,r.mN)(e),s=t?.path.match(a)||t?.path.match(h);if(!s)return null;const[,i,o,l,u]=s,c=o.indexOf("/");return{title:g(-1!==c?o.slice(c+1):o),serverType:n[l.toLowerCase()],sublayer:null!=u&&""!==u?parseInt(u,10):null,url:{path:i}}}function d(e){const t=(0,r.mN)(e).path.match(l);return t?{serviceUrl:t[1],sublayerId:Number(t[2])}:null}function g(e){return(e=e.replaceAll(/\s*[/_]+\s*/g," "))[0].toUpperCase()+e.slice(1)}function p(e,t){const s=[];if(e){const t=c(e);null!=t&&t.title&&s.push(t.title)}if(t){const e=g(t);s.push(e)}if(2===s.length){if(s[0].toLowerCase().includes(s[1].toLowerCase()))return s[0];if(s[1].toLowerCase().includes(s[0].toLowerCase()))return s[1]}return s.join(" - ")}function _(e){if(!e)return!1;const t=(e=e.toLowerCase()).includes(".arcgis.com/"),s=e.includes("//services")||e.includes("//tiles")||e.includes("//features");return t&&s}function f(e,t){return e?(0,r.Qj)((0,r.Hu)(e,t)):e}function m(e){let{url:t}=e;if(!t)return{url:t};t=(0,r.Hu)(t,e.logger);const s=(0,r.mN)(t),i=c(s.path);let n;if(null!=i)null!=i.sublayer&&null==e.layer.layerId&&(n=i.sublayer),t=i.url.path;else if(e.nonStandardUrlAllowed){const e=d(s.path);null!=e&&(t=e.serviceUrl,n=e.sublayerId)}return{url:(0,r.Qj)(t),layerId:n}}function y(e,t,s,n,o){(0,i.w)(t,n,"url",o),n.url&&null!=e.layerId&&(n.url=(0,r.v_)(n.url,s,e.layerId.toString()))}function I(e){if(!e)return!1;const t=e.toLowerCase(),s=t.includes("/services/"),r=t.includes("/mapserver/wmsserver"),i=t.includes("/imageserver/wmsserver"),n=t.includes("/wmsserver");return s&&(r||i||n)}},28694:(e,t,s)=>{s.d(t,{p:()=>i});var r=s(69285);function i(e,t,s){if(!s?.features||!s.hasZ)return;const i=(0,r.k)(s.geometryType,t,e.outSpatialReference);if(null!=i)for(const e of s.features)i(e.geometry)}},61027:(e,t,s)=>{s.d(t,{Ht:()=>r,KS:()=>l,QC:()=>o,QS:()=>c,jL:()=>h,mi:()=>n,nE:()=>u,vs:()=>a});const r=8388607,i=8388608,n=0,o=1,a=e=>(e&i)>>>23,h=e=>e&r,l=e=>a(e)===o?254:255;function u(e){return a(e)===o}function c(e,t){return((t?i:0)|e)>>>0}},26899:(e,t,s)=>{s.d(t,{$_:()=>C,UK:()=>M,ws:()=>F,xV:()=>A});var r=s(20102),i=s(92604),n=s(95648),o=s(66039),a=s(35371);const h=i.Z.getLogger("esri.views.2d.engine.webgl.Utils"),l="geometry",u=[{name:l,strideInBytes:12}],c=[{name:l,strideInBytes:36}],d=[{name:l,strideInBytes:24}],g=[{name:l,strideInBytes:12}],p=[{name:l,strideInBytes:40}],_=[{name:l,strideInBytes:36}],f=[{name:l,strideInBytes:36}];function m(e){const t={};for(const s of e)t[s.name]=s.strideInBytes;return t}const y=m([{name:l,strideInBytes:36}]),I=m(u),b=m(c),x=m(d),v=m(g),S=m(p),w=m(_),T=m(f);function C(e,t){switch(e){case o.LW.MARKER:return t===o.mD.HEATMAP?I:y;case o.LW.FILL:switch(t){case o.mD.DOT_DENSITY:return v;case o.mD.SIMPLE:case o.mD.OUTLINE_FILL_SIMPLE:return x;default:return b}case o.LW.LINE:return S;case o.LW.TEXT:return w;case o.LW.LABEL:return T}}function F(e){switch(e){case"butt":return n.RL.BUTT;case"round":return n.RL.ROUND;case"square":return n.RL.SQUARE;default:return h.error(new r.Z("mapview-invalid-type",`Cap type ${e} is not a valid option. Defaulting to round`)),n.RL.ROUND}}function A(e){switch(e){case"miter":return n.AH.MITER;case"bevel":return n.AH.BEVEL;case"round":return n.AH.ROUND;default:return h.error(new r.Z("mapview-invalid-type",`Join type ${e} is not a valid option. Defaulting to round`)),n.AH.ROUND}}function M(e){switch(e){case a.Br.UNSIGNED_BYTE:return Uint8Array;case a.Br.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case a.Br.FLOAT:return Float32Array;default:return void h.error(new r.Z("webgl-utils",`Unable to handle type ${e}`))}}a.l1.STATIC_DRAW,new Map},37720:(e,t,s)=>{s.d(t,{aH:()=>n,t2:()=>i});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)}},66039:(e,t,s)=>{var r,i,n,o,a,h,l;s.d(t,{LW:()=>r,X:()=>o,mD:()=>l,mf:()=>a}),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.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"}(i||(i={})),function(e){e[e.SIZE=0]="SIZE",e[e.COLOR=1]="COLOR",e[e.OPACITY=2]="OPACITY",e[e.ROTATION=3]="ROTATION"}(n||(n={})),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"}(o||(o={})),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"}(a||(a={})),function(e){e[e.SPRITE=0]="SPRITE",e[e.GLYPH=1]="GLYPH"}(h||(h={})),function(e){e[e.DEFAULT=0]="DEFAULT",e[e.SIMPLE=1]="SIMPLE",e[e.DOT_DENSITY=2]="DOT_DENSITY",e[e.OUTLINE_FILL=3]="OUTLINE_FILL",e[e.OUTLINE_FILL_SIMPLE=4]="OUTLINE_FILL_SIMPLE",e[e.HEATMAP=5]="HEATMAP",e[e.PIE_CHART=6]="PIE_CHART"}(l||(l={}))},12142:(e,t,s)=>{s.d(t,{Jz:()=>n,UJ:()=>i});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)},74259:(e,t,s)=>{s.d(t,{k:()=>g,p:()=>p});var r=s(8557),i=s(32448),n=(s(80442),s(96794)),o=s(60437),a=s(59999),h=s(61800);const l=(0,o.Ue)();function u(e,t){return e<<16|t}function c(e){return(4294901760&e)>>>16}function d(e){return 65535&e}const g={getObjectId:e=>e.getObjectId(),getAttributes:e=>e.readAttributes(),getAttribute:(e,t)=>e.readAttribute(t),getAttributeAsTimestamp:(e,t)=>e.readAttributeAsTimestamp(t),cloneWithGeometry:(e,t)=>e,getGeometry:e=>e.readHydratedGeometry(),getCentroid:(e,t)=>e.readCentroid()};class p extends a.J{constructor(e,t,s){super(e,t),this.featureAdapter=g,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,n.r)(9,(e=>({minX:this._storage.getXMin(e),minY:this._storage.getYMin(e),maxX:this._storage.getXMax(e),maxY:this._storage.getYMax(e)}))),this.mode=s}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,s){if(null==t.addOrUpdate)return t;if(t.addOrUpdate.attachStorage(this._storage),"snapshot"===this.mode){const r=t.addOrUpdate.getCursor();for(;r.next();){const t=r.getDisplayId();this.setComputedAttributes(this._storage,r,t,e.scale,s)}return t}this._featureSetsByInstance.set(t.addOrUpdate.instance,t.addOrUpdate);const r=t.addOrUpdate.getCursor();for(;r.next();)this._insertFeature(r,e.scale,s);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(null!=s)return s.readers;const r=new Map,i=this._searchIndex(e.bounds),n=[];for(const e of i){const t=this._storage.getInstanceId(e),s=c(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);n.push(h.t.from(s,e))})),this._indexSearchCache.enqueue({tileId:t,readers:n}),n}insert(e){const t=e.getCursor(),s=this._storage;for(;t.next();){const e=u(t.instance,t.getIndex()),r=t.getObjectId(),i=this._objectIdToDisplayId.get(r)??this._storage.createDisplayId();t.setDisplayId(i),s.setInstanceId(i,e),this._objectIdToDisplayId.set(r,i)}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=c(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=c(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)t(this.lookupFeatureByDisplayId(e,this._storage))}forEachBounds(e,t){this._rebuildIndex();for(const s of e){if(!s.readGeometry())continue;const e=s.getDisplayId();(0,o.bZ)(l,this._storage.getXMin(e),this._storage.getYMin(e),this._storage.getXMax(e),this._storage.getYMax(e)),t(l)}}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 null==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=c(t),r=d(t),i=this._getFeatureSet(s);return i?(i.setIndex(r),i):null}_insertFeature(e,t,s){const r=this._storage,i=e.getObjectId(),n=u(e.instance,e.getIndex());r.getInstanceId(e.getDisplayId());let o=this._objectIdToDisplayId.get(i);o||(o=r.createDisplayId(),this._objectIdToDisplayId.set(i,o),this._spatialIndexInvalid=!0),e.setDisplayId(o),r.setInstanceId(o,n),this.setComputedAttributes(r,e,o,t,s)}_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=c(e),s=this._getFeatureSet(t);if(!s)return;const r=s.getCursor(),i=d(e);return r.setIndex(i),r}_getFeatureSet(e){return this._featureSetsByInstance.get(e)}}},27937:(e,t,s)=>{s.r(t),s.d(t,{default:()=>yt});var r=s(43697),i=s(92036),n=s(80442),o=s(17445),a=s(5600),h=(s(75215),s(67676)),l=s(52011),u=s(8744),c=s(11145),d=s(95330),g=s(19402),p=s(98732),_=s(3489),f=s(99514),m=s(25031),y=s(74259),I=s(66677),b=s(3172),x=s(20102),v=s(92604),S=s(80903),w=s(82397),T=s(16467),C=s(34599),F=s(70272),A=s(87554);class M extends A.s{static fromFeatures(e,t){const{objectIdField:s,geometryType:r}=t,i=(0,p.Yn)([],e,r,!1,!1,s);for(let t=0;t<i.length;t++)i[t].displayId=e[t].displayId;return M.fromOptimizedFeatures(i,t)}static fromFeatureSet(e,t){const s=(0,p.h_)(e,t.objectIdField);return M.fromOptimizedFeatureSet(s,t)}static fromOptimizedFeatureSet(e,t){const{features:s}=e,r=M.fromOptimizedFeatures(s,t);return r._exceededTransferLimit=e.exceededTransferLimit,r._transform=e.transform,r._fieldsIndex=new f.Z(t.fields),r}static fromOptimizedFeatures(e,t,s){const r=A.s.createInstance(),i=new M(r,e,t);return i._fieldsIndex=new f.Z(t.fields),i._transform=s,i}constructor(e,t,s){super(e,s),this._exceededTransferLimit=!1,this._featureIndex=-1,this._fieldsIndex=null,this._geometryType=s?.geometryType,this._features=t}get fields(){return this._fieldsIndex}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=>!(null!=e.objectId&&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 M(this.instance,this._features,this.fullSchema());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.readUnquantizedGeometry();return(0,p.di)(e,this.geometryType,this.hasZ,this.hasM)}readLegacyCentroid(){const e=this.readCentroid();return null==e?null:{x:e.coords[0]*this._sx+this._tx,y:e.coords[1]*this._sy+this._ty}}readGeometryArea(){return(0,F.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(null==e)return null;const t=e.clone();return null!=this._transform&&(0,p.$g)(t,t,this.hasZ,this.hasM,this._transform),t}getXHydrated(){if(!(0,F.S6)(this._current))return 0;const e=this._current.geometry.coords[0],t=this.getQuantizationTransform();return null==t?e:e*t.scale[0]+t.translate[0]}getYHydrated(){if(!(0,F.S6)(this._current))return 0;const e=this._current.geometry.coords[1],t=this.getQuantizationTransform();return null==t?e:t.translate[1]-e*t.scale[1]}getX(){return(0,F.S6)(this._current)?this._current.geometry.coords[0]*this._sx+this._tx:0}getY(){return(0,F.S6)(this._current)?this._current.geometry.coords[1]*this._sy+this._ty:0}readGeometry(){if(!(0,F.S6)(this._current)){if(null!=this._current.centroid){const[e,t]=this._current.centroid.coords;return this.createQuantizedExtrudedGeometry(e,t)}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(){return(0,F.S6)(this._current)?this._computeCentroid():this._current.centroid}_readAttribute(e,t){const s=this._fieldsIndex.get(e);if(!s)return;let r=this._current.attributes[s.name];return null==r?r:("esriFieldTypeTimestampOffset"===this.fields.get(e)?.type&&(r=this.parseTimestampOffset(r)),t&&this.fields.isDateField(e)?new Date(r):r)}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._transform=this._transform,e._fieldsIndex=this._fieldsIndex}_readAttributes(){return this._current.attributes}}var E=s(70586),k=s(45091),O=s(5428),P=s(77863);const R=268435455;class L{constructor(){this.hasFeatures=!1,this.exceededTransferLimit=!1,this.fieldCount=0,this.featureCount=0,this.objectIdFieldIndex=0,this.vertexCount=0,this.offsets={attributes:new Array,geometry:new Array},this.centroid=new Array}}const z=268435455,N=128e3,U={small:{delta:new Int32Array(128),decoded:new Int32Array(128)},large:{delta:new Int32Array(N),decoded:new Int32Array(N)}};function Z(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 B(e){for(;e.next();){if(1===e.tag())return e.getMessage();e.skip()}return null}function D(e,t,s,r,i,n){return.5*Math.abs(e*r+s*n+i*t-e*n-s*t-i*r)}function q(e,t,s,r){return 0==e*r-s*t&&e*s+t*r>0}class G extends A.s{static fromBuffer(e,t,s=!1){const r=t.geometryType,i=function(e){try{const t=2,s=new k.Z(new Uint8Array(e),new DataView(e));for(;s.next();){if(s.tag()===t)return B(s.getMessage());s.skip()}}catch(e){const t=new x.Z("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:e});v.Z.getLogger("esri.view.2d.layers.features.support.FeatureSetReaderPBF").error(t)}return null}(e),n=function(e,t,s=!1){const r=e.asUnsafe(),i=r.pos(),n=new L;let o=0,a=0,h=null,l=null,u=null,c=!1;const d=[];for(;r.next();)switch(r.tag()){case 1:h=r.getString();break;case 3:l=r.getString();break;case 12:u=r.processMessage(P.G$);break;case 9:if(n.exceededTransferLimit=r.getBool(),n.exceededTransferLimit){n.offsets.geometry=s?new Float64Array(8e3):new Int32Array(8e3),n.centroid=s?new Float64Array(16e3):new Int32Array(16e3);for(let e=0;e<n.centroid.length;e++)n.centroid[e]=R}break;case 13:{const e=r.processMessage(P.wn);e.index=o++,d.push(e);break}case 15:{const e=r.getLength(),i=r.pos()+e;if(!n.exceededTransferLimit){const e=n.offsets.geometry,t=n.centroid;e.push(0),t.push(R),t.push(R)}!c&&n.exceededTransferLimit&&(c=!0,n.offsets.attributes=s?new Float64Array(8e3*o):new Uint32Array(8e3*o));let h=a*o;for(;r.pos()<i&&r.next();)switch(r.tag()){case 1:{c?n.offsets.attributes[h++]=r.pos():n.offsets.attributes.push(r.pos());const e=r.getLength();r.skipLen(e);break}case 2:if(t){const e=r.getLength(),t=r.pos()+e;for(;r.pos()<t&&r.next();)switch(r.tag()){case 3:{r.getUInt32();const e=r.getSInt64(),t=r.getSInt64();n.centroid[2*a]=e,n.centroid[2*a+1]=t;break}default:r.skip()}}else{n.offsets.geometry[a]=r.pos();const e=r.getLength();n.vertexCount+=e,r.skipLen(e)}break;case 4:{const e=r.getLength(),t=r.pos()+e;for(;r.pos()<t&&r.next();)switch(r.tag()){case 3:{r.getUInt32();const e=r.getSInt64(),t=r.getSInt64();n.centroid[2*a]=e,n.centroid[2*a+1]=t;break}default:r.skip()}break}default:r.skip()}a++,n.hasFeatures=!0;break}default:r.skip()}const g=h||l;if(!g)throw new x.Z("FeatureSet has no objectId or globalId field name");return n.fields=new f.Z(d),n.featureCount=a,n.fieldCount=o,n.objectIdFieldIndex=n.fields.get(g)?.index,n.transform=u,n.displayIds=new Uint32Array(n.featureCount),n.groupIds=new Uint16Array(n.featureCount),r.move(i),n}(i,"esriGeometryPoint"===r,s),o=A.s.createInstance();return new G(o,i,n,t)}constructor(e,t,s,r){super(e,r),this._hasNext=!1,this._isPoints=!1,this._featureIndex=-1,this._featureOffset=0,this._cache={area:0,unquantGeometry:void 0,geometry:void 0,centroid:void 0,legacyFeature:void 0,optFeature:void 0},this._geometryType=r.geometryType,this._reader=t,this._header=s,this._hasNext=s.hasFeatures,this._isPoints="esriGeometryPoint"===r.geometryType}get fields(){return this._header.fields}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="";for(const t of this._header.fields.fields)e+=this._readAttributeAtIndex(t.index)+".";return e}getObjectId(){return this._readAttributeAtIndex(this._header.objectIdFieldIndex)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(e){this._header.displayIds[this._featureIndex]=e}getGroupId(){return this._header.groupIds[this._featureIndex]}setGroupId(e){this._header.groupIds[this._featureIndex]=e}readLegacyFeature(){if(void 0===this._cache.legacyFeature){const e=this.readCentroid(),t={attributes:this.readAttributes(),geometry:this._isPoints?this.readLegacyPointGeometry():this.readLegacyGeometry(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null};return this._cache.legacyFeature=t,t}return this._cache.legacyFeature}readOptimizedFeature(){if(void 0===this._cache.optFeature){const e=new F.u_(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 null==t?e:e*t.scale[0]+t.translate[0]}getYHydrated(){const e=this._header.centroid[2*this._featureIndex+1],t=this.getQuantizationTransform();return null==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.readUnquantizedGeometry(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=void 0,null;const s=Z(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]===z)return null;const e=this.getXHydrated(),t=this.getYHydrated();return new O.Z([],[e,t])}const e=this.readGeometry();if(!e)return null;const t=e.clone(),s=this.getQuantizationTransform();return null!=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]===z)return null;const e=this.getX(),s=this.getY();t=new O.Z([],[e,s])}else{const s=this._header.offsets.geometry[this._featureIndex],r=this._reader;if(0===s){const e=this._readServerCentroid();if(!e)return null;const[t,s]=e.coords;return this.createQuantizedExtrudedGeometry(t,s)}r.move(s);try{if(t=e?this._parseGeometryForDisplay(r):this._parseGeometry(r),!t){const e=this._readServerCentroid();if(!e)return null;const[t,s]=e.coords;return this.createQuantizedExtrudedGeometry(t,s)}}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;return e=this._computeCentroid(),e||(e=this._readServerCentroid()),this._cache.centroid=e??void 0,e??null}return this._cache.centroid}copy(){const e=this._reader.clone(),t=new G(this.instance,e,this._header,this.fullSchema());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.fields.get(e);if(null==s)return;let r=this._readAttributeAtIndex(s.index);"esriFieldTypeTimestampOffset"===this.fields.get(e)?.type&&(r=this.parseTimestampOffset(r));const i=this._header.fields.isDateField(s.name);return t?null==r?r:i?new Date(r):r:r}_readAttributes(){const e={};for(const t of this._header.fields.fields)e[t.name]=this._readAttributeAtIndex(t.index);return 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)}_readServerCentroid(){const e=this._header.centroid[2*this._featureIndex]+this._tx,t=this._header.centroid[2*this._featureIndex+1]+this._ty;return e===z?null:new O.Z([],[e,t])}_parseGeometry(e){const t=e.asUnsafe(),s=t.getLength(),r=t.pos()+s,i=[],n=[];for(;t.pos()<r&&t.next();)switch(t.tag()){case 2:{const e=t.getUInt32(),s=t.pos()+e;for(;t.pos()<s;)n.push(t.getUInt32());break}case 3:{const e=t.getUInt32(),s=t.pos()+e;for(i.push(t.getSInt32()+this._tx),i.push(t.getSInt32()+this._ty),this.hasZ&&t.getSInt32(),this.hasM&&t.getSInt32();t.pos()<s;)i.push(t.getSInt32()),i.push(t.getSInt32()),this.hasZ&&t.getSInt32(),this.hasM&&t.getSInt32();break}default:t.skip()}return i.length?new O.Z(n,i):null}_parseGeometryForDisplay(e){const t=e.asUnsafe(),s=t.getLength(),r=t.pos()+s,i=[],n=[];let o=0,a=0,h=null,l=0;const u="esriGeometryPolygon"===this.geometryType;for(;t.pos()<r&&t.next();)switch(t.tag()){case 2:{const e=t.getUInt32(),s=t.pos()+e;for(;t.pos()<s;){const e=t.getUInt32();i.push(e),o+=e}h=Z(2*o).delta;break}case 3:{t.getUInt32();const e=2+(this.hasZ?1:0)+(this.hasM?1:0);(0,E.O3)(h);for(const s of i)if(a+e*s>h.length)for(let e=0;e<s;e++)t.getSInt32(),t.getSInt32(),this.hasZ&&t.getSInt32(),this.hasM&&t.getSInt32();else if(u){const e=this.getAreaSimplificationThreshold(s,this._header.vertexCount);let r=2,i=1;const o=!1;let u=t.getSInt32(),c=t.getSInt32();h[a++]=u,h[a++]=c,this.hasZ&&t.getSInt32(),this.hasM&&t.getSInt32();let d=t.getSInt32(),g=t.getSInt32();for(this.hasZ&&t.getSInt32(),this.hasM&&t.getSInt32();r<s;){let s=t.getSInt32(),n=t.getSInt32();this.hasZ&&t.getSInt32(),this.hasM&&t.getSInt32();const o=u+d,p=c+g;D(u,c,o,p,o+s,p+n)>=e?(l+=-.5*(o-u)*(p+c),i>1&&q(h[a-2],h[a-1],d,g)?(h[a-2]+=d,h[a-1]+=g):(h[a++]=d,h[a++]=g,i++),u=o,c=p):(s+=d,n+=g),d=s,g=n,r++}i<3||o?a-=2*i:(l+=-.5*(u+d-u)*(c+g+c),q(h[a-2],h[a-1],d,g)?(h[a-2]+=d,h[a-1]+=g,n.push(i)):(h[a++]=d,h[a++]=g,n.push(++i)))}else{let e=0,r=t.getSInt32(),i=t.getSInt32();this.hasZ&&t.getSInt32(),this.hasM&&t.getSInt32(),h[a++]=r,h[a++]=i,e+=1;for(let n=1;n<s;n++){const s=t.getSInt32(),o=t.getSInt32(),u=r+s,c=i+o;l+=-.5*(u-r)*(c+i),this.hasZ&&t.getSInt32(),this.hasM&&t.getSInt32(),n>2&&q(h[a-2],h[a-1],s,o)?(h[a-2]+=s,h[a-1]+=o):(h[a++]=s,h[a++]=o,e+=1),r=u,i=c}n.push(e)}break}default:t.skip()}if(this._cache.area=l,!n.length)return null;if(this._tx||this._ty){let e=0;(0,E.O3)(h);for(const t of n)h[2*e]+=this._tx,h[2*e+1]+=this._ty,e+=t}return new O.Z(n,h)}}class j{constructor(e){this.service=e,this._arcadeLayerSchema={...e,fieldsIndex:f.Z.fromJSON(e.fieldsIndex)}}destroy(){}}class H extends j{constructor(e){super(e),this._portsOpen=async function(e){const t=new S.Z;return await t.open(e,{}),t}(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 M.fromFeatureSet(s,this._arcadeLayerSchema)}}class Q extends j{async executeQuery(e,t){const{data:s}=await(0,C.n7)(this.service.source,e,t),r=!e.quantizationParameters;return G.fromBuffer(s,this._arcadeLayerSchema,r)}}class Y extends j{async executeQuery(e,t){const{source:s,capabilities:r,spatialReference:i,objectIdField:n,geometryType:o}=this.service;if(null!=e.quantizationParameters&&!r.query.supportsQuantization){const r=e.clone(),o=(0,w.vY)(r.quantizationParameters);r.quantizationParameters=null;const{data:a}=await(0,C.JT)(s,r,i,t),h=(0,p.h_)(a,n);return(0,p.RZ)(o,h),M.fromOptimizedFeatureSet(h,this._arcadeLayerSchema)}const{data:a}=await(0,C.JT)(s,e,this.service.spatialReference,t);return"esriGeometryPoint"===o&&(a.features=a.features?.filter((e=>{if(null!=e.geometry){const t=e.geometry;return Number.isFinite(t.x)&&Number.isFinite(t.y)}return!0}))),M.fromFeatureSet(a,this._arcadeLayerSchema)}}class X extends j{async executeQuery(e,t){const{capabilities:s}=this.service;if(e.quantizationParameters&&!s.query.supportsQuantization){const s=e.clone(),r=(0,w.vY)(s.quantizationParameters);s.quantizationParameters=null;const i=await(0,T.WW)(this.service.source,e,t);return(0,p.RZ)(r,i),M.fromOptimizedFeatureSet(i,this._arcadeLayerSchema)}const r=await(0,T.WW)(this.service.source,e,t);return M.fromOptimizedFeatureSet(r,this._arcadeLayerSchema)}}var V=s(92835),W=s(32448),J=s(22862),$=s(14165),K=s(8557);class ee{constructor(){this.version=0,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;let s;for(s in e){const r=e[s];if("object"==typeof r)for(const e in r){const i=e,n=r[i];t[s][i]=n}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){this.version=e.version,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,t){this.requests={done:new Array,stream:new K.Z(10)},this._edits=null,this._abortController=new AbortController,this._version=0,this._isDone=!1,this.didSend=!1,this.tile=e,this._version=t,this._resolver=(0,d.hh)(),this._resolver.promise.catch((e=>(0,d.H9)(e)))}get signal(){return this._abortController.signal}get options(){return{signal:this._abortController.signal}}get empty(){return!this.requests.done.length&&null==this.edits}get edits(){return this._edits}get done(){return this._resolver.promise}get isDone(){return this._isDone}resolve(){this._isDone=!0,this._resolver.resolve()}clear(){this.requests.done=[]}applyUpdate(e){this.requests.done.forEach((t=>t.message.status.unset(e))),this._version=e.version,null!=this._edits&&this._edits.status.unset(e)}add(e){e.message.status=e.message.status??ee.empty(),e.message.status.version=this._version,(0,n.Z)("esri-2d-update-debug")&&console.debug(this.tile.id,"DataTileSubscription:add",this._version),e.message.end&&(this.requests.done.forEach((e=>{null!=e.message&&e.message.end&&(e.message.end=!1)})),this._resolver.resolve(),this._isDone=!0),this.requests.done.push(e)}edit(e,t){const s=e.getQuantizationTransform(),r=e.fullSchema(),i=Array.from(e.features()).filter(h.pC),n=[...t,...i.map((e=>e.objectId))];this.removeIds(n),this._invalidate(),null!=this._edits?(this.requests.done.forEach((e=>e.message.end=!1)),this._edits.addOrUpdate.append(e.features())):this._edits={type:"append",addOrUpdate:M.fromOptimizedFeatures(i,r,s),id:this.tile.id,status:ee.empty(),end:!0}}*readers(){for(const{message:e}of this.requests.done)null!=e.addOrUpdate&&(yield e.addOrUpdate);null!=this._edits?.addOrUpdate&&(yield this._edits.addOrUpdate)}_invalidate(){for(const e of this.requests.done)e.message.status=ee.empty();null!=this._edits&&(this._edits.status=ee.empty())}removeIds(e){this._invalidate();for(const{message:t}of this.requests.done){const s=t.addOrUpdate;null!=s&&(s.removeIds(e),s.isEmpty&&((0,n.Z)("esri-2d-update-debug")&&console.debug("Removing FeatureSetReader"),t.addOrUpdate=null))}null!=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(),this._resolver.reject((0,d.zE)())}}class se{constructor(e){this.updatingHandles=new g.R,this.events=new W.Z,this._resolver=(0,d.hh)(),this._didEdit=!1,this._subscriptions=new Map,this._outSR=e.outSR,this._serviceInfo=e.serviceInfo,this._onTileUpdateMessage=e.onMessage,this._arcadeLayerSchema=e.arcadeLayerSchema}destroy(){for(const e of this._subscriptions.values())e.abort();this.updatingHandles.destroy()}get subscriptions(){return this._subscriptions.values()}async _onMessage(e){const t=this._subscriptions.get(e.id);if(!t)return;const s={...e,remove:e.remove??[],status:e.status??ee.empty()};return(0,d.R8)(this._onTileUpdateMessage(s,t.options))}update(e,t){const s=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)}(this._schema?.outFields,t.outFields),t.outFields=t.outFields.length>=.75*s?["*"]:t.outFields,t.outFields.sort();const r=(0,J.Hg)(this._schema,t);if(!r)return;(0,n.Z)("esri-2d-update-debug")&&console.debug("Applying Update - Source:",r);const i="orderByFields"in this._serviceInfo&&this._serviceInfo.orderByFields?this._serviceInfo.orderByFields:this._serviceInfo.objectIdField+" ASC",o=this._serviceInfo.source,a={returnCentroid:!(null!==o&&"object"==typeof o&&"path"in o&&(0,I.M8)(o.path))&&"esriGeometryPolygon"===this._serviceInfo.geometryType,returnGeometry:!0,timeReferenceUnknownClient:"stream"!==this._serviceInfo.type&&this._serviceInfo.timeReferenceUnknownClient,outFields:t.outFields,outSpatialReference:this._outSR,orderByFields:[i],where:t.definitionExpression||"1=1",gdbVersion:t.gdbVersion,historicMoment:t.historicMoment,timeExtent:t.timeExtent?V.Z.fromJSON(t.timeExtent):null},h=this._schema&&(0,J.uD)(r,"outFields");this._schema&&(0,J.V7)(r,["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(e.version),void(this._didEdit=!1);this._subscriptions.forEach((t=>t.applyUpdate(e))),await this.resend()}refresh(e,t){for(const t of this._tiles())this.unsubscribe(t),this.subscribe(t,e)}subscribe(e,t){const s=new te(e,t);return this._subscriptions.set(e.id,s),s}unsubscribe(e){const t=this.getSubscription(e.id);null!=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})}getSubscription(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,t){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){return this.updatingHandles.addPromise(this._edit(e,t))}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:{tile:(0,n.Z)("esri-tiles-debug")?e.id.replaceAll("/","."):void 0}}),query:t}))),i=(await(0,d.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 Promise.allSettled(i)}this._didEdit=!0}}var re=s(79384);class ie extends se{constructor(e){super(e),this.type="feature",this.mode="on-demand",this._adapter=function(e){const{capabilities:t}=e;return function(e){return"ogc-source"===e?.type}(e.source)?new X(e):function(e){return Array.isArray(e.source)}(e)?new H(e):t.query.supportsFormatPBF&&(0,n.Z)("featurelayer-pbf")?new Q(e):new Y(e)}(e.serviceInfo),this._queue=new re.e({concurrency:8,process:async e=>{if((0,d.k_)(e),null!=e.tile){const t=e.tile.key.id,{signal:s}=e,r=(0,n.Z)("esri-tiles-debug")?{tile:t.replaceAll("/","."),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,d.k_)(e),null!=e.tile){const t=e.tile.key.id,{signal:s}=e,r=(0,n.Z)("esri-tiles-debug")?{tile:t.replaceAll("/","."),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()}enqueueQuery(e,t){return this.updatingHandles.addPromise(this._queue.push(e,t))}enqueuePatchQuery(e,t){return this.updatingHandles.addPromise(this._patchQueue.push(e,t))}get maxRecordCountFactor(){const{query:e}=this._serviceInfo.capabilities;return e.supportsMaxRecordCountFactor?4:null}get maxPageSize(){const{query:e}=this._serviceInfo.capabilities;return(e.maxRecordCount??8e3)*(this.maxRecordCountFactor??1)}get pageSize(){return Math.min(8e3,this.maxPageSize)}enableEvent(e,t){}subscribe(e,t){const s=super.subscribe(e,t);return this._fetchDataTile(e).catch((t=>{(0,d.D_)(t)||v.Z.getLogger("esri.views.2d.layers.features.sources.BaseFeatureSource").error(new x.Z("mapview-query-error","Encountered error when fetching tile",{tile:e,error:t}))})),s}unsubscribe(e){super.unsubscribe(e)}readers(e){return this._subscriptions.get(e).readers()}async query(e,t={}){const s=t.query??{};return this._adapter.executeQuery(e,{...t,query:{...s,...this._schema?.customParameters}})}async queryLastEditDate(){const e=this._serviceInfo.source,t={...e.query,f:"json"};return(await(0,b.Z)(e.path,{query:t,responseType:"json"})).data.editingInfo.lastEditDate}createTileQuery(e,t={}){const s=this._serviceInfo.geometryType,r=this.createQuery(t);r.quantizationParameters=t.quantizationParameters??e.getQuantizationParameters(),r.resultType="tile",r.geometry=e.extent,this._serviceInfo.capabilities.query.supportsQuantization?"esriGeometryPolyline"===s&&(r.maxAllowableOffset=e.resolution*(0,n.Z)("feature-polyline-generalization-factor")):"esriGeometryPolyline"!==s&&"esriGeometryPolygon"!==s||(r.maxAllowableOffset=e.resolution,"esriGeometryPolyline"===s&&(r.maxAllowableOffset*=(0,n.Z)("feature-polyline-generalization-factor")));const i=this._serviceInfo.capabilities.query;return r.defaultSpatialReferenceEnabled=i.supportsDefaultSpatialReference,r.compactGeometryEnabled=i.supportsCompactGeometry,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=null!=i.start?i.start/8e3:0,o=r.signal;return await this.enqueuePatchQuery({tile:e,query:i,signal:o,depth:n})}async _resend(e,t){const{query:s,message:r}=e,i=null!=s.outFields?s.outFields:[],n=this._queryInfo.outFields,o=n.filter((e=>!i.includes(e)));if(null!=r.addOrUpdate)if(o.length)try{const e=this._subscriptions.get(r.id).tile,i=await this._executePatchQuery(e,s,o,t);(0,d.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"});else this._onMessage({...r,type:"append"})}async _resendSubscription(e){if((0,n.Z)("esri-2d-update-debug")&&console.debug(e.tile.id,"Resend Subscription"),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 null!=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 ne=(0,n.Z)("esri-mobile"),oe={maxDrillLevel:ne?1:4,maxRecordCountFactor:ne?1:3};class ae extends ie{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,u=this.createTileQuery(a,{maxRecordCountFactor:t?oe.maxRecordCountFactor:void 0,returnExceededLimitFeatures:!1,quantizationParameters:i});n++;try{const t=await this.enqueueQuery({tile:e,query:u,signal:r,depth:h});if(n--,(0,d.k_)(r),!t)return;if(l!==this._queryInfo)return void o(a,h);if(t.exceededTransferLimit&&h<oe.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:u,message:i}),this._onMessage(i)}catch(t){if(!(0,d.D_)(t)){const t={id:e.id,addOrUpdate:null,end:!0,type:"append"};s.add({query:u,message:t}),this._onMessage(t)}}};o(e,0)}}class he extends ie{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,d.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((i=>{if(s=!0,!(0,d.D_)(i)){v.Z.getLogger("esri.views.2d.layers.features.sources.PagedFeatureSource").error(new x.Z("mapview-query-error","Encountered error when fetching tile",{tile:e,error:i}));const n={id:e.id,addOrUpdate:null,end:s,type:"append"},o={start:this.pageSize*r,num:this.pageSize,returnExceededLimitFeatures:!0,quantizationParameters:e.getQuantizationParameters()};null!=this.maxRecordCountFactor&&(o.maxRecordCountFactor=this.maxRecordCountFactor);const a=this.createTileQuery(e,o);t.add({message:n,query:a}),this._onMessage(n)}}))}await a,(0,d.k_)(t),o=Math.min(o+2,6)}}async _fetchDataTilePage(e,t,s){(0,d.k_)(s);const r=this._queryInfo,i={start:this.pageSize*t,num:this.pageSize,returnExceededLimitFeatures:!0,quantizationParameters:e.getQuantizationParameters()};null!=this.maxRecordCountFactor&&(i.maxRecordCountFactor=this.maxRecordCountFactor);const n=this.createTileQuery(e,i);try{const i=s.signal,o=await this.enqueueQuery({tile:e,query:n,signal:i,depth:t});return(0,d.k_)(s),o?r!==this._queryInfo?this._fetchDataTilePage(e,t,s):{reader:o,query:n}:null}catch(e){return(0,d.H9)(e),null}}}var le=s(77734),ue=s(61800);function ce(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 de(e,t){if(null==e)return null;const s=t.transform,r=e.getQuantizationTransform();if(null==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,c]=s.translate,d=i/h,g=(o-u)/h,p=n/l,_=(-a+c)/l;return e.transform(g,_,d,p)}let ge=class extends ie{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 le.Z(1e3),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._featureCount??=t.initialFeatureCount,null!=t.changedFeatureCount&&(this._featureCount=t.changedFeatureCount),this._hasAggregates=!!e.targets?.aggregate}async resend(e=!1){if(await this._downloadPromise,this._invalidated||e){const e=this._featureCount;return(0,E.O3)(e,"Expected featureCount to be defined"),this._invalidated=!1,this._subscriptions.forEach((e=>e.clear())),this._downloadPromise=this._download(e),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(e,t){t&&(this._featureCount=t.featureCount),await this.resend(!0)}async _sendPatchQuery(e,t){const s=null!=e.outFields?e.outFields:[],r=this._queryInfo.outFields,i=r.filter((e=>!s.includes(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.enqueueQuery({query:n,depth:0,signal:o});(0,d.k_)({signal:o}),t.joinAttributes(a)}async _fetchDataTile(e){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=de(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,d.e4)(1),this._onMessage(n)}const i=de(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){v.Z.getLogger("esri.views.2d.layers.features.sources.SnapshotFeatureSource").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};null!=this.maxRecordCountFactor&&(i.maxRecordCountFactor=this.maxRecordCountFactor);const n=this.createQuery(i),o=this._signal,a=await this.enqueueQuery({query:n,depth:e,signal:o});(0,d.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=>{const n=e.tile;s.set(n.key.id,null),t=n.tileInfoView,r.add(n.level);const{row:o,col:a}=n.key,h=`${n.level}/${o}/${a}`,l=i.get(h)??[];l.push(e),i.set(h,l)}));for(const n of r){const r=t.getLODInfoAt(n),o=e.getCursor();for(;o.next();){const e=ce(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);null==i&&(i=[],s.set(e,i)),i.push(t)}}}s.forEach(((t,s)=>{if(null!=t){const r=this._subscriptions.get(s),i={type:"append",id:s,addOrUpdate:de(ue.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}};ge=(0,r._)([(0,l.j)("esri.view.2d.layers.features.sources.SnapshotFeatureSource")],ge);var pe=s(50758),_e=s(96794),fe=s(22021);const me="__esri_timestamp__";class ye{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}removeById(e){this._removed.push(e)}removeByTrackId(e){const t=this._trackIdToObservations.get(e);if(t)for(const e of t.entries)this._removed.push(e)}add(e){if(this._useGeneratedIds){const t=this._nextId();e.attributes[this.objectIdField]=t,e.objectId=t}else e.objectId=e.attributes[this.objectIdField];const t=e.objectId;if(this._addOrUpdated.set(t,e),this._maxAge=Math.max(this._maxAge,e.attributes[this._timeInfo.startTimeField]),!this._timeInfo.trackIdField)return null==this._trackIdLessObservations&&(this._trackIdLessObservations=new K.Z(1e5)),void this._trackIdLessObservations.enqueue(t);const s=e.attributes[this._timeInfo.trackIdField];if(!this._trackIdToObservations.has(s)){const e=null!=this._purgeOptions?.maxObservations?this._purgeOptions.maxObservations:1e3,t=(0,fe.uZ)(e,0,1e3);this._trackIdToObservations.set(s,new K.Z(t))}const r=this._trackIdToObservations.get(s),i=r?.enqueue(t);null!=i&&(this._addOrUpdated.has(i)?this._addOrUpdated.delete(i):this._removed.push(i))}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(null!=t)for(const e of t){const t=this.store.removeById(e);null!=t&&r.push(t)}const i=[];if(null!=e){const r=new Set(t??[]);for(const t of e)r.has(t.objectId)||(t.attributes[me]=s,this.store.add(t),i.push(t))}(i.length||r?.length)&&this.store.update(i,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;null!=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=s.dequeue();this._removed.push(e),t--}if(null!=this._trackIdLessObservations){let s=t-e.displayCount;for(;s-- >0;){const e=this._trackIdLessObservations.dequeue();null!=e&&this._removed.push(e)}}}}_purgeByAge(e){const t=this._timeInfo?.startTimeField;if(!e.age||!t)return;const s=60*e.age*1e3,r=this._maxAge-s;this.store.forEach((e=>{e.attributes[t]<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[me]<s&&this._removed.push(e.objectId)}))}_purgeTracks(){this._trackIdToObservations.forEach(((e,t)=>{0===e.size&&this._trackIdToObservations.delete(t)}))}}var Ie=s(95047);let be=class extends i.Z{constructor(e){super(e)}get connectionStatus(){return this.connection?.connectionStatus}get errorString(){return this.connection?.errorString}};function xe(e,t){const s=e.weakClone();if(null!=e.geometry){const r=(0,p.Jd)(t,e.geometry.coords[0]),i=(0,p.IN)(t,e.geometry.coords[1]);s.geometry=new O.Z([],[r,i])}return s}(0,r._)([(0,a.Cb)()],be.prototype,"connection",void 0),(0,r._)([(0,a.Cb)()],be.prototype,"connectionStatus",null),(0,r._)([(0,a.Cb)()],be.prototype,"errorString",null),be=(0,r._)([(0,l.j)("esri.views.2d.layers.features.sources.StreamConnectionState")],be);class ve{constructor(e,t){this.onUpdate=e,this._geometryType=t,this._objectIdToFeature=new Map,this._index=null}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,_e.r)(9,function(e){return"esriGeometryPoint"===e?e=>null!=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 null!=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)}clear(){this._index=null,this._objectIdToFeature.clear()}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 Se extends se{constructor(e){super(e),this.type="stream",this._updateIntervalId=0,this._level=0,this._isPaused=!1,this._updateInfo={websocket:0,client:0},this._inUpdate=!1;const{outSR:t}=e,{geometryType:s,objectIdField:r,timeInfo:i,purgeOptions:n,source:o,spatialReference:a,serviceFilter:h,maxReconnectionAttempts:l,maxReconnectionInterval:u,updateInterval:c,customParameters:d,enabledEventTypes:g}=e.serviceInfo,_=new ve(this._onUpdate.bind(this),s),f=new ye(_,r,i,n),m=(0,Ie.createConnection)(o,a,t,s,h,l,u,d??{});var y;this._connectionState=new be({connection:m}),this._store=_,this._manager=f,this._connection=m,this._quantize="esriGeometryPoint"===(y=s)?xe:(e,t)=>{const s=e.weakClone(),r=new O.Z,i=(0,p.Nh)(r,e.geometry,!1,!1,y,t,!1,!1);return s.geometry=i,s},this._enabledEventTypes=new Set(g),this._handlesGroup=(0,pe.AL)([this._connection.on("data-received",(e=>this._onFeature(e))),this._connection.on("message-received",(e=>this._onWebSocketMessage(e)))]),this._initUpdateInterval=()=>{let t=performance.now();this._updateIntervalId=setInterval((()=>{const s=performance.now(),r=s-t;if(r>2500){t=s;const e=Math.round(this._updateInfo.client/(r/1e3)),i=Math.round(this._updateInfo.websocket/(r/1e3));this._updateInfo.client=0,this._updateInfo.websocket=0,this.events.emit("updateRate",{client:e,websocket:i})}e.canAcceptRequest()&&!this._inUpdate&&this._manager.checkForUpdates()}),c)},this._isPaused=e.serviceInfo.isPaused,this._isPaused||this._initUpdateInterval()}destroy(){super.destroy(),this._clearUpdateInterval(),this._connection.destroy(),this._handlesGroup?.remove()}_fetchDataTile(){}get connectionStatus(){return this._connectionState.connectionStatus}get errorString(){return this._connectionState.errorString}updateCustomParameters(e){this._connection.updateCustomParameters(e)}pauseStream(){this._isPaused||(this._isPaused=!0,this._clearUpdateInterval())}resumeStream(){this._isPaused&&(this._isPaused=!1,this._initUpdateInterval())}sendMessageToSocket(e){this._connection.sendMessageToSocket(e)}sendMessageToClient(e){this._isPaused&&"type"in e&&"clear"===e.type?(this._store.clear(),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,clear:!0,end:!0})}))):this._connection.sendMessageToClient(e)}enableEvent(e,t){t?this._enabledEventTypes.add(e):this._enabledEventTypes.delete(e)}subscribe(e,t){const s=super.subscribe(e,t);this._level=e.level;const r=this._getTileFeatures(e);return this._onMessage({type:"append",id:e.key.id,addOrUpdate:r,end:!0}),s.didSend=!0,s}unsubscribe(e){super.unsubscribe(e)}*readers(e){const t=this._subscriptions.get(e),{tile:s}=t;yield this._getTileFeatures(s)}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 M.fromOptimizedFeatures(t,this._arcadeLayerSchema,e.transform)}_onWebSocketMessage(e){if(this._enabledEventTypes.has("message-received")&&this.events.emit("message-received",e),"type"in e)switch(e.type){case"delete":if(e.objectIds)for(const t of e.objectIds)this._manager.removeById(t);if(e.trackIds)for(const t of e.trackIds)this._manager.removeByTrackId(t);break;case"clear":this._store.forEach((e=>this._manager.removeById(e.objectId)))}}_onFeature(e){this._updateInfo.websocket++;try{this._enabledEventTypes.has("data-received")&&this.events.emit("data-received",e);const t=(0,p.XA)(e,this._serviceInfo.geometryType,!1,!1,this._serviceInfo.objectIdField);this._manager.add(t)}catch(e){}}_clearUpdateInterval(){clearInterval(this._updateIntervalId),this._updateIntervalId=0}async _onUpdate(e,t){this._inUpdate=!0;try{null!=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})}));const t=[];this._subscriptions.forEach(((e,s)=>{if(!e.didSend||e.tile.level!==this._level)return;const r=e.tile,i={type:"append",id:s,addOrUpdate:this._getTileFeatures(r),remove:[],end:!1,status:ee.empty()};e.requests.stream.enqueue(i),t.push(this._onMessage(i))})),await Promise.all(t),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,end:!0})}))}catch{}this._inUpdate=!1}}var we=s(16534),Te=s(61027),Ce=s(26899);s(37720),s(66039);var Fe=s(35371);const Ae=v.Z.getLogger("esri.views.layers.2d.features.support.AttributeStore"),Me=()=>null,Ee={sharedArrayBuffer:(0,n.Z)("esri-shared-array-buffer"),atomics:(0,n.Z)("esri-atomics")};function ke(e,t){return s=>t(e(s))}class Oe{constructor(e,t,s,r){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;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 this.data?.buffer}unsetComponentAllTexels(e,t){const s=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=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=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){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){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=(0,Te.jL)(e);return this.data[s*this.texelSize+t]}setData(e,t,s){const r=(0,Te.jL)(e),i=1<<t;0!=(this.layout&i)?null!=this.data&&(this.data[r*this.texelSize+t]=s,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)):Ae.error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}lock(){this.pixelType===Fe.Br.UNSIGNED_BYTE&&this._shared&&Ee.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,1)}unlock(){this.pixelType===Fe.Br.UNSIGNED_BYTE&&this._shared&&Ee.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=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=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,Ce.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 Pe{constructor(e,t){this._client=e,this.config=t,this.updatingHandles=new g.R,this._blocks=new Array,this._filters=new Array(we.NS),this._attributeComputeInfo=null,this._targetType=0,this._abortController=new AbortController,this._hasScaleExpr=!1,this._size=32,this._nextUpdate=null,this._currUpdate=null,this._idsToHighlight=new Set;const s=t.supportsTextureFloat?Fe.Br.FLOAT:Fe.Br.UNSIGNED_BYTE;Me(`Creating AttributeStore ${Ee.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:Fe.Br.UNSIGNED_BYTE,layout:1},{pixelType:Fe.Br.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:Fe.Br.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:s,layout:15},{pixelType:s,layout:15},{pixelType:s,layout:15},{pixelType:s,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}destroy(){this._abortController.abort(),this.updatingHandles.destroy()}get hasScaleExpr(){return this._hasScaleExpr}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}isUpdating(){const e=this.updatingHandles.updating||!!this._nextUpdate;return(0,n.Z)("esri-2d-log-updating")&&console.log(`Updating AttributeStore: ${e}\n -> updatingHandles ${this.updatingHandles.updating} (currUpdate: ${!!this._currUpdate})\n -> nextUpdate: ${!!this._nextUpdate}\n`),e}update(e,t){this.config=t;const s=t.schema.processors[0].storage,r=(0,J.Hg)(this._schema,s);if((e.targets.feature||e.targets.aggregate)&&(e.storage.data=!0),r&&((0,n.Z)("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:",r),e.storage.data=!0,this._schema=s,this._attributeComputeInfo=null,null!=s)){switch(s.target){case"feature":this._targetType=Te.mi;break;case"aggregate":this._targetType=Te.QC}if("subtype"===s.type){this._attributeComputeInfo={isSubtype:!0,subtypeField:s.subtypeField,map:new Map};for(const e in s.mapping){const t=s.mapping[e];if(null!=t?.vvMapping)for(const s of t.vvMapping)this._bindAttribute(s,parseInt(e,10))}}else{if(this._attributeComputeInfo={isSubtype:!1,map:new Map},null!=s.vvMapping)for(const e of s.vvMapping)this._bindAttribute(e);if(null!=s.attributeMapping)for(const e of s.attributeMapping)this._bindAttribute(e)}}}onTileData(e,t){if(null==t.addOrUpdate)return;const s=t.addOrUpdate.getCursor();for(;s.next();){const e=s.getDisplayId();this.setAttributeData(e,s)}}async setHighlight(e,t){const s=this._getBlock(0),r=t.map((e=>(0,Te.jL)(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,s){(0,n.Z)("esri-2d-update-debug")&&console.debug("AttributeStore::updateFilters");const{service:r,spatialReference:i}=s,{filters:o}=t,a=o.map(((e,t)=>this._updateFilter(e,t,r,i))),h=(await Promise.all(a)).some((e=>e));(0,n.Z)("esri-2d-update-debug")&&console.debug("AttributeStore::updateFilters - finsihed"),h&&(e.storage.filters=!0,(0,n.Z)("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:","Filters changed"))}setData(e,t,s,r){const i=(0,Te.jL)(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)?we.BB:0}unsetAttributeData(e){const t=(0,Te.jL)(e);this._getBlock(0).setData(t,0,0)}setAttributeData(e,t){const s=(0,Te.jL)(e);if(this._ensureSizeForTexel(s),this._getBlock(0).setData(s,0,this.getFilterFlags(t)),this._targetType!==(0,Te.vs)(e))return;const r=this._attributeComputeInfo,i=this.config.supportsTextureFloat?1:2;let n=null;r&&(n=r.isSubtype?r.map.get(t.readAttribute(r.subtypeField)):r.map,n?.size&&n.forEach(((e,r)=>{const n=r*i%4,o=Math.floor(r*i/4),a=this._getBlock(o+we.mb),h=e(t);if(this.config.supportsTextureFloat)a.setData(s,n,h);else if(h===we.k9)a.setData(s,n,255),a.setData(s,n+1,255);else{const e=(0,fe.uZ)(Math.round(h),-32767,32766)+32768,t=255&e,r=(65280&e)>>8;a.setData(s,n,t),a.setData(s,n+1,r)}})))}sendUpdates(){if((0,n.Z)("esri-2d-update-debug")&&console.debug("AttributeStore::sendUpdate"),this._nextUpdate)return this._nextUpdate.promise;if(this._currUpdate)return this._nextUpdate=(0,d.hh)(),this.updatingHandles.addPromise(this._nextUpdate.promise),this._nextUpdate.promise;const e={blocks:this._blocks.map((e=>null!=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()))}else(0,n.Z)("esri-2d-update-debug")&&console.debug("AttributeStore::sendUpdate::No additional updates queued")};(0,n.Z)("esri-2d-update-debug")&&console.debug("AttributeStore::sendUpdate::client.update");const s=this.updatingHandles.addPromise(this._client.update(e,this._signal).then(t).catch(t));return this._client.render(this._signal),s})).catch((e=>{if((0,d.D_)(e))return this._createResourcesPromise=null,this._createResources();Ae.error(new x.Z("mapview-attribute-store","Encountered an error during client update",e))})),this._currUpdate}_ensureSizeForTexel(e){for(;e>=this._size*this._size;)if(this._expand())return}_bindAttribute(e,t){let s;if(null!=e.fieldIndex)e.normalizationField&&Ae.warn("mapview-arcade","Ignoring normalizationField specified with an arcade expression which is not supported."),s=t=>t.getComputedNumericAtIndex(e.fieldIndex);else{if(!e.field)return;s=function(){const{normalizationField:t}=e;return t?s=>{const r=s.readAttribute(t);return r?s.readAttribute(e.field)/r:null}:t=>t.readAttribute(e.field)}()}const{valueRepresentation:r}=e;r&&(s=ke(s,(e=>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}(e,r))));const i=e=>null===e||isNaN(e)||e===1/0||e===-1/0?we.k9:e,n=this._attributeComputeInfo;if(n.isSubtype){const r=n.map.get(t)??new Map;r.set(e.binding,ke(s,i)),n.map.set(t,r)}else n.map.set(e.binding,ke(s,i))}_createResources(){if(null!=this._createResourcesPromise)return this._createResourcesPromise;this._getBlock(we.S),this._getBlock(we.U8),Me("Initializing AttributeStore");const e={shared:Ee.sharedArrayBuffer&&!("local"===this._client.type),size:this._size,blocks:this._blocks.map((e=>null!=e?{textureOnly:e.textureOnly,buffer:e.buffer,pixelType:e.pixelType}:null))},t=this._client.initialize(e,this._signal).catch((e=>{(0,d.D_)(e)?this._createResourcesPromise=null:Ae.error(new x.Z("mapview-attribute-store","Encountered an error during client initialization",e))}));return this._createResourcesPromise=t,t.then((()=>null==this._createResourcesPromise?this._createResources():void 0)),t}_getBlock(e){const t=this._blocks[e];if(null!=t)return t;Me(`Initializing AttributeBlock at index ${e}`);const s=Ee.sharedArrayBuffer,r=this._client.type,i=new Oe(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;Me("Expanding block size to",e,this._blocks);for(const t of this._blocks)t?.expand(e);return this._createResourcesPromise=null,this._size=e,0}return Ae.error(new x.Z("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}async _updateFilter(e,t,s,r){const i=this._filters[t],n=null!=i&&i.hash;if(!i&&!e)return!1;if(n===JSON.stringify(e))return!1;if(null==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(null!=r)return r;const{default:i}=await s.e(9169).then(s.bind(s,29169)),n=new i({geometryType:t.geometryType,hasM:!1,hasZ:!1,timeInfo:t.timeInfo,fieldsIndex:f.Z.fromJSON(t.fieldsIndex)});return this._filters[e]=n,n}isVisible(e){return!!(2&this._getBlock(0).getData(e,0))}getFilterFlags(e){let t=0;const s=(0,Te.KS)(e.getDisplayId());for(let r=0;r<this._filters.length;r++){const i=!!(s&1<<r),n=this._filters[r];t|=(!i||null==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}}s(66577);var Re=s(84864),Le=s(82971),ze=s(37427);class Ne{constructor(e=[],t,s=8096){this.onRelease=e=>{},this._nodes=0,this._root=new Ue(this,0,0,0),this._statisticFields=e,this._pool=s?new K.Z(8096):null,this._serviceInfo=t}destroy(){this.clear()}_acquire(e,t,s){this._nodes++;let r=null;return null!=this._pool&&(r=this._pool.dequeue()),null!=r?r.realloc(e,t,s):r=new Ue(this,e,t,s),r}_release(e){this.onRelease(e),this._nodes--,null!=this._pool&&this._pool.enqueue(e)}get count(){return this._root.count}get size(){return this._nodes}get poolSize(){return this._pool?.size??0}get depth(){let e=0;return this.forEach((t=>e=Math.max(e,t.depth))),e}dropLevels(e){this.forEach((t=>{if(t.depth>=e)for(let e=0;e<t.children.length;e++){const s=t.children[e];s&&this._release(s)}})),this.forEach((t=>{if(t.depth>=e)for(let e=0;e<t.children.length;e++)t.children[e]=null}))}clear(){this.forEach((e=>this._release(e))),this._root=new Ue(this,0,0,0)}insert(e,t,s=0){const r=M.fromOptimizedFeatures([e],this._serviceInfo).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,u=0,c=0;for(;null!==h;){if(h.depth>=a&&(h.count+=1,h.xTotal+=s,h.yTotal+=r,h.xGeohashTotal+=i,h.yGeohashTotal+=n,h.referenceId=t,this._updateStatisticsCursor(e,h,1)),l>=o)return void h.add(t);const d=Math.ceil((l+1)/2),g=Math.floor((l+1)/2),p=1-l%2,_=30-(3*d+2*g),f=30-(2*d+3*g),m=(i&7*p+3*(1-p)<<_)>>_,y=(n&3*p+7*(1-p)<<f)>>f,I=m+y*(8*p+4*(1-p));u=u<<3*p+2*(1-p)|m,c=c<<2*p+3*(1-p)|y,null==h.children[I]&&(h.children[I]=this._acquire(u,c,l+1)),l+=1,h=h.children[I]}}remove(e,t){const s=M.fromOptimizedFeatures([e],this._serviceInfo).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),u=1-a%2,c=30-(3*h+2*l),d=30-(2*h+3*l),g=((r&7*u+3*(1-u)<<c)>>c)+((i&3*u+7*(1-u)<<d)>>d)*(8*u+4*(1-u)),p=o.children[g];1===p?.count&&(this._release(p),o.children[g]=null),a+=1,o=p}}forEach(e){let t=this._root;for(;null!==t;){const s=this._linkChildren(t)||t.next;e(t),t=s}}find(e,t,s){return this._root.find(e,t,s,0,0,0)}findIf(e){let t=null;return this.forEach((s=>{e(s)&&(t=s)})),t}findAllIf(e){const t=[];return this.forEach((s=>{e(s)&&t.push(s)})),t}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,u=n.xGeohashTotal/n.count,c=n.yGeohashTotal/n.count;if(1===n.count&&e<u&&u<=s&&t<c&&c<=r)return n;if(o>=i){n=n.next;continue}const d=Math.ceil((o+1)/2),g=Math.floor((o+1)/2),p=30-(3*d+2*g),_=30-(2*d+3*g),f=~((1<<p)-1),m=~((1<<_)-1),y=(e&f)>>p,I=(t&m)>>_,b=(s&f)>>p,x=(r&m)>>_,v=a<<3*l+2*(1-l),S=h<<2*l+3*(1-l),w=v+8*l+4*(1-l),T=S+4*l+8*(1-l),C=Math.max(v,y),F=Math.max(S,I),A=Math.min(w,b),M=Math.min(T,x);let E=null,k=null;for(let e=F;e<=M;e++)for(let t=C;t<=A;t++){const s=t-v+(e-S)*(8*l+4*(1-l)),r=n.children[s];r&&(E||(E=r,E.next=n.next),k&&(k.next=r),k=r,r.next=n.next)}n=E||n.next}return null}getRegionDisplayIds(e){let t=this._root;const{bounds:s,geohashBounds:r,level:i}=e,[n,o,a,h]=s,l=[];for(;null!==t;){const e=t.depth,s=t.xNode,u=t.yNode;if(e>=i){const e=t.xTotal/t.count,s=t.yTotal/t.count;e>=n&&e<=a&&s>=o&&s<=h&&t.displayIds.forEach((e=>l.push(e))),t=t.next;continue}const c=Math.ceil((e+1)/2),d=Math.floor((e+1)/2),g=1-e%2,p=30-(3*c+2*d),_=30-(2*c+3*d),f=~((1<<p)-1),m=~((1<<_)-1),y=(r.xLL&f)>>p,I=(r.yLL&m)>>_,b=(r.xTR&f)>>p,x=(r.yTR&m)>>_,v=s<<3*g+2*(1-g),S=u<<2*g+3*(1-g),w=v+8*g+4*(1-g),T=S+4*g+8*(1-g),C=Math.max(v,y),F=Math.max(S,I),A=Math.min(w,b),M=Math.min(T,x);let E=null,k=null;for(let e=F;e<=M;e++)for(let s=C;s<=A;s++){const r=s-v+(e-S)*(8*g+4*(1-g)),i=t.children[r];i&&(E||(E=i,E.next=t.next),k&&(k.next=i),k=i,i.next=t.next)}t=E||t.next}return l}getRegionStatistics(e){let t=this._root,s=0,r=0,i=0;const n={},{bounds:o,geohashBounds:a,level:h}=e,[l,u,c,d]=o;let g=0;for(;null!==t;){const e=t.depth,o=t.xNode,p=t.yNode;if(e>=h){const e=t.xTotal/t.count,o=t.yTotal/t.count;e>l&&e<=c&&o>u&&o<=d&&(s+=t.count,r+=t.xTotal,i+=t.yTotal,1===t.count&&(g=t.referenceId),this._aggregateStatistics(n,t.statistics)),t=t.next;continue}const _=Math.ceil((e+1)/2),f=Math.floor((e+1)/2),m=1-e%2,y=30-(3*_+2*f),I=30-(2*_+3*f),b=~((1<<y)-1),x=~((1<<I)-1),v=(a.xLL&b)>>y,S=(a.yLL&x)>>I,w=(a.xTR&b)>>y,T=(a.yTR&x)>>I,C=o<<3*m+2*(1-m),F=p<<2*m+3*(1-m),A=C+8*m+4*(1-m),M=F+4*m+8*(1-m),E=Math.max(C,v),k=Math.max(F,S),O=Math.min(A,w),P=Math.min(M,T);let R=null,L=null;for(let e=k;e<=P;e++)for(let o=E;o<=O;o++){const a=o-C+(e-F)*(8*m+4*(1-m)),h=t.children[a];if(h){if(e!==k&&e!==P&&o!==E&&o!==O){const e=h.xTotal/h.count,t=h.yTotal/h.count;e>l&&e<=c&&t>u&&t<=d&&(s+=h.count,r+=h.xTotal,i+=h.yTotal,1===h.count&&(g=h.referenceId),this._aggregateStatistics(n,h.statistics));continue}R||(R=h,R.next=t.next),L&&(L.next=h),L=h,h.next=t.next}}t=R||t.next}return{count:s,attributes:this.normalizeStatistics(n,s),xTotal:r,yTotal:i,referenceId:g}}getBins(e){const t=[],{geohashBounds:s,level:r}=e;let i=this._root;for(;null!==i;){const e=i.depth,n=i.xNode,o=i.yNode;if(e>=r){t.push(i),i=i.next;continue}const a=Math.ceil((e+1)/2),h=Math.floor((e+1)/2),l=1-e%2,u=30-(3*a+2*h),c=30-(2*a+3*h),d=~((1<<u)-1),g=~((1<<c)-1),p=(s.xLL&d)>>u,_=(s.yLL&g)>>c,f=(s.xTR&d)>>u,m=(s.yTR&g)>>c,y=n<<3*l+2*(1-l),I=o<<2*l+3*(1-l),b=y+8*l+4*(1-l),x=I+4*l+8*(1-l),v=Math.max(y,p),S=Math.max(I,_),w=Math.min(b,f),T=Math.min(x,m);let C=null,F=null;for(let e=S;e<=T;e++)for(let t=v;t<=w;t++){const s=t-y+(e-I)*(8*l+4*(1-l)),r=i.children[s];r&&(C||(C=r,C.next=i.next),F&&(F.next=r),F=r,r.next=i.next)}i=C||i.next}return t}_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"min":{if(isNaN(n))break;if(!t.statistics[i]){t.statistics[i]={value:n};break}const e=t.statistics[i].value;t.statistics[i].value=Math.min(e,n);break}case"max":{if(isNaN(n))break;if(!t.statistics[i]){t.statistics[i]={value:n};break}const e=t.statistics[i].value;t.statistics[i].value=Math.max(e,n);break}case"count":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??0;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??0,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"min":{if(!e[r]){e[r]={value:t[r].value};break}const s=e[r].value;e[r].value=Math.min(s,t[r].value);break}case"max":{if(!e[r]){e[r]={value:t[r].value};break}const s=e[r].value;e[r].value=Math.max(s,t[r].value);break}case"count":break;case"sum":case"avg":case"avg_angle":case"mode":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"min":case"max":{const r=e[i];if(!t||!r)break;s[i]=r.value;break}case"count":if(!t)break;s[i]=t;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,u=Math.atan2(h,a)*l;s[i]=u;break}case"mode":{const t=e[i];let r=0,n=0,o=null;for(const e in t){const s=t[e];s===r?n+=1:s>r&&(r=s,n=1,o=e)}s[i]="null"===o||n>1?null:o;break}}}return s}}class Ue{constructor(e,t,s,r){this.count=0,this.xTotal=0,this.yTotal=0,this.statistics={},this.displayId=0,this.referenceId=0,this.displayIds=new Set,this.next=null,this.depth=0,this.xNode=0,this.yNode=0,this.xGeohashTotal=0,this.yGeohashTotal=0,this._tree=e,this.children=new Array(32);for(let e=0;e<this.children.length;e++)this.children[e]=null;this.xNode=t,this.yNode=s,this.depth=r}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.displayId=0,this.referenceId=0,this.xTotal=0,this.yTotal=0,this.count=0,this.statistics={},this.displayIds.clear(),this}get id(){return`${this.xNode}.${this.yNode}`}add(e){this.displayIds.add(e)}remove(e){this.displayIds.delete(e)}getAttributes(){const e=this._tree.normalizeStatistics(this.statistics,this.count);return e.referenceId=null,e.aggregateId=this.id,e.aggregateCount=this.count,e}getGeometry(e,t){const s=this.getLngLatBounds(),[r,i,n,o]=s,a=(0,ze.iV)({rings:[[[r,i],[r,o],[n,o],[n,i],[r,i]]]},Le.Z.WGS84,e),h=(0,p.Uy)(new O.Z,a,!1,!1);return null!=t?(0,p.Nh)(new O.Z,h,!1,!1,"esriGeometryPolygon",t,!1,!1):h}getGeometryCentroid(e,t){const s=this.getLngLatBounds(),[r,i,n,o]=s,a=(0,ze.iV)({x:(r+n)/2,y:(i+o)/2},Le.Z.WGS84,e),h=(0,p.dd)(new O.Z,a);return null!=t?(0,p.Nh)(new O.Z,h,!1,!1,"esriGeometryPoint",t,!1,!1):h}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),n=this.xNode<<r,o=this.yNode<<i;return(0,Re.bU)({geohashX:n,geohashY:o},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,u=30-n-h,c=((e&7*o+3*(1-o)<<l)>>l)+((t&3*o+7*(1-o)<<u)>>u)*(8*o+4*(1-o)),d=this.children[c];return null==d?null:d.find(e,t,s,r+1,i+a,n+h)}}var Ze=s(60437),Be=s(68441),De=s(59999),qe=s(38913),Ge=s(6570);const je=v.Z.getLogger("esri.view.2d.layers.features.support.BinStore"),He=(0,Ze.Ue)();function Qe(e){return 57.29577951308232*e}class Ye extends De.J{constructor(e,t,s,r){super(e,s),this.type="bin",this.events=new W.Z,this.objectIdField="aggregateId",this.featureAdapter=y.k,this._geohashLevel=5,this._geohashBuf=[],this._serviceInfo=r,this.geometryInfo=e.geometryInfo,this._spatialReference=t,this._projectionSupportCheck=(0,ze._W)(t,Le.Z.WGS84),this._bitsets.geohash=s.getBitset(s.createBitset()),this._bitsets.inserted=s.getBitset(s.createBitset())}destroy(){this._tree&&this._tree.destroy()}get featureSpatialReference(){return this._spatialReference}get fields(){return this._fields}async updateSchema(e,t){const s=this._schema;try{await super.updateSchema(e,t),await this._projectionSupportCheck}catch(e){}this._fields=this._schema.params.fields,this._fieldsIndex=new f.Z(this._fields);const r=(0,J.Hg)(s,t);t&&(null!=r||e.source||e.storage.filters)?(((0,J.uD)(r,"params.fields")||(0,J.uD)(r,"params")||!this._tree||e.source)&&(this._tree&&this._tree.destroy(),this._tree=new Ne(this._statisticFields,this._serviceInfo),this._tree.onRelease=e=>e.displayId&&this._storage.releaseDisplayId(e.displayId),this._geohashLevel=this._schema.params.fixedBinLevel,this._rebuildTree(),(0,n.Z)("esri-2d-update-debug")&&je.info("Aggregate mesh needs update due to tree changing")),(0,n.Z)("esri-2d-update-debug")&&je.info("Aggregate mesh needs update due to tree changing"),e.targets[t.name]=!0,e.mesh=!1):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)}}))}sweepAggregates(e,t,s){}onTileData(e,t,s,r,i,n=!0){if(!this._schema||null==t.addOrUpdate)return t;this.events.emit("changed");const o=this._getTransforms(e,this._spatialReference);{const e=t.addOrUpdate.getCursor();for(;e.next();)this._update(e,r)}if(t.status.mesh||!n)return t;const a=new Array;this._getBinsForTile(a,e,o,s),t.addOrUpdate=M.fromOptimizedFeatures(a,{fields:this.fields,fieldsIndex:this._fieldsIndex,geometryType:"esriGeometryPolygon",objectIdField:this.objectIdField}),t.addOrUpdate.attachStorage(s),t.end=!0,t.isRepush||(t.clear=!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,i)}}return t}forEachBin(e){this._tree.forEach(e)}forEach(e){this._tree.forEach((t=>{if(t.depth!==this._geohashLevel)return;const s=this._toFeatureJSON(t),r=M.fromFeatures([s],{objectIdField:this.objectIdField,globalIdField:null,geometryType:this.geometryInfo.geometryType,fields:this.fields,fieldsIndex:this._fieldsIndex}).getCursor();r.next(),e(r)}))}forEachInBounds(e,t){}forEachBounds(e,t){const{hasM:s,hasZ:r}=this.geometryInfo;for(const i of e){const e=(0,p.$)(He,i.readGeometry(),r,s);null!=e&&t(e)}}onTileUpdate(e){}getAggregate(e){const t=(0,Te.QS)(e,!0),s=this._tree.findIf((e=>e.displayId===t));return s?this._toFeatureJSON(s):null}getAggregates(){return this._tree.findAllIf((e=>e.depth===this._geohashLevel)).map(this._toFeatureJSON.bind(this))}getDisplayId(e){return this._tree.findIf((t=>t.id===e))?.displayId}getFeatureDisplayIdsForAggregate(e){const t=this._tree.findIf((t=>t.id===e));return null!=t?Array.from(t.displayIds):[]}getDisplayIdForReferenceId(e){return this._tree.findIf((t=>1===t.displayIds.size&&t.displayIds.has(e)))?.displayId}_toFeatureJSON(e){const t=this._spatialReference;return{displayId:e.displayId,attributes:e.getAttributes(),geometry:(0,p.di)(e.getGeometry(t),"esriGeometryPolygon",!1,!1),centroid:null}}_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=Qe(t/Be.sv.radius),n=i-360*Math.floor((i+180)/360),o=Qe(Math.PI/2-2*Math.atan(Math.exp(-s/Be.sv.radius)));(0,Re.tp)(r,e,o,n,12)}else{const i=(0,ze.iV)({x:t,y:s},this._spatialReference,Le.Z.WGS84);if(!i)return!1;(0,Re.tp)(r,e,i.y,i.x,12)}return this._bitsets.geohash.set(e),!0}_getBinsForTile(e,t,s,r){try{const i=this._getGeohashBounds(t),n=this._tree.getBins(i);for(const t of n){t.displayId||(t.displayId=r.createDisplayId(!0));let i=null;const n=t.getGeometry(this._spatialReference,s.tile);n||(i=t.getGeometryCentroid(this._spatialReference,s.tile));const o=new F.u_(n,t.getAttributes(),i);o.objectId=t.id,o.displayId=t.displayId,e.push(o)}}catch(e){return void je.error("Unable to get bins for tile",t.key.id)}}_getGeohash(e,t,s){const r={geohashX:0,geohashY:0};return(0,Re.v7)(r,t,e,s),r}_getGeohashBounds(e){const t=this._getGeohashLevel(e.key.level),s=[e.extent.xmin,e.extent.ymin,e.extent.xmax,e.extent.ymax],r=qe.Z.fromExtent(Ge.Z.fromBounds(s,this._spatialReference)),i=(0,ze.iV)(r,this._spatialReference,Le.Z.WGS84,{densificationStep:64*e.resolution}),n=(0,p.Uy)(new O.Z,i,!1,!1),o=n.coords.filter(((e,t)=>!(t%2))),a=n.coords.filter(((e,t)=>t%2)),h=Math.min(...o),l=Math.min(...a),u=Math.max(...o),c=Math.max(...a),d=this._getGeohash(h,l,t),g=this._getGeohash(u,c,t);return{bounds:s,geohashBounds:{xLL:d.geohashX,yLL:d.geohashY,xTR:g.geohashX,yTR:g.geohashY},level:t}}_getGeohashLevel(e){return this._schema.params.fixedBinLevel}_getTransforms(e,t){const s={originPosition:"upperLeft",scale:[e.resolution,e.resolution],translate:[e.bounds[0],e.bounds[3]]},r=(0,u.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]]}}}}const Xe=(0,Ze.Ue)();class Ve extends F.nd{constructor(e,t,s,r,i){super(new O.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{attributes:{...this.attributes,aggregateId:this.objectId,referenceId:1===this.attributes.cluster_count?this.referenceId:null},geometry:{x:this.geometry.coords[0],y:this.geometry.coords[1]}}}}function We(e){return 57.29577951308232*e}class Je extends De.J{constructor(e,t,s,r){super(e,s),this.type="cluster",this.events=new W.Z,this.objectIdField="aggregateId",this.featureAdapter=y.k,this._geohashLevel=0,this._tileLevel=0,this._aggregateValueRanges={},this._aggregateValueRangesChanged=!1,this._geohashBuf=[],this._clusters=new Map,this._tiles=new Map,this._serviceInfo=r,this.geometryInfo=e.geometryInfo,this._spatialReference=t,this._projectionSupportCheck=(0,ze._W)(t,Le.Z.WGS84),this._bitsets.geohash=s.getBitset(s.createBitset()),this._bitsets.inserted=s.getBitset(s.createBitset())}destroy(){this._tree.destroy()}get featureSpatialReference(){return this._spatialReference}get fields(){return this._fields}async updateSchema(e,t){const s=this._schema;try{await super.updateSchema(e,t),await this._projectionSupportCheck}catch(e){}this._fields=[...this._schema.params.fields,{name:"referenceId",alias:"referenceId",type:"esriFieldTypeInteger"}],!!this._fields.some((e=>"cluster_count"===e.name))||this._fields.push({name:"cluster_count",alias:"cluster_count",type:"esriFieldTypeInteger"}),this._fieldsIndex=new f.Z(this._fields);const r=(0,J.Hg)(s,t);t&&(null!=r||e.source||e.storage.filters)?(((0,J.uD)(r,"params.fields")||!this._tree||e.source)&&(this._tree&&this._tree.destroy(),this._tree=new Ne(this._statisticFields,this._serviceInfo),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)}}))}sweepAggregates(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,n=!0){if(!this._schema||null==t.addOrUpdate)return t;this.events.emit("changed");const o=this._getTransforms(e,this._spatialReference);{const e=t.addOrUpdate.getCursor();for(;e.next();)this._update(e,r)}if(t.status.mesh||!n)return t;const a=new Array,h=this._schema.params.clusterRadius;this._getClustersForTile(a,e,h,s,o),t.addOrUpdate=M.fromOptimizedFeatures(a,{fields:this.fields,fieldsIndex:this._fieldsIndex,geometryType:"esriGeometryPoint",objectIdField:this.objectIdField}),t.addOrUpdate.attachStorage(s),t.clear=!0,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,i)}}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){for(const t of this._clusters.values())if((t?.displayId&Te.Ht)==(e&Te.Ht))return t.toJSON();return null}getAggregates(){const e=[];for(const t of this._clusters.values())t?.tileLevel===this._tileLevel&&e.push(t.toJSON());return e}getDisplayId(e){const t=this._clusters.get(e);return t?t.displayId:null}getFeatureDisplayIdsForAggregate(e){const t=this._clusters.get(e);return t?this._tree.getRegionDisplayIds(t.geohashBoundsInfo):[]}getDisplayIdForReferenceId(e){for(const t of this._clusters.values())if(t?.referenceId===e)return t.displayId;return null}getAggregateValueRanges(){return this._aggregateValueRanges}forEach(e){this._clusters.forEach((t=>{if(!t)return;const s=t.toJSON(),r=M.fromFeatures([s],{objectIdField:this.objectIdField,globalIdField:null,geometryType:this.geometryInfo.geometryType,fields:this.fields,fieldsIndex:this._fieldsIndex}).getCursor();r.next(),e(r)}))}forEachInBounds(e,t){}forEachBounds(e,t){const{hasM:s,hasZ:r}=this.geometryInfo;for(const i of e){const e=(0,p.$)(Xe,i.readGeometry(),r,s);null!=e&&t(e)}}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=We(t/Be.sv.radius),n=i-360*Math.floor((i+180)/360),o=We(Math.PI/2-2*Math.atan(Math.exp(-s/Be.sv.radius)));(0,Re.tp)(r,e,o,n,12)}else{const i=(0,ze.iV)({x:t,y:s},this._spatialReference,Le.Z.WGS84);if(!i)return!1;(0,Re.tp)(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=Math.ceil(2**t.key.level*we.i9/a)+1,l=Math.ceil(o/a)+0,u=Math.ceil(we.i9/a),{row:c,col:d}=t.key,g=d*we.i9,_=c*we.i9,f=Math.floor(g/a)-l,m=Math.floor(_/a)-l,y=f+u+2*l,I=m+u+2*l,b=t.tileInfoView.getLODInfoAt(t.key.level);for(let s=f;s<=y;s++)for(let o=m;o<=I;o++){let a=s;b.wrap&&(a=s<0?s+h:s%h);const l=b.wrap&&s<0,u=b.wrap&&s%h!==s,c=this._lookupCluster(r,b,t.key.level,a,o,t);if(null!=c){let t=null;if(i&&(t=l?i.left:u?i.right:i.tile),n&&null==t)continue;if(!c.count)continue;if(null!=t&&n){const s=c.geometry.clone();let r=c.attributes;s.coords[0]=(0,p.Jd)(t,s.coords[0]),s.coords[1]=(0,p.IN)(t,s.coords[1]),1===c.count&&null!=c.referenceId&&(r={...c.attributes,referenceId:c.referenceId});const i=new F.u_(s,r);i.displayId=c.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,u.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.i9;e.wrap&&n<0&&(n=0),e.wrap&&a>l&&(a=l);const u=n/we.i9,c=o/we.i9,d=a/we.i9,g=h/we.i9;return[e.getXForColumn(u),e.getYForRow(c),e.getXForColumn(d),e.getYForRow(g)]}_getGeohash(e,t,s){const r={geohashX:0,geohashY:0};return(0,Re.v7)(r,t,e,s),r}_getGeohashBounds(e,t){const s=this._getGeohashLevel(e.key.level);if(this._spatialReference.isWebMercator){const[e,r,i,n]=t,o={x:e,y:r},a={x:i,y:n};let h=0,l=0,u=0,c=0;{const e=We(o.x/Be.sv.radius);h=e-360*Math.floor((e+180)/360),l=We(Math.PI/2-2*Math.atan(Math.exp(-o.y/Be.sv.radius)))}{const e=We(a.x/Be.sv.radius);u=e-360*Math.floor((e+180)/360),c=We(Math.PI/2-2*Math.atan(Math.exp(-a.y/Be.sv.radius)))}const d={geohashX:0,geohashY:0},g={geohashX:0,geohashY:0};return(0,Re.v7)(d,l,h,s),(0,Re.v7)(g,c,u,s),{bounds:[e,r,i,n],geohashBounds:{xLL:d.geohashX,yLL:d.geohashY,xTR:g.geohashX,yTR:g.geohashY},level:s}}const r=qe.Z.fromExtent(Ge.Z.fromBounds(t,this._spatialReference)),i=(0,ze.iV)(r,this._spatialReference,Le.Z.WGS84,{densificationStep:64*e.resolution});if(!i)return null;const n=(0,p.Uy)(new O.Z,i,!1,!1),o=n.coords.filter(((e,t)=>!(t%2))),a=n.coords.filter(((e,t)=>t%2)),h=Math.min(...o),l=Math.min(...a),u=Math.max(...o),c=Math.max(...a),d=this._getGeohash(h,l,s),g=this._getGeohash(u,c,s);return{bounds:t,geohashBounds:{xLL:d.geohashX,yLL:d.geohashY,xTR:g.geohashX,yTR:g.geohashY},level:s}}_lookupCluster(e,t,s,r,i,n){const o=this._getClusterId(s,r,i),a=this._clusters.get(o),h=this._getClusterBounds(t,r,i),l=this._getGeohashBounds(n,h);if(null==l)return null;const u=this._tree.getRegionStatistics(l),{count:c,xTotal:d,yTotal:g,referenceId:p}=u,_=c?d/c:0,f=c?g/c:0;if(0===c)return this._clusters.set(o,null),null;const m={cluster_count:c,...u.attributes},y=null!=a?a.update(_,f,s,m,l,p):Ve.create(e,o,_,f,s,m,l,p);if(0===c){const[e,t,s,r]=h;y.geometry.coords[0]=(e+s)/2,y.geometry.coords[1]=(t+r)/2}return this._clusters.set(o,y),this._updateAggregateValueRangeForCluster(y,y.tileLevel),y}_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.i9/s),{row:i,col:n}=e.key,o=n*we.i9,a=i*we.i9,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 $e{constructor(){this._freeIds=[],this._idCounter=1}createId(e=!1){return(0,Te.QS)(this._getFreeId(),e)}releaseId(e){this._freeIds.push(e)}_getFreeId(){return this._freeIds.length?this._freeIds.pop():this._idCounter++}}var Ke=s(93054);function et(e,t,s){if(!(e.length>t))for(;e.length<=t;)e.push(s)}class tt{constructor(){this._numerics=[],this._strings=[],this._idGenerator=new $e,this._allocatedSize=256,this._bitsets=[],this._instanceIds=[],this._bounds=[]}createBitset(){const e=this._bitsets.length;return this._bitsets.push(Ke.p.create(this._allocatedSize,Te.Ht)),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]=[]),et(this._numerics[e],t,0)}_ensureInstanceId(e){et(this._instanceIds,e,0)}_ensureString(e,t){this._strings[e]||(this._strings[e]=[]),et(this._strings[e],t,null)}createDisplayId(e=!1){const t=this._idGenerator.createId();return t>this._allocatedSize&&this._expand(),(0,Te.QS)(t,e)}releaseDisplayId(e){for(const t of this._bitsets)t.unset(e);return this._idGenerator.releaseId(e&Te.Ht)}getComputedNumeric(e,t){return this.getComputedNumericAtIndex(e&Te.Ht,0)}setComputedNumeric(e,t,s){return this.setComputedNumericAtIndex(e&Te.Ht,s,0)}getComputedString(e,t){return this.getComputedStringAtIndex(e&Te.Ht,0)}setComputedString(e,t,s){return this.setComputedStringAtIndex(e&Te.Ht,0,s)}getComputedNumericAtIndex(e,t){const s=e&Te.Ht;return this._ensureNumeric(t,s),this._numerics[t][s]}setComputedNumericAtIndex(e,t,s){const r=e&Te.Ht;this._ensureNumeric(t,r),this._numerics[t][r]=s}getInstanceId(e){const t=e&Te.Ht;return this._ensureInstanceId(t),this._instanceIds[t]}setInstanceId(e,t){const s=e&Te.Ht;this._ensureInstanceId(s),this._instanceIds[s]=t}getComputedStringAtIndex(e,t){const s=e&Te.Ht;return this._ensureString(t,s),this._strings[t][s]}setComputedStringAtIndex(e,t,s){const r=e&Te.Ht;this._ensureString(t,r),this._strings[t][r]=s}getXMin(e){return this._bounds[4*(e&Te.Ht)]}getYMin(e){return this._bounds[4*(e&Te.Ht)+1]}getXMax(e){return this._bounds[4*(e&Te.Ht)+2]}getYMax(e){return this._bounds[4*(e&Te.Ht)+3]}setBounds(e,t){const s=t.readHydratedGeometry();if(!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&Te.Ht;return et(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 st(e){if(!(0,d.D_)(e)&&!function(e){return"worker:port-closed"===e.name}(e))throw e}function rt(e){return"feature"===e.type&&"snapshot"===e.mode}let it=class extends i.Z{constructor(){super(...arguments),this._storage=new tt,this._markedIdsBufId=this._storage.createBitset(),this._lastCleanup=performance.now(),this._cleanupNeeded=!1,this._invalidated=!1,this._tileToResolver=new Map,this._didEdit=!1,this._updateVersion=1,this._updatingHandles=new g.R,this.tileStore=null,this.config=null,this.processor=null,this.remoteClient=null,this.service=null}initialize(){this._initStores(),this._initSource(),this._updateQueue=new re.e({concurrency:"stream"===this._source.type?1:4,process:(e,t)=>this._onTileMessage(e,{signal:t})}),this.addHandles([this.tileStore.on("update",this.onTileUpdate.bind(this)),(0,o.gx)((()=>!this.updating),(()=>this.onIdle()))])}_initSource(){const e=this.tileStore.tileScheme;this._source=function(e,t,s,r,i,n,o){const a=function(e,t,s,r,i,n,o){switch(e.type){case"snapshot":return{type:"feature",origin:"snapshot",featureCount:e.featureCount??0,serviceInfo:e,onMessage:i,outSR:s,tileInfoView:r,canAcceptRequest:n,store:o,arcadeLayerSchema:t};case"stream":return{type:"stream",serviceInfo:e,onMessage:i,outSR:s,canAcceptRequest:n,arcadeLayerSchema:t};case"memory":case"on-demand":return{type:"feature",serviceInfo:e,onMessage:i,outSR:s,origin:function(e){return Array.isArray(e)?"local":"path"in e&&(0,I.M8)(e.path)?"hosted":"unknown"}(e.source),tileInfoView:r,canAcceptRequest:n,arcadeLayerSchema:t}}}(e,t,s,r,i,n,o);switch(a.type){case"feature":switch(a.origin){case"hosted":case"local":return new he(a);case"snapshot":return new ge(a);default:return new ae(a)}case"stream":return new Se(a)}}(this.service,{...this.service,fieldsIndex:this.fieldsIndex},this.spatialReference,e,((e,t)=>(this._invalidated=!0,this._patchTile(e,t))),(()=>this._updateQueue&&this._updateQueue.length<50),this.featureStore),this._proxyEvents()}_setStreamClientProperty(e,t){this.remoteClient.invoke("setProperty",{propertyName:e,value:t}).catch(st)}_proxyEvents(){if("stream"===this._source.type){const e=this._source.events,t=this._source;this.addHandles([(0,o.YP)((()=>t.connectionStatus),(e=>this._setStreamClientProperty("pipelineConnectionStatus",e)),{initial:!0}),(0,o.YP)((()=>t.errorString),(e=>this._setStreamClientProperty("pipelineErrorString",e)),{initial:!0}),e.on("data-received",(e=>this.remoteClient.invoke("emitEvent",{name:"data-received",event:{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry}}).catch(st))),e.on("message-received",(e=>this.remoteClient.invoke("emitEvent",{name:"message-received",event:e}).catch(st))),e.on("updateRate",(e=>this.remoteClient.invoke("emitEvent",{name:"update-rate",event:{...e}}).catch(st)))])}}_initAttributeStore(e){this.attributeStore||(this.attributeStore=new Pe({type:"remote",initialize:(e,t)=>(0,d.R8)(this.remoteClient.invoke("tileRenderer.featuresView.attributeView.initialize",e,{signal:t}).catch(st)),update:(e,t)=>(0,d.R8)(this.remoteClient.invoke("tileRenderer.featuresView.attributeView.requestUpdate",e,{signal:t}).catch(st)),render:e=>(0,d.R8)(this.remoteClient.invoke("tileRenderer.featuresView.requestRender",void 0,{signal:e}).catch(st))},e))}_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};this.featureStore=new y.p(t,this._storage,e)}_initQueryEngine(e){const t=this;this.featureQueryEngine?.destroy(),this.featureQueryEngine=new _.q({availableFields:e.availableFields,definitionExpression:e.schema.source.definitionExpression??void 0,fieldsIndex:f.Z.fromJSON(this.service.fieldsIndex),geometryType:this.service.geometryType,objectIdField:this.service.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!0,featureStore:this.featureStore,aggregateAdapter:{getFeatureObjectIds:e=>null==t.aggregateStore?[]:t.aggregateStore.getFeatureDisplayIdsForAggregate(e).map((e=>t.getObjectId(e)))},timeInfo:this.service.timeInfo})}_initAggregateQueryEngine(e,t){if(this.aggregateQueryEngine?.destroy(),null==e)return;const s=t.targets.aggregate.params.fields.slice();this.aggregateQueryEngine=new _.q({definitionExpression:void 0,fieldsIndex:f.Z.fromLayerJSON({fields:s,dateFieldsTimeReference:{timeZoneIANA:m.pt}}),geometryType:e.geometryInfo.geometryType,objectIdField:e.objectIdField,hasM:e.geometryInfo.hasM,hasZ:e.geometryInfo.hasZ,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!1,featureStore:e,aggregateAdapter:{getFeatureObjectIds:e=>[]}})}destroy(){this._updateQueue.destroy(),this._source.destroy(),this.featureQueryEngine?.destroy(),this.aggregateQueryEngine?.destroy(),this.attributeStore?.destroy();for(const e of this.tileStore.tiles)this._source.unsubscribe(e);clearInterval(this._checkUpdating),this._updatingHandles.destroy()}get fieldsIndex(){return f.Z.fromJSON(this.service.fieldsIndex)}get spatialReference(){return this.tileStore.tileScheme.spatialReference}get dataUpdating(){return this._source.updatingHandles.updating}get updating(){return this.isUpdating()}isUpdating(){const e=this._source.updatingHandles.updating,t=!this.attributeStore||this.attributeStore.updatingHandles.updating,s=e||t||this._updatingHandles.updating;if((0,n.Z)("esri-2d-log-updating")){let r=`Updating FeatureController2D: ${s}\n`;r+=` -> updatingSource ${e}\n`;for(const e of this._source.subscriptions)r+=` ${e.tile.id} ${e.isDone}\n`;r+=` -> updatingAttributeStore ${t}\n`,r+=` -> updatingHandles ${this._updatingHandles.updating} (queue: ${this._updateQueue.length})\n`,console.log(r)}return s}updateCustomParameters(e){"stream"===this._source.type&&this._source.updateCustomParameters(e)}enableEvent(e){this._source.enableEvent(e.name,e.value)}pause(){this._updateQueue.pause(),this._updateQueue.clear()}resume(){this._updateQueue.resume()}pauseStream(){"stream"===this._source.type&&this._source.pauseStream()}resumeStream(){"stream"===this._source.type&&this._source.resumeStream()}sendMessageToSocket(e){"stream"===this._source.type&&this._source.sendMessageToSocket(e)}sendMessageToClient(e){"stream"===this._source.type&&this._source.sendMessageToClient(e)}_initAggregateStore(e){const t=e.schema.targets?.aggregate?.type??null;if((this.config?.schema.targets?.aggregate?.type??null)!==t&&(null!=this.aggregateStore&&(this.removeHandles("valueRangesChanged"),this.aggregateStore.destroy(),this.aggregateStore=null),t)){switch(t){case"cluster":{const e={geometryInfo:{geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new Je(e,this.spatialReference,this._storage,{...this.service,fieldsIndex:this.fieldsIndex}),this.addHandles(this.aggregateStore.events.on("valueRangesChanged",(e=>{this.remoteClient.invoke("emitEvent",{name:"valueRangesChanged",event:{valueRanges:e.valueRanges}}).catch(st)})),"valueRangesChanged");break}case"bin":{const e={geometryInfo:{geometryType:"esriGeometryPolygon",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new Ye(e,this.spatialReference,this._storage,{...this.service,fieldsIndex:this.fieldsIndex});break}}this.aggregateStore.onTileUpdate({added:this.tileStore.tiles,removed:[]})}}async update(e,t){this._updateVersion++,(0,n.Z)("esri-2d-update-debug")&&console.debug(`FeatureController2D::update: Token version ${this._updateVersion}`),this._initQueryEngine(t),this._initAttributeStore(t),this.pause(),this.config?.timeZone!==t.timeZone&&(e.mesh=!0,e.storage.data=!0,e.storage.filters=!0,e.targets.aggregate=!0,e.targets.feature=!0,this.featureStore.invalidate()),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,t,this)]),this._initAggregateStore(t),null!=this.aggregateStore&&await this.aggregateStore.updateSchema(e,t.schema.targets.aggregate),this._initAggregateQueryEngine(this.aggregateStore,t.schema),(0,n.Z)("esri-2d-update-debug")&&e.describe(),this._set("config",t)}async applyUpdate(e){e.version=this._updateVersion,(0,n.Z)("esri-2d-update-debug")&&console.debug(`FeatureController2D::applyUpdate: Token version ${e.version}`),e.mesh&&this.clearTiles(),this._updateQueue.resume(),await this._source.applyUpdate(e),(0,n.Z)("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Waiting for source update to finish"),this.notifyChange("updating"),await(0,o.N1)((()=>!this.updating)),(0,n.Z)("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Source update finsihed"),null!=this.aggregateStore&&(await(0,d.e4)(10),(0,n.Z)("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Waiting for aggregate idle call"),await(0,o.N1)((()=>!this.updating)),(0,n.Z)("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Aggregate idle called")),(0,n.Z)("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Update finished")}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"),null!=this.aggregateStore&&this.aggregateStore.clear(),await this._source.resend(),await(0,o.N1)((()=>!this.updating))}catch(e){}}async refresh(e){if(!e.dataChanged){const e=ee.empty();return e.storage.filters=!0,this.applyUpdate(e)}this.featureStore.invalidate(),this.clearTiles(),this._source.refresh(this._updateVersion,e),this._cleanupNeeded=!0,this.notifyChange("updating"),await(0,o.N1)((()=>!this.updating))}clearTiles(){for(const e of this.tileStore.tiles)this.processor.onTileClear(e,!1)}onTileUpdate(e){null!=this.aggregateStore&&this.aggregateStore.onTileUpdate(e);for(const t of e.added){const e=this._source.subscribe(t,this._updateVersion);"stream"!==this._source.type&&this._updatingHandles.addPromise(e.done),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")}async onIdle(){this._invalidated&&(this._invalidated=!1,null==this.aggregateStore&&"heatmap"!==this.processor.type||await this._repushCurrentLevelTiles()),this._markAndSweep()}async querySummaryStatistics({query:e,params:t}){return this.featureQueryEngine.executeQueryForSummaryStatistics(e,t)}async queryAggregateSummaryStatistics({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForSummaryStatistics(this._normalizeAggregateQuery(e),t)}async queryUniqueValues({query:e,params:t}){return this.featureQueryEngine.executeQueryForUniqueValues(e,t)}async queryAggregateUniqueValues({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForUniqueValues(this._normalizeAggregateQuery(e),t)}async queryClassBreaks({query:e,params:t}){return this.featureQueryEngine.executeQueryForClassBreaks(e,t)}async queryAggregateClassBreaks({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForClassBreaks(this._normalizeAggregateQuery(e),t)}async queryHistogram({query:e,params:t}){return this.featureQueryEngine.executeQueryForHistogram(e,t)}async queryAggregateHistogram({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForHistogram(this._normalizeAggregateQuery(e),t)}queryExtent(e){return this.featureQueryEngine.executeQueryForExtent(e)}queryAggregates(e){return this.aggregateQueryEngine.executeQuery(this._normalizeAggregateQuery(e))}queryAggregateCount(e){return this.aggregateQueryEngine.executeQueryForCount(this._normalizeAggregateQuery(e))}queryAggregateIds(e){return this.aggregateQueryEngine.executeQueryForIds(this._normalizeAggregateQuery(e))}queryFeatures(e){return this.featureQueryEngine.executeQuery(e)}async queryVisibleFeatures(e){const t=await this.featureQueryEngine.executeQuery(e),s=t.objectIdFieldName;return t.features=t.features.filter((e=>{const t=e.attributes[s],r=this.getDisplayId(t);return null!=r&&this.attributeStore.isVisible(r)})),t}queryFeatureCount(e){return this.featureQueryEngine.executeQueryForCount(e)}queryLatestObservations(e){return this.featureQueryEngine.executeQueryForLatestObservations(e)}queryObjectIds(e){return this.featureQueryEngine.executeQueryForIds(e)}async queryStatistics(){return this.featureStore.storeStatistics}getObjectId(e){return this.featureStore.lookupObjectId(e,this._storage)}getDisplayId(e){if(null!=this.aggregateStore){const t=this.aggregateStore.getDisplayId(e);if(null==t){const t=this.featureStore.lookupDisplayId(e);return this.aggregateStore.getDisplayIdForReferenceId(t)}return t}return this.featureStore.lookupDisplayId(e)}getFeatures(e){const t=[],s=[];for(const r of e){const e=null!=this.aggregateStore?this.getAggregate(r):null;if(null!=e)if(null!=e.attributes.referenceId){const s=this.getFeature(e.attributes.referenceId);null!=s&&t.push(s)}else s.push(e);else{const e=this.getFeature(r);null!=e&&t.push(e)}}return{features:t,aggregates:s}}getFeature(e){const t=this.featureStore.lookupFeatureByDisplayId(e,this._storage);if(null==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 null==this.aggregateStore?null:this.aggregateStore.getAggregate(e)}getAggregates(){return null==this.aggregateStore?[]:this.aggregateStore.getAggregates()}async setHighlight(e){const t=e.map((e=>this.getDisplayId(e))).filter(h.pC);return this.attributeStore.setHighlight(e,t)}_normalizeAggregateQuery(e){const t=e.objectIds??[];for(const s of e.aggregateIds??[])t.push(s);return e.objectIds=t,e.aggregateIds=[],e}_lookupObjectIdByGlobalId(e){const t=this.service.globalIdField;if(null==t)throw new Error("Expected globalIdField to be defined");let s=null;if(this.featureStore.forEach((r=>{e===r.readAttribute(t)&&(s=r.getObjectId())})),null==s)throw new Error(`Expected to find a feature with globalId ${e}`);return s}async _repushCurrentLevelTiles(){const e=this.tileStore.tiles.filter((e=>e.level===this._level));e.map((async e=>this._patchTile({type:"append",id:e.key.id,clear:!0,addOrUpdate:null,end:!1})));const t=e.map((async e=>this._patchTile({type:"append",id:e.key.id,addOrUpdate:M.fromOptimizedFeatures([],{...this.service,fieldsIndex:this.fieldsIndex}),remove:[],end:!0,isRepush:!0,status:ee.empty()})));await Promise.all(t)}_maybeForceCleanup(){performance.now()-this._lastCleanup>5e3&&this._markAndSweep()}_patchTile(e,t){const s=this._updateQueue.push(e,t).catch((e=>{}));return this._updatingHandles.addPromise(s)}async _onTileMessage(e,t){if((0,d.k_)(t),(0,n.Z)("esri-2d-update-debug")){const t=e.addOrUpdate?.hasFeatures;console.debug(e.id,`FeatureController:onTileMessage: [clear:${e.clear}, end:${e.end}, features: ${t}]`)}const s=this.tileStore.get(e.id);if(!s)return;if(e.clear)return this.processor.onTileClear(s,e.end);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(null==e.addOrUpdate)return void this.processor.onTileMessage(s,{...e,addOrUpdate:null},null!=this.aggregateStore,t).catch(d.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,this.config?.timeZone)),r.storage.data&&r.storage.filters||(r.storage.data=!0,r.storage.filters=!0,this.attributeStore.onTileData(s,e),"stream"===this._source.type||this._didEdit?(await this.attributeStore.sendUpdates(),(0,d.k_)(t)):this.attributeStore.sendUpdates()),null!=this.aggregateStore&&!r.targets.aggregate){r.targets.aggregate=!0;const t=rt(this._source)&&this._source.loading,i=!rt(this._source)||t||e.end;if(this.aggregateStore.onTileData(s,e,this._storage,this.attributeStore,this.config?.timeZone,i),!i)return;r.mesh||(this.attributeStore.onTileData(s,e),await this.attributeStore.sendUpdates())}if(!r.mesh){r.mesh=!0;const i=null!=this.aggregateStore&&"cluster"===this.aggregateStore.type;await this.processor.onTileMessage(s,e,i,t),(0,d.k_)(t)}this._maybeForceCleanup()}catch(e){(0,d.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||"stream"!==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)}})),null!=this.aggregateStore&&(this.aggregateStore.sweepFeatures(e,this.featureStore),"sweepAggregates"in this.aggregateStore&&this.aggregateStore.sweepAggregates(this._storage,this.attributeStore,this._level)),this.featureStore.sweepFeatures(e,this._storage,this.attributeStore),this.featureStore.sweepFeatureSets(t)}};(0,r._)([(0,a.Cb)({constructOnly:!0})],it.prototype,"tileStore",void 0),(0,r._)([(0,a.Cb)()],it.prototype,"config",void 0),(0,r._)([(0,a.Cb)({readOnly:!0})],it.prototype,"fieldsIndex",null),(0,r._)([(0,a.Cb)()],it.prototype,"processor",void 0),(0,r._)([(0,a.Cb)({constructOnly:!0})],it.prototype,"remoteClient",void 0),(0,r._)([(0,a.Cb)({constructOnly:!0})],it.prototype,"service",void 0),(0,r._)([(0,a.Cb)()],it.prototype,"spatialReference",null),(0,r._)([(0,a.Cb)()],it.prototype,"dataUpdating",null),(0,r._)([(0,a.Cb)()],it.prototype,"updating",null),it=(0,r._)([(0,l.j)("esri.views.2d.layers.features.controllers.FeatureController2D")],it);const nt=it;var ot=s(3894),at=s(24470),ht=s(6388),lt=s(55415);class ut{constructor(e,t){this.key=new lt.Z(0,0,0,0),this.bounds=(0,at.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 Ge.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=ot.Z.acquire();for(let s=0;s<e.length;s++)t[s]=new ut(this.tileInfoView,e[s]);return t}getQuantizationParameters(){return ht.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}})}}var ct=s(67524);const dt={added:[],removed:[]},gt=new Set,pt=new lt.Z(0,0,0,0);class _t extends W.Z{constructor(e){super(),this._tiles=new Map,this._index=(0,_e.r)(9,(0,n.Z)("esri-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 ut(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=pt.set(i,e,r.normalizeCol(s),r.getWorldForColumn(s)).id;if(gt.add(t),!this.has(t)){const e=new ut(this.tileScheme,t);this._tiles.set(t,e),this._index.insert(e),this.tiles.push(e),dt.added.push(e)}}for(let e=this.tiles.length-1;e>=0;e--){const t=this.tiles[e];gt.has(t.id)||(this._tiles.delete(t.id),this.tiles.splice(e,1),this._index.remove(t),dt.removed.push(t))}(dt.added.length||dt.removed.length)&&this.emit("update",dt),ct.Z.pool.release(t),gt.clear(),dt.added.length=0,dt.removed.length=0}}var ft=s(83068);let mt=class extends i.Z{constructor(){super(...arguments),this.controller=null,this.processor=null,this.remoteClient=null,this.tileStore=null,this.service=null,this.viewState=null,this._paused=!1,this._pendingTileUpdates=[]}initialize(){this.addHandles([(0,o.YP)((()=>this.updating),(e=>{this.remoteClient.invoke("setUpdating",e).catch((e=>{}))}))])}destroy(){this.stop(),this.controller?.destroy(),this.processor?.destroy(),this.controller=this.processor=this.tileStore=this.remoteClient=null}get updating(){return!this.controller||this.controller.updating}stop(){this._paused=!0,Array.isArray(this.service?.source)&&(this.service.source.forEach((e=>e.close())),this.service.source.length=0),this.tileStore?.updateTiles({added:[],removed:this.tileStore.tiles.map((e=>e.id))}),this.tileStore?.destroy(),this.tileStore=null,this._pendingTileUpdates.length=0}async startup({service:e,config:t,tileInfo:s,tiles:r}){if(this._paused=!0,Array.isArray(this.service?.source)&&(this.service.source.forEach((e=>e.close())),this.service.source.length=0),this.service=e,!this.tileStore||!(0,u.fS)(this.tileStore.tileScheme.spatialReference,s.spatialReference)){const e=new ft.Z(c.Z.fromJSON(s));r.added.length=r.removed.length=0,this.tileStore?.updateTiles({added:[],removed:this.tileStore.tiles.map((e=>e.id))}),this.tileStore?.destroy(),this.tileStore=new _t(e),this._pendingTileUpdates.length=0}for(await this._createProcessorAndController(t),await this.update({config:t}),this.controller.resume(),this.tileStore.clear(),this.tileStore.updateTiles(r),this._paused=!1;this._pendingTileUpdates.length;)this.tileStore.updateTiles(this._pendingTileUpdates.pop())}async updateTiles(e){this._paused?this._pendingTileUpdates.push(e):this.tileStore?.updateTiles(e)}async update({config:e}){const t=ee.empty();return await Promise.all([this.processor.update(t,e),this.controller.update(t,e)]),t.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){return this._createController(this.service,e)}async _handleProcessorConfig(e){return this._createProcessor(this.service,e)}async _createController(e,t){this.controller&&(this.controller.destroy(),this.removeHandles("controller"));const{tileStore:s,remoteClient:r}=this,i=new nt({service:e,tileStore:s,remoteClient:r}),n=(0,o.YP)((()=>i.dataUpdating),(e=>{this.remoteClient.invoke("setDataUpdating",e).catch((e=>{}))}));return this.addHandles(n,"controller"),this.controller=i,i}async _createProcessor(e,t){const r=t.schema.processors[0].type,i=(await function(e){return"heatmap"===e?s.e(9904).then(s.bind(s,49904)):Promise.all([s.e(3425),s.e(951)]).then(s.bind(s,60951))}(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,a.Cb)()],mt.prototype,"controller",void 0),(0,r._)([(0,a.Cb)()],mt.prototype,"processor",void 0),(0,r._)([(0,a.Cb)()],mt.prototype,"updating",null),(0,r._)([(0,a.Cb)()],mt.prototype,"viewState",void 0),mt=(0,r._)([(0,l.j)("esri.views.2d.layers.features.Pipeline")],mt);const yt=mt},59999:(e,t,s)=>{s.d(t,{J:()=>a});var r=s(80442),i=s(22862),n=s(59266),o=s(92604);class a{constructor(e,t){this._canCacheExpressionValue=!1,this._sourceInfo=e,this._storage=t,this._bitsets={computed:t.getBitset(t.createBitset())}}get storage(){return this._storage}invalidate(){this._bitsets.computed.clear()}async updateSchema(e,t){const s=(0,i.Hg)(this._schema,t);if(this._schema=t,!t||null==s||!(0,i.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 n=t.attributes,o=[],a=[];for(const e in n){const t=n[e];switch(t.type){case"field":break;case"expression":o.push(this._createArcadeComputedField(t));break;case"label-expression":o.push(this._createLabelArcadeComputedField(t));break;case"statistic":a.push(t)}}this._computedFields=await Promise.all(o),this._canCacheExpressionValue=!this._computedFields.some((e=>"expression"===e.type&&null!=e.expression&&e.expression.referencesScale())),this._statisticFields=a}setComputedAttributes(e,t,s,r,i){const n=this._bitsets.computed;if(!this._canCacheExpressionValue||!n.has(s)){n.set(s);for(const n of this._computedFields){const o=this._evaluateField(t,n,r,i);switch(n.resultType){case"numeric":e.setComputedNumericAtIndex(s,n.fieldIndex,o);break;case"string":e.setComputedStringAtIndex(s,n.fieldIndex,o)}}}}async _createArcadeComputedField(e){const t=this._sourceInfo.spatialReference,s=this._sourceInfo.fieldsIndex;return{...e,expression:await(0,n.Yi)(e.valueExpression,t,s)}}async _createLabelArcadeComputedField(e){const t=this._sourceInfo.spatialReference,r=this._sourceInfo.fieldsIndex,{createLabelFunction:i}=await s.e(4695).then(s.bind(s,14695)),n=await i(e.label,r,t);return{...e,builder:n}}_evaluateField(e,t,s,r){switch(t.type){case"label-expression":{const s=e.readArcadeFeature();return t.builder.evaluate(s,r)||""}case"expression":{const{expression:i}=t;return function(e,t,s){if(null==e)return null;const r=t.readArcadeFeature();t.contextTimeZone=s.$view?.timeZone;try{return e.evaluate({...s,$feature:r},e.services)}catch(e){return o.Z.getLogger("esri.views.2d.support.arcadeOnDemand").warn("Feature arcade evaluation failed:",e),null}}(i,e,{$view:{scale:s,timeZone:r}})}}}}},87554:(e,t,s)=>{s.d(t,{s:()=>F}),s(66577);var r=s(48853),i=s(80442),n=s(70586),o=s(22641),a=s(53970),h=s(58835),l=s(32724),u=s(98732),c=s(5428),d=s(25031),g=s(93054),p=s(33955);let _=0;const f=(0,i.Z)("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],m=f[0],y=f[1],I=f[2],b=f[3],x=(0,i.Z)("featurelayer-simplify-payload-size-factors")??[1,2,4],v=x[0],S=x[1],w=x[2],T=(0,i.Z)("featurelayer-simplify-mobile-factor")??2,C=(0,i.Z)("esri-mobile");class F{constructor(e,t){this.type="FeatureSetReader",this.arcadeDeclaredClass="esri.arcade.Feature",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._contextTimeZone=null,this._level=0,this.instance=e,this._layerSchema=t}static createInstance(){return _++,_=_>65535?0:_,_}get isEmpty(){return null!=this._deleted&&this._deleted.countSet()===this.getSize()}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}set level(e){this._level=e}getAreaSimplificationThreshold(e,t){let s=1;const r=C?T:1;t>4e6?s=w*r:t>1e6?s=S*r:t>5e5?s=v*r:t>1e5&&(s=r);let i=0;e>4e3?i=b*s:e>2e3?i=I*s:e>100?i=y:e>15&&(i=m);let n=8;return this._level<4?n=1:this._level<5?n=2:this._level<6&&(n=4),i*n}createQuantizedExtrudedGeometry(e,t){return"esriGeometryPolyline"===this.geometryType?this._createQuantizedExtrudedLine(e,t):this._createQuantizedExtrudedQuad(e,t)}_createQuantizedExtrudedQuad(e,t){return new c.Z([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createQuantizedExtrudedLine(e,t){return new c.Z([2],[e-1,t+1,1,-1])}parseTimestampOffset(e){return e}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}readAttributeAsTimestamp(e){const t=this.readAttribute(e);return"string"==typeof t?new Date(t).getTime():"number"==typeof t||null==t?t:null}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}hasField(e){return this.fields.has(e)}geometry(){const e=this.readHydratedGeometry(),t=(0,u.di)(e,this.geometryType,this.hasZ,this.hasM),s=(0,p.im)(t);return s&&(s.spatialReference=this._arcadeSpatialReference),s}autocastArcadeDate(e,t){return t&&t instanceof Date?this.isUnknownDateTimeField(e)?r.iG.unknownDateJSToArcadeDate(t):r.iG.dateJSAndZoneToArcadeDate(t,this.contextTimeZone??d.By):t}isUnknownDateTimeField(e){return this._layerSchema.fieldsIndex.getTimeZone(e)===d._4}field(e){let t=this.fields.get(e);if(t)switch(t.type){case"date-only":case"esriFieldTypeDateOnly":return o.u.fromReader(this.readAttribute(e,!1));case"time-only":case"esriFieldTypeTimeOnly":return a.n.fromReader(this.readAttribute(e,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return r.iG.fromReaderAsTimeStampOffset(this.readAttribute(e,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(e,this.readAttribute(e,!0));default:return this.readAttribute(e,!1)}for(const s of this._joined)if(s.setIndex(this.getIndex()),t=s.fields.get(e),t)switch(t.type){case"date-only":case"esriFieldTypeDateOnly":return o.u.fromReader(s._readAttribute(e,!1));case"time-only":case"esriFieldTypeTimeOnly":return a.n.fromReader(s._readAttribute(e,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return r.iG.fromReaderAsTimeStampOffset(s._readAttribute(e,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(e,s._readAttribute(e,!0));default:return this.readAttribute(e,!1)}throw new Error(`Field ${e} does not exist`)}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.fields.fields.map((e=>e.name))}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeature());const t=this.readLegacyFeature();if(!t)return JSON.stringify(null);const s={geometry:t.geometry,attributes:{...t.attributes??{}}};for(const e in s.attributes){const t=s.attributes[e];t instanceof Date&&(s.attributes[e]=t.getTime())}return JSON.stringify(s)}gdbVersion(){return null}fullSchema(){return this._layerSchema}castAsJson(e=null){return{attributes:this._readAttributes(),geometry:!0===e?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}removeIds(e){if(null==this._objectIdToIndex){const e=new Map,t=this.getCursor();for(;t.next();){const s=t.getObjectId();(0,n.O3)(s),e.set(s,t.getIndex())}this._objectIdToIndex=e}const t=this._objectIdToIndex;for(const s of e)t.has(s)&&this.removeAtIndex(t.get(s))}removeAtIndex(e){null==this._deleted&&(this._deleted=g.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 null==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=h.z.fromOptimized(e,this.geometryType);t.yFactor*=-1;const s=(0,l.r)(t);return s?(s[1]*=-1,new c.Z([],s)):null}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,e.contextTimeZone=this.contextTimeZone}}},61800:(e,t,s)=>{s.d(t,{t:()=>i});var r=s(87554);class i extends r.s{static from(e,t){return new i(e.copy(),t)}constructor(e,t){super(r.s.createInstance(),e.fullSchema()),this._currentIndex=-1,this._reader=e,this._indices=t}get fields(){return this._reader.fields}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}get contextTimeZone(){return this._reader.contextTimeZone}set contextTimeZone(e){this._reader.contextTimeZone=e}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(e=!1){return this._reader.castToText(e)}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{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)}constructor(e,t){this._mask=0,this._buf=e,this._mask=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}}},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:()=>p});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{static create(e,t,s=null){const i=(0,r.C5)(e.spatialReference),a=t.origin||n(e.origin.x,e.origin.y),l=n(e.size[0]*t.resolution,e.size[1]*t.resolution),u=n(-1/0,-1/0),c=n(1/0,1/0),d=n(1/0,1/0);null!=s&&(o(u,Math.max(0,Math.floor((s.xmin-a[0])/l[0])),Math.max(0,Math.floor((a[1]-s.ymax)/l[1]))),o(c,Math.max(0,Math.floor((s.xmax-a[0])/l[0])),Math.max(0,Math.floor((a[1]-s.ymin)/l[1]))),o(d,c[0]-u[0]+1,c[1]-u[1]+1));const{cols:g,rows:p}=t;let _,f,m,y;return!s&&g&&p&&(o(u,g[0],p[0]),o(c,g[1],p[1]),o(d,g[1]-g[0]+1,p[1]-p[0]+1)),e.isWrappable?(_=n(Math.ceil(Math.round((i.valid[1]-i.valid[0])/t.resolution)/e.size[0]),d[1]),f=n(Math.floor((i.origin[0]-a[0])/l[0]),u[1]),m=n(_[0]+f[0]-1,c[1]),y=!0):(f=u,m=c,_=d,y=!1),new h(t.level,t.resolution,t.scale,a,u,c,d,l,f,m,_,y)}constructor(e,t,s,r,i,n,o,a,h,l,u,c){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=u,this.wrap=c}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 u{constructor(e,t,s){this.row=e,this.colFrom=t,this.colTo=s}}const c=new i.Z("0/0/0/0");class d{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,u=(Math.floor(r)-r)*h;return new d(s,Math.floor(r),Math.ceil(n),h,o<0?l:u,o<0?u:l,o<0?i:s,o<0?s:i)}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}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 g=[[0,0],[0,0],[0,0],[0,0]];class p{constructor(e,t=null,s=e.lods[0].level,r=e.lods[e.lods.length-1].level){this.tileInfo=e,this.fullExtent=t,this.scales=[],this._infoByScale={},this._infoByLevel={};const i=e.lods.filter((e=>e.level>=s&&e.level<=r));this.minScale=i[0].scale,this.maxScale=i[i.length-1].scale;const n=this._lodInfos=i.map((s=>h.create(e,s,t)));i.forEach(((e,t)=>{this._infoByLevel[e.level]=n[t],this._infoByScale[e.scale]=n[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){c.set(t);const r=this._infoByLevel[c.level];return r?r.getTileBounds(e,c,s):e}getTileCoords(e,t,s=!1){c.set(t);const r=this._infoByLevel[c.level];return r?r.getTileCoords(e,c,s):e}getTileCoverage(e,t=192,s=!0,r="closest"){if(!s&&(e.scale>this.minScale||e.scale<this.maxScale))return null;const i="closest"===r?this.getClosestInfoForScale(e.scale):this.getSmallestInfoForScale(e.scale),n=l.Z.pool.acquire(i),o=this._wrap;let a,h,c,p=1/0,_=-1/0;const f=n.spans;g[0][0]=g[0][1]=g[1][1]=g[3][0]=-t,g[1][0]=g[2][0]=e.size[0]+t,g[2][1]=g[3][1]=e.size[1]+t;for(const t of g)e.toMap(t,t),t[0]=i.getColumnForX(t[0]),t[1]=i.getRowForY(t[1]);const m=[];let y=3;for(let e=0;e<4;e++){if(g[e][1]===g[y][1]){y=e;continue}const t=d.create(g[e],g[y]);p=Math.min(t.ymin,p),_=Math.max(t.ymax,_),void 0===m[t.ymin]&&(m[t.ymin]=[]),m[t.ymin].push(t),y=e}if(null==p||null==_||_-p>100)return null;let I=[];for(a=p;a<_;){null!=m[a]&&(I=I.concat(m[a])),h=1/0,c=-1/0;for(let e=I.length-1;e>=0;e--){const t=I[e];h=Math.min(h,t.getLeftCol()),c=Math.max(c,t.getRightCol())}if(h=Math.floor(h),c=Math.floor(c),a>=i.first[1]&&a<=i.last[1])if(o)if(i.size[0]<i.worldSize[0]){const e=Math.floor(c/i.worldSize[0]);for(let t=Math.floor(h/i.worldSize[0]);t<=e;t++)f.push(new u(a,Math.max(i.getFirstColumnForWorld(t),h),Math.min(i.getLastColumnForWorld(t),c)))}else f.push(new u(a,h,c));else h>i.last[0]||c<i.first[0]||(h=Math.max(h,i.first[0]),c=Math.min(c,i.last[0]),f.push(new u(a,h,c)));a+=1;for(let e=I.length-1;e>=0;e--){const t=I[e];t.ymax>=a?t.incrRow():I.splice(e,1)}}return n}getTileParentId(e){c.set(e);const t=this._infoByLevel[c.level],s=this._lodInfos.indexOf(t)-1;return s<0?null:(this._getTileIdAtLOD(c,this._lodInfos[s],c),c.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){c.set(t);const s=this._infoByLevel[c.level],r=e.lodInfo;if(r.resolution>s.resolution){this._getTileIdAtLOD(c,r,c);const t=r.denormalizeCol(c.col,c.world);for(const s of e.spans)if(s.row===c.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(c.col,c.world),h=r.getColumnForX(s.getXForColumn(a)),l=r.getRowForY(s.getYForRow(c.row)),u=r.getColumnForX(s.getXForColumn(a+1))-1,d=r.getRowForY(s.getYForRow(c.row+1))-1;return!(h>o||u<n||l>i||d<t)}const i=r.denormalizeCol(c.col,c.world);return e.spans.some((e=>e.row===c.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{static getId(e,t,s,r){return"object"==typeof e?`${e.level}/${e.row}/${e.col}/${e.world}`:`${e}/${t}/${s}/${r}`}constructor(e,t,s,r){this.set(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 t>=0&&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)},79384:(e,t,s)=>{s.d(t,{e:()=>d});var r=s(70586),i=s(95330),n=s(64830),o=s(58971),a=s(10661);class h{constructor(){this._map=new Map,this._observable=new a.s}get size(){return(0,o.it)(this._observable),this._map.size}clear(){this._map.size>0&&(this._map.clear(),this._observable.notify())}delete(e){const t=this._map.delete(e);return t&&this._observable.notify(),t}entries(){return(0,o.it)(this._observable),this._map.entries()}forEach(e,t){(0,o.it)(this._observable),this._map.forEach(((s,r)=>e.call(t,s,r,this)),t)}get(e){return(0,o.it)(this._observable),this._map.get(e)}has(e){return(0,o.it)(this._observable),this._map.has(e)}keys(){return(0,o.it)(this._observable),this._map.keys()}set(e,t){return this._map.set(e,t),this._observable.notify(),this}values(){return(0,o.it)(this._observable),this._map.values()}[Symbol.iterator](){return(0,o.it)(this._observable),this._map[Symbol.iterator]()}get[Symbol.toStringTag](){return this._map[Symbol.toStringTag]}}var l=s(1654),u=s(95528);class c{constructor(e,t){this.item=e,this.controller=t,this.promise=null}}class d{constructor(e){this._schedule=null,this._task=null,this._deferreds=new h,this._controllers=new h,this._processingItems=new h,this._pausedSignal=(0,u.t)(!1),this.concurrency=1,e.concurrency&&(this.concurrency=e.concurrency),this._queue=new n.Z(e.peeker),this.process=e.process;const t=e.scheduler;e.priority&&t&&(this._task=t.registerTask(e.priority,this))}destroy(){this.clear(),this._schedule=(0,r.hw)(this._schedule),this._task=(0,r.hw)(this._task)}get updating(){return!!this._task?.updating||this.running}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._pausedSignal.value||(this._pausedSignal.value=!0,this._cancelNext())}push(e,t){const s=this.get(e);if(s)return s;const r=new AbortController;let n=null;t&&(n=(0,i.fu)(t,(()=>r.abort())));const o=()=>{a.remove(),null!=n&&n.remove(),this._deferreds.delete(e),this._controllers.delete(e),this._queue.remove(e),this._processingItems.delete(e),this._scheduleNext()},a=(0,i.$F)(r.signal,(()=>{const t=this._processingItems.get(e);t&&t.controller.abort(),o(),h.reject((0,i.zE)())})),h=(0,i.hh)();return this._deferreds.set(e,h),this._controllers.set(e,r),h.promise.then(o,o),this._queue.push(e),this._scheduleNext(),h.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._pausedSignal.value&&(this._pausedSignal.value=!1,this._scheduleNext())}takeAll(){const e=[];for(;this._queue.length;)e.push(this._queue.pop());return this.clear(),e}get running(){return!this._pausedSignal.value&&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._pausedSignal.value||this._schedule||(this._schedule=(0,l.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(null==e)return;let t;const s=new AbortController,r=new c(e,s);this._processingItems.set(e,r);try{t=this.process(e,s.signal)}catch(e){this._processError(r,e)}(0,i.y8)(t)?(r.promise=t,t.then((e=>this._processResult(r,e)),(e=>this._processError(r,e)))):this._processResult(r,t)}get test(){return{update:e=>this.runTask(e)}}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[8062,8008],{7335:(e,a,r)=>{r.d(a,{L:()=>n});var t=r(96187);class n{constructor(){this._serviceMetadatas=new Map}async fetchServiceMetadata(e,a){const r=this._serviceMetadatas.get(e);if(r)return r;const n=await(0,t.T)(e,a);return this._serviceMetadatas.set(e,n),n}}},71592:(e,a,r)=>{r.d(a,{w:()=>y});var t=r(40330),n=r(3172),i=r(20102),l=r(95330),s=r(66677),o=r(48522),c=r(15235);async function y(e,a){const r=(0,s.Qc)(e);if(!r)throw new i.Z("invalid-url","Invalid scene service url");const y={...a,sceneServerUrl:r.url.path,layerId:r.sublayer??void 0};if(y.sceneLayerItem??=await async function(e){const a=(await u(e)).serviceItemId;if(!a)return null;const r=new c.default({id:a,apiKey:e.apiKey}),i=await async function(e){const a=t.id?.findServerInfo(e.sceneServerUrl);if(a?.owningSystemUrl)return a.owningSystemUrl;const r=e.sceneServerUrl.replace(/(.*\/rest)\/.*/i,"$1")+"/info";try{const a=(await(0,n.Z)(r,{query:{f:"json"},responseType:"json",signal:e.signal})).data.owningSystemUrl;if(a)return a}catch(e){(0,l.r9)(e)}return null}(e);null!=i&&(r.portal=new o.Z({url:i}));try{return r.load({signal:e.signal})}catch(e){return(0,l.r9)(e),null}}(y),null==y.sceneLayerItem)return d(y.sceneServerUrl.replace("/SceneServer","/FeatureServer"),y);const p=await async function({sceneLayerItem:e,signal:a}){if(!e)return null;try{const r=(await e.fetchRelatedItems({relationshipType:"Service2Service",direction:"reverse"},{signal:a})).find((e=>"Feature Service"===e.type))||null;if(!r)return null;const t=new c.default({portal:r.portal,id:r.id});return await t.load(),t}catch(e){return(0,l.r9)(e),null}}(y);if(!p?.url)throw new i.Z("related-service-not-found","Could not find feature service through portal item relationship");const f=await d(p.url,y);return f.portalItem=p,f}async function u(e){if(e.rootDocument)return e.rootDocument;const a={query:{f:"json",token:e.apiKey},responseType:"json",signal:e.signal};try{const r=await(0,n.Z)(e.sceneServerUrl,a);e.rootDocument=r.data}catch{e.rootDocument={}}return e.rootDocument}async function d(e,a){const r=(0,s.Qc)(e);if(!r)throw new i.Z("invalid-feature-service-url","Invalid feature service url");const t=r.url.path,l=a.layerId;if(null==l)return{serverUrl:t};const o=u(a),c=e=>{const r={query:{f:"json"},responseType:"json",authMode:e,signal:a.signal};return(0,n.Z)(t,r)},y=c("anonymous").catch((()=>c("no-prompt"))),[d,p]=await Promise.all([y,o]),f=p?.layers,L=d.data&&d.data.layers;if(!Array.isArray(L))throw new Error("expected layers array");if(Array.isArray(f)){for(let e=0;e<Math.min(f.length,L.length);e++)if(f[e].id===l)return{serverUrl:t,layerId:L[e].id}}else if(null!=l&&l<L.length)return{serverUrl:t,layerId:L[l].id};throw new Error("could not find matching associated sublayer")}},52104:(e,a,r)=>{r.d(a,{V:()=>n});var t=r(96187);async function n(e,a){const r=await(0,t.T)(e,a);y(r),s(r);const n={serviceJSON:r};if((r.currentVersion??0)<10.5)return n;const i=await(0,t.T)(e+"/layers",a);return y(i),s(i),n.layersJSON={layers:i.layers,tables:i.tables},n}function i(e){return"Feature Layer"===e.type||"Oriented Imagery Layer"===e.type}function l(e){return"Table"===e.type}function s(e){e.layers=e.layers?.filter(i),e.tables=e.tables?.filter(l)}function o(e){e.type||="Feature Layer"}function c(e){e.type||="Table"}function y(e){e.layers?.forEach(o),e.tables?.forEach(c)}},70024:(e,a,r)=>{r.d(a,{k:()=>M,populateOperationalLayers:()=>y});var t=r(46791),n=(r(80442),r(7335)),i=r(87344),l=r(15235);function s(e,a){return!(!e.layerType||"ArcGISFeatureLayer"!==e.layerType)&&e.featureCollectionType===a}var o=r(28008),c=r(40555);async function y(e,a,r){if(!a)return;const t=[];for(const e of a)t.push(g(e,r));const n=await Promise.allSettled(t);for(const a of n)"rejected"===a.status||a.value&&e.add(a.value)}const u={ArcGISDimensionLayer:"DimensionLayer",ArcGISFeatureLayer:"FeatureLayer",ArcGISImageServiceLayer:"ImageryLayer",ArcGISMapServiceLayer:"MapImageLayer",PointCloudLayer:"PointCloudLayer",ArcGISSceneServiceLayer:"SceneLayer",IntegratedMeshLayer:"IntegratedMeshLayer",OGCFeatureLayer:"OGCFeatureLayer",BuildingSceneLayer:"BuildingSceneLayer",ArcGISTiledElevationServiceLayer:"ElevationLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",GroupLayer:"GroupLayer",GeoJSON:"GeoJSONLayer",WebTiledLayer:"WebTileLayer",CSV:"CSVLayer",VectorTileLayer:"VectorTileLayer",WFS:"WFSLayer",WMS:"WMSLayer",DefaultTileLayer:"TileLayer",KML:"KMLLayer",RasterDataLayer:"UnsupportedLayer",Voxel:"VoxelLayer",LineOfSightLayer:"LineOfSightLayer"},d={ArcGISTiledElevationServiceLayer:"ElevationLayer",DefaultTileLayer:"ElevationLayer",RasterDataElevationLayer:"UnsupportedLayer"},p={ArcGISFeatureLayer:"FeatureLayer"},f={ArcGISTiledMapServiceLayer:"TileLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",OpenStreetMap:"OpenStreetMapLayer",WebTiledLayer:"WebTileLayer",VectorTileLayer:"VectorTileLayer",ArcGISImageServiceLayer:"UnsupportedLayer",WMS:"UnsupportedLayer",ArcGISMapServiceLayer:"UnsupportedLayer",ArcGISSceneServiceLayer:"SceneLayer",DefaultTileLayer:"TileLayer"},L={ArcGISAnnotationLayer:"UnsupportedLayer",ArcGISDimensionLayer:"UnsupportedLayer",ArcGISFeatureLayer:"FeatureLayer",ArcGISImageServiceLayer:"ImageryLayer",ArcGISImageServiceVectorLayer:"ImageryLayer",ArcGISMapServiceLayer:"MapImageLayer",ArcGISStreamLayer:"StreamLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",BingMapsAerial:"BingMapsLayer",BingMapsRoad:"BingMapsLayer",BingMapsHybrid:"BingMapsLayer",CSV:"CSVLayer",DefaultTileLayer:"TileLayer",GeoRSS:"GeoRSSLayer",GeoJSON:"GeoJSONLayer",GroupLayer:"GroupLayer",KML:"KMLLayer",MediaLayer:"MediaLayer",OGCFeatureLayer:"OGCFeatureLayer",OrientedImageryLayer:"OrientedImageryLayer",SubtypeGroupLayer:"SubtypeGroupLayer",VectorTileLayer:"VectorTileLayer",WFS:"WFSLayer",WMS:"WMSLayer",WebTiledLayer:"WebTileLayer"},m={ArcGISFeatureLayer:"FeatureLayer"},w={ArcGISImageServiceLayer:"ImageryLayer",ArcGISImageServiceVectorLayer:"ImageryLayer",ArcGISMapServiceLayer:"MapImageLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",OpenStreetMap:"OpenStreetMapLayer",VectorTileLayer:"VectorTileLayer",WebTiledLayer:"WebTileLayer",BingMapsAerial:"BingMapsLayer",BingMapsRoad:"BingMapsLayer",BingMapsHybrid:"BingMapsLayer",WMS:"WMSLayer",DefaultTileLayer:"TileLayer"},S={...L,LinkChartLayer:"LinkChartLayer"},h={...m},I={...w};async function g(e,a){return async function(e,a,r){const t=new e;return t.read(a,r.context),"group"===t.type&&("GroupLayer"===a.layerType?await M(t,a,r):v(a)?function(e,a,r){a.itemId&&(e.portalItem=new l.default({id:a.itemId,portal:r?.portal}),e.when((()=>{const t=t=>{const n=t.layerId;G(t,e,a,n,r);const i=a.featureCollection?.layers?.[n];i&&t.read(i,r)};e.layers?.forEach(t),e.tables?.forEach(t)})))}(t,a,r.context):b(a)&&await async function(e,a,r){const t=i.T.FeatureLayer,n=await t(),l=a.featureCollection,s=l?.showLegend,o=l?.layers?.map(((t,i)=>{const l=new n;l.read(t,r);const o={...r,ignoreDefaults:!0};return G(l,e,a,i,o),null!=s&&l.read({showLegend:s},o),l}));e.layers.addMany(o??[])}(t,a,r.context)),await(0,c.y)(t,r.context),t}(await async function(e,a){const r=a.context,t=T(r);let c=e.layerType||e.type;!c&&a?.defaultLayerType&&(c=a.defaultLayerType);const y=t[c];let u=y?i.T[y]:i.T.UnknownLayer;if(v(e)){const a=r?.portal;if(e.itemId){const r=new l.default({id:e.itemId,portal:a});await r.load();const t=(await(0,o.v)(r,new n.L)).className||"UnknownLayer";u=i.T[t]}}else"ArcGISFeatureLayer"===c?function(e){return s(e,"notes")}(e)||function(e){return s(e,"markup")}(e)?u=i.T.MapNotesLayer:function(e){return s(e,"route")}(e)?u=i.T.RouteLayer:b(e)&&(u=i.T.GroupLayer):e.wmtsInfo?.url&&e.wmtsInfo.layerIdentifier?u=i.T.WMTSLayer:"WFS"===c&&"2.0.0"!==e.wfsInfo?.version&&(u=i.T.UnsupportedLayer);return u()}(e,a),e,a)}function b(e){return"ArcGISFeatureLayer"===e.layerType&&!v(e)&&(e.featureCollection?.layers?.length??0)>1}function v(e){return"Feature Collection"===e.type}function T(e){let a;switch(e.origin){case"web-scene":switch(e.layerContainerType){case"basemap":a=f;break;case"ground":a=d;break;case"tables":a=p;break;default:a=u}break;case"link-chart":switch(e.layerContainerType){case"basemap":a=I;break;case"tables":a=h;break;default:a=S}break;default:switch(e.layerContainerType){case"basemap":a=w;break;case"tables":a=m;break;default:a=L}}return a}async function M(e,a,r){const n=new t.Z,i=y(n,Array.isArray(a.layers)?a.layers:[],r);try{try{if(await i,"group"===e.type)return e.layers.addMany(n),e}catch(a){e.destroy();for(const e of n)e.destroy();throw a}}catch(e){throw e}}function G(e,a,r,t,n){e.read({id:`${a.id}-sublayer-${t}`,visibility:r.visibleLayers?.includes(t)??!0},n)}},87344:(e,a,r)=>{r.d(a,{T:()=>t});const t={BingMapsLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(8153)]).then(r.bind(r,2723))).default,BuildingSceneLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9790),r.e(8775),r.e(7899),r.e(957),r.e(1423),r.e(3778),r.e(7215),r.e(4723),r.e(9238),r.e(6170),r.e(1767),r.e(2139),r.e(3554)]).then(r.bind(r,30223))).default,CSVLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9790),r.e(8775),r.e(7899),r.e(957),r.e(1423),r.e(3778),r.e(7215),r.e(4723),r.e(9238),r.e(7587)]).then(r.bind(r,45425))).default,DimensionLayer:async()=>(await Promise.all([r.e(163),r.e(9717)]).then(r.bind(r,40081))).default,ElevationLayer:async()=>(await Promise.all([r.e(163),r.e(9016),r.e(2763)]).then(r.bind(r,65665))).default,FeatureLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9790),r.e(8775),r.e(7899),r.e(957),r.e(1423),r.e(3778),r.e(7215),r.e(4723),r.e(9238),r.e(447)]).then(r.bind(r,19238))).default,GeoJSONLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9790),r.e(8775),r.e(7899),r.e(957),r.e(1423),r.e(3778),r.e(7215),r.e(2934)]).then(r.bind(r,23477))).default,GeoRSSLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9790),r.e(6e3)]).then(r.bind(r,3723))).default,GroupLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9059)]).then(r.bind(r,40504))).default,ImageryLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9790),r.e(8775),r.e(7899),r.e(957),r.e(4599),r.e(6610),r.e(1319),r.e(4608)]).then(r.bind(r,60590))).default,ImageryTileLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9790),r.e(8775),r.e(7899),r.e(6610),r.e(1319),r.e(4136),r.e(9532)]).then(r.bind(r,74878))).default,IntegratedMeshLayer:async()=>(await Promise.all([r.e(163),r.e(1767),r.e(1537)]).then(r.bind(r,9310))).default,KMLLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9790),r.e(8775),r.e(7899),r.e(1423),r.e(6413)]).then(r.bind(r,42756))).default,LineOfSightLayer:async()=>(await Promise.all([r.e(163),r.e(4998)]).then(r.bind(r,21786))).default,LinkChartLayer:async()=>(await Promise.all([r.e(4609),r.e(9790),r.e(8775),r.e(7899),r.e(957),r.e(1423),r.e(7215),r.e(8968),r.e(3794),r.e(6939)]).then(r.bind(r,19087))).default,MapImageLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9790),r.e(8775),r.e(7899),r.e(957),r.e(1423),r.e(3778),r.e(4599),r.e(9735),r.e(2725),r.e(7374)]).then(r.bind(r,27374))).default,MapNotesLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9790),r.e(8775),r.e(7899),r.e(957),r.e(1423),r.e(3778),r.e(7215),r.e(4723),r.e(9238),r.e(6618)]).then(r.bind(r,62128))).default,MediaLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(4828)]).then(r.bind(r,57765))).default,OGCFeatureLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9790),r.e(8775),r.e(7899),r.e(957),r.e(1423),r.e(3778),r.e(7215),r.e(3966),r.e(2118)]).then(r.bind(r,88068))).default,OpenStreetMapLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9971),r.e(6237)]).then(r.bind(r,66237))).default,OrientedImageryLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9790),r.e(8775),r.e(7899),r.e(957),r.e(1423),r.e(3778),r.e(7215),r.e(4723),r.e(9238),r.e(178)]).then(r.bind(r,44958))).default,PointCloudLayer:async()=>(await Promise.all([r.e(163),r.e(8775),r.e(1767),r.e(7863)]).then(r.bind(r,10608))).default,RouteLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9790),r.e(8775),r.e(7899),r.e(1423),r.e(9206)]).then(r.bind(r,40153))).default,SceneLayer:async()=>(await Promise.all([r.e(163),r.e(9790),r.e(8775),r.e(7899),r.e(957),r.e(1423),r.e(3778),r.e(6170),r.e(1767),r.e(2139),r.e(299)]).then(r.bind(r,57476))).default,StreamLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9790),r.e(8775),r.e(7899),r.e(957),r.e(1423),r.e(3778),r.e(7215),r.e(5936)]).then(r.bind(r,88387))).default,SubtypeGroupLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9790),r.e(8775),r.e(7899),r.e(957),r.e(1423),r.e(3778),r.e(4723),r.e(7157),r.e(7021)]).then(r.bind(r,20697))).default,TileLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9790),r.e(8775),r.e(7899),r.e(957),r.e(1423),r.e(3778),r.e(4599),r.e(9735),r.e(9016),r.e(2725),r.e(8636)]).then(r.bind(r,98636))).default,UnknownLayer:async()=>(await r.e(4166).then(r.bind(r,44166))).default,UnsupportedLayer:async()=>(await r.e(9296).then(r.bind(r,39296))).default,VectorTileLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9016),r.e(4325),r.e(9805),r.e(5481)]).then(r.bind(r,94756))).default,VoxelLayer:async()=>(await Promise.all([r.e(163),r.e(8775),r.e(1767),r.e(7528)]).then(r.bind(r,28865))).default,WFSLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9790),r.e(8775),r.e(7899),r.e(957),r.e(1423),r.e(3778),r.e(7215),r.e(8089),r.e(7740)]).then(r.bind(r,12653))).default,WMSLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9790),r.e(8775),r.e(7915)]).then(r.bind(r,25906))).default,WMTSLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9971),r.e(2594)]).then(r.bind(r,72594))).default,WebTileLayer:async()=>(await Promise.all([r.e(163),r.e(4609),r.e(9971)]).then(r.bind(r,16199))).default}},33516:(e,a,r)=>{r.d(a,{M4:()=>o,Yv:()=>l,ht:()=>i,wk:()=>s});var t=r(17452),n=r(48522);function i(e){return{origin:"portal-item",url:(0,t.mN)(e.itemUrl),portal:e.portal||n.Z.getDefault(),portalItem:e,readResourcePaths:[]}}function l(e){const a=(0,t.mN)(e.itemUrl);return{origin:"portal-item",messages:[],writtenProperties:[],url:a,portal:e.portal||n.Z.getDefault(),portalItem:e,verifyItemRelativeUrls:a?{rootPath:a.path,writtenUrls:[]}:null,blockedRelativeUrls:[]}}function s(e){return{origin:"web-map",url:(0,t.mN)(e.itemUrl),portal:e.portal||n.Z.getDefault(),portalItem:e,readResourcePaths:[]}}function o(e,a){const r=(0,t.mN)(e.itemUrl);return{origin:"web-map",messages:[],writtenProperties:[],url:r,portal:e.portal||n.Z.getDefault(),portalItem:e,initiator:a,verifyItemRelativeUrls:r?{rootPath:r.path,writtenUrls:[]}:null,blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}}}},18062:(e,a,r)=>{r.d(a,{load:()=>L});var t=r(20102),n=r(66677),i=r(52104),l=r(7335),s=r(70024),o=r(87344),c=r(48522),y=r(33516),u=r(3072),d=r(14661),p=r(40555),f=r(96187);async function L(e,a){const r=e.instance.portalItem;if(r?.id)return await r.load(a),function(e){const a=e.instance.portalItem;if(!a?.type||!e.supportedTypes.includes(a.type))throw new t.Z("portal:invalid-layer-item-type","Invalid layer item type '${type}', expected '${expectedType}'",{type:a?.type,expectedType:e.supportedTypes.join(", ")})}(e),async function(e,a){const r=e.instance,n=r.portalItem;if(!n)return;const{url:o,title:c}=n,L=(0,y.ht)(n);if("group"===r.type)return async function(e,a,r){const n=e.portalItem;if(!e.sourceIsPortalItem)return;const{title:o,type:c}=n;if("Group Layer"===c){if(!(0,d._$)(n,"Map"))throw new t.Z("portal:invalid-layer-item-typekeyword","'Group Layer' item without 'Map' type keyword is not supported");return async function(e){const a=e.portalItem,r=await a.fetchData("json");if(!r)return;const t=(0,y.wk)(a);e.read(r,t),await(0,s.k)(e,r,{context:t}),e.resourceReferences={portalItem:a,paths:t.readResourcePaths??[]}}(e)}return e.read({title:o},a),async function(e,a){let r;const{portalItem:n}=e;if(!n)return;const s=n.type,o=a.layerModuleTypeMap;switch(s){case"Feature Service":case"Feature Collection":r=o.FeatureLayer;break;case"Stream Service":r=o.StreamLayer;break;case"Scene Service":r=o.SceneLayer;break;default:throw new t.Z("portal:unsupported-item-type-as-group",`The item type '${s}' is not supported as a 'IGroupLayer'`)}const c=new l.L;let[y,d]=await Promise.all([r(),S(a,c)]),p=()=>y;if("Feature Service"===s){d=n.url?await(0,u.$O)(d,n.url,c):{};const a=(0,u.XX)(d),r=(0,u._Y)(d),t=[];if(a.length||r?.length){a.length&&t.push("SubtypeGroupLayer"),r?.length&&t.push("OrientedImageryLayer");const e=[];for(const a of t){const r=o[a];e.push(r())}const n=await Promise.all(e),i=new Map;t.forEach(((e,a)=>{i.set(e,n[a])})),p=e=>e.layerType?i.get(e.layerType)??y:y}const l=await async function(e){const{layersJSON:a}=await(0,i.V)(e);if(!a)return null;const r=[...a.layers,...a.tables];return e=>r.find((a=>a.id===e.id))}(n.url);return await m(e,p,d,l)}return"Scene Service"===s&&n.url&&(d=await(0,u.CD)(n,d,c)),(0,u.Q4)(d)>0?await m(e,p,d):await async function(e,a){const{portalItem:r}=e;if(!r?.url)return;const t=await(0,f.T)(r.url);t&&m(e,a,{layers:t.layers?.map(u.bS),tables:t.tables?.map(u.bS)})}(e,p)}(e,r)}(r,L,e);o&&r.read({url:o},L);const w=new l.L,h=await S(e,w,a);return h&&r.read(h,L),r.resourceReferences={portalItem:n,paths:L.readResourcePaths??[]},"subtype-group"!==r.type&&r.read({title:c},L),(0,p.y)(r,L)}(e,a)}async function m(e,a,r,t){let n=r.layers||[];const i=r.tables||[];if("Feature Collection"===e.portalItem?.type?(n.forEach(((e,a)=>{e.id=a,"Table"===e?.layerDefinition?.type&&i.push(e)})),n=n.filter((e=>"Table"!==e?.layerDefinition?.type))):(n.reverse(),i.reverse()),n.forEach((n=>{const i=t?.(n);if(i||!t){const t=w(e,a(n),r,n,i);e.add(t)}})),i.length){const a=await o.T.FeatureLayer();i.forEach((n=>{const i=t?.(n);if(i||!t){const t=w(e,a,r,n,i);e.tables.add(t)}}))}}function w(e,a,r,t,n){const i=e.portalItem,l={portalItem:i.clone(),layerId:t.id};null!=t.url&&(l.url=t.url);const s=new a(l);if("sourceJSON"in s&&(s.sourceJSON=n),"subtype-group"!==s.type&&(s.sublayerTitleMode="service-name"),"Feature Collection"===i.type){const e={origin:"portal-item",portal:i.portal||c.Z.getDefault()};s.read(t,e);const a=r.showLegend;null!=a&&s.read({showLegend:a},e)}return s}async function S(e,a,r){if(!1===e.supportsData)return;const t=e.instance,i=t.portalItem;if(!i)return;let l=null;try{l=await i.fetchData("json",r)}catch(e){}if(function(e){return"stream"!==e.type&&"layerId"in e}(t)){let e=null;const r=await async function(e,a,r){if(a?.layers&&a?.tables)return(0,u.Q4)(a);const t=(0,n.Qc)(e.url);if(!t)return 1;const i=await r.fetchServiceMetadata(t.url.path).catch((()=>null));return(a?.layers?.length??i?.layers?.length??0)+(a?.tables?.length??i?.tables?.length??0)}(i,l,a);if((l?.layers||l?.tables)&&r>0){if(null==t.layerId){const e=(0,u.XX)(l);t.layerId="subtype-group"===t.type?e?.[0]:(0,u.Ok)(l)}e=function(e,a){const{layerId:r}=a,t=e.layers?.find((e=>e.id===r))||e.tables?.find((e=>e.id===r));return t&&function(e,a){return!("feature"===a.type&&"layerType"in e&&"SubtypeGroupLayer"===e.layerType||"subtype-group"===a.type&&!("layerType"in e))}(t,a)?t:null}(l,t),e&&null!=l.showLegend&&(e.showLegend=l.showLegend)}return r>1&&"sublayerTitleMode"in t&&"service-name"!==t.sublayerTitleMode&&(t.sublayerTitleMode="item-title-and-service-name"),e}return l}},3072:(e,a,r)=>{r.d(a,{$O:()=>i,CD:()=>y,Ok:()=>l,Q4:()=>s,XX:()=>o,_Y:()=>c,bS:()=>n});var t=r(71592);function n(e){const a={id:e.id,name:e.name};return"Oriented Imagery Layer"===e.type&&(a.layerType="OrientedImageryLayer"),a}async function i(e,a,r){if(null==e?.layers||null==e?.tables){const t=await r.fetchServiceMetadata(a);(e=e||{}).layers=e.layers||t?.layers?.map(n),e.tables=e.tables||t?.tables?.map(n)}return e}function l(e){const a=e.layers;if(a?.length)return a[0].id;const r=e.tables;return r?.length?r[0].id:null}function s(e){return(e?.layers?.length??0)+(e?.tables?.length??0)}function o(e){const a=[];return e?.layers?.forEach((e=>{"SubtypeGroupLayer"===e.layerType&&a.push(e.id)})),a}function c(e){return e?.layers?.filter((({layerType:e})=>"OrientedImageryLayer"===e)).map((({id:e})=>e))}async function y(e,a,r){if(!e?.url)return a??{};if(a??={},!a.layers){const t=await r.fetchServiceMetadata(e.url);a.layers=t.layers?.map(n)}const{serverUrl:i,portalItem:l}=await(0,t.w)(e.url,{sceneLayerItem:e}).catch((()=>({serverUrl:null,portalItem:null})));if(null==i)return a.tables=[],a;if(!a.tables&&l){const e=await l.fetchData();if(e?.tables)a.tables=e.tables.map(n);else{const e=await r.fetchServiceMetadata(i);a.tables=e?.tables?.map(n)}}if(a.tables)for(const e of a.tables)e.url=`${i}/${e.id}`;return a}},28008:(e,a,r)=>{r.d(a,{fromItem:()=>u,v:()=>d});var t=r(20102),n=r(71592),i=r(7335),l=r(84230),s=r(87344),o=r(15235),c=r(3072),y=r(14661);async function u(e){!e.portalItem||e.portalItem instanceof o.default||(e={...e,portalItem:new o.default(e.portalItem)});const a=await async function(e){await e.load();const a=new i.L;return async function(e){const a=e.className,r=s.T[a];return{constructor:await r(),properties:e.properties}}(await d(e,a))}(e.portalItem);return new(0,a.constructor)({portalItem:e.portalItem,...a.properties})}async function d(e,a){switch(e.type){case"Map Service":return async function(e,a){return await async function(e,a){return(await a.fetchServiceMetadata(e.url)).tileInfo}(e,a)?{className:"TileLayer"}:{className:"MapImageLayer"}}(e,a);case"Feature Service":return async function(e,a){const r=await p(e,a);if("object"==typeof r){const e={};return null!=r.id&&(e.layerId=r.id),{className:r.className||"FeatureLayer",properties:e}}return{className:"GroupLayer"}}(e,a);case"Feature Collection":return async function(e){await e.load();const a=(0,y._$)(e,"Map Notes"),r=(0,y._$)(e,"Markup");if(a||r)return{className:"MapNotesLayer"};if((0,y._$)(e,"Route Layer"))return{className:"RouteLayer"};const t=await e.fetchData();return 1===(0,c.Q4)(t)?{className:"FeatureLayer"}:{className:"GroupLayer"}}(e);case"Scene Service":return async function(e,a){const r=await p(e,a,(async()=>{try{if(!e.url)return[];const{serverUrl:r}=await(0,n.w)(e.url,{sceneLayerItem:e}),t=await a.fetchServiceMetadata(r);return t?.tables??[]}catch{return[]}}));if("object"==typeof r){const t={};let n;if(null!=r.id?(t.layerId=r.id,n=`${e.url}/layers/${r.id}`):n=e.url,e.typeKeywords?.length)for(const a of Object.keys(l.fb))if(e.typeKeywords.includes(a))return{className:l.fb[a]};const i=await a.fetchServiceMetadata(n);return{className:l.fb[i?.layerType]||"SceneLayer",properties:t}}if(!1===r){const r=await a.fetchServiceMetadata(e.url);if("Voxel"===r?.layerType)return{className:"VoxelLayer"}}return{className:"GroupLayer"}}(e,a);case"Image Service":return async function(e,a){await e.load();const r=e.typeKeywords?.map((e=>e.toLowerCase()))??[];if(r.includes("elevation 3d layer"))return{className:"ElevationLayer"};if(r.includes("tiled imagery"))return{className:"ImageryTileLayer"};const t=await e.fetchData(),n=t?.layerType;if("ArcGISTiledImageServiceLayer"===n)return{className:"ImageryTileLayer"};if("ArcGISImageServiceLayer"===n)return{className:"ImageryLayer"};const i=await a.fetchServiceMetadata(e.url),l=i.cacheType?.toLowerCase(),s=i.capabilities?.toLowerCase().includes("tilesonly");return"map"===l||s?{className:"ImageryTileLayer"}:{className:"ImageryLayer"}}(e,a);case"Stream Service":case"Feed":return{className:"StreamLayer"};case"Vector Tile Service":return{className:"VectorTileLayer"};case"GeoJson":return{className:"GeoJSONLayer"};case"CSV":return{className:"CSVLayer"};case"KML":return{className:"KMLLayer"};case"WFS":return{className:"WFSLayer"};case"WMTS":return{className:"WMTSLayer"};case"WMS":return{className:"WMSLayer"};case"Group Layer":return{className:"GroupLayer"};default:throw new t.Z("portal:unknown-item-type","Unknown item type '${type}'",{type:e.type})}}async function p(e,a,r){const t=e.url;if(!t||/\/\d+$/.test(t))return{};await e.load();let n=await e.fetchData();if("Feature Service"===e.type){const e=await(0,c.$O)(n,t,a),r=f(e);if("object"==typeof r){const a=(0,c.XX)(e),t=(0,c._Y)(e);r.className=null!=r.id&&a.includes(r.id)?"SubtypeGroupLayer":null!=r.id&&t?.includes(r.id)?"OrientedImageryLayer":"FeatureLayer"}return r}if("Scene Service"===e.type&&(n=await(0,c.CD)(e,n,a)),(0,c.Q4)(n)>0)return f(n);const i=await a.fetchServiceMetadata(t);return r&&(i.tables=await r()),f(i)}function f(e){return 1===(0,c.Q4)(e)&&{id:(0,c.Ok)(e)}}},40555:(e,a,r)=>{r.d(a,{y:()=>l});var t=r(66643),n=r(95330),i=r(20941);async function l(e,a,r){const l=e&&e.getAtOrigin&&e.getAtOrigin("renderer",a.origin);if(l&&"unique-value"===l.type&&l.styleOrigin){const s=await(0,t.q6)(l.populateFromStyle());if((0,n.k_)(r),!1===s.ok){const r=s.error;a?.messages&&a.messages.push(new i.Z("renderer:style-reference",`Failed to create unique value renderer from style reference: ${r.message}`,{error:r,context:a})),e.clear("renderer",a?.origin)}}}},96187:(e,a,r)=>{r.d(a,{T:()=>n});var t=r(3172);async function n(e,a){const{data:r}=await(0,t.Z)(e,{responseType:"json",query:{f:"json",...a?.customParameters,token:a?.apiKey}});return r}}}]);
|