(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-425aac71"],{"0c45":function(e,t,s){"use strict";s.r(t),s.d(t,"default",(function(){return St})),s.d(t,"getInstances",(function(){return bt}));var r=s("a4ee"),i=s("9096"),n=s("c120"),a=s("59b2"),o=(s("b50f"),s("cea0"),s("d386")),c=s("7f83"),u=s("dff3");function d(e){return"heatmap"===e?s.e("chunk-6020b8b6").then(s.bind(null,"331e")):Promise.all([s.e("chunk-01b259ce"),s.e("chunk-11343bbf")]).then(s.bind(null,"0ec3"))}var l=s("b2b2"),h=s("f4cc"),f=s("477c"),p=s("6655"),g=s("6411"),_=s("80b7"),y=s("0c9a"),m=s("54b4"),b=s("2eab"),I=s("ce50"),S=s("e92d"),x=s("67c2"),O=s("008c"),v=s("7e5e"),w=s("e9fc"),j=s("434a"),T=s("013b"),F=s("9392"),C=s("8152"),A=s("f0d0"),k=s("f97e");const E=268435455;class M{constructor(){this.fieldMap=new Map,this.fields=[],this.hasFeatures=!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}hasField(e){return this.fieldMap.has(e)}isDateField(e){var t;return null==(t=this.fieldMap.get(e))?void 0:t.isDate}getFieldIndex(e){var t;return null==(t=this.fieldMap.get(e))?void 0:t.index}}function R(e){const t=1,s=2,r=e.getLength(),i=e.pos()+r,n={name:"",isDate:!1};for(;e.pos()0}class W extends A["a"]{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}static fromBuffer(e,t,s=!1){const r=t.geometryType,i=H(e),n=L(i,"esriGeometryPoint"===r,s),a=A["a"].createInstance();return new W(a,i,n,t)}get geometryType(){return this._geometryType}get size(){return this._header.featureCount}get hasZ(){return!1}get hasM(){return!1}get stride(){return 2+(this.hasZ?1:0)+(this.hasM?1:0)}get hasFeatures(){return this._header.hasFeatures}get hasNext(){return this._hasNext}get exceededTransferLimit(){return this._header.exceededTransferLimit}hasField(e){return this._header.hasField(e)||this._header.hasField(Q(e))}getFieldNames(){return this._header.fields.map(e=>e.fieldName)}getSize(){return this.size}getQuantizationTransform(){return this._header.transform}getCursor(){return this.copy()}getIndex(){return this._featureIndex}setIndex(e){this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0,this._featureIndex=e}getAttributeHash(){let e="";return this._header.fields.forEach(({index:t})=>{e+=this._readAttributeAtIndex(t)+"."}),e}getObjectId(){return this._readAttributeAtIndex(this._header.objectIdFieldIndex)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(e){this._header.displayIds[this._featureIndex]=e}getGroupId(){return this._header.groupIds[this._featureIndex]}setGroupId(e){this._header.groupIds[this._featureIndex]=e}readLegacyFeature(){if(void 0===this._cache.legacyFeature){var e;const t=this.readCentroid(),s={attributes:this.readAttributes(),geometry:this._isPoints?this.readLegacyPointGeometry():this.readLegacyGeometry(),centroid:null!=(e=t&&{x:t.coords[0],y:t.coords[1]})?e:null};return this._cache.legacyFeature=s,s}return this._cache.legacyFeature}readOptimizedFeature(){if(void 0===this._cache.optFeature){const e=new F["a"](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 Object(l["j"])(t)?e:e*t.scale[0]+t.translate[0]}getYHydrated(){const e=this._header.centroid[2*this._featureIndex+1],t=this.getQuantizationTransform();return Object(l["j"])(t)?e:t.translate[1]-e*t.scale[1]}getX(){return this._header.centroid[2*this._featureIndex]*this._sx+this._tx}getY(){return this._header.centroid[2*this._featureIndex+1]*this._sy+this._ty}readLegacyPointGeometry(){return{x:this.getX(),y:this.getY()}}readLegacyGeometry(e){const t=this.readGeometry(e);return Object(p["l"])(t,this.geometryType,!1,!1)}readLegacyCentroid(){const e=this.readCentroid();if(!e)return null;const[t,s]=e.coords;return{x:t,y:s}}readGeometryArea(){return this._cache.area||this.readGeometry(!0),this._cache.area}readUnquantizedGeometry(e=!1){if(void 0===this._cache.unquantGeometry){const t=this.readGeometry(e);if(!t)return this._cache.unquantGeometry=null,null;const s=B(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]=this._readAttributeAtIndex(s)}),e}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._featureOffset=this._featureOffset,e._hasNext=this._hasNext}_readAttributeAtIndex(e){const t=this._header.offsets.attributes[this._featureIndex*this._header.fieldCount+e],s=this._reader;return s.move(t),Y(s)}_parseGeometry(e){const t=2,s=3,r=e.getLength(),i=e.pos()+r,n=[],a=[];for(;e.pos()u.length)for(let t=0;t=t?(d+=-.5*(a-o)*(p+l),i>1&&X(u[c-2],u[c-1],h,f)?(u[c-2]+=h,u[c-1]+=f):(u[c++]=h,u[c++]=f,i++),o=a,l=p):(s+=h,n+=f),h=s,f=n,r++}i<3||n?c-=2*i:(d+=-.5*(o+h-o)*(l+f+l),X(u[c-2],u[c-1],h,f)?(u[c-2]+=h,u[c-1]+=f,a.push(i)):(u[c++]=h,u[c++]=f,a.push(++i)))}else{let t=0,r=e.getSInt32(),i=e.getSInt32();this.hasZ&&e.getSInt32(),this.hasM&&e.getSInt32(),u[c++]=r,u[c++]=i,t+=1;for(let n=1;n2&&X(u[c-2],u[c-1],s,a)?(u[c-2]+=s,u[c-1]+=a):(u[c++]=s,u[c++]=a,t+=1),r=o,i=l}a.push(t)}break}default:e.skip()}if(this._cache.area=d,!a.length)return null;if(this._tx||this._ty){let e=0;for(const t of a)u[2*e]+=this._tx,u[2*e+1]+=this._ty,e+=t}return new C["a"](a,u)}}class ${constructor(e){this.service=e}destroy(){}}function J(e){return Array.isArray(e.source)}function K(e){return e&&e.capabilities&&e.collection&&e.layerDefinition}function ee(e){const{capabilities:t}=e;return K(e.source)?new ne(e):J(e)?new se(e):t.query.supportsFormatPBF&&Object(n["a"])("featurelayer-pbf")?new re(e):new ie(e)}async function te(e){const t=new x["a"];return await t.open(e,{}),t}class se extends ${constructor(e){super(e),this._portsOpen=te(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 j["a"].fromFeatureSet(s,this.service)}}class re extends ${async executeQuery(e,t){const{data:s}=await Object(w["executeQueryPBFBuffer"])(this.service.source,e,t),r=!e.quantizationParameters;return W.fromBuffer(s,this.service,r)}}class ie extends ${async executeQuery(e,t){const{source:s,capabilities:r,spatialReference:i,objectIdField:n,geometryType:a}=this.service;if(Object(l["k"])(e.quantizationParameters)&&!r.query.supportsQuantization){const r=e.clone(),a=Object(O["c"])(Object(l["t"])(r.quantizationParameters));r.quantizationParameters=null;const{data:o}=await Object(w["executeQuery"])(s,r,i,t),c=Object(p["b"])(o,n);return Object(p["u"])(a,c),j["a"].fromOptimizedFeatureSet(c,this.service)}const{data:o}=await Object(w["executeQuery"])(s,e,this.service.spatialReference,t);var c;return"esriGeometryPoint"===a&&(o.features=null==(c=o.features)?void 0:c.filter(e=>{if(Object(l["k"])(e.geometry)){const t=e.geometry;return Number.isFinite(t.x)&&Number.isFinite(t.y)}return!0})),j["a"].fromFeatureSet(o,this.service)}}class ne extends ${async executeQuery(e,t){const{capabilities:s}=this.service;if(e.quantizationParameters&&!s.query.supportsQuantization){const s=e.clone(),r=Object(O["c"])(Object(l["t"])(s.quantizationParameters));s.quantizationParameters=null;const i=await Object(v["j"])(this.service.source,e,t);return Object(p["u"])(r,i),j["a"].fromOptimizedFeatureSet(i,this.service)}const r=await Object(v["j"])(this.service.source,e,t);return j["a"].fromOptimizedFeatureSet(r,this.service)}}var ae=s("658b"),oe=s("ce6d"),ce=s("0f1c"),ue=s("69dd"),de=s("971e");class le{constructor(){this.source=!1,this.targets={feature:!1,aggregate:!1},this.storage={filters:!1,data:!1},this.mesh=!1,this.queryFilter=!1,this.why={mesh:[],source:[]}}static create(e){const t=new le;for(const s in e){const r=e[s];if("object"==typeof r)for(const e in r){const i=r[e];t[s][e]=i}t[s]=r}return t}static empty(){return le.create({})}static all(){return le.create({source:!0,targets:{feature:!0,aggregate:!0},storage:{filters:!0,data:!0},mesh:!0})}unset(e){e.source&&(this.source=!1),e.targets.feature&&(this.targets.feature=!1),e.targets.aggregate&&(this.targets.aggregate=!1),e.storage.filters&&(this.storage.filters=!1),e.storage.data&&(this.storage.data=!1),e.mesh&&(this.mesh=!1),e.queryFilter&&(this.queryFilter=!1)}any(){return this.source||this.mesh||this.storage.filters||this.storage.data||this.targets.feature||this.targets.aggregate||this.queryFilter}describe(){let e=0,t="";if(this.mesh){e+=20,t+="-> (20) Mesh needs update\n";for(const e of this.why.mesh)t+=` + ${e}\n`}if(this.source){e+=10,t+="-> (10) The source needs update\n";for(const e of this.why.source)t+=` + ${e}\n`}this.targets.feature&&(e+=5,t+="-> (5) Feature target parameters changed\n"),this.storage.filters&&(e+=5,t+="-> (5) Feature filter parameters changed\n"),this.targets.aggregate&&(e+=4,t+="-> (4) Aggregate target parameters changed\n"),this.storage.data&&(e+=1,t+="-> (1) Texture storage parameters changed");const s=e<5?"Fastest":e<10?"Fast":e<15?"Moderate":e<20?"Slow":"Very Slow";console.debug(`Applying ${s} update of cost ${e}/45 `),console.debug(t)}toJSON(){return{queryFilter:this.queryFilter,source:this.source,targets:this.targets,storage:this.storage,mesh:this.mesh}}}class he{constructor(e){this.requests={done:new Array,stream:new de["a"](10)},this._edits=null,this._abortController=new AbortController,this._done=!1,this.didSend=!1,this.tile=e}get signal(){return this._abortController.signal}get options(){return{signal:this._abortController.signal}}get empty(){return!this.requests.done.length}get edits(){return this._edits}get done(){return this._done}end(){this._done=!0}clear(){this.requests.done=[]}applyUpdate(e){this.requests.done.forEach(t=>t.message.status.unset(e)),Object(l["k"])(this._edits)&&this._edits.status.unset(e)}add(e){var t;e.message.status=null!=(t=e.message.status)?t:le.empty(),e.message.end&&this.requests.done.forEach(e=>{Object(l["k"])(e.message)&&e.message.end&&(e.message.end=!1)}),this.requests.done.push(e)}edit(e,t){const s=e.getQuantizationTransform(),r=e.fullSchema(),i=Array.from(e.features()),n=[...t,...i.map(e=>e.objectId)];this.removeIds(n),this._invalidate(),Object(l["j"])(this._edits)?this._edits={type:"append",addOrUpdate:j["a"].fromOptimizedFeatures(i,r,Object(l["t"])(s)),id:this.tile.id,status:le.empty(),end:!0}:(this.requests.done.forEach(e=>e.message.end=!1),Object(l["t"])(this._edits.addOrUpdate).append(e.features()))}*readers(){for(const{message:e}of this.requests.done)Object(l["k"])(e.addOrUpdate)&&(yield e.addOrUpdate);Object(l["k"])(this._edits)&&Object(l["k"])(this._edits.addOrUpdate)&&(yield this._edits.addOrUpdate)}_invalidate(){for(const e of this.requests.done)e.message.status=le.empty();Object(l["k"])(this._edits)&&(this._edits.status=le.empty())}removeIds(e){this._invalidate();for(const{message:t}of this.requests.done){const s=t.addOrUpdate;Object(l["k"])(s)&&(s.removeIds(e),s.isEmpty&&(t.addOrUpdate=null))}Object(l["k"])(this._edits)&&Object(l["k"])(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()}}function fe(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)}class pe{constructor(e){this.events=new oe["a"],this._resolver=Object(h["g"])(),this._didEdit=!1,this._subscriptions=new Map,this._outSR=e.outSR,this._serviceInfo=e.serviceInfo,this._onTileUpdateMessage=e.onMessage}destroy(){}async _onMessage(e){var t,s;const r=this._subscriptions.get(e.id);if(!r)return;const i={...e,remove:null!=(t=e.remove)?t:[],status:null!=(s=e.status)?s:le.empty()};return Object(h["l"])(this._onTileUpdateMessage(i,r.options))}update(e,t){var s;const r=t.fields.length;t.outFields=fe(null==(s=this._schema)?void 0:s.outFields,t.outFields),t.outFields=t.outFields.length>=.75*r?["*"]:t.outFields,t.outFields.sort();const i=Object(ce["a"])(this._schema,t);if(!i)return;Object(n["a"])("esri-2d-update-debug")&&console.debug("Applying Update - Source:",i);const a="orderByFields"in this._serviceInfo&&this._serviceInfo.orderByFields?this._serviceInfo.orderByFields:this._serviceInfo.objectIdField+" ASC",o={returnCentroid:Object(n["a"])("esri-2d-query-centroid-enabled")&&"esriGeometryPolygon"===this._serviceInfo.geometryType,returnGeometry:!0,timeReferenceUnknownClient:"stream"!==this._serviceInfo.type&&this._serviceInfo.timeReferenceUnknownClient,outFields:t.outFields,outSpatialReference:this._outSR,orderByFields:[a],where:t.definitionExpression||"1=1",gdbVersion:t.gdbVersion,historicMoment:t.historicMoment,timeExtent:ae["a"].fromJSON(t.timeExtent)},c=this._schema&&Object(ce["b"])(i,"outFields");this._schema&&Object(ce["c"])(i,["timeExtent","definitionExpression","gdbVersion","historicMoment","customParameters"])&&(e.why.mesh.push("Layer filter and/or custom parameters changed"),e.why.source.push("Layer filter and/or custom parameters changed"),e.mesh=!0,e.source=!0,e.queryFilter=!0),c&&(e.why.source.push("Layer required fields changed"),e.source=!0),Object(ce["a"])(o,this._queryInfo)&&(this._queryInfo=o),this._schema=t,this._resolver.resolve()}whenInitialized(){return this._resolver.promise}async applyUpdate(e){if(e.queryFilter||e.source&&this._didEdit)return this.refresh(),void(this._didEdit=!1);this._subscriptions.forEach(t=>t.applyUpdate(e)),await this.resend()}refresh(){for(const e of this._tiles())this.unsubscribe(e),this.subscribe(e)}subscribe(e){const t=new he(e);this._subscriptions.set(e.id,t)}unsubscribe(e){const t=this.get(e.id);Object(l["k"])(t)&&t.abort(),this._subscriptions.delete(e.id)}createQuery(e={}){const t=this._queryInfo.historicMoment?new Date(this._queryInfo.historicMoment):null;return new ue["a"]({...this._queryInfo,historicMoment:t,...e})}get(e){return this._subscriptions.has(e)?this._subscriptions.get(e):null}async queryLastEditDate(){throw new Error("Service does not support query type")}async query(e){throw new Error("Service does not support query")}*_tiles(){const e=Array.from(this._subscriptions.values());for(const t of e)yield t.tile}async edit(e,t){const s=Array.from(this._subscriptions.values()),r=s.map(({tile:e})=>e);for(const i of s)i.removeIds(t);if(e.length){const s=r.map(t=>{const s=this.createTileQuery(t);return s.objectIds=e,{tile:t,query:s}}).map(async({tile:e,query:t})=>({tile:e,result:await this.query(t),query:t})),i=(await Object(h["k"])(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 Object(h["j"])(i)}this._didEdit=!0}}var ge=s("b541");const _e=S["a"].getLogger("esri.views.2d.layers.features.sources.BaseFeatureSource"),ye=4;class me extends pe{constructor(e){super(e),this.type="feature",this.mode="on-demand",this._adapter=ee(e.serviceInfo),this._queue=new ge["a"]({concurrency:8,process:async e=>{if(Object(h["v"])(e),Object(l["k"])(e.tile)){const t=e.tile.key.id,{signal:s}=e,r=Object(n["a"])("esri-tiles-debug")?{tile:t.replace(/\//g,"."),depth:e.depth}:void 0,i=await this._adapter.executeQuery(e.query,{signal:s,query:{...r,...this._schema.customParameters}});return i.level=e.tile.key.level,i}return this._adapter.executeQuery(e.query,{...e,query:this._schema.customParameters})}}),this._patchQueue=new ge["a"]({concurrency:8,process:async e=>{if(Object(h["v"])(e),Object(l["k"])(e.tile)){const t=e.tile.key.id,{signal:s}=e,r=Object(n["a"])("esri-tiles-debug")?{tile:t.replace(/\//g,"."),depth:e.depth}:void 0,i=await this._adapter.executeQuery(e.query,{signal:s,query:{...r,...this._schema.customParameters}});return i.level=e.tile.key.level,i}return this._adapter.executeQuery(e.query,{...e,query:this._schema.customParameters})}})}destroy(){super.destroy(),this._adapter.destroy(),this._queue.destroy(),this._patchQueue.destroy()}get updating(){return!!this._queue.length||Array.from(this._subscriptions.values()).some(e=>!e.done)}get maxRecordCountFactor(){const{query:e}=this._serviceInfo.capabilities;return e.supportsMaxRecordCountFactor?ye:null}get maxPageSize(){var e;const{query:t}=this._serviceInfo.capabilities;return(null!=(e=t.maxRecordCount)?e:8e3)*Object(l["u"])(this.maxRecordCountFactor,1)}get pageSize(){return Math.min(8e3,this.maxPageSize)}enableEvent(e,t){}subscribe(e){super.subscribe(e);const t=this._subscriptions.get(e.id);this._fetchDataTile(e).catch(t=>{Object(h["m"])(t)||_e.error(new I["a"]("mapview-query-error","Encountered error when fetching tile",{tile:e,error:t}))}).then(()=>t.end())}unsubscribe(e){super.unsubscribe(e)}readers(e){return this._subscriptions.get(e).readers()}async query(e){return this._adapter.executeQuery(e,{query:this._schema.customParameters})}async queryLastEditDate(){const e=this._serviceInfo.source,t={...e.query,f:"json"};return(await Object(b["default"])(e.path,{query:t,responseType:"json"})).data.editingInfo.lastEditDate}createTileQuery(e,t={}){var s;const r=this._serviceInfo.geometryType,i=this.createQuery(t);i.quantizationParameters=null!=(s=t.quantizationParameters)?s:e.getQuantizationParameters(),i.resultType="tile",i.geometry=e.extent,this._serviceInfo.capabilities.query.supportsQuantization?"esriGeometryPolyline"===r&&(i.maxAllowableOffset=e.resolution*Object(n["a"])("feature-polyline-generalization-factor")):"esriGeometryPolyline"!==r&&"esriGeometryPolygon"!==r||(i.maxAllowableOffset=e.resolution,"esriGeometryPolyline"===r&&(i.maxAllowableOffset*=Object(n["a"])("feature-polyline-generalization-factor")));const a=this._serviceInfo.capabilities.query;return i.defaultSpatialReferenceEnabled=a.supportsDefaultSpatialReference,i.compactGeometryEnabled=a.supportsCompactGeometry,i}async _executePatchQuery(e,t,s,r){const i=t.clone();i.outFields=[this._serviceInfo.objectIdField,...s],i.returnCentroid=!1,i.returnGeometry=!1;const n=Object(l["k"])(i.start)?i.start/8e3:0,a=r.signal;return this._patchQueue.push({tile:e,query:i,signal:a,depth:n})}async _resend(e,t){const{query:s,message:r}=e,i=Object(l["k"])(s.outFields)?s.outFields:[],n=this._queryInfo.outFields,a=n.filter(e=>!i.includes(e));if(Object(l["j"])(r.addOrUpdate))this._onMessage({...r,type:"append"});else if(a.length)try{const e=this._subscriptions.get(r.id).tile,i=await this._executePatchQuery(e,s,a,t);Object(h["v"])(t),s.outFields=n,r.addOrUpdate.joinAttributes(i),this._onMessage({...r,end:r.end,type:"append"})}catch(o){}else this._onMessage({...r,type:"append"})}async _resendSubscription(e){if(e.empty)return this._onMessage({id:e.tile.id,addOrUpdate:null,end:!1,type:"append"});const t=e.signal;for(const s of e.requests.done)await this._resend(s,{signal:t});return Object(l["k"])(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 be=Object(n["a"])("esri-mobile"),Ie={maxDrillLevel:be?1:4,maxRecordCountFactor:be?1:3};class Se extends me{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 a=async(o,c)=>{const u=this._queryInfo,d=this.createTileQuery(o,{maxRecordCountFactor:t?Ie.maxRecordCountFactor:void 0,returnExceededLimitFeatures:!1,quantizationParameters:i});n++;try{const t=await this._queue.push({tile:e,query:d,signal:r,depth:c});if(n--,Object(h["v"])(r),!t)return;if(u!==this._queryInfo)return void a(o,c);if(t.exceededTransferLimit&&c{const r=t.weakClone(),i=new C["a"],n=!1,a=!1,o=Object(p["v"])(i,t.geometry,n,a,e,s,!1,!1);return r.geometry=o,r}}function Fe(e){return"esriGeometryPoint"===e?e=>Object(l["k"])(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 Object(l["k"])(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}}}function Ce(e,t){const s=Object(xe["a"])(9,Fe(t));return s.load(e),s}function Ae(e,t){return e.search({minX:t.bounds[0],minY:t.bounds[1],maxX:t.bounds[2],maxY:t.bounds[3]})}class ke{constructor(e,t){this.onUpdate=e,this._geometryType=t,this._objectIdToFeature=new Map}get _features(){const e=[];return this._objectIdToFeature.forEach(t=>e.push(t)),e}add(e){this._objectIdToFeature.set(e.objectId,e),this._index=null}get(e){return this._objectIdToFeature.has(e)?this._objectIdToFeature.get(e):null}forEach(e){this._objectIdToFeature.forEach(e)}search(e){return this._index||(this._index=Ce(this._features,this._geometryType)),Ae(this._index,e)}removeById(e){const t=this._objectIdToFeature.get(e);return t?(this._objectIdToFeature.delete(e),this._index=null,t):null}update(e,t){this.onUpdate(e,t)}get size(){return this._objectIdToFeature.size}}class Ee extends pe{constructor(e){super(e),this.type="geoevent",this._dataReceiveEventEnabled=!1,this._level=0,this._updateInfo={websocket:0,client:0};const{outSR:t}=e,{geometryType:s,objectIdField:r,timeInfo:i,purgeOptions:n,source:a,spatialReference:o,serviceFilter:c,maxReconnectionAttempts:u,maxReconnectionInterval:d,updateInterval:l,enableDataReceived:h,customParameters:f}=e.serviceInfo,p=new ke(this._onUpdate.bind(this),s),g=new Oe["a"](p,r,i,n),_=Object(ve["a"])(a,o,t,s,c,u,d,f);this._store=p,this._manager=g,this._connection=_,this._quantize=Te(s),this._dataReceiveEventEnabled=h,this._handles=[this._connection.on("feature",e=>this._onFeature(e)),this._connection.watch("connectionStatus",e=>this.events.emit("connectionStatus",e)),this._connection.watch("errorString",e=>this.events.emit("errorString",e))],this._initUpdateInterval=()=>{let t=performance.now();this._updateIntervalId=setInterval(()=>{const s=performance.now(),r=s-t;if(r>we){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._manager.checkForUpdates()},l)},this._initUpdateInterval()}destroy(){super.destroy(),this._clearUpdateInterval(),this._handles.forEach(e=>e.remove()),this._connection.destroy()}_fetchDataTile(){}pauseStream(){this._clearUpdateInterval()}resumeStream(){this._initUpdateInterval()}enableEvent(e,t){"data-received"===e&&(this._dataReceiveEventEnabled=t)}get updating(){return!1}subscribe(e){super.subscribe(e);const t=this._subscriptions.get(e.id);this._level=e.level;const s=this._getTileFeatures(e);this._onMessage({type:"append",id:e.key.id,addOrUpdate:s,end:!0}),t.didSend=!0}unsubscribe(e){super.unsubscribe(e)}*readers(e){const t=this._subscriptions.get(e),{tile:s}=t;yield this._getTileFeatures(s);for(const r of t.requests.stream.entries)Object(l["k"])(r)&&Object(l["k"])(r.addOrUpdate)&&(yield r.addOrUpdate)}createTileQuery(e){throw new Error("Service does not support tile queries")}async resend(){this._subscriptions.forEach(e=>{const{tile:t}=e,s={type:"append",id:t.id,addOrUpdate:this._getTileFeatures(t),end:!0};this._onMessage(s)})}_getTileFeatures(e){const t=this._store.search(e).map(t=>this._quantize(t,e.transform));return j["a"].fromOptimizedFeatures(t,this._serviceInfo,e.transform)}_onFeature(e){this._updateInfo.websocket++;try{this._dataReceiveEventEnabled&&this.events.emit("feature",e);const t=Object(p["a"])(e,this._serviceInfo.geometryType,!1,!1,this._serviceInfo.objectIdField);this._manager.add(t)}catch(t){}}_clearUpdateInterval(){clearInterval(this._updateIntervalId),this._updateIntervalId=0}_onUpdate(e,t){Object(l["k"])(e)&&(this._updateInfo.client+=e.length),this._subscriptions.forEach((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,clear:!0,end:!1})}),this._subscriptions.forEach((e,t)=>{if(!e.didSend||e.tile.level!==this._level)return;const s=e.tile,r={type:"append",id:t,addOrUpdate:this._getTileFeatures(s),remove:[],end:!0,status:le.empty()};e.requests.stream.enqueue(r),this._onMessage(r)})}}const Me=S["a"].getLogger("esri.views.2d.layers.features.sources.FeatureSource");class Re extends me{constructor(e){super(e)}async _fetchDataTile(e){const t=6,s=20,r=this._subscriptions.get(e.key.id);let i=!1,n=0,a=0;const o=(t,s)=>{a--,Object(h["v"])(r);const n=e.id,o=t.reader,c=t.query;if(!o.exceededTransferLimit){if(i=!0,0!==s&&!o.hasFeatures){const e={id:n,addOrUpdate:o,end:0===a,type:"append"};return r.add({message:e,query:c}),void this._onMessage(e)}const e={id:n,addOrUpdate:o,end:0===a,type:"append"};return r.add({message:e,query:c}),void this._onMessage(e)}const u={id:n,addOrUpdate:o,end:i&&0===a,type:"append"};r.add({message:u,query:c}),this._onMessage(u)};let c=0,u=0;for(;!i&&u++e&&o(e,t)).catch(t=>{i=!0,Object(h["m"])(t)||(Me.error(new I["a"]("mapview-query-error","Encountered error when fetching tile",{tile:e,error:t})),this._onMessage({id:e.id,addOrUpdate:null,end:i,type:"append"}))})}await s,Object(h["v"])(r),c=Math.min(c+2,t)}}async _fetchDataTilePage(e,t,s){Object(h["v"])(s);const r=this._queryInfo,i={start:this.pageSize*t,num:this.pageSize,returnExceededLimitFeatures:!0,quantizationParameters:e.getQuantizationParameters()};Object(l["k"])(this.maxRecordCountFactor)&&(i.maxRecordCountFactor=this.maxRecordCountFactor);const n=this.createTileQuery(e,i);try{const i=s.signal,a=await this._queue.push({tile:e,query:n,signal:i,depth:t});return Object(h["v"])(s),a?r!==this._queryInfo?this._fetchDataTilePage(e,t,s):{reader:a,query:n}:null}catch(a){return Object(h["w"])(a),null}}}var Ne=s("880d"),Le=s("f209");const De=S["a"].getLogger("esri.views.2d.layers.features.sources.SnapshotFeatureSource");function Pe(e,t,s){const r=e.getXHydrated(),i=e.getYHydrated(),n=t.getColumnForX(r),a=Math.floor(t.normalizeCol(n));return`${s}/${Math.floor(t.getRowForY(i))}/${a}`}function Ue(e,t){if(Object(l["j"])(e))return null;const s=t.transform,r=e.getQuantizationTransform();if(Object(l["j"])(r)){const[t,r]=s.scale,[i,n]=s.translate,a=-i/t,o=1/t,c=n/r,u=1/-r;return e.transform(a,c,o,u)}const[i,n]=r.scale,[a,o]=r.translate,[c,u]=s.scale,[d,h]=s.translate,f=i/c,p=(a-d)/c,g=n/u,_=(-o+h)/u;return e.transform(p,_,f,g)}class qe extends me{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 Ne["a"](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._hasAggregates=e.targets.aggregate}async resend(e=!1){if(await this._downloadPromise,this._invalidated||e){const e=Object(l["v"])(this._schema.featureCount,"Expected featureCount to be defined");return 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(){await this.resend(!0)}async _sendPatchQuery(e,t){const s=Object(l["k"])(e.outFields)?e.outFields:[],r=this._queryInfo.outFields,i=r.filter(e=>-1===s.indexOf(e));if(!i.length)return;const n=e.clone(),a=this._signal;n.returnGeometry=!1,n.returnCentroid=!1,n.outFields=i,e.outFields=r;const o=await this._queue.push({query:n,depth:0,signal:a});Object(h["v"])({signal:a}),t.joinAttributes(o)}async _fetchDataTile(e){if(!this._downloadPromise){const e=Object(l["v"])(this._schema.featureCount,"Expected featureCount to be defined");this._downloadPromise=this._download(e)}const t=this._store.search(e),s=this._subscriptions.get(e.key.id),r=t.length-1;for(let o=0;o=0?t[r]:null,e),n=this._didSendEnd,a={type:"append",id:e.id,addOrUpdate:i,end:n,status:le.empty()};s.add({query:null,message:a}),this._onMessage(a)}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(t){De.error("mapview-snapshot-source","Encountered and error when downloading feature snapshot",t)}this._sendEnd(),this._loading=!1}async _downloadPage(e,t,s){const r=this.pageSize,i={start:e*r,num:r,cacheHint:!0};Object(l["k"])(this.maxRecordCountFactor)&&(i.maxRecordCountFactor=this.maxRecordCountFactor);const n=this.createQuery(i),a=this._signal,o=await this._queue.push({query:n,depth:e,signal:a});Object(h["v"])({signal:a}),this._queries.push({query:n,reader:o}),this._store.insert(o),s.add(o.instance);const c=o.getCursor();for(;c.next();)t.set(c.getDisplayId());this._send(o)}_send(e){if(!this._subscriptions.size)return;let t=null;const s=new Map,r=new Set,i=new Map;this._subscriptions.forEach(e=>{var n;const a=e.tile;s.set(a.key.id,null),t=a.tileInfoView,r.add(a.level);const{row:o,col:c}=a.key,u=`${a.level}/${o}/${c}`,d=null!=(n=i.get(u))?n:[];d.push(e),i.set(u,d)});for(const n of r){const r=t.getLODInfoAt(n),a=e.getCursor();for(;a.next();){const e=Pe(a,r,n),t=a.getIndex();if(i.has(e))for(const r of i.get(e)){const e=r.tile.id;let i=s.get(e);Object(l["j"])(i)&&(i=[],s.set(e,i)),i.push(t)}}}s.forEach((t,s)=>{if(Object(l["k"])(t)){const r=this._subscriptions.get(s),i={type:"append",id:s,addOrUpdate:Ue(Le["a"].from(e,t),r.tile),end:!1,status:le.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:le.empty()};e.add({query:null,message:t}),this._onMessage(t)}),this._didSendEnd=!0}}function ze(e,t,s,r,i,n){const a=Ge(e,t,s,r,i,n);switch(a.type){case"feature":switch(a.origin){case"hosted":case"local":return new Re(a);case"snapshot":return new qe(a);case"unknown":return new Se(a)}case"geoevent":return new Ee(a)}}function Ge(e,t,s,r,i,n){switch(e.type){case"snapshot":return{type:"feature",origin:"snapshot",featureCount:Object(l["u"])(e.featureCount,0),serviceInfo:e,onMessage:r,outSR:t,tileInfoView:s,canAcceptRequest:i,store:n};case"stream":return{type:"geoevent",serviceInfo:e,onMessage:r,outSR:t,canAcceptRequest:i};case"memory":case"on-demand":return{type:"feature",serviceInfo:e,onMessage:r,outSR:t,origin:a(e.source),tileInfoView:s,canAcceptRequest:i}}function a(e){return Array.isArray(e)?"local":"path"in e&&Object(m["c"])(e.path)?"hosted":"unknown"}}var Be=s("d806");s("e06a");new Float64Array(2),new Float64Array(2);function Qe(e,t){let s=-90,r=90,i=-180,n=180;for(let a=0;a>u,g=(f&e.geohashY)>>d;for(let e=l-1;e>=0;e--){const t=(i+n)/2,s=p&1<=0;e--){const t=(s+r)/2,i=g&1<t?1:0;i|=r<<29-(e+5*d),c=(1-r)*c+r*t,u=(1-r)*t+r*u}for(let e=0;e<5;e++){const s=(a+o)/2,r=t>s?1:0;n|=r<<29-(e+5*d),a=(1-r)*a+r*s,o=(1-r)*s+r*o}}e.geohashX=i,e.geohashY=n}function Ve(e,t,s,r,i){i%2&&(i+=1);let n=0,a=0,o=-90,c=90,u=-180,d=180;for(let l=0;lt?1:0;n|=s<<29-(e+5*l),u=(1-s)*u+s*t,d=(1-s)*t+s*d}for(let e=0;e<5;e++){const t=(o+c)/2,r=s>t?1:0;a|=r<<29-(e+5*l),o=(1-r)*o+r*t,c=(1-r)*t+r*c}}e[2*t]=n,e[2*t+1]=a}class Ye{constructor(e=[],t,s=8096){this._nodes=0,this._root=new Ze(0,0,0),this._statisticFields=e,this._pool=s?new de["a"](8096):null,this._serviceInfo=t}_acquire(e,t,s){this._nodes++;let r=null;return Object(l["k"])(this._pool)&&(r=this._pool.dequeue()),Object(l["k"])(r)?r.realloc(e,t,s):new Ze(e,t,s)}_release(e){this._nodes--,Object(l["k"])(this._pool)&&this._pool.enqueue(e)}get count(){return this._root.count}get size(){return this._nodes}get poolSize(){return Object(l["n"])(this._pool,0,e=>e.size)}get depth(){let e=0;return this._forEachNode(t=>e=Math.max(e,t.depth)),e}dropLevels(e){this._forEachNode(t=>{if(t.depth>=e)for(let e=0;e=o&&(c.count+=1,c.xTotal+=s,c.yTotal+=r,c.xGeohashTotal+=i,c.yGeohashTotal+=n,c.displayId=t,this._updateStatisticsCursor(e,c,1)),u>=a)return void c.add(t);const h=Math.ceil((u+1)/2),f=Math.floor((u+1)/2),p=1-u%2,g=30-(3*h+2*f),_=30-(2*h+3*f),y=(i&7*p+3*(1-p)<>g,m=(n&3*p+7*(1-p)<<_)>>_,b=y+m*(8*p+4*(1-p));d=d<<3*p+2*(1-p)|y,l=l<<2*p+3*(1-p)|m,null==c.children[b]&&(c.children[b]=this._acquire(d,l,u+1)),u+=1,c=c.children[b]}}remove(e,t){const s=j["a"].fromOptimizedFeatures([e],this._serviceInfo).getCursor();s.next();const r=s.readGeometry();if(!r)return;const[i,n]=r.coords,a=e.geohashX,o=e.geohashY;this.removeCursor(s,i,n,a,o,t)}removeCursor(e,t,s,r,i,n){let a=this._root,o=0;for(;null!==a;){if(a.count-=1,a.xTotal-=t,a.yTotal-=s,a.xGeohashTotal-=r,a.yGeohashTotal-=i,this._updateStatisticsCursor(e,a,-1),o>=n)return void a.remove(e.getDisplayId());const c=Math.ceil((o+1)/2),u=Math.floor((o+1)/2),d=1-o%2,l=30-(3*c+2*u),h=30-(2*c+3*u),f=((r&7*d+3*(1-d)<>l)+((i&3*d+7*(1-d)<>h)*(8*d+4*(1-d)),p=a.children[f];1===p.count&&(this._release(p),a.children[f]=null),o+=1,a=p}}find(e,t,s){return this._root.find(e,t,s,0,0,0)}findSingleOccupancyNode(e,t,s,r,i){let n=this._root;for(;null!==n;){const a=n.depth,o=n.xNode,c=n.yNode,u=1-a%2,d=n.xGeohashTotal/n.count,l=n.yGeohashTotal/n.count;if(1===n.count&&e=i){n=n.next;continue}const h=Math.ceil((a+1)/2),f=Math.floor((a+1)/2),p=30-(3*h+2*f),g=30-(2*h+3*f),_=~((1<>p,b=(t&y)>>g,I=(s&_)>>p,S=(r&y)>>g,x=o<<3*u+2*(1-u),O=c<<2*u+3*(1-u),v=x+8*u+4*(1-u),w=O+4*u+8*(1-u),j=Math.max(x,m),T=Math.max(O,b),F=Math.min(v,I),C=Math.min(w,S);let A=null,k=null;for(let e=T;e<=C;e++)for(let t=j;t<=F;t++){const s=t-x+(e-O)*(8*u+4*(1-u)),r=n.children[s];r&&(A||(A=r,A.next=n.next),k&&(k.next=r),k=r,r.next=n.next)}n=A||n.next}return null}getRegionDisplayIds(e,t,s,r,i){let n=this._root;const a=[];for(;null!==n;){const o=n.depth,c=n.xNode,u=n.yNode;if(o>=i){const i=n.xGeohashTotal/n.count,o=n.yGeohashTotal/n.count;e<=i&&i<=s&&t<=o&&o<=r&&n.displayIds.forEach(e=>a.push(e)),n=n.next;continue}const d=Math.ceil((o+1)/2),l=Math.floor((o+1)/2),h=1-o%2,f=30-(3*d+2*l),p=30-(2*d+3*l),g=~((1<>f,m=(t&_)>>p,b=(s&g)>>f,I=(r&_)>>p,S=c<<3*h+2*(1-h),x=u<<2*h+3*(1-h),O=S+8*h+4*(1-h),v=x+4*h+8*(1-h),w=Math.max(S,y),j=Math.max(x,m),T=Math.min(O,b),F=Math.min(v,I);let C=null,A=null;for(let e=j;e<=F;e++)for(let t=w;t<=T;t++){const s=t-S+(e-x)*(8*h+4*(1-h)),r=n.children[s];r&&(C||(C=r,C.next=n.next),A&&(A.next=r),A=r,r.next=n.next)}n=C||n.next}return a}getRegionStatistics(e,t,s,r,i){let n=this._root,a=0,o=0,c=0;const u={};let d=0;for(;null!==n;){const l=n.depth,h=n.xNode,f=n.yNode;if(l>=i){const i=n.xGeohashTotal/n.count,l=n.yGeohashTotal/n.count;e>y,x=(t&I)>>m,O=(s&b)>>y,v=(r&I)>>m,w=h<<3*_+2*(1-_),j=f<<2*_+3*(1-_),T=w+8*_+4*(1-_),F=j+4*_+8*(1-_),C=Math.max(w,S),A=Math.max(j,x),k=Math.min(T,O),E=Math.min(F,v);let M=null,R=null;for(let i=A;i<=E;i++)for(let l=C;l<=k;l++){const h=l-w+(i-j)*(8*_+4*(1-_)),f=n.children[h];if(f){if(i!==A&&i!==E&&l!==C&&l!==k){const i=f.xGeohashTotal/f.count,n=f.yGeohashTotal/f.count;er&&(r=s,n=e)}s[i]="null"===n?null:n;break}}}return s}}class Ze{constructor(e,t,s){this.count=0,this.xTotal=0,this.yTotal=0,this.statistics={},this.displayId=0,this.displayIds=new Set,this.next=null,this.depth=0,this.xNode=0,this.yNode=0,this.xGeohashTotal=0,this.yGeohashTotal=0,this.children=new Array(32);for(let r=0;r=s)return this;const a=1-r%2,o=3*a+2*(1-a),c=2*a+3*(1-a),u=30-i-o,d=30-n-c,l=((e&7*a+3*(1-a)<>u)+((t&3*a+7*(1-a)<>d)*(8*a+4*(1-a)),h=this.children[l];return null==h?null:h.find(e,t,s,r+1,i+o,n+c)}}var Xe=s("2255"),We=s("1ec3"),$e=s("8c81"),Je=s("175e"),Ke=s("8483"),et=s("5996");const tt=12,st=1;class rt extends F["b"]{constructor(e,t,s,r,i){super(new C["a"]([],[t,s]),r,null,e),this.geohashBoundsInfo=i}get count(){return this.attributes.cluster_count}static create(e,t,s,r,i,n,a,o){const c=new rt(t,s,r,n,a);return c.displayId=e.createDisplayId(!0),c.referenceId=o,c.tileLevel=i,c}update(e,t,s,r,i,n){return this.geometry.coords[0]=e,this.geometry.coords[1]=t,this.tileLevel=s,this.attributes=r,this.geohashBoundsInfo=i,this.referenceId=null,this.referenceId=n,this}toJSON(){return{objectId:this.objectId,referenceId:1===this.attributes.cluster_count?this.referenceId:null,attributes:{...this.attributes,clusterId:this.objectId},geometry:{x:this.geometry.coords[0],y:this.geometry.coords[1]}}}}function it(e){return 57.29577951308232*e}class nt extends Ke["a"]{constructor(e,t,s,r){super(e,s),this.events=new oe["a"],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=Object(We["a"])(t,et["a"].WGS84),this._bitsets.geohash=s.getBitset(s.createBitset()),this._bitsets.inserted=s.getBitset(s.createBitset())}async updateSchema(e,t){const s=this._schema;try{await super.updateSchema(e,t),await this._projectionSupportCheck}catch(i){}const r=Object(ce["a"])(s,t);t&&(!Object(l["j"])(r)||e.source||e.storage.filters)?((Object(ce["b"])(r,"params.fields")||!this._tree||e.source)&&(this._tree=new Ye(this._statisticFields,this._serviceInfo),this._rebuildTree(),Object(n["a"])("esri-2d-update-debug")&&console.debug("Aggregate mesh needs update due to tree changing")),Object(n["a"])("esri-2d-update-debug")&&console.debug("Applying Update - ClusterStore:",r),e.targets[t.name]=!0,e.mesh=!1,this._aggregateValueRanges={}):s&&(e.mesh=!0)}clear(){this._rebuildTree()}sweepFeatures(e,t){this._bitsets.inserted.forEachSet(s=>{if(!e.has(s)){const e=t.lookupByDisplayIdUnsafe(s);this._remove(e)}})}sweepClusters(e,t,s){this._clusters.forEach((r,i)=>{r&&r.tileLevel!==s&&(e.releaseDisplayId(r.displayId),t.unsetAttributeData(r.displayId),this._clusters.delete(i))})}onTileData(e,t,s,r,i=!0){if(!this._schema||Object(l["j"])(t.addOrUpdate))return t;const n=this._getTransforms(e,this._spatialReference);{const e=t.addOrUpdate.getCursor();for(;e.next();)this._update(e,r)}if(t.status.mesh||!i)return t;const a=new Array,o=this._schema.params.clusterRadius;this._getClustersForTile(a,e,o,s,n),t.addOrUpdate=j["a"].fromOptimizedFeatures(a,this._serviceInfo),t.addOrUpdate.attachStorage(s),t.end=!0;{const r=t.addOrUpdate.getCursor();for(;r.next();){const t=r.getDisplayId();this._bitsets.computed.unset(t),this.setComputedAttributes(s,r,t,e.scale)}}return this._aggregateValueRangesChanged&&t.end&&(this.events.emit("valueRangesChanged",{valueRanges:this._aggregateValueRanges}),this._aggregateValueRangesChanged=!1),t}onTileUpdate({added:e,removed:t}){if(e.length){const t=e[0].level;this._tileLevel=t,this._setGeohashLevel(t)}if(!this._schema)return;const s=this._schema.params.clusterRadius;t.forEach(e=>{this._tiles.delete(e.key.id),this._markTileClustersForDeletion(e,s)})}getAggregate(e){for(const t of this._clusters.values())if(((null==t?void 0:t.displayId)&Je["a"])==(e&Je["a"]))return t.toJSON();return null}getAggregates(){const e=[];for(const t of this._clusters.values())(null==t?void 0: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);if(!t)return[];const s=t.geohashBoundsInfo;return this._tree.getRegionDisplayIds(s.xLL,s.yLL,s.xTR,s.yTR,s.level)}getDisplayIdForReferenceId(e){for(const t of this._clusters.values())if((null==t?void 0:t.referenceId)===e)return t.displayId;return null}getAggregateValueRanges(){return this._aggregateValueRanges}forEach(e){for(const[t,s]of this._clusters)s&&e(s,t)}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(),a=e.getYHydrated();if(!this._setGeohash(s,n,a))return;const o=this._geohashBuf[2*s],c=this._geohashBuf[2*s+1];this._tree.insertCursor(e,s,n,a,o,c,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=it(t/Xe["a"].radius),n=i-360*Math.floor((i+180)/360),a=it(Math.PI/2-2*Math.atan(Math.exp(-s/Xe["a"].radius)));Ve(r,e,a,n,tt)}else{const i=Object(We["b"])({x:t,y:s},this._spatialReference,et["a"].WGS84);if(!i)return!1;Ve(r,e,i.y,i.x,tt)}return this._bitsets.geohash.set(e),!0}_getClustersForTile(e,t,s,r,i,n=!0){const a=this._schema.params.clusterPixelBuffer,o=2*s,c=this._getGeohashLevel(t.key.level),u=Math.ceil(2**t.key.level*$e["P"]/o),d=Math.ceil(a/o)+0,h=Math.ceil($e["P"]/o),{row:f,col:g}=t.key,_=g*$e["P"],y=f*$e["P"],m=Math.floor(_/o)-d,b=Math.floor(y/o)-d,I=m+h+2*d,S=b+h+2*d,x=t.tileInfoView.getLODInfoAt(t.key.level);for(let O=m;O<=I;O++)for(let s=b;s<=S;s++){let a=O;x.wrap&&(a=O<0?O+u:O%u);const o=x.wrap&&O<0,d=x.wrap&&O%u!==O,h=this._lookupCluster(r,x,t.key.level,a,s,c);if(Object(l["k"])(h)){const t=Object(l["b"])(i,e=>o?e.left:d?e.right:e.tile);if(n&&Object(l["j"])(t))continue;if(!h.count)continue;if(Object(l["k"])(t)&&n){const s=h.geometry.clone();let r=h.attributes;s.coords[0]=Object(p["w"])(t,s.coords[0]),s.coords[1]=Object(p["x"])(t,s.coords[1]),1===h.count&&Object(l["k"])(h.referenceId)&&(r={...h.attributes,referenceId:h.referenceId});const i=new F["a"](s,r);i.displayId=h.displayId,e.push(i)}}}}_getGeohashLevel(e){return Math.min(Math.ceil(e/2+2),tt)}_setGeohashLevel(e){const t=this._getGeohashLevel(e),s=(Math.floor(t/st)+1)*st-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=Object(c["e"])(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 a=s*i;let o=n+i;const c=a-i,u=2**e.level*$e["P"];e.wrap&&n<0&&(n=0),e.wrap&&o>u&&(o=u);const d=n/$e["P"],l=a/$e["P"],h=o/$e["P"],f=c/$e["P"];return[e.getXForColumn(d),e.getYForRow(l),e.getXForColumn(h),e.getYForRow(f)]}_lookupCluster(e,t,s,r,i,n){const a=this._getClusterId(s,r,i),o=this._clusters.get(a),[c,u,d,h]=this._getClusterBounds(t,r,i),f={x:c,y:u},p={x:d,y:h};let g=0,_=0,y=0,m=0;if(this._spatialReference.isWebMercator){{const e=it(f.x/Xe["a"].radius);g=e-360*Math.floor((e+180)/360),_=it(Math.PI/2-2*Math.atan(Math.exp(-f.y/Xe["a"].radius)))}{const e=it(p.x/Xe["a"].radius);y=e-360*Math.floor((e+180)/360),m=it(Math.PI/2-2*Math.atan(Math.exp(-p.y/Xe["a"].radius)))}}else{const e=Object(We["b"])(f,this._spatialReference,et["a"].WGS84),t=Object(We["b"])(p,this._spatialReference,et["a"].WGS84);if(!e||!t)return null;g=e.x,_=e.y,y=t.x,m=t.y}const b={geohashX:0,geohashY:0},I={geohashX:0,geohashY:0};He(b,_,g,n),He(I,m,y,n);const S=b.geohashX,x=b.geohashY,O=I.geohashX,v=I.geohashY,w={xLL:S,yLL:x,xTR:O,yTR:v,level:n},j=this._tree.getRegionStatistics(S,x,O,v,n),{count:T,xTotal:F,yTotal:C,referenceId:A}=j,k=T?F/T:0,E=T?C/T:0;if(0===T)return this._clusters.set(a,null),null;const M={cluster_count:T,...j.attributes},R=Object(l["k"])(o)?o.update(k,E,s,M,w,A):rt.create(e,a,k,E,s,M,w,A);return 0===T&&(R.geometry.coords[0]=(c+d)/2,R.geometry.coords[1]=(u+h)/2),this._clusters.set(a,R),this._updateAggregateValueRangeForCluster(R,R.tileLevel),R}_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($e["P"]/s),{row:i,col:n}=e.key,a=n*$e["P"],o=i*$e["P"],c=Math.floor(a/s),u=Math.floor(o/s);for(let d=c;dthis._onTileMessage(e,{signal:t})}),this.handles.add([this.tileStore.on("update",this.onTileUpdate.bind(this)),this.watch("updating",e=>!e&&this.onIdle())]),this._checkUpdating=setInterval(()=>this.notifyChange("updating"),300)}async startup(){this._initAttributeStore()}_initSource(){const e=this.tileStore.tileScheme,t=()=>this._updateQueue.length<50,s=(e,t)=>(this._invalidated=!0,this._patchTile(e,t));this._source=ze(this.service,this.spatialReference,e,s,t,this.featureStore),this._proxyEvents()}_proxyEvents(){if("geoevent"===this._source.type){const e=this._source.events;this.handles.add([e.on("connectionStatus",e=>this.remoteClient.invoke("setProperty",{propertyName:"connectionStatus",value:e}).catch(ht)),e.on("errorString",e=>this.remoteClient.invoke("setProperty",{propertyName:"errorString",value:e}).catch(ht)),e.on("feature",e=>this.remoteClient.invoke("emitEvent",{name:"data-received",event:{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry}}).catch(ht)),e.on("updateRate",e=>this.remoteClient.invoke("emitEvent",{name:"update-rate",event:{...e}}).catch(ht))])}}_initAttributeStore(){this.attributeStore?this.attributeStore.invalidateResources():this.attributeStore=new Be["a"]({type:"remote",initialize:(e,t)=>Object(h["l"])(this.remoteClient.invoke(ct,e,{signal:t}).catch(ht)),update:(e,t)=>Object(h["l"])(this.remoteClient.invoke(ut,e,{signal:t}).catch(ht)),render:e=>Object(h["l"])(this.remoteClient.invoke(dt,void 0,{signal:e}).catch(ht))},this.config)}_initStores(){const e="snapshot"===this.service.type?"snapshot":"on-demand",t={geometryInfo:{geometryType:this.service.geometryType,hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.featureStore=new y["a"](t,this._storage,e),this.aggregateStore=new nt(t,this.spatialReference,this._storage,this.service),this.handles.add(this.aggregateStore.events.on("valueRangesChanged",e=>{this.remoteClient.invoke("emitEvent",{name:"valueRangesChanged",event:{valueRanges:e.valueRanges}}).catch(ht)}))}_initQueryEngine(){var e;const t=this;null==(e=this.queryEngine)||e.destroy(),this.queryEngine=new g["a"]({definitionExpression:this.config.definitionExpression,fields:this.service.fields,geometryType:this.service.geometryType,objectIdField:this.service.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!0,featureStore:this.featureStore,aggregateAdapter:{getFeatureObjectIds:e=>t.aggregateStore.getFeatureDisplayIdsForAggregate(e).map(e=>t.getObjectId(e))},timeInfo:this.service.timeInfo})}destroy(){this._updateQueue.destroy(),this._source.destroy(),this.queryEngine.destroy(),this.attributeStore&&this.attributeStore.destroy();for(const e of this.tileStore.tiles)this._source.unsubscribe(e);clearInterval(this._checkUpdating)}get fieldsIndex(){return new _["a"](this.service.fields)}get hasAggregates(){return!!this.config.schema.targets.aggregate}get spatialReference(){return this.tileStore.tileScheme.spatialReference}get updating(){return this.isUpdating()}isUpdating(){return this._source.updating||!!this._updateQueue.length}enableEvent(e){this._source.enableEvent(e.name,e.value)}pause(){this._updateQueue.pause(),this._updateQueue.clear()}pauseStream(){"geoevent"===this._source.type&&this._source.pauseStream()}resumeStream(){"geoevent"===this._source.type&&this._source.resumeStream()}async update(e,t){this._set("config",t),this._schema=t.schema,this._initQueryEngine(),await Promise.all([this._source.update(e,t.schema.source),this.featureStore.updateSchema(e,t.schema.targets.feature),this.attributeStore.update(e,t),this.attributeStore.updateFilters(e,this)]),await this.aggregateStore.updateSchema(e,t.schema.targets.aggregate),Object(n["a"])("esri-2d-update-debug")&&e.describe()}async applyUpdate(e){e.mesh&&this.clearTiles(),this._updateQueue.resume(),await this._source.applyUpdate(e),this.notifyChange("updating"),await Object(f["g"])(()=>!this.updating),this.hasAggregates&&(await Object(h["a"])(10),await Object(f["g"])(()=>!this.updating))}async onEdits({edits:e}){Object(n["a"])("esri-2d-update-debug")&&console.debug("Applying Edit:",e),this._didEdit=!0;try{const t=e.removed.map(e=>e.objectId&&-1!==e.objectId?e.objectId:this._lookupObjectIdByGlobalId(e.globalId)),s=e.addOrModified.map(({objectId:e})=>e);this.featureStore.invalidate(),await this._source.edit(s,t),this.clearTiles(),this.notifyChange("updating"),this.aggregateStore.clear(),await this._source.resend(),await Object(f["g"])(()=>!this.updating)}catch(t){}}async refresh(e){if(!e){const e=le.empty();return e.storage.filters=!0,this.applyUpdate(e)}this.featureStore.invalidate(),this.clearTiles(),this._source.refresh(),this._cleanupNeeded=!0,this.notifyChange("updating"),await Object(f["g"])(()=>!this.updating)}clearTiles(){for(const e of this.tileStore.tiles)this.processor.onTileClear(e)}onTileUpdate(e){this.aggregateStore.onTileUpdate(e);for(const t of e.added)this._source.subscribe(t),this._level=t.level;for(const t of e.removed)this._source.unsubscribe(t),this._cleanupNeeded=!0,this._tileToResolver.has(t.id)&&(this._tileToResolver.get(t.id).resolve(),this._tileToResolver.delete(t.id));this.notifyChange("updating")}onIdle(){this._invalidated&&((this.hasAggregates||"heatmap"===this.processor.type)&&this._repushCurrentLevelTiles(),this._invalidated=!1),this._markAndSweep()}async querySummaryStatistics({query:e,params:t}){return this.queryEngine.executeQueryForSummaryStatistics(e,t)}async queryUniqueValues({query:e,params:t}){return this.queryEngine.executeQueryForUniqueValues(e,t)}async queryClassBreaks({query:e,params:t}){return this.queryEngine.executeQueryForClassBreaks(e,t)}async queryHistogram({query:e,params:t}){return this.queryEngine.executeQueryForHistogram(e,t)}queryExtent(e){return this.queryEngine.executeQueryForExtent(e)}queryFeatures(e){return this.queryEngine.executeQuery(e)}async queryVisibleFeatures(e){const t=await this.queryEngine.executeQuery(e),s=t.objectIdFieldName;return t.features=t.features.filter(e=>{const t=e.attributes[s],r=this.getDisplayId(t);return this.attributeStore.isVisible(r)}),t}queryFeatureCount(e){return this.queryEngine.executeQueryForCount(e)}queryLatestObservations(e){return this.queryEngine.executeQueryForLatestObservations(e)}queryObjectIds(e){return this.queryEngine.executeQueryForIds(e)}async queryStatistics(){return this.featureStore.storeStatistics}getObjectId(e){return this.featureStore.lookupObjectId(e,this._storage)}getDisplayId(e){if(this._schema.targets.aggregate){const t=this.aggregateStore.getDisplayId(e);if(Object(l["j"])(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=this.hasAggregates?this.getAggregate(r):null;if(Object(l["k"])(e))if(Object(l["k"])(e.referenceId)){const s=this.getFeature(e.referenceId);Object(l["k"])(s)&&t.push(s)}else s.push(e);else{const e=this.getFeature(r);Object(l["k"])(e)&&t.push(e)}}return{features:t,aggregates:s}}getFeature(e){const t=this.featureStore.lookupFeatureByDisplayId(e,this._storage);if(Object(l["j"])(t))return null;const s=t.readHydratedGeometry(),r=Object(p["l"])(s,t.geometryType,t.hasZ,t.hasM);return{attributes:t.readAttributes(),geometry:r}}getAggregate(e){return this.aggregateStore.getAggregate(e)}getAggregates(){return this.aggregateStore.getAggregates()}async setHighlight(e){const t=e.map(e=>this.getDisplayId(e));return this.attributeStore.setHighlight(e,t)}_lookupObjectIdByGlobalId(e){const t=this.service.globalIdField;if(Object(l["j"])(t))throw new Error("Expected globalIdField to be defined");let s=null;if(this.featureStore.forEach(r=>{e===r.readAttribute(t)&&(s=r.getObjectId())}),Object(l["j"])(s))throw new Error("Expected to find a feature with globalId "+e);return s}_repushCurrentLevelTiles(){const e=this.tileStore.tiles.filter(e=>e.level===this._level);for(const t of e)this._patchTile({type:"append",id:t.key.id,addOrUpdate:j["a"].fromOptimizedFeatures([],this.service),remove:[],end:!0,status:le.empty()})}_maybeForceCleanup(){performance.now()-this._lastCleanup>ot&&this._markAndSweep()}_patchTile(e,t){const s=this._updateQueue.push(e,t).then(()=>{this.notifyChange("updating")}).catch(e=>{this.notifyChange("updating")});return this.notifyChange("updating"),s}async _onTileMessage(e,t){Object(h["v"])(t);const s=this.tileStore.get(e.id);if(!s)return;if(e.clear)return this.processor.onTileClear(s);const r=e.status;this._cleanupNeeded=!0;const i=[];for(const a of e.remove){const e=this.featureStore.lookupDisplayId(a);e&&i.push(e)}e.remove=i;try{if(Object(l["j"])(e.addOrUpdate))return void this.processor.onTileMessage(s,{...e,addOrUpdate:null},this.hasAggregates,t).catch(h["w"]);if(e.addOrUpdate.setArcadeSpatialReference(this.spatialReference),this.featureStore.hasInstance(e.addOrUpdate.instance)&&r.targets.feature||(r.targets.feature=!0,this.featureStore.onTileData(s,e)),r.storage.data&&r.storage.filters||(r.storage.data=!0,r.storage.filters=!0,this.attributeStore.onTileData(s,e),"geoevent"===this._source.type||this._didEdit?(await this.attributeStore.sendUpdates(),Object(h["v"])(t)):this.attributeStore.sendUpdates()),this.hasAggregates&&!r.targets.aggregate){r.targets.aggregate=!0;const t=ft(this._source)&&this._source.loading,i=!ft(this._source)||t||e.end;if(this.aggregateStore.onTileData(s,e,this._storage,this.attributeStore,i),!i)return;r.mesh||(this.attributeStore.onTileData(s,e),await this.attributeStore.sendUpdates(),this.processor.onTileClear(s))}r.mesh||(r.mesh=!0,await this.processor.onTileMessage(s,e,this.hasAggregates,t),Object(h["v"])(t)),this._maybeForceCleanup()}catch(n){Object(h["w"])(n)}}_mark(e,t,s){const r=(4294901760&this._storage.getInstanceId(e))>>>16;e&&(t.add(r),s.set(e))}_markAndSweep(){if(this._lastCleanup=performance.now(),"feature"===this._source.type&&"snapshot"===this._source.mode||"geoevent"!==this._source.type&&!this._cleanupNeeded)return;this._cleanupNeeded=!1;const e=this._storage.getBitset(this._markedIdsBufId),t=new Set;e.clear();for(const s of this.tileStore.tiles)for(const r of this._source.readers(s.id)){const s=r.getCursor();for(;s.next();){let r=s.getDisplayId();if(!r){const e=s.getObjectId();r=this.featureStore.lookupDisplayId(e)}this._mark(r,t,e)}}"symbol"===this.processor.type&&this.processor.forEachBufferId(s=>{this._mark(s,t,e)}),this._updateQueue.forEach(s=>{for(const r of s.remove){const s=this.featureStore.lookupDisplayId(r);this._mark(s,t,e)}}),this.config.schema.targets.aggregate&&(this.aggregateStore.sweepFeatures(e,this.featureStore),this.aggregateStore.sweepClusters(this._storage,this.attributeStore,this._level)),this.featureStore.sweepFeatures(e,this._storage,this.attributeStore),this.featureStore.sweepFeatureSets(t)}};Object(r["a"])([Object(a["b"])({constructOnly:!0})],pt.prototype,"tileStore",void 0),Object(r["a"])([Object(a["b"])()],pt.prototype,"config",void 0),Object(r["a"])([Object(a["b"])({readOnly:!0})],pt.prototype,"fieldsIndex",null),Object(r["a"])([Object(a["b"])()],pt.prototype,"processor",void 0),Object(r["a"])([Object(a["b"])({constructOnly:!0})],pt.prototype,"remoteClient",void 0),Object(r["a"])([Object(a["b"])({constructOnly:!0})],pt.prototype,"service",void 0),Object(r["a"])([Object(a["b"])()],pt.prototype,"spatialReference",null),Object(r["a"])([Object(a["b"])()],pt.prototype,"updating",null),pt=Object(r["a"])([Object(o["a"])("esri.views.2d.layers.features.controllers.FeatureController2D")],pt);const gt=pt;var _t=s("c39b"),yt=s("018d");const mt=new Set;function bt(){return mt}let It=class extends i["a"]{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.handles.add(this.watch("updating",e=>{this.remoteClient.invoke("setUpdating",e).catch(e=>{})}))}destroy(){var e,t;this.stop(),null==(e=this.controller)||e.destroy(),null==(t=this.processor)||t.destroy(),this.controller=this.processor=this.tileStore=this.remoteClient=null}get updating(){return!this.controller||this.controller.updating}stop(){var e,t,s;this._paused=!0,Array.isArray(null==(e=this.service)?void 0:e.source)&&(this.service.source.forEach(e=>e.close()),this.service.source.length=0),null==(t=this.tileStore)||t.updateTiles({added:[],removed:this.tileStore.tiles.map(e=>e.id)}),null==(s=this.tileStore)||s.destroy(),this.tileStore=null,this._pendingTileUpdates.length=0}async startup({service:e,config:t,tileInfo:s,tiles:r}){var i;if(this._paused=!0,Array.isArray(null==(i=this.service)?void 0:i.source)&&(this.service.source.forEach(e=>e.close()),this.service.source.length=0),this.service=e,!this.tileStore||!Object(c["d"])(this.tileStore.tileScheme.spatialReference,s.spatialReference)){var n,a;const e=new yt["a"](u["a"].fromJSON(s));r.added.length=r.removed.length=0,null==(n=this.tileStore)||n.updateTiles({added:[],removed:this.tileStore.tiles.map(e=>e.id)}),null==(a=this.tileStore)||a.destroy(),this.tileStore=new _t["a"](e),this._pendingTileUpdates.length=0}for(await this._createProcessorAndController(t),await this.update({config:t},!0),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},t=!1){const s=le.empty();return t||this.controller.pause(),await Promise.all([this.processor.update(s,e),this.controller.update(s,e)]),s.toJSON()}async applyUpdate(e){return this.controller.applyUpdate(le.create(e))}async _createProcessorAndController(e){await Promise.all([this._handleControllerConfig(e),this._handleProcessorConfig(e)]),this.controller.processor=this.processor}async _handleControllerConfig(e){const t=await this._createController(this.service,e);return await t.startup(),t}async _handleProcessorConfig(e){return this._createProcessor(this.service,e)}async _createController(e,t){this.controller&&this.controller.destroy();const{tileStore:s,remoteClient:r}=this,i=new gt({service:e,config:t,tileStore:s,remoteClient:r});return this.controller=i,i}async _createProcessor(e,t){const s=t.schema.processors[0].type,r=(await d(s)).default,{remoteClient:i,tileStore:n}=this,a=new r({service:e,config:t,tileStore:n,remoteClient:i});return this.processor&&this.processor.destroy(),this.processor=a,a}};Object(r["a"])([Object(a["b"])()],It.prototype,"controller",void 0),Object(r["a"])([Object(a["b"])()],It.prototype,"processor",void 0),Object(r["a"])([Object(a["b"])()],It.prototype,"updating",null),Object(r["a"])([Object(a["b"])()],It.prototype,"viewState",void 0),It=Object(r["a"])([Object(o["a"])("esri.views.2d.layers.features.Pipeline")],It);const St=It},"0c9a":function(e,t,s){"use strict";s.d(t,"a",(function(){return p})),s.d(t,"b",(function(){return f}));var r=s("971e"),i=s("ce6d"),n=(s("c120"),s("b2b2")),a=s("901f"),o=s("4261"),c=s("8483"),u=s("f209");function d(e,t){return e<<16|t}function l(e){return(4294901760&e)>>>16}function h(e){return 65535&e}const f={getObjectId:e=>e.getObjectId(),getAttributes:e=>e.readAttributes(),getAttribute:(e,t)=>e.readAttribute(t),cloneWithGeometry:(e,t)=>e,getGeometry:e=>e.readHydratedGeometry(),getCentroid:(e,t)=>e.readCentroid()};class p extends c["a"]{constructor(e,t,s){super(e,t),this.featureAdapter=f,this.events=new i["a"],this._featureSetsByInstance=new Map,this._objectIdToDisplayId=new Map,this._spatialIndexInvalid=!0,this._indexSearchCache=new r["a"](50),this._index=Object(a["a"])(9,e=>({minX:this._storage.getXMin(e),minY:this._storage.getYMin(e),maxX:this._storage.getXMax(e),maxY:this._storage.getYMax(e)})),this._storage=t,this.mode=s}get storage(){return this._storage}get storeStatistics(){let e=0,t=0,s=0;return this.forEach(r=>{const i=r.readGeometry();i&&(t+=i.isPoint?1:i.lengths.reduce((e,t)=>e+t,0),s+=i.isPoint?1:i.lengths.length,e+=1)}),{featureCount:e,vertexCount:t,ringCount:s}}hasInstance(e){return this._featureSetsByInstance.has(e)}onTileData(e,t){if(Object(n["j"])(t.addOrUpdate))return t;if(t.addOrUpdate.attachStorage(this._storage),"snapshot"===this.mode){const s=t.addOrUpdate.getCursor();for(;s.next();){const t=s.getDisplayId();this.setComputedAttributes(this._storage,s,t,e.scale)}return t}this._featureSetsByInstance.set(t.addOrUpdate.instance,t.addOrUpdate);const s=t.addOrUpdate.getCursor();for(;s.next();)this._insertFeature(s,e.scale);return this._spatialIndexInvalid=!0,this.events.emit("changed"),t}search(e){this._rebuildIndex();const t=e.id,s=this._indexSearchCache.find(e=>e.tileId===t);if(Object(n["k"])(s))return s.readers;const r=new Map,i=this._searchIndex(e.bounds),a=[];for(const n of i){const e=this._storage.getInstanceId(n),t=l(e),s=h(e);r.has(t)||r.set(t,[]),r.get(t).push(s)}return r.forEach((e,t)=>{const s=this._featureSetsByInstance.get(t);a.push(u["a"].from(s,e))}),this._indexSearchCache.enqueue({tileId:t,readers:a}),a}insert(e){const t=e.getCursor(),s=this._storage;for(;t.next();){var r;const e=d(t.instance,t.getIndex()),i=t.getObjectId(),n=null!=(r=this._objectIdToDisplayId.get(i))?r:this._storage.createDisplayId();t.setDisplayId(n),s.setInstanceId(n,e),this._objectIdToDisplayId.set(i,n)}this._featureSetsByInstance.set(e.instance,e),this._spatialIndexInvalid=!0}remove(e){const t=this._objectIdToDisplayId.get(e);if(!t)return;const s=this._storage.getInstanceId(t),r=h(s),i=l(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=l(s),i=h(s),n=this._getFeatureSet(r);n.setIndex(i),e(n)})}forEachInBounds(e,t){const s=this._searchIndex(e);for(const r of s){const e=this.lookupFeatureByDisplayId(r,this._storage);t(Object(n["t"])(e))}}forEachBounds(e,t,s){this._rebuildIndex();const r=[0,0,0,0];for(const i of e){if(!i.readGeometry())continue;const e=i.getDisplayId();r[0]=this._storage.getXMin(e),r[1]=this._storage.getYMin(e),r[2]=this._storage.getXMax(e),r[3]=this._storage.getYMax(e),t(Object(o["s"])(s,r))}}sweepFeatures(e,t,s){this._spatialIndexInvalid=!0,this._objectIdToDisplayId.forEach((r,i)=>{e.has(r)||(t.releaseDisplayId(r),s&&s.unsetAttributeData(r),this._objectIdToDisplayId.delete(i))}),this.events.emit("changed")}sweepFeatureSets(e){this._spatialIndexInvalid=!0,this._featureSetsByInstance.forEach((t,s)=>{e.has(s)||this._featureSetsByInstance.delete(s)})}lookupObjectId(e,t){const s=this.lookupFeatureByDisplayId(e,t);return Object(n["j"])(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=l(t),r=h(t),i=this._getFeatureSet(s);return i?(i.setIndex(r),i):null}_insertFeature(e,t){const s=this._storage,r=e.getObjectId(),i=d(e.instance,e.getIndex());s.getInstanceId(e.getDisplayId());let n=this._objectIdToDisplayId.get(r);n||(n=s.createDisplayId(),this._objectIdToDisplayId.set(r,n),this._spatialIndexInvalid=!0),e.setDisplayId(n),s.setInstanceId(n,i),this.setComputedAttributes(s,e,n,t)}_searchIndex(e){this._rebuildIndex();const t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this._index.search(t)}_rebuildIndex(){if(!this._spatialIndexInvalid)return;const e=[];"snapshot"===this.mode?this._featureSetsByInstance.forEach(t=>{const s=t.getCursor();for(;s.next();){const t=s.getDisplayId();this._storage.setBounds(t,s)&&e.push(t)}}):this._objectIdToDisplayId.forEach(t=>{const s=this._storage.getInstanceId(t);this._storage.setBounds(t,this._lookupFeature(s))&&e.push(t)}),this._index.clear(),this._index.load(e),this._indexSearchCache.clear(),this._spatialIndexInvalid=!1}_lookupFeature(e){const t=l(e),s=h(e),r=this._getFeatureSet(t);if(!r)return null;const i=r.getCursor();return i.setIndex(s),i}_getFeatureSet(e){return this._featureSetsByInstance.get(e)}}},"175e":function(e,t,s){"use strict";s.d(t,"a",(function(){return r})),s.d(t,"b",(function(){return c})),s.d(t,"c",(function(){return o})),s.d(t,"d",(function(){return f})),s.d(t,"e",(function(){return l})),s.d(t,"f",(function(){return d})),s.d(t,"g",(function(){return u})),s.d(t,"h",(function(){return h}));const r=8388607,i=8388608,n=254,a=255,o=0,c=1,u=e=>(e&i)>>>23,d=e=>e&r,l=e=>u(e)===c?n:a;function h(e){return u(e)===c}function f(e,t){return((t?i:0)|e)>>>0}},3484:function(e,t,s){"use strict";s.d(t,"a",(function(){return c}));var r=s("ce50"),i=s("e92d"),n=s("c84e"),a=s("c8dd");const o=i["a"].getLogger("esri.views.2d.engine.webgl");function c(e){return Object(a["u"])(e.minDataValue)&&Object(a["u"])(e.maxDataValue)&&null!=e.minSize&&null!=e.maxSize?n["e"].SIZE_MINMAX_VALUE:(e.expression&&"view.scale"===e.expression||e.valueExpression&&"$view.scale"===e.valueExpression)&&Array.isArray(e.stops)?n["e"].SIZE_SCALE_STOPS:(null!=e.field||e.expression&&"view.scale"!==e.expression||e.valueExpression&&"$view.scale"!==e.valueExpression)&&(Array.isArray(e.stops)||"levels"in e&&e.levels)?n["e"].SIZE_FIELD_STOPS:(null!=e.field||e.expression&&"view.scale"!==e.expression||e.valueExpression&&"$view.scale"!==e.valueExpression)&&null!=e.valueUnit?n["e"].SIZE_UNIT_VALUE:(o.error(new r["a"]("mapview-bad-type","Found invalid size VisualVariable",e)),n["e"].NONE)}},"434a":function(e,t,s){"use strict";s.d(t,"a",(function(){return c}));var r=s("b2b2"),i=s("6655"),n=s("9392"),a=s("f0d0");function o({coords:e,lengths:t}){let s=0;for(const r of t){for(let t=1;t!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 c(this.instance,this._features,this.fullSchema());return this.copyInto(e),e}next(){for(;++this._featureIndexe.toLowerCase()).includes(e.toLowerCase())}getFieldNames(){return Object.keys(this._current.attributes)}_readAttribute(e,t){const s=this._current.attributes[e];if(void 0!==s)return null!=s&&t&&this._dateFields.has(e)?new Date(s):s;const r=this.readAttributes(),i=e.toLocaleLowerCase().trim();for(const n in r)if(n.toLocaleLowerCase().trim()===i){const e=this._current.attributes[n];return null!=e&&t&&this._dateFields.has(n)?new Date(e):e}}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._transform=this._transform,e._dateFields=this._dateFields}_readAttributes(){return this._current.attributes}}},"4b0b":function(e,t,s){"use strict";s.d(t,"a",(function(){return o}));var r=s("175e");class i{constructor(){this._freeIds=[],this._idCounter=1}createId(e=!1){return Object(r["d"])(this._getFreeId(),e)}releaseId(e){this._freeIds.push(e)}_getFreeId(){return this._freeIds.length?this._freeIds.pop():this._idCounter++}}var n=s("7de1");function a(e,t,s){if(!(e.length>t))for(;e.length<=t;)e.push(s)}class o{constructor(){this._numerics=[],this._strings=[],this._idGenerator=new i,this._allocatedSize=256,this._bitsets=[],this._instanceIds=[],this._bounds=[]}createBitset(){const e=this._bitsets.length;return this._bitsets.push(n["a"].create(this._allocatedSize,r["a"])),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]=[]),a(this._numerics[e],t,0)}_ensureInstanceId(e){a(this._instanceIds,e,0)}_ensureString(e,t){this._strings[e]||(this._strings[e]=[]),a(this._strings[e],t,null)}createDisplayId(e=!1){const t=this._idGenerator.createId();return t>this._allocatedSize&&this._expand(),Object(r["d"])(t,e)}releaseDisplayId(e){for(const t of this._bitsets)t.unset(e);return this._idGenerator.releaseId(e&r["a"])}getComputedNumeric(e,t){return this.getComputedNumericAtIndex(e&r["a"],0)}setComputedNumeric(e,t,s){return this.setComputedNumericAtIndex(e&r["a"],s,0)}getComputedString(e,t){return this.getComputedStringAtIndex(e&r["a"],0)}setComputedString(e,t,s){return this.setComputedStringAtIndex(e&r["a"],0,s)}getComputedNumericAtIndex(e,t){const s=e&r["a"];return this._ensureNumeric(t,s),this._numerics[t][s]}setComputedNumericAtIndex(e,t,s){const i=e&r["a"];this._ensureNumeric(t,i),this._numerics[t][i]=s}getInstanceId(e){const t=e&r["a"];return this._ensureInstanceId(t),this._instanceIds[t]}setInstanceId(e,t){const s=e&r["a"];this._ensureInstanceId(s),this._instanceIds[s]=t}getComputedStringAtIndex(e,t){const s=e&r["a"];return this._ensureString(t,s),this._strings[t][s]}setComputedStringAtIndex(e,t,s){const i=e&r["a"];this._ensureString(t,i),this._strings[t][i]=s}getXMin(e){return this._bounds[4*(e&r["a"])]}getYMin(e){return this._bounds[4*(e&r["a"])+1]}getXMax(e){return this._bounds[4*(e&r["a"])+2]}getYMax(e){return this._bounds[4*(e&r["a"])+3]}setBounds(e,t){const s=t.readHydratedGeometry();if(!s||!s.coords.length)return!1;let i=1/0,n=1/0,o=-1/0,c=-1/0;s.forEachVertex((e,t)=>{i=Math.min(i,e),n=Math.min(n,t),o=Math.max(o,e),c=Math.max(c,t)});const u=e&r["a"];return a(this._bounds,4*u+4,0),this._bounds[4*u]=i,this._bounds[4*u+1]=n,this._bounds[4*u+2]=o,this._bounds[4*u+3]=c,!0}}},"563d":function(e,t,s){"use strict";s.d(t,"a",(function(){return C}));var r=s("a4ee"),i=(s("e06a"),s("2eab")),n=s("ce50"),a=s("e92d"),o=s("b2b2"),c=s("f4cc"),u=s("e041"),d=(s("cea0"),s("b50f"),s("c120"),s("2dd4"),s("d386")),l=s("59b2"),h=s("b0f5"),f=s("ce6d"),p=s("9096");let g=class extends(f["a"].EventedMixin(p["a"])){onFeature(e){this.emit("feature",e)}};g=Object(r["a"])([Object(d["a"])("esri.layers.graphics.sources.connections.StreamConnection")],g);const _=g,y=a["a"].getLogger("esri.layers.graphics.sources.connections.WebSocketConnection");var m;!function(e){e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"}(m||(m={}));let b=class extends _{constructor(e){super(),this.errorString=null;const{geometryType:t,spatialReference:s,sourceSpatialReference:r}=e;this._config=e,this._featureZScaler=Object(h["a"])(t,r,s),this._open()}async _open(){await this._tryCreateWebSocket(),this.destroyed||await this._handshake()}destroy(){Object(o["k"])(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(Object(o["j"])(this._websocket))return"disconnected";switch(this._websocket.readyState){case m.CONNECTING:case m.OPEN:return"connected";case m.CLOSING:case m.CLOSED:return"disconnected"}}async _tryCreateWebSocket(e=this._config.source.path,t=1e3,s=0){try{if(this.destroyed)return;const t=Object(u["e"])(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?(y.error(new n["a"]("websocket-connection","Exceeded maxReconnectionAttempts attempts. No further attempts will be made")),void this.destroy()):(y.error(new n["a"]("websocket-connection",`Failed to connect. Attempting to reconnect in ${i}s`,r)),await Object(c["a"])(t),this._tryCreateWebSocket(e,Math.min(1.5*t,1e3*this._config.maxReconnectionInterval),s+1))}}_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),r.onmessage=e=>this._onMessage(e),t(r)},r.onclose=e=>{r.onopen=r.onclose=null,s(e)}})}async _handshake(e=1e4){const t=this._websocket;if(Object(o["j"])(t))return;const s=Object(c["g"])(),r=t.onmessage,{filter:i,outFields:a,spatialReference:u}=this._config;return s.timeout(e),t.onmessage=e=>{var o;let c=null;try{c=JSON.parse(e.data)}catch(d){}c&&"object"==typeof c||(y.error(new n["a"]("websocket-connection","Protocol violation. Handshake failed - malformed message",e.data)),s.reject(),this.destroy()),(null==(o=c.spatialReference)?void 0:o.wkid)!==(null==u?void 0:u.wkid)&&(y.error(new n["a"]("websocket-connection","Protocol violation. Handshake failed - expected wkid of "+u.wkid,e.data)),s.reject(),this.destroy()),"json"!==c.format&&(y.error(new n["a"]("websocket-connection","Protocol violation. Handshake failed - format is not set",e.data)),s.reject(),this.destroy()),i&&c.filter!==i&&y.error(new n["a"]("websocket-connection","Tried to set filter, but server doesn't support it")),a&&c.outFields!==a&&y.error(new n["a"]("websocket-connection","Tried to set outFields, but server doesn't support it")),t.onmessage=r,s.resolve()},t.send(JSON.stringify({filter:i,outFields:a,format:"json",spatialReference:{wkid:u.wkid}})),s.promise}_onMessage(e){try{const t=JSON.parse(e.data);if("featureResult"!==t.type)throw new n["a"]("websocket-connection","Protocol violation - Expected to find message of type 'featureResult'",t);for(const e of t.features)Object(o["k"])(this._featureZScaler)&&this._featureZScaler(e.geometry),this.onFeature(e)}catch(t){return y.error(new n["a"]("websocket-connection","Failed to parse message",t)),void this.destroy()}}_onError(e){const t="Encountered an error over WebSocket connection";this._set("errorString",t),y.error("websocket-connection",t)}_onClose(e){this._websocket=null,this.notifyChange("connectionStatus"),1e3!==e.code&&y.error("websocket-connection","WebSocket closed unexpectedly with error code "+e.code),this.destroyed||this._open()}};Object(r["a"])([Object(l["b"])()],b.prototype,"connectionStatus",null),Object(r["a"])([Object(l["b"])()],b.prototype,"errorString",void 0),b=Object(r["a"])([Object(d["a"])("esri.layers.graphics.sources.connections.WebSocketConnection")],b);var I=s("e9fc"),S=s("69dd"),x=s("a9ab"),O=s("5996");const v=a["a"].getLogger("esri.layers.graphics.sources.connections.GeoEventConnection"),w=1e4,j={maxQueryDepth:5,maxRecordCountFactor:3};let T=class extends b{constructor(e){super({...j,...e})}async _open(){const e=await this._fetchServiceDefinition(this._config.source);e.timeInfo.trackIdField||v.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){let t;try{t=this._enrich(JSON.parse(e.data)),Object(o["k"])(this._featureZScaler)&&this._featureZScaler(t.geometry)}catch(s){return void v.error(new n["a"]("geoevent-connection","Failed to parse message",s))}this.onFeature(t)}async _fetchServiceDefinition(e){const t={f:"json",...this._config.customParameters},s=Object(i["default"])(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 Object(u["e"])(n+"/subscribe",{outSR:""+t.wkid,token:i})}_inferWebSocketBaseUrl(e){if(1===e.length)return e[0];for(const t of e)if(-1!==t.indexOf("wss"))return t;return v.error(new n["a"]("geoevent-connection","Unable to infer WebSocket url",e)),null}async _setFilter(e,t){const s=this._websocket;if(Object(o["j"])(s)||Object(o["j"])(e)&&Object(o["j"])(t))return;const r=JSON.stringify({filter:this._serializeFilter(e,t)});let i=!1;const a=Object(c["g"])(),u=()=>{i||(this.destroyed||this._websocket!==s||v.error(new n["a"]("geoevent-connection","Server timed out when setting filter")),a.reject())},d=e=>{const t=JSON.parse(e.data);t.filter&&(t.error&&(v.error(new n["a"]("geoevent-connection","Failed to set service filter",t.error)),this._set("errorString","Could not set service filter - "+t.error),a.reject(t.error)),s.onmessage=this._onMessage.bind(this),i=!0,a.resolve())};return s.onmessage=d,s.send(r),setTimeout(u,w),a.promise}_serializeFilter(e,t){const s={};if(Object(o["j"])(e)&&Object(o["j"])(t))return s;if(Object(o["k"])(e)&&e.geometry)try{const t=Object(x["a"])(e.geometry);if("extent"!==t.type)throw new n["a"]("Expected extent but found type "+t.type);s.geometry=JSON.stringify(t.shiftCentralMeridian())}catch(r){v.error(new n["a"]("geoevent-connection","Encountered an error when setting connection geometryDefinition",r))}return Object(o["k"])(e)&&e.where&&"1 = 1"!==e.where&&(s.where=e.where),Object(o["k"])(t)&&(s.outFields=t.join(",")),s}_enrich(e){if(!this._relatedFeatures)return e;const t=this._serviceDefinition.relatedFeatures.joinField,s=e.attributes[t];if(!this._relatedFeatures.has(s))return v.warn("geoevent-connection","Feature join failed. Is the join field configured correctly?",e),e;const{attributes:r,geometry:i}=this._relatedFeatures.get(s);for(const n in r)e.attributes[n]=r[n];return i&&(e.geometry=i),e.geometry||e.centroid||v.error(new n["a"]("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 n of i.features)this.onFeature(this._enrich(n))}catch(e){v.error(new n["a"]("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.resolve().then(s.bind(null,"5bd5"))).default)({url:e}),{capabilities:r}=await t.load(),i=r.query.supportsMaxRecordCountFactor,n=r.query.supportsPagination,a=r.query.supportsCentroid,c=this._config.maxRecordCountFactor,u=t.capabilities.query.maxRecordCount,d=i?u*c:u,l=new S["a"];if(l.outFields=Object(o["u"])(this._config.outFields,["*"]),l.where=Object(o["u"])(Object(o["i"])(this._config.filter,"where"),"1=1"),l.returnGeometry=!0,l.returnExceededLimitFeatures=!0,l.outSpatialReference=O["a"].fromJSON(this._config.spatialReference),a&&(l.returnCentroid=!0),i&&(l.maxRecordCountFactor=c),n)return l.num=d,t.destroy(),this._queryPages(e,l);const h=await Object(I["executeQuery"])(e,l,this._config.sourceSpatialReference);return t.destroy(),h.data}async _queryPages(e,t,s=[],r=0){t.start=Object(o["k"])(t.num)?r*t.num:null;const{data:i}=await Object(I["executeQuery"])(e,t,this._config.sourceSpatialReference);return i.exceededTransferLimit&&rs.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 i of s){const e=i.attributes[r];t.set(e,i)}this._relatedFeatures=t}};T=Object(r["a"])([Object(d["a"])("esri.layers.graphics.sources.connections.GeoEventConnection")],T);const F=T;function C(e,t,s,r,i,n,a,o){const c=0===e.path.indexOf("wss://")||0===e.path.indexOf("ws://"),u={source:e,sourceSpatialReference:t,spatialReference:s,geometryType:r,filter:i,maxReconnectionAttempts:n,maxReconnectionInterval:a,customParameters:o};return c?new b(u):new F(u)}},"7ab1":function(e,t,s){"use strict";s.d(t,"a",(function(){return u}));var r=s("971e"),i=s("38a4"),n=s("b2b2");const a="__esri_stream_id__",o="__esri_timestamp__",c=1e3;class u{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=this.objectIdField===a}add(e){if(this._useGeneratedIds){const t=this._nextId();e.attributes[this.objectIdField]=t,e.objectId=t}else e.objectId=e.attributes[this.objectIdField];if(this._addOrUpdated.set(e.objectId,e),this._maxAge=Math.max(this._maxAge,e.attributes[this._timeInfo.startTimeField]),!this._timeInfo.trackIdField)return Object(n["j"])(this._trackIdLessObservations)&&(this._trackIdLessObservations=new r["a"](1e5)),void this._trackIdLessObservations.enqueue(e.objectId);const t=e.attributes[this._timeInfo.trackIdField];if(!this._trackIdToObservations.has(t)){const e=Object(n["k"])(this._purgeOptions)&&null!=this._purgeOptions.maxObservations?this._purgeOptions.maxObservations:c,s=Object(i["f"])(e,0,c);this._trackIdToObservations.set(t,new r["a"](s))}const s=this._trackIdToObservations.get(t).enqueue(e.objectId);Object(n["k"])(s)&&(this._addOrUpdated.has(s)?this._addOrUpdated.delete(s):this._removed.push(s))}checkForUpdates(){const e=this._getToAdd(),t=this._getToRemove(),s=performance.now();s-this._lastPurge>=this.purgeInterval&&(this._purge(s),this._lastPurge=s);const r=[];if(Object(n["k"])(t))for(const i of t){const e=this.store.removeById(i);Object(n["k"])(e)&&r.push(e)}if(Object(n["k"])(e))for(const i of e)i.attributes[o]=s,this.store.add(i);(e||r)&&this.store.update(e,r)}_getToAdd(){if(!this._addOrUpdated.size)return null;const e=new Array(this._addOrUpdated.size);let t=0;return this._addOrUpdated.forEach(s=>e[t++]=s),this._addOrUpdated.clear(),e}_getToRemove(){const e=this._removed;return this._removed.length?(this._removed=[],e):null}_nextId(){const e=this._idCounter;return this._idCounter=(this._idCounter+1)%4294967294+1,e}_purge(e){const t=this._purgeOptions;Object(n["k"])(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=Object(n["t"])(s.dequeue());this._removed.push(e),t--}if(Object(n["k"])(this._trackIdLessObservations)){let s=t-e.displayCount;for(;s-- >0;){const e=this._trackIdLessObservations.dequeue();Object(n["k"])(e)&&this._removed.push(e)}}}}_purgeByAge(e){var t;if(!e.age||null==(t=this._timeInfo)||!t.startTimeField)return;const s=60*e.age*1e3,r=this._maxAge-s;this.store.forEach(e=>{e.attributes[this._timeInfo.startTimeField]{e.attributes[o]{0===e.size&&this._trackIdToObservations.delete(t)})}}},"7de1":function(e,t,s){"use strict";s.d(t,"a",(function(){return r}));class r{constructor(e,t){this._mask=0,this._buf=e,this._mask=t}static fromBuffer(e,t){return new r(e,t)}static create(e,t=4294967295){const s=new Uint32Array(Math.ceil(e/32));return new r(s,t)}_getIndex(e){return Math.floor(e/32)}has(e){const t=this._mask&e;return!!(this._buf[this._getIndex(t)]&1<>>=1,r++}}countSet(){let e=0;return this.forEachSet(t=>{e++}),e}}},"7e5e":function(e,t,s){"use strict";s.d(t,"a",(function(){return m})),s.d(t,"b",(function(){return y})),s.d(t,"c",(function(){return b})),s.d(t,"d",(function(){return I})),s.d(t,"e",(function(){return S})),s.d(t,"f",(function(){return x})),s.d(t,"g",(function(){return O})),s.d(t,"h",(function(){return v})),s.d(t,"i",(function(){return w})),s.d(t,"j",(function(){return j}));s("e06a");var r=s("2eab"),i=s("ce50"),n=s("e92d"),a=s("b2b2"),o=s("7f83"),c=s("9786"),u=s("6655"),d=s("eed5"),l=s("e3a3"),h=s("88d1"),f=s("80b7"),p=s("6781"),g=s("5996");const _=n["a"].getLogger("esri.layers.graphics.sources.ogcfeature"),y="http://www.opengis.net/def/crs/",m=y+"OGC/1.3/CRS84";async function b(e,t,s={},n=5){const{links:o}=e,c=M(o,"items","application/geo+json")||M(o,"http://www.opengis.net/def/rel/ogc/1.0/items","application/geo+json");if(Object(a["j"])(c))throw new i["a"]("ogc-feature-layer:missing-items-page","Missing items url");const{data:u}=await Object(r["default"])(c.href,{signal:s.signal,query:{limit:n,...s.customParameters,token:s.apiKey},headers:{accept:"application/geo+json"}});await Object(l["d"])(u);const d=Object(l["c"])(u,{geometryType:t.geometryType}),g=t.fields||d.fields||[],y=null!=t.hasZ?t.hasZ:d.hasZ,m=d.geometryType,b=t.objectIdField||d.objectIdFieldName||"OBJECTID";let I=t.timeInfo;const S=g.find(e=>e.name===b);if(S)S.type="esriFieldTypeOID",S.editable=!1,S.nullable=!1;else{if(!d.objectIdFieldType)throw new i["a"]("ogc-feature-layer:missing-feature-id","Collection geojson require a feature id as a unique identifier");g.unshift({name:b,alias:b,type:"esriFieldTypeOID",editable:!1,nullable:!1})}if(b!==d.objectIdFieldName){const e=g.find(e=>e.name===d.objectIdFieldName);e&&(e.type="esriFieldTypeInteger")}g===d.fields&&d.unknownFields.length>0&&_.warn({name:"ogc-feature-layer:unknown-field-types",message:"Some fields types couldn't be inferred from the features and were dropped",details:{unknownFields:d.unknownFields}});for(const r of g){if(null==r.name&&(r.name=r.alias),null==r.alias&&(r.alias=r.name),"esriFieldTypeOID"!==r.type&&"esriFieldTypeGlobalID"!==r.type&&(r.editable=null==r.editable||!!r.editable,r.nullable=null==r.nullable||!!r.nullable),!r.name)throw new i["a"]("ogc-feature-layer:invalid-field-name","field name is missing",{field:r});if(-1===p["a"].jsonValues.indexOf(r.type))throw new i["a"]("ogc-feature-layer:invalid-field-type",`invalid type for field "${r.name}"`,{field:r})}if(I){const e=new f["a"](g);if(I.startTimeField){const t=e.get(I.startTimeField);t?(I.startTimeField=t.name,t.type="esriFieldTypeDate"):I.startTimeField=null}if(I.endTimeField){const t=e.get(I.endTimeField);t?(I.endTimeField=t.name,t.type="esriFieldTypeDate"):I.endTimeField=null}if(I.trackIdField){const t=e.get(I.trackIdField);t?I.trackIdField=t.name:(I.trackIdField=null,_.warn({name:"ogc-feature-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:I}}))}I.startTimeField||I.endTimeField||(_.warn({name:"ogc-feature-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing",details:{timeInfo:I}}),I=null)}return{drawingInfo:m?Object(h["d"])(m):null,geometryType:m,fields:g,hasZ:!!y,objectIdField:b,timeInfo:I}}async function I(e,t={}){const{links:s}=e,n=M(s,"data","application/json")||M(s,"http://www.opengis.net/def/rel/ogc/1.0/data","application/json");if(Object(a["j"])(n))throw new i["a"]("ogc-feature-layer:missing-collections-page","Missing collections url");const{apiKey:o,customParameters:c,signal:u}=t,{data:d}=await Object(r["default"])(n.href,{signal:u,headers:{accept:"application/json"},query:{...c,token:o}});return d}async function S(e,t={}){const{links:s}=e,n=M(s,"conformance","application/json")||M(s,"http://www.opengis.net/def/rel/ogc/1.0/conformance","application/json");if(Object(a["j"])(n))throw new i["a"]("ogc-feature-layer:missing-conformance-page","Missing conformance url");const{apiKey:o,customParameters:c,signal:u}=t,{data:d}=await Object(r["default"])(n.href,{signal:u,headers:{accept:"application/json"},query:{...c,token:o}});return d}async function x(e,t={}){const{apiKey:s,customParameters:i,signal:n}=t,{data:a}=await Object(r["default"])(e,{signal:n,headers:{accept:"application/json"},query:{...i,token:s}});return a}async function O(e,t={}){const s="application/vnd.oai.openapi+json;version=3.0",i=M(e.links,"service-desc",s);if(Object(a["j"])(i))return _.warn("ogc-feature-layer:missing-openapi-page","The OGC API-Features server does not have an OpenAPI page."),null;const{apiKey:n,customParameters:o,signal:c}=t,{data:u}=await Object(r["default"])(i.href,{signal:c,headers:{accept:s},query:{...o,token:n}});return u}function v(e){const t=/^http:\/\/www\.opengis.net\/def\/crs\/(?.*)\/(?.*)\/(?.*)$/i.exec(e),s=null==t?void 0:t.groups;if(!s)return null;const{authority:r,code:i}=s;switch(r.toLowerCase()){case"ogc":switch(i.toLowerCase()){case"crs27":return g["a"].GCS_NAD_1927.wkid;case"crs83":return 4269;case"crs84":case"crs84h":return g["a"].WGS84.wkid;default:return null}case"esri":case"epsg":{const e=Number.parseInt(i,10);return Number.isNaN(e)?null:e}default:return null}}async function w(e,t,s){const r=await j(e,t,s);return Object(u["k"])(r)}async function j(e,t,s){const{capabilities:{query:{maxRecordCount:n}},collection:h,layerDefinition:f,queryParameters:{apiKey:p,customParameters:_},spatialReference:y,supportedCrs:m}=e,{links:b}=h,I=M(b,"items","application/geo+json")||M(b,"http://www.opengis.net/def/rel/ogc/1.0/items","application/geo+json");if(Object(a["j"])(I))throw new i["a"]("ogc-feature-layer:missing-items-page","Missing items url");const{geometry:S,num:x,start:O,timeExtent:v,where:w}=t;if(t.objectIds)throw new i["a"]("ogc-feature-layer:query-by-objectids-not-supported","Queries with objectids are not supported");const j=g["a"].fromJSON(y),T=Object(a["u"])(t.outSpatialReference,j),C=T.isWGS84?null:F(T,m),R=E(S,m),N=A(v),L=k(w),D=null!=x?x:null!=O&&void 0!==O?10:n,{data:P}=await Object(r["default"])(I.href,{...s,query:{..._,...R,crs:C,datetime:N,query:L,limit:D,startindex:O,token:p},headers:{accept:"application/geo+json"}});let U=!1;if(P.links){const e=P.links.find(e=>"next"===e.rel);U=!!e}!U&&Number.isInteger(P.numberMatched)&&Number.isInteger(P.numberReturned)&&(U=P.numberReturnede.rel===t&&e.type===s)||e.find(e=>e.rel===t&&!e.type)}},8332:function(e,t,s){"use strict";s.d(t,"a",(function(){return p})),s.d(t,"b",(function(){return u}));var r=s("b2b2"),i=s("a915"),n=s("a9a2"),a=s("8c81"),o=s("c84e"),c=s("3484");function u(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}function d(e){return{value:e.value,size:Object(i["j"])(e.size)}}function l(e){return e.map(e=>d(e))}function h(e){if("string"==typeof e||"number"==typeof e)return Object(i["j"])(e);const t=e;return{type:"size",expression:t.expression,stops:l(t.stops)}}const f=e=>{const t=[],s=[],r=l(e),n=r.length;for(let o=0;o<6;o++){const e=r[Math.min(o,n-1)];t.push(e.value),s.push(null==e.size?a["x"]:Object(i["g"])(e.size))}return{values:new Float32Array(t),sizes:new Float32Array(s)}};function p(e){const t=e&&e.length>0?{}:null,s=t?{}:null;if(!t)return{vvFields:t,vvRanges:s};for(const r of e)if(r.field&&(t[r.type]=r.field),"size"===r.type){s.size||(s.size={});const e=r;switch(Object(c["a"])(e)){case o["e"].SIZE_MINMAX_VALUE:s.size.minMaxValue={minDataValue:e.minDataValue,maxDataValue:e.maxDataValue,minSize:h(e.minSize),maxSize:h(e.maxSize)};break;case o["e"].SIZE_SCALE_STOPS:s.size.scaleStops={stops:l(e.stops)};break;case o["e"].SIZE_FIELD_STOPS:if(e.levels){const t={};for(const s in e.levels)t[s]=f(e.levels[s]);s.size.fieldStops={type:"level-dependent",levels:t}}else s.size.fieldStops={type:"static",...f(e.stops)};break;case o["e"].SIZE_UNIT_VALUE:s.size.unitValue={unit:e.valueUnit,valueRepresentation:e.valueRepresentation}}}else if("color"===r.type)s.color=y(r);else if("opacity"===r.type)s.opacity=g(r);else if("rotation"===r.type){const e=r;s.rotation={type:e.rotationType}}return{vvFields:t,vvRanges:s}}function g(e){const t={values:[0,0,0,0,0,0,0,0],opacities:[0,0,0,0,0,0,0,0]};if("string"==typeof e.field){if(!e.stops)return null;{if(e.stops.length>8)return null;const s=e.stops;for(let e=0;e<8;++e){const r=s[Math.min(e,s.length-1)];t.values[e]=r.value,t.opacities[e]=r.opacity}}}else{if(!(e.stops&&e.stops.length>=0))return null;{const s=e.stops&&e.stops.length>=0&&e.stops[0].opacity;for(let e=0;e<8;e++)t.values[e]=1/0,t.opacities[e]=s}}return t}function _(e,t,s){e[4*t+0]=s.r/255,e[4*t+1]=s.g/255,e[4*t+2]=s.b/255,e[4*t+3]=s.a}function y(e){if(Object(r["j"])(e))return null;if(e.normalizationField)return null;const t={field:null,values:[0,0,0,0,0,0,0,0],colors:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]};if("string"==typeof e.field){if(!e.stops)return null;{if(e.stops.length>8)return null;t.field=e.field;const s=e.stops;for(let e=0;e<8;++e){const r=s[Math.min(e,s.length-1)];t.values[e]=r.value,_(t.colors,e,r.color)}}}else{if(!(e.stops&&e.stops.length>=0))return null;{const s=e.stops&&e.stops.length>=0&&e.stops[0].color;for(let e=0;e<8;e++)t.values[e]=1/0,_(t.colors,e,s)}}for(let s=0;s<32;s+=4)Object(n["b"])(t.colors,s,!0);return t}},8483:function(e,t,s){"use strict";s.d(t,"a",(function(){return d}));var r=s("c120"),i=s("b2b2"),n=s("0f1c"),a=s("82fa"),o=s("e92d");function c(e,t,s){e.referencesGeometry();const r=t.readArcadeFeature();try{return e.evaluate({...s,$feature:r})}catch(i){return o["a"].getLogger("esri.views.2d.support.arcadeOnDemand").warn("Feature arcade evaluation failed:",i),null}}const u=Promise.resolve().then(s.bind(null,"ccac"));class d{constructor(e,t){this._canCacheExpressionValue=!1,this._sourceInfo=e,this._bitsets={computed:t.getBitset(t.createBitset())}}invalidate(){this._bitsets.computed.clear()}async updateSchema(e,t){const s=Object(n["a"])(this._schema,t);if(this._schema=t,!t||Object(i["j"])(s)||!Object(n["b"])(s,"attributes"))return;Object(r["a"])("esri-2d-update-debug")&&console.debug("Applying Update - Store:",s),this._bitsets.computed.clear(),e.targets[t.name]=!0;const a=t.attributes,o=[],c=[];for(const r in a){const e=a[r];switch(e.type){case"field":break;case"expression":o.push(this._createArcadeComputedField(e));break;case"label-expression":o.push(this._createLabelArcadeComputedField(e));break;case"statistic":c.push(e)}}this._computedFields=await Promise.all(o),this._canCacheExpressionValue=!this._computedFields.some(e=>"expression"===e.type&&e.expression.referencesScale()),this._statisticFields=c}setComputedAttributes(e,t,s,r){const i=this._bitsets.computed;if(!this._canCacheExpressionValue||!i.has(s)){i.set(s);for(const i of this._computedFields){const n=this._evaluateField(t,i,r);switch(i.resultType){case"numeric":e.setComputedNumericAtIndex(s,i.fieldIndex,n);break;case"string":e.setComputedStringAtIndex(s,i.fieldIndex,n)}}}}async _createArcadeComputedField(e){const t=this._sourceInfo.spatialReference,s=this._sourceInfo.fieldsIndex;return{...e,expression:await Object(a["d"])(e.valueExpression,t,s)}}async _createLabelArcadeComputedField(e){const t=this._sourceInfo.spatialReference,s=this._sourceInfo.fieldsIndex,{createLabelFunction:r}=await u,i=await r(e.label,s,t);return{...e,builder:i}}_evaluateField(e,t,s){switch(t.type){case"label-expression":{const s=e.readArcadeFeature();return t.builder.evaluate(s)||""}case"expression":{const{expression:r}=t;return c(r,e,{$view:{scale:s}})}}}}},"88d1":function(e,t,s){"use strict";s.d(t,"a",(function(){return h})),s.d(t,"b",(function(){return d})),s.d(t,"c",(function(){return l})),s.d(t,"d",(function(){return o}));var r=s("c120"),i=s("7ffa"),n=s("a94c"),a=s("8246");function o(e){return{renderer:{type:"simple",symbol:"esriGeometryPoint"===e||"esriGeometryMultipoint"===e?a["c"]:"esriGeometryPolyline"===e?a["e"]:a["d"]}}}const c=/^[_$a-zA-Z][_$a-zA-Z0-9]*$/;let u=1;function d(e,t){if(Object(r["a"])("esri-csp-restrictions"))return()=>({[t]:null,...e});try{let s=`this.${t} = null;`;for(const t in e)s+=`this${c.test(t)?"."+t:`["${t}"]`} = ${JSON.stringify(e[t])};`;const r=new Function(`\n return class AttributesClass$${u++} {\n constructor() {\n ${s};\n }\n }\n `)();return()=>new r}catch(s){return()=>({[t]:null,...e})}}function l(e={}){return[{name:"New Feature",description:"",prototype:{attributes:Object(i["a"])(e)}}]}function h(e,t){return{attachment:null,data:{isVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:e},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:t,supportsDelete:t,supportsEditing:t,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:t,supportsExceedsLimitStatistics:!0},query:n["a"],queryRelated:{supportsCount:!0,supportsOrderBy:!0,supportsPagination:!0},editing:{supportsGeometryUpdate:t,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1}}}},"8c81":function(e,t,s){"use strict";s.d(t,"a",(function(){return v})),s.d(t,"b",(function(){return T})),s.d(t,"c",(function(){return O})),s.d(t,"d",(function(){return w})),s.d(t,"e",(function(){return j})),s.d(t,"f",(function(){return d})),s.d(t,"g",(function(){return z})),s.d(t,"h",(function(){return V})),s.d(t,"i",(function(){return B})),s.d(t,"j",(function(){return G})),s.d(t,"k",(function(){return Q})),s.d(t,"l",(function(){return H})),s.d(t,"m",(function(){return Y})),s.d(t,"n",(function(){return P})),s.d(t,"o",(function(){return a})),s.d(t,"p",(function(){return k})),s.d(t,"q",(function(){return A})),s.d(t,"r",(function(){return c})),s.d(t,"s",(function(){return C})),s.d(t,"t",(function(){return M})),s.d(t,"u",(function(){return o})),s.d(t,"v",(function(){return F})),s.d(t,"w",(function(){return q})),s.d(t,"x",(function(){return r})),s.d(t,"y",(function(){return U})),s.d(t,"z",(function(){return i})),s.d(t,"A",(function(){return D})),s.d(t,"B",(function(){return p})),s.d(t,"C",(function(){return g})),s.d(t,"D",(function(){return _})),s.d(t,"E",(function(){return y})),s.d(t,"F",(function(){return f})),s.d(t,"G",(function(){return h})),s.d(t,"H",(function(){return m})),s.d(t,"I",(function(){return b})),s.d(t,"J",(function(){return I})),s.d(t,"K",(function(){return S})),s.d(t,"L",(function(){return x})),s.d(t,"M",(function(){return l})),s.d(t,"N",(function(){return u})),s.d(t,"O",(function(){return E})),s.d(t,"P",(function(){return n})),s.d(t,"Q",(function(){return L})),s.d(t,"R",(function(){return N})),s.d(t,"S",(function(){return R}));const r=1e-30,i=4294967295,n=512,a=8,o=29,c=24,u=8,d={metrics:{width:15,height:17,left:0,top:-7,advance:14}},l=0,h=0,f=0,p=1,g=2,_=3,y=4,m=12,b=5,I=6,S=5,x=6,O=0,v=1,w=2,j=3,T=4,F=2,C=1,A=2,k=4,E=1.05,M=3,R=5,N=6,L=1.15,D=2,P=8,U=500,q=10,z=2,G=0,B=1,Q=4,H=8,V=4,Y=1},"971e":function(e,t,s){"use strict";s.d(t,"a",(function(){return i}));var r=s("b2b2");class i{constructor(e){this.size=0,this._start=0,this.maxSize=e,this._buffer=new Array(e)}get entries(){return this._buffer}enqueue(e){if(this.size===this.maxSize){const t=this._buffer[this._start];return this._buffer[this._start]=e,this._start=(this._start+1)%this.maxSize,t}return this._buffer[(this._start+this.size++)%this.maxSize]=e,null}dequeue(){if(0===this.size)return null;const e=this._buffer[this._start];return this._buffer[this._start]=null,this.size--,this._start=(this._start+1)%this.maxSize,e}peek(){return 0===this.size?null:this._buffer[this._start]}find(e){if(0===this.size)return null;for(const t of this._buffer)if(Object(r["k"])(t)&&e(t))return t;return null}clear(e){let t=this.dequeue();for(;Object(r["k"])(t);)e&&e(t),t=this.dequeue()}}},"97cb":function(e,t,s){"use strict";s.d(t,"a",(function(){return i})),s.d(t,"b",(function(){return r}));const r=(e,t)=>e&&((...e)=>t.warn("DEBUG:",...e))||(()=>null),i=!1},a9a2:function(e,t,s){"use strict";s.d(t,"a",(function(){return a})),s.d(t,"b",(function(){return n})),s.d(t,"c",(function(){return o})),s.d(t,"d",(function(){return c}));var r=s("d114");function i(e,t){return Array.isArray(t)?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3]):(e[0]=t.r,e[1]=t.g,e[2]=t.b,e[3]=t.a),e}function n(e,t=0,s=!1){const r=e[t+3];return e[t+0]*=r,e[t+1]*=r,e[t+2]*=r,s||(e[t+3]*=255),e}function a(e){return n(i([],e))}function o(e){if(!e)return 0;const{r:t,g:s,b:i,a:n}=e;return Object(r["b"])(t*n,s*n,i*n,255*n)}function c(e){if(!e)return 0;const[t,s,i,n]=e;return Object(r["b"])(t*(n/255),s*(n/255),i*(n/255),n)}},ab39:function(e,t,s){"use strict";var r,i,n,a,o,c,u,d,l,h,f,p,g,_,y,m,b,I,S,x,O,v,w,j,T,F,C,A,k,E,M,R,N,L,D,P,U,q,z,G,B,Q,H,V,Y,Z,X,W,$,J,K,ee,te,se,re,ie,ne,ae,oe,ce;s.d(t,"a",(function(){return n})),s.d(t,"b",(function(){return m})),s.d(t,"c",(function(){return y})),s.d(t,"d",(function(){return r})),s.d(t,"e",(function(){return o})),s.d(t,"f",(function(){return u})),s.d(t,"g",(function(){return d})),s.d(t,"h",(function(){return l})),s.d(t,"i",(function(){return S})),s.d(t,"j",(function(){return x})),s.d(t,"k",(function(){return O})),s.d(t,"l",(function(){return j})),s.d(t,"m",(function(){return C})),s.d(t,"n",(function(){return A})),s.d(t,"o",(function(){return i})),s.d(t,"p",(function(){return D})),s.d(t,"q",(function(){return P})),s.d(t,"r",(function(){return z})),s.d(t,"s",(function(){return V})),s.d(t,"t",(function(){return Y})),s.d(t,"u",(function(){return Z})),s.d(t,"v",(function(){return X})),s.d(t,"w",(function(){return re})),s.d(t,"x",(function(){return ie})),s.d(t,"y",(function(){return ae})),function(e){e[e.BUTT=0]="BUTT",e[e.ROUND=1]="ROUND",e[e.SQUARE=2]="SQUARE",e[e.UNKNOWN=4]="UNKNOWN"}(r||(r={})),function(e){e[e.BEVEL=0]="BEVEL",e[e.ROUND=1]="ROUND",e[e.MITER=2]="MITER",e[e.UNKNOWN=4]="UNKNOWN"}(i||(i={})),function(e){e[e.SCREEN=0]="SCREEN",e[e.MAP=1]="MAP"}(n||(n={})),function(e){e[e.Tint=0]="Tint",e[e.Ignore=1]="Ignore",e[e.Multiply=99]="Multiply"}(a||(a={})),function(e){e.Both="Both",e.JustBegin="JustBegin",e.JustEnd="JustEnd",e.None="None"}(o||(o={})),function(e){e[e.Mosaic=0]="Mosaic",e[e.Centered=1]="Centered"}(c||(c={})),function(e){e[e.Normal=0]="Normal",e[e.Superscript=1]="Superscript",e[e.Subscript=2]="Subscript"}(u||(u={})),function(e){e[e.MSSymbol=0]="MSSymbol",e[e.Unicode=1]="Unicode"}(d||(d={})),function(e){e[e.Unspecified=0]="Unspecified",e[e.TrueType=1]="TrueType",e[e.PSOpenType=2]="PSOpenType",e[e.TTOpenType=3]="TTOpenType",e[e.Type1=4]="Type1"}(l||(l={})),function(e){e[e.Display=0]="Display",e[e.Map=1]="Map"}(h||(h={})),function(e){e[e.Z=0]="Z",e[e.X=1]="X",e[e.Y=2]="Y"}(f||(f={})),function(e){e[e.XYZ=0]="XYZ",e[e.ZXY=1]="ZXY",e[e.YXZ=2]="YXZ"}(p||(p={})),function(e){e[e.Rectangle=0]="Rectangle",e[e.RoundedRectangle=1]="RoundedRectangle",e[e.Oval=2]="Oval"}(g||(g={})),function(e){e[e.None=0]="None",e[e.Alpha=1]="Alpha",e[e.Screen=2]="Screen",e[e.Multiply=3]="Multiply",e[e.Add=4]="Add"}(_||(_={})),function(e){e[e.TTB=0]="TTB",e[e.RTL=1]="RTL",e[e.BTT=2]="BTT"}(y||(y={})),function(e){e[e.None=0]="None",e[e.SignPost=1]="SignPost",e[e.FaceNearPlane=2]="FaceNearPlane"}(m||(m={})),function(e){e[e.Float=0]="Float",e[e.String=1]="String",e[e.Boolean=2]="Boolean"}(b||(b={})),function(e){e[e.Intersect=0]="Intersect",e[e.Subtract=1]="Subtract"}(I||(I={})),function(e){e.OpenEnded="OpenEnded",e.Block="Block",e.Crossed="Crossed"}(S||(S={})),function(e){e.FullGeometry="FullGeometry",e.PerpendicularFromFirstSegment="PerpendicularFromFirstSegment",e.ReversedFirstSegment="ReversedFirstSegment",e.PerpendicularToSecondSegment="PerpendicularToSecondSegment",e.SecondSegmentWithTicks="SecondSegmentWithTicks",e.DoublePerpendicular="DoublePerpendicular",e.OppositeToFirstSegment="OppositeToFirstSegment",e.TriplePerpendicular="TriplePerpendicular",e.HalfCircleFirstSegment="HalfCircleFirstSegment",e.HalfCircleSecondSegment="HalfCircleSecondSegment",e.HalfCircleExtended="HalfCircleExtended",e.OpenCircle="OpenCircle",e.CoverageEdgesWithTicks="CoverageEdgesWithTicks",e.GapExtentWithDoubleTicks="GapExtentWithDoubleTicks",e.GapExtentMidline="GapExtentMidline",e.Chevron="Chevron",e.PerpendicularWithArc="PerpendicularWithArc",e.ClosedHalfCircle="ClosedHalfCircle",e.TripleParallelExtended="TripleParallelExtended",e.ParallelWithTicks="ParallelWithTicks",e.Parallel="Parallel",e.PerpendicularToFirstSegment="PerpendicularToFirstSegment",e.ParallelOffset="ParallelOffset",e.OffsetOpposite="OffsetOpposite",e.OffsetSame="OffsetSame",e.CircleWithArc="CircleWithArc",e.DoubleJog="DoubleJog",e.PerpendicularOffset="PerpendicularOffset",e.LineExcludingLastSegment="LineExcludingLastSegment",e.MultivertexArrow="MultivertexArrow",e.CrossedArrow="CrossedArrow",e.ChevronArrow="ChevronArrow",e.ChevronArrowOffset="ChevronArrowOffset",e.PartialFirstSegment="PartialFirstSegment",e.Arch="Arch",e.CurvedParallelTicks="CurvedParallelTicks",e.Arc90Degrees="Arc90Degrees"}(x||(x={})),function(e){e.Mitered="Mitered",e.Bevelled="Bevelled",e.Rounded="Rounded",e.Square="Square",e.TrueBuffer="TrueBuffer"}(O||(O={})),function(e){e.ClosePath="ClosePath",e.ConvexHull="ConvexHull",e.RectangularBox="RectangularBox"}(v||(v={})),function(e){e.BeginningOfLine="BeginningOfLine",e.EndOfLine="EndOfLine"}(w||(w={})),function(e){e.Mitered="Mitered",e.Bevelled="Bevelled",e.Rounded="Rounded",e.Square="Square"}(j||(j={})),function(e){e.Fast="Fast",e.Accurate="Accurate"}(T||(T={})),function(e){e.BeginningOfLine="BeginningOfLine",e.EndOfLine="EndOfLine"}(F||(F={})),function(e){e.Sinus="Sinus",e.Square="Square",e.Triangle="Triangle",e.Random="Random"}(C||(C={})),function(e){e[e.None=0]="None",e[e.Default=1]="Default",e[e.Force=2]="Force"}(A||(A={})),function(e){e[e.Buffered=0]="Buffered",e[e.Left=1]="Left",e[e.Right=2]="Right",e[e.AlongLine=3]="AlongLine"}(k||(k={})),function(e){e[e.Linear=0]="Linear",e[e.Rectangular=1]="Rectangular",e[e.Circular=2]="Circular",e[e.Buffered=3]="Buffered"}(E||(E={})),function(e){e[e.Discrete=0]="Discrete",e[e.Continuous=1]="Continuous"}(M||(M={})),function(e){e[e.AcrossLine=0]="AcrossLine",e[e.AloneLine=1]="AloneLine"}(R||(R={})),function(e){e[e.Left=0]="Left",e[e.Right=1]="Right",e[e.Center=2]="Center",e[e.Justify=3]="Justify"}(N||(N={})),function(e){e[e.Base=0]="Base",e[e.MidPoint=1]="MidPoint",e[e.ThreePoint=2]="ThreePoint",e[e.FourPoint=3]="FourPoint",e[e.Underline=4]="Underline",e[e.CircularCW=5]="CircularCW",e[e.CircularCCW=6]="CircularCCW"}(L||(L={})),function(e){e.Butt="Butt",e.Round="Round",e.Square="Square"}(D||(D={})),function(e){e.NoConstraint="NoConstraint",e.HalfPattern="HalfPattern",e.HalfGap="HalfGap",e.FullPattern="FullPattern",e.FullGap="FullGap",e.Custom="Custom"}(P||(P={})),function(e){e[e.None=-1]="None",e[e.Custom=0]="Custom",e[e.Circle=1]="Circle",e[e.OpenArrow=2]="OpenArrow",e[e.ClosedArrow=3]="ClosedArrow",e[e.Diamond=4]="Diamond"}(U||(U={})),function(e){e[e.ExtraLeading=0]="ExtraLeading",e[e.Multiple=1]="Multiple",e[e.Exact=2]="Exact"}(q||(q={})),function(e){e.Bevel="Bevel",e.Round="Round",e.Miter="Miter"}(z||(z={})),function(e){e[e.Default=0]="Default",e[e.String=1]="String",e[e.Numeric=2]="Numeric"}(G||(G={})),function(e){e[e.InsidePolygon=0]="InsidePolygon",e[e.PolygonCenter=1]="PolygonCenter",e[e.RandomlyInsidePolygon=2]="RandomlyInsidePolygon"}(B||(B={})),function(e){e[e.Tint=0]="Tint",e[e.Replace=1]="Replace",e[e.Multiply=2]="Multiply"}(Q||(Q={})),function(e){e[e.ClipAtBoundary=0]="ClipAtBoundary",e[e.RemoveIfCenterOutsideBoundary=1]="RemoveIfCenterOutsideBoundary",e[e.DoNotTouchBoundary=2]="DoNotTouchBoundary",e[e.DoNotClip=3]="DoNotClip"}(H||(H={})),function(e){e.NoConstraint="NoConstraint",e.WithMarkers="WithMarkers",e.WithFullGap="WithFullGap",e.WithHalfGap="WithHalfGap",e.Custom="Custom"}(V||(V={})),function(e){e.Fixed="Fixed",e.Random="Random",e.RandomFixedQuantity="RandomFixedQuantity"}(Y||(Y={})),function(e){e.LineMiddle="LineMiddle",e.LineBeginning="LineBeginning",e.LineEnd="LineEnd",e.SegmentMidpoint="SegmentMidpoint"}(Z||(Z={})),function(e){e.OnPolygon="OnPolygon",e.CenterOfMass="CenterOfMass",e.BoundingBoxCenter="BoundingBoxCenter"}(X||(X={})),function(e){e[e.Low=0]="Low",e[e.Medium=1]="Medium",e[e.High=2]="High"}(W||(W={})),function(e){e[e.MarkerCenter=0]="MarkerCenter",e[e.MarkerBounds=1]="MarkerBounds"}($||($={})),function(e){e[e.None=0]="None",e[e.PropUniform=1]="PropUniform",e[e.PropNonuniform=2]="PropNonuniform",e[e.DifUniform=3]="DifUniform",e[e.DifNonuniform=4]="DifNonuniform"}(J||(J={})),function(e){e.Tube="Tube",e.Strip="Strip",e.Wall="Wall"}(K||(K={})),function(e){e[e.Random=0]="Random",e[e.Increasing=1]="Increasing",e[e.Decreasing=2]="Decreasing",e[e.IncreasingThenDecreasing=3]="IncreasingThenDecreasing"}(ee||(ee={})),function(e){e[e.Relative=0]="Relative",e[e.Absolute=1]="Absolute"}(te||(te={})),function(e){e[e.Normal=0]="Normal",e[e.LowerCase=1]="LowerCase",e[e.Allcaps=2]="Allcaps"}(se||(se={})),function(e){e[e.LTR=0]="LTR",e[e.RTL=1]="RTL"}(re||(re={})),function(e){e.Draft="Draft",e.Picture="Picture",e.Text="Text"}(ie||(ie={})),function(e){e[e.Top=0]="Top",e[e.Center=1]="Center",e[e.Baseline=2]="Baseline",e[e.Bottom=3]="Bottom"}(ne||(ne={})),function(e){e[e.Right=0]="Right",e[e.Upright=1]="Upright"}(ae||(ae={})),function(e){e[e.Small=0]="Small",e[e.Medium=1]="Medium",e[e.Large=2]="Large"}(oe||(oe={})),function(e){e[e.Calm=0]="Calm",e[e.Rippled=1]="Rippled",e[e.Slight=2]="Slight",e[e.Moderate=3]="Moderate"}(ce||(ce={}))},c84e:function(e,t,s){"use strict";var r,i,n,a,o,c,u;s.d(t,"a",(function(){return u})),s.d(t,"b",(function(){return a})),s.d(t,"c",(function(){return n})),s.d(t,"d",(function(){return r})),s.d(t,"e",(function(){return o})),s.d(t,"f",(function(){return c})),function(e){e[e.FILL=0]="FILL",e[e.LINE=1]="LINE",e[e.MARKER=2]="MARKER",e[e.TEXT=3]="TEXT",e[e.LABEL=4]="LABEL"}(r||(r={})),function(e){e[e.SUCCEEDED=0]="SUCCEEDED",e[e.FAILED_OUT_OF_MEMORY=1]="FAILED_OUT_OF_MEMORY"}(i||(i={})),function(e){e[e.NONE=0]="NONE",e[e.MAP=1]="MAP",e[e.LABEL=2]="LABEL",e[e.LABEL_ALPHA=4]="LABEL_ALPHA",e[e.HITTEST=8]="HITTEST",e[e.HIGHLIGHT=16]="HIGHLIGHT",e[e.CLIP=32]="CLIP",e[e.DEBUG=64]="DEBUG",e[e.NUM_DRAW_PHASES=9]="NUM_DRAW_PHASES"}(n||(n={})),function(e){e[e.SIZE=0]="SIZE",e[e.COLOR=1]="COLOR",e[e.OPACITY=2]="OPACITY",e[e.ROTATION=3]="ROTATION"}(a||(a={})),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"}(c||(c={})),function(e){e[e.SPRITE=0]="SPRITE",e[e.GLYPH=1]="GLYPH"}(u||(u={}))},c8dd:function(e,t,s){"use strict";s.d(t,"a",(function(){return Q})),s.d(t,"b",(function(){return L})),s.d(t,"c",(function(){return D})),s.d(t,"d",(function(){return le})),s.d(t,"e",(function(){return B})),s.d(t,"f",(function(){return H})),s.d(t,"g",(function(){return K})),s.d(t,"h",(function(){return ee})),s.d(t,"i",(function(){return q})),s.d(t,"j",(function(){return z})),s.d(t,"k",(function(){return de})),s.d(t,"l",(function(){return Z})),s.d(t,"m",(function(){return Y})),s.d(t,"n",(function(){return F})),s.d(t,"o",(function(){return re})),s.d(t,"p",(function(){return G})),s.d(t,"q",(function(){return ae})),s.d(t,"r",(function(){return P})),s.d(t,"s",(function(){return ie})),s.d(t,"t",(function(){return se})),s.d(t,"u",(function(){return U})),s.d(t,"v",(function(){return ne})),s.d(t,"w",(function(){return ce})),s.d(t,"x",(function(){return te})),s.d(t,"y",(function(){return oe})),s.d(t,"z",(function(){return ue})),s.d(t,"A",(function(){return N}));var r=s("ce50"),i=s("e92d"),n=(s("38a4"),s("a915"),s("ab39")),a=(s("a9a2"),s("c84e")),o=s("ecd7");class c{constructor(){this.color=[0,0,0,0],this.haloColor=[0,0,0,0],this.haloSize=0,this.size=12,this.angle=0,this.offsetX=0,this.offsetY=0,this.hAnchor=0,this.vAnchor=0}acquire(e,t,s,r,i,n,a,o,c){this.color=e,this.haloColor=t,this.haloSize=s,this.size=r,this.angle=i,this.offsetX=n,this.offsetY=a,this.hAnchor=o,this.vAnchor=c}release(){this.color[0]=this.color[1]=this.color[2]=this.color[3]=0,this.haloColor[0]=this.haloColor[1]=this.haloColor[2]=this.haloColor[3]=0,this.haloSize=0,this.size=0,this.angle=0,this.offsetX=0,this.offsetY=0,this.hAnchor=0,this.vAnchor=0}}c.pool=new o["a"](c);var u=s("d17d"),d=(s("a1ff"),s("3f3e"));const l=i["a"].getLogger("esri.views.2d.engine.webgl.Utils"),h="geometry",f=[{name:h,strideInBytes:36}],p=[{name:h,strideInBytes:32}],g=[{name:h,strideInBytes:20}],_=[{name:h,strideInBytes:12}],y=[{name:h,strideInBytes:40}],m=[{name:h,strideInBytes:36}],b=[{name:h,strideInBytes:36}];function I(e){const t={};for(const s of e)t[s.name]=s.strideInBytes;return t}const S=I(f),x=I(p),O=I(g),v=I(_),w=I(y),j=I(m),T=I(b);function F(e,{fill:t}){switch(e){case a["d"].MARKER:return S;case a["d"].FILL:return"dot-density"===t?v:"simple"===t?O:x;case a["d"].LINE:return w;case a["d"].TEXT:return j;case a["d"].LABEL:return T}}const C=[h],A=[h],k=[h],E=[h],M=[h];function R(e){switch(e){case a["d"].MARKER:return C;case a["d"].FILL:return A;case a["d"].LINE:return k;case a["d"].TEXT:return E;case a["d"].LABEL:return M}}function N(e){switch(e%4){case 0:case 2:return 4;case 1:case 3:return 1}}function L(e,t){switch(t%4){case 0:case 2:return new Uint32Array(Math.floor(e*t/4));case 1:case 3:return new Uint8Array(e*t)}}function D(e,t){switch(t%4){case 0:case 2:return new Uint32Array(e);case 1:case 3:return new Uint8Array(e)}}function P(e){return null!=e}function U(e){return"number"==typeof e}function q(e){switch(e){case"butt":return n["d"].BUTT;case"round":return n["d"].ROUND;case"square":return n["d"].SQUARE;default:return l.error(new r["a"]("mapview-invalid-type",`Cap type ${e} is not a valid option. Defaulting to round`)),n["d"].ROUND}}function z(e){switch(e){case"miter":return n["o"].MITER;case"bevel":return n["o"].BEVEL;case"round":return n["o"].ROUND;default:return l.error(new r["a"]("mapview-invalid-type",`Join type ${e} is not a valid option. Defaulting to round`)),n["o"].ROUND}}function G(e){switch(e){case"opacity":return a["b"].OPACITY;case"color":return a["b"].COLOR;case"rotation":return a["b"].ROTATION;case"size":return a["b"].SIZE;default:return l.error("Cannot interpret unknown vv: "+e),null}}function B(e,t,s,r,i,n,a){for(const c in n){const t=n[c].stride,r=N(t),a=n[c].data,o=s[c].data,u=t*i.vertexCount/r,d=t*e/r,l=t*i.vertexFrom/r;for(let e=0;e{const t=new d["a"](e.name,e.count,e.type,i,0,e.normalized||!1);return i+=e.count*V(e.type),t}),t[s].forEach(e=>e.stride=i)}return t}const W=e=>{const t=new Map;for(const s in e)for(const r of e[s])t.set(r.name,r.location);return t},$=e=>{const t={};for(const s in e){const r=e[s];t[s]=r.length?r[0].stride:0}return t},J=new Map,K=(e,t)=>{if(!J.has(e)){const s=X(t),r={strides:$(s),bufferLayouts:s,attributes:W(t)};J.set(e,r)}return J.get(e)};function ee(e){e(a["d"].FILL),e(a["d"].LINE),e(a["d"].MARKER),e(a["d"].TEXT),e(a["d"].LABEL)}const te=e=>"path"in e&&he(e.path),se=e=>"url"in e&&e.url||"imageData"in e&&e.imageData,re=e=>"imageData"in e&&e.imageData&&"contentType"in e&&e.contentType?`data:${e.contentType};base64,${e.imageData}`:"url"in e?e.url:null,ie=e=>"url"in e&&e.url&&e.url.includes(".gif")||"contentType"in e&&"image/gif"===e.contentType||"imageData"in e&&e.imageData.includes("data:image/gif"),ne=e=>"url"in e&&e.url&&e.url.includes(".png")||"contentType"in e&&"image/png"===e.contentType||"imageData"in e&&e.imageData.includes("data:image/png"),ae=e=>e.type&&-1!==e.type.toLowerCase().indexOf("3d");function oe(e){switch(e.type){case"line":{const t=e;return"CIMSolidStroke"===t.cim.type&&!t.dashTemplate}case"fill":return"CIMSolidFill"===e.cim.type;case"esriSFS":return"esriSFSSolid"===e.style||"esriSFSNull"===e.style;case"esriSLS":return"esriSLSSolid"===e.style||"esriSLSNull"===e.style;default:return!1}}const ce=e=>e.includes("data:image/svg+xml");function ue(e){switch("cim"in e?e.cim.type:e.type){case"esriSMS":case"esriPMS":case"CIMPointSymbol":case"CIMVectorMarker":case"CIMPictureMarker":case"CIMCharacterMarker":return!1;default:return!0}}function de(e){const t="maxVVSize"in e&&e.maxVVSize,s="width"in e&&e.width||"size"in e&&e.size||0;return t||s}function le(e){const t=[];for(let s=0;s!!e&&(e=e.trim(),!!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(e)&&/[\dz]$/i.test(e)&&e.length>4))},d114:function(e,t,s){"use strict";s.d(t,"a",(function(){return n})),s.d(t,"b",(function(){return a})),s.d(t,"c",(function(){return i}));const r=new Float32Array(1);new Uint32Array(r.buffer);function i(e){return[255&e,(65280&e)>>>8,(16711680&e)>>>16,(4278190080&e)>>>24]}function n(e,t){return 65535&e|t<<16}function a(e,t,s,r){return 255&e|(255&t)<<8|(255&s)<<16|r<<24}},d806:function(e,t,s){"use strict";s.d(t,"a",(function(){return x}));var r=s("ce50"),i=s("c120"),n=s("e92d"),a=s("38a4"),o=s("b2b2"),c=s("f4cc"),u=s("0f1c"),d=s("80b7"),l=s("8c81"),h=s("175e"),f=s("c8dd"),p=s("97cb"),g=s("8332"),_=s("d17d");const y=n["a"].getLogger("esri.views.layers.2d.features.support.AttributeStore"),m=Object(p["b"])(p["a"],y),b={sharedArrayBuffer:Object(i["a"])("esri-shared-array-buffer"),atomics:Object(i["a"])("esri-atomics")};function I(e,t){return s=>t(e(s))}class S{constructor(e,t,s,r){this.size=0,this.texelSize=4;const{pixelType:i,layout:n,textureOnly:a}=r;this.textureOnly=a||!1,this.pixelType=i,this._ctype=t,this.layout=n,this._resetRange(),this._shared=e,this.size=s,a||(this.data=this._initData(i,s,e,t))}get buffer(){return Object(o["b"])(this.data,e=>e.buffer)}unsetComponentAllTexels(e,t){const s=Object(o["t"])(this.data);for(let r=0;rt)return null;this._resetRange();const r=!(this._shared||"local"===this._ctype),i=this.pixelType,n=this.layout,a=Object(o["t"])(this.data);return{start:e,end:t,data:r&&a.slice(e*s,(t+1)*s)||null,pixelType:i,layout:n}}_initData(e,t,s,r){const i=s&&"local"!==r?SharedArrayBuffer:ArrayBuffer,n=Object(f["l"])(e),a=new n(new i(t*t*4*n.BYTES_PER_ELEMENT));for(let o=0;onull)}destroy(){this._abortController.abort()}get hasScaleExpr(){return this._hasScaleExpr}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}update(e,t){this.config=t;const s=t.schema.processors[0].storage,r=Object(u["a"])(this._schema,s);if((e.targets.feature||e.targets.aggregate)&&(e.storage.data=!0),r&&(Object(i["a"])("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:",r),e.storage.data=!0,this._schema=s,this._attributeComputeMap.clear(),!Object(o["j"])(s))){switch(s.target){case"feature":this._targetType=h["c"];break;case"aggregate":this._targetType=h["b"]}if("subtype"===s.type)for(const e in s.mapping){const t=s.mapping[e];if(Object(o["k"])(t))for(const e of t.mapping)this._bindAttribute(e)}else for(const e of s.mapping)this._bindAttribute(e)}}onTileData(e,t){if(Object(o["j"])(t.addOrUpdate))return;const s=t.addOrUpdate.getCursor();for(;s.next();){const e=s.getDisplayId();this.setAttributeData(e,s)}}invalidateResources(){this._createResourcesPromise=null,this._abortController.abort(),this._abortController=new AbortController}async setHighlight(e,t){const s=1,r=this._getBlock(0),i=t.map(e=>Object(h["f"])(e));r.lock(),r.unsetComponentAllTexels(0,s),r.setComponent(0,s,i),r.unlock(),this._idsToHighlight.clear();for(const n of e)this._idsToHighlight.add(n);await this.sendUpdates()}async updateFilters(e,t){const{config:s,service:r,spatialReference:n}=t,{filters:a}=s,o=a.map((e,t)=>this._updateFilter(e,t,r,n));(await Promise.all(o)).some(e=>e)&&(e.storage.filters=!0,Object(i["a"])("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:","Filters changed"))}setData(e,t,s,r){const i=Object(h["f"])(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)?l["s"]:0}unsetAttributeData(e){const t=Object(h["f"])(e);this._getBlock(0).setData(t,0,0)}setAttributeData(e,t){const s=Object(h["f"])(e);if(this._ensureSizeForTexel(s),this._getBlock(0).setData(s,0,this.getFilterFlags(t)),this._targetType!==Object(h["g"])(e))return;const r=this._attributeComputeMap,i=this.config.supportsTextureFloat?1:2,n=4;r.size&&r.forEach((e,r)=>{const o=r*i%n,c=Math.floor(r*i/n),u=this._getBlock(c+l["e"]),d=e(t);if(this.config.supportsTextureFloat)u.setData(s,o,d);else if(d===l["x"])u.setData(s,o,255),u.setData(s,o+1,255);else{const e=Object(a["f"])(Math.round(d),-32767,32766)+32768,t=255&e,r=(65280&e)>>8;u.setData(s,o,t),u.setData(s,o+1,r)}})}sendUpdates(){if(this._nextUpdate)return this._nextUpdate.promise;if(this._currUpdate)return this._nextUpdate=Object(c["g"])(),this._nextUpdate.promise;const e={blocks:this._blocks.map(e=>Object(o["k"])(e)?e.toMessage():null)};return this._currUpdate=this._createResources().then(()=>{const t=()=>{if(this._currUpdate=null,this._nextUpdate){const e=this._nextUpdate;this._nextUpdate=null,this.sendUpdates().then(()=>e.resolve())}},s=this._client.update(e,this._signal).then(t).catch(t);return this._client.render(this._signal),s}).catch(e=>Object(c["m"])(e)?(this._createResourcesPromise=null,this._createResources()):(y.error(new r["a"]("mapview-attribute-store","Encountered an error during client update",e)),Promise.resolve())),this._currUpdate}_ensureSizeForTexel(e){for(;e>=this._size*this._size;)if(this._expand())return}_bindAttribute(e){function t(){return e.normalizationField?t=>{const s=t.readAttribute(e.normalizationField);return s?t.readAttribute(e.field)/s:null}:t=>t.readAttribute(e.field)}function s(){return e.normalizationField&&y.warn("mapview-arcade","Ignoring normalizationField specified with an arcade expression which is not supported."),t=>t.getComputedNumericAtIndex(e.fieldIndex)}let r;if(null!=e.fieldIndex)r=s();else{if(!e.field)return;r=t()}e.valueRepresentation&&(r=I(r,t=>Object(g["b"])(t,e.valueRepresentation)));const i=e=>null===e||isNaN(e)||e===1/0?l["x"]:e;this._attributeComputeMap.set(e.binding,I(r,i))}_createResources(){if(Object(o["k"])(this._createResourcesPromise))return this._createResourcesPromise;this._getBlock(l["a"]),this._getBlock(l["d"]),m("Initializing AttributeStore");const e={shared:b.sharedArrayBuffer&&!("local"===this._client.type),size:this._size,blocks:Object(o["m"])(this._blocks,e=>({textureOnly:e.textureOnly,buffer:e.buffer,pixelType:e.pixelType}))},t=this._client.initialize(e,this._signal).catch(e=>{Object(c["m"])(e)?this._createResourcesPromise=null:y.error(new r["a"]("mapview-attribute-store","Encountered an error during client initialization",e))});return this._createResourcesPromise=t,t.then(()=>Object(o["j"])(this._createResourcesPromise)?this._createResources():void 0),t}_getBlock(e){const t=this._blocks[e];if(Object(o["k"])(t))return t;m("Initializing AttributeBlock at index "+e);const s=b.sharedArrayBuffer,r=this._client.type,i=new S(s,r,this._size,this._blockDescriptors[e]);return this._blocks[e]=i,this._createResourcesPromise=null,i}_expand(){if(this._sizet.expand(e)),this._createResourcesPromise=null,this._size=e,0}return y.error(new r["a"]("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}async _updateFilter(e,t,s,r){const i=this._filters[t],n=Object(o["k"])(i)&&i.hash;if(!i&&!e)return!1;if(n===JSON.stringify(e))return!1;if(Object(o["j"])(e)){if(!i)return!1;const e=1<2)return!0;return!1}function f(e){return!g(e)}function p(e){return g(e)}function g(e){let t=0;for(let s=0;s=0;r--)F(e,t[r],s);e.lengths.push(t.length)}function F(e,t,s){const[r,i,n]=t;e.coords.push(r,i),s.hasZ&&e.coords.push(n||0)}function C(e){switch(typeof e){case"string":return"esriFieldTypeString";case"number":return"esriFieldTypeDouble";default:return"unknown"}}function A(e){if(!e)throw new r["a"]("geojson-layer:empty","GeoJSON data is empty");if("Feature"!==e.type&&"FeatureCollection"!==e.type)throw new r["a"]("geojson-layer:unsupported-geojson-object","missing or not supported GeoJSON object type",{data:e});const{crs:t}=e;if(!t)return;const s="string"==typeof t?t:"name"===t.type?t.properties.name:"EPSG"===t.type?t.properties.code:null,i=new RegExp(".*(CRS84H?|4326)$","i");if(!s||!i.test(s))throw new r["a"]("geojson-layer:unsupported-crs","unsupported GeoJSON 'crs' member",{crs:t})}function k(e,t={}){const s=[],r=new Set,i=new Set;let n,o=!1,l=null,f=!1,{geometryType:p=null}=t,g=!1;for(const a of u(e)){const{geometry:e,properties:t,id:u}=a;if((!e||(p||(p=c(e.type)),c(e.type)===p))&&(o||(o=h(d(e))),f||(f=null!=u,f&&(n=typeof u,l=Object.keys(t).filter(e=>t[e]===u))),f&&null!=u&&(l.length>1?l=l.filter(e=>t[e]===u):1===l.length&&(l=t[l[0]]===u?l:[])),!g&&t)){let e=!0;for(const n in t){if(r.has(n))continue;const a=t[n];if(null==a){e=!1,i.add(n);continue}const o=C(a);"unknown"!==o?(i.delete(n),r.add(n),s.push({name:n,alias:n,type:o})):i.add(n)}g=e}}const _=l&&1===l.length&&l[0]||null;if(_)for(const c of s)if(c.name===_&&Object(a["p"])(c)){c.type="esriFieldTypeOID";break}return{fields:s,geometryType:p,hasZ:o,objectIdFieldName:_,objectIdFieldType:n,unknownFields:Array.from(i)}}function E(e,t){return Array.from(l(u(e),t))}},f0d0:function(e,t,s){"use strict";s.d(t,"a",(function(){return w}));s("e06a");var r,i,n,a=s("c120"),o=s("b2b2"),c=s("d97e"),u=s("6655"),d=s("8152"),l=s("7de1"),h=s("a9ab");let f=0;const p=null!=(r=Object(a["a"])("featurelayer-simplify-thresholds"))?r:[.5,.5,.5,.5],g=p[0],_=p[1],y=p[2],m=p[3],b=null!=(i=Object(a["a"])("featurelayer-simplify-payload-size-factors"))?i:[1,2,4],I=b[0],S=b[1],x=b[2],O=null!=(n=Object(a["a"])("featurelayer-simplify-mobile-factor"))?n:2,v=Object(a["a"])("esri-mobile");class w{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._level=0,this.instance=e,this._layerSchema=t}static createInstance(){return f++,f=f>65535?0:f,f}get isEmpty(){return Object(o["k"])(this._deleted)&&this._deleted.countSet()===this.getSize()}set level(e){this._level=e}getAreaSimplificationThreshold(e,t){let s=1;const r=v?O:1;t>4e6?s=x*r:t>1e6?s=S*r:t>5e5?s=I*r:t>1e5&&(s=r);let i=0;e>4e3?i=m*s:e>2e3?i=y*s:e>100?i=_:e>15&&(i=g);let n=8;return this._level<4?n=1:this._level<5?n=2:this._level<6&&(n=4),i*n}setArcadeSpatialReference(e){this._arcadeSpatialReference=e}attachStorage(e){this._storage=e}getQuantizationTransform(){throw new Error("Unable to find transform for featureSet")}getStorage(){return this._storage}getComputedNumeric(e){return this.getComputedNumericAtIndex(0)}setComputedNumeric(e,t){return this.setComputedNumericAtIndex(t,0)}getComputedString(e){return this.getComputedStringAtIndex(0)}setComputedString(e,t){return this.setComputedStringAtIndex(0,t)}getComputedNumericAtIndex(e){return this._storage.getComputedNumericAtIndex(this.getDisplayId(),e)}setComputedNumericAtIndex(e,t){this._storage.setComputedNumericAtIndex(this.getDisplayId(),e,t)}getComputedStringAtIndex(e){return this._storage.getComputedStringAtIndex(this.getDisplayId(),e)}setComputedStringAtIndex(e,t){return this._storage.setComputedStringAtIndex(this.getDisplayId(),e,t)}transform(e,t,s,r){const i=this.copy();return i._tx+=e,i._ty+=t,i._sx*=s,i._sy*=r,i}readAttribute(e,t=!1){const s=this._readAttribute(e,t);if(void 0!==s)return s;for(const r of this._joined){r.setIndex(this.getIndex());const s=r._readAttribute(e,t);if(void 0!==s)return s}}readAttributes(){const e=this._readAttributes();for(const t of this._joined){t.setIndex(this.getIndex());const s=t._readAttributes();for(const t of Object.keys(s))e[t]=s[t]}return e}joinAttributes(e){this._joined.push(e)}readArcadeFeature(){return this}geometry(){const e=this.readHydratedGeometry(),t=Object(u["l"])(e,this.geometryType,this.hasZ,this.hasM),s=Object(h["a"])(t);return s&&(s.spatialReference=this._arcadeSpatialReference),s}field(e){if(this.hasField(e))return this.readAttribute(e,!0);for(const t of this._joined)if(t.setIndex(this.getIndex()),t.hasField(e))return t._readAttribute(e,!0);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.getFieldNames()}castToText(){return JSON.stringify(this.readLegacyFeature())}gdbVersion(){return null}fullSchema(){return this._layerSchema}castAsJson(e=null){return{attributes:this._readAttributes(),geometry:!0===(null==e?void 0:e.keepGeometryType)?this.geometry():this.geometry().toJSON()}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}removeIds(e){if(Object(o["j"])(this._objectIdToIndex)){const e=new Map,t=this.getCursor();for(;t.next();)e.set(t.getObjectId(),t.getIndex());this._objectIdToIndex=e}const t=this._objectIdToIndex;for(const s of e)t.has(s)&&this.removeAtIndex(t.get(s))}removeAtIndex(e){Object(o["j"])(this._deleted)&&(this._deleted=l["a"].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 Object(o["j"])(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=Object(o["u"])(this.getQuantizationTransform(),null);return Object(c["a"])(new d["a"],e,this.hasM,this.hasZ,t)}copyInto(e){e.seen=this.seen,e._storage=this._storage,e._arcadeSpatialReference=this._arcadeSpatialReference,e._joined=this._joined,e._tx=this._tx,e._ty=this._ty,e._sx=this._sx,e._sy=this._sy,e._deleted=this._deleted,e._objectIdToIndex=this._objectIdToIndex}}},f209:function(e,t,s){"use strict";s.d(t,"a",(function(){return i}));var r=s("f0d0");class i extends r["a"]{constructor(e,t){super(r["a"].createInstance(),e.fullSchema()),this._currentIndex=-1,this._reader=e,this._indices=t}static from(e,t){return new i(e.copy(),t)}get hasNext(){return this._currentIndex+1