@arcgis/core 4.29.0-next.20231221 → 4.29.0-next.20231222
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/01dbff2fdff9d5c95892.js +1 -0
- package/assets/esri/core/workers/chunks/046b3920f4aca1061d06.js +1 -0
- package/assets/esri/core/workers/chunks/15af5fd13722ef57c8f7.js +1 -0
- package/assets/esri/core/workers/chunks/3a4598c384c4c31ab35b.js +1 -0
- package/assets/esri/core/workers/chunks/5c269c59f61a185ed5c7.js +1 -0
- package/assets/esri/core/workers/chunks/7435463436cda9eb4246.js +1 -0
- package/assets/esri/core/workers/chunks/c1c4f3909b724c13033d.js +1 -0
- package/assets/esri/core/workers/chunks/ccfdd3d278756f01f630.js +1 -0
- package/assets/esri/core/workers/chunks/d4cf3af5f5c30925539c.js +1 -0
- package/assets/esri/core/workers/chunks/ee0b43679cc0cc531d7c.js +1 -0
- package/assets/esri/core/workers/chunks/f9f3d6b4347e63f440e0.js +1 -0
- package/assets/esri/core/workers/chunks/fbfdb4779198f4c35c65.js +1 -0
- package/assets/esri/core/workers/chunks/ffad926201d92c4d6b4e.js +1 -0
- package/chunks/HUDMaterial.glsl.js +1 -1
- package/core/MemCache.js +1 -1
- package/core/MemCachePool.js +1 -1
- package/core/deprecate.js +1 -1
- package/layers/mixins/operationalLayerModuleMap.js +1 -1
- package/layers/mixins/operationalLayers.js +1 -1
- package/layers/support/editableLayers.js +1 -1
- package/layers/support/layersCreator.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/StreamLayerView2D.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/FeatureSourceEventLog.js +5 -0
- package/views/2d/layers/features/PipelineConnectionHandlers.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/featureServiceUtils.js +5 -0
- package/views/2d/layers/features/layerAdapters/geometryUtils.js +5 -0
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/strategies/AFetchLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/ATileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/DrillDownTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/PagedTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/SnapshotLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/DrillDownTileSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/PagedTileSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
- package/views/3d/effects/RenderNode.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/terrain/TerrainAttributesCache.js +1 -1
- package/views/3d/webgl-engine/effects/RenderNodes.js +5 -0
- package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/webdoc/support/webdocSaveUtils.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/TableList.js +1 -1
- package/assets/esri/core/workers/chunks/251ceefdea4b345698a4.js +0 -1
- package/assets/esri/core/workers/chunks/2e6f1c788813b4162adf.js +0 -1
- package/assets/esri/core/workers/chunks/49ca15b23dd363bc3546.js +0 -1
- package/assets/esri/core/workers/chunks/521a38edbeff0073bfdd.js +0 -1
- package/assets/esri/core/workers/chunks/573ad8aa1c2cfad61eb8.js +0 -1
- package/assets/esri/core/workers/chunks/831283ac6653d7af90b6.js +0 -1
- package/assets/esri/core/workers/chunks/90444e25dd487d0bc438.js +0 -1
- package/assets/esri/core/workers/chunks/90b34ce04d5a83ea4344.js +0 -1
- package/assets/esri/core/workers/chunks/9c80cfae983c8ccfe616.js +0 -1
- package/assets/esri/core/workers/chunks/a1cf80c67ee8dbe9c897.js +0 -1
- package/assets/esri/core/workers/chunks/c76094c26e80656a2f8d.js +0 -1
- package/assets/esri/core/workers/chunks/df394ec25adfc9798f74.js +0 -1
- package/assets/esri/core/workers/chunks/e4ab40d895fccc81fe44.js +0 -1
- package/views/3d/webgl-engine/effects/RenderNodeCollection.js +0 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5683],{95401:(e,t,r)=>{r.d(t,{e:()=>c});var s,i,n,o=r(5732),a={exports:{}};s=a,i=function(){function e(e,r,i){i=i||2;var n,o,a,l,u,h,d,p=r&&r.length,_=p?r[0]*i:e.length,f=t(e,0,_,i,!0),y=[];if(!f||f.next===f.prev)return y;if(p&&(f=c(e,r,f,i)),e.length>80*i){n=a=e[0],o=l=e[1];for(var g=i;g<_;g+=i)(u=e[g])<n&&(n=u),(h=e[g+1])<o&&(o=h),u>a&&(a=u),h>l&&(l=h);d=0!==(d=Math.max(a-n,l-o))?1/d:0}return s(f,y,i,n,o,d),y}function t(e,t,r,s,i){var n,o;if(i===A(e,t,r,s)>0)for(n=t;n<r;n+=s)o=T(n,e[n],e[n+1],o);else for(n=r-s;n>=t;n-=s)o=T(n,e[n],e[n+1],o);if(o&&x(o,o.next)){var a=o.next;E(o),o=a}return o}function r(e,t){if(!e)return e;t||(t=e);var r,s=e;do{if(r=!1,s.steiner||!x(s,s.next)&&0!==m(s.prev,s,s.next))s=s.next;else{var i=s.prev;if(E(s),(s=t=i)===s.next)break;r=!0}}while(r||s!==t);return t}function s(e,t,c,l,u,h,d){if(e){!d&&h&&p(e,l,u,h);for(var _,f,y=e;e.prev!==e.next;)if(_=e.prev,f=e.next,h?n(e,l,u,h):i(e))t.push(_.i/c),t.push(e.i/c),t.push(f.i/c),E(e),e=f.next,y=f.next;else if((e=f)===y){d?1===d?s(e=o(r(e),t,c),t,c,l,u,h,2):2===d&&a(e,t,c,l,u,h):s(r(e),t,c,l,u,h,1);break}}}function i(e){var t=e.prev,r=e,s=e.next;if(m(t,r,s)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(y(t.x,t.y,r.x,r.y,s.x,s.y,i.x,i.y)&&m(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function n(e,t,r,s){var i=e.prev,n=e,o=e.next;if(m(i,n,o)>=0)return!1;for(var a=i.x<n.x?i.x<o.x?i.x:o.x:n.x<o.x?n.x:o.x,c=i.y<n.y?i.y<o.y?i.y:o.y:n.y<o.y?n.y:o.y,l=i.x>n.x?i.x>o.x?i.x:o.x:n.x>o.x?n.x:o.x,u=i.y>n.y?i.y>o.y?i.y:o.y:n.y>o.y?n.y:o.y,h=_(a,c,t,r,s),d=_(l,u,t,r,s),p=e.prevZ,f=e.nextZ;p&&p.z>=h&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&y(i.x,i.y,n.x,n.y,o.x,o.y,p.x,p.y)&&m(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&y(i.x,i.y,n.x,n.y,o.x,o.y,f.x,f.y)&&m(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&y(i.x,i.y,n.x,n.y,o.x,o.y,p.x,p.y)&&m(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&y(i.x,i.y,n.x,n.y,o.x,o.y,f.x,f.y)&&m(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function o(e,t,s){var i=e;do{var n=i.prev,o=i.next.next;!x(n,o)&&b(n,i,i.next,o)&&S(n,o)&&S(o,n)&&(t.push(n.i/s),t.push(i.i/s),t.push(o.i/s),E(i),E(i.next),i=e=o),i=i.next}while(i!==e);return r(i)}function a(e,t,i,n,o,a){var c=e;do{for(var l=c.next.next;l!==c.prev;){if(c.i!==l.i&&g(c,l)){var u=I(c,l);return c=r(c,c.next),u=r(u,u.next),s(c,t,i,n,o,a),void s(u,t,i,n,o,a)}l=l.next}c=c.next}while(c!==e)}function c(e,s,i,n){var o,a,c,u=[];for(o=0,a=s.length;o<a;o++)(c=t(e,s[o]*n,o<a-1?s[o+1]*n:e.length,n,!1))===c.next&&(c.steiner=!0),u.push(f(c));for(u.sort(l),o=0;o<u.length;o++)i=r(i=h(u[o],i),i.next);return i}function l(e,t){return e.x-t.x}function u(e){if(e.next.prev===e)return e;let t=e;for(;;){const r=t.next;if(r.prev===t||r===t||r===e)break;t=r}return t}function h(e,t){var s=function(e,t){var r,s=t,i=e.x,n=e.y,o=-1/0;do{if(n<=s.y&&n>=s.next.y&&s.next.y!==s.y){var a=s.x+(n-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(a<=i&&a>o){if(o=a,a===i){if(n===s.y)return s;if(n===s.next.y)return s.next}r=s.x<s.next.x?s:s.next}}s=s.next}while(s!==t);if(!r)return null;if(i===o)return r;var c,l=r,u=r.x,h=r.y,p=1/0;s=r;do{i>=s.x&&s.x>=u&&i!==s.x&&y(n<h?i:o,n,u,h,n<h?o:i,n,s.x,s.y)&&(c=Math.abs(n-s.y)/(i-s.x),S(s,e)&&(c<p||c===p&&(s.x>r.x||s.x===r.x&&d(r,s)))&&(r=s,p=c)),s=s.next}while(s!==l);return r}(e,t);if(!s)return t;var i=I(s,e),n=r(s,s.next);let o=u(i);return r(o,o.next),n=u(n),u(t===s?n:t)}function d(e,t){return m(e.prev,e,t.prev)<0&&m(t.next,e,e.next)<0}function p(e,t,r,s){var i=e;do{null===i.z&&(i.z=_(i.x,i.y,t,r,s)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,r,s,i,n,o,a,c,l=1;do{for(r=e,e=null,n=null,o=0;r;){for(o++,s=r,a=0,t=0;t<l&&(a++,s=s.nextZ);t++);for(c=l;a>0||c>0&&s;)0!==a&&(0===c||!s||r.z<=s.z)?(i=r,r=r.nextZ,a--):(i=s,s=s.nextZ,c--),n?n.nextZ=i:e=i,i.prevZ=n,n=i;r=s}n.nextZ=null,l*=2}while(o>1)}(i)}function _(e,t,r,s,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-s)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function f(e){var t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function y(e,t,r,s,i,n,o,a){return(i-o)*(t-a)-(e-o)*(n-a)>=0&&(e-o)*(s-a)-(r-o)*(t-a)>=0&&(r-o)*(n-a)-(i-o)*(s-a)>=0}function g(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&b(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&(S(e,t)&&S(t,e)&&function(e,t){var r=e,s=!1,i=(e.x+t.x)/2,n=(e.y+t.y)/2;do{r.y>n!=r.next.y>n&&r.next.y!==r.y&&i<(r.next.x-r.x)*(n-r.y)/(r.next.y-r.y)+r.x&&(s=!s),r=r.next}while(r!==e);return s}(e,t)&&(m(e.prev,e,t.prev)||m(e,t.prev,t))||x(e,t)&&m(e.prev,e,e.next)>0&&m(t.prev,t,t.next)>0)}function m(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function x(e,t){return e.x===t.x&&e.y===t.y}function b(e,t,r,s){var i=w(m(e,t,r)),n=w(m(e,t,s)),o=w(m(r,s,e)),a=w(m(r,s,t));return i!==n&&o!==a||!(0!==i||!v(e,r,t))||!(0!==n||!v(e,s,t))||!(0!==o||!v(r,e,s))||!(0!==a||!v(r,t,s))}function v(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function w(e){return e>0?1:e<0?-1:0}function S(e,t){return m(e.prev,e,e.next)<0?m(e,t,e.next)>=0&&m(e,e.prev,t)>=0:m(e,t,e.prev)<0||m(e,e.next,t)<0}function I(e,t){var r=new R(e.i,e.x,e.y),s=new R(t.i,t.x,t.y),i=e.next,n=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,s.next=r,r.prev=s,n.next=s,s.prev=n,s}function T(e,t,r,s){var i=new R(e,t,r);return s?(i.next=s.next,i.prev=s,s.next.prev=i,s.next=i):(i.prev=i,i.next=i),i}function E(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function R(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function A(e,t,r,s){for(var i=0,n=t,o=r-s;n<r;n+=s)i+=(e[o]-e[n])*(e[n+1]+e[o+1]),o=n;return i}return e.deviation=function(e,t,r,s){var i=t&&t.length,n=i?t[0]*r:e.length,o=Math.abs(A(e,0,n,r));if(i)for(var a=0,c=t.length;a<c;a++){var l=t[a]*r,u=a<c-1?t[a+1]*r:e.length;o-=Math.abs(A(e,l,u,r))}var h=0;for(a=0;a<s.length;a+=3){var d=s[a]*r,p=s[a+1]*r,_=s[a+2]*r;h+=Math.abs((e[d]-e[_])*(e[p+1]-e[d+1])-(e[d]-e[p])*(e[_+1]-e[d+1]))}return 0===o&&0===h?0:Math.abs((h-o)/o)},e.flatten=function(e){for(var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},s=0,i=0;i<e.length;i++){for(var n=0;n<e[i].length;n++)for(var o=0;o<t;o++)r.vertices.push(e[i][n][o]);i>0&&(s+=e[i-1].length,r.holes.push(s))}return r},e},void 0!==(n=i())&&(s.exports=n);const c=(0,o.g)(a.exports)},64830:(e,t,r)=>{r.d(t,{Z:()=>n});var s=r(58971),i=r(10661);class n{constructor(e=(e=>e.values().next().value)){this._peeker=e,this._observable=new i.s,this._items=new Set}get length(){return(0,s.it)(this._observable),this._items.size}clear(){0!==this.length&&(this._items.clear(),this._observable.notify())}last(){if(0===this.length)return;let e;for(e of this._items);return e}peek(){if(0!==this.length)return this._peeker(this._items)}push(e){this.contains(e)||(this._items.add(e),this._observable.notify())}contains(e){return(0,s.it)(this._observable),this._items.has(e)}pop(){if(0===this.length)return;const e=this.peek();return this._items.delete(e),this._observable.notify(),e}popLast(){if(0===this.length)return;const e=this.last();return this._items.delete(e),this._observable.notify(),e}remove(e){this.contains(e)&&(this._items.delete(e),this._observable.notify())}filter(e){const t=this.length;return this._items.forEach((t=>{e(t)||this._items.delete(t)})),t!==this._items.size&&this._observable.notify(),this}*[Symbol.iterator](){(0,s.it)(this._observable),yield*this._items}}},46505:(e,t,r)=>{function s(){return[0,0]}function i(e,t){return[e,t]}function n(){return i(1,1)}function o(){return i(1,0)}function a(){return i(0,1)}r.d(t,{Ue:()=>s,al:()=>i});const c=n(),l=o(),u=a();Object.freeze(Object.defineProperty({__proto__:null,ONES:c,UNIT_X:l,UNIT_Y:u,ZEROS:[0,0],clone:function(e){return[e[0],e[1]]},create:s,createView:function(e,t){return new Float64Array(e,t,2)},fromArray:function(e,t=[0,0]){const r=Math.min(2,e.length);for(let s=0;s<r;++s)t[s]=e[s];return t},fromValues:i,ones:n,unitX:o,unitY:a,zeros:function(){return[0,0]}},Symbol.toStringTag,{value:"Module"}))},19402:(e,t,r)=>{r.d(t,{R:()=>u});var s=r(43697),i=r(92036),n=r(50758),o=r(17445),a=r(1654),c=r(5600),l=r(52011);let u=class extends i.Z{constructor(){super(...arguments),this.updating=!1,this._handleId=0,this._scheduleHandleId=0,this._pendingPromises=new Set}destroy(){this.removeAll()}add(e,t,r={}){return this._installWatch(e,t,r,o.YP)}addWhen(e,t,r={}){return this._installWatch(e,t,r,o.gx)}addOnCollectionChange(e,t,{initial:r=!1,final:s=!1}={}){const i=++this._handleId;return this.addHandles([(0,o.on)(e,"after-changes",this._createSyncUpdatingCallback(),o.Z_),(0,o.on)(e,"change",t,{onListenerAdd:r?e=>t({added:e.toArray(),removed:[]}):void 0,onListenerRemove:s?e=>t({added:[],removed:e.toArray()}):void 0})],i),(0,n.kB)((()=>this.removeHandles(i)))}addPromise(e){if(null==e)return e;const t=++this._handleId;this.addHandles((0,n.kB)((()=>{this._pendingPromises.delete(e)&&(0!==this._pendingPromises.size||this.hasHandles(h)||this._set("updating",!1))})),t),this._pendingPromises.add(e),this._set("updating",!0);const r=()=>this.removeHandles(t);return e.then(r,r),e}removeAll(){this._pendingPromises.clear(),this.removeAllHandles(),this._set("updating",!1)}_installWatch(e,t,r={},s){const i=++this._handleId;r.sync||this._installSyncUpdatingWatch(e,i);const o=s(e,t,r);return this.addHandles(o,i),(0,n.kB)((()=>this.removeHandles(i)))}_installSyncUpdatingWatch(e,t){const r=this._createSyncUpdatingCallback(),s=(0,o.YP)(e,r,{sync:!0,equals:()=>!1});return this.addHandles(s,t),s}_createSyncUpdatingCallback(){return()=>{this.removeHandles(h),++this._scheduleHandleId;const e=this._scheduleHandleId;this._get("updating")||this._set("updating",!0),this.addHandles((0,a.Os)((()=>{e===this._scheduleHandleId&&(this._set("updating",this._pendingPromises.size>0),this.removeHandles(h))})),h)}}};(0,s._)([(0,c.Cb)({readOnly:!0})],u.prototype,"updating",void 0),u=(0,s._)([(0,l.j)("esri.core.support.UpdatingHandles")],u);const h=-42},80903:(e,t,r)=>{r.d(t,{Z:()=>l});var s=r(50758),i=r(95330),n=r(64830),o=r(18948),a=r(49737),c=r(728);class l{constructor(){this._inUseClients=new Array,this._clients=new Array,this._clientPromises=new Array,this._ongoingJobsQueue=new n.Z}destroy(){this.close()}get closed(){return!this._clients?.length}open(e,t){return new Promise(((r,s)=>{let n=!0;const o=e=>{(0,i.k_)(t.signal),n&&(n=!1,e())};this._clients.length=e.length,this._clientPromises.length=e.length,this._inUseClients.length=e.length;for(let n=0;n<e.length;++n){const a=e[n];(0,i.y8)(a)?this._clientPromises[n]=a.then((e=>(this._clients[n]=new c.default(e,t,this._ongoingJobsQueue),o(r),this._clients[n])),(()=>(o(s),null))):(this._clients[n]=new c.default(a,t,this._ongoingJobsQueue),this._clientPromises[n]=Promise.resolve(this._clients[n]),o(r))}}))}broadcast(e,t,r){const s=new Array(this._clientPromises.length);for(let i=0;i<this._clientPromises.length;++i){const n=this._clientPromises[i];s[i]=n.then((s=>s?.invoke(e,t,r)))}return s}close(){let e;for(;e=this._ongoingJobsQueue.pop();)e.resolver.reject((0,i.zE)(`Worker closing, aborting job calling '${e.methodName}'`));for(const e of this._clientPromises)e.then((e=>e?.close()));this._clients.length=0,this._clientPromises.length=0,this._inUseClients.length=0,(0,o.E)(this)}invoke(e,t,r){return this.apply(e,[t],r)}apply(e,t,r){const s=(0,i.hh)();this._ongoingJobsQueue.push({methodName:e,data:t,invokeOptions:r,resolver:s});for(let e=0;e<this._clientPromises.length;e++){const t=this._clients[e];t?t.jobAdded():this._clientPromises[e].then((e=>e?.jobAdded()))}return s.promise}createInvokeProxy(e){return(0,a.D)(this,e)}on(e,t){return Promise.all(this._clientPromises).then((()=>(0,s.AL)(this._clients.map((r=>r.on(e,t))))))}openPorts(){return new Promise((e=>{const t=new Array(this._clientPromises.length);let r=t.length;for(let s=0;s<this._clientPromises.length;++s)this._clientPromises[s].then((i=>{i&&(t[s]=i.openPort()),0==--r&&e(t)}))}))}get test(){return{numClients:this._clients.length}}}},18948:(e,t,r)=>{r.d(t,{E:()=>n,z:()=>i});const s=new FinalizationRegistry((e=>{e.close()}));function i(e,t){s.register(e,t,t)}function n(e){s.unregister(e)}},84864:(e,t,r)=>{r.d(t,{bU:()=>v,fC:()=>S,ir:()=>f,zp:()=>y}),r(80442);var s=r(22021),i=r(6570),n=r(38913),o=r(82971),a=r(68441),c=r(98732),l=r(5428),u=r(37427);const h=new Float64Array(2),d=new Float64Array(2),p="0123456789bcdefghjkmnpqrstuvwxyz",_=64;function f(e,t,r,s){const a=[e.xmin,e.ymin,e.xmax,e.ymax],h=n.Z.fromExtent(i.Z.fromBounds(a,s)),d=(0,u.iV)(h,s,o.Z.WGS84,{densificationStep:t*_}),p=(0,c.Uy)(new l.Z,d,!1,!1),f=p.coords.filter(((e,t)=>!(t%2))),g=p.coords.filter(((e,t)=>t%2)),m=Math.min(...f),x=Math.min(...g),b=Math.max(...f),v=Math.max(...g),w=y(m,x,r,o.Z.WGS84),S=y(b,v,r,o.Z.WGS84);if(!w||!S)throw new Error("InternalError: Unable to project tile bounds");return{bounds:a,geohashBounds:{xLL:w[0],yLL:w[1],xTR:S[0],yTR:S[1]},level:r}}function y(e,t,r,i){if(i.isWebMercator){const i=(0,s.BV)(e/a.sv.radius),n=i-360*Math.floor((i+180)/360),o=[0,0];return w(o,0,(0,s.BV)(Math.PI/2-2*Math.atan(Math.exp(-t/a.sv.radius))),n,r),o}const n=(0,u.iV)({x:e,y:t},i,o.Z.WGS84);if(!n)return null;const c=[0,0];return w(c,0,n.y,n.x,r),c}function g(e){return p[e]}function m(e){return(e[0]+e[1])/2}function x(e,t,r){return e[0]=t,e[1]=r,e}function b(e,t){const r=t>m(e);return function(e,t){const r=m(e),s=t,i=!t;e[0]=i*e[0]+s*r,e[1]=i*r+s*e[1]}(e,r),r}function v(e,t){let r=-90,s=90,i=-180,n=180;for(let o=0;o<t;o++){const t=Math.ceil((o+1)/2),a=Math.floor((o+1)/2),c=1-o%2,l=30-(3*t+2*a),u=30-(2*t+3*a),h=3*c+2*(1-c),d=2*c+3*(1-c),p=3*c+7*(1-c)<<u,_=(7*c+3*(1-c)<<l&e.geohashX)>>l,f=(p&e.geohashY)>>u;for(let e=h-1;e>=0;e--){const t=(i+n)/2,r=_&1<<e?1:0;i=(1-r)*i+r*t,n=(1-r)*t+r*n}for(let e=d-1;e>=0;e--){const t=(r+s)/2,i=f&1<<e?1:0;r=(1-i)*r+i*t,s=(1-i)*t+i*s}}return[i,r,n,s]}function w(e,t,r,s,i){i%2&&(i+=1);let n=0,o=0,a=-90,c=90,l=-180,u=180;for(let e=0;e<i/2;e++){for(let t=0;t<5;t++){const r=(l+u)/2,i=s>r?1:0;n|=i<<29-(t+5*e),l=(1-i)*l+i*r,u=(1-i)*r+i*u}for(let t=0;t<5;t++){const s=(a+c)/2,i=r>s?1:0;o|=i<<29-(t+5*e),a=(1-i)*a+i*s,c=(1-i)*s+i*c}}e[2*t]=n,e[2*t+1]=o}function S(e,t,r){let s="";const i=x(h,-90,90),n=x(d,-180,180);for(let o=0;o<r;o++){let r=0;o%2?(r|=b(i,e)<<4,r|=b(n,t)<<3,r|=b(i,e)<<2,r|=b(n,t)<<1,r|=b(i,e)<<0):(r|=b(n,t)<<4,r|=b(i,e)<<3,r|=b(n,t)<<2,r|=b(i,e)<<1,r|=b(n,t)<<0),s+=g(r)}return s}},65390:(e,t,r)=>{r.d(t,{b:()=>l,j:()=>c});var s=r(99880),i=r(80442);const n=128e3;let o=null,a=null;async function c(){return o||(o=async function(){const e=(0,i.Z)("esri-csp-restrictions")?await r.e(3852).then(r.bind(r,43852)).then((e=>e.l)):await r.e(4358).then(r.bind(r,84358)).then((e=>e.l));a=await e.default({locateFile:e=>(0,s.V)(`esri/core/libs/libtess/${e}`)})}()),o}function l(e,t){const r=Math.max(e.length,n);return a.triangulate(e,t,r)}},95047:(e,t,r)=>{r.r(t),r.d(t,{createConnection:()=>E});var s=r(43697),i=(r(66577),r(3172)),n=r(20102),o=r(92604),a=r(95330),c=r(17452),l=(r(80442),r(77734),r(52011)),u=r(5600),h=r(69285),d=r(32448);let p=class extends d.Z.EventedAccessor{destroy(){this.emit("destroy")}get connectionError(){return this.errorString?new n.Z("stream-connection",this.errorString):null}onFeature(e){this.emit("data-received",e)}onMessage(e){this.emit("message-received",e)}};(0,s._)([(0,u.Cb)({readOnly:!0})],p.prototype,"connectionError",null),p=(0,s._)([(0,l.j)("esri.layers.support.StreamConnection")],p);const _=p;var f,y;(y=f||(f={}))[y.CONNECTING=0]="CONNECTING",y[y.OPEN=1]="OPEN",y[y.CLOSING=2]="CLOSING",y[y.CLOSED=3]="CLOSED";let g=class extends _{constructor(e){super({}),this._outstandingMessages=[],this.errorString=null;const{geometryType:t,spatialReference:r,sourceSpatialReference:s}=e;this._config=e,this._featureZScaler=(0,h.k)(t,s,r),this._open()}normalizeCtorArgs(){return{}}async _open(){await this._tryCreateWebSocket(),this.destroyed||await this._handshake()}destroy(){super.destroy(),null!=this._websocket&&(this._websocket.onopen=null,this._websocket.onclose=null,this._websocket.onerror=null,this._websocket.onmessage=null,this._websocket.close()),this._websocket=null}get connectionStatus(){if(null==this._websocket)return"disconnected";switch(this._websocket.readyState){case f.CONNECTING:case f.OPEN:return"connected";case f.CLOSING:case f.CLOSED:return"disconnected"}}sendMessageToSocket(e){null!=this._websocket?this._websocket.send(JSON.stringify(e)):this._outstandingMessages.push(e)}sendMessageToClient(e){this._onMessage(e)}updateCustomParameters(e){this._config.customParameters=e,null!=this._websocket&&this._websocket.close()}async _tryCreateWebSocket(e=this._config.source.path,t=1e3,r=0){try{if(this.destroyed)return;const t=(0,c.fl)(e,this._config.customParameters??{});this._websocket=await this._createWebSocket(t),this.notifyChange("connectionStatus")}catch(s){const i=t/1e3;return this._config.maxReconnectionAttempts&&r>=this._config.maxReconnectionAttempts?(o.Z.getLogger(this).error(new n.Z("websocket-connection","Exceeded maxReconnectionAttempts attempts. No further attempts will be made")),void this.destroy()):(o.Z.getLogger(this).error(new n.Z("websocket-connection",`Failed to connect. Attempting to reconnect in ${i}s`,s)),await(0,a.e4)(t),this._tryCreateWebSocket(e,Math.min(1.5*t,1e3*this._config.maxReconnectionInterval),r+1))}}_setWebSocketJSONParseHandler(e){e.onmessage=e=>{try{const t=JSON.parse(e.data);this._onMessage(t)}catch(e){return void o.Z.getLogger(this).error(new n.Z("websocket-connection","Failed to parse message, invalid JSON",{error:e}))}}}_createWebSocket(e){return new Promise(((t,r)=>{const s=new WebSocket(e);s.onopen=()=>{if(s.onopen=null,this.destroyed)return s.onclose=null,void s.close();s.onclose=e=>this._onClose(e),s.onerror=e=>this._onError(e),this._setWebSocketJSONParseHandler(s),t(s)},s.onclose=e=>{s.onopen=s.onclose=null,r(e)}}))}async _handshake(e=1e4){const t=this._websocket;if(null==t)return;const r=(0,a.hh)(),s=t.onmessage,{filter:i,outFields:c,spatialReference:l}=this._config;return r.timeout(e),t.onmessage=e=>{let a=null;try{a=JSON.parse(e.data)}catch(e){}a&&"object"==typeof a||(o.Z.getLogger(this).error(new n.Z("websocket-connection","Protocol violation. Handshake failed - malformed message",e.data)),r.reject(),this.destroy()),a.spatialReference?.wkid!==l?.wkid&&(o.Z.getLogger(this).error(new n.Z("websocket-connection",`Protocol violation. Handshake failed - expected wkid of ${l.wkid}`,e.data)),r.reject(),this.destroy()),"json"!==a.format&&(o.Z.getLogger(this).error(new n.Z("websocket-connection","Protocol violation. Handshake failed - format is not set",e.data)),r.reject(),this.destroy()),i&&a.filter!==i&&o.Z.getLogger(this).error(new n.Z("websocket-connection","Tried to set filter, but server doesn't support it")),c&&a.outFields!==c&&o.Z.getLogger(this).error(new n.Z("websocket-connection","Tried to set outFields, but server doesn't support it")),t.onmessage=s;for(const e of this._outstandingMessages)t.send(JSON.stringify(e));this._outstandingMessages=[],r.resolve()},t.send(JSON.stringify({filter:i,outFields:c,format:"json",spatialReference:{wkid:l.wkid}})),r.promise}_onMessage(e){if(this.onMessage(e),"type"in e)switch(e.type){case"features":case"featureResult":for(const t of e.features)null!=this._featureZScaler&&this._featureZScaler(t.geometry),this.onFeature(t)}}_onError(e){const t="Encountered an error over WebSocket connection";this._set("errorString",t),o.Z.getLogger(this).error("websocket-connection",t)}_onClose(e){this._websocket=null,this.notifyChange("connectionStatus"),1e3!==e.code&&o.Z.getLogger(this).error("websocket-connection",`WebSocket closed unexpectedly with error code ${e.code}`),this.destroyed||this._open()}};(0,s._)([(0,u.Cb)()],g.prototype,"connectionStatus",null),(0,s._)([(0,u.Cb)()],g.prototype,"errorString",void 0),g=(0,s._)([(0,l.j)("esri.layers.graphics.sources.connections.WebSocketConnection")],g);var m=r(34599),x=r(14165),b=r(33955),v=r(82971);const w={maxQueryDepth:5,maxRecordCountFactor:3};let S=class extends g{constructor(e){super({...w,...e}),this._buddyServicesQuery=null,this._relatedFeatures=null}async _open(){const e=await this._fetchServiceDefinition(this._config.source);e.timeInfo.trackIdField||o.Z.getLogger(this).warn("GeoEvent service was configured without a TrackIdField. This may result in certain functionality being disabled. The purgeOptions.maxObservations property will have no effect.");const t=this._fetchWebSocketUrl(e.streamUrls,this._config.spatialReference);this._buddyServicesQuery||(this._buddyServicesQuery=this._queryBuddyServices()),await this._buddyServicesQuery,await this._tryCreateWebSocket(t);const{filter:r,outFields:s}=this._config;this.destroyed||this._setFilter(r,s)}_onMessage(e){if("attributes"in e){let t;try{t=this._enrich(e),null!=this._featureZScaler&&this._featureZScaler(t.geometry)}catch(e){return void o.Z.getLogger(this).error(new n.Z("geoevent-connection","Failed to parse message",e))}this.onFeature(t)}else this.onMessage(e)}async _fetchServiceDefinition(e){const t={f:"json",...this._config.customParameters},r=(0,i.Z)(e.path,{query:t,responseType:"json"}),s=(await r).data;return this._serviceDefinition=s,s}_fetchWebSocketUrl(e,t){const r=e[0],{urls:s,token:i}=r,n=this._inferWebSocketBaseUrl(s);return(0,c.fl)(`${n}/subscribe`,{outSR:""+t.wkid,token:i})}_inferWebSocketBaseUrl(e){if(1===e.length)return e[0];for(const t of e)if(t.includes("wss"))return t;return o.Z.getLogger(this).error(new n.Z("geoevent-connection","Unable to infer WebSocket url",e)),null}async _setFilter(e,t){const r=this._websocket;if(null==r||null==e&&null==t)return;const s=JSON.stringify({filter:this._serializeFilter(e,t)});let i=!1;const c=(0,a.hh)();return r.onmessage=e=>{const t=JSON.parse(e.data);t.filter&&(t.error&&(o.Z.getLogger(this).error(new n.Z("geoevent-connection","Failed to set service filter",t.error)),this._set("errorString",`Could not set service filter - ${t.error}`),c.reject(t.error)),this._setWebSocketJSONParseHandler(r),i=!0,c.resolve())},r.send(s),setTimeout((()=>{i||(this.destroyed||this._websocket!==r||o.Z.getLogger(this).error(new n.Z("geoevent-connection","Server timed out when setting filter")),c.reject())}),1e4),c.promise}_serializeFilter(e,t){const r={};if(null==e&&null==t)return r;if(e?.geometry)try{const t=(0,b.im)(e.geometry);if("extent"!==t.type)throw new n.Z(`Expected extent but found type ${t.type}`);r.geometry=JSON.stringify(t.shiftCentralMeridian())}catch(e){o.Z.getLogger(this).error(new n.Z("geoevent-connection","Encountered an error when setting connection geometryDefinition",e))}return e?.where&&"1 = 1"!==e.where&&"1=1"!==e.where&&(r.where=e.where),null!=t&&(r.outFields=t.join(",")),r}_enrich(e){if(!this._relatedFeatures)return e;const t=this._serviceDefinition.relatedFeatures.joinField,r=e.attributes[t],s=this._relatedFeatures.get(r);if(!s)return o.Z.getLogger(this).warn("geoevent-connection","Feature join failed. Is the join field configured correctly?",e),e;const{attributes:i,geometry:a}=s;for(const t in i)e.attributes[t]=i[t];return a&&(e.geometry=a),e.geometry||e.centroid||o.Z.getLogger(this).error(new n.Z("geoevent-connection","Found malformed feature - no geometry found",e)),e}async _queryBuddyServices(){try{const{relatedFeatures:e,keepLatestArchive:t}=this._serviceDefinition,r=this._queryRelatedFeatures(e),s=this._queryArchive(t);await r;const i=await s;if(!i)return;for(const e of i.features)this.onFeature(this._enrich(e))}catch(e){o.Z.getLogger(this).error(new n.Z("geoevent-connection","Encountered an error when querying buddy services",{error:e}))}}async _queryRelatedFeatures(e){if(!e)return;const t=await this._queryBuddy(e.featuresUrl);this._addRelatedFeatures(t)}async _queryArchive(e){if(e)return this._queryBuddy(e.featuresUrl)}async _queryBuddy(e){const t=new((await Promise.all([r.e(163),r.e(1566),r.e(1773),r.e(9790),r.e(6621),r.e(1423),r.e(7407),r.e(1469),r.e(4723),r.e(9238),r.e(6277)]).then(r.bind(r,19238))).default)({url:e}),{capabilities:s}=await t.load(),i=s.query.supportsMaxRecordCountFactor,n=s.query.supportsPagination,o=s.query.supportsCentroid,a=this._config.maxRecordCountFactor,c=t.capabilities.query.maxRecordCount,l=i?c*a:c,u=new x.Z;if(u.outFields=this._config.outFields??["*"],u.where=this._config.filter?.where??"1=1",u.returnGeometry=!0,u.returnExceededLimitFeatures=!0,u.outSpatialReference=v.Z.fromJSON(this._config.spatialReference),o&&(u.returnCentroid=!0),i&&(u.maxRecordCountFactor=a),n)return u.num=l,t.destroy(),this._queryPages(e,u);const h=await(0,m.JT)(e,u,this._config.sourceSpatialReference);return t.destroy(),h.data}async _queryPages(e,t,r=[],s=0){t.start=null!=t.num?s*t.num:null;const{data:i}=await(0,m.JT)(e,t,this._config.sourceSpatialReference);return i.exceededTransferLimit&&s<(this._config.maxQueryDepth??0)?(i.features.forEach((e=>r.push(e))),this._queryPages(e,t,r,s+1)):(r.forEach((e=>i.features.push(e))),i)}_addRelatedFeatures(e){const t=new Map,r=e.features,s=this._serviceDefinition.relatedFeatures.joinField;for(const e of r){const r=e.attributes[s];t.set(r,e)}this._relatedFeatures=t}};S=(0,s._)([(0,l.j)("esri.layers.graphics.sources.connections.GeoEventConnection")],S);const I=S;let T=class extends _{constructor(e){super({}),this.connectionStatus="connected",this.errorString=null;const{geometryType:t,spatialReference:r,sourceSpatialReference:s}=e;this._featureZScaler=(0,h.k)(t,s,r)}normalizeCtorArgs(){return{}}updateCustomParameters(e){}sendMessageToSocket(e){}sendMessageToClient(e){if("type"in e)switch(e.type){case"features":case"featureResult":for(const t of e.features)null!=this._featureZScaler&&this._featureZScaler(t.geometry),this.onFeature(t)}this.onMessage(e)}};function E(e,t,r,s,i,n,o,a){const c={source:e,sourceSpatialReference:t,spatialReference:r,geometryType:s,filter:i,maxReconnectionAttempts:n,maxReconnectionInterval:o,customParameters:a};return e?e.path.startsWith("wss://")||e.path.startsWith("ws://")?new g(c):new I(c):new T(c)}(0,s._)([(0,u.Cb)()],T.prototype,"connectionStatus",void 0),(0,s._)([(0,u.Cb)()],T.prototype,"errorString",void 0),T=(0,s._)([(0,l.j)("esri.layers.support.ClientSideConnection")],T)},39450:(e,t,r)=>{r.d(t,{Z:()=>u});var s,i=r(43697),n=r(96674),o=r(5600),a=r(75215),c=(r(77734),r(80442),r(52011));let l=s=class extends n.wq{constructor(e){super(e),this.cols=null,this.level=0,this.levelValue=null,this.origin=null,this.resolution=0,this.rows=null,this.scale=0}clone(){return new s({cols:this.cols,level:this.level,levelValue:this.levelValue,resolution:this.resolution,rows:this.rows,scale:this.scale})}};(0,i._)([(0,o.Cb)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],l.prototype,"cols",void 0),(0,i._)([(0,o.Cb)({type:a.z8,json:{write:!0}})],l.prototype,"level",void 0),(0,i._)([(0,o.Cb)({type:String,json:{write:!0}})],l.prototype,"levelValue",void 0),(0,i._)([(0,o.Cb)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],l.prototype,"origin",void 0),(0,i._)([(0,o.Cb)({type:Number,json:{write:!0}})],l.prototype,"resolution",void 0),(0,i._)([(0,o.Cb)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],l.prototype,"rows",void 0),(0,i._)([(0,o.Cb)({type:Number,json:{write:!0}})],l.prototype,"scale",void 0),l=s=(0,i._)([(0,c.j)("esri.layers.support.LOD")],l);const u=l},11145:(e,t,r)=>{r.d(t,{Z:()=>I});var s,i=r(43697),n=r(35454),o=r(96674),a=r(67900),c=r(5600),l=r(75215),u=(r(77734),r(80442),r(71715)),h=r(52011),d=r(30556),p=r(94139),_=r(82971),f=r(24470),y=r(8744),g=r(40488),m=r(39450),x=r(43077);const b=new n.X({PNG:"png",PNG8:"png8",PNG24:"png24",PNG32:"png32",JPEG:"jpg",JPG:"jpg",DIB:"dib",TIFF:"tiff",EMF:"emf",PS:"ps",PDF:"pdf",GIF:"gif",SVG:"svg",SVGZ:"svgz",Mixed:"mixed",MIXED:"mixed",LERC:"lerc",LERC2D:"lerc2d",RAW:"raw",pbf:"pbf"});let v=s=class extends o.wq{static create(e={}){const{resolutionFactor:t=1,scales:r,size:i=256,spatialReference:n=_.Z.WebMercator,numLODs:o=24}=e;if(!(0,y.JY)(n)){const e=[];if(r)for(let t=0;t<r.length;t++){const s=r[t];e.push(new m.Z({level:t,scale:s,resolution:s}))}else{let t=5e-4;for(let r=o-1;r>=0;r--)e.unshift(new m.Z({level:r,scale:t,resolution:t})),t*=2}return new s({dpi:96,lods:e,origin:new p.Z(0,0,n),size:[i,i],spatialReference:n})}const c=(0,y.C5)(n),l=e.origin?new p.Z({x:e.origin.x,y:e.origin.y,spatialReference:n}):new p.Z(c?{x:c.origin[0],y:c.origin[1],spatialReference:n}:{x:0,y:0,spatialReference:n}),u=1/(39.37*(0,a.c9)(n)*96),h=[];if(r)for(let e=0;e<r.length;e++){const t=r[e],s=t*u;h.push(new m.Z({level:e,scale:t,resolution:s}))}else{let e=(0,y.sT)(n)?512/i*591657527.5917094:256/i*591657527.591555;const r=Math.ceil(o/t);h.push(new m.Z({level:0,scale:e,resolution:e*u}));for(let s=1;s<r;s++){const r=e/2**t,i=r*u;h.push(new m.Z({level:s,scale:r,resolution:i})),e=r}}return new s({dpi:96,lods:h,origin:l,size:[i,i],spatialReference:n})}constructor(e){super(e),this.dpi=96,this.format=null,this.origin=null,this.size=null,this.spatialReference=null}get isWrappable(){const{spatialReference:e,origin:t}=this;if(e&&t){const r=(0,y.C5)(e);return e.isWrappable&&!!r&&Math.abs(r.origin[0]-t.x)<=r.dx}return!1}readOrigin(e,t){return p.Z.fromJSON({spatialReference:t.spatialReference,...e})}set lods(e){let t=0,r=0;const s=[],i=this._levelToLOD={};e&&(t=-1/0,r=1/0,e.forEach((e=>{s.push(e.scale),t=e.scale>t?e.scale:t,r=e.scale<r?e.scale:r,i[e.level]=e}))),this._set("scales",s),this._set("lods",e),this._initializeUpsampleLevels()}readSize(e,t){return[t.cols,t.rows]}writeSize(e,t){t.cols=e[0],t.rows=e[1]}zoomToScale(e){const t=this.scales;if(e<=0)return t[0];if(e>=t.length-1)return t[t.length-1];const r=Math.floor(e),s=r+1;return t[r]/(t[r]/t[s])**(e-r)}scaleToZoom(e){const t=this.scales,r=t.length-1;let s=0;for(;s<r;s++){const r=t[s],i=t[s+1];if(r<=e)return s;if(i===e)return s+1;if(r>e&&i<e)return s+Math.log(r/e)/Math.log(r/i)}return s}snapScale(e,t=.95){const r=this.scaleToZoom(e);return r%Math.floor(r)>=t?this.zoomToScale(Math.ceil(r)):this.zoomToScale(Math.floor(r))}tileAt(e,t,r,s){const i=this.lodAt(e);if(!i)return null;let n,o;if("number"==typeof t)n=t,o=r;else if((0,y.fS)(t.spatialReference,this.spatialReference))n=t.x,o=t.y,s=r;else{const e=(0,g.iV)(t,this.spatialReference);if(null==e)return null;n=e.x,o=e.y,s=r}const a=i.resolution*this.size[0],c=i.resolution*this.size[1];return s||(s=new x.f(null,0,0,0,(0,f.Ue)())),s.level=e,s.row=Math.floor((this.origin.y-o)/c+.001),s.col=Math.floor((n-this.origin.x)/a+.001),this.updateTileInfo(s),s}updateTileInfo(e,t=s.ExtrapolateOptions.NONE){let r=this.lodAt(e.level);if(!r&&t===s.ExtrapolateOptions.POWER_OF_TWO){const t=this.lods[this.lods.length-1];t.level<e.level&&(r=t)}if(!r)return;const i=e.level-r.level,n=r.resolution*this.size[0]/2**i,o=r.resolution*this.size[1]/2**i;e.id=`${e.level}/${e.row}/${e.col}`,e.extent||(e.extent=(0,f.Ue)()),e.extent[0]=this.origin.x+e.col*n,e.extent[1]=this.origin.y-(e.row+1)*o,e.extent[2]=e.extent[0]+n,e.extent[3]=e.extent[1]+o}upsampleTile(e){const t=this._upsampleLevels[e.level];return!(!t||-1===t.parentLevel||(e.level=t.parentLevel,e.row=Math.floor(e.row/t.factor+.001),e.col=Math.floor(e.col/t.factor+.001),this.updateTileInfo(e),0))}getTileBounds(e,t){const r=this.lodAt(t.level);if(null==r)return null;const{resolution:s}=r,i=s*this.size[0],n=s*this.size[1];return e[0]=this.origin.x+t.col*i,e[1]=this.origin.y-(t.row+1)*n,e[2]=e[0]+i,e[3]=e[1]+n,e}lodAt(e){return this._levelToLOD?.[e]??null}clone(){return s.fromJSON(this.write({}))}getOrCreateCompatible(e,t){if(256===this.size[0]&&256===this.size[1])return 256===e?this:null;const r=[],i=this.lods.length;for(let e=0;e<i;e++){const s=this.lods[e],i=s.resolution*t;r.push(new m.Z({level:s.level,scale:s.scale,resolution:i}))}return new s({size:[e,e],dpi:this.dpi,format:this.format,compressionQuality:this.compressionQuality,origin:this.origin,spatialReference:this.spatialReference,lods:r})}_initializeUpsampleLevels(){const e=this.lods;this._upsampleLevels=[];let t=null;for(let r=0;r<e.length;r++){const s=e[r];this._upsampleLevels[s.level]={parentLevel:t?t.level:-1,factor:t?t.resolution/s.resolution:0},t=s}}};var w,S;(0,i._)([(0,c.Cb)({type:Number,json:{write:!0}})],v.prototype,"compressionQuality",void 0),(0,i._)([(0,c.Cb)({type:Number,json:{write:!0}})],v.prototype,"dpi",void 0),(0,i._)([(0,c.Cb)({type:String,json:{read:b.read,write:b.write,origins:{"web-scene":{read:!1,write:!1}}}})],v.prototype,"format",void 0),(0,i._)([(0,c.Cb)({readOnly:!0})],v.prototype,"isWrappable",null),(0,i._)([(0,c.Cb)({type:p.Z,json:{write:!0}})],v.prototype,"origin",void 0),(0,i._)([(0,u.r)("origin")],v.prototype,"readOrigin",null),(0,i._)([(0,c.Cb)({type:[m.Z],value:null,json:{write:!0}})],v.prototype,"lods",null),(0,i._)([(0,c.Cb)({readOnly:!0})],v.prototype,"scales",void 0),(0,i._)([(0,c.Cb)({cast:e=>Array.isArray(e)?e:"number"==typeof e?[e,e]:[256,256]})],v.prototype,"size",void 0),(0,i._)([(0,u.r)("size",["rows","cols"])],v.prototype,"readSize",null),(0,i._)([(0,d.c)("size",{cols:{type:l.z8},rows:{type:l.z8}})],v.prototype,"writeSize",null),(0,i._)([(0,c.Cb)({type:_.Z,json:{write:!0}})],v.prototype,"spatialReference",void 0),v=s=(0,i._)([(0,h.j)("esri.layers.support.TileInfo")],v),w=v||(v={}),(S=w.ExtrapolateOptions||(w.ExtrapolateOptions={}))[S.NONE=0]="NONE",S[S.POWER_OF_TWO=1]="POWER_OF_TWO";const I=v},43077:(e,t,r)=>{r.d(t,{f:()=>s});class s{constructor(e,t,r,s,i=void 0){this.id=e,this.level=t,this.row=r,this.col=s,this.extent=i}}},28694:(e,t,r)=>{r.d(t,{p:()=>i});var s=r(69285);function i(e,t,r){if(!r?.features||!r.hasZ)return;const i=(0,s.k)(r.geometryType,t,e.outSpatialReference);if(null!=i)for(const e of r.features)i(e.geometry)}},67327:(e,t,r)=>{r.d(t,{z:()=>_});var s=r(95648),i=r(16534);function n(e,t){return e.x===t.x&&e.y===t.y}function o(e){if(!e)return;const t=e.length;if(t<=1)return;let r=0;for(let s=1;s<t;s++)n(e[s],e[r])||++r===s||(e[r]=e[s]);e.length=r+1}function a(e,t){return e.x=t.y,e.y=-t.x,e}function c(e,t){return e.x=-t.y,e.y=t.x,e}function l(e,t){return e.x=t.x,e.y=t.y,e}function u(e,t){return e.x=-t.x,e.y=-t.y,e}function h(e){return Math.sqrt(e.x*e.x+e.y*e.y)}function d(e,t){return e.x*t.x+e.y*t.y}function p(e,t,r,s){return e.x=t.x*r+t.y*s,e.y=t.x*s-t.y*r,e}class _{constructor(e,t,r){this._writeVertex=e,this._writeTriangle=t,this._canUseThinTessellation=r,this._prevNormal={x:void 0,y:void 0},this._nextNormal={x:void 0,y:void 0},this._textureNormalLeft={x:0,y:1},this._textureNormalRight={x:0,y:-1},this._textureNormal={x:void 0,y:void 0},this._joinNormal={x:void 0,y:void 0},this._inner={x:void 0,y:void 0},this._outer={x:void 0,y:void 0},this._roundStart={x:void 0,y:void 0},this._roundEnd={x:void 0,y:void 0},this._startBreak={x:void 0,y:void 0},this._endBreak={x:void 0,y:void 0},this._innerPrev={x:void 0,y:void 0},this._innerNext={x:void 0,y:void 0},this._bevelStart={x:void 0,y:void 0},this._bevelEnd={x:void 0,y:void 0},this._bevelMiddle={x:void 0,y:void 0}}tessellate(e,t,r=this._canUseThinTessellation){o(e),r&&t.halfWidth<i.do&&!t.offset?this._tessellateThin(e,t):this._tessellate(e,t)}_tessellateThin(e,t){if(e.length<2)return;const r=t.wrapDistance||65535;let s=t.initialDistance||0,i=!1,n=e[0].x,o=e[0].y;const a=e.length;for(let t=1;t<a;++t){i&&(i=!1,s=0);let a=e[t].x,c=e[t].y,l=a-n,u=c-o,h=Math.sqrt(l*l+u*u);if(l/=h,u/=h,s+h>r){i=!0;const e=(r-s)/h;h=r-s,a=(1-e)*n+e*a,c=(1-e)*o+e*c,--t}const d=this._writeVertex(n,o,0,0,l,u,u,-l,0,-1,s),p=this._writeVertex(n,o,0,0,l,u,-u,l,0,1,s);s+=h;const _=this._writeVertex(a,c,0,0,l,u,u,-l,0,-1,s),f=this._writeVertex(a,c,0,0,l,u,-u,l,0,1,s);this._writeTriangle(d,p,_),this._writeTriangle(p,_,f),n=a,o=c}}_tessellate(e,t){const r=e[0],i=e[e.length-1],o=n(r,i),_=o?3:2;if(e.length<_)return;const f=t.pixelCoordRatio,y=null!=t.capType?t.capType:s.RL.BUTT,g=null!=t.joinType?t.joinType:s.AH.MITER,m=null!=t.miterLimit?Math.min(t.miterLimit,4):2,x=null!=t.roundLimit?Math.min(t.roundLimit,1.05):1.05,b=null!=t.halfWidth?t.halfWidth:2,v=!!t.textured;let w,S,I,T=null;const E=this._prevNormal,R=this._nextNormal;let A=-1,C=-1;const M=this._joinNormal;let F,N;const O=this._textureNormalLeft,P=this._textureNormalRight,k=this._textureNormal;let D=-1,B=-1;const L=t.wrapDistance||65535;let U=t.initialDistance||0;const z=this._writeVertex,G=this._writeTriangle,V=(e,t,r,s,i,n)=>{const o=z(S,I,F,N,r,s,e,t,i,n,U);return D>=0&&B>=0&&o>=0&&G(D,B,o),D=B,B=o,o};o&&(w=e[e.length-2],R.x=i.x-w.x,R.y=i.y-w.y,C=h(R),R.x/=C,R.y/=C);let Z=!1;for(let t=0;t<e.length;++t){if(Z&&(Z=!1,U=0),w&&(E.x=-R.x,E.y=-R.y,A=C,U+A>L&&(Z=!0)),Z){const r=(L-U)/A;A=L-U,w={x:(1-r)*w.x+r*e[t].x,y:(1-r)*w.y+r*e[t].y},--t}else w=e[t];S=w.x,I=w.y;const r=t<=0&&!Z,i=t===e.length-1;if(r||(U+=A),T=i?o?e[1]:null:e[t+1],T?(R.x=T.x-S,R.y=T.y-I,C=h(R),R.x/=C,R.y/=C):(R.x=void 0,R.y=void 0),!o){if(r){c(M,R),F=M.x,N=M.y,y===s.RL.SQUARE&&(V(-R.y-R.x,R.x-R.y,R.x,R.y,0,-1),V(R.y-R.x,-R.x-R.y,R.x,R.y,0,1)),y===s.RL.ROUND&&(V(-R.y-R.x,R.x-R.y,R.x,R.y,-1,-1),V(R.y-R.x,-R.x-R.y,R.x,R.y,-1,1)),y!==s.RL.ROUND&&y!==s.RL.BUTT||(V(-R.y,R.x,R.x,R.y,0,-1),V(R.y,-R.x,R.x,R.y,0,1));continue}if(i){a(M,E),F=M.x,N=M.y,y!==s.RL.ROUND&&y!==s.RL.BUTT||(V(E.y,-E.x,-E.x,-E.y,0,-1),V(-E.y,E.x,-E.x,-E.y,0,1)),y===s.RL.SQUARE&&(V(E.y-E.x,-E.x-E.y,-E.x,-E.y,0,-1),V(-E.y-E.x,E.x-E.y,-E.x,-E.y,0,1)),y===s.RL.ROUND&&(V(E.y-E.x,-E.x-E.y,-E.x,-E.y,1,-1),V(-E.y-E.x,E.x-E.y,-E.x,-E.y,1,1));continue}}let n,_,z=(W=R,-((H=E).x*W.y-H.y*W.x));if(Math.abs(z)<.01)d(E,R)>0?(M.x=E.x,M.y=E.y,z=1,n=Number.MAX_VALUE,_=!0):(c(M,R),z=1,n=1,_=!1);else{M.x=(E.x+R.x)/z,M.y=(E.y+R.y)/z,n=h(M);const e=(n-1)*b*f;_=n>4||e>A&&e>C}F=M.x,N=M.y;let G=g;switch(g){case s.AH.BEVEL:n<1.05&&(G=s.AH.MITER);break;case s.AH.ROUND:n<x&&(G=s.AH.MITER);break;case s.AH.MITER:n>m&&(G=s.AH.BEVEL)}switch(G){case s.AH.MITER:if(V(M.x,M.y,-E.x,-E.y,0,-1),V(-M.x,-M.y,-E.x,-E.y,0,1),i)break;if(v){const e=Z?0:U;D=this._writeVertex(S,I,F,N,R.x,R.y,M.x,M.y,0,-1,e),B=this._writeVertex(S,I,F,N,R.x,R.y,-M.x,-M.y,0,1,e)}break;case s.AH.BEVEL:{const e=z<0;let t,r,s,n;if(e){const e=D;D=B,B=e,t=O,r=P}else t=P,r=O;if(_)s=e?c(this._innerPrev,E):a(this._innerPrev,E),n=e?a(this._innerNext,R):c(this._innerNext,R);else{const t=e?u(this._inner,M):l(this._inner,M);s=t,n=t}const o=e?a(this._bevelStart,E):c(this._bevelStart,E);V(s.x,s.y,-E.x,-E.y,t.x,t.y);const h=V(o.x,o.y,-E.x,-E.y,r.x,r.y);if(i)break;const d=e?c(this._bevelEnd,R):a(this._bevelEnd,R);if(_){const e=this._writeVertex(S,I,F,N,-E.x,-E.y,0,0,0,0,U);D=this._writeVertex(S,I,F,N,R.x,R.y,n.x,n.y,t.x,t.y,U),B=this._writeVertex(S,I,F,N,R.x,R.y,d.x,d.y,r.x,r.y,U),this._writeTriangle(h,e,B)}else{if(v){const e=this._bevelMiddle;e.x=(o.x+d.x)/2,e.y=(o.y+d.y)/2,p(k,e,-E.x,-E.y),V(e.x,e.y,-E.x,-E.y,k.x,k.y),p(k,e,R.x,R.y),D=this._writeVertex(S,I,F,N,R.x,R.y,e.x,e.y,k.x,k.y,U),B=this._writeVertex(S,I,F,N,R.x,R.y,n.x,n.y,t.x,t.y,U)}else{const e=D;D=B,B=e}V(d.x,d.y,R.x,R.y,r.x,r.y)}if(e){const e=D;D=B,B=e}break}case s.AH.ROUND:{const e=z<0;let t,r;if(e){const e=D;D=B,B=e,t=O,r=P}else t=P,r=O;const s=e?u(this._inner,M):l(this._inner,M);let o,h;_?(o=e?c(this._innerPrev,E):a(this._innerPrev,E),h=e?a(this._innerNext,R):c(this._innerNext,R)):(o=s,h=s);const f=e?a(this._roundStart,E):c(this._roundStart,E),y=e?c(this._roundEnd,R):a(this._roundEnd,R),g=V(o.x,o.y,-E.x,-E.y,t.x,t.y),m=V(f.x,f.y,-E.x,-E.y,r.x,r.y);if(i)break;const x=this._writeVertex(S,I,F,N,-E.x,-E.y,0,0,0,0,U);_||this._writeTriangle(D,B,x);const b=u(this._outer,s),w=this._writeVertex(S,I,F,N,R.x,R.y,y.x,y.y,r.x,r.y,U);let T,A;const C=n>2;if(C){let t;n!==Number.MAX_VALUE?(b.x/=n,b.y/=n,t=d(E,b),t=(n*(t*t-1)+1)/t):t=-1,T=e?a(this._startBreak,E):c(this._startBreak,E),T.x+=E.x*t,T.y+=E.y*t,A=e?c(this._endBreak,R):a(this._endBreak,R),A.x+=R.x*t,A.y+=R.y*t}p(k,b,-E.x,-E.y);const L=this._writeVertex(S,I,F,N,-E.x,-E.y,b.x,b.y,k.x,k.y,U);p(k,b,R.x,R.y);const G=v?this._writeVertex(S,I,F,N,R.x,R.y,b.x,b.y,k.x,k.y,U):L,Z=x,H=v?this._writeVertex(S,I,F,N,R.x,R.y,0,0,0,0,U):x;let W=-1,j=-1;if(C&&(p(k,T,-E.x,-E.y),W=this._writeVertex(S,I,F,N,-E.x,-E.y,T.x,T.y,k.x,k.y,U),p(k,A,R.x,R.y),j=this._writeVertex(S,I,F,N,R.x,R.y,A.x,A.y,k.x,k.y,U)),v?C?(this._writeTriangle(Z,m,W),this._writeTriangle(Z,W,L),this._writeTriangle(H,G,j),this._writeTriangle(H,j,w)):(this._writeTriangle(Z,m,L),this._writeTriangle(H,G,w)):C?(this._writeTriangle(x,m,W),this._writeTriangle(x,W,j),this._writeTriangle(x,j,w)):(this._writeTriangle(x,m,L),this._writeTriangle(x,G,w)),_?(D=this._writeVertex(S,I,F,N,R.x,R.y,h.x,h.y,t.x,t.y,U),B=w):(D=v?this._writeVertex(S,I,F,N,R.x,R.y,h.x,h.y,t.x,t.y,U):g,this._writeTriangle(D,H,w),B=w),e){const e=D;D=B,B=e}break}}}var H,W}}},94278:(e,t,r)=>{r.r(t),r.d(t,{default:()=>iu});var s=r(43697),i=r(50758),n=r(80442),o=r(95330),a=r(77734),c=r(17445),l=r(5600),u=r(92604),h=(r(97831),r(44550),r(20941),r(20102)),d=r(11145),p=r(8744),_=r(55415);function f(e,t){return[e,t]}function y(e,t,r){return e[0]=t,e[1]=r,e}const g=new _.Z("0/0/0/0");class m{static create(e,t,r=null){const s=(0,p.C5)(e.spatialReference),i=t.origin||f(e.origin.x,e.origin.y),n=f(e.size[0]*t.resolution,e.size[1]*t.resolution),o=f(-1/0,-1/0),a=f(1/0,1/0),c=f(1/0,1/0);null!=r&&(y(o,Math.max(0,Math.floor((r.xmin-i[0])/n[0])),Math.max(0,Math.floor((i[1]-r.ymax)/n[1]))),y(a,Math.max(0,Math.floor((r.xmax-i[0])/n[0])),Math.max(0,Math.floor((i[1]-r.ymin)/n[1]))),y(c,a[0]-o[0]+1,a[1]-o[1]+1));const{cols:l,rows:u}=t;let h,d,_,g;return!r&&l&&u&&(y(o,l[0],u[0]),y(a,l[1],u[1]),y(c,l[1]-l[0]+1,u[1]-u[0]+1)),e.isWrappable?(h=f(Math.ceil(Math.round((s.valid[1]-s.valid[0])/t.resolution)/e.size[0]),c[1]),d=f(Math.floor((s.origin[0]-i[0])/n[0]),o[1]),_=f(h[0]+d[0]-1,a[1]),g=!0):(d=o,_=a,h=c,g=!1),new m(t.level,t.resolution,t.scale,i,o,a,c,n,d,_,h,g)}constructor(e,t,r,s,i,n,o,a,c,l,u,h){this.level=e,this.resolution=t,this.scale=r,this.origin=s,this.first=i,this.last=n,this.size=o,this.norm=a,this.worldStart=c,this.worldEnd=l,this.worldSize=u,this.wrap=h}normalizeCol(e){if(!this.wrap)return e;const t=this.worldSize[0];return e<0?t-1-Math.abs((e+1)%t):e%t}denormalizeCol(e,t){return this.wrap?this.worldSize[0]*t+e:e}getWorldForColumn(e){return this.wrap?Math.floor(e/this.worldSize[0]):0}getFirstColumnForWorld(e){return e*this.worldSize[0]+this.first[0]}getLastColumnForWorld(e){return e*this.worldSize[0]+this.first[0]+this.size[0]-1}getColumnForX(e){return(e-this.origin[0])/this.norm[0]}getXForColumn(e){return this.origin[0]+e*this.norm[0]}getRowForY(e){return(this.origin[1]-e)/this.norm[1]}getYForRow(e){return this.origin[1]-e*this.norm[1]}getTileBounds(e,t,r=!1){g.set(t);const s=r?g.col:this.denormalizeCol(g.col,g.world),i=g.row;return function(e,t,r,s,i){e[0]=t,e[1]=r,e[2]=s,e[3]=i}(e,this.getXForColumn(s),this.getYForRow(i+1),this.getXForColumn(s+1),this.getYForRow(i)),e}getTileCoords(e,t,r=!1){g.set(t);const s=r?g.col:this.denormalizeCol(g.col,g.world);return Array.isArray(e)?y(e,this.getXForColumn(s),this.getYForRow(g.row)):(e.x=this.getXForColumn(s),e.y=this.getYForRow(g.row)),e}}var x=r(71143);class b{constructor(){this.spans=[]}acquire(e){this.lodInfo=e}release(){this.lodInfo=null,this.spans.length=0}*keys(){const e=this.lodInfo;for(const{row:t,colFrom:r,colTo:s}of this.spans)for(let i=r;i<=s;i++){const r=e.getWorldForColumn(i);yield new _.Z(e.level,t,e.normalizeCol(i),r)}}forEach(e,t){const{spans:r,lodInfo:s}=this,{level:i}=s;if(0!==r.length)for(const{row:n,colFrom:o,colTo:a}of r)for(let r=o;r<=a;r++)e.call(t,i,n,s.normalizeCol(r),s.getWorldForColumn(r))}}b.pool=new x.Z(b);class v{constructor(e,t,r){this.row=e,this.colFrom=t,this.colTo=r}}const w=new _.Z("0/0/0/0");class S{static create(e,t){e[1]>t[1]&&([e,t]=[t,e]);const[r,s]=e,[i,n]=t,o=i-r,a=n-s,c=0!==a?o/a:0,l=(Math.ceil(s)-s)*c,u=(Math.floor(s)-s)*c;return new S(r,Math.floor(s),Math.ceil(n),c,o<0?l:u,o<0?u:l,o<0?i:r,o<0?r:i)}constructor(e,t,r,s,i,n,o,a){this.x=e,this.ymin=t,this.ymax=r,this.invM=s,this.leftAdjust=i,this.rightAdjust=n,this.leftBound=o,this.rightBound=a}incrRow(){this.x+=this.invM}getLeftCol(){return Math.max(this.x+this.leftAdjust,this.leftBound)}getRightCol(){return Math.min(this.x+this.rightAdjust,this.rightBound)}}const I=[[0,0],[0,0],[0,0],[0,0]];class T{constructor(e,t=null,r=e.lods[0].level,s=e.lods[e.lods.length-1].level){this.tileInfo=e,this.fullExtent=t,this.scales=[],this._infoByScale={},this._infoByLevel={};const i=e.lods.filter((e=>e.level>=r&&e.level<=s));this.minScale=i[0].scale,this.maxScale=i[i.length-1].scale;const n=this._lodInfos=i.map((r=>m.create(e,r,t)));i.forEach(((e,t)=>{this._infoByLevel[e.level]=n[t],this._infoByScale[e.scale]=n[t],this.scales[t]=e.scale}),this),this._wrap=e.isWrappable}get spatialReference(){return this.tileInfo.spatialReference}getLODInfoAt(e){return this._infoByLevel["number"==typeof e?e:e.level]}getTileBounds(e,t,r=!1){w.set(t);const s=this._infoByLevel[w.level];return s?s.getTileBounds(e,w,r):e}getTileCoords(e,t,r=!1){w.set(t);const s=this._infoByLevel[w.level];return s?s.getTileCoords(e,w,r):e}getTileCoverage(e,t=192,r=!0,s="closest"){if(!r&&(e.scale>this.minScale||e.scale<this.maxScale))return null;const i="closest"===s?this.getClosestInfoForScale(e.scale):this.getSmallestInfoForScale(e.scale),n=b.pool.acquire(i),o=this._wrap;let a,c,l,u=1/0,h=-1/0;const d=n.spans;I[0][0]=I[0][1]=I[1][1]=I[3][0]=-t,I[1][0]=I[2][0]=e.size[0]+t,I[2][1]=I[3][1]=e.size[1]+t;for(const t of I)e.toMap(t,t),t[0]=i.getColumnForX(t[0]),t[1]=i.getRowForY(t[1]);const p=[];let _=3;for(let e=0;e<4;e++){if(I[e][1]===I[_][1]){_=e;continue}const t=S.create(I[e],I[_]);u=Math.min(t.ymin,u),h=Math.max(t.ymax,h),void 0===p[t.ymin]&&(p[t.ymin]=[]),p[t.ymin].push(t),_=e}if(null==u||null==h||h-u>100)return null;let f=[];for(a=u;a<h;){null!=p[a]&&(f=f.concat(p[a])),c=1/0,l=-1/0;for(let e=f.length-1;e>=0;e--){const t=f[e];c=Math.min(c,t.getLeftCol()),l=Math.max(l,t.getRightCol())}if(c=Math.floor(c),l=Math.floor(l),a>=i.first[1]&&a<=i.last[1])if(o)if(i.size[0]<i.worldSize[0]){const e=Math.floor(l/i.worldSize[0]);for(let t=Math.floor(c/i.worldSize[0]);t<=e;t++)d.push(new v(a,Math.max(i.getFirstColumnForWorld(t),c),Math.min(i.getLastColumnForWorld(t),l)))}else d.push(new v(a,c,l));else c>i.last[0]||l<i.first[0]||(c=Math.max(c,i.first[0]),l=Math.min(l,i.last[0]),d.push(new v(a,c,l)));a+=1;for(let e=f.length-1;e>=0;e--){const t=f[e];t.ymax>=a?t.incrRow():f.splice(e,1)}}return n}getTileParentId(e){w.set(e);const t=this._infoByLevel[w.level],r=this._lodInfos.indexOf(t)-1;return r<0?null:(this._getTileIdAtLOD(w,this._lodInfos[r],w),w.id)}getTileResolution(e){const t=this._infoByLevel["object"==typeof e?e.level:e];return t?t.resolution:-1}getTileScale(e){const t=this._infoByLevel[e.level];return t?t.scale:-1}intersects(e,t){w.set(t);const r=this._infoByLevel[w.level],s=e.lodInfo;if(s.resolution>r.resolution){this._getTileIdAtLOD(w,s,w);const t=s.denormalizeCol(w.col,w.world);for(const r of e.spans)if(r.row===w.row&&r.colFrom<=t&&r.colTo>=t)return!0}if(s.resolution<r.resolution){const[t,i,n,o]=e.spans.reduce(((e,t)=>(e[0]=Math.min(e[0],t.row),e[1]=Math.max(e[1],t.row),e[2]=Math.min(e[2],t.colFrom),e[3]=Math.max(e[3],t.colTo),e)),[1/0,-1/0,1/0,-1/0]),a=r.denormalizeCol(w.col,w.world),c=s.getColumnForX(r.getXForColumn(a)),l=s.getRowForY(r.getYForRow(w.row)),u=s.getColumnForX(r.getXForColumn(a+1))-1,h=s.getRowForY(r.getYForRow(w.row+1))-1;return!(c>o||u<n||l>i||h<t)}const i=s.denormalizeCol(w.col,w.world);return e.spans.some((e=>e.row===w.row&&e.colFrom<=i&&e.colTo>=i))}normalizeBounds(e,t,r){if(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],this._wrap){const t=(0,p.C5)(this.tileInfo.spatialReference),s=-r*(t.valid[1]-t.valid[0]);e[0]+=s,e[2]+=s}return e}getSmallestInfoForScale(e){const t=this.scales;if(this._infoByScale[e])return this._infoByScale[e];if(e>t[0])return this._infoByScale[t[0]];for(let r=1;r<t.length-1;r++)if(e>t[r]+1e-6)return this._infoByScale[t[r-1]];return this._infoByScale[t[t.length-1]]}getClosestInfoForScale(e){const t=this.scales;return this._infoByScale[e]||(e=t.reduce(((t,r)=>Math.abs(r-e)<Math.abs(t-e)?r:t),t[0])),this._infoByScale[e]}scaleToLevel(e){const t=this.scales;if(this._infoByScale[e])return this._infoByScale[e].level;for(let r=t.length-1;r>=0;r--)if(e<t[r])return r===t.length-1?this._infoByScale[t[t.length-1]].level:this._infoByScale[t[r]].level+(t[r]-e)/(t[r]-t[r+1]);return this._infoByScale[t[0]].level}scaleToZoom(e){return this.tileInfo.scaleToZoom(e)}_getTileIdAtLOD(e,t,r){const s=this._infoByLevel[r.level];return e.set(r),t.resolution<s.resolution?null:(t.resolution===s.resolution||(e.level=t.level,e.col=Math.floor(r.col*s.resolution/t.resolution+.01),e.row=Math.floor(r.row*s.resolution/t.resolution+.01)),e)}}var E=r(92036),R=r(70586),A=r(52011),C=r(23727),M=r(79384);const F=new Set,N=[],O=new Map,P=[0,0];let k=class extends E.Z{constructor(e){super(e),this._keyToItem=new Map,this.concurrency=6,this.strategy="scale-first",this.tileInfoView=null}initialize(){const{concurrency:e,process:t,strategy:r}=this;this._queue=new M.e({concurrency:e,process:(e,r)=>{const s=this._keyToItem.get(e);return t(s,{signal:r})},peeker:"scale-first"===r?e=>this._peekByScaleFirst(e):e=>this._peekByCenterFirst(e)})}destroy(){this.clear(),this._queue=(0,R.SC)(this._queue)}get length(){return this._queue?this._queue.length:0}get onGoingCount(){return this._keyToItem.size}abort(e){const t="string"==typeof e?e:e.id;this._queue.abort(t)}clear(){this._queue.clear(),this._keyToItem.clear()}has(e){return"string"==typeof e?this._keyToItem.has(e):this._keyToItem.has(e.id)}isOngoing(e){const t="string"==typeof e?e:e.id;return this.has(t)&&this._queue.isOngoing(t)}pause(){this._queue.pause()}push(e){const t=e.key.id;if(this._queue.has(t))return this._queue.get(t);const r=this._queue.push(t),s=()=>{this._keyToItem.delete(t)};return this._keyToItem.set(t,e),r.then(s,s),r}reset(){this._queue.reset()}resume(){this._queue.resume()}_peekByScaleFirst(e){if(!this.state)return e.values().next().value;const t=this.tileInfoView;let r=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY;e.forEach((e=>{const t=this._keyToItem.get(e),i=this.tileInfoView.getTileScale(t.key);O.has(i)||(O.set(i,[]),r=Math.max(i,r),s=Math.min(i,s)),O.get(i).push(t.key),F.add(i)}));let i=this.state.scale;O.has(i)||(function(e,t){e.length=0,t.forEach((t=>e.push(t)))}(N,F),N.sort(((e,t)=>e-t)),i=N.reduce(((e,t)=>Math.abs(t-i)<Math.abs(e-i)?t:e),N[0])),i=Math.min(i,r),i=Math.max(i,s);const n=O.get(i),o=t.getClosestInfoForScale(i),a=o.getColumnForX(this.state.center[0]),c=o.getRowForY(this.state.center[1]);return n.sort(((e,t)=>{const r=o.denormalizeCol(e.col,e.world),s=o.denormalizeCol(t.col,t.world);return Math.sqrt((a-r)*(a-r)+(c-e.row)*(c-e.row))-Math.sqrt((a-s)*(a-s)+(c-t.row)*(c-t.row))})),F.clear(),O.clear(),n[0].id}_peekByCenterFirst(e){if(!this.state)return e.values().next().value;const t=this.tileInfoView,r=this.state.center;let s,i=Number.POSITIVE_INFINITY;return e.forEach((e=>{const n=this._keyToItem.get(e);t.getTileCoords(P,n.key);const o=(0,C.TE)(P,r);o<i&&(i=o,s=n.key)})),s.id}};(0,s._)([(0,l.Cb)({constructOnly:!0})],k.prototype,"concurrency",void 0),(0,s._)([(0,l.Cb)({constructOnly:!0})],k.prototype,"process",void 0),(0,s._)([(0,l.Cb)()],k.prototype,"state",void 0),(0,s._)([(0,l.Cb)({constructOnly:!0})],k.prototype,"strategy",void 0),(0,s._)([(0,l.Cb)({constructOnly:!0})],k.prototype,"tileInfoView",void 0),k=(0,s._)([(0,A.j)("esri.views.2d.tiling.TileQueue")],k);var D=r(24470);new _.Z(0,0,0,0),new Map;class B{constructor(e){this._client=e,this.layerView=this._client.createInvokeProxy(),this.container=this._client.createInvokeProxy("container"),this.attributeView=this._client.createInvokeProxy("container.attributeView"),this.eventLog=this._client.createInvokeProxy("eventLog")}}var L=r(22862),U=r(82971),z=r(99514),G=r(16534);class V{constructor(e,t,r,s,i,n,o){this.instanceId=e,this.textureKey=t,this.indexStart=r,this.indexCount=s,this.vertexStart=i,this.vertexCount=n,this.overlaps=o}updateBaseOffsets(e){this.vertexStart+=e.vertexFrom,this.indexStart+=e.indexFrom}clone(){return new V(this.instanceId,this.textureKey,this.indexStart,this.indexCount,this.vertexStart,this.vertexCount,this.overlaps)}static write(e,t,r,s,i,n,o,a){e.push(t),e.push(r),e.push(s),e.push(i),e.push(n),e.push(o),e.push(a)}serialize(e){return e.push(this.instanceId),e.push(this.textureKey),e.push(this.indexStart),e.push(this.indexCount),e.push(this.vertexStart),e.push(this.vertexCount),e.push(this.overlaps),e}static deserialize(e){const t=e.readInt32(),r=e.readInt32(),s=e.readInt32(),i=e.readInt32(),n=e.readInt32(),o=e.readInt32(),a=e.readInt32();return new V(t,r,s,i,n,o,a)}}function Z(e,t){if(null!==t){e.push(t.length);for(const r of t)r.serialize(e);return e}e.push(0)}function H(e,t,r){const s=e.readInt32(),i=new Array(s);for(let s=0;s<i.length;s++)i[s]=t.deserialize(e,r);return i}V.byteSizeHint=7*Uint32Array.BYTES_PER_ELEMENT;class W{constructor(e,t){this.id=e,this.sortKey=t,this.records=[]}serialize(e){return e.push(this.id),e.push(this.sortKey),Z(e,this.records),e}static deserialize(e){const t=e.readInt32(),r=e.readInt32(),s=new W(t,r);return s.records=H(e,V)??[],s}}W.byteSizeHint=2*Uint32Array.BYTES_PER_ELEMENT+V.byteSizeHint;class j{get length(){return this._pos}constructor(e,t){this._pos=0;const r=t?this._roundToNearest(t,e.BYTES_PER_ELEMENT):40;this._array=new ArrayBuffer(r),this._buffer=new e(this._array),this._ctor=e,this._i16View=new Int16Array(this._array)}_roundToNearest(e,t){const r=Math.round(e);return 1===t?r:r+(t-r%t)}_ensureSize(e){if(this._pos+e>=this._buffer.length){const t=this._roundToNearest(1.25*(this._array.byteLength+e*this._buffer.BYTES_PER_ELEMENT),this._buffer.BYTES_PER_ELEMENT),r=new ArrayBuffer(t),s=new this._ctor(r);s.set(this._buffer,0),this._array=r,this._buffer=s,this._i16View=new Int16Array(this._array)}}ensureSize(e){this._ensureSize(e)}writeF32(e){this._ensureSize(1);const t=this._pos;return new Float32Array(this._array,4*this._pos,1)[0]=e,this._pos++,t}push(e){this._ensureSize(1);const t=this._pos;return this._buffer[this._pos++]=e,t}writeFixed(e){this._buffer[this._pos++]=e}setValue(e,t){this._buffer[e]=t}i1616Add(e,t,r){this._i16View[2*e]+=t,this._i16View[2*e+1]+=r}getValue(e){return this._buffer[e]}incr(e){if(this._buffer.length<e)throw new Error("Increment index overflows the target buffer");this._buffer[e]++}decr(e){this._buffer[e]--}writeRegion(e){this._ensureSize(e.length);const t=this._pos;return this._buffer.set(e,this._pos),this._pos+=e.length,t}writeManyFrom(e,t,r){this._ensureSize(r-t);for(let s=t;s!==r;s++)this.writeFixed(e._buffer[s])}buffer(){const e=this._array.slice(0,4*this._pos);return this.destroy(),e}toArray(){return[...this._buffer]}seek(e){this._pos=e}destroy(){this._array=null,this._buffer=null}}class Y{constructor(e,t,r,s=0){const i=6*s*Uint32Array.BYTES_PER_ELEMENT,n=4*s*r,o=r/4,a=t.attributes.find((e=>"pos"===e.name||"position"===e.name));if(!a)throw new Error("InternalError: Unable to find position attribute");this.layout={...t,position:a},this._indices=new j(Uint32Array,i),this._vertices=new j(Uint32Array,n),this._metrics=new j(Uint32Array,0),this._metricCountOffset=this._metrics.push(0),this._strideInt=o,this._instanceId=e}serialize(e){const t=this._indices.buffer(),r=this._vertices.buffer(),s=this._metrics.length?this._metrics.buffer():null;return e.push(t,r),{instanceId:this._instanceId,layout:this.layout,indices:t,vertices:r,metrics:s}}get strideInt(){return this._strideInt}get vertexCount(){return this._vertices.length/this._strideInt}get indexCount(){return this._indices.length}get indexWriter(){return this._indices}get vertexWriter(){return this._vertices}get metricWriter(){return this._metrics}vertexEnsureSize(e){this._vertices.ensureSize(e)}indexEnsureSize(e){this._indices.ensureSize(e)}writeIndex(e){this._indices.push(e)}writeVertex(e){this._vertices.push(e)}writeVertexRegion(e){this._vertices.writeRegion(e)}writeVertexF32(e){this._vertices.writeF32(e)}writeMetric(e){this._metrics.incr(this._metricCountOffset),e.serialize(this._metrics)}}class q{constructor(e,t=0){this._id=e,this._sizeHint=t,this._entityRecordCountOffset=0,this._entityCountOffset=0,this._entityIdIndex=0,this._entitySortKeyIndex=0,this._instanceIdToVertexData=new Map,this._current={metric:null,writer:null,start:0,sortKey:0,instanceId:0,layoutHash:0,indexStart:0,vertexStart:0,textureKey:0,metricBoxLenPointer:0},this._entities=new j(Uint32Array,this._sizeHint*W.byteSizeHint),this._entityCountOffset=this._entities.push(0)}get id(){return this._id}serialize(){const e=new Array,t=[],r=this._entities.buffer();for(const r of this._instanceIdToVertexData.values())t.push(r.serialize(e));return{message:{data:t,entities:r},transferList:e}}vertexCount(){return this._current.writer?.vertexCount??0}indexCount(){return this._current.writer?.indexCount??0}vertexEnsureSize(e){this._current.writer.vertexEnsureSize(e)}indexEnsureSize(e){this._current.writer.indexEnsureSize(e)}vertexWrite(e){this._current.writer.writeVertex(e)}vertexWriteRegion(e){this._current.writer.writeVertexRegion(e)}vertexWriteF32(e){this._current.writer.writeVertexF32(e)}recordBounds(e,t,r,s){}indexWrite(e){this._current.writer.writeIndex(e)}metricStart(e){this._current.metric=e}metricEnd(){const e=this._current.writer;this._current.metric.bounds.length&&e.writeMetric(this._current.metric)}metricBoxWrite(e){this._current.metric.bounds.push(e)}entityStart(e,t=e){this._entityIdIndex=this._entities.push(e),this._entitySortKeyIndex=this._entities.push(t),this._entityRecordCountOffset=this._entities.push(0)}entityEnd(){0===this._entities.getValue(this._entityRecordCountOffset)?this._entities.seek(this._entityIdIndex):this._entities.incr(this._entityCountOffset)}recordCount(){return this._entities.getValue(this._entityRecordCountOffset)}recordStart(e,t,r=0){this._current.writer=this._getVertexWriter(e,t),this._current.indexStart=this._current.writer.indexCount,this._current.vertexStart=this._current.writer.vertexCount,this._current.instanceId=e,this._current.layoutHash=t.hash,this._current.textureKey=r}recordEnd(e=0){const t=this._current.vertexStart,r=this._current.writer.vertexCount-t;if(!r)return!1;const s=this._current.indexStart,i=this._current.writer.indexCount-s;return this._entities.incr(this._entityRecordCountOffset),V.write(this._entities,this._current.instanceId,this._current.textureKey,s,i,t,r,e),!0}copyLastFrom(e,t,r){const s=e._entities.getValue(e._entityIdIndex);if(s!==this._entities.getValue(this._entityIdIndex)){const t=e._entities.getValue(e._entitySortKeyIndex);this.entityStart(s,t)}this.recordStart(e._current.instanceId,e._current.writer.layout,e._current.textureKey);const i=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,n=this._current.vertexStart,o=e._current.vertexStart-n,a=this._current.writer.indexWriter,c=this._current.writer.vertexWriter,l=e._current.writer.indexWriter,u=e._current.writer.vertexWriter;for(let t=e._current.indexStart;t!==l.length;t++){const e=l.getValue(t);a.push(e-o)}for(let t=e._current.vertexStart*i;t!==u.length;t++){const e=u.getValue(t);c.push(e)}const h=this._current.writer.layout.position,d=h.packPrecisionFactor??1,p=h.offset/Uint32Array.BYTES_PER_ELEMENT,_=t*d,f=r*d;for(let e=n*i;e<=c.length;e+=i)c.i1616Add(e+p,_,f);this.recordEnd()}_getVertexWriter(e,t){const{stride:r}=t,s=this._instanceIdToVertexData;return s.has(e)||s.set(e,new Y(e,t,r,this._sizeHint)),s.get(e)}}function $(e){switch(e){case 1:case 8:case 32:return-1;case 2:case 64:return 0;case 4:case 16:case 128:return 1}}function X(e){switch(e){case 1:case 2:case 4:return-1;case 8:case 16:return 0;case 32:case 64:case 128:return 1}}class K{constructor(e,t,r=0){this.tileKey=e,this._bufferingEnabled=t,this._sizeHint=r,this._meshes={self:new q(this.id,this._sizeHint),neighbors:new Array},this._currentRecordOverlaps=0,this._currentEntityOverlaps=0}get id(){return this.tileKey}vertexCount(){return this._meshes.self.vertexCount()}indexCount(){return this._meshes.self.indexCount()}indexEnsureSize(e){this._meshes.self.indexEnsureSize(e)}entityStart(e,t=e){this._currentEntityOverlaps=0,this._meshes.self.entityStart(e,t)}entityEnd(){if(this._meshes.self.entityEnd(),this._bufferingEnabled)for(let e=0;e<8;e++){const t=1<<e;this._currentEntityOverlaps&t&&this._meshes.neighbors[e].entityEnd()}}recordStart(e,t,r){this._currentRecordOverlaps=0,this._meshes.self.recordStart(e,t,r)}recordEnd(e=0){const t=this._meshes.self.recordEnd(this._currentRecordOverlaps);return t&&0!==this._currentRecordOverlaps?(this._copyIntoNeighbors(),this._currentEntityOverlaps|=this._currentRecordOverlaps,!0):t}recordBounds(e,t,r,s){this._bufferingEnabled&&this._addOverlap(e,t,r,s)}recordCount(){return this._meshes.self.recordCount()}metricStart(e){this._meshes.self.metricStart(e)}metricBoxWrite(e){this._meshes.self.metricBoxWrite(e)}metricEnd(){this._meshes.self.metricEnd()}vertexWrite(e){this._meshes.self.vertexWrite(e)}vertexWriteF32(e){this._meshes.self.vertexWriteF32(e)}vertexWriteRegion(e){this._meshes.self.vertexWriteRegion(e)}indexWrite(e){this._meshes.self.indexWrite(e)}serialize(e){const t={message:[],transferList:[]},r=this._meshes.self.serialize();return t.message.push({tileId:this.tileKey,...r.message}),t.transferList.push(...r.transferList),this._meshes.neighbors.forEach(((r,s)=>{const i=r.serialize(),n=1<<s,o=$(n),a=X(n),c=function(e,t,r,s){const i=e.clone(),n=1<<i.level,o=i.col+t,a=i.row+r;return s&&o<0?(i.col=o+n,i.world-=1):o>=n?(i.col=o-n,i.world+=1):i.col=o,i.row=a,i}(new _.Z(this.tileKey),o,a,e);t.message.push({tileId:c.id,...i.message}),t.transferList.push(...i.transferList)})),t}_addOverlap(e,t,r,s){const i=255^((e<0+r?148:e>=G.i9-r?41:189)|(t<0+s?224:t>=G.i9-s?7:231));this._currentRecordOverlaps|=i}_copyIntoNeighbors(){for(let e=0;e<8;e++){const t=1<<e;if(this._currentRecordOverlaps&t){if(!this._meshes.neighbors[e]){const r=Math.floor(this._sizeHint/16);this._meshes.neighbors[e]=new q(t,r)}const r=this._meshes.neighbors[e],s=-$(t)*G.i9,i=-X(t)*G.i9;r.copyLastFrom(this._meshes.self,s,i)}}}}class Q{}var J=r(67676),ee=r(22974),te=r(19153);const re=53290320,se=10;function ie(e,t,r,s,i,n,o){if(e.primitiveName===t)for(const t in e)if(t===r){let r=s?.readWithDefault(i,n,e[t]&&o);return"text"===e.type&&(r=r.toString()),void(e[t]=r)}if("type"in e&&null!=e.type)switch(e.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(e.symbolLayers)for(const a of e.symbolLayers)ie(a,t,r,s,i,n,o);break;case"CIMHatchFill":e.lineSymbol&&ie(e.lineSymbol,t,r,s,i,n,o);break;case"CIMSolidStroke":case"CIMSolidFill":case"CIMVectorMarker":if("CIMVectorMarker"===e.type&&e.markerGraphics)for(const a of e.markerGraphics)ie(a,t,r,s,i,n,o),ie(a.symbol,t,r,s,i,n,o)}}class ne{destroy(){}}class oe extends ne{constructor(e){super(),this._value=e}resize(e){}read(e,t){return this._value}readWithDefault(e,t,r){return this._value}referencesScale(){return!1}referencesGeometry(){return!1}}async function ae(e,t){const{defaultValue:r,valueExpressionInfo:s,value:i}=t;if(s){const{expression:i}=s,n=await e.createComputedField({expression:i});return n?{...t,computed:n,defaultValue:r}:null}return{...t,computed:new oe(i),defaultValue:r}}async function ce(e,t){const{defaultValue:r,valueExpressionInfo:s}=t,{expression:i}=s,n=await e.createComputedField({expression:i});return n?{...t,computed:n,defaultValue:r}:null}class le{static async create(e,t,r){const s={},i=new Map,n=new Map,o=new Map,a=new Map,c=new Map;for(const l in r.params){const u=r.params[l];if(null!=u&&"object"==typeof u)if(Array.isArray(u)){if("object"==typeof u[0])throw new Error(`InternalError: Cannot handle ${l}. Nested array params are not supported`);s[l]=u}else if("valueExpressionInfo"in u){if(u.value){s[l]=u.value;continue}const t=await ce(e,u);if(!t){s[l]=u.defaultValue;continue}i.set(l,t),s[l]=null}else switch(u.type){case"cim-effect-infos":if(u.effectInfos.some((e=>e.overrides.length))){n.set(l,{effects:await Promise.all(u.effectInfos.map((async t=>{const r=t.overrides.map((t=>ae(e,t)));return{effect:t.effect,compiledOverrides:(await Promise.all(r)).filter(J.pC)}})))});break}s[l]=u.effectInfos.map((e=>e.effect));break;case"cim-marker-placement-info":u.overrides.length&&o.set(l,{placementInfo:u,compiledOverrides:(await Promise.all(u.overrides.map((t=>ae(e,t))))).filter(J.pC)}),s[l]=u.placement;break;case"sprite-rasterization-param":case"text-rasterization-param":{if(u.overrides.length){const t=u.overrides.map((t=>ae(e,t)));a.set(l,{compiledOverrides:(await Promise.all(t)).filter(J.pC),rasterizationParam:u,objectIdToResourceId:new Map});continue}if("sprite-rasterization-param"===u.type&&"animated"===u.resource.type){a.set(l,{compiledOverrides:[],rasterizationParam:u,objectIdToResourceId:new Map});continue}const r={type:"cim-rasterization-info",resource:u.resource};s[l]=await t.fetchResourceImmediate(r)??null;break}case"cim-marker-transform-param":{const t=e=>"boolean"!=typeof e&&"number"!=typeof e&&"valueExpressionInfo"in e,r=e=>e.some((e=>{for(const r in e){const s=e[r];if(t(s))return!0}return!1})),{params:i}=u;if(r(i)){const r={compiledMarkerInfos:[]};await Promise.all(i.map((async s=>{const i={props:{}};for(const r in s)if(t(s[r])){const t=await ce(e,s[r]);i.compiledExpressionMap||(i.compiledExpressionMap=new Map);const n=i.compiledExpressionMap;t&&n.set(r,t)}else s[r]&&(i.props[r]=s[r]);r.compiledMarkerInfos.push(i)}))),c.set(l,r)}else s[l]={type:"cim-marker-transform-info",infos:i};break}default:s[l]=u}else s[l]=u}return new le(r,s,i,n,o,a,c)}constructor(e,t,r,s,i,n,o){this.inputMeshParams=e,this._resolvedMeshParams=t,this._dynamicProperties=r,this._dynamicEffectProperties=s,this._dynamicPlacementProperties=i,this._dynamicAsyncProperties=n,this._dynamicTransformProperties=o,this.evaluator=e=>e}get hasDynamicProperties(){return!!(this._dynamicProperties.size||this._dynamicAsyncProperties.size||this._dynamicEffectProperties.size||this._dynamicTransformProperties.size||this._dynamicPlacementProperties.size)}get evaluatedMeshParams(){return this._evaluatedMeshParams||(this._evaluatedMeshParams=this.evaluator(this._resolvedMeshParams)),this._evaluatedMeshParams}enqueueRequest(e,t,r){for(const i of this._dynamicAsyncProperties.values()){const n=(0,ee.d9)(i.rasterizationParam.resource);"animated"===i.rasterizationParam.resource.type&&i.rasterizationParam.resource.randomizeStartTime&&(n.startGroup=(s=t.getObjectId()||0,Math.floor(function(e,t){let r;if("string"==typeof e)r=(0,te.hP)(e+`-seed(${t})`);else{let s=12;r=e^t;do{r=107*(r>>8^r)+s|0}while(0!=--s)}return(1+r/(1<<31))/2}(s,re)*se)));for(const{primitiveName:e,propertyName:s,computed:o,defaultValue:a}of i.compiledOverrides)ie(n,e,s,o,t,r,a);const o=e.enqueueRequest({type:"cim-rasterization-info",resource:n});i.objectIdToResourceId.set(t.getObjectId(),o)}var s}evaluateMeshParams(e,t,r){for(const[e,s]of this._dynamicProperties.entries())this._resolvedMeshParams[e]=s.computed.readWithDefault(t,r,s.defaultValue);for(const[e,s]of this._dynamicPlacementProperties.entries())for(const{computed:i,defaultValue:n,propertyName:o}of s.compiledOverrides){const a=i.readWithDefault(t,r,n);s.placementInfo.placement[o]=a,this._resolvedMeshParams[e]=s.placementInfo.placement}for(const[e,s]of this._dynamicEffectProperties.entries())for(const i of s.effects){for(const{computed:e,defaultValue:s,propertyName:n}of i.compiledOverrides){const o=e.readWithDefault(t,r,s);i.effect[n]=o}this._resolvedMeshParams[e]=s.effects.map((e=>e.effect))}for(const[e,s]of this._dynamicTransformProperties.entries()){const i={type:"cim-marker-transform-info",infos:[]};for(const e of s.compiledMarkerInfos){const s={...e.props};if(e.compiledExpressionMap)for(const[i,n]of e.compiledExpressionMap){const e=n.computed.readWithDefault(t,r,n.defaultValue);s[i]="number"==typeof e||"boolean"==typeof e?e:n.defaultValue}i.infos.push(s)}this._resolvedMeshParams[e]=i}for(const[r,s]of this._dynamicAsyncProperties.entries()){const i=s.objectIdToResourceId.get(t.getObjectId());if(null==i)continue;const n=e.getResource(i);this._resolvedMeshParams[r]=n}return this._evaluatedMeshParams=this.evaluator(this._resolvedMeshParams),this.evaluatedMeshParams}}var ue=r(65390),he=(r(95401),r(59255)),de=r(5428);function pe(e,t,r,s,i,n,o){Be=0;const a=(s-r)*n,c=i&&i.length,l=c?(i[0]-r)*n:a;let u,h,d,p,_,f=_e(t,r,0,0,l,n,!0);if(f&&f.next!==f.prev){if(c&&(f=function(e,t,r,s,i,n){const o=new Array;for(let i=0,a=s.length;i<a;i++){const c=_e(e,t,0,s[i]*n,i<a-1?s[i+1]*n:r*n,n,!1);c===c.next&&(c.steiner=!0),o.push(ve(c))}o.sort(Me);for(const e of o)i=we(e,i);return i}(t,r,s,i,f,n)),a>80*n){u=d=t[0+r*n],h=p=t[1+r*n];for(let e=n;e<l;e+=n){const s=t[e+r*n],i=t[e+1+r*n];u=Math.min(u,s),h=Math.min(h,i),d=Math.max(d,s),p=Math.max(p,i)}_=Math.max(d-u,p-h),_=0!==_?1/_:0}ye(f,e,n,u,h,_,o,0)}}function _e(e,t,r,s,i,n,o){let a;if(o===function(e,t,r,s,i,n){let o=0;for(let r=s,a=i-n;r<i;r+=n)o+=(e[a+t*n]-e[r+t*n])*(e[r+1+t*n]+e[a+1+t*n]),a=r;return o}(e,t,0,s,i,n)>0)for(let r=s;r<i;r+=n)a=xe(r+t*n,e[r+t*n],e[r+1+t*n],a);else for(let r=i-n;r>=s;r-=n)a=xe(r+t*n,e[r+t*n],e[r+1+t*n],a);return a&&Ce(a,a.next)&&(be(a),a=a.next),a}function fe(e,t=e){if(!e)return e;let r,s=e;do{if(r=!1,s.steiner||!Ce(s,s.next)&&0!==Ie(s.prev,s,s.next))s=s.next;else{if(be(s),s=t=s.prev,s===s.next)break;r=!0}}while(r||s!==t);return t}function ye(e,t,r,s,i,n,o,a){if(!e)return;!a&&n&&(e=Se(e,s,i,n));let c=e;for(;e.prev!==e.next;){const l=e.prev,u=e.next;if(n?me(e,s,i,n):ge(e))t.push(l.index/r+o),t.push(e.index/r+o),t.push(u.index/r+o),be(e),e=u.next,c=u.next;else if((e=u)===c){a?1===a?ye(e=Fe(e,t,r,o),t,r,s,i,n,o,2):2===a&&Ne(e,t,r,s,i,n,o):ye(fe(e),t,r,s,i,n,o,1);break}}}function ge(e){const t=e.prev,r=e,s=e.next;if(Ie(t,r,s)>=0)return!1;let i=e.next.next;const n=i;let o=0;for(;i!==e.prev&&(0===o||i!==n);){if(o++,Ee(t.x,t.y,r.x,r.y,s.x,s.y,i.x,i.y)&&Ie(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function me(e,t,r,s){const i=e.prev,n=e,o=e.next;if(Ie(i,n,o)>=0)return!1;const a=i.x<n.x?i.x<o.x?i.x:o.x:n.x<o.x?n.x:o.x,c=i.y<n.y?i.y<o.y?i.y:o.y:n.y<o.y?n.y:o.y,l=i.x>n.x?i.x>o.x?i.x:o.x:n.x>o.x?n.x:o.x,u=i.y>n.y?i.y>o.y?i.y:o.y:n.y>o.y?n.y:o.y,h=Ae(a,c,t,r,s),d=Ae(l,u,t,r,s);let p=e.prevZ,_=e.nextZ;for(;p&&p.z>=h&&_&&_.z<=d;){if(p!==e.prev&&p!==e.next&&Ee(i.x,i.y,n.x,n.y,o.x,o.y,p.x,p.y)&&Ie(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,_!==e.prev&&_!==e.next&&Ee(i.x,i.y,n.x,n.y,o.x,o.y,_.x,_.y)&&Ie(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&Ee(i.x,i.y,n.x,n.y,o.x,o.y,p.x,p.y)&&Ie(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;_&&_.z<=d;){if(_!==e.prev&&_!==e.next&&Ee(i.x,i.y,n.x,n.y,o.x,o.y,_.x,_.y)&&Ie(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function xe(e,t,r,s){const i=ke.create(e,t,r);return s?(i.next=s.next,i.prev=s,s.next.prev=i,s.next=i):(i.prev=i,i.next=i),i}function be(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function ve(e){let t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function we(e,t){const r=function(e,t){let r=t;const s=e.x,i=e.y;let n,o=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){const e=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(e<=s&&e>o){if(o=e,e===s){if(i===r.y)return r;if(i===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!n)return null;if(s===o)return n.prev;const a=n,c=n.x,l=n.y;let u,h=1/0;for(r=n.next;r!==a;)s>=r.x&&r.x>=c&&s!==r.x&&Ee(i<l?s:o,i,c,l,i<l?o:s,i,r.x,r.y)&&(u=Math.abs(i-r.y)/(s-r.x),(u<h||u===h&&r.x>n.x)&&Re(r,e)&&(n=r,h=u)),r=r.next;return n}(e,t);if(!r)return t;const s=Pe(r,e);return fe(s,s.next),fe(r,r.next)}function Se(e,t,r,s){let i;for(;i!==e;i=i.next){if(i=i||e,null===i.z&&(i.z=Ae(i.x,i.y,t,r,s)),i.prev.next!==i||i.next.prev!==i)return i.prev.next=i,i.next.prev=i,Se(e,t,r,s);i.prevZ=i.prev,i.nextZ=i.next}return e.prevZ.nextZ=null,e.prevZ=null,function(e){let t,r=1;for(;;){let s,i=e;e=null,t=null;let n=0;for(;i;){n++,s=i;let o=0;for(;o<r&&s;o++)s=s.nextZ;let a=r;for(;o>0||a>0&&s;){let r;0===o?(r=s,s=s.nextZ,a--):0!==a&&s?i.z<=s.z?(r=i,i=i.nextZ,o--):(r=s,s=s.nextZ,a--):(r=i,i=i.nextZ,o--),t?t.nextZ=r:e=r,r.prevZ=t,t=r}i=s}if(t.nextZ=null,r*=2,n<2)return e}}(e)}function Ie(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Te(e,t,r,s){return!!(Ce(e,t)&&Ce(r,s)||Ce(e,s)&&Ce(r,t))||Ie(e,t,r)>0!=Ie(e,t,s)>0&&Ie(r,s,e)>0!=Ie(r,s,t)>0}function Ee(e,t,r,s,i,n,o,a){return(i-o)*(t-a)-(e-o)*(n-a)>=0&&(e-o)*(s-a)-(r-o)*(t-a)>=0&&(r-o)*(n-a)-(i-o)*(s-a)>=0}function Re(e,t){return Ie(e.prev,e,e.next)<0?Ie(e,t,e.next)>=0&&Ie(e,e.prev,t)>=0:Ie(e,t,e.prev)<0||Ie(e,e.next,t)<0}function Ae(e,t,r,s,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-s)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Ce(e,t){return e.x===t.x&&e.y===t.y}function Me(e,t){return e.x-t.x}function Fe(e,t,r,s){let i=e;do{const n=i.prev,o=i.next.next;!Ce(n,o)&&Te(n,i,i.next,o)&&Re(n,o)&&Re(o,n)&&(t.push(n.index/r+s),t.push(i.index/r+s),t.push(o.index/r+s),be(i),be(i.next),i=e=o),i=i.next}while(i!==e);return i}function Ne(e,t,r,s,i,n,o){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.index!==e.index&&Oe(a,e)){let c=Pe(a,e);return a=fe(a,a.next),c=fe(c,c.next),ye(a,t,r,s,i,n,o,0),void ye(c,t,r,s,i,n,o,0)}e=e.next}a=a.next}while(a!==e)}function Oe(e,t){return e.next.index!==t.index&&e.prev.index!==t.index&&!function(e,t){let r=e;do{if(r.index!==e.index&&r.next.index!==e.index&&r.index!==t.index&&r.next.index!==t.index&&Te(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&Re(e,t)&&Re(t,e)&&function(e,t){let r=e,s=!1;const i=(e.x+t.x)/2,n=(e.y+t.y)/2;do{r.y>n!=r.next.y>n&&r.next.y!==r.y&&i<(r.next.x-r.x)*(n-r.y)/(r.next.y-r.y)+r.x&&(s=!s),r=r.next}while(r!==e);return s}(e,t)}function Pe(e,t){const r=ke.create(e.index,e.x,e.y),s=ke.create(t.index,t.x,t.y),i=e.next,n=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,s.next=r,r.prev=s,n.next=s,s.prev=n,s}class ke{constructor(){this.index=0,this.x=0,this.y=0,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}static create(e,t,r){const s=Be<De.length?De[Be++]:new ke;return s.index=e,s.x=t,s.y=r,s.prev=null,s.next=null,s.z=null,s.prevZ=null,s.nextZ=null,s.steiner=!1,s}}const De=[];let Be=0;for(let e=0;e<8096;e++)De.push(new ke);const Le=new he.bN(0,0,0,1,0),Ue=new he.bN(0,0,0,1,0);function ze(e,t,r){let s=0;for(let i=1;i<r;i++){const r=e[2*(t+i-1)],n=e[2*(t+i-1)+1];s+=(e[2*(t+i)]-r)*(e[2*(t+i)+1]+n)}return s}function Ge(e,t,r,s,i){let n=0;for(let o=r;o<s;o+=3){const r=2*(e[o]-i),s=2*(e[o+1]-i),a=2*(e[o+2]-i);n+=Math.abs((t[r]-t[a])*(t[s+1]-t[r+1])-(t[r]-t[s])*(t[a+1]-t[r+1]))}return n}Le.setExtent(G.i9),Ue.setExtent(G.i9);var Ve=r(58835),Ze=r(95961),He=r(21793),We=r(66221),je=r(25844);class Ye{static executeEffects(e,t,r,s){const i=(0,je.Tg)(e);let n=new He.z(t);for(const t of e){const e=(0,We.h)(t);e&&(n=e.execute(n,t,1.3333333333333333,r,s,i))}return n}static applyEffects(e,t,r){if(!e)return t;const s=(0,je.Tg)(e);let i,n=new He.z(Ve.z.fromJSONCIM(t));for(const t of e){const e=(0,We.h)(t);e&&(n=e.execute(n,t,1,null,r,s))}const o=[];let a=null;for(;i=n.next();)o.push(...(0,Ze.M)(i)),a=i.geometryType;return 0===o.length||null===a?null:"esriGeometryPolygon"===a?{rings:o}:{paths:o}}}let qe=null;function $e(){return qe}const Xe=new Float32Array(1);new Uint32Array(Xe.buffer);var Ke=r(35371);function Qe(e){switch(e){case Ke.g.BYTE:case Ke.g.UNSIGNED_BYTE:return 1;case Ke.g.SHORT:case Ke.g.UNSIGNED_SHORT:return 2;case Ke.g.FLOAT:case Ke.g.INT:case Ke.g.UNSIGNED_INT:return 4}}class Je{static fromVertexSpec({attributes:e},t){let r,s,i;const n=[];for(const o in e){const a=e[o];!1!==t?.[o]&&("position"===a.pack?r={...a,name:o,offset:0}:"id"===a.pack?s={...a,name:o,offset:4}:"bitset"===o?i={...a,name:o,offset:7}:n.push({...a,name:o}))}const o=function(e){const t=[],r=[],s=[];for(const i of e){const e=Qe(i.type)*i.count;switch(e%2||e%4||4){case 4:t.push(i);continue;case 2:r.push(i);continue;case 1:s.push(i);continue;default:throw new Error("Found unexpected dataType byte count")}}return t.push(...r),t.push(...s),t}(n),a=[];let c=8,l=1;for(const e of o)a.push({...e,offset:c}),c+=Qe(e.type)*e.count,e.packAlternating&&(l=Math.max(e.packAlternating.count,l));const u=Uint32Array.BYTES_PER_ELEMENT,h=c%u;return new Je(r,s,i,a,c+(h?u-h:0),l)}constructor(e,t,r,s,i,n){this.position=e,this.id=t,this.bitset=r,this.standardAttributes=s,this.stride=i,this.packVertexCount=n,s.push(r),this._attributes=[e,t,r,...s]}get attributeLayout(){if(!this._attributeLayout){const e=function(e){const t=e.map((({name:e,count:t,type:r})=>`${e}.${t}.${r}`)).join(",");return(0,te.hP)(t)}(this._attributes),t=this._attributes.map((e=>({name:e.name,count:e.count,offset:e.offset,type:e.type,packPrecisionFactor:e.packPrecisionFactor,normalized:e.normalized??!1})));this._attributeLayout={attributes:t,hash:e,stride:this.stride}}return this._attributeLayout}}class et{static fromVertexSpec(e,t){const r=Je.fromVertexSpec(e,t);return new et(r)}constructor(e){this._spec=e,this._packed=new Uint8Array(this._spec.stride*this._spec.packVertexCount),this._packedU32View=new Uint32Array(this._packed.buffer),this._dataView=new DataView(this._packed.buffer)}get attributeLayout(){return this._spec.attributeLayout}get stride(){return this._spec.stride}writeVertex(e,t,r,s,i,n){for(let e=0;e<this._spec.packVertexCount;e++){const o=e*this._spec.stride;this._packPosition(r,s,o),this._packId(t,o);const a=this._spec.bitset;if(n){if(a.packTessellation){const e=a.packTessellation(n,i);this._pack(e,a,o)}for(const e of this._spec.standardAttributes)if(null!=e.packTessellation){const t=e.packTessellation(n,i);this._pack(t,e,o)}else if(e.packAlternating?.packTessellation){const t=e.packAlternating.packTessellation(n,i);for(let r=0;r<this._spec.packVertexCount;r++){const s=t[r];this._pack(s,e,r*this._spec.stride)}}}}e.vertexWriteRegion(this._packedU32View)}pack(e,t){for(const r of this._spec.standardAttributes)if(r.pack&&"string"!=typeof r.pack){const s=r.pack(e,t);for(let e=0;e<this._spec.packVertexCount;e++)this._pack(s,r,e*this._spec.stride)}else if(r.packAlternating?.pack){const s=r.packAlternating.pack(e,t);for(let e=0;e<this._spec.packVertexCount;e++){const t=s[e];this._pack(t,r,e*this._spec.stride)}}}_packPosition(e,t,r){const{offset:s}=this._spec.position,i=this._spec.position.packPrecisionFactor??1,n=65535&e*i|t*i<<16;this._dataView.setUint32(r+s,n,!0)}_packId(e,t){const r=e*(this._spec.id.packPrecisionFactor??1),s=4278190080&this._dataView.getUint32(t+this._spec.id.offset,!0);this._dataView.setUint32(t+this._spec.id.offset,r|s,!0)}_pack(e,t,r){!function(e,t,r,s){const i=r.packPrecisionFactor??1;switch(r.type){case Ke.g.BYTE:if(1===r.count)e.setInt8(s+r.offset,t*i);else for(let n=0;n<r.count;n++){const o=n*Int8Array.BYTES_PER_ELEMENT;e.setInt8(s+r.offset+o,t[n]*i)}break;case Ke.g.UNSIGNED_BYTE:if(1===r.count)e.setUint8(s+r.offset,t*i);else for(let n=0;n<r.count;n++){const o=n*Uint8Array.BYTES_PER_ELEMENT;e.setUint8(s+r.offset+o,t[n]*i)}break;case Ke.g.SHORT:if(1===r.count)e.setInt16(s+r.offset,t*i,!0);else for(let n=0;n<r.count;n++){const o=n*Int16Array.BYTES_PER_ELEMENT;e.setInt16(s+r.offset+o,t[n]*i,!0)}break;case Ke.g.UNSIGNED_SHORT:if(1===r.count)e.setUint16(s+r.offset,t*i,!0);else for(let n=0;n<r.count;n++){const o=n*Uint16Array.BYTES_PER_ELEMENT;e.setUint16(s+r.offset+o,t[n]*i,!0)}break;case Ke.g.INT:if(1===r.count)e.setInt32(s+r.offset,t*i,!0);else for(let n=0;n<r.count;n++){const o=n*Int32Array.BYTES_PER_ELEMENT;e.setInt32(s+r.offset+o,t[n]*i,!0)}break;case Ke.g.UNSIGNED_INT:if(1===r.count)e.setUint32(s+r.offset,t*i,!0);else for(let n=0;n<r.count;n++){const o=n*Uint32Array.BYTES_PER_ELEMENT;e.setUint32(s+r.offset+o,t[n]*i,!0)}break;case Ke.g.FLOAT:if(1===r.count)e.setFloat32(s+r.offset,t*i,!0);else for(let n=0;n<r.count;n++){const o=n*Float32Array.BYTES_PER_ELEMENT;e.setFloat32(s+r.offset+o,t[n]*i,!0)}}}(this._dataView,e,t,r)}}class tt{constructor(e,t,r,s){this._instanceId=e,this._evaluator=t,this._viewParams=r,this._optionalAttributes=s,this._evaluator.evaluator=e=>this.vertexSpec.createComputedParams(e)}get _vertexPack(){if(!this._cachedVertexPack){const e=et.fromVertexSpec(this.vertexSpec,this._optionalAttributes);this._evaluator.hasDynamicProperties||e.pack(this._evaluator.evaluatedMeshParams,this._viewParams),this._cachedVertexPack=e}return this._cachedVertexPack}get evaluatedMeshParams(){return this._evaluator.evaluatedMeshParams}get hasEffects(){return!!this.evaluatedMeshParams.effects}get instanceId(){return this._instanceId}get attributeLayout(){return this._vertexPack.attributeLayout}setReferences(e){this._references=e}getBoundsInfo(){return null}async loadDependencies(){(function(e){if(!e)return!1;for(const t of e)switch(t.effect.type){case"CIMGeometricEffectBuffer":case"CIMGeometricEffectOffset":case"CIMGeometricEffectDonut":return!0}return!1})(this._evaluator.inputMeshParams.params.effects?.effectInfos)&&await async function(){qe=await Promise.all([r.e(5837),r.e(247)]).then(r.bind(r,30247))}()}enqueueRequest(e,t,r){this._evaluator.hasDynamicProperties&&this._evaluator.enqueueRequest(e,t,r)}write(e,t,r,s){this.ensurePacked(t,r,s);const i=this.evaluatedMeshParams.effects;if(!i||0===i.length)return void this._write(e,r);const n=r.readLegacyGeometryForDisplay();if(!n)return;const o=Ve.z.fromJSONCIM(n),a=$e();o.invertY();const c=Ye.executeEffects(i,o,"",a);let l;for(;l=c.next();)l.invertY(),this._write(e,r,l)}ensurePacked(e,t,r){if(!this._evaluator.hasDynamicProperties)return;const s=this._evaluator.evaluateMeshParams(e,t,r);this._vertexPack.pack(s,this._viewParams)}_writeVertex(e,t,r,s,i){const n=this.evaluatedMeshParams;this._vertexPack.writeVertex(e,t,r,s,n,i)}}const rt=(0,n.Z)("featurelayer-fast-triangulation-enabled");class st extends tt{async loadDependencies(){await Promise.all([super.loadDependencies(),(0,ue.j)()])}_write(e,t,r){const s=r?.asOptimized()??t.readGeometryForDisplay(),i=this._clip(s);i&&(e.recordStart(this.instanceId,this.attributeLayout),this._writeGeometry(e,t,i),e.recordEnd())}_clip(e){return e?function(e,t){if(null==e)return null;if(!function(e,t,r){let s=0;for(let t=0;t<e.lengths.length;t++){const i=e.lengths[t];for(let t=0;t<i;t++){const i=e.coords[2*(t+s)],n=e.coords[2*(t+s)+1];if(i<-128||i>r||n<-128||n>r)return!0}s+=i}return!1}(e,0,G.i9+128))return e;Le.setPixelMargin(t),Le.reset(he.Vl.Polygon);let r=0;for(let t=0;t<e.lengths.length;t++){const s=e.lengths[t];let i=e.coords[2*(0+r)],n=e.coords[2*(0+r)+1];Le.moveTo(i,n);for(let t=1;t<s;t++)i=e.coords[2*(t+r)],n=e.coords[2*(t+r)+1],Le.lineTo(i,n);Le.close(),r+=s}const s=Le.result(!1);if(!s)return null;const i=[],n=[];for(const e of s){let t=0;for(const r of e)n.push(r.x),n.push(r.y),t++;i.push(t)}return new de.Z(i,n)}(e,this.hasEffects?256:8):null}_writeGeometry(e,t,r){const s=r.maxLength>100,i=[],n=this.createTesselationParams(t);if(!s&&rt&&function(e,t){const{coords:r,lengths:s,hasIndeterminateRingOrder:i}=t,n=e;if(i)return!1;let o=0;for(let e=0;e<s.length;){let t=e,i=s[e],a=ze(r,o,i);const c=[];for(;++t<s.length;){const e=s[t],n=ze(r,o+i,e);if(!(n>0))break;a+=n,c.push(o+i),i+=e}const l=n.length;pe(n,r,o,o+i,c,2,0);const u=Ge(n,r,l,n.length,0),h=Math.abs(a);if(Math.abs((u-h)/Math.max(1e-7,h))>1e-5)return n.length=0,!1;e=t,o+=i}return!0}(i,r))return void(i.length&&this._writeVertices(e,t,r.coords,n,i));const o=function(e){const{coords:t,lengths:r}=e,{buffer:s}=(0,ue.b)(t,r);return s}(r);this._writeVertices(e,t,o,n)}_writeVertices(e,t,r,s,i){const n=t.getDisplayId(),o=e.vertexCount(),a=this.hasEffects;let c=0;if(i)for(const t of i){const i=r[2*t],o=r[2*t+1];a&&e.recordBounds(i,o,0,0),this._writeVertex(e,n,i,o,s),c++}else for(let t=0;t<r.length;t+=2){const i=Math.round(r[t]),o=Math.round(r[t+1]);a&&e.recordBounds(i,o,0,0),this._writeVertex(e,n,i,o,s),c++}e.indexEnsureSize(c);for(let t=0;t<c;t++)e.indexWrite(t+o)}}const it={createComputedParams:e=>e,attributes:{id:{type:Ke.g.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:Ke.g.UNSIGNED_BYTE,count:1},pos:{type:Ke.g.SHORT,count:2,pack:"position",packPrecisionFactor:10},inverseArea:{type:Ke.g.FLOAT,count:1,packTessellation:({inverseArea:e})=>e}}};var nt=r(62357),ot=r(31363),at=r(22303),ct=r(95648);function lt(e,t){return[!!e?.minScale&&t.scaleToZoom(e.minScale)||0,!!e?.maxScale&&t.scaleToZoom(e.maxScale)||100]}function ut(e){return 1<<e}function ht(e){let t=0;for(const[r,s]of e)s&&(t|=1<<r);return t}function dt(e){let t;if(!e)return[0,0,0,0];if("string"==typeof e){const r=at.Z.fromString(e);if(!r)return u.Z.getLogger("esri.views.2d.engine.webgl.shaderGraph.techniques.meshWriterUtils").errorOnce(new h.Z("mapview:mesh-processing","Unable to parse string into color",{color:e})),[0,0,0,0];t=r.toArray()}else t=e;const[r,s,i,n]=t;return[r*(n/255),s*(n/255),i*(n/255),n]}function pt(e,t){return Math.round(Math.min(Math.sqrt(e*t),255))}function _t(e,t){return Math.round(e*t)/t}function ft(e,t){return Math.ceil(e*t)/t}const yt={createComputedParams:e=>e,attributes:{id:{type:Ke.g.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:Ke.g.UNSIGNED_BYTE,count:1},pos:{type:Ke.g.SHORT,count:2,pack:"position",packPrecisionFactor:10},zoomRange:{type:Ke.g.SHORT,count:2,packPrecisionFactor:G.JS,pack:({scaleInfo:e},{tileInfo:t})=>lt(e,t)},color:{type:Ke.g.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>dt(e)}}};class gt extends st{constructor(){super(...arguments),this.vertexSpec=yt}createTesselationParams(e){return null}}const mt={createComputedParams:e=>e,attributes:{...yt.attributes,tlbr:{count:4,type:Ke.g.UNSIGNED_SHORT,pack:({sprite:e})=>{const{rect:t,width:r,height:s}=e,i=t.x+G.s4,n=t.y+G.s4;return[i,n,i+r,n+s]}},inverseRasterizationScale:{count:1,type:Ke.g.BYTE,packPrecisionFactor:16,pack:({sprite:e})=>1/e.rasterizationScale}}};class xt extends gt{constructor(){super(...arguments),this.vertexSpec=mt}_write(e,t,r){const s=r?.asOptimized()??t.readGeometryForDisplay(),i=this._clip(s);if(!i)return;const n=this.evaluatedMeshParams.sprite?.textureBinding;e.recordStart(this.instanceId,this.attributeLayout,n),this._writeGeometry(e,t,i),e.recordEnd()}}var bt,vt;(vt=bt||(bt={}))[vt.Geographic=0]="Geographic",vt[vt.Arithmatic=1]="Arithmatic";const wt=1.1,St=1,It=1e-5,Tt=.05,Et=1e-30,Rt=2;function At(e){const{sprite:t,aspectRatio:r,scaleProportionally:s}=e,i=(0,nt.F2)(e.height),n=i>0?i:t.height;let o=i*r;return o<=0?o=t.width:s&&(o*=t.width/t.height),{width:o,height:n}}function Ct(e){const{applyRandomOffset:t,sampleAlphaOnly:r}=e,{width:s,height:i}=At(e);return ht([[Rt,t],[4,r],[6,s<G.oh],[5,i<G.oh]])}function Mt(e){const{width:t}=At(e);return Math.round(t<G.oh?t*G.Kg:t)}function Ft(e){const{height:t}=At(e);return Math.round(t<G.oh?t*G.Kg:t)}const Nt={createComputedParams:e=>e,attributes:{...mt.attributes,bitset:{count:1,type:Ke.g.UNSIGNED_BYTE,pack:Ct},width:{count:1,type:Ke.g.UNSIGNED_SHORT,pack:Mt},height:{count:1,type:Ke.g.UNSIGNED_SHORT,pack:Ft},offset:{count:2,type:Ke.g.SHORT,pack:({offsetX:e,offsetY:t})=>[(0,nt.F2)(e),-(0,nt.F2)(t)]},scale:{count:2,type:Ke.g.UNSIGNED_BYTE,packPrecisionFactor:16,pack:({scaleX:e,scaleY:t})=>[e,t]},angle:{count:1,type:Ke.g.UNSIGNED_BYTE,pack:({angle:e})=>(0,ot.s5)(e)}}};var Ot=r(67327);class Pt{constructor(){this.extrusionOffsetX=0,this.extrusionOffsetY=0,this.normalX=0,this.normalY=0,this.directionX=0,this.directionY=0,this.distance=0}}const kt={createComputedParams:e=>e,attributes:{id:{type:Ke.g.UNSIGNED_BYTE,count:3,pack:"id"},pos:{type:Ke.g.SHORT,count:2,pack:"position",packPrecisionFactor:10},bitset:{type:Ke.g.UNSIGNED_BYTE,count:1},zoomRange:{type:Ke.g.SHORT,count:2,packPrecisionFactor:G.JS,pack:({scaleInfo:e},{tileInfo:t})=>lt(e,t)},color:{type:Ke.g.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>dt(e)},offset:{type:Ke.g.BYTE,count:2,packPrecisionFactor:16,packTessellation:({extrusionOffsetX:e,extrusionOffsetY:t})=>[_t(e,16),_t(t,16)]},normal:{type:Ke.g.BYTE,count:2,packPrecisionFactor:16,packTessellation:({normalX:e,normalY:t})=>[_t(e,16),_t(t,16)]},halfWidth:{type:Ke.g.UNSIGNED_SHORT,count:1,packPrecisionFactor:16,pack:({width:e})=>ft((0,nt.F2)(.5*e),16)},referenceHalfWidth:{type:Ke.g.UNSIGNED_SHORT,count:1,packPrecisionFactor:16,pack:({referenceWidth:e})=>ft((0,nt.F2)(.5*e),16)}}};class Dt{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0}}class Bt extends tt{constructor(e,t,r,s){super(e,t,r,s),this.vertexSpec=kt,this._currentWrite=new Dt,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:65535,textured:!1},this._tessParams=new Pt,this._initializeTessellator()}writeLineVertices(e,t,r){const s=this._getLines(t);null!=s&&this._writeVertices(e,r,s)}_initializeTessellator(){this._lineTessellator=new Ot.z(this._writeTesselatedVertex.bind(this),this._writeTriangle.bind(this),!0)}_write(e,t,r){const s=r??Ve.z.fromFeatureSetReaderCIM(t);s&&this._writeGeometry(e,t,s)}_writeGeometry(e,t,r,s){e.recordStart(this.instanceId,this.attributeLayout,s),this.writeLineVertices(e,r,t),e.recordEnd()}_getLines(e){return function(e,t){Ue.setPixelMargin(t);const r=Ue,s=-t,i=G.i9+t;let n=[],o=!1;if(!e.nextPath())return null;let a=!0;for(;a;){e.seekPathStart();const t=[];if(!e.pathSize)return null;r.reset(he.Vl.LineString),e.nextPoint();let c=e.x,l=e.y;if(o)r.moveTo(c,l);else{if(c<s||c>i||l<s||l>i){o=!0;continue}t.push({x:c,y:l})}let u=!1;for(;e.nextPoint();)if(c=e.x,l=e.y,o)r.lineTo(c,l);else{if(c<s||c>i||l<s||l>i){u=!0;break}t.push({x:c,y:l})}if(u)o=!0;else{if(o){const e=r.resultWithStarts();if(e)for(const t of e)n.push(t)}else n.push({line:t,start:0});a=e.nextPath(),o=!1}}return n=n.filter((e=>e.line.length>1)),0===n.length?null:n}(e,this.hasEffects?256:16)}_writeVertices(e,t,r){const{_currentWrite:s,_tessellationOptions:i,evaluatedMeshParams:n}=this,{width:o,capType:a,joinType:c,miterLimit:l,hasSizeVV:u}=n,h=(0,nt.F2)(.5*o);i.halfWidth=h,i.capType=function(e){switch(e){case"butt":case ct.kP.Butt:return ct.RL.BUTT;case"round":case ct.kP.Round:return ct.RL.ROUND;case"square":case ct.kP.Square:return ct.RL.SQUARE}}(a),i.joinType=function(e){switch(e){case"bevel":case ct.r4.Bevel:return ct.AH.BEVEL;case"miter":case ct.r4.Miter:return ct.AH.MITER;case"round":case ct.r4.Round:return ct.AH.ROUND}}(c),i.miterLimit=l;const d=!u;s.out=e,s.id=t.getDisplayId(),s.vertexCount=0,s.indexCount=0,s.vertexFrom=e.vertexCount(),s.vertexBounds=d&&h<G.do?0:1;for(const{line:e,start:t}of r)i.initialDistance=t%65535,this._lineTessellator.tessellate(e,i,d)}_writeTesselatedVertex(e,t,r,s,i,n,o,a,c,l,u){const{out:h,id:d,vertexBounds:p}=this._currentWrite;return this.hasEffects&&h.recordBounds(e,t,p,p),this._tessParams.extrusionOffsetX=o,this._tessParams.extrusionOffsetY=a,this._tessParams.normalX=c,this._tessParams.normalY=l,this._tessParams.directionX=i,this._tessParams.directionY=n,this._tessParams.distance=u,this._writeVertex(h,d,e,t,this._tessParams),this._currentWrite.vertexFrom+this._currentWrite.vertexCount++}_writeTriangle(e,t,r){const{out:s}=this._currentWrite;s.indexEnsureSize(3),s.indexWrite(e),s.indexWrite(t),s.indexWrite(r),this._currentWrite.indexCount+=3}}const Lt={createComputedParams:e=>e,attributes:{...kt.attributes,bitset:{type:Ke.g.UNSIGNED_BYTE,count:1,pack:e=>0},color:{type:Ke.g.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>dt(e)}}},Ut={createComputedParams:e=>e,attributes:{...kt.attributes,bitset:{type:Ke.g.UNSIGNED_BYTE,count:1,pack:e=>ht([[0,!0]])},color:{type:Ke.g.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>dt(e)}}};class zt extends Bt{constructor(){super(...arguments),this.vertexSpec=Ut}}class Gt extends gt{constructor(e,t,r,s){super(e,t,r,s),this.vertexSpec=Lt,this._lineMeshWriter=this._createOutlineWriter(e,t,r,s)}_createOutlineWriter(e,t,r,s){return new zt(e,t,r,s)}_write(e,t,r){const s=r?.asOptimized()??t.readGeometryForDisplay(),i=this._clip(s);i&&(e.recordStart(this.instanceId,this.attributeLayout),this._writeGeometry(e,t,i),this._lineMeshWriter.writeLineVertices(e,Ve.z.fromOptimizedCIM(i,"esriGeometryPolyline"),t),e.recordEnd())}ensurePacked(e,t,r){super.ensurePacked(e,t,r),this._lineMeshWriter.ensurePacked(e,t,r)}enqueueRequest(e,t,r){super.enqueueRequest(e,t,r),this._lineMeshWriter.enqueueRequest(e,t,r)}async loadDependencies(){await Promise.all([super.loadDependencies(),this._lineMeshWriter.loadDependencies()])}}var Vt=r(67498),Zt=r(11726);const Ht=()=>u.Z.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder");class Wt{constructor(){this._includedModules=new Map}include(e,t){if(this._includedModules.has(e)){const r=this._includedModules.get(e);if(r!==t){Ht().error("Trying to include shader module multiple times with different sets of options.");const t=new Set;for(const s of Object.keys(r))r[s]!==e[s]&&t.add(s);for(const s of Object.keys(e))r[s]!==e[s]&&t.add(s);t.forEach((t=>console.error(` ${t}: current ${r[t]} new ${e[t]}`)))}}else this._includedModules.set(e,t),e(this.builder,t)}}class jt extends Wt{constructor(){super(...arguments),this.vertex=new $t,this.fragment=new $t,this.attributes=new Xt,this.varyings=new Kt,this.extensions=new Qt,this.constants=new Jt}get fragmentUniforms(){return this.fragment.uniforms.entries}get builder(){return this}generate(e,t=!0){const r=this.extensions.generateSource(e),s=this.attributes.generateSource(e),i=this.varyings.generateSource(e),n="vertex"===e?this.vertex:this.fragment,o=n.uniforms.generateSource(),a=n.code.generateSource(),c="vertex"===e?er:function(e=!0){return`#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp sampler2D;\n#else\n precision mediump float;\n precision mediump sampler2D;\n#endif\n${e?"out vec4 fragColor;":""}\n`}(t),l=this.constants.generateSource().concat(n.constants.generateSource());return`${t?"#version 300 es":""}\n${r.join("\n")}\n${c}\n${l.join("\n")}\n${o.join("\n")}\n${s.join("\n")}\n${i.join("\n")}\n${a.join("\n")}`}generateBindPass(e){const t=new Map;this.vertex.uniforms.entries.forEach((e=>{const r=e.bind[Vt.P.Pass];r&&t.set(e.name,r)})),this.fragment.uniforms.entries.forEach((e=>{const r=e.bind[Vt.P.Pass];r&&t.set(e.name,r)}));const r=Array.from(t.values()),s=r.length;return(t,i)=>{for(let n=0;n<s;++n)r[n](e,t,i)}}generateBindDraw(e){const t=new Map;this.vertex.uniforms.entries.forEach((e=>{const r=e.bind[Vt.P.Draw];r&&t.set(e.name,r)})),this.fragment.uniforms.entries.forEach((e=>{const r=e.bind[Vt.P.Draw];r&&t.set(e.name,r)}));const r=Array.from(t.values()),s=r.length;return(t,i,n)=>{for(let o=0;o<s;++o)r[o](e,t,i,n)}}}class Yt{constructor(){this._entries=new Map}add(...e){for(const t of e)this._add(t)}get(e){return this._entries.get(e)}_add(e){if(null!=e){if(this._entries.has(e.name)&&!this._entries.get(e.name).equals(e))throw new h.Z(`Duplicate uniform name ${e.name} for different uniform type`);this._entries.set(e.name,e)}else Ht().error(`Trying to add null Uniform from ${(new Error).stack}.`)}generateSource(){return Array.from(this._entries.values()).map((e=>null!=e.arraySize?`uniform ${e.type} ${e.name}[${e.arraySize}];`:`uniform ${e.type} ${e.name};`))}get entries(){return Array.from(this._entries.values())}}class qt{constructor(){this._entries=new Array}add(e){this._entries.push(e)}generateSource(){return this._entries}}class $t extends Wt{constructor(){super(...arguments),this.uniforms=new Yt,this.code=new qt,this.constants=new Jt}get builder(){return this}}class Xt{constructor(){this._entries=new Array}add(e,t){this._entries.push([e,t])}generateSource(e){return"fragment"===e?[]:this._entries.map((e=>`in ${e[1]} ${e[0]};`))}}class Kt{constructor(){this._entries=new Map}add(e,t){this._entries.has(e)&&(0,Zt.hu)(this._entries.get(e)===t),this._entries.set(e,t)}generateSource(e){const t=new Array;return this._entries.forEach(((r,s)=>t.push("vertex"===e?`out ${r} ${s};`:`in ${r} ${s};`))),t}}class Qt{constructor(){this._entries=new Set}add(e){this._entries.add(e)}generateSource(e){const t="vertex"===e?Qt.ALLOWLIST_VERTEX:Qt.ALLOWLIST_FRAGMENT;return Array.from(this._entries).filter((e=>t.includes(e))).map((e=>`#extension ${e} : enable`))}}Qt.ALLOWLIST_FRAGMENT=["GL_EXT_shader_texture_lod","GL_OES_standard_derivatives"],Qt.ALLOWLIST_VERTEX=[];class Jt{constructor(){this._entries=new Set}add(e,t,r){let s="ERROR_CONSTRUCTOR_STRING";switch(t){case"float":s=Jt._numberToFloatStr(r);break;case"int":s=Jt._numberToIntStr(r);break;case"bool":s=r.toString();break;case"vec2":s=`vec2(${Jt._numberToFloatStr(r[0])}, ${Jt._numberToFloatStr(r[1])})`;break;case"vec3":s=`vec3(${Jt._numberToFloatStr(r[0])}, ${Jt._numberToFloatStr(r[1])}, ${Jt._numberToFloatStr(r[2])})`;break;case"vec4":s=`vec4(${Jt._numberToFloatStr(r[0])}, ${Jt._numberToFloatStr(r[1])}, ${Jt._numberToFloatStr(r[2])}, ${Jt._numberToFloatStr(r[3])})`;break;case"ivec2":s=`ivec2(${Jt._numberToIntStr(r[0])}, ${Jt._numberToIntStr(r[1])})`;break;case"ivec3":s=`ivec3(${Jt._numberToIntStr(r[0])}, ${Jt._numberToIntStr(r[1])}, ${Jt._numberToIntStr(r[2])})`;break;case"ivec4":s=`ivec4(${Jt._numberToIntStr(r[0])}, ${Jt._numberToIntStr(r[1])}, ${Jt._numberToIntStr(r[2])}, ${Jt._numberToIntStr(r[3])})`;break;case"mat2":case"mat3":case"mat4":s=`${t}(${Array.prototype.map.call(r,(e=>Jt._numberToFloatStr(e))).join(", ")})`}return this._entries.add(`const ${t} ${e} = ${s};`),this}static _numberToIntStr(e){return e.toFixed(0)}static _numberToFloatStr(e){return Number.isInteger(e)?e.toFixed(1):e.toString()}generateSource(){return Array.from(this._entries)}}const er="precision highp float;\nprecision highp sampler2D;";function tr(e,t){const r=[];for(r.push(t);r.length;){const t=r.pop();if("object"==typeof t&&!e.has(t.uid)){e.add(t.uid);for(const e of t.children)r.push(e)}}}class rr{constructor(){this.uid=rr.NodeCount++,this._debugName=null,this._isMutable=!1,this.isImplicit=!1}get isMutable(){return this._isMutable}setMutable(){return this._isMutable=!0,this}setDebugName(e){return e=e.split(" ").map(((e,t)=>t>0?e.charAt(0).toUpperCase()+e.slice(1):e)).join(""),this._debugName=e,this.isImplicit&&this.children[0]instanceof rr&&this.children[0].setDebugName(e),this}get debugInfo(){return{name:this._debugName??""}}cloneInto(e){e._debugName=this._debugName,e._isMutable=this._isMutable,e.isImplicit=this.isImplicit,e.uid=this.uid}}function sr(e){return"object"==typeof e?e.clone():e}rr.NodeCount=0;class ir extends rr{constructor(){super(...arguments),this.shaderType="primitive-node"}}class nr extends rr{constructor(e){super(),this.child=e,this.shaderType="scope-node"}get children(){return[this.child]}clone(){const e=new nr(sr(this.child));return this.cloneInto(e),e}}class or extends rr{constructor(e,t,r){super(),this.property=e,this.target=t,this.returnType=r,this.shaderType="property-access-node"}get children(){const e=[this.target];return"string"!=typeof this.property&&e.push(this.property),e}clone(){const e=new or(this.property,sr(this.target),this.returnType);return this.cloneInto(e),e}}class ar extends rr{constructor(e,t,r){super(),this.condition=e,this.ifTrue=t,this.ifFalse=r,this.shaderType="condition-node"}get children(){return[this.condition,this.ifTrue,this.ifFalse]}clone(){const e=sr(this.ifTrue),t=this.ifFalse?sr(this.ifFalse):null,r=new ar(this.condition,e,t);return this.cloneInto(r),r}}class cr extends rr{constructor(e,t,r,s){super(),this.captureList=e,this.returnType=t,this.generator=s,this.shaderType="block-node",r&&(this.subgraph=new nr(r))}get children(){return Object.keys(this.captureList).map((e=>this.captureList[e])).concat(this.subgraph??[])}clone(){const e={};for(const t in this.captureList)e[t]=sr(this.captureList[t]);const t=new cr(e,this.returnType,this.subgraph?sr(this.subgraph.child):this.subgraph,this.generator);return this.cloneInto(t),t}}class lr extends rr{constructor(e,t,r,s,i,n=!1){super(),this.token=e,this._children=t,this.isInfix=r,this.isPropertyAccess=s,this.returnType=i,this.isTernary=n,this.shaderType="function-node"}get children(){return this._children}clone(){const e=new lr(this.token,this._children.map(sr),this.isInfix,this.isPropertyAccess,this.returnType,this.isTernary);return this.cloneInto(e),e}}var ur,hr,dr,pr,_r,fr,yr,gr,mr,xr,br,vr,wr,Sr;function Ir(e){return new Proxy(e,{get(t,r){if("constructor"===r)return new Proxy(t.constructor,{construct:(e,t,r)=>Ir(new e(...t))});if(r in t)return t[r];if("string"==typeof r){const t=function(e){const t=[["float","vec2","vec3","vec4"],["int","ivec2","ivec3","ivec4"],["uint","uvec2","uvec3","uvec4"],["bool","bvec2","bvec3","bvec4"]];for(const r of t)if(r.includes(e))return r.map((e=>$r[e]));throw new Error("Unable to find type family")}(e.type);return ts(e,r,t[r.length-1])}}})}function Tr(e){return new Proxy(e,{construct:(e,t,r)=>Ir(new e(...t))})}class Er extends Error{}let Rr=ur=class extends ir{constructor(e,t){super(),this.elementType=e,this.size=t,this.children=[],this.type="array"}clone(){const e=new ur(this.elementType,this.size);return super.cloneInto(e),e}get(e){if("number"==typeof e){const t=new Vr(e);return t.isImplicit=!0,ts(this,t,this.elementType.constructor)}return ts(this,e,this.elementType.constructor)}last(){return this.get(this.size-1)}first(){return this.get(0)}findIndex(e,t,r){return function(e,t,r=0,s=e.size){const i=new Vr(r).setMutable().setDebugName("FindIndexIterator"),n=t(e.get(i)).setDebugName("FindIndexPredicate"),o=as({iter:i},Vr,n,(({out:e,iter:t,subgraph:r})=>`\n${e} = -1;\n\nfor (; ${t} < ${s}; ${t}++) {\n\n${r.body}\n\n if (${r.varName}) {\n ${e} = ${t};\n break;\n }\n\n}\n`)).setDebugName("FindIndexBlock");return o}(this,e,t,r)}glslFindIndex(e,t,r){return function(e,t,r=0,s=e.size){const i=as({array:e},Vr,null,(({out:e,array:i})=>`\n${e} = -1;\nfor (int i = ${r}; i < ${s}; i++) {\n bool condition;\n ${t({array:i,i:"i",out:"condition"})}\n if (condition) {\n ${e} = i;\n break;\n }\n}\n`)).setDebugName("GlslFindIndexBlock");return i}(this,e,t,r)}static ofType(e,t){const r={construct:(r,s)=>new ur(new e,t)};return new Proxy(ur,r)}};Rr.type="array",Rr=ur=(0,s._)([function(e){return new Proxy(e,{construct:(e,t,r)=>function(e){return new Proxy(e,{get(t,r){if(r in t)return t[r];if("string"==typeof r){const t=parseInt(r,10);if(!isNaN(t))return ts(e,`[${t}]`,e.elementType.constructor)}}})}(new e(...t))})}],Rr);class Ar extends ir{constructor(){super(...arguments),this.type="sampler2D",this.children=[]}clone(){const e=new Ar;return e.children=this.children.map(sr),super.cloneInto(e),e}}Ar.type="sampler2D";class Cr extends ir{constructor(e){super(),this.type="float",this.children=[e]}clone(){const e=new Cr(sr(this.children[0]));return super.cloneInto(e),e}multiply(e){return us(this,"number"==typeof e?zr(e,Cr):e)}divide(e){return hs(this,"number"==typeof e?zr(e,Cr):e)}add(e){return ds(this,"number"==typeof e?zr(e,Cr):e)}subtract(e){return ps(this,"number"==typeof e?zr(e,Cr):e)}}Cr.type="float";let Mr=hr=class extends ir{constructor(e,t){super(),this.type="vec2",this.children=[e,t].filter((e=>null!=e))}clone(){const e=new hr(sr(this.children[0]),sr(this.children[1]));return super.cloneInto(e),e}get 0(){return ts(this,"[0]",Cr)}get 1(){return ts(this,"[1]",Cr)}get 2(){throw new Er}get 3(){throw new Er}multiply(e){return us(this,"number"==typeof e?zr(e,Cr):e)}divide(e){return hs(this,"number"==typeof e?zr(e,Cr):e)}add(e){return ds(this,"number"==typeof e?zr(e,Cr):e)}subtract(e){return ps(this,"number"==typeof e?zr(e,Cr):e)}};Mr.type="vec2",Mr=hr=(0,s._)([Tr],Mr);let Fr=dr=class extends ir{constructor(e,t,r){super(),this.type="vec3",this.children=[e,t,r].filter((e=>null!=e))}get 0(){return ts(this,"[0]",Cr)}get 1(){return ts(this,"[1]",Cr)}get 2(){return ts(this,"[2]",Cr)}get 3(){throw new Er}clone(){const e=new dr(sr(this.children[0]),sr(this.children[1]),sr(this.children[2]));return super.cloneInto(e),e}multiply(e){return us(this,"number"==typeof e?zr(e,Cr):e)}divide(e){return hs(this,"number"==typeof e?zr(e,Cr):e)}add(e){return ds(this,"number"==typeof e?zr(e,Cr):e)}subtract(e){return ps(this,"number"==typeof e?zr(e,Cr):e)}};Fr.type="vec3",Fr=dr=(0,s._)([Tr],Fr);let Nr=pr=class extends ir{constructor(e,t,r,s){super(),this.type="vec4",this.children=[e,t,r,s].filter((e=>null!=e))}clone(){const e=new pr(sr(this.children[0]),sr(this.children[1]),sr(this.children[2]),sr(this.children[3]));return super.cloneInto(e),e}get 0(){return ts(this,"[0]",Cr)}get 1(){return ts(this,"[1]",Cr)}get 2(){return ts(this,"[2]",Cr)}get 3(){return ts(this,"[3]",Cr)}multiply(e){return us(this,"number"==typeof e?zr(e,Cr):e)}divide(e){return hs(this,"number"==typeof e?zr(e,Cr):e)}add(e){return ds(this,"number"==typeof e?zr(e,Cr):e)}subtract(e){return ps(this,"number"==typeof e?zr(e,Cr):e)}};Nr.type="vec4",Nr=pr=(0,s._)([Tr],Nr);let Or=_r=class extends ir{constructor(e){super(),this.type="uint",this.children=[e]}clone(){const e=new _r(sr(this.children[0]));return super.cloneInto(e),e}};Or.type="uint",Or=_r=(0,s._)([Tr],Or);let Pr=fr=class extends ir{constructor(e,t){super(),this.type="uvec2",this.children=[e,t].filter((e=>null!=e))}clone(){const e=new fr(sr(this.children[0]),sr(this.children[1]));return super.cloneInto(e),e}};Pr.type="uvec2",Pr=fr=(0,s._)([Tr],Pr);let kr=yr=class extends ir{constructor(e,t,r){super(),this.type="uvec3",this.children=[e,t,r].filter((e=>null!=e))}clone(){const e=new yr(sr(this.children[0]),sr(this.children[1]),sr(this.children[2]));return super.cloneInto(e),e}};kr.type="uvec3",kr=yr=(0,s._)([Tr],kr);let Dr=gr=class extends ir{constructor(e,t,r,s){super(),this.type="uvec4",this.children=[e,t,r,s].filter((e=>null!=e))}clone(){const e=new gr(sr(this.children[0]),sr(this.children[1]),sr(this.children[2]),sr(this.children[3]));return super.cloneInto(e),e}};Dr.type="uvec4",Dr=gr=(0,s._)([Tr],Dr);class Br extends ir{constructor(e){super(),this.type="bool",this.children=[e]}and(e){return xs(this,e)}or(e){return ms(this,e)}clone(){const e=new Br(sr(this.children[0]));return super.cloneInto(e),e}}Br.type="bool";let Lr=mr=class extends ir{constructor(e,t){super(),this.type="bvec2",this.children=[e,t].filter((e=>null!=e))}all(){return bs(this)}any(){return vs(this)}clone(){const e=new mr(sr(this.children[0]),sr(this.children[1]));return super.cloneInto(e),e}};Lr.type="bvec2",Lr=mr=(0,s._)([Tr],Lr);let Ur=xr=class extends ir{constructor(e,t,r){super(),this.type="bvec3",this.children=[e,t,r].filter((e=>null!=e))}all(){return bs(this)}any(){return vs(this)}clone(){const e=new xr(sr(this.children[0]),sr(this.children[1]),sr(this.children[2]));return super.cloneInto(e),e}};function zr(e,t){return"number"==typeof e?new t(e):e}Ur.type="bvec3",Ur=xr=(0,s._)([Tr],Ur);let Gr=br=class extends ir{constructor(e,t,r,s){super(),this.type="bvec4",this.children=[e,t,r,s].filter((e=>null!=e))}all(){return bs(this)}any(){return vs(this)}clone(){const e=new br(sr(this.children[0]),sr(this.children[1]),sr(this.children[2]),sr(this.children[3]));return super.cloneInto(e),e}};Gr.type="bvec4",Gr=br=(0,s._)([Tr],Gr);class Vr extends ir{constructor(e){super(),this.type="int",this.children=[e]}multiply(e){return us(this,zr(e,Vr))}add(e){return ds(this,zr(e,Vr))}subtract(e){return ps(this,zr(e,Vr))}divide(e){return hs(this,zr(e,Vr))}clone(){const e=new Vr(sr(this.children[0]));return super.cloneInto(e),e}}Vr.type="int";let Zr=vr=class extends ir{constructor(e,t){super(),this.type="ivec2",this.children=[e,t].filter((e=>null!=e))}clone(){const e=new vr(sr(this.children[0]),sr(this.children[1]));return super.cloneInto(e),e}};Zr.type="ivec2",Zr=vr=(0,s._)([Tr],Zr);let Hr=wr=class extends ir{constructor(e,t,r){super(),this.type="ivec3",this.children=[e,t,r].filter((e=>null!=e))}clone(){const e=new wr(sr(this.children[0]),sr(this.children[1]),sr(this.children[2]));return super.cloneInto(e),e}};Hr.type="ivec3",Hr=wr=(0,s._)([Tr],Hr);let Wr=Sr=class extends ir{constructor(e,t,r,s){super(),this.type="ivec4",this.children=[e,t,r,s].filter((e=>null!=e))}clone(){const e=new Sr(sr(this.children[0]),sr(this.children[1]),sr(this.children[2]),sr(this.children[3]));return super.cloneInto(e),e}};Wr.type="ivec4",Wr=Sr=(0,s._)([Tr],Wr);class jr extends ir{constructor(e,t,r,s){super(),this.type="mat2",this.children=[e,t,r,s]}clone(){const e=new jr(sr(this.children[0]),sr(this.children[1]),sr(this.children[2]),sr(this.children[3]));return super.cloneInto(e),e}}jr.type="mat2";class Yr extends ir{static identity(){return new Yr(1,0,0,0,1,0,0,0,1)}static fromRotation(e){const t=Ns(e),r=Ss(e);return new Yr(r,t,0,os(t),r,0,0,0,1)}constructor(e,t,r,s,i,n,o,a,c){super(),this.type="mat3",this.children=[e,t,r,s,i,n,o,a,c]}add(e){return ds(this,e)}multiply(e){return us(this,e)}clone(){const e=new Yr(sr(this.children[0]),sr(this.children[1]),sr(this.children[2]),sr(this.children[3]),sr(this.children[4]),sr(this.children[5]),sr(this.children[6]),sr(this.children[7]),sr(this.children[8]));return super.cloneInto(e),e}}Yr.type="mat3";class qr extends ir{static identity(){return new qr(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)}constructor(e,t,r,s,i,n,o,a,c,l,u,h,d,p,_,f){super(),this.type="mat4",this.children=[e,t,r,s,i,n,o,a,c,l,u,h,d,p,_,f]}static fromColumns(e,t,r,s){return new qr(e.x,e.y,e.z,e.w,t.x,t.y,t.z,t.w,r.x,r.y,r.z,r.w,s.x,s.y,s.z,s.w)}multiply(e){return us(this,e)}clone(){const e=new qr(sr(this.children[0]),sr(this.children[1]),sr(this.children[2]),sr(this.children[3]),sr(this.children[4]),sr(this.children[5]),sr(this.children[6]),sr(this.children[7]),sr(this.children[8]),sr(this.children[9]),sr(this.children[10]),sr(this.children[11]),sr(this.children[12]),sr(this.children[13]),sr(this.children[14]),sr(this.children[15]));return super.cloneInto(e),e}}qr.type="mat4";const $r={float:Cr,vec2:Mr,vec3:Fr,vec4:Nr,int:Vr,ivec2:Zr,ivec3:Hr,ivec4:Wr,uint:Or,uvec2:Pr,uvec3:kr,uvec4:Dr,bool:Br,bvec2:Lr,bvec3:Ur,bvec4:Gr},Xr=(...e)=>new Vr(...e),Kr=(...e)=>new Cr(...e),Qr=(...e)=>new Mr(...e),Jr=(...e)=>new Nr(...e),es=(...e)=>new Yr(...e);function ts(e,t,r){const s=new r(new or(t,e,r));return s.isImplicit=!0,s}function rs(e,t,r,s=null){if(s){const i=new s,n=new s(new lr(e,[t,r],!0,!1,i));return n.isImplicit=!0,n}if("float"===t.type||"int"===t.type){const s=new r.constructor(new lr(e,[t,r],!0,!1,r.constructor));return s.isImplicit=!0,s}if(("mat2"===t.type||"mat3"===t.type||"mat4"===t.type)&&"float"!==r.type){const s=new r.constructor(new lr(e,[t,r],!0,!1,r.constructor));return s.isImplicit=!0,s}const i=new t.constructor(new lr(e,[t,r],!0,!1,t.constructor));return i.isImplicit=!0,i}function ss(e,t,r=t.constructor){const s=new r(new lr(e,[t],!1,!1,r));return s.isImplicit=!0,s}function is(e,t,r,s=t.constructor){const i=new s(new lr(e,[t,r],!1,!1,s));return i.isImplicit=!0,i}function ns(e,t,r,s,i=t.constructor){const n=new i(new lr(e,[t,r,s],!1,!1,i));return n.isImplicit=!0,n}function os(e){return us(e,Kr(-1))}function as(e,t,r,s){return new t(new cr(e,t,r,s))}function cs(e,t,r){const s="function"==typeof t?t():t,i="function"==typeof r?r():r,n=new s.constructor(new ar(e,s,i));return n.isImplicit=!0,n}function ls(...e){const t=e.map((([e,t])=>"function"==typeof t?[e,t()]:[e,t])),r=t[0][1].constructor,s=t.findIndex((e=>!0===e[0]));if(-1===s)throw new Error("A cond must have a fallthrough case with `true`/; ");const i=t.slice(0,s),n=t[s][1],o=new r(i.reduceRight(((e,t)=>cs(t[0],t[1],e)),n));return o.isImplicit=!0,o}function us(e,t){return rs("*",e,t)}function hs(e,t){return rs("/",e,t)}function ds(e,t){return rs("+",e,t)}function ps(e,t){return rs("-",e,t)}function _s(e,t){return rs("==",e,t,Br)}function fs(e,t){return rs("<=",e,t,Br)}function ys(e,t){return rs(">",e,t,Br)}function gs(e,t){return rs(">=",e,t,Br)}function ms(...e){return e.length<=1?e[0]:e.slice(1).reduce(((e,t)=>function(e,t){return rs("||",e,t,Br)}(e,t)),e[0])}function xs(...e){return e.length<=1?e[0]:e.slice(1).reduce(((e,t)=>function(e,t){return rs("&&",e,t,Br)}(e,t)),e[0])}function bs(e){return ss("all",e,Br)}function vs(e){return ss("any",e,Br)}function ws(e,t,r){return ns("clamp",e,t,r,e.constructor)}function Ss(e){return ss("cos",e)}function Is(e,t){return is("dot",e,t,Cr)}function Ts(e){return ss("fract",e)}function Es(e){return ss("length",e,Cr)}function Rs(e,t){return is("max",e,t)}function As(e,t){return is("min",e,t)}function Cs(e,t,r){return ns("mix",e,t,r)}function Ms(e,t){return is("mod",e,t)}function Fs(e){return"bool"===e.type?ss("!",e):ss("not",e)}function Ns(e){return ss("sin",e)}function Os(e,t){return is("step",e,t,t.constructor)}function Ps(e,t){return is("texture2D",e,t,Nr)}function ks(e,t,r){const s=t.split("\n");for(const t of s)if(t.trim().length){{let t="";null!=r&&(t+=`/*id:${r??"000"}*/ `),e.body+=t.padEnd(14)}e.body+=" ".repeat(e.indent)+t+"\n"}}class Ds{write(e){for(const t of e.rootOutputNodes())e.shouldPruneOutputNode(t)||(t.variableName=this._write(e,t.node));return e}_createVarName(e,t){let r="";return"boolean"!=typeof t&&"number"!=typeof t&&t.debugInfo.name&&(r=`${t.debugInfo.name}_`),`${r}v${e.varCount++}`}_write(e,t,r=!1){if("number"==typeof t)return t.toString();if("boolean"==typeof t)return t.toString();let s=e.getEmit(t);if(s)return s;switch(t.shaderType){case"scope-node":s=this._writeScopeNode(e,t);break;case"primitive-node":s=this._writePrimitveNode(e,t,r);break;case"function-node":s=this._writeFunctionNode(e,t);break;case"property-access-node":s=this._writePropertyAccessNode(e,t);break;case"text-node":s=t.text;break;case"block-node":s=this._writeBlockNode(e,t);break;case"condition-node":s=this._writeConditionNode(e,t)}return e.setEmit(t,s),s}_writeScopeNode(e,t){const r=new t.child.constructor;r.setDebugName(t.debugInfo.name);const s=this._write(e,r,!0);return ks(e,`{ /*ScopeStart: ${t.uid} ${t.debugInfo.name}*/`),e.indent+=2,ks(e,`${s} = ${this._write(e,t.child)};`),e.indent-=2,ks(e,`} /*ScopeEnd: ${t.uid} ${t.debugInfo.name}*/`),s}_writeConditionNode(e,t){const r=new t.ifTrue.constructor,s=this._write(e,r,!0);ks(e,`if (${this._write(e,t.condition)}) {`),e.indent+=2;const i=e.createSubgraphContext(),n=this._write(i,t.ifTrue);if(e.body+=i.body,n&&ks(e,`${s} = ${n};`),e.indent-=2,ks(e,"}"),t.ifFalse){ks(e,"else {"),e.indent+=2;const r=e.createSubgraphContext(),i=this._write(r,t.ifFalse);e.body+=r.body,i&&ks(e,`${s} = ${i};`),e.indent-=2,ks(e,"}")}return s}_writeBlockNode(e,t){const{captureList:r,generator:s,returnType:i}=t,n={};for(const t in r){if(!r[t])continue;const s=this._write(e,r[t]);n[t]=s}const o=new i,a=this._write(e,o,!0);if(n.out=a,t.subgraph){const r=e.createSubgraphContext(),s=this._write(r,t.subgraph.child),i=r.body;n.subgraph={varName:s,body:i}}const c=s(n);return ks(e,"{\n"),e.indent+=2,ks(e,c),e.indent-=2,ks(e,"}\n"),a}_writePropertyAccessNode(e,t){const r=this._write(e,t.target);return"string"==typeof t.property&&t.property.includes("[")?`${r}${t.property}`:"string"!=typeof t.property?`${r}[${this._write(e,t.property)}]`:`${r}.${t.property}`}_writeFunctionNode(e,t){const r=t.returnType.type;if(t.isInfix){const[s,i]=t.children.map((t=>this._write(e,t))),n=this._createVarName(e,t);return ks(e,`${r.padEnd(5)} ${n} = ${s} ${t.token} ${i};`,t.uid),n}const s=t.children.map((t=>this._write(e,t))).join(", "),i=this._createVarName(e,t);return ks(e,`${r.padEnd(5)} ${i} = ${t.token}(${s});`,t.uid),i}_writePrimitveNode(e,t,r=!1){const s=e.getInput(t);if(s)return s.isUsed=!0,s.variableName;const i=1===t.children.length&&t.children[0]?.type===t.type;if(t.isImplicit||i)return this._write(e,t.children[0]);const n=this._createVarName(e,t);if(r)return ks(e,`${t.type.padEnd(5)} ${n};`,t.uid),n;const o=!t.debugInfo.name&&!t.isMutable;if(o&&"float"===t.type&&"number"==typeof t.children[0])return Number.isInteger(t.children[0])?t.children[0].toFixed(1):t.children[0].toString();if(o&&"int"===t.type&&"number"==typeof t.children[0]&&Number.isInteger(t.children[0]))return t.children[0].toString();const a=t.children.map((t=>this._write(e,t))).join(", ");return"array"===t.type?(ks(e,`${t.type.padEnd(5)} ${n} = [${a}];`,t.uid),n):o?`${t.type}(${a})`:(ks(e,`${t.type.padEnd(5)} ${n} = ${t.type}(${a});`,t.uid),n)}}class Bs{constructor(e,t,r){this.variableName=e,this.variableInputType=t,this.node=r,this.type="shader-input",this.isUsed=!1}clone(){return new Bs(this.variableName,this.variableInputType,sr(this.node))}}class Ls{constructor(e,t,r){this.outVariableName=e,this.outVariableType=t,this.node=r,this.type="shader-output"}clone(){const e=new Ls(this.outVariableName,this.outVariableType,sr(this.node));return e.variableName=this.variableName,e}}class Us{static createVertex(e,t,r,s,i,n){const o=[];for(const t in e){const s=e[t],i=r.get(t);i?o.push(new Bs(i,"builtin",s)):o.push(new Bs("a_"+t,"attribute",s))}for(const e of s){const t=e.uniformHydrated;o.push(new Bs(e.uniformName,"uniform",t))}const a=[];for(const e in t){const r=t[e];"glPosition"===e?a.push(new Ls("gl_Position","builtin",r)):"glPointSize"===e?a.push(new Ls("gl_PointSize","builtin",r)):a.push(new Ls("v_"+e,"varying",r))}return new Us(o,a,i,n)}static createFragment(e,t,r,s,i,n){const o=[],a=Array.from(i.rootOutputNodes());for(const t in e){const s=e[t],i=r.get(t);if(i){o.push(new Bs(i,"builtin",s));continue}const n=a.find((e=>e.node===s));n&&o.push(new Bs(n.outVariableName,n.outVariableType,s))}for(const e of s){const t=e.uniformHydrated;o.push(new Bs(e.uniformName,"uniform",t))}const c=[];for(const e in t){const s=t[e],i=r.get(e);if("discard"===e)c.push(new Ls(null,"discard",s));else{if(!i)throw new Error(`Member ${e} in shader fragment output shoule be tagged as builtin`);c.push(new Ls(i,"builtin",s))}}return new Us(o,c,n)}constructor(e,t,r,s){this.type="shader-graph-context",this.indent=0,this.body="",this.varCount=0,this._inputShaderTypesByNodeUid=new Map,this._nodeEmitMap=new Map;for(const t of e)this._inputShaderTypesByNodeUid.set(t.node.uid,t);this._outputShaderTypes=t,this._transformFeedbackBindings=r,this._transformFeedbackNames=new Set(r.map((e=>"v_"+e.propertyKey))),this._usedInFragmentShader=s}shouldPruneOutputNode(e){return!!this._usedInFragmentShader&&"builtin"!==e.outVariableType&&!this._transformFeedbackNames.has(e.outVariableName)&&!this._usedInFragmentShader.has(e.node.uid)}setEmit(e,t){this._nodeEmitMap.set(e.uid,t)}getEmit(e){return this._nodeEmitMap.get(e.uid)}inputs(){return this._inputShaderTypesByNodeUid.values()}getInput(e){return this._inputShaderTypesByNodeUid.get(e.uid)}*rootOutputNodes(){for(const e of this._outputShaderTypes)yield e}*nodes(){const e=[];for(const t of this._outputShaderTypes.values())e.push(t.node);for(;e.length;){const t=e.pop();"number"!=typeof t&&"boolean"!=typeof t&&e.push(...t.children.filter(Boolean)),yield t}}*nodesOfTypeOrFunction(){for(const e of this.nodes())"number"!=typeof e&&"boolean"!=typeof e&&(yield e)}createSubgraphContext(){const e=this.clone();return e.body="",e.indent=this.indent+2,e._nodeEmitMap=new Map(this._nodeEmitMap),e}clone(){const e=new Us([],this._outputShaderTypes,this._transformFeedbackBindings,this._usedInFragmentShader);return e._inputShaderTypesByNodeUid=this._inputShaderTypesByNodeUid,e.indent=this.indent,e.body=this.body,e.varCount=this.varCount,e._nodeEmitMap=this._nodeEmitMap,e}insertVertexShader(e){e.vertex.code.add(""),this._insertInputs(e,"vertex"),e.vertex.code.add(""),e.vertex.code.add("// OUTPUTS: "),e.vertex.code.add("// --------------------------------------------------------- ");for(const t of this.rootOutputNodes()){const r="builtin"===t.outVariableType;this.shouldPruneOutputNode(t)||(r?e.vertex.code.add(`// ${t.outVariableType.padEnd(7)} ${t.node.type.padEnd(9)} ${t.outVariableName};`):e.vertex.code.add(`${t.outVariableType.padEnd(10)} ${t.node.type.padEnd(9)} ${t.outVariableName};`))}e.vertex.code.add(""),e.vertex.code.add("void main() {"),e.vertex.code.add(" "+this.body.split("\n").join("\n "));for(const t of this.rootOutputNodes())this.shouldPruneOutputNode(t)||e.vertex.code.add(` ${t.outVariableName} = ${t.variableName};`);e.vertex.code.add("}")}insertFragmentShader(e){this._insertInputs(e,"fragment"),e.fragment.code.add(""),e.fragment.code.add("void main() {"),e.fragment.code.add(" "+this.body.split("\n").join("\n "));for(const t of this.rootOutputNodes())"discard"===t.outVariableType?(e.fragment.code.add(" // TODO: Should ensure codegen for discard appears first in fragment shader"),e.fragment.code.add(` if (${t.variableName}) {`),e.fragment.code.add(" discard;"),e.fragment.code.add(" }"),e.fragment.code.add(" ")):e.fragment.code.add(` ${t.outVariableName} = ${t.variableName};`);e.fragment.code.add("}")}_insertInputs(e,t){e[t].code.add("// INPUTS: "),e[t].code.add("// --------------------------------------------------------- ");for(const r of this.inputs())r.isUsed&&"builtin"!==r.variableInputType&&("array"===r.node.type?e[t].code.add(`${r.variableInputType.padEnd(10)} ${r.node.elementType.type.padEnd(9)} ${r.variableName}[${r.node.size}];`):e[t].code.add(`${r.variableInputType.padEnd(10)} ${r.node.type.padEnd(9)} ${r.variableName};`))}}var zs=r(78286),Gs=r(49300),Vs=r(7575);r(1717);const Zs=["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uint","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"],Hs=!1;var Ws,js=r(5732),Ys={exports:{}};void 0!==(Ws=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"])&&(Ys.exports=Ws);const qs=(0,js.g)(Ys.exports);var $s,Xs={exports:{}};void 0!==($s=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"])&&(Xs.exports=$s);const Ks=(0,js.g)(Xs.exports);var Qs,Js,ei={exports:{}};Qs=ei,void 0!==(Js=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT","textureSize","texelFetch"])&&(Qs.exports=Js);const ti=(0,js.g)(ei.exports);var ri=999,si=9999,ii=0,ni=1,oi=2,ai=3,ci=4,li=5,ui=6,hi=7,di=8,pi=9,_i=10,fi=11,yi=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function gi(e){return function(e){var t=function(){var e,t,r,s=0,i=0,n=ri,o=[],a=[],c=1,l=0,u=0,h=!1,d=!1,p="";return function(e){return a=[],null!==e?f(e.replace?e.replace(/\r\n/g,"\n"):e):(o.length&&_(o.join("")),n=_i,_("(eof)"),a)};function _(e){e.length&&a.push({type:yi[n],data:e,position:u,line:c,column:l})}function f(t){var o;for(s=0,r=(p+=t).length;e=p[s],s<r;){switch(o=s,n){case ii:s=x();break;case ni:case oi:s=m();break;case ai:s=b();break;case ci:s=S();break;case fi:s=w();break;case li:s=I();break;case si:s=T();break;case pi:s=g();break;case ri:s=y()}o!==s&&("\n"===p[o]?(l=0,++c):++l)}return i+=s,p=p.slice(s),a}function y(){return o=o.length?[]:o,"/"===t&&"*"===e?(u=i+s-1,n=ii,t=e,s+1):"/"===t&&"/"===e?(u=i+s-1,n=ni,t=e,s+1):"#"===e?(n=oi,u=i+s,s):/\s/.test(e)?(n=pi,u=i+s,s):(h=/\d/.test(e),d=/[^\w_]/.test(e),u=i+s,n=h?ci:d?ai:si,s)}function g(){return/[^\s]/g.test(e)?(_(o.join("")),n=ri,s):(o.push(e),t=e,s+1)}function m(){return"\r"!==e&&"\n"!==e||"\\"===t?(o.push(e),t=e,s+1):(_(o.join("")),n=ri,s)}function x(){return"/"===e&&"*"===t?(o.push(e),_(o.join("")),n=ri,s+1):(o.push(e),t=e,s+1)}function b(){if("."===t&&/\d/.test(e))return n=li,s;if("/"===t&&"*"===e)return n=ii,s;if("/"===t&&"/"===e)return n=ni,s;if("."===e&&o.length){for(;v(o););return n=li,s}if(";"===e||")"===e||"("===e){if(o.length)for(;v(o););return _(e),n=ri,s+1}var r=2===o.length&&"="!==e;if(/[\w_\d\s]/.test(e)||r){for(;v(o););return n=ri,s}return o.push(e),t=e,s+1}function v(e){for(var t,r,s=0;;){if(t=Ks.indexOf(e.slice(0,e.length+s).join("")),r=Ks[t],-1===t){if(s--+e.length>0)continue;r=e.slice(0,1).join("")}return _(r),u+=r.length,(o=o.slice(r.length)).length}}function w(){return/[^a-fA-F0-9]/.test(e)?(_(o.join("")),n=ri,s):(o.push(e),t=e,s+1)}function S(){return"."===e||/[eE]/.test(e)?(o.push(e),n=li,t=e,s+1):"x"===e&&1===o.length&&"0"===o[0]?(n=fi,o.push(e),t=e,s+1):/[^\d]/.test(e)?(_(o.join("")),n=ri,s):(o.push(e),t=e,s+1)}function I(){return"f"===e&&(o.push(e),t=e,s+=1),/[eE]/.test(e)||"-"===e&&/[eE]/.test(t)?(o.push(e),t=e,s+1):/[^\d]/.test(e)?(_(o.join("")),n=ri,s):(o.push(e),t=e,s+1)}function T(){if(/[^\d\w_]/.test(e)){var r=o.join("");return n=qs.indexOf(r)>-1?di:ti.indexOf(r)>-1?hi:ui,_(o.join("")),n=ri,s}return o.push(e),t=e,s+1}}(),r=[];return(r=r.concat(t(e))).concat(t(null))}(e)}const mi=new Set(["GL_OES_standard_derivatives","GL_EXT_frag_depth","GL_EXT_draw_buffers","GL_EXT_shader_texture_lod"]);function xi(e,t){for(let r=t-1;r>=0;r--){const t=e[r];if("whitespace"!==t.type&&"block-comment"!==t.type){if("keyword"!==t.type)break;if("attribute"===t.data||"in"===t.data)return!0}}return!1}function bi(e,t,r,s){s=s||r;for(const i of e)if("ident"===i.type&&i.data===r)return s in t?t[s]++:t[s]=0,bi(e,t,s+"_"+t[s],s);return r}function vi(e,t,r="afterVersion"){function s(e,t){for(let r=t;r<e.length;r++){const t=e[r];if("operator"===t.type&&";"===t.data)return r}return null}const i={data:"\n",type:"whitespace"},n=t=>t<e.length&&/[^\r\n]$/.test(e[t].data);let o=function(e){let t=-1,i=0,n=-1;for(let o=0;o<e.length;o++){const a=e[o];if("preprocessor"===a.type&&(/\#(if|ifdef|ifndef)\s+.+/.test(a.data)?++i:/\#endif\s*.*/.test(a.data)&&--i),"afterVersion"!==r&&"afterPrecision"!==r||"preprocessor"===a.type&&a.data.startsWith("#version")&&(n=Math.max(n,o)),"afterPrecision"===r&&"keyword"===a.type&&"precision"===a.data){const t=s(e,o);if(null===t)throw new Error("precision statement not followed by any semicolons!");n=Math.max(n,t)}t<n&&0===i&&(t=o)}return t+1}(e);n(o-1)&&e.splice(o++,0,i);for(const r of t)e.splice(o++,0,r);n(o-1)&&n(o)&&e.splice(o,0,i)}function wi(e,t,r,s="lowp"){vi(e,[{type:"keyword",data:"out"},{type:"whitespace",data:" "},{type:"keyword",data:s},{type:"whitespace",data:" "},{type:"keyword",data:r},{type:"whitespace",data:" "},{type:"ident",data:t},{type:"operator",data:";"}],"afterPrecision")}function Si(e,t,r,s,i="lowp"){vi(e,[{type:"keyword",data:"layout"},{type:"operator",data:"("},{type:"keyword",data:"location"},{type:"whitespace",data:" "},{type:"operator",data:"="},{type:"whitespace",data:" "},{type:"integer",data:s.toString()},{type:"operator",data:")"},{type:"whitespace",data:" "},{type:"keyword",data:"out"},{type:"whitespace",data:" "},{type:"keyword",data:i},{type:"whitespace",data:" "},{type:"keyword",data:r},{type:"whitespace",data:" "},{type:"ident",data:t},{type:"operator",data:";"}],"afterPrecision")}function Ii(e,t){let r,s,i=-1;for(let n=t;n<e.length;n++){const t=e[n];if("operator"===t.type&&("["===t.data&&(r=n),"]"===t.data)){s=n;break}"integer"===t.type&&(i=parseInt(t.data,10))}return r&&s&&e.splice(r,s-r+1),i}function Ti(e,t){if(e.startsWith("#version 300"))return e;const r=function(e){return Hs?Ei.get(e):null}(e);if(null!=r)return r;const s=gi(e);if("300 es"===function(e,t="100",r="300 es"){const s=/^\s*\#version\s+([0-9]+(\s+[a-zA-Z]+)?)\s*/;for(const i of e)if("preprocessor"===i.type){const e=s.exec(i.data);if(e){const s=e[1].replaceAll(/\s\s+/g," ");if(s===r)return s;if(s===t)return i.data="#version "+r,t;throw new Error("unknown glsl version: "+s)}}return e.splice(0,0,{type:"preprocessor",data:"#version "+r},{type:"whitespace",data:"\n"}),null}(s,"100","300 es"))return e;let i=null,n=null;const o={},a={};for(let e=0;e<s.length;++e){const r=s[e];switch(r.type){case"keyword":t===Ke.Ho.VERTEX_SHADER&&"attribute"===r.data?r.data="in":"varying"===r.data&&(r.data=t===Ke.Ho.VERTEX_SHADER?"out":"in");break;case"builtin":if(/^texture(2D|Cube)(Proj)?(Lod|Grad)?(EXT)?$/.test(r.data.trim())&&(r.data=r.data.replaceAll(/(2D|Cube|EXT)/g,"")),t===Ke.Ho.FRAGMENT_SHADER&&"gl_FragColor"===r.data&&(i||(i=bi(s,o,"fragColor"),wi(s,i,"vec4")),r.data=i),t===Ke.Ho.FRAGMENT_SHADER&&"gl_FragData"===r.data){const t=Ii(s,e+1),i=bi(s,o,"fragData");Si(s,i,"vec4",t,"mediump"),r.data=i}else t===Ke.Ho.FRAGMENT_SHADER&&"gl_FragDepthEXT"===r.data&&(n||(n=bi(s,o,"gl_FragDepth")),r.data=n);break;case"ident":if(Zs.includes(r.data)){if(t===Ke.Ho.VERTEX_SHADER&&xi(s,e))throw new Error("attribute in vertex shader uses a name that is a reserved word in glsl 300 es");r.data in a||(a[r.data]=bi(s,o,r.data)),r.data=a[r.data]}}}for(let e=s.length-1;e>=0;--e){const t=s[e];if("preprocessor"===t.type){const r=t.data.match(/\#extension\s+(.*)\:/);if(r&&r[1]&&mi.has(r[1].trim())){const t=s[e+1];s.splice(e,t&&"whitespace"===t.type?2:1)}const i=t.data.match(/\#ifdef\s+(.*)/);i&&i[1]&&mi.has(i[1].trim())&&(t.data="#if 1");const n=t.data.match(/\#ifndef\s+(.*)/);n&&n[1]&&mi.has(n[1].trim())&&(t.data="#if 0")}}return function(e,t){return Hs&&Ei.set(e,t),t}(e,function(e){return e.map((e=>"eof"!==e.type?e.data:"")).join("")}(s))}const Ei=new Map;class Ri{constructor(e,t,r,s,i=new Map,n=[]){this._context=e,this._locations=s,this._uniformBlockBindings=i,this._transformFeedbackVaryings=n,this._refCount=1,this._compiled=!1,this._linesOfCode=0,this._nameToUniformLocation=new Map,this._nameToUniform1=new Map,this._nameToUniform1v=new Map,this._nameToUniform2=new Map,this._nameToUniform3=new Map,this._nameToUniform4=new Map,this._nameToUniformMatrix3=new Map,this._nameToUniformMatrix4=new Map,e||console.error("RenderingContext isn't initialized!"),0===t.length&&console.error("Shaders source should not be empty!"),this._context.type===Vs.zO.WEBGL2&&(t=Ti(t,Ke.Ho.VERTEX_SHADER),r=Ti(r,Ke.Ho.FRAGMENT_SHADER)),this._vShader=Ai(this._context,Ke.Ho.VERTEX_SHADER,t),this._fShader=Ai(this._context,Ke.Ho.FRAGMENT_SHADER,r),Mi.enabled&&(this._linesOfCode=t.match(/\n/g).length+r.match(/\n/g).length+2,this._context.instanceCounter.increment(Ke._g.LinesOfCode,this._vShader,this._linesOfCode)),this._vShader&&this._fShader||console.error("Error loading shaders!"),this._context.instanceCounter.increment(Ke._g.Shader,this),(0,Gs.CG)()&&(this.vertexShader=t,this.fragmentShader=r),this.usedMemory=t.length+r.length;const o=this._context.gl,a=o.createProgram();if(o.attachShader(a,this._vShader),o.attachShader(a,this._fShader),this._locations.forEach(((e,t)=>o.bindAttribLocation(a,e,t))),this._context.type===Vs.zO.WEBGL2&&this._transformFeedbackVaryings?.length){const e=o;e.transformFeedbackVaryings(a,this._transformFeedbackVaryings,e.SEPARATE_ATTRIBS)}if(o.linkProgram(a),(0,Gs.CG)()&&!o.getProgramParameter(a,o.LINK_STATUS)&&console.error(`Could not link shader\nvalidated: ${o.getProgramParameter(a,o.VALIDATE_STATUS)}, gl error ${o.getError()}, vertex: ${o.getShaderParameter(this._vShader,o.COMPILE_STATUS)}, fragment: ${o.getShaderParameter(this._fShader,o.COMPILE_STATUS)}, info log: ${o.getProgramInfoLog(a)}, vertex source: ${this.vertexShader}, fragment source: ${this.fragmentShader}`),this._context.type===Vs.zO.WEBGL2){const e=o;for(const[t,r]of this._uniformBlockBindings){const s=e.getUniformBlockIndex(a,t);s<4294967295&&e.uniformBlockBinding(a,s,r)}}this._glName=a,this._context.instanceCounter.increment(Ke._g.Program,this)}get glName(){return this._glName}get hasGLName(){return null!=this._glName}get hasTransformFeedbackVaryings(){return!!this._transformFeedbackVaryings?.length}get compiled(){if(this._compiled)return!0;const e=this._context.gl.getExtension("KHR_parallel_shader_compile");return null==e||null==this.glName?(this._compiled=!0,!0):(this._compiled=!!this._context.gl.getProgramParameter(this.glName,e.COMPLETION_STATUS_KHR),this._compiled)}dispose(){if(--this._refCount>0)return;const e=this._context.gl,t=this._context.instanceCounter;this._nameToUniformLocation.forEach((e=>e&&t.decrement(Ke._g.Uniform,e))),this._nameToUniformLocation.clear(),this._vShader&&(this._linesOfCode>0&&(t.decrement(Ke._g.LinesOfCode,this._vShader,this._linesOfCode),this._linesOfCode=0),e.deleteShader(this._vShader),this._vShader=null,t.decrement(Ke._g.Shader,this)),this._fShader&&(e.deleteShader(this._fShader),this._fShader=null),this._glName&&(e.deleteProgram(this._glName),this._glName=null,t.decrement(Ke._g.Program,this))}ref(){++this._refCount}_getUniformLocation(e){const t=this._nameToUniformLocation.get(e);if(void 0!==t)return t;if(this.glName){const t=this._context.gl.getUniformLocation(this.glName,e);return this._nameToUniformLocation.set(e,t),t&&this._context.instanceCounter.increment(Ke._g.Uniform,t),t}return null}hasUniform(e){return null!=this._getUniformLocation(e)}setUniform1i(e,t){const r=this._nameToUniform1.get(e);void 0!==r&&t===r||(this._context.gl.uniform1i(this._getUniformLocation(e),t),this._nameToUniform1.set(e,t))}setUniform1iv(e,t){Ci(this._nameToUniform1v,e,t)&&this._context.gl.uniform1iv(this._getUniformLocation(e),t)}setUniform2iv(e,t){Ci(this._nameToUniform2,e,t)&&this._context.gl.uniform2iv(this._getUniformLocation(e),t)}setUniform3iv(e,t){Ci(this._nameToUniform3,e,t)&&this._context.gl.uniform3iv(this._getUniformLocation(e),t)}setUniform4iv(e,t){Ci(this._nameToUniform4,e,t)&&this._context.gl.uniform4iv(this._getUniformLocation(e),t)}setUniform1f(e,t){const r=this._nameToUniform1.get(e);void 0!==r&&t===r||(this._context.gl.uniform1f(this._getUniformLocation(e),t),this._nameToUniform1.set(e,t))}setUniform1fv(e,t){Ci(this._nameToUniform1v,e,t)&&this._context.gl.uniform1fv(this._getUniformLocation(e),t)}setUniform2f(e,t,r){const s=this._nameToUniform2.get(e);void 0===s?(this._context.gl.uniform2f(this._getUniformLocation(e),t,r),this._nameToUniform2.set(e,[t,r])):t===s[0]&&r===s[1]||(this._context.gl.uniform2f(this._getUniformLocation(e),t,r),s[0]=t,s[1]=r)}setUniform2fv(e,t){Ci(this._nameToUniform2,e,t)&&this._context.gl.uniform2fv(this._getUniformLocation(e),t)}setUniform3f(e,t,r,s){const i=this._nameToUniform3.get(e);void 0===i?(this._context.gl.uniform3f(this._getUniformLocation(e),t,r,s),this._nameToUniform3.set(e,[t,r,s])):t===i[0]&&r===i[1]&&s===i[2]||(this._context.gl.uniform3f(this._getUniformLocation(e),t,r,s),i[0]=t,i[1]=r,i[2]=s)}setUniform3fv(e,t){const r=this._getUniformLocation(e);null!=r&&Ci(this._nameToUniform3,e,t)&&this._context.gl.uniform3fv(r,t)}setUniform4f(e,t,r,s,i){const n=this._nameToUniform4.get(e);void 0===n?(this._context.gl.uniform4f(this._getUniformLocation(e),t,r,s,i),this._nameToUniform4.set(e,[t,r,s,i])):void 0!==n&&t===n[0]&&r===n[1]&&s===n[2]&&i===n[3]||(this._context.gl.uniform4f(this._getUniformLocation(e),t,r,s,i),n[0]=t,n[1]=r,n[2]=s,n[3]=i)}setUniform4fv(e,t){const r=this._getUniformLocation(e);null!=r&&Ci(this._nameToUniform4,e,t)&&this._context.gl.uniform4fv(r,t)}setUniformMatrix3fv(e,t,r=!1){const s=this._getUniformLocation(e);null!=s&&Ci(this._nameToUniformMatrix3,e,t)&&this._context.gl.uniformMatrix3fv(s,r,t)}setUniformMatrix4fv(e,t,r=!1){const s=this._getUniformLocation(e);null!=s&&Ci(this._nameToUniformMatrix4,e,t)&&this._context.gl.uniformMatrix4fv(s,r,t)}stop(){}}function Ai(e,t,r){const s=e.gl,i=s.createShader(t);return s.shaderSource(i,r),s.compileShader(i),(0,Gs.CG)()&&!s.getShaderParameter(i,s.COMPILE_STATUS)&&(console.error("Compile error in ".concat(t===Ke.Ho.VERTEX_SHADER?"vertex":"fragment"," shader")),console.error(s.getShaderInfoLog(i)),console.error(function(e){let t=2;return e.replaceAll("\n",(()=>"\n"+function(e){return e>=1e3?e.toString():(" "+e).slice(-3)}(t++)+":"))}(r))),i}function Ci(e,t,r){const s=e.get(t);if(!s)return e.set(t,Array.from(r)),!0;const i=r.length;if(s.length!==i)return e.set(t,Array.from(r)),!0;for(let e=0;e<i;++e){const t=r[e];if(s[e]!==t){for(s[e]=t;e<i;++e)s[e]=r[e];return!0}}return!1}const Mi={enabled:!1};r(4375);var Fi=r(57088),Ni=(r(11335),r(47859));function Oi(e,t,r){const s=new Ni.X(t.width,t.height);return s.dataType=t.dataType,t.depth&&(s.depth=t.depth),t.flipped&&(s.flipped=t.flipped),t.hasMipmap&&(s.hasMipmap=t.hasMipmap),s.internalFormat=t.internalFormat,t.isImmutable&&(s.isImmutable=t.isImmutable),t.isOpaque&&(s.isOpaque=t.isOpaque),t.maxAnisotropy&&(s.maxAnisotropy=t.maxAnisotropy),s.pixelFormat=t.pixelFormat,t.preMultiplyAlpha&&(s.preMultiplyAlpha=t.preMultiplyAlpha),t.samplingMode&&(s.samplingMode=t.samplingMode),t.target&&(s.target=t.target),s.uniform=t.uniform,t.unpackAlignment&&(s.unpackAlignment=t.unpackAlignment),t.wrapMode&&(s.wrapMode=t.wrapMode),new Fi.x(e,s,r)}function Pi(e,t,r){const s=t.length;if(s!==r){const i=new h.Z("Invalid Uniform",`Invalid length, expected ${r} but got ${s}`,{uniformName:e,values:t});u.Z.getLogger("esri.views.2d.engine.webgl.shaderGraph.typed.TypedShaderProgram").errorOnce(i)}}new Map;class ki{constructor(e,t,r,s,i,n){this._program=null,this._vao=null,this._temporaryTextures=[],this.vertexShader=e,this.fragmentShader=t,this._locations=r,this._locationInfo=s,this._uniformBindings=i,this._transformFeedbackBindings=n}destroy(){this._program&&this._program.dispose(),this.cleanupTemporaryTextures()}get locations(){return this._locations}get locationInfo(){return this._locationInfo}setUniforms(e){this._uniforms=e}cleanupTemporaryTextures(){for(const e of this._temporaryTextures)e.dispose();this._temporaryTextures=[]}bind(e){const t=this._uniforms;if(!this._program){const t=new Map;for(const[e,r]of this._locations)t.set(e,r);const r=[];for(const e of this._transformFeedbackBindings??[]){const{index:t,propertyKey:s}=e;r[t]=`v_${s}`}this._program=new Ri(e,this.vertexShader,this.fragmentShader,t,new Map,r)}const r=this._program;e.useProgram(r);for(const s of this._uniformBindings){const{shaderModulePath:i,uniformName:n,uniformType:o,uniformArrayLength:a}=s,c=(0,zs.hS)(i,t);if(null==c){if("sampler2D"===o)continue;throw new Error(`Failed to find uniform value for ${i}`)}switch("array"===o?s.uniformArrayElementType:o){case"sampler2D":{const{unit:t,texture:s}=c;if(r.setUniform1i(n,t),"type"in s)e.bindTexture(s,t);else{const r=Oi(e,s.descriptor,s.data);e.bindTexture(r,t)}break}case"int":if(!a){r.setUniform1i(n,c);break}Pi(s.uniformName,c,a),r.setUniform1iv(n,c);break;case"float":if(!a){r.setUniform1f(n,c);break}Pi(s.uniformName,c,a),r.setUniform1fv(n,c);break;case"vec2":if(!a){r.setUniform2f(n,c[0],c[1]);break}Pi(s.uniformName,c,a),r.setUniform2fv(n,c.flat());break;case"vec3":if(!a){r.setUniform3f(n,c[0],c[1],c[2]);break}Pi(s.uniformName,c,a),r.setUniform3fv(n,c.flat());break;case"vec4":if(!a){r.setUniform4f(n,c[0],c[1],c[2],c[3]);break}Pi(s.uniformName,c,a),r.setUniform4fv(n,c.flat());break;case"mat3":r.setUniformMatrix3fv(n,c.flat());break;case"mat4":r.setUniformMatrix4fv(n,c.flat());break;default:throw new Error(`Unable to set uniform for type ${o}`)}}}}function Di(e){return new e}function Bi(e,t,r){const s=e.constructor[t]??[];e.constructor.hasOwnProperty(t)||Object.defineProperty(e.constructor,t,{value:s.slice()}),e.constructor[t].push(r)}function Li(e,t){return(r,s)=>{Bi(r,"locations",{typeCtor:t,propertyKey:s,parameterIndex:null,index:e})}}const Ui=e=>(t,r,s)=>{Bi(t,"inputs",{inputCtor:e,propertyKey:r,parameterIndex:s})},zi=e=>(t,r)=>{Bi(t,"uniforms",{typeCtor:e,propertyKey:r})},Gi=e=>(t,r)=>{Bi(t,"options",{typeCtor:e,propertyKey:r})},Vi=(e,t)=>{Bi(e,"defines",{propertyKey:t})},Zi=(e,t)=>(r,s)=>{r.constructor.builtins.push({builtin:e,propertyKey:s,typeCtor:t})};class Hi{}Hi.builtins=[],(0,s._)([Zi("gl_VertexID",Vr)],Hi.prototype,"glVertexID",void 0);class Wi{}class ji{}ji.builtins=[],(0,s._)([Zi("gl_FragCoord",Nr)],ji.prototype,"glFragCoord",void 0),(0,s._)([Zi("gl_PointCoord",Mr)],ji.prototype,"glPointCoord",void 0);class Yi{}(0,s._)([(e,t)=>{Bi(e,"builtins",{builtin:"gl_FragColor",propertyKey:t})}],Yi.prototype,"glFragColor",void 0);class qi{constructor(){this.type="uniform-group"}get _uniforms(){return this.constructor.uniforms??[]}}class $i{constructor(){this.logShader=!1,this.computeAttributes={}}get vertexInput(){const e=(0,J.dF)(this._shaderModuleClass.inputs,(e=>"vertex"===e.propertyKey&&0===e.parameterIndex));if(!e)throw new Error("Unable to find vertex input parameter");return e}get computeInput(){return(0,J.dF)(this._shaderModuleClass.inputs,(e=>"vertex"===e.propertyKey&&1===e.parameterIndex))}get fragmentInput(){const e=(0,J.dF)(this._shaderModuleClass.inputs,(e=>"fragment"===e.propertyKey));if(!e)throw new Error("Unable to find fragment input parameter");return e}get transformFeedbackBindings(){return this.fragmentInput.inputCtor.transformFeedbackBindings??[]}get locations(){return[...this.vertexInput.inputCtor.locations,...this.computeInput?.inputCtor.locations??[]]}get locationsMap(){const e=new Map,t=new Set;for(const r of this.locations)t.has(r.index)?u.Z.getLogger("esri.views.2d.engine.webgl.shaderGraph.GraphShaderModule").warnOnce("mapview-rendering",`Unable to assigned attribute ${r.propertyKey} to ${r.index}. Index already in use`,{locationsMap:e}):(e.set(r.propertyKey,r.index),t.add(r.index));return e}get locationInfo(){if(!this._locationInfo){const e=this.locationsMap,t=Array.from(e.entries()).map((([e,t])=>`${e}.${t}`)).join("."),r=(0,te.hP)(t);this._locationInfo={hash:r,locations:e}}return this._locationInfo}get renamedLocationsMap(){const e=new Map;for(const t of this.locations)e.set("a_"+t.propertyKey,t.index);return e}get optionPropertyKeys(){if(!this._optionPropertyKeys){const e=new Set;for(const t of this._options)e.add(t.propertyKey);this._optionPropertyKeys=e}return this._optionPropertyKeys}get _shaderModuleClass(){return this.constructor}get _defines(){return this._shaderModuleClass.defines??[]}get _options(){return this._shaderModuleClass.options??[]}get _uniforms(){return this._shaderModuleClass.uniforms??[]}getProgram(e,t,r,s){try{const{vertex:i,fragment:n,uniformBindings:o}=this._generateShaders(e,t,r,s);return new ki(i,n,this.renamedLocationsMap,this.locationInfo,o,this.transformFeedbackBindings)}catch(e){return console.error("Failed to create program",{error:e}),new ki("","",this.renamedLocationsMap,this.locationInfo,[],this.transformFeedbackBindings)}}getDebugUniformClassInfo(e){const t=this._options.find((t=>t.propertyKey===e));if(t)return{type:"option",className:t.typeCtor};const r=this._uniforms.find((t=>t.propertyKey===e));if(!r)throw new Error(`Unable to find uniform class type for property: ${e}`);return{type:"required",className:r.typeCtor}}getShaderKey(e,t,r,s){const i=Object.keys(r).map((e=>`${e}.${r[e]}`)).join("."),n=Object.keys(s).map((e=>`${e}.${s[e]}`)).join("."),o=Object.keys(t).filter((e=>this.optionPropertyKeys.has(e)&&t[e])).join(".");return`${this.constructor.name}.${e.hash}.${i}.${n}.${o}`}_generateShaders(e,t,r,s){const i=[];this._setDefines(r),this._setOptionalUniforms(i,t),this._setRequiredUniforms(i);const n=this._hydrateVertexInput(s),o=this._injectPackPrecisionFactor(n,e),a=this._hydrateComputeInput(),c=a&&this._injectPackPrecisionFactor(a,e),l=this.vertex(o,c),u=this._hydrateFragmentInput(l),h=this.fragment(u),d=new Set;for(const e in h)tr(d,h[e]);const p=this._getVertexInputBuiltins(),_=Us.createVertex({...n,...a},l,p,i,this.transformFeedbackBindings,d);(new Ds).write(_);const f=this._getFragmentInputBuiltins(h);f.set("glPointCoord","gl_PointCoord");const y=Us.createFragment(u,h,f,i,_,this.transformFeedbackBindings);(new Ds).write(y);const g=this._createShaderBuilder(_,y),m=g.generate("vertex",!1),x=g.generate("fragment",!1);return this.logShader&&(console.log(m),console.log(x)),{vertex:m,fragment:x,uniformBindings:i}}_setDefines(e){for(const t in e)this[t]=e[t]}_setOptionalUniforms(e,t){for(const r of this._options)t[r.propertyKey]?this[r.propertyKey]=this._hydrateUniformGroup(e,r):this[r.propertyKey]=null}_setRequiredUniforms(e){for(const t of this._uniforms)this[t.propertyKey]=this._hydrateUniformGroup(e,t)}_hydrateUniformGroup(e,t){const r=new(0,t.typeCtor);for(const s of r._uniforms??[]){const i=Di(s.typeCtor),n=`u_${t.propertyKey}_${s.propertyKey}`,o=i.type,a=[t.propertyKey,s.propertyKey].join(".");if("type"in s.typeCtor&&"array"===s.typeCtor.type){const t=i;e.push({shaderModulePath:a,uniformName:n,uniformType:o,uniformArrayLength:t.size,uniformArrayElementType:t.elementType.type,uniformHydrated:i})}else e.push({shaderModulePath:a,uniformName:n,uniformType:o,uniformHydrated:i});r[s.propertyKey]=i}return r}_hydrateVertexInput(e){const t=this.vertexInput.inputCtor,r=t.locations.reduce(((t,r)=>!1===e[r.propertyKey]?t:{...t,[r.propertyKey]:Di(r.typeCtor)}),{});for(const{propertyKey:e,typeCtor:s}of t.builtins){const t=Di(s);r[e]=t}return r}_hydrateComputeInput(){return null==this.computeInput?null:this.computeInput.inputCtor.locations.reduce(((e,t)=>({...e,[t.propertyKey]:Di(t.typeCtor)})),{})}_injectPackPrecisionFactor(e,t){const r={};for(const s in e){const i=e[s],n=t.attributes.find((e=>e.name===s));if(n?.packPrecisionFactor){if("float"!==i.type&&"vec2"!==i.type&&"vec3"!==i.type&&"vec4"!==i.type)throw new Error(`InternalError: packPrecisionFactor requires GenType, but found ${i.type}`);r[s]=i.divide(new Cr(n.packPrecisionFactor))}else r[s]=i}return r}_hydrateFragmentInput(e){const t={};for(const r in e)t[r]=e[r];for(const{propertyKey:e,typeCtor:r}of ji.builtins){const s=Di(r);t[e]=s}return t}_getVertexInputBuiltins(){const e=this.vertexInput.inputCtor,t=new Map;for(const{builtin:r,propertyKey:s}of e.builtins)t.set(s,r);return t}_getFragmentInputBuiltins(e){const t=e.constructor,r=new Map;for(const e of t.builtins??[])r.set(e.propertyKey,e.builtin);return r}_createShaderBuilder(e,t){const r=new jt;return this._insertDebugInfo(r),e.insertVertexShader(r),t.insertFragmentShader(r),r}_insertDebugInfo(e){e.vertex.code.add("// DEFINES: "),e.vertex.code.add("// --------------------------------------------------------- ");for(const t of this._defines)this[t.propertyKey]?e.vertex.code.add(`// ${t.propertyKey}: true`):e.vertex.code.add(`// ${t.propertyKey}: false`);e.vertex.code.add(""),e.vertex.code.add("// OPTIONS: "),e.vertex.code.add("// --------------------------------------------------------- ");for(const t of this._options)this[t.propertyKey]?e.vertex.code.add(`// ${t.propertyKey}: true`):e.vertex.code.add(`// ${t.propertyKey}: false`)}}function Xi(e){const t=Kr(12.9898),r=Kr(78.233),s=Kr(43758.5453);return Ts(Ns(Ms(Is(e,Qr(t,r)),Kr(3.14))).multiply(s))}function Ki(e){return _s(e,Kr(Et))}function Qi(e,t){const r=Kr(2**t);return Ms(function(e){return ss("floor",e)}(e.divide(r)),Kr(2))}function Ji(e,t){return Qi(e,t+1)}class en extends qi{getVisualVariableData(e){if(!this._vvData){const t=this.getAttributeDataCoords(e);this._vvData=Ps(this.visualVariableData,t).setDebugName("storage2")}return this._vvData}getAttributeDataCoords(e){if(!this._uv){const t=function(e){const t=Qi(e.z,7),r=Kr(1).subtract(t),s=e.xyz.subtract(((...e)=>new Fr(...e))(0,0,Kr(128)));return r.multiply(e).add(t.multiply(s))}(e),r=this.size,s=Xr(t.x),i=Xr(t.y).multiply(Xr(256)),n=Xr(t.z).multiply(Xr(256)).multiply(Xr(256)),o=Kr(s.add(i).add(n)),a=Ms(o,r),c=o.subtract(a).divide(r);this._uv=new Mr(a,c).add(.5).divide(r)}return this._uv}getFilterData(e){const t=this.getAttributeDataCoords(e);return Ps(this.filterFlags,t).setDebugName("storage0")}getAnimationData(e){const t=this.getAttributeDataCoords(e);return Ps(this.animation,t).setDebugName("storage1")}getVVData(e){return this.getVisualVariableData(e)}getDataDrivenData0(e){const t=this.getAttributeDataCoords(e);return Ps(this.dataDriven0,t).setDebugName("storage30")}getDataDrivenData1(e){const t=this.getAttributeDataCoords(e);return Ps(this.dataDriven1,t).setDebugName("storage31")}getDataDrivenData2(e){const t=this.getAttributeDataCoords(e);return Ps(this.dataDriven2,t).setDebugName("storage32")}getGPGPUData(e){const t=this.getAttributeDataCoords(e);return Ps(this.gpgpu,t).setDebugName("storage4")}getFilterFlags(e){return(0,n.Z)("webgl-ignores-sampler-precision")?function(e){return ss("ceil",e)}(this.getFilterData(e).x.multiply(Kr(255))):this.getFilterData(e).x.multiply(Kr(255))}getAnimationValue(e){return this.getAnimationData(e).x}getSizeValue(e){return this.getVisualVariableData(e).x}getColorValue(e){return this.getVisualVariableData(e).y}getOpacityValue(e){return this.getVisualVariableData(e).z}getRotationValue(e){return this.getVisualVariableData(e).w}}(0,s._)([zi(Ar)],en.prototype,"filterFlags",void 0),(0,s._)([zi(Ar)],en.prototype,"animation",void 0),(0,s._)([zi(Ar)],en.prototype,"gpgpu",void 0),(0,s._)([zi(Ar)],en.prototype,"visualVariableData",void 0),(0,s._)([zi(Ar)],en.prototype,"dataDriven0",void 0),(0,s._)([zi(Ar)],en.prototype,"dataDriven1",void 0),(0,s._)([zi(Ar)],en.prototype,"dataDriven2",void 0),(0,s._)([zi(Cr)],en.prototype,"size",void 0);class tn extends qi{}(0,s._)([zi(Mr)],tn.prototype,"position",void 0),(0,s._)([zi(Cr)],tn.prototype,"distance",void 0);class rn extends qi{}(0,s._)([zi(Yr)],rn.prototype,"displayViewScreenMat3",void 0),(0,s._)([zi(Yr)],rn.prototype,"displayViewMat3",void 0),(0,s._)([zi(Yr)],rn.prototype,"displayMat3",void 0),(0,s._)([zi(Yr)],rn.prototype,"viewMat3",void 0),(0,s._)([zi(Yr)],rn.prototype,"tileMat3",void 0),(0,s._)([zi(Cr)],rn.prototype,"displayZoomFactor",void 0),(0,s._)([zi(Cr)],rn.prototype,"requiredZoomFactor",void 0),(0,s._)([zi(Mr)],rn.prototype,"tileOffset",void 0),(0,s._)([zi(Cr)],rn.prototype,"currentScale",void 0),(0,s._)([zi(Cr)],rn.prototype,"currentZoom",void 0),(0,s._)([zi(Cr)],rn.prototype,"metersPerSRUnit",void 0);class sn extends Hi{}(0,s._)([Li(0,Fr)],sn.prototype,"id",void 0),(0,s._)([Li(1,Cr)],sn.prototype,"bitset",void 0),(0,s._)([Li(2,Mr)],sn.prototype,"pos",void 0);class nn extends Wi{}(0,s._)([Li(14,Mr)],nn.prototype,"nextPos1",void 0),(0,s._)([Li(15,Mr)],nn.prototype,"nextPos2",void 0);class on extends ji{}class an extends $i{clip(e,t){let r=new Cr(0);const s=this.storage.getFilterFlags(e);if(r=r.add(Kr(2).multiply(Kr(1).subtract(Ji(s,0)))),this.inside?r=r.add(Kr(2).multiply(Kr(1).subtract(Ji(s,1)))):this.outside?r=r.add(Kr(2).multiply(Ji(s,1))):this.highlight&&(r=r.add(Kr(2).multiply(Kr(1).subtract(function(e){return Qi(e,0)}(s))))),null!=t){const e=new Cr(1).subtract(Os(t.x,this.view.currentZoom)),s=Os(t.y,this.view.currentZoom);r=r.add(new Cr(2).multiply(e.add(s)))}return r}getFragmentOutput(e,t,r=new Cr(1/255)){const s=new Yi;return s.glFragColor=this._maybeWriteHittest(t)??this._maybeHighlight(e,r)??e,s}_maybeHighlight(e,t){return this.highlight?new Nr(e.rgb,Os(t,e.a)):null}maybeRunHittest(e,t,r){if(null==this.hittestRequest)return null;const s=this.hittest(e,t,r),i=cs(gs(s,this.hittestRequest.distance),new Cr(2),new Cr(0)),n=function(e){return e.multiply(2).subtract(1)}(this.storage.getAttributeDataCoords(e.id)),o=new Nr(new Cr(1/255),0,0,Os(new Cr(0),s).divide(255));return{glPointSize:new Cr(1),glPosition:new Nr(n,i,1),color:o}}_maybeWriteHittest(e){return null!=this.hittestRequest?e.color:null}}function cn(e,t,r){const s=r.subtract(t),i=ws(function(e,t){return Is(e,function(e){return ss("normalize",e)}(t))}(e.subtract(t),s).divide(Es(s)),new Cr(0),new Cr(1));return function(e,t){return is("distance",e,t,Cr)}(e,t.add(i.multiply(r.subtract(t))))}function ln(e,t,r,s){return _s(function(e){const t=function(e){return ss("abs",e)}(e);return Os(t.x.add(t.y).add(t.z),new Cr(1.05))}(function(e,t,r,s){const i=new Yr(r.x.multiply(s.y).subtract(s.x.multiply(r.y)),s.x.multiply(t.y).subtract(t.x.multiply(s.y)),t.x.multiply(r.y).subtract(r.x.multiply(t.y)),r.y.subtract(s.y),s.y.subtract(t.y),t.y.subtract(r.y),s.x.subtract(r.x),t.x.subtract(s.x),r.x.subtract(t.x)),n=t.x.multiply(r.y.subtract(s.y)),o=r.x.multiply(s.y.subtract(t.y)),a=s.x.multiply(t.y.subtract(r.y)),c=n.add(o).add(a);return new Cr(1).divide(c).multiply(i.multiply(new Fr(1,e)))}(e,t,r,s)),new Cr(1))}function un(e){return e.distance.add(1)}function hn(e,t,r){const{viewMat3:s,tileMat3:i}=e.view,n=s.multiply(i),o=n.multiply(new Fr(t.pos,1)),a=n.multiply(new Fr(r.nextPos1,1)),c=n.multiply(new Fr(r.nextPos2,1));return function(e,t,r,s){const i=function(e,t){return e.x.multiply(t.y).subtract(t.x.multiply(e.y))}(r.subtract(t),s.subtract(t)),n=xs(function(e,t){return rs("<",e,t,Br)}(i,new Cr(Tt)),ys(i,new Cr(-Tt)));return ls([xs(Fs(n),ln(e.xy,t,r,s)),new Cr(-1)],[!0,()=>{const i=cn(e,t,r),n=cn(e,r,s),o=cn(e,s,t);return As(As(i,n),o)}])}(e.hittestRequest.position,o.xy,a.xy,c.xy)}(0,s._)([Vi],an.prototype,"inside",void 0),(0,s._)([Vi],an.prototype,"outside",void 0),(0,s._)([Vi],an.prototype,"highlight",void 0),(0,s._)([zi(en)],an.prototype,"storage",void 0),(0,s._)([zi(rn)],an.prototype,"view",void 0),(0,s._)([Gi(tn)],an.prototype,"hittestRequest",void 0);class dn extends qi{getColor(e,t,r){return ls([ms(Ki(e),r),t],[fs(e,this.values.first()),this.colors.first()],[gs(e,this.values.last()),this.colors.last()],[!0,()=>{const t=this.values.findIndex((t=>ys(t,e))),r=this.values.get(t),s=t.subtract(1),i=this.values.get(s),n=e.subtract(i).divide(r.subtract(i));return Cs(this.colors.get(s),this.colors.get(t),n)}])}}(0,s._)([zi(Rr.ofType(Nr,8))],dn.prototype,"colors",void 0),(0,s._)([zi(Rr.ofType(Cr,8))],dn.prototype,"values",void 0);class pn extends qi{getOpacity(e){return ls([Ki(e),new Cr(1)],[fs(e,this.opacityValues.first()),this.opacities.first()],[gs(e,this.opacityValues.last()),this.opacities.last()],[!0,()=>{const t=this.opacityValues.findIndex((t=>ys(t,e))),r=this.opacityValues.get(t),s=t.subtract(1),i=this.opacityValues.get(s),n=e.subtract(i).divide(r.subtract(i));return Cs(this.opacities.get(s),this.opacities.get(t),n)}])}}function _n(e){return null!=e.visualVariableSizeMinMaxValue||null!=e.visualVariableSizeScaleStops||null!=e.visualVariableSizeStops||null!=e.visualVariableSizeUnitValue}function fn(e,t,r,s=new Br(!1)){if(null==e.visualVariableColor)return r;const i=e.storage.getColorValue(t);return e.visualVariableColor.getColor(i,r,s)}function yn(e,t){if(null==e.visualVariableOpacity)return new Cr(1);const r=e.storage.getOpacityValue(t);return e.visualVariableOpacity.getOpacity(r)}(0,s._)([zi(Rr.ofType(Cr,8))],pn.prototype,"opacities",void 0),(0,s._)([zi(Rr.ofType(Cr,8))],pn.prototype,"opacityValues",void 0);class gn extends sn{}(0,s._)([Li(3,Nr)],gn.prototype,"color",void 0),(0,s._)([Li(4,Mr)],gn.prototype,"zoomRange",void 0);class mn extends an{constructor(){super(...arguments),this.computeAttributes={pos:["nextPos1","nextPos2"]}}vertex(e,t){const r=yn(this,e.id),s=fn(this,e.id,e.color).multiply(r),i=this.view.displayViewScreenMat3.multiply(new Fr(e.pos.xy,1)),n=this.clip(e.id,e.zoomRange);return{glPosition:new Nr(i.xy,n,1),color:s,...this.maybeRunHittest(e,t,null)}}fragment(e){return this.getFragmentOutput(e.color,e,new Cr(0))}hittest(e,t){return hn(this,e,t)}}(0,s._)([Gi(dn)],mn.prototype,"visualVariableColor",void 0),(0,s._)([Gi(pn)],mn.prototype,"visualVariableOpacity",void 0),(0,s._)([(0,s.a)(0,Ui(gn)),(0,s.a)(1,Ui(nn))],mn.prototype,"vertex",null),(0,s._)([(0,s.a)(0,Ui(on))],mn.prototype,"fragment",null);class xn extends qi{getPatternOffsetAtTileOrigin(e,t=new Cr(0),r=new Cr(1)){const s=new Mr(16777216).divide(e);let i=e.multiply(Ts(this.maxIntsToLocalOrigin.multiply(s))).add(this.tileOffsetFromLocalOrigin).subtract(new Cr(.5).multiply(e));return i=new Mr(i.x.multiply(r).subtract(i.y.multiply(t)),i.x.multiply(t).add(i.y.multiply(r))),Ms(i,e)}}(0,s._)([zi(Mr)],xn.prototype,"tileOffsetFromLocalOrigin",void 0),(0,s._)([zi(Mr)],xn.prototype,"maxIntsToLocalOrigin",void 0);class bn extends qi{}(0,s._)([zi(Mr)],bn.prototype,"size",void 0),(0,s._)([zi(Ar)],bn.prototype,"texture",void 0);class vn extends gn{}function wn(e,t){const r=Cs(new Mr(1),new Mr(1/G.Kg),new Mr(Qi(t.bitset,6),Qi(t.bitset,5))),s=e.view.requiredZoomFactor,i=new Mr(t.width,t.height).multiply(r),n=i.multiply(t.scale).multiply(s),o=t.angle.multiply(.024543692606171875),a=Ns(o),c=Ss(o),l=function(e,t,r,s,i){const n=_s(Qi(i,Rt),Kr(1)),o=function(e){return Is(e,Jr(255/256,255/65536,255/16777216,255/4294967296))}(new Nr(e,0));return cs(n,es(s.divide(t.x),r.divide(t.y),0,os(r.divide(t.x)),s.divide(t.y),0,Xi(Qr(o,0)),Xi(Qr(0,o)),1),es(s.divide(t.x),r.divide(t.y),0,os(r.divide(t.x)),s.divide(t.y),0,0,0,1))}(t.id,n,a,c,t.bitset),u=e.localTileOffset.getPatternOffsetAtTileOrigin(i,a,c),h=s.multiply(t.scale).multiply(t.offset.subtract(u)).divide(n),d=new Fr(t.pos,1),p=l.multiply(d).xy.subtract(h),_=t.tlbr.divide(e.mosaicInfo.size.xyxy);let f=Qi(t.bitset,4);return null!=e.visualVariableColor&&(f=cs(Ki(e.storage.getColorValue(t.id)),new Cr(0),f)),{tileTextureCoord:p,tlbr:_,sampleAlphaOnly:f}}function Sn(e,t){const r=Ms(t.tileTextureCoord,new Cr(1)),s=Cs(t.tlbr.xy,t.tlbr.zw,r);let i=Ps(e.mosaicInfo.texture,s);return i=cs(ys(t.sampleAlphaOnly,new Cr(.5)),i.aaaa,i),t.color.multiply(i)}(0,s._)([Li(5,Nr)],vn.prototype,"tlbr",void 0),(0,s._)([Li(6,Cr)],vn.prototype,"width",void 0),(0,s._)([Li(7,Cr)],vn.prototype,"height",void 0),(0,s._)([Li(8,Mr)],vn.prototype,"offset",void 0),(0,s._)([Li(9,Mr)],vn.prototype,"scale",void 0),(0,s._)([Li(10,Cr)],vn.prototype,"angle",void 0);class In extends mn{vertex(e,t){return{...super.vertex(e,t),...wn(this,e)}}fragment(e){const t=Sn(this,e);return this.getFragmentOutput(t,e,new Cr(0))}}(0,s._)([zi(bn)],In.prototype,"mosaicInfo",void 0),(0,s._)([zi(xn)],In.prototype,"localTileOffset",void 0),(0,s._)([(0,s.a)(0,Ui(vn)),(0,s.a)(1,Ui(nn))],In.prototype,"vertex",null),(0,s._)([(0,s.a)(0,Ui(class extends on{}))],In.prototype,"fragment",null);class Tn extends qi{getSize(e,t){const r=this.minMaxValueAndSize.xy,s=this.minMaxValueAndSize.zw;return cs(Ki(e),t,(()=>{const t=ws(e.subtract(r.x).divide(r.y.subtract(r.x)),new Cr(0),new Cr(1));return s.x.add(t.multiply(s.y.subtract(s.x)))}))}}(0,s._)([zi(Nr)],Tn.prototype,"minMaxValueAndSize",void 0);class En extends qi{getSizeForViewScale(e){return ls([fs(e,this.values.first()),this.sizes.first()],[gs(e,this.values.last()),this.sizes.last()],[!0,()=>{const t=this.values.findIndex((t=>ys(t,e))),r=this.values.get(t),s=t.subtract(1),i=this.values.get(s),n=e.subtract(i).divide(r.subtract(i));return Cs(this.sizes.get(s),this.sizes.get(t),n)}])}}(0,s._)([zi(Rr.ofType(Cr,8))],En.prototype,"sizes",void 0),(0,s._)([zi(Rr.ofType(Cr,8))],En.prototype,"values",void 0);class Rn extends qi{getSize(e,t){const r=ls([Ki(e),t],[fs(e,this.values.first()),this.sizes.first()],[gs(e,this.values.last()),this.sizes.last()],[!0,()=>{const t=this.values.findIndex((t=>ys(t,e))),r=this.values.get(t),s=t.subtract(1),i=this.values.get(s),n=e.subtract(i).divide(r.subtract(i));return Cs(this.sizes.get(s),this.sizes.get(t),n)}]);return cs(Ki(r),t,r)}}(0,s._)([zi(Rr.ofType(Cr,8))],Rn.prototype,"sizes",void 0),(0,s._)([zi(Rr.ofType(Cr,8))],Rn.prototype,"values",void 0);class An extends qi{getSize(e,t){return cs(Ki(e),t,e.multiply(this.unitValueToPixelsRatio))}}(0,s._)([zi(Cr)],An.prototype,"unitValueToPixelsRatio",void 0);class Cn extends sn{}(0,s._)([Li(3,Nr)],Cn.prototype,"color",void 0),(0,s._)([Li(4,Mr)],Cn.prototype,"offset",void 0),(0,s._)([Li(5,Mr)],Cn.prototype,"normal",void 0),(0,s._)([Li(6,Cr)],Cn.prototype,"halfWidth",void 0),(0,s._)([Li(7,Cr)],Cn.prototype,"referenceHalfWidth",void 0),(0,s._)([Li(8,Mr)],Cn.prototype,"zoomRange",void 0);class Mn extends on{}class Fn extends qi{}function Nn(e){return Rs(new Cr(wt).multiply(Os(e,new Cr(St))),new Cr(1))}function On(e,t){const{id:r,offset:s,pos:i,normal:n,zoomRange:o}=t,{displayViewScreenMat3:a,displayViewMat3:c}=e.view,l=fn(e,r,t.color),u=yn(e,r),h=function(e,t){const{id:r,halfWidth:s,referenceHalfWidth:i}=t;if(_n(e)){const t=function(e,t,r){if(_n(e)){const s=e.storage.getSizeValue(t);return e.visualVariableSizeMinMaxValue?.getSize(s,r)??e.visualVariableSizeScaleStops?.getSizeForViewScale(e.view.currentScale)??e.visualVariableSizeStops?.getSize(s,r)??e.visualVariableSizeUnitValue?.getSize(s,r)}return r}(e,r,new Cr(2).multiply(i));return new Cr(.5).multiply(s.divide(Rs(i,new Cr(It)))).multiply(t)}return s}(e,t),d=new Cr(.5).multiply(e.antialiasingControls.antialiasing),p=Rs(h.add(d),new Cr(.45)).add(new Cr(.1).multiply(d)),_=Nn(p).multiply(p).multiply(s),f=c.multiply(new Fr(_,new Cr(0))),y=a.multiply(new Fr(i,new Cr(1))).add(f),g=new Cr(2).multiply(Os(h,new Cr(0))).add(e.clip(r,o)),m=new Nr(y.xy,g,1);return{color:l,opacity:u,halfWidth:p,normal:n,scaledOffset:_,scaledHalfWidth:h,glPosition:new Nr(m.xy,g,1)}}function Pn(e,t){const{opacity:r,color:s}=e,i=function(e,t){const{halfWidth:r,normal:s}=e,i=Nn(r),n=Es(s).multiply(r);return ws(i.multiply(r.subtract(n)).divide(t.add(i).subtract(new Cr(1))),new Cr(0),new Cr(1))}(e,t);return r.multiply(s).multiply(i)}(0,s._)([zi(Cr)],Fn.prototype,"antialiasing",void 0),(0,s._)([zi(Cr)],Fn.prototype,"blur",void 0);class kn extends an{constructor(){super(...arguments),this.computeAttributes={pos:["nextPos1","nextPos2"]}}vertex(e,t){const r=On(this,e);return{...r,...this.maybeRunHittest(e,t,r.halfWidth)}}fragment(e){const t=Pn(e,this.antialiasingControls.blur);return this.getFragmentOutput(t,e)}hittest(e,t,r){const{viewMat3:s,tileMat3:i}=this.view,n=s.multiply(i),o=n.multiply(new Fr(e.pos,1)),a=n.multiply(new Fr(t.nextPos1,1)),c=n.multiply(new Fr(t.nextPos2,1)),l=this.hittestRequest.position;return As(cn(l,o.xy,a.xy),cn(l,o.xy,c.xy)).subtract(r)}}(0,s._)([zi(Fn)],kn.prototype,"antialiasingControls",void 0),(0,s._)([Gi(dn)],kn.prototype,"visualVariableColor",void 0),(0,s._)([Gi(pn)],kn.prototype,"visualVariableOpacity",void 0),(0,s._)([Gi(Tn)],kn.prototype,"visualVariableSizeMinMaxValue",void 0),(0,s._)([Gi(En)],kn.prototype,"visualVariableSizeScaleStops",void 0),(0,s._)([Gi(Rn)],kn.prototype,"visualVariableSizeStops",void 0),(0,s._)([Gi(An)],kn.prototype,"visualVariableSizeUnitValue",void 0),(0,s._)([(0,s.a)(0,Ui(Cn)),(0,s.a)(1,Ui(nn))],kn.prototype,"vertex",null),(0,s._)([(0,s.a)(0,Ui(Mn))],kn.prototype,"fragment",null);class Dn extends sn{}(0,s._)([Li(3,Mr)],Dn.prototype,"offset",void 0),(0,s._)([Li(4,Nr)],Dn.prototype,"color",void 0),(0,s._)([Li(5,Mr)],Dn.prototype,"normal",void 0),(0,s._)([Li(6,Cr)],Dn.prototype,"halfWidth",void 0),(0,s._)([Li(7,Cr)],Dn.prototype,"referenceHalfWidth",void 0),(0,s._)([Li(8,Mr)],Dn.prototype,"zoomRange",void 0);class Bn extends Mn{}function Ln(e,t,r){const{id:s,bitset:i}=t,n=Qi(i,0),o=ys(n,new Cr(.5)),a=On(e,t),c=cs(o,a.halfWidth,new Cr(0)),l=yn(e,s),u=fn(e,s,t.color),h=cs(o,t.color,u.multiply(l)),d=e.view.displayViewScreenMat3.multiply(new Fr(t.pos.xy,1)),p=e.clip(t.id),_=new Nr(d.xy,p,1),f=cs(o,a.glPosition,_),y=r&&e.maybeRunHittest(t,r,o);return{isOutline:n,color:h,opacity:new Cr(1),halfWidth:c,normal:a.normal,glPosition:f,...y}}class Un extends an{constructor(){super(...arguments),this.computeAttributes={pos:["nextPos1","nextPos2"]}}}(0,s._)([zi(Fn)],Un.prototype,"antialiasingControls",void 0),(0,s._)([Gi(dn)],Un.prototype,"visualVariableColor",void 0),(0,s._)([Gi(pn)],Un.prototype,"visualVariableOpacity",void 0),(0,s._)([Gi(Tn)],Un.prototype,"visualVariableSizeMinMaxValue",void 0),(0,s._)([Gi(En)],Un.prototype,"visualVariableSizeScaleStops",void 0),(0,s._)([Gi(Rn)],Un.prototype,"visualVariableSizeStops",void 0),(0,s._)([Gi(An)],Un.prototype,"visualVariableSizeUnitValue",void 0);class zn extends Un{vertex(e,t){return Ln(this,e,t)}fragment(e){const{color:t,isOutline:r}=e,s=ys(r,new Cr(.5)),i=cs(s,Pn(e,this.antialiasingControls.blur),t),n=cs(s,new Cr(1/255),new Cr(0));return this.getFragmentOutput(i,e,n)}hittest(e,t,r){return cs(r,un(this.hittestRequest),hn(this,e,t))}}(0,s._)([(0,s.a)(0,Ui(Dn)),(0,s.a)(1,Ui(nn))],zn.prototype,"vertex",null),(0,s._)([(0,s.a)(0,Ui(Bn))],zn.prototype,"fragment",null);class Gn extends gn{}function Vn(e,t){const r=t.tlbr.xy,s=t.tlbr.zw,i=s.x.subtract(r.x),n=r.y.subtract(s.y),o=new Mr(i,n).multiply(t.inverseRasterizationScale),a=o.multiply(e.view.requiredZoomFactor),c=function(e){const t=new Cr(1),r=new Cr(0);return new Yr(t.divide(e.x),r.divide(e.y),0,os(r.divide(e.x)),t.divide(e.y),0,0,0,1)}(a),l=e.localTileOffset.getPatternOffsetAtTileOrigin(o).divide(a),u=new Fr(t.pos,1);return{tileTextureCoord:c.multiply(u).xy.subtract(l),tlbr:t.tlbr.divide(e.mosaicInfo.size.xyxy)}}function Zn(e,t){const r=Ms(e.tileTextureCoord,new Cr(1)),s=Cs(e.tlbr.xy,e.tlbr.zw,r),i=Ps(t.texture,s);return e.color.multiply(i)}(0,s._)([Li(5,Nr)],Gn.prototype,"tlbr",void 0),(0,s._)([Li(6,Cr)],Gn.prototype,"inverseRasterizationScale",void 0);class Hn extends mn{vertex(e,t){return{...super.vertex(e,t),...Vn(this,e)}}fragment(e){const t=Zn(e,this.mosaicInfo);return this.getFragmentOutput(t,e,new Cr(0))}}(0,s._)([zi(bn)],Hn.prototype,"mosaicInfo",void 0),(0,s._)([zi(xn)],Hn.prototype,"localTileOffset",void 0),(0,s._)([(0,s.a)(0,Ui(Gn)),(0,s.a)(1,Ui(nn))],Hn.prototype,"vertex",null),(0,s._)([(0,s.a)(0,Ui(class extends on{}))],Hn.prototype,"fragment",null);class Wn extends Dn{}(0,s._)([Li(9,Nr)],Wn.prototype,"tlbr",void 0),(0,s._)([Li(10,Cr)],Wn.prototype,"inverseRasterizationScale",void 0);class jn extends Bn{}class Yn extends zn{vertex(e,t){return{...Ln(this,e,t),...Vn(this,e)}}fragment(e){const{isOutline:t}=e,r=ys(t,new Cr(.5)),s=cs(r,Pn(e,this.antialiasingControls.blur),Zn(e,this.mosaicInfo)),i=cs(r,new Cr(1/255),new Cr(0));return this.getFragmentOutput(s,e,i)}}(0,s._)([zi(bn)],Yn.prototype,"mosaicInfo",void 0),(0,s._)([zi(xn)],Yn.prototype,"localTileOffset",void 0),(0,s._)([(0,s.a)(0,Ui(Wn)),(0,s.a)(1,Ui(nn))],Yn.prototype,"vertex",null),(0,s._)([(0,s.a)(0,Ui(jn))],Yn.prototype,"fragment",null);const qn=16,$n=.0625;class Xn extends sn{}(0,s._)([Li(3,Nr)],Xn.prototype,"color",void 0),(0,s._)([Li(4,Nr)],Xn.prototype,"tlbr",void 0),(0,s._)([Li(5,Cr)],Xn.prototype,"angle",void 0),(0,s._)([Li(6,Cr)],Xn.prototype,"aux1",void 0),(0,s._)([Li(7,Cr)],Xn.prototype,"aux2",void 0),(0,s._)([Li(8,Mr)],Xn.prototype,"aux3",void 0),(0,s._)([Li(9,Mr)],Xn.prototype,"aux4",void 0),(0,s._)([Li(10,Mr)],Xn.prototype,"zoomRange",void 0);class Kn extends Un{vertex(e,t){const{aux1:r,aux2:s,aux3:i,aux4:n}=e,o={...e,width:r,height:s,offset:i,scale:n.multiply($n)},a=Ln(this,{...e,halfWidth:r.multiply($n),referenceHalfWidth:s.multiply($n),offset:i.multiply($n),normal:n.subtract(128).multiply($n)}),c=wn(this,o),l=ys(a.isOutline,new Cr(.5));return{...a,...c,...this.maybeRunHittest(e,t,l)}}fragment(e){const{isOutline:t}=e,r=ys(t,new Cr(.5)),s=cs(r,Pn(e,this.antialiasingControls.blur),Sn(this,e)),i=cs(r,new Cr(1/255),new Cr(0));return this.getFragmentOutput(s,e,i)}hittest(e,t,r){return cs(r,un(this.hittestRequest),hn(this,e,t))}}(0,s._)([zi(bn)],Kn.prototype,"mosaicInfo",void 0),(0,s._)([zi(xn)],Kn.prototype,"localTileOffset",void 0),(0,s._)([(0,s.a)(0,Ui(Xn)),(0,s.a)(1,Ui(nn))],Kn.prototype,"vertex",null),(0,s._)([(0,s.a)(0,Ui(class extends jn{}))],Kn.prototype,"fragment",null);const Qn=Nt.attributes,Jn=Ut.attributes,eo={createComputedParams:e=>e,attributes:{id:Qn.id,pos:Qn.pos,zoomRange:Qn.zoomRange,tlbr:Qn.tlbr,angle:Qn.angle,color:Qn.color,bitset:{type:Ke.g.UNSIGNED_BYTE,count:1,pack:e=>Ct(e)},aux1:{count:1,type:Ke.g.UNSIGNED_SHORT,pack:e=>Mt(e)},aux2:{count:1,type:Ke.g.UNSIGNED_SHORT,pack:e=>Ft(e)},aux3:{count:2,type:Ke.g.SHORT,pack:({offsetX:e,offsetY:t})=>[(0,nt.F2)(e),(0,nt.F2)(t)]},aux4:{count:2,type:Ke.g.UNSIGNED_BYTE,pack:({scaleX:e,scaleY:t})=>[e*qn,t*qn]}}},to={createComputedParams:e=>e,attributes:{id:Qn.id,pos:Qn.pos,zoomRange:Qn.zoomRange,tlbr:Qn.tlbr,angle:Qn.angle,color:Jn.color,bitset:{type:Ke.g.UNSIGNED_BYTE,count:1,pack:e=>ht([[0,!0]])},aux1:{count:1,type:Ke.g.UNSIGNED_SHORT,pack:e=>(0,nt.F2)(.5*e.width)*qn},aux2:{count:1,type:Ke.g.UNSIGNED_SHORT,pack:e=>(0,nt.F2)(.5*e.referenceWidth)*qn},aux3:{count:2,type:Ke.g.SHORT,packTessellation:({extrusionOffsetX:e,extrusionOffsetY:t})=>[e*qn,t*qn]},aux4:{count:2,type:Ke.g.UNSIGNED_BYTE,packTessellation:({normalX:e,normalY:t})=>[e*qn+128,t*qn+128]}}};class ro extends zt{constructor(){super(...arguments),this.vertexSpec=to}}const so={createComputedParams:e=>e,attributes:{...mt.attributes,...Lt.attributes}},io={createComputedParams:e=>e,attributes:{...mt.attributes,...Ut.attributes}};class no extends zt{constructor(){super(...arguments),this.vertexSpec=io}}const oo={createComputedParams:e=>e,attributes:{pos:{type:Ke.g.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:Ke.g.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:Ke.g.UNSIGNED_BYTE,count:1},offset:{type:Ke.g.BYTE,count:2,packAlternating:{count:4,pack:()=>[[-1,-1],[1,-1],[-1,1],[1,1]]}}}};var ao=r(30729);const co=8388607,lo=e=>e&co;var uo=r(43823);class ho{constructor(e,t,r,s,i,n,o,a,c=[]){this.entityTexel=e,this.anchorX=t,this.anchorY=r,this.directionX=s,this.directionY=i,this.maxScale=n,this.minScale=o,this.referenceBounds=a,this.bounds=c}serialize(e){e.push(this.entityTexel),e.writeF32(this.anchorX),e.writeF32(this.anchorY),e.writeF32(this.directionX),e.writeF32(this.directionY),e.writeF32(this.maxScale),e.writeF32(this.minScale),e.writeF32(this.referenceBounds.size),e.writeF32(this.referenceBounds.offsetX),e.writeF32(this.referenceBounds.offsetY),Z(e,this.bounds)}static deserialize(e){const t=e.readInt32(),r=e.readF32(),s=e.readF32(),i=e.readF32(),n=e.readF32(),o=e.readF32(),a=e.readF32(),c=e.readF32(),l=e.readF32(),u=e.readF32(),h=H(e,uo.Z)??[];return new ho(t,r,s,i,n,o,a,{size:c,offsetX:l,offsetY:u},h)}}var po=r(22021);class _o{static getPlacement(e,t,r,s,i,n){const o=(0,We.W)(r);return o?(-1===t&&e.invertY(),o.execute(e,r,s,i,n)):null}}var fo=r(48050),yo=r(72233);class go{constructor(e){const{offsetX:t,offsetY:r,postAngle:s,fontSize:i,transforms:n}=e;if(this.offsetX=t,this.offsetY=r,this.postAngle=s,this.fontSize=i,this.transforms=n,n&&n.infos.length>1){const e=(0,yo.yl)(i,s,!1,t,r,n);this.fontSize=e.size,this.postAngle=e.rotation,this.offsetX=e.offsetX,this.offsetY=e.offsetY}}}const mo=[4,4],xo=[16,4],bo={topLeft:xo,topRight:xo,bottomLeft:xo,bottomRight:xo},vo=[4,2],wo=[4,6],So={topLeft:vo,topRight:vo,bottomLeft:wo,bottomRight:wo},Io={topLeft:vo,topRight:wo,bottomLeft:vo,bottomRight:wo},To={topLeft:wo,topRight:wo,bottomLeft:mo,bottomRight:mo},Eo={topLeft:mo,topRight:mo,bottomLeft:wo,bottomRight:wo},Ro={topLeft:wo,topRight:mo,bottomLeft:wo,bottomRight:mo},Ao={topLeft:mo,topRight:wo,bottomLeft:mo,bottomRight:wo},Co={createComputedParams:e=>e,attributes:{pos:{type:Ke.g.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:Ke.g.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:Ke.g.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:e})=>ht([[0,e]])},zoomRange:{type:Ke.g.SHORT,count:2,packPrecisionFactor:G.JS,pack:({scaleInfo:e},{tileInfo:t})=>lt(e,t)},offset:{type:Ke.g.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:e})=>{const{bottomLeft:t,bottomRight:r,topLeft:s,topRight:i}=e;return[s,i,t,r]}}},textureUV:{type:Ke.g.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,packTessellation:({texcoords:e})=>{const{bottomLeft:t,bottomRight:r,topLeft:s,topRight:i}=e;return[s,i,t,r]}}},color:{type:Ke.g.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:e})=>e},fontSize:{type:Ke.g.UNSIGNED_BYTE,count:1,packPrecisionFactor:4,packTessellation:({fontSize:e})=>(0,nt.F2)(e)},referenceSize:{type:Ke.g.UNSIGNED_BYTE,count:1,packPrecisionFactor:4,packTessellation:({fontSize:e},{referenceSize:t})=>(0,nt.F2)(t??e)},haloColor:{type:Ke.g.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:e})=>dt(e)},haloFontSize:{type:Ke.g.UNSIGNED_BYTE,count:1,packPrecisionFactor:4,pack:({haloFontSize:e})=>(0,nt.F2)(e)},referenceSymbol:{type:Ke.g.BYTE,count:4,packPrecisionFactor:1,packTessellation:(e,t)=>{if(!e.referenceBounds)return[0,0,0,0];const r=(0,ao.g)(t.horizontalAlignment),s=(0,ao.tf)(t.verticalAlignment),{offsetX:i,offsetY:n,size:o}=e.referenceBounds;return[(0,nt.F2)(i),-(0,nt.F2)(n),(0,nt.F2)(o),r+1<<2|s+1]}}}};class Mo extends tt{constructor(){super(...arguments),this.vertexSpec=Co,this._textMeshParamsPropsInitialized=!1,this.enablePixelBuffering=!0}ensurePacked(e,t,r){super.ensurePacked(e,t,r),this._textMeshParamsPropsInitialized&&!this._evaluator.hasDynamicProperties||(this._textMeshTransformProps=new go(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}_write(e,t,r){const s=this._getShaping();if(!s)return;const i=t.getDisplayId();if(null!=this.evaluatedMeshParams.placement)return this._writePlacedTextMarkers(e,t,s,r);if(r&&r.nextPath())return r.nextPoint(),this._writeGlyphs(e,i,r.x,r.y,s,0);if("esriGeometryPolygon"===t.geometryType){const r=t.readCentroidForDisplay();if(!r)return;const[n,o]=r.coords;return this._writeGlyphs(e,i,n,o,s,0)}if("esriGeometryMultipoint"===t.geometryType){const r=t.readGeometryForDisplay();return void r?.forEachVertex(((t,r)=>this._writeGlyphs(e,i,t,r,s,0)))}const n=t.readXForDisplay(),o=t.readYForDisplay();return this._writeGlyphs(e,i,n,o,s,0)}_writePlacedTextMarkers(e,t,r,s){const i=s??Ve.z.fromFeatureSetReaderCIM(t);if(!i)return;const n=_o.getPlacement(i,-1,this.evaluatedMeshParams.placement,(0,nt.F2)(1),e.id,$e());if(!n)return;const o=t.getDisplayId();let a=n.next();for(;null!=a;){const t=a.tx,s=-a.ty,i=-a.getAngle();this._writeGlyphs(e,o,t,s,r,i),a=n.next()}}_getShaping(){const e=this._textMeshTransformProps,t=this.evaluatedMeshParams;if(!t.glyphs?.glyphs.length)return null;const r=Math.round((0,nt.F2)(e.fontSize)),s=(0,nt.F2)(e.offsetX),i=(0,nt.F2)(e.offsetY),n=(0,po.uZ)((0,nt.F2)(t.lineWidth),32,512),o=G.uk*(0,po.uZ)(t.lineHeightRatio,.25,4);return(0,fo.Nr)(t.glyphs,{scale:r/G.iD,angle:e.postAngle,xOffset:s,yOffset:i,horizontalAlignment:t.horizontalAlignment,verticalAlignment:t.verticalAlignment,maxLineWidth:n,lineHeight:o,decoration:t.decoration,borderLineSizePx:(0,nt.F2)(t.boxBorderLineSize),hasBackground:!!t.boxBackgroundColor,useCIMAngleBehavior:t.useCIMAngleBehavior})}_writeGlyphs(e,t,r,s,i,n,o){const a=this.evaluatedMeshParams,c=this._textMeshTransformProps,l=c.fontSize,u=(0,nt.F2)(c.offsetX),h=(0,nt.F2)(c.offsetY);0!==n&&i.setRotation(n);const d=i.bounds,p=r+d.x+u,_=s+d.y-h,f=2*(a.minPixelBuffer?a.minPixelBuffer/l:1),y=Math.max(d.width,d.height)*f;i.textBox&&(e.recordStart(this.instanceId,this.attributeLayout,i.glyphs[0].textureBinding),this.enablePixelBuffering&&e.recordBounds(p,_,y,y),this._writeTextBox(e,t,r,s,i.textBox,o),e.recordEnd());for(const n of i.glyphs){e.recordStart(this.instanceId,this.attributeLayout,n.textureBinding),this.enablePixelBuffering&&e.recordBounds(p,_,y,y);const{texcoords:i,offsets:c}=n;this._writeQuad(e,t,r,s,{texcoords:i,offsets:c,fontSize:l,color:dt(a.color),isBackground:!1,referenceBounds:o}),e.recordEnd()}}_writeTextBox(e,t,r,s,i,n){const o=this.evaluatedMeshParams,{fontSize:a}=this._textMeshTransformProps,{boxBackgroundColor:c,boxBorderLineColor:l}=o;c&&(this._writeQuad(e,t,r,s,{texcoords:bo,offsets:i.main,color:dt(c),isBackground:!0,fontSize:a,referenceBounds:n}),l||(this._writeQuad(e,t,r,s,{texcoords:To,offsets:i.top,color:dt(c),isBackground:!0,fontSize:a,referenceBounds:n}),this._writeQuad(e,t,r,s,{texcoords:Eo,offsets:i.bot,color:dt(c),isBackground:!0,fontSize:a,referenceBounds:n}),this._writeQuad(e,t,r,s,{texcoords:Ro,offsets:i.left,color:dt(c),isBackground:!0,fontSize:a,referenceBounds:n}),this._writeQuad(e,t,r,s,{texcoords:Ao,offsets:i.right,color:dt(c),isBackground:!0,fontSize:a,referenceBounds:n}))),l&&(this._writeQuad(e,t,r,s,{texcoords:So,offsets:i.top,color:dt(l),isBackground:!0,fontSize:a,referenceBounds:n}),this._writeQuad(e,t,r,s,{texcoords:So,offsets:i.bot,color:dt(l),isBackground:!0,fontSize:a,referenceBounds:n}),this._writeQuad(e,t,r,s,{texcoords:Io,offsets:i.left,color:dt(l),isBackground:!0,fontSize:a,referenceBounds:n}),this._writeQuad(e,t,r,s,{texcoords:Io,offsets:i.right,color:dt(l),isBackground:!0,fontSize:a,referenceBounds:n}))}_writeQuad(e,t,r,s,i){const n=e.vertexCount();this._writeVertex(e,t,r,s,i),e.indexWrite(n+0),e.indexWrite(n+1),e.indexWrite(n+2),e.indexWrite(n+1),e.indexWrite(n+3),e.indexWrite(n+2)}}const Fo={createComputedParams:e=>e,attributes:{...kt.attributes,bitset:{type:Ke.g.UNSIGNED_BYTE,count:1,pack:({shouldSampleAlphaOnly:e,shouldScaleDash:t,isSDF:r})=>ht([[4,e],[2,t],[3,r]])},tlbr:{type:Ke.g.UNSIGNED_SHORT,count:4,pack:({sprite:e})=>{const{rect:t,width:r,height:s}=e,i=t.x+G.s4,n=t.y+G.s4;return[i,n,i+r,n+s]}},accumulatedDistance:{type:Ke.g.UNSIGNED_SHORT,count:1,packTessellation:({distance:e})=>e},segmentDirection:{type:Ke.g.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:e,directionY:t})=>[e,t]}}};var No=r(55308),Oo=r(57490);class Po{static from(e){return"width"in e?this.fromSimpleMeshParams(e):this.fromComplexMeshParams(e)}static fromSimpleMeshParams(e){const t=new Po(e.sprite,e.color,e.outlineColor,e.minPixelBuffer,e.placement,e.scaleInfo,e.effects),{type:r,width:s,height:i,angle:n,outlineSize:o,referenceSize:a,sprite:c,overrideOutlineColor:l}=e;return t.rawWidth=(0,nt.F2)(s),t.rawHeight=(0,nt.F2)(i),t.angle=n,t.outlineSize=(0,nt.F2)(o),t.referenceSize=(0,nt.F2)(a),t.overrideOutlineColor=l,t.offsetX=(0,nt.F2)(e.offsetX),t.offsetY=(0,nt.F2)(e.offsetY),"simple"!==r||c.sdf||(t.rawWidth=c.width,t.rawHeight=c.height),t.sizeRatio=c.sdf?2:1,t._computeSize(e,!1),t}static fromComplexMeshParams(e){const t=new Po(e.sprite,e.color,e.outlineColor,e.minPixelBuffer,e.placement,e.scaleInfo,e.effects);let{alignment:r,transforms:s,size:i,scaleX:n,anchorX:o,anchorY:a,angle:c,colorLocked:l,frameHeight:u,offsetX:h,offsetY:d,outlineSize:p,referenceSize:_,scaleFactor:f,sizeRatio:y,isAbsoluteAnchorPoint:g,rotateClockwise:m,scaleSymbolsProportionally:x,sprite:b}=e;if(s&&s.infos.length>0){const e=(0,yo.yl)(i,c,m,h,d,s);i=e.size,c=e.rotation,h=e.offsetX,d=e.offsetY,m=!1}f&&(i*=f,h*=f,d*=f),t.alignment=r,t.rawHeight=(0,nt.F2)(i),t.rawWidth=t.rawHeight*n*(b.width/b.height),t.referenceSize=(0,nt.F2)(_),t.sizeRatio=y,t.angle=c,t.rotateClockwise=m,t.anchorX=o,t.anchorY=a,t.offsetX=(0,nt.F2)(h),t.offsetY=(0,nt.F2)(d),g&&i&&(t.anchorX=o/i,t.anchorY=a/i);const v=x&&u?i/u:1;return t.outlineSize=0===p||isNaN(p)?0:Math.max((0,nt.F2)(p)*v,.75),t.scaleSymbolsProportionally=x,t.colorLocked=l,t._computeSize(e,!0),t}constructor(e,t,r,s,i,n,o){this.sprite=e,this.color=t,this.outlineColor=r,this.minPixelBuffer=s,this.placement=i,this.scaleInfo=n,this.effects=o,this.rawWidth=0,this.rawHeight=0,this.angle=0,this.outlineSize=0,this.referenceSize=0,this.sizeRatio=1,this.alignment=ct.v2.SCREEN,this.scaleSymbolsProportionally=!1,this.overrideOutlineColor=!1,this.colorLocked=!1,this.anchorX=0,this.anchorY=0,this.computedWidth=0,this.computedHeight=0,this.texXmin=0,this.texYmin=0,this.texXmax=0,this.texYmax=0,this.offsetX=0,this.offsetY=0,this.rotateClockwise=!0}get boundsInfo(){return{size:Math.max(this.computedHeight,this.computedWidth),offsetX:this.offsetX,offsetY:this.offsetY}}_computeSize(e,t){const{sprite:r,hasSizeVV:s}=e,i=!!r.sdf,{rawWidth:n,rawHeight:o,sizeRatio:a,outlineSize:c}=this,l=n*a,u=o*a;if(i&&!s){const e=t&&n>o?l:n,r=o,s=c+2;this.computedWidth=Math.min(e+s,l),this.computedHeight=Math.min(r+s,u)}else this.computedWidth=l,this.computedHeight=u;const h=i?G.qu/Math.max(l,u):1,d=.5*(l-this.computedWidth)*h,p=.5*(u-this.computedHeight)*h,_=r.rect.x+G.s4+d,f=r.rect.y+G.s4+p,y=_+r.width-2*d,g=f+r.height-2*p;this.texXmin=Math.floor(_),this.texYmin=Math.floor(f),this.texXmax=Math.ceil(y),this.texYmax=Math.ceil(g),this.computedWidth*=(this.texXmax-this.texXmin)/(y-_),this.computedHeight*=(this.texYmax-this.texYmin)/(g-f),this.anchorX*=l/this.computedWidth,this.anchorY*=u/this.computedHeight}}const ko=0,Do=1,Bo=2,Lo=3,Uo=4,zo=3.14159265359/180,Go=128/Math.PI;const Vo={createComputedParams:e=>Po.from(e),attributes:{pos:{type:Ke.g.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:Ke.g.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:Ke.g.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:r,overrideOutlineColor:s,colorLocked:i})=>{let n=0;return e.sdf&&(n|=ut(ko)),t===ct.v2.MAP&&(n|=ut(Do)),r&&(n|=ut(Bo)),s&&(n|=ut(Lo)),i&&(n|=ut(Uo)),n}},zoomRange:{type:Ke.g.SHORT,count:2,packPrecisionFactor:G.JS,pack:({scaleInfo:e},{tileInfo:t})=>lt(e,t)},offset:{type:Ke.g.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:r,anchorX:s,anchorY:i,offsetX:n,offsetY:o,rotateClockwise:a})=>{const c=function(e,t,r,s,i=!1){const n=(0,Oo.Ue)(),o=i?1:-1;return e?(0,No.Us)(n,o*zo*e):(0,No.yR)(n),(t||r)&&(0,No.Iu)(n,n,[t,-r]),s&&(0,No.U1)(n,n,o*zo*-s),n}(0,n,o,-e,a),l=-(.5+s)*t,u=-(.5-i)*r,h=[l,u],d=[l+t,u],p=[l,u+r],_=[l+t,u+r];return(0,C.iu)(h,h,c),(0,C.iu)(d,d,c),(0,C.iu)(p,p,c),(0,C.iu)(_,_,c),[h,d,p,_]}}},textureUV:{type:Ke.g.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:r,texYmin:s})=>[[t,s],[e,s],[t,r],[e,r]]}},color:{type:Ke.g.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>dt(e)},outlineColor:{type:Ke.g.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>dt(e)},sizing:{type:Ke.g.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:r,referenceSize:s})=>[pt(Math.max(e,t),128),pt(r,128),pt(s,128),0]},placementAngle:{type:Ke.g.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>function(e){return function(e,t){return e%=256,Math.abs(e>=0?e:e+256)}(e*Go)}(e)},sizeRatio:{type:Ke.g.UNSIGNED_BYTE,count:1,packPrecisionFactor:64,pack:({sizeRatio:e})=>e}}},Zo={createComputedParams:e=>e,attributes:{pos:{type:Ke.g.SHORT,count:2,packPrecisionFactor:10,pack:"position"},id:{type:Ke.g.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:Ke.g.UNSIGNED_BYTE,count:1,pack:e=>0},offset:{type:Ke.g.SHORT,count:2,packPrecisionFactor:16,packAlternating:{count:4,pack:({size:e,outlineWidth:t})=>{const r=Math.round((0,nt.F2)(e+2*t)),s=-r/2,i=-r/2;return[[s,i],[s+r,i],[s,i+r],[s+r,i+r]]}}},texCoords:{type:Ke.g.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:()=>[[0,1],[1,1],[0,0],[1,0]]}},size:{type:Ke.g.UNSIGNED_BYTE,count:2,pack:({size:e})=>[e,e]},referenceSize:{type:Ke.g.UNSIGNED_BYTE,count:1,pack:({size:e})=>(0,nt.F2)(e)},zoomRange:{type:Ke.g.UNSIGNED_BYTE,count:2,pack:({scaleInfo:e},{tileInfo:t})=>lt(e,t)}}},Ho=function(e){const t={};for(const r in e){const s={name:r,constructor:e[r]};t[r]=s}return t}({FillMeshWriter:gt,DotDensityMeshWriter:class extends st{constructor(){super(...arguments),this.vertexSpec=it}createTesselationParams(e){return{inverseArea:1/e.readGeometryArea()}}},ComplexFillMeshWriter:class extends xt{constructor(){super(...arguments),this.vertexSpec=Nt}},PatternFillMeshWriter:xt,OutlineFillMeshWriter:Gt,PatternOutlineFillMeshWriter:class extends Gt{constructor(){super(...arguments),this.vertexSpec=so}_createOutlineWriter(e,t,r,s){return new no(e,t,r,s)}_write(e,t,r){const s=r?.asOptimized()??t.readGeometryForDisplay(),i=this._clip(s);if(!i)return;const n=this.evaluatedMeshParams.sprite?.textureBinding;e.recordStart(this.instanceId,this.attributeLayout,n),this._writeGeometry(e,t,i),this._lineMeshWriter.writeLineVertices(e,Ve.z.fromOptimizedCIM(i,"esriGeometryPolyline"),t),e.recordEnd()}ensurePacked(e,t,r){super.ensurePacked(e,t,r),this._lineMeshWriter.ensurePacked(e,t,r)}enqueueRequest(e,t,r){super.enqueueRequest(e,t,r),this._lineMeshWriter.enqueueRequest(e,t,r)}async loadDependencies(){await Promise.all([super.loadDependencies(),this._lineMeshWriter.loadDependencies()])}},ComplexOutlineFillMeshWriter:class extends Gt{constructor(){super(...arguments),this.vertexSpec=eo}_createOutlineWriter(e,t,r,s){return new ro(e,t,r,s)}_write(e,t,r){const s=r?.asOptimized()??t.readGeometryForDisplay(),i=this._clip(s);if(!i)return;const n=this.evaluatedMeshParams.sprite?.textureBinding;e.recordStart(this.instanceId,this.attributeLayout,n),this._writeGeometry(e,t,i),this._lineMeshWriter.writeLineVertices(e,Ve.z.fromOptimizedCIM(i,"esriGeometryPolyline"),t),e.recordEnd()}ensurePacked(e,t,r){super.ensurePacked(e,t,r),this._lineMeshWriter.ensurePacked(e,t,r)}enqueueRequest(e,t,r){super.enqueueRequest(e,t,r),this._lineMeshWriter.enqueueRequest(e,t,r)}async loadDependencies(){await Promise.all([super.loadDependencies(),this._lineMeshWriter.loadDependencies()])}},MarkerMeshWriter:class extends tt{constructor(){super(...arguments),this.vertexSpec=Vo}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}_write(e,t,r){const s=this.evaluatedMeshParams.sprite?.textureBinding,i=t.getDisplayId();e.recordStart(this.instanceId,this.attributeLayout,s);const n=this.evaluatedMeshParams.minPixelBuffer,o=Math.max(this.evaluatedMeshParams.computedWidth,n),a=Math.max(this.evaluatedMeshParams.computedHeight,n);if(null!=this.evaluatedMeshParams.placement)this._writePlacedMarkers(e,t,r,o,a);else if(r&&r.nextPath()){r.nextPoint();const t=r.x,s=r.y;e.recordBounds(t,s,o,a),this._writeQuad(e,i,t,s)}else if("esriGeometryPolygon"===t.geometryType){const r=t.readCentroidForDisplay();if(!r)return;const[s,n]=r.coords;e.recordBounds(s,n,o,a),this._writeQuad(e,i,s,n)}else if("esriGeometryPoint"===t.geometryType){const r=t.readXForDisplay(),s=t.readYForDisplay();e.recordBounds(r,s,o,a),this._writeQuad(e,i,r,s)}else{const r=t.readGeometryForDisplay();r?.forEachVertex(((t,r)=>{e.recordBounds(t,r,o,a),this._writeQuad(e,i,t,r)}))}e.recordEnd()}_writePlacedMarkers(e,t,r,s,i){const n=r??Ve.z.fromFeatureSetReaderCIM(t)?.clone();if(!n)return;const o=_o.getPlacement(n,-1,this.evaluatedMeshParams.placement,(0,nt.F2)(1),e.id,$e());if(!o)return;const a=t.getDisplayId();let c=o.next();for(;null!=c;){const t=c.tx,r=-c.ty,n=-c.getAngle();e.recordBounds(t,r,s,i),this._writeQuad(e,a,t,r,n),c=o.next()}}_writeQuad(e,t,r,s,i){const n=e.vertexCount(),o=null==i?null:{placementAngle:i};this._writeVertex(e,t,r,s,o),e.indexWrite(n+0),e.indexWrite(n+1),e.indexWrite(n+2),e.indexWrite(n+1),e.indexWrite(n+3),e.indexWrite(n+2)}},PieChartMeshWriter:class extends tt{constructor(){super(...arguments),this.vertexSpec=Zo}_write(e,t){const r=t.getDisplayId();let s,i;if("esriGeometryPoint"===t.geometryType)s=t.readXForDisplay(),i=t.readYForDisplay();else{const e=t.readCentroidForDisplay();if(!e)return;s=e?.coords[0],i=e?.coords[1]}e.recordStart(this.instanceId,this.attributeLayout),e.recordBounds(s,i,this.evaluatedMeshParams.size,this.evaluatedMeshParams.size);const n=e.vertexCount();this._writeVertex(e,r,s,i),e.indexWrite(n+0),e.indexWrite(n+1),e.indexWrite(n+2),e.indexWrite(n+1),e.indexWrite(n+3),e.indexWrite(n+2),e.recordEnd()}},TextMeshWriter:Mo,LineMeshWriter:Bt,TexturedLineMeshWriter:class extends Bt{constructor(e,t,r,s){super(e,t,r,s),this.vertexSpec=Fo,this._tessellationOptions.textured=!0}_write(e,t,r){const s=r??Ve.z.fromFeatureSetReaderCIM(t);if(!s)return;const{sprite:i}=this.evaluatedMeshParams;this._writeGeometry(e,t,s,i?.textureBinding)}},HeatmapMeshWriter:class extends tt{constructor(){super(...arguments),this.vertexSpec=oo}_write(e,t){e.recordStart(this.instanceId,this.attributeLayout);const r=t.getDisplayId();if("esriGeometryPoint"===t.geometryType){const s=t.readXForDisplay(),i=t.readYForDisplay();this._writeQuad(e,r,s,i)}else if("esriGeometryMultipoint"===t.geometryType){const s=t.readGeometryForDisplay();s?.forEachVertex(((t,s)=>{t>=0&&t<=512&&s>=0&&s<=512&&this._writeQuad(e,r,t,s)}))}e.recordEnd()}_writeQuad(e,t,r,s){const i=e.vertexCount();this._writeVertex(e,t,r,s),e.indexWrite(i+0),e.indexWrite(i+1),e.indexWrite(i+2),e.indexWrite(i+1),e.indexWrite(i+3),e.indexWrite(i+2)}},LabelMeshWriter:class extends Mo{constructor(){super(...arguments),this.enablePixelBuffering=!1}_write(e,t,r){if(null!=r)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const r=t.readXForDisplay(),s=t.readYForDisplay();return this._writePoint(e,r,s,t)}case"esriGeometryEnvelope":case"esriGeometryPolygon":case"esriGeometryMultipoint":{const r=t.readCentroidForDisplay();if(!r)return;const[s,i]=r.coords;if(s<0||s>=G.i9||i<0||i>=G.i9)return;return this._writePoint(e,s,i,t)}case"esriGeometryPolyline":u.Z.getLogger("rendering-engine").warnOnce("Polyline labels are currently disabled. To be re-enabled by issue #56041.")}}_writePoint(e,t,r,s){const i=this._getShaping();if(!i)return;let n=this._getPointReferenceBounds();n||(n={offsetX:0,offsetY:0,size:0});const o=i.boundsT,a=(0,ao.kH)(this.evaluatedMeshParams.horizontalAlignment),c=(0,ao.b7)(this.evaluatedMeshParams.verticalAlignment),l=this.evaluatedMeshParams.scaleInfo?.maxScale??0,u=this.evaluatedMeshParams.scaleInfo?.maxScale??0,h=lo(s.getDisplayId());e.metricStart(new ho(h,t,r,a,c,l,u,n)),e.metricBoxWrite(o),this._writeGlyphs(e,s.getDisplayId(),t,r,i,0,n),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}}});async function Wo(e,t,r,s){return Promise.all(r.map((r=>async function(e,t,r,s,i,n,o){const a=Ho[r],c=await le.create(e,t,i),l=new a.constructor(s,c,n,o);return await l.loadDependencies(),l}(e,t,r.meshWriterName,r.id,r.options,s,r.optionalAttributes))))}class jo{constructor(){this._defaultResult=null,this._backgroundFillResult=null}static async from(e,t,r,s){const i=new jo;return i.setDefault(await Wo(e,t,r.meshes,s)),i}size(){return 1}getDefault(){return this._defaultResult}setDefault(e){this._defaultResult=e}getBackgroundFill(){return this._backgroundFillResult}setBackgroundFill(e){this._backgroundFillResult=e}match(e,t){const r=this.doMatch(e,t)||this.getDefault();if(r&&r.length>0){const e=this.getBackgroundFill();if(e)return[...e,...r]}return r}getSortKey(e,t){return 0}doMatch(e,t){return null}async fetchResources(e,t){}}class Yo extends jo{static async fromDictionaryRenderer(e,t,r){return new Yo(e,t,r)}constructor(e,t,r){super(),this._storage=e,this._schema=t,this._viewParams=r,this._hashToGroup=new Map}get fieldMap(){return this._schema.fieldMap}async fetchResources(e,t){const r=t.getCursor(),s=[];for(;r.next();)s.push(this._updateMeshWriterGroup(e,r));await Promise.all(s)}match(e,t){const r=e.getAttributeHash();return this._hashToGroup.get(r)}async _updateMeshWriterGroup(e,t){const r=t.readLegacyFeatureForDisplay(),s=t.getAttributeHash();if(this._hashToGroup.has(s))return;this._hashToGroup.set(s,null);const i=await e.fetchDictionaryResourceImmediate({type:"dictionary-request",feature:r});if(!i)return;const n=await Wo(this._storage,e,i.meshes,this._viewParams);this._hashToGroup.set(s,n)}}class qo extends jo{constructor(e,t){super(),this._intervals=[],this._isMaxInclusive=t,this._field=e}static async fromIntervalSchema(e,t,r,s){const i=await e.createComputedField(r),n=new qo(i,r.isMaxInclusive);await Promise.all(r.intervals.map((async r=>{const i=await Wo(e,t,r.meshes,s);n.add(r,i)})));const o=await Wo(e,t,r.defaultSymbol,s);n.setDefault(o);const a=await Wo(e,t,r.backgroundFill,s);return n.setBackgroundFill(a),n}add(e,t){this._intervals.push({interval:e,result:t}),this._intervals.sort(((e,t)=>e.interval.min-t.interval.min))}size(){return super.size()+this._intervals.length}doMatch(e,t){const r=this._field?.read(e,t);if(null==r||isNaN(r)||r===1/0||r===-1/0)return null;for(let e=0;e<this._intervals.length;e++){const{interval:t,result:s}=this._intervals[e],i=r>=t.min,n=this._isMaxInclusive?r<=t.max:r<t.max;if(i&&n)return s}return null}}class $o extends jo{static async fromLabelSchema(e,t,r,s){const i=r.classes.map((async r=>{const i=await Wo(e,t,r.meshes,s);return{minScale:r.minScale,maxScale:r.maxScale,meshes:i,expression:null,where:await e.createWhereClause(r.where)}})),n=await Promise.all(i);return new $o(n)}constructor(e){super(),this._labels=e}match(e,t){if(!this._labels.length)return null;const r=this._getLabels(t.$view.scale),s=[];for(const t of r)t.where&&!t.where(e)||s.push(...t.meshes);return s}_getLabels(e){return this._labels.filter((t=>this._validForTileScale(t,e)))}_validForTileScale(e,t){const r=t-t/4,s=t+t/2;return(!e.minScale||e.minScale>=r)&&(!e.maxScale||e.maxScale<=s)}}class Xo extends jo{constructor(e,t){super(),this._defaultSymbolSortKey=0,this._nullResult=null,this._resultsMap=new Map,this._fields=[],this._fields=e,this._separator=t||""}static async fromMatcherSchema(e,t,r,s){const i=r.expression?[e.createComputedField({expression:r.expression})]:[r.field?e.createComputedField({field:r.field}):null,r.field2?e.createComputedField({field:r.field2}):null,r.field3?e.createComputedField({field:r.field3}):null],n=(await Promise.all(i)).filter((e=>!!e)),o=new Xo(n,r.fieldDelimiter),a=await Wo(e,t,r.defaultSymbol,s);o.setDefault(a);const c=await Wo(e,t,r.backgroundFill,s);return o.setBackgroundFill(c),await Promise.all(r.map.map((async(r,i)=>{const n=await Wo(e,t,r.symbol,s);"<Null>"===r.value?o.setNullResult(n):o.add(r.value,n,i+1)}))),o}setNullResult(e){this._nullResult=e}getSortKey(e,t){const r=this._getValueFromFields(e,t);if(null==r||""===r||"<Null>"===r)return 0;const s=this._resultsMap.get(r.toString());return s?s.sortKey:this._defaultSymbolSortKey}add(e,t,r){this._resultsMap.set(e.toString(),{meshWriters:t,sortKey:r}),this._defaultSymbolSortKey=Math.max(this._defaultSymbolSortKey,r+1)}size(){return super.size()+this._resultsMap.size}doMatch(e,t){const r=this._getValueFromFields(e,t);if(null!==this._nullResult&&(null==r||""===r||"<Null>"===r))return this._nullResult;if(null==r)return null;const s=r.toString();return this._resultsMap.get(s)?.meshWriters}_getValueFromFields(e,t){const r=[];for(const s of this._fields){const i=s.read(e,t);null==i||""===i?r.push("<Null>"):r.push(i)}return r.join(this._separator)}}async function Ko(e,t,r,s){switch(r.type){case"simple":case"heatmap":case"dot-density":case"pie-chart":return jo.from(e,t,r,s);case"interval":return qo.fromIntervalSchema(e,t,r,s);case"dictionary":return Yo.fromDictionaryRenderer(e,r,s);case"label":return $o.fromLabelSchema(e,t,r,s);case"map":return Xo.fromMatcherSchema(e,t,r,s);case"subtype":return Qo.fromSubtypes(e,t,r,s);case"cluster":return Jo.fromClusterSchema(e,t,r,s);default:throw new Error("Impl")}}class Qo extends jo{constructor(e,t){super(),this._subMatchers=e,this._subtypeField=t}static async fromSubtypes(e,t,r,s){const i=new Map,n=[];for(const o in r.renderers){const a=parseInt(o,10),c=Ko(e,t,r.renderers[o],s).then((e=>i.set(a,e)));n.push(c)}return await Promise.all(n),new Qo(i,r.subtypeField)}match(e,t){const r=e.readAttribute(this._subtypeField),s=this._subMatchers.get(r);return s?s.match(e,t):null}}class Jo extends jo{static async fromClusterSchema(e,t,r,s){const[i,n]=await Promise.all([Ko(e,t,r.feature,s),Ko(e,t,r.cluster,s)]);return new Jo(i,n)}constructor(e,t){super(),this._featureMatcher=e,this._clusterMatcher=t}match(e,t){return 1===e.readAttribute("cluster_count")?this._featureMatcher.match(e,t):this._clusterMatcher.match(e,t)}}class ea extends Q{static async create(e,t,r,s){const i=await Ko(e,t,r.symbology,s),n=r.labels?await Ko(e,t,r.labels,s):null;return new ea(i,n)}constructor(e,t){super(),this._symbology=e,this._labels=t}destroy(){}async enqueueMatcherRequests(e,t){await Promise.all([this._symbology.fetchResources(e,t),this._labels?.fetchResources(e,t)])}enqueueWriterRequests(e,t,r){const s=this._symbology.match(t,r);if(s){for(const i of s)i.enqueueRequest(e,t,r);if(this._labels){const s=this._labels.match(t,r);if(!s)return;for(const i of s)i.enqueueRequest(e,t,r)}}}write(e,t,r,s){const i=this._symbology.match(r,s);if(!i)return;const n=e.indexCount();for(const n of i)n.write(e,t,r,s);if(n!==e.indexCount()&&this._labels){const n=this._labels.match(r,s);if(!n)return;for(const o of n)o.setReferences(i),o.write(e,t,r,s)}}getSortKey(e,t){return this._symbology.getSortKey(e,t)}}class ta{}class ra extends ta{constructor(e){super(),this._fetcher=e,this._controller=new AbortController,this._pendingRequests=[],this._resourceIdToResource=new Map}destory(){this._controller.abort()}get _abortOptions(){return{signal:this._controller.signal}}enqueueRequest(e){const t=(0,te.hP)(JSON.stringify(e));return this._pendingRequests.push({...e,resourceId:t}),t}async fetchEnqueuedResources(){const e=this._pendingRequests;this._pendingRequests=[];const t=await this._fetcher.fetch(e,this._abortOptions);for(let r=0;r<t.length;r++){const s=e[r].resourceId;this._resourceIdToResource.set(s,t[r])}}async fetchResourceImmediate(e){const t=await this._fetcher.fetch([e],this._abortOptions);if(1!==t.length)throw new Error("FeaturePipelineResourceProxy: failed to fetch resources");return t[0]}async fetchDictionaryResourceImmediate(e){const t=await this._fetcher.fetchDictionary([e],this._abortOptions);if(1!==t.length)throw new Error("FeaturePipelineResourceProxy: failed to fetch dictionary resources");return t[0]}getResource(e){return this._resourceIdToResource.get(e)}}var sa=r(84864),ia=r(98732),na=r(70272);class oa{static async create(e,t){if("count"===t.statisticType){const e=new oe(1);return new oa(t.name,t.alias,t.type,t.statisticType,e)}const r=await e.createComputedField({expression:t.onStatisticExpression?.expression,field:t.onStatisticField});return new oa(t.name,t.alias,t.type,t.statisticType,r)}constructor(e,t,r,s,i){this.name=e,this.alias=t,this.type=r,this.statisticType=s,this.computed=i}}var aa=r(3489),ca=r(32448),la=r(60437),ua=r(65326);class ha{constructor(e){this.subscription=e,this.handledChunks=new Set}destroy(){}*features(){}}class da{constructor(e,t){this._source=e,this._attributeStore=t,this._sendStates=new Map,this.events=new ca.Z,this.featureAdapter=ua.n}destroy(){}onSubscribe(e){const t=this.createState(e);this._sendStates.set(e.key.id,t),this.updateChunks()}onUnsubscribe(e){this._sendStates.get(e.key.id)?.destroy(),this._sendStates.delete(e.key.id)}invalidate(){const e=Array.from(this._sendStates.values());this._sendStates.clear();for(const t of e)t.destroy(),this.onSubscribe(t.subscription)}invalidateAttributeData(){}getDisplayIds(e){const t=new Set(e),r=[];for(const e of this._sendStates.values())for(const s of e.features())t.has(s.objectId)&&(r.push(s.displayId),t.delete(s.objectId));return r}getFeatureObjectIdsForAggregate(e){throw new Error("InternalError: AggregateId lookup not supported")}forEach(e){for(const t of this._sendStates.values())for(const r of t.features())e(r)}forEachInBounds(e,t){}forEachBounds(e,t){const r=(0,la.Ue)();for(const s of e){const e=(0,ia.$)(r,s.geometry,!1,!1);e&&t(e)}}}class pa extends ha{}class _a extends da{constructor(e,t,r,s){super(e,t),this.spatialReference=r,this.aggregateFields=s}get aggregateQueryEngine(){return this._aggregateQueryEngine||(this._aggregateQueryEngine=new aa.q({featureStore:this,fieldsIndex:new z.Z(this.aggregateFields),geometryType:"esriGeometryPolygon",objectIdField:"aggregateId",hasM:!1,hasZ:!1,spatialReference:this.spatialReference,cacheSpatialQueries:!0})),this._aggregateQueryEngine}async*applyOverride(e){this._attributeStore.incrementDisplayIdGeneration();for(const e of this._sendStates.values())e.reset()}async*updateChunks(){if(this._source.chunks().length)for(const e of this._sendStates.values())yield*this._update(e,this._source)}}class fa{constructor(e,t,r,s,i){this.subscription=e,this.reader=t,this.clear=r,this.end=s,this.debugInfo=i,this.type="append"}get id(){return this.subscription.tile.id}createMessage(e,t){return{type:"append",clear:this.clear,id:this.id,append:e,end:this.end,debugInfo:this.debugInfo,subscriptionVesrion:this.subscription.version,version:t}}}class ya{constructor(e,t,r,s,i){this.subscription=e,this.reader=t,this.remove=r,this.end=s,this.debugInfo=i,this.type="update"}get id(){return this.subscription.tile.id}createMessage(e,t){return{type:"update",id:this.id,modify:e,debugInfo:this.debugInfo,remove:this.remove,version:t,subscriptionVesrion:this.subscription.version,end:this.end}}}class ga extends ne{constructor(e){super(),this._field=e}resize(e){throw new Error("Method not implemented.")}read(e,t){return e.readAttribute(this._field)}readWithDefault(e,t){return e.readAttribute(this._field)}referencesScale(){return!1}referencesGeometry(){return!1}}var ma=r(59266);function xa(e){return null==e||e===1/0||e===-1/0||"number"==typeof e&&isNaN(e)}class ba extends ne{static async create(e,t){const r=await(0,ma.Yi)(e,t.spatialReference,t.fields);return new ba(r)}constructor(e){super(),this._compiled=e}resize(e){}read(e,t){return function(e,t,r){if(null==e)return null;const s=t.readArcadeFeature();t.contextTimeZone=r.$view?.timeZone;try{return e.evaluate({...r,$feature:s},e.services)}catch(e){return u.Z.getLogger("esri.views.2d.support.arcadeOnDemand").warn("Feature arcade evaluation failed:",e),null}}(this._compiled,e,t)}readWithDefault(e,t,r){return function(e,t,r,s){if(null==e)return null!=s?s:null;const i=t.readArcadeFeature(),n=e.evaluate({...r,$feature:i},e.services);return xa(n)?null!=s?s:null:n}(this._compiled,e,t,r)}referencesScale(){return this._compiled?.referencesScale()??!1}referencesGeometry(){return this._compiled?.referencesGeometry()??!1}}class va extends ne{constructor(e,t){super(),this._field=e,this._normalizationInfo=t}resize(e){throw new Error("Method not implemented.")}read(e,t){return this._readNormalized(e)}readWithDefault(e,t){return this._readNormalized(e)}referencesScale(){return!1}referencesGeometry(){return!1}_readNormalized(e){const t=e.readAttribute(this._field);if(null==t)return null;const{normalizationField:r,normalizationTotal:s,normalizationType:i}=this._normalizationInfo,n=e.readAttribute(r);switch(i??"esriNormalizeByField"){case"esriNormalizeByField":return n?n?t/n:void 0:null;case"esriNormalizeByLog":return Math.log(t)*Math.LOG10E;case"esriNormalizeByPercentOfTotal":return s?t/s*100:null}}}class wa{static fromBuffer(e,t){return new wa(e,t)}static create(e,t=4294967295){const r=new Uint32Array(Math.ceil(e/32));return new wa(r,t)}constructor(e,t){this._mask=0,this._buf=e,this._mask=t}_getIndex(e){return Math.floor(e/32)}has(e){const t=this._mask&e;return!!(this._buf[this._getIndex(t)]&1<<t%32)}hasRange(e,t){let r=e,s=t;for(;r%32&&r!==s;){if(this.has(r))return!0;r++}for(;s%32&&r!==s;){if(this.has(r))return!0;s--}if(r===s)return!1;for(let e=r/32;e!==s/32;e++)if(this._buf[e])return!0;return!1}set(e){const t=this._mask&e,r=this._getIndex(t),s=1<<t%32;this._buf[r]|=s}setRange(e,t){let r=e,s=t;for(;r%32&&r!==s;)this.set(r++);for(;s%32&&r!==s;)this.set(s--);if(r!==s)for(let e=r/32;e!==s/32;e++)this._buf[e]=4294967295}unset(e){const t=this._mask&e,r=this._getIndex(t),s=1<<t%32;this._buf[r]&=4294967295^s}resize(e){const t=this._buf,r=new Uint32Array(Math.ceil(e/32));r.set(t),this._buf=r}or(e){for(let t=0;t<this._buf.length;t++)this._buf[t]|=e._buf[t];return this}and(e){for(let t=0;t<this._buf.length;t++)this._buf[t]&=e._buf[t];return this}xor(e){for(let t=0;t<this._buf.length;t++)this._buf[t]^=e._buf[t];return this}ior(e){for(let t=0;t<this._buf.length;t++)this._buf[t]|=~e._buf[t];return this}iand(e){for(let t=0;t<this._buf.length;t++)this._buf[t]&=~e._buf[t];return this}ixor(e){for(let t=0;t<this._buf.length;t++)this._buf[t]^=~e._buf[t];return this}any(){for(let e=0;e<this._buf.length;e++)if(this._buf[e])return!0;return!1}copy(e){for(let t=0;t<this._buf.length;t++)this._buf[t]=e._buf[t];return this}clone(){return new wa(this._buf.slice(),this._mask)}clear(){for(let e=0;e<this._buf.length;e++)this._buf[e]=0;return this}forEachSet(e){for(let t=0;t<this._buf.length;t++){let r=this._buf[t],s=32*t;if(r)for(;r;)1&r&&e(s),r>>>=1,s++}}countSet(){let e=0;return this.forEachSet((t=>{e++})),e}}var Sa=r(42033);const Ia=()=>u.Z.getLogger("esri.views.2d.layers.features.support.whereUtils"),Ta={getAttribute:(e,t)=>e.readAttribute(t)};async function Ea(e,t){try{const r=await(0,Sa.E)(e,t);if(!r.isStandardized){const e=new h.Z("mapview - bad input","Unable to apply filter's definition expression, as expression is not standardized.",r);Ia().error(e)}return e=>{const t=e.readArcadeFeature();return r.testFeature(t,Ta)}}catch(t){return Ia().warn("mapview-bad-where-clause","Encountered an error when evaluating where clause",e),e=>!0}}const Ra=()=>u.Z.getLogger("esri.views.2d.layers.features.support.ComputedAttributeStorage"),Aa=4294967295;function Ca(e,t,r){if(!(e.length>t))for(;e.length<=t;)e.push(r)}class Ma{constructor(e){this._numerics=[],this._strings=[],this._allocatedSize=256,this._bitsets=[],this._instanceIds=[],this._bounds=[],this._dirtyBitset=this.getBitset(this.createBitset()),this.compilationOptions=e}createBitset(){const e=this._bitsets.length;return this._bitsets.push(wa.create(this._allocatedSize,co)),e+1}async createComputedField(e){if(e.expression)try{if(!this.compilationOptions)throw new Error("InternalError: Compilation options not defined");return await ba.create(e.expression,this.compilationOptions)}catch(t){const r=new h.Z("featurelayer","Failed to compile arcade expression",{error:t,expression:e.expression});return Ra().error(r),null}if(e.normalizationType||e.normalizationField)return new va(e.field,e);if(e.field)return new ga(e.field);const t=new h.Z("featurelayer","Unable to create computed field. No expression or field found",{info:e});return Ra().error(t),null}async createWhereClause(e){return e?Ea(e,this.compilationOptions.fields):null}getBitset(e){return this._bitsets[e-1]}getComputedNumeric(e,t){return this.getComputedNumericAtIndex(e&co,0)}setComputedNumeric(e,t,r){return this.setComputedNumericAtIndex(e&co,r,0)}getComputedString(e,t){return this.getComputedStringAtIndex(e&co,0)}setComputedString(e,t,r){return this.setComputedStringAtIndex(e&co,0,r)}getComputedNumericAtIndex(e,t){const r=e&co;return this._ensureNumeric(t,r),this._numerics[t][r]}setComputedNumericAtIndex(e,t,r){const s=e&co;this._ensureNumeric(t,s),this._numerics[t][s]=r}getPackedChunkId(e){const t=e&co;return this._ensureInstanceId(t),this._instanceIds[t]}setPackedChunkId(e,t){const r=e&co;this._ensureInstanceId(r),this._instanceIds[r]=t}getComputedStringAtIndex(e,t){const r=e&co;return this._ensureString(t,r),this._strings[t][r]}setComputedStringAtIndex(e,t,r){const s=e&co;this._ensureString(t,s),this._strings[t][s]=r}getXMin(e){return this._bounds[4*(e&co)]}getYMin(e){return this._bounds[4*(e&co)+1]}getXMax(e){return this._bounds[4*(e&co)+2]}getYMax(e){return this._bounds[4*(e&co)+3]}setBounds(e,t,r=!1){const s=e&co;if(!r&&!this._dirtyBitset.has(e))return this._bounds[4*s]!==Aa;this._dirtyBitset.unset(e);const i=t.readGeometryWorldSpace();if(Ca(this._bounds,4*s+4,0),!i||!i.coords.length)return this._bounds[4*s]=Aa,this._bounds[4*s+1]=Aa,this._bounds[4*s+2]=Aa,this._bounds[4*s+3]=Aa,!1;let n=1/0,o=1/0,a=-1/0,c=-1/0;return i.forEachVertex(((e,t)=>{n=Math.min(n,e),o=Math.min(o,t),a=Math.max(a,e),c=Math.max(c,t)})),this._bounds[4*s]=n,this._bounds[4*s+1]=o,this._bounds[4*s+2]=a,this._bounds[4*s+3]=c,!0}getBounds(e,t){const r=this.getXMin(t),s=this.getYMin(t),i=this.getXMax(t),n=this.getYMax(t);return(0,la.bZ)(e,r,s,i,n),r!==Aa}_ensureNumeric(e,t){this._numerics[e]||(this._numerics[e]=[]),Ca(this._numerics[e],t,0)}_ensureInstanceId(e){Ca(this._instanceIds,e,0)}_ensureString(e,t){this._strings[e]||(this._strings[e]=[]),Ca(this._strings[e],t,null)}}var Fa=r(20322),Na=r(22222),Oa=r(10402),Pa=r(17590),ka=r(14165);class Da{getObjectId(e){return e.getObjectId()}getAttributes(e){return e.readAttributes()}getAttribute(e,t){return e.readAttribute(t)}getAttributeAsTimestamp(e,t){return e.readAttributeAsTimestamp(t)}cloneWithGeometry(e,t){return e}getGeometry(e){return e.readGeometryWorldSpace()}getCentroid(e,t){return e.readCentroidForDisplay()}}Da.Shared=new Da;class Ba{constructor(e){this._geometryBounds=(0,D.Ue)(),this._idToVisibility=new Map,this._serviceInfo=e}static async create(e){const t=new Ba(e);return await t.update(e.filterJSON,e.spatialReference),t}get hash(){return this._hash}check(e){return this._applyFilter(e)}clear(){const e=this._resetAllHiddenIds();return this.update(),{show:e,hide:[]}}invalidate(){this._idToVisibility.forEach(((e,t)=>{this._idToVisibility.set(t,0)}))}setKnownIds(e){for(const t of e)this._idToVisibility.set(t,1)}setTrue(e){const t=[],r=[],s=new Set(e);return this._idToVisibility.forEach(((e,i)=>{const n=!!(1&this._idToVisibility.get(i)),o=s.has(i);!n&&o?t.push(i):n&&!o&&r.push(i),this._idToVisibility.set(i,o?3:0)})),{show:t,hide:r}}createQuery(){const{geometry:e,spatialRel:t,where:r,timeExtent:s,objectIds:i}=this;return ka.Z.fromJSON({geometry:e,spatialRel:t,where:r,timeExtent:s,objectIds:i})}async update(e,t){this._hash=JSON.stringify(e);const r=await(0,Na.j6)(e,null,t);await Promise.all([this._setGeometryFilter(r),this._setIdFilter(r),this._setAttributeFilter(r),this._setTimeFilter(r)])}async _setAttributeFilter(e){if(!e?.where)return this._clause=null,void(this.where=null);this._clause=await Ea(e.where,this._serviceInfo.fieldsIndex),this.where=e.where}_setIdFilter(e){this._idsToShow=e?.objectIds&&new Set(e.objectIds),this._idsToHide=e?.hiddenIds&&new Set(e.hiddenIds),this.objectIds=e?.objectIds}async _setGeometryFilter(e){if(!e?.geometry)return this._spatialQueryOperator=null,this.geometry=null,void(this.spatialRel=null);const t=e.geometry,r=e.spatialRel||"esriSpatialRelIntersects",s=await(0,Oa.cW)(r,t,this._serviceInfo.geometryType,this._serviceInfo.hasZ,this._serviceInfo.hasM);(0,Fa.$P)(this._geometryBounds,t),this._spatialQueryOperator=s,this.geometry=t,this.spatialRel=r}_setTimeFilter(e){if(this.timeExtent=this._timeOperator=null,e?.timeExtent)if(this._serviceInfo.timeInfo)this.timeExtent=e.timeExtent,this._timeOperator=(0,Pa.y)(this._serviceInfo.timeInfo,e.timeExtent,Da.Shared);else{const t=new h.Z("feature-layer-view:time-filter-not-available","Unable to apply time filter, as layer doesn't have time metadata.",e.timeExtent);u.Z.getLogger("esri.views.2d.layers.features.controllers.FeatureFilter").error(t)}}_applyFilter(e){return this._filterByGeometry(e)&&this._filterById(e)&&this._filterByTime(e)&&this._filterByExpression(e)}_filterByExpression(e){return!this.where||this._clause(e)}_filterById(e){return(!this._idsToHide?.size||!this._idsToHide.has(e.getObjectId()))&&(!this._idsToShow?.size||this._idsToShow.has(e.getObjectId()))}_filterByGeometry(e){if(!this.geometry)return!0;const t=e.readGeometryWorldSpace();return!!t&&this._spatialQueryOperator(t)}_filterByTime(e){return null==this._timeOperator||this._timeOperator(e)}_resetAllHiddenIds(){const e=[];return this._idToVisibility.forEach(((t,r)=>{1&t||(this._idToVisibility.set(r,1),e.push(r))})),e}}class La{constructor(e){this._options=e,this._fieldsIndex="fieldsIndex"in e?z.Z.fromJSON(e.fieldsIndex):new z.Z(e.fields),e.spatialReference&&(this._spatialReference=U.Z.fromJSON(e.spatialReference)),this._arcadeSchema={fields:this.fieldsIndex.fields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,objectIdField:this.objectIdField,globalIdField:this._options.globalIdField,spatialReference:this._spatialReference,timeInfo:this._options.timeInfo,typeIdField:this._options.typeIdField,types:this._options.types}}get fieldsIndex(){return this._fieldsIndex}get geometryType(){return this._options.geometryType}get objectIdField(){return this._options.objectIdField}get arcadeSchema(){return this._arcadeSchema}get spatialReference(){return this._spatialReference}}r(66577);var Ua=r(48853),za=r(22641),Ga=r(53970),Va=r(32724),Za=r(25031),Ha=r(33955);const Wa=(0,n.Z)("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],ja=Wa[0],Ya=Wa[1],qa=Wa[2],$a=Wa[3],Xa=(0,n.Z)("featurelayer-simplify-payload-size-factors")??[1,2,4],Ka=Xa[0],Qa=Xa[1],Ja=Xa[2],ec=(0,n.Z)("featurelayer-simplify-mobile-factor")??2,tc=(0,n.Z)("esri-mobile"),rc=4294967295;class sc{constructor(e){this.metadata=e,this.type="FeatureSetReader",this._deleted=null,this._joined=[],this._objectIdToIndex=null,this._boundsBuffer=[],this.arcadeDeclaredClass="esri.arcade.Feature",this._contextTimeZone=null}get isEmpty(){return null!=this._deleted&&this._deleted.countSet()===this.getSize()}getAreaSimplificationThreshold(e,t){let r=1;const s=tc?ec:1;t>4e6?r=Ja*s:t>1e6?r=Qa*s:t>5e5?r=Ka*s:t>1e5&&(r=s);let i=0;return e>4e3?i=$a*r:e>2e3?i=qa*r:e>100?i=Ya:e>15&&(i=ja),i}parseTimestampOffset(e){return e}getBounds(e){if(function(e,t,r){if(!(e.length>t))for(;e.length<=t;)e.push(0)}(this._boundsBuffer,4*this.getIndex()+4),this.getBoundsXMin()===rc)return!1;if(0===this.getBoundsXMin()){const t=this.readGeometryWorldSpace();if(!t)return this.setBoundsXMin(rc),!1;let r=1/0,s=1/0,i=-1/0,n=-1/0;return t.forEachVertex(((e,t)=>{r=Math.min(r,e),s=Math.min(s,t),i=Math.max(i,e),n=Math.max(n,t)})),this.setBoundsXMin(r),this.setBoundsYMin(s),this.setBoundsXMax(i),this.setBoundsYMax(n),(0,la.bZ)(e,r,s,i,n),!0}const t=this.getBoundsXMin(),r=this.getBoundsYMin(),s=this.getBoundsXMax(),i=this.getBoundsYMax();return(0,la.bZ)(e,t,r,s,i),!0}getBoundsXMin(){return this._boundsBuffer[4*this.getIndex()]}setBoundsXMin(e){this._boundsBuffer[4*this.getIndex()]=e}getBoundsYMin(){return this._boundsBuffer[4*this.getIndex()+1]}setBoundsYMin(e){this._boundsBuffer[4*this.getIndex()+1]=e}getBoundsXMax(){return this._boundsBuffer[4*this.getIndex()+2]}setBoundsXMax(e){this._boundsBuffer[4*this.getIndex()+2]=e}getBoundsYMax(){return this._boundsBuffer[4*this.getIndex()+3]}setBoundsYMax(e){this._boundsBuffer[4*this.getIndex()+3]=e}readAttributeAsTimestamp(e){const t=this.readAttribute(e);return"string"==typeof t?new Date(t).getTime():"number"==typeof t||null==t?t:null}readAttribute(e,t=!1){const r=this._readAttribute(e,t);if(void 0!==r)return r;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 r=t._readAttributes();for(const t of Object.keys(r))e[t]=r[t]}return e}joinAttributes(e){this._joined.push(e)}removeIds(e){if(null==this._objectIdToIndex){const e=new Map,t=this.getCursor();for(;t.next();){const r=t.getObjectId();(0,R.O3)(r),e.set(r,t.getIndex())}this._objectIdToIndex=e}const t=this._objectIdToIndex;for(const r of e.values())t.has(r)&&this._removeAtIndex(t.get(r))}readOptimizedFeatureWorldSpace(){const e=this.readGeometryWorldSpace(),t=this.readAttributes(),r=this.readCentroidWorldSpace(),s=new na.u_(e,t,r);return s.objectId=this.getObjectId(),s.displayId=this.getDisplayId(),s}readLegacyFeatureForDisplay(){const e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyFeatureWorldSpace(){const e=this.readCentroidWorldSpace();return{attributes:this.readAttributes(),geometry:this._readLegacyGeometryWorldSpace(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){const e=this.readGeometryForDisplay();return(0,ia.di)(e,this.geometryType,!1,!1)}readXForDisplay(){return this._readX()}readYForDisplay(){return this._readY()}readXWorldSpace(){const e=this._readX(),t=this.getInTransform();return null==t?e:e*t.scale[0]+t.translate[0]}readYWorldSpace(){const e=this._readY(),t=this.getInTransform();return null==t?e:t.translate[1]-e*t.scale[1]}readGeometryForDisplay(){const e=this._readGeometryDeltaDecoded(!0);if(!e){const e=this._createGeometryFromServerCentroid();return e?e.deltaDecode():null}return e}readGeometryWorldSpace(){let e=this._readGeometry();if(e||(e=this._createGeometryFromServerCentroid()),!e)return null;const t=e.clone(),r=this.getInTransform();return null!=r&&(0,ia.$g)(t,t,this.hasZ,this.hasM,r),t}readCentroidForDisplay(){const e=this.readGeometryForDisplay();return e?this._computeDisplayCentroid(e):this._readServerCentroid()}readCentroidWorldSpace(){const e=this.readGeometryForDisplay(),t=e?this._computeDisplayCentroid(e):this._readServerCentroid();if(!t)return null;const r=t.clone(),s=this.getInTransform();return null!=s&&(0,ia.$g)(r,r,this.hasZ,this.hasM,s),r}_readGeometryDeltaDecoded(e){const t=this._readGeometry(e);return"esriGeometryPoint"!==this.geometryType&&t&&this.getInTransform()?t.deltaDecode():t}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)}geometry(){const e=this.readGeometryWorldSpace(),t=(0,ia.di)(e,this.geometryType,this.hasZ,this.hasM),r=(0,Ha.im)(t);if(r){if(!this.metadata.spatialReference)throw new Error("InternalError: Expected spatial reference to be defined");r.spatialReference=this.metadata.spatialReference}return r}autocastArcadeDate(e,t){return t&&t instanceof Date?this.isUnknownDateTimeField(e)?Ua.iG.unknownDateJSToArcadeDate(t):Ua.iG.dateJSAndZoneToArcadeDate(t,this.contextTimeZone??Za.By):t}isUnknownDateTimeField(e){return this.metadata.fieldsIndex.getTimeZone(e)===Za._4}field(e){let t=this.fields.get(e);if(t)switch(t.type){case"date-only":case"esriFieldTypeDateOnly":return za.u.fromReader(this.readAttribute(e,!1));case"time-only":case"esriFieldTypeTimeOnly":return Ga.n.fromReader(this.readAttribute(e,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return Ua.iG.fromReaderAsTimeStampOffset(this.readAttribute(e,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(e,this.readAttribute(e,!0));default:return this.readAttribute(e,!1)}for(const r of this._joined)if(r.setIndex(this.getIndex()),t=r.fields.get(e),t)switch(t.type){case"date-only":case"esriFieldTypeDateOnly":return za.u.fromReader(r._readAttribute(e,!1));case"time-only":case"esriFieldTypeTimeOnly":return Ga.n.fromReader(r._readAttribute(e,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return Ua.iG.fromReaderAsTimeStampOffset(r._readAttribute(e,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(e,r._readAttribute(e,!0));default:return this.readAttribute(e,!1)}throw new Error(`Field ${e} does not exist`)}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.fields.fields.map((e=>e.name))}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeatureForDisplay());const t=this.readLegacyFeatureForDisplay();if(!t)return JSON.stringify(null);const r={geometry:t.geometry,attributes:{...t.attributes??{}}};for(const e in r.attributes){const t=r.attributes[e];t instanceof Date&&(r.attributes[e]=t.getTime())}return JSON.stringify(r)}gdbVersion(){return null}fullSchema(){return this.metadata.arcadeSchema}castAsJson(e=null){return{attributes:this._readAttributes(),geometry:!0===e?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}_getExists(){return null==this._deleted||!this._deleted.has(this.getIndex())}_computeDisplayCentroid(e){const t=Ve.z.fromOptimized(e,this.geometryType);t.yFactor*=-1;const r=(0,Va.r)(t);return r?(r[1]*=-1,new de.Z([],r)):null}copyInto(e){e._joined=this._joined,e._deleted=this._deleted,e._objectIdToIndex=this._objectIdToIndex,e._boundsBuffer=this._boundsBuffer}_readLegacyGeometryWorldSpace(){const e=this.readGeometryWorldSpace();return(0,ia.di)(e,this.geometryType,!1,!1)}_createGeometryFromServerCentroid(){const e=this._readServerCentroid();if(!e)return null;const[t,r]=e.coords;return this._createQuantizedExtrudedGeometry(t,r)}_createQuantizedExtrudedGeometry(e,t){return"esriGeometryPolyline"===this.geometryType?this._createQuantizedExtrudedLine(e,t):this._createQuantizedExtrudedQuad(e,t)}_createQuantizedExtrudedQuad(e,t){return new de.Z([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createQuantizedExtrudedLine(e,t){return new de.Z([2],[e-1,t+1,1,-1])}_removeAtIndex(e){null==this._deleted&&(this._deleted=wa.create(this.getSize())),this._deleted.set(e)}}class ic extends sc{static fromFeatures(e,t){const{objectIdField:r,geometryType:s}=t,i=(0,ia.Yn)([],e,s,!1,!1,r);for(let t=0;t<i.length;t++)i[t].displayId=e[t].displayId;return ic.fromOptimizedFeatures(i,t)}static fromFeatureSet(e,t){const r=(0,ia.h_)(e,t.objectIdField);return ic.fromOptimizedFeatureSet(r,t)}static fromOptimizedFeatureSet(e,t){const r=ic.fromOptimizedFeatures(e.features,t);return r._exceededTransferLimit=e.exceededTransferLimit,r._transform=e.transform,r._fieldsIndex=new z.Z(e.fields),r}static fromOptimizedFeatures(e,t,r){const s=new ic(e,t);return s._fieldsIndex=t.fieldsIndex,s._transform=r,s}static empty(e){return new ic([],e)}constructor(e,t){super(t),this._exceededTransferLimit=!1,this._featureIndex=-1,this._fieldsIndex=null,this._geometryType=t.geometryType,this._features=e}get fields(){return this._fieldsIndex}get geometryType(){return this._geometryType}get hasFeatures(){return!!this._features.length}get hasNext(){return this._featureIndex+1<this._features.length}get exceededTransferLimit(){return this._exceededTransferLimit}get hasZ(){return!1}get hasM(){return!1}get _current(){return this._features[this._featureIndex]}removeIds(e){const t=new Set(e);this._features=this._features.filter((e=>!(null!=e.objectId&&t.has(e.objectId))))}getSize(){return this._features.length}getCursor(){return this.copy()}getInTransform(){return this._transform}getAttributeHash(){let e="";for(const t in this._current.attributes)e+=this._current.attributes[t];return e}getIndex(){return this._featureIndex}setIndex(e){this._featureIndex=e}getObjectId(){return this._current?.objectId}getDisplayId(){return this._current.displayId}setDisplayId(e){this._current.displayId=e}copy(){const e=new ic(this._features,this.metadata);return this.copyInto(e),e}next(){for(;++this._featureIndex<this._features.length&&!this._getExists(););return this._featureIndex<this._features.length}readGeometryArea(){return(0,na.S6)(this._current)?(0,ia.lz)(this._current.geometry,2):0}_readX(){return(0,na.S6)(this._current)?this._current.geometry.coords[0]:0}_readY(){return(0,na.S6)(this._current)?this._current.geometry.coords[1]:0}_readGeometry(){return this._current.geometry??null}_readServerCentroid(){return this._current.centroid}_readAttribute(e,t){if(!this._fieldsIndex){const t=this._current.attributes[e];if(void 0!==t)return t;const r=e.toLowerCase();for(const e in this._current.attributes)if(e.toLowerCase()===r)return this._current.attributes[e];return}const r=this._fieldsIndex.get(e);if(!r)return;let s=this._current.attributes[r.name];return null==s?s:("esriFieldTypeTimestampOffset"===this.fields.get(e)?.type&&(s=this.parseTimestampOffset(s)),t&&this.fields.isDateField(e)?new Date(s):s)}_readAttributes(){return this._current.attributes}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._transform=this._transform,e._fieldsIndex=this._fieldsIndex}}class nc extends pa{constructor(e,t){super(e),this.bins=new Map,this.done=!1,this._store=t}reset(){this.destroy(),this.bins.clear(),this.done=!1,this.handledChunks.clear()}destroy(){for(const e of this.bins.values()){const t=e.cachedFeature?.objectId;null!=t&&this._store.releaseDisplayIdForObjectId(t)}}*features(){for(const e of this.bins.values())e.cachedFeature&&(yield e.cachedFeature)}getGeohashBounds(e,t){const r=this.subscription.tile;return(0,sa.ir)(r.extent,r.resolution,t,e)}}class oc extends _a{static async create(e,t,r,s){const i=new Ma({spatialReference:t}),n=e.fixedBinLevel,o=await Promise.all(e.fields.map((async e=>oa.create(i,e)))),a=e.featureFilter?await Ba.create({geometryType:r.service.geometryType,hasM:!1,hasZ:!1,timeInfo:r.service.timeInfo,fieldsIndex:new z.Z(r.service.fields),spatialReference:t,filterJSON:e.featureFilter}):null;return new oc({fields:o,geohashLevel:n,spatialReference:t,featureFilter:a},r,s)}constructor(e,t,r){super(t,r,e.spatialReference,e.fields),this._indexOptions=e,this._metadata=new La({geometryType:this.geometryType,objectIdField:"aggregateId",fields:this._indexOptions.fields})}get geometryType(){return"esriGeometryPolygon"}createState(e){return new nc(e,this._attributeStore)}getDisplayFeatures(e){const t=new Set(e),r=new Set,s=[];for(const e of this._sendStates.values())for(const i of e.features())t.has(i.displayId)&&!r.has(i.objectId)&&(s.push((0,ia.EI)(i,this.geometryType,!1,!1)),r.add(i.objectId));return{features:[],aggregates:s}}getFeatureObjectIdsForAggregate(e){for(const t of this._sendStates.values())for(const r of t.bins.values())if(r.id===e)return Array.from(r.objectIds);return[]}async*_update(e,t){const{handledChunks:r,subscription:s,bins:i}=e,{spatialReference:o,geohashLevel:a}=this._indexOptions,c=s.tile;if(e.done)return;for(const s of t.chunks()){if(r.has(s.chunkId))continue;r.add(s.chunkId);const t=s.queryInfo;if("tileId"in t){const e=new _.Z(t.tileId);if(e.level!==c.level||e.world!==c.key.world)continue}const n=s.getGeohashIndex(this._indexOptions),l=e.getGeohashBounds(o,a);n.putBins(i,l)}const l=[],u=s.tile.transform;for(const e of i.values()){if(e.cachedFeature)e.cachedFeature.attributes=e.getAttributes();else{const t=e.getGeometry(this.spatialReference,u),r=new na.u_(t,e.getAttributes(),null);t||(r.centroid=e.getGeometryCentroid(this.spatialReference,u)),r.objectId=e.id,r.displayId=this._attributeStore.createDisplayIdForObjectId(e.id),e.cachedFeature=r}l.push(e.cachedFeature)}this.events.emit("changed"),e.done=!t.updating;const h=ic.fromOptimizedFeatures(l,this._metadata,u),d=h.getCursor(),p=e.subscription.tile.arcadeEvaluationOptions;for(;d.next();)this._attributeStore.setAttributeData(d.getDisplayId(),d,p);if((0,n.Z)("esri-2d-update-debug")){const e=s.tile;console.debug(`Tile[${e.key.id}] BinningStrategy.sendUpdates`)}if(this._attributeStore.sendUpdates(),(0,n.Z)("esri-2d-update-debug")){const e=s.tile;console.debug(`Tile[${e.key.id}] BinningStrategy._sendUpdates.await`)}const f=new fa(e.subscription,h,!0,e.done,{});yield f}}class ac extends pa{constructor(e,t){super(e),this.cells=new Map,this.done=!1,this._store=t}reset(){this.destroy(),this.cells.clear(),this.done=!1,this.handledChunks.clear()}destroy(){for(const e of this.cells.values()){const t=e.cachedFeature?.objectId;null!=t&&this._store.releaseDisplayIdForObjectId(t)}}*features(){const e=this.subscription.tile.transform;for(const t of this.cells.values())if(t.cachedFeature){const r=t.cachedFeature.clone();let s=r.geometry;s&&(s=(0,ia.$g)(new de.Z,s,!1,!1,e)),r.geometry=s,yield r}}}class cc extends _a{static async create(e,t,r,s,i){const n=new Ma({spatialReference:r}),o=await Promise.all(t.fields.map((async e=>oa.create(n,e)))),a=t.featureFilter?await Ba.create({geometryType:s.service.geometryType,hasM:!1,hasZ:!1,timeInfo:s.service.timeInfo,fieldsIndex:new z.Z(s.service.fields),spatialReference:r,filterJSON:t.featureFilter}):null;return new cc(e,{fields:o,spatialReference:r,featureFilter:a,cellSize:t.cellSize},s,i)}constructor(e,t,r,s){super(r,s,t.spatialReference,t.fields),this._connection=e,this._indexOptions=t,this._metadata=new La({geometryType:this.geometryType,objectIdField:"aggregateId",fields:[...this._indexOptions.fields,...this._source.service.fields]}),this._aggregateStatistics=new Map}get geometryType(){return"esriGeometryPoint"}createState(e){return new ac(e,this._attributeStore)}async*applyOverride(e){return this._aggregateStatistics.clear(),super.applyOverride(e)}getDisplayFeatures(e){const t=new Set(e),r=new Set,s=[],i=[];for(const e of this._sendStates.values())for(const n of e.features())if(t.has(n.displayId)&&!r.has(n.displayId)){const e=(0,ia.EI)(n,this.geometryType,!1,!1);if(r.add(n.displayId),1===e.attributes.cluster_count){s.push(e);continue}i.push(e)}return{features:s,aggregates:i}}getFeatureObjectIdsForAggregate(e){for(const t of this._sendStates.values())for(const r of t.cells.values())if(r.id===e)return Array.from(r.objectIds);return[]}async*_update(e,t){const{handledChunks:r,subscription:s,cells:i}=e,o=s.tile;if(e.done)return;for(const e of t.chunks()){if(r.has(e.chunkId))continue;r.add(e.chunkId);const t=e.queryInfo;if("tileId"in t){const e=new _.Z(t.tileId);if(e.level!==o.level||e.world!==o.key.world)continue}e.getGridIndex({...this._indexOptions,scale:o.scale}).putCells(i,o.bounds)}const a=[],c=s.tile.transform;let l=!1;const u=o.level;let h=this._aggregateStatistics.get(u);h||(h=new Map,this._aggregateStatistics.set(u,h));for(const e of i.values()){if(e.cachedFeature)e.cachedFeature.attributes=e.getAttributes();else{const t=e.getCentroid(c),r=new na.u_(t,e.getAttributes(),null);r.objectId=e.id,r.displayId=this._attributeStore.createDisplayIdForObjectId(e.id),e.cachedFeature=r}e.count>1&&(l=this._updateAggregateStatistics(h,e)||l);const[t,r]=e.cachedFeature.geometry.coords;t<G.i9&&t>=0&&r<G.i9&&r>=0&&a.push(e.cachedFeature)}if(l)for(const[e,t]of h.entries())this._connection.container.updateStatistics(u,e,t.minValue,t.maxValue);this.events.emit("changed"),e.done=!t.updating;const d=ic.fromOptimizedFeatures(a,this._metadata,c),p=d.getCursor(),f=e.subscription.tile.arcadeEvaluationOptions;for(;p.next();)this._attributeStore.setAttributeData(p.getDisplayId(),p,f);if((0,n.Z)("esri-2d-update-debug")){const e=s.tile;console.debug(`Tile[${e.key.id}] ClusterStrategy.sendUpdates`)}if(this._attributeStore.sendUpdates(),(0,n.Z)("esri-2d-update-debug")){const e=s.tile;console.debug(`Tile[${e.key.id}] ClusterStrategy._sendUpdates.await`)}const y=new ya(e.subscription,d,[],e.done,{});yield y}_updateAggregateStatistics(e,t){let r=!1;for(const s of t.statistics.values()){if("esriFieldTypeString"===s.field.type)continue;const t=s.value,i=s.field,n=e.get(i.name);if(n){const{minValue:e,maxValue:s}=n,i=Math.min(n.minValue,t),o=Math.max(n.maxValue,t);e===i&&s===o||(n.minValue=i,n.maxValue=o,r=!0)}else e.set(i.name,{minValue:t,maxValue:t}),r=!0}return r}}var lc=r(88764);function uc(e,t){if(!(this instanceof uc))return new uc(e,t);this._maxEntries=Math.max(4,e||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),t&&("function"==typeof t?this.toBBox=t:this._initFormat(t)),this.clear()}function hc(e,t,r){if(!r)return t.indexOf(e);for(var s=0;s<t.length;s++)if(r(e,t[s]))return s;return-1}function dc(e,t){pc(e,0,e.children.length,t,e)}function pc(e,t,r,s,i){i||(i=Sc(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var n,o=t;o<r;o++)n=e.children[o],_c(i,e.leaf?s(n):n);return i}function _c(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function fc(e,t){return e.minX-t.minX}function yc(e,t){return e.minY-t.minY}function gc(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function mc(e){return e.maxX-e.minX+(e.maxY-e.minY)}function xc(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function bc(e,t){var r=Math.max(e.minX,t.minX),s=Math.max(e.minY,t.minY),i=Math.min(e.maxX,t.maxX),n=Math.min(e.maxY,t.maxY);return Math.max(0,i-r)*Math.max(0,n-s)}function vc(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function wc(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function Sc(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Ic(e,t,r,s,i){for(var n,o=[t,r];o.length;)(r=o.pop())-(t=o.pop())<=s||(n=t+Math.ceil((r-t)/s/2)*s,(0,lc.q)(e,n,t,r,i),o.push(t,n,n,r))}uc.prototype={all:function(){return this._all(this.data,[])},search:function(e){var t=this.data,r=[],s=this.toBBox;if(!wc(e,t))return r;for(var i,n,o,a,c=[];t;){for(i=0,n=t.children.length;i<n;i++)o=t.children[i],wc(e,a=t.leaf?s(o):o)&&(t.leaf?r.push(o):vc(e,a)?this._all(o,r):c.push(o));t=c.pop()}return r},collides:function(e){var t=this.data,r=this.toBBox;if(!wc(e,t))return!1;for(var s,i,n,o,a=[];t;){for(s=0,i=t.children.length;s<i;s++)if(n=t.children[s],wc(e,o=t.leaf?r(n):n)){if(t.leaf||vc(e,o))return!0;a.push(n)}t=a.pop()}return!1},load:function(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(var t=0,r=e.length;t<r;t++)this.insert(e[t]);return this}var s=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===s.height)this._splitRoot(this.data,s);else{if(this.data.height<s.height){var i=this.data;this.data=s,s=i}this._insert(s,this.data.height-s.height-1,!0)}else this.data=s;return this},insert:function(e){return null!=e&&this._insert(e,this.data.height-1),this},clear:function(){return this.data=Sc([]),this},remove:function(e,t){if(null==e)return this;for(var r,s,i,n,o=this.data,a=this.toBBox(e),c=[],l=[];o||c.length;){if(o||(o=c.pop(),s=c[c.length-1],r=l.pop(),n=!0),o.leaf&&-1!==(i=hc(e,o.children,t)))return o.children.splice(i,1),c.push(o),this._condense(c),this;n||o.leaf||!vc(o,a)?s?(r++,o=s.children[r],n=!1):o=null:(c.push(o),l.push(r),r=0,s=o,o=o.children[0])}return this},toBBox:function(e){return e},compareMinX:fc,compareMinY:yc,toJSON:function(){return this.data},fromJSON:function(e){return this.data=e,this},_all:function(e,t){for(var r=[];e;)e.leaf?t.push.apply(t,e.children):r.push.apply(r,e.children),e=r.pop();return t},_build:function(e,t,r,s){var i,n=r-t+1,o=this._maxEntries;if(n<=o)return dc(i=Sc(e.slice(t,r+1)),this.toBBox),i;s||(s=Math.ceil(Math.log(n)/Math.log(o)),o=Math.ceil(n/Math.pow(o,s-1))),(i=Sc([])).leaf=!1,i.height=s;var a,c,l,u,h=Math.ceil(n/o),d=h*Math.ceil(Math.sqrt(o));for(Ic(e,t,r,d,this.compareMinX),a=t;a<=r;a+=d)for(Ic(e,a,l=Math.min(a+d-1,r),h,this.compareMinY),c=a;c<=l;c+=h)u=Math.min(c+h-1,l),i.children.push(this._build(e,c,u,s-1));return dc(i,this.toBBox),i},_chooseSubtree:function(e,t,r,s){for(var i,n,o,a,c,l,u,h;s.push(t),!t.leaf&&s.length-1!==r;){for(u=h=1/0,i=0,n=t.children.length;i<n;i++)c=gc(o=t.children[i]),(l=xc(e,o)-c)<h?(h=l,u=c<u?c:u,a=o):l===h&&c<u&&(u=c,a=o);t=a||t.children[0]}return t},_insert:function(e,t,r){var s=this.toBBox,i=r?e:s(e),n=[],o=this._chooseSubtree(i,this.data,t,n);for(o.children.push(e),_c(o,i);t>=0&&n[t].children.length>this._maxEntries;)this._split(n,t),t--;this._adjustParentBBoxes(i,n,t)},_split:function(e,t){var r=e[t],s=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,s);var n=this._chooseSplitIndex(r,i,s),o=Sc(r.children.splice(n,r.children.length-n));o.height=r.height,o.leaf=r.leaf,dc(r,this.toBBox),dc(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(r,o)},_splitRoot:function(e,t){this.data=Sc([e,t]),this.data.height=e.height+1,this.data.leaf=!1,dc(this.data,this.toBBox)},_chooseSplitIndex:function(e,t,r){var s,i,n,o,a,c,l,u;for(c=l=1/0,s=t;s<=r-t;s++)o=bc(i=pc(e,0,s,this.toBBox),n=pc(e,s,r,this.toBBox)),a=gc(i)+gc(n),o<c?(c=o,u=s,l=a<l?a:l):o===c&&a<l&&(l=a,u=s);return u},_chooseSplitAxis:function(e,t,r){var s=e.leaf?this.compareMinX:fc,i=e.leaf?this.compareMinY:yc;this._allDistMargin(e,t,r,s)<this._allDistMargin(e,t,r,i)&&e.children.sort(s)},_allDistMargin:function(e,t,r,s){e.children.sort(s);var i,n,o=this.toBBox,a=pc(e,0,t,o),c=pc(e,r-t,r,o),l=mc(a)+mc(c);for(i=t;i<r-t;i++)n=e.children[i],_c(a,e.leaf?o(n):n),l+=mc(a);for(i=r-t-1;i>=t;i--)n=e.children[i],_c(c,e.leaf?o(n):n),l+=mc(c);return l},_adjustParentBBoxes:function(e,t,r){for(var s=r;s>=0;s--)_c(t[s],e)},_condense:function(e){for(var t,r=e.length-1;r>=0;r--)0===e[r].children.length?r>0?(t=e[r-1].children).splice(t.indexOf(e[r]),1):this.clear():dc(e[r],this.toBBox)},_initFormat:function(e){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(e[0])),this.compareMinY=new Function("a","b",t.join(e[1])),this.toBBox=new Function("a","return {minX: a"+e[0]+", minY: a"+e[1]+", maxX: a"+e[2]+", maxY: a"+e[3]+"};")}};class Tc{static fromReader(e){const t=[],r=e.copy(),s=(0,la.Ue)();for(;r.next();)r.getBounds(s)&&t.push(r.getIndex());const i=uc(9,(e=>(r.setIndex(e),{minX:r.getBoundsXMin(),minY:r.getBoundsYMin(),maxX:r.getBoundsXMax(),maxY:r.getBoundsYMax()})));return i.load(t),new Tc(i)}constructor(e){this._index=e}search(e){const t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this._index.search(t)}}var Ec=r(37427);const Rc=Math.PI/180;class Ac{static create(e){return new Ac(e.map((e=>function(e){switch(e.statisticType){case"min":return new Mc(e);case"max":return new Fc(e);case"avg":return new Oc(e);case"avg_angle":return new Pc(e);case"sum":case"count":return new Nc(e);case"mode":return new kc(e)}}(e))))}constructor(e){this._statistics=e}values(){return this._statistics.values()}insert(e,t){for(const r of this._statistics)r.insert(e,t)}merge(e){for(let t=0;t<this._statistics.length;t++){const r=this._statistics[t],s=e._statistics[t];if(r.field!==s.field)throw new Error("InternalError: Tried to merge incompatible statistics");r.merge(s)}}clone(){return new Ac(this._statistics.map((e=>e.clone())))}}class Cc{constructor(e){this.field=e}insert(e,t){if(!this.field.computed)return;const r=this.field.computed.read(e,t);xa(r)||this._insertValue(r)}}class Mc extends Cc{constructor(){super(...arguments),this.type="min",this.value=Number.MAX_VALUE}_insertValue(e){this.value=Math.min(this.value,e)}merge(e){this.value=Math.min(this.value,e.value)}clone(){const e=new Mc(this.field);return e.value=this.value,e}}class Fc extends Cc{constructor(){super(...arguments),this.type="max",this.value=Number.MIN_VALUE}_insertValue(e){this.value=Math.max(this.value,e)}merge(e){this.value=Math.max(this.value,e.value)}clone(){const e=new Fc(this.field);return e.value=this.value,e}}class Nc extends Cc{constructor(){super(...arguments),this.type="sum",this.value=0}_insertValue(e){this.value+=e}merge(e){this.value+=e.value}clone(){const e=new Nc(this.field);return e.value=this.value,e}}class Oc extends Cc{constructor(){super(...arguments),this.type="avg",this._total=0,this._count=0}get value(){return this._total/this._count}_insertValue(e){this._total+=e,this._count+=1}merge(e){this._total+=e._total,this._count+=e._count}clone(){const e=new Oc(this.field);return e._total=this._total,e._count=this._count,e}}class Pc extends Cc{constructor(){super(...arguments),this.type="avg_angle",this._x=0,this._y=0,this._count=0}get value(){const e=this._x/this._count,t=this._y/this._count,r=180/Math.PI;return Math.atan2(t,e)*r}_insertValue(e){this._x=this._x+Math.cos(e*Rc),this._y=this._y+Math.sin(e*Rc),this._count+=1}merge(e){this._x+=e._x,this._y+=e._y,this._count+=e._count}clone(){const e=new Pc(this.field);return e._x=this._x,e._y=this._y,e._count=this._count,e}}class kc extends Cc{constructor(){super(...arguments),this._frequencies=new Map}get value(){let e,t=0;for(const[r,s]of this._frequencies.entries())s>t&&(t=s,e=r);return e}_insertValue(e){const t=this._frequencies.get(e);null!=t?this._frequencies.set(e,t+1):this._frequencies.set(e,1)}merge(e){for(const[t,r]of e._frequencies.entries()){const e=this._frequencies.get(t);null!=e?this._frequencies.set(t,e+r):this._frequencies.set(t,r)}}clone(){const e=new kc(this.field);return e._frequencies=new Map(this._frequencies),e}}class Dc{static create(e,t,r,s){const i=Ac.create(e),n=new Array(32);for(let e=0;e<n.length;e++)n[e]=null;return new Dc(i,t,r,s,n)}constructor(e,t,r,s,i){this._statistics=e,this.xNode=t,this.yNode=r,this.depth=s,this.children=i,this._objectIds=new Set,this._count=0,this._xWorldTotal=0,this._yWorldTotal=0,this._xGeohashTotal=0,this._yGeohashTotal=0,this.next=null}get id(){return`${this.xNode}.${this.yNode}`}get objectIds(){return this._objectIds}clone(){const e=new Dc(this._statistics.clone(),this.xNode,this.yNode,this.depth,this.children);return e._count=this._count,e._xWorldTotal=this._xWorldTotal,e._yWorldTotal=this._yWorldTotal,e._xGeohashTotal=this._xGeohashTotal,e._yGeohashTotal=this._yGeohashTotal,e.next=this.next,e.cachedFeature=this.cachedFeature,e._objectIds=new Set(this._objectIds),e}insert(e,t,r,s,i,n){this._count+=1,this._xWorldTotal+=t,this._yWorldTotal+=r,this._xGeohashTotal+=s,this._yGeohashTotal+=i,this._statistics.insert(e,n),this._objectIds.add(e.getObjectId())}merge(e){if(0!==e._count){this._count+=e._count,this._xWorldTotal+=e._xWorldTotal,this._yWorldTotal+=e._yWorldTotal,this._xGeohashTotal+=e._xWorldTotal,this._yGeohashTotal+=e._yWorldTotal,this._statistics.merge(e._statistics);for(const t of e._objectIds.values())this._objectIds.add(t)}}getGeometry(e,t){const r=this._getLngLatBounds(),[s,i,n,o]=r,a=(0,Ec.iV)({rings:[[[s,i],[s,o],[n,o],[n,i],[s,i]]]},U.Z.WGS84,e),c=(0,ia.Uy)(new de.Z,a,!1,!1);return null!=t?(0,ia.Nh)(new de.Z,c,!1,!1,"esriGeometryPolygon",t,!1,!1):c}getGeometryCentroid(e,t){const r=this._getLngLatBounds(),[s,i,n,o]=r,a=(0,Ec.iV)({x:(s+n)/2,y:(i+o)/2},U.Z.WGS84,e),c=(0,ia.dd)(new de.Z,a);return null!=t?(0,ia.Nh)(new de.Z,c,!1,!1,"esriGeometryPoint",t,!1,!1):c}getAttributes(){const e={aggregateId:this.id};for(const t of this._statistics.values())e[t.field.name]=t.value;return e.aggregateCount=this._count,e}_getLngLatBounds(){const e=this.depth,t=Math.ceil(e/2),r=Math.floor(e/2),s=30-(3*t+2*r),i=30-(2*t+3*r),n=this.xNode<<s,o=this.yNode<<i;return(0,sa.bU)({geohashX:n,geohashY:o},this.depth)}}class Bc{constructor(e){this._fields=e,this._root=Dc.create(this._fields,0,0,0)}destroy(){}insert(e,t,r,s,i,n,o){let a=this._root,c=0,l=0,u=0;for(;null!==a;){if(a.insert(e,t,r,s,i,o),c>=n)return;const h=Math.ceil((c+1)/2),d=Math.floor((c+1)/2),p=1-c%2,_=30-(3*h+2*d),f=30-(2*h+3*d),y=(s&7*p+3*(1-p)<<_)>>_,g=(i&3*p+7*(1-p)<<f)>>f,m=y+g*(8*p+4*(1-p));l=l<<3*p+2*(1-p)|y,u=u<<2*p+3*(1-p)|g,null==a.children[m]&&(a.children[m]=Dc.create(this._fields,l,u,c+1)),c+=1,a=a.children[m]}}putBins(e,t){for(const r of this.getNodes(t)){const t=e.get(r.id);t?t.merge(r):e.set(r.id,r.clone())}}getNodes(e){const t=[],{geohashBounds:r,level:s}=e;let i=this._root;for(;null!==i;){const e=i.depth,n=i.xNode,o=i.yNode;if(e>=s){t.push(i),i=i.next;continue}const a=Math.ceil((e+1)/2),c=Math.floor((e+1)/2),l=1-e%2,u=30-(3*a+2*c),h=30-(2*a+3*c),d=~((1<<u)-1),p=~((1<<h)-1),_=(r.xLL&d)>>u,f=(r.yLL&p)>>h,y=(r.xTR&d)>>u,g=(r.yTR&p)>>h,m=n<<3*l+2*(1-l),x=o<<2*l+3*(1-l),b=m+8*l+4*(1-l),v=x+4*l+8*(1-l),w=Math.max(m,_),S=Math.max(x,f),I=Math.min(b,y),T=Math.min(v,g);let E=null,R=null;for(let e=S;e<=T;e++)for(let t=w;t<=I;t++){const r=t-m+(e-x)*(8*l+4*(1-l)),s=i.children[r];s&&(E||(E=s,E.next=i.next),R&&(R.next=s),R=s,s.next=i.next)}i=E||i.next}return t}}class Lc{constructor(e){this._options=e,this._tree=new Bc(e.fields)}insert(e){const t=e.getCursor(),r={$view:{scale:0}};for(;t.next();)this._insertFeature(t,r)}putBins(e,t){this._tree.putBins(e,t)}_insertFeature(e,t){const{featureFilter:r,geohashLevel:s,spatialReference:i}=this._options;if(null!==r&&!r.check(e))return;const n=e.readXWorldSpace(),o=e.readYWorldSpace(),a=(0,sa.zp)(n,o,s,i);a&&this._tree.insert(e,n,o,a[0],a[1],s,t)}}var Uc=r(67900);class zc{static create(e,t){return new zc(e,Ac.create(t))}constructor(e,t){this.id=e,this._statistics=t,this._count=0,this._xWorldTotal=0,this._yWorldTotal=0,this._objectIds=new Set}get count(){return this._count}get statistics(){return this._statistics}get objectIds(){return this._objectIds}clone(){const e=new zc(this.id,this._statistics.clone());return e._count=this._count,e._xWorldTotal=this._xWorldTotal,e._yWorldTotal=this._yWorldTotal,e._firstFeatureAttributes=this._firstFeatureAttributes,e._objectIds=new Set(this._objectIds),e}insert(e,t){0===this._count?this._firstFeatureAttributes=e.readAttributes():this._firstFeatureAttributes=null,this._count+=1,this._xWorldTotal+=e.readXWorldSpace(),this._yWorldTotal+=e.readYWorldSpace(),this._statistics.insert(e,t),this._objectIds.add(e.getObjectId())}merge(e){if(0!==e._count){this._count+=e._count,this._firstFeatureAttributes=e._firstFeatureAttributes,this._xWorldTotal+=e._xWorldTotal,this._yWorldTotal+=e._yWorldTotal,this._statistics.merge(e._statistics);for(const t of e._objectIds.values())this._objectIds.add(t)}}getCentroid(e){const t=new de.Z([],[this._xWorldTotal/this._count,this._yWorldTotal/this._count]);if(null!=e){const r=new de.Z;return(0,ia.Nh)(r,t,!1,!1,"esriGeometryPoint",e)}return t}getAttributes(){const e={aggregateId:this.id};for(const t of this._statistics.values())e[t.field.name]=t.value;return null!=this._firstFeatureAttributes?{...e,...this._firstFeatureAttributes}:e}}class Gc{constructor(e){this._options=e,this._cells=new Map,this._pixelsPerMapUnit=function(e,t){return(0,Uc.c9)(e)*Uc.hd*96/t}(e.spatialReference,e.scale)}insert(e){const t=e.getCursor(),r={$view:{scale:this._options.scale}};for(;t.next();)this._insertFeature(t,r)}putCells(e,t){const[r,s,i,n]=t,o=Math.floor(r*this._pixelsPerMapUnit/this._options.cellSize),a=Math.floor(s*this._pixelsPerMapUnit/this._options.cellSize),c=Math.ceil(i*this._pixelsPerMapUnit/this._options.cellSize),l=Math.ceil(n*this._pixelsPerMapUnit/this._options.cellSize);for(let t=a;t<=l;t++)for(let r=o;r<=c;r++){const s=`${r}.${t}`,i=this._cells.get(s);if(!i)continue;const n=e.get(i.id);n?i&&!e.has(i.id)&&n.merge(i):e.set(i.id,i.clone())}}_insertFeature(e,t){const{featureFilter:r}=this._options;if(null!==r&&!r.check(e))return;const s=e.readXWorldSpace()*this._pixelsPerMapUnit,i=e.readYWorldSpace()*this._pixelsPerMapUnit,n=Math.floor(s/this._options.cellSize),o=Math.floor(i/this._options.cellSize);this._getCellOrCreate(n,o).insert(e,t)}_getCellOrCreate(e,t){const r=`${e}.${t}`;let s=this._cells.get(r);return s||(s=zc.create(r,this._options.fields),this._cells.set(r,s)),s}}class Vc extends sc{static from(e,t){return new Vc(e.copy(),t)}constructor(e,t){super(e.metadata),this._currentIndex=-1,this._displayTranslationX=0,this._displayTranslationY=0,this._displayScaleX=1,this._displayScaleY=1,this._reader=e,this._indices=t,this._isPoint="esriGeometryPoint"===e.geometryType}setTransformForDisplay(e){const t=this._reader.getInTransform();if(null==t){const[t,r]=e.scale,[s,i]=e.translate;return this._displayTranslationX=-s/t,this._displayScaleX=1/t,this._displayTranslationY=i/r,this._displayScaleY=1/-r,void(this._displayTransform=e)}const[r,s]=t.scale,[i,n]=t.translate,[o,a]=e.scale,[c,l]=e.translate;if(this._displayScaleX=r/o,this._displayTranslationX=(i-c)/o,this._displayScaleY=s/a,this._displayTranslationY=(-n+l)/a,!this._isPoint&&t)throw new Error("InternalError: Relative transformations not supported for non-point features");this._displayTransform=e}getInTransform(){return this._reader.getInTransform()}get fields(){return this._reader.fields}get hasNext(){return this._currentIndex+1<this._indices.length}getSize(){return this._indices.length}getCursor(){return this.copy()}copy(){const e=new Vc(this._reader.copy(),this._indices);return e._currentIndex=this._currentIndex,e._displayTransform=this._displayTransform,e._displayTranslationX=this._displayTranslationX,e._displayTranslationY=this._displayTranslationY,e._displayScaleX=this._displayScaleX,e._displayScaleY=this._displayScaleY,e}_nextIndex(){return++this._currentIndex<this._indices.length&&(this._reader.setIndex(this._indices[this._currentIndex]),!0)}next(){for(;this._nextIndex()&&!this._reader._getExists(););return this._currentIndex<this._indices.length}readXForDisplay(){return this._reader.readXForDisplay()*this._displayScaleX+this._displayTranslationX}readYForDisplay(){return this._reader.readYForDisplay()*this._displayScaleY+this._displayTranslationY}readGeometryForDisplay(){const e=this._reader.readGeometryForDisplay();if(!this._displayTransform)return e;const t=new de.Z;return(0,ia.Nh)(t,e,this.hasZ,this.hasM,this.geometryType,this._displayTransform),t.deltaDecode()}readCentroidForDisplay(){const e=this._reader.readCentroidForDisplay()?.clone();if(e){const[t,r]=e.coords;e.coords[0]=t*this._displayScaleX+this._displayTranslationX,e.coords[1]=r*this._displayScaleY+this._displayTranslationY}return e}get geometryType(){return this._reader.geometryType}get hasFeatures(){return this._reader.hasFeatures}get exceededTransferLimit(){return this._reader.exceededTransferLimit}get hasZ(){return this._reader.hasZ}get hasM(){return this._reader.hasM}readAttribute(e,t=!1){return this._reader.readAttribute(e,t)}readAttributes(){return this._reader.readAttributes()}joinAttributes(e){return this._reader.joinAttributes(e)}getBounds(e){return this._reader.getBounds(e)}getAttributeHash(){return this._reader.getAttributeHash()}getObjectId(){return this._reader.getObjectId()}getDisplayId(){return this._reader.getDisplayId()}setDisplayId(e){return this._reader.setDisplayId(e)}setIndex(e){return this._reader.setIndex(e)}getIndex(){return this._reader.getIndex()}readXWorldSpace(){return this._reader.readXWorldSpace()}readYWorldSpace(){return this._reader.readYWorldSpace()}_readX(){return this._reader.readXForDisplay()}_readY(){return this._reader.readYForDisplay()}_readServerCentroid(){return this._reader._readServerCentroid()}readLegacyFeatureForDisplay(){return this._reader.readLegacyFeatureForDisplay()}readLegacyGeometryForDisplay(){return this._reader.readLegacyGeometryForDisplay()}readGeometryArea(){return this._reader.readGeometryArea()}readGeometryWorldSpace(){return this._reader.readGeometryWorldSpace()}_readGeometry(){return this._reader._readGeometry()}_readAttribute(e,t){throw new Error("Error: Should not be called. Underlying _reader should be used instead")}_readAttributes(){throw new Error("Error: Should not be called. Underlying _reader should be used instead")}readArcadeFeature(){return this._reader.readArcadeFeature()}geometry(){return this._reader.geometry()}field(e){return this.readAttribute(e,!0)}hasField(e){return this._reader.hasField(e)}setField(e,t){return this._reader.setField(e,t)}keys(){return this._reader.keys()}castToText(e=!1){return this._reader.castToText(e)}}class Zc{size(){return this.reader.getSize()}get fields(){return this.reader.fields}invalidate(){this._geohashIndex=null,this._geohashIndexHash=null,this._spatialIndex=null,this._gridIndex=null,this._gridIndexHash=null}queryFeaturesInBounds(e){const t=this._getSpatialIndex().search(e);return Vc.from(this.reader,t)}getGeohashIndex(e){const t=JSON.stringify(e);return t!==this._geohashIndexHash&&(this._geohashIndexHash=t,this._geohashIndex=new Lc(e),this._geohashIndex.insert(this.reader)),this._geohashIndex}getGridIndex(e){const t=JSON.stringify(e);return t!==this._gridIndexHash&&(this._gridIndexHash=t,this._gridIndex=new Gc(e),this._gridIndex.insert(this.reader)),this._gridIndex}_getSpatialIndex(){return this._spatialIndex||(this._spatialIndex=Tc.fromReader(this.reader)),this._spatialIndex}}class Hc extends Zc{constructor(){super(...arguments),this.chunkId="override",this.removed=new Set,this.overridenIds=new Set,this._features=[]}get reader(){return ic.fromOptimizedFeatures(this._features,this._layerSchema??{fields:[]})}get queryInfo(){return{}}get first(){return!1}get end(){return!1}applyOverrides(e){super.invalidate(),this._layerSchema||(this._layerSchema=e.reader.fullSchema());const{reader:t,removed:r}=e,s=[],i=new Set,n=t.getCursor(),o=new Set(r);for(this.overridenIds.clear();n.next();){const e=n.readOptimizedFeatureWorldSpace(),t=e.objectId;s.push(e),i.add(t),this.overridenIds.add(t),this.removed.delete(t)}for(const e of this._features){const t=e.objectId;o.has(t)||i.has(t)||(s.push(e),this.overridenIds.add(t))}this._features=s;for(const e of i.values())this.removed.delete(e);for(const e of r)this.removed.add(e),this.overridenIds.add(e)}getTileReader(e){if(!this._features.length)return null;const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}class Wc extends ha{}class jc extends da{constructor(e,t){super(e,t),this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set,this._handle=e.store.events.on("remove",(e=>{this.handledChunks.delete(e.chunkId),this.handledChunksForAttributeData.delete(e.chunkId),this.handledChunksForIdCreation.delete(e.chunkId);const t=e.reader.getCursor();for(;t.next();){const e=t.getObjectId();this._attributeStore.releaseDisplayIdForObjectId(e)}}))}destroy(){super.destroy(),this._handle.remove();for(const e of this._source.chunks()){const t=e.reader.getCursor();for(;t.next();){const e=t.getObjectId();this._attributeStore.releaseDisplayIdForObjectId(e)}}}invalidateAttributeData(){this.handledChunksForAttributeData.clear()}onSubscribe(e){super.onSubscribe(e),this._evalOptions=e.tile.arcadeEvaluationOptions}createState(e){return new Wc(e)}get aggregateQueryEngine(){throw new Error("InternalError: FeatureUpdateStrategy does not support aggregations")}getDisplayIds(e){const t=new Set(e),r=[];for(const e of this._source.chunks()){const s=e.reader.getCursor();for(;s.next();)t.has(s.getObjectId())&&r.push(s.getDisplayId())}return r}getDisplayFeatures(e){const t=new Set(e),r=new Set,s=[];for(const e of this._source.chunks()){const i=e.reader.getCursor();for(;i.next();){const e=i.getObjectId();t.has(i.getDisplayId())&&!r.has(e)&&(s.push(i.readLegacyFeatureWorldSpace()),r.add(e))}}return{features:s,aggregates:[]}}async*applyOverride(e){const t=[],r=e.reader.getCursor();for(;r.next();){const e=r.getObjectId();t.push(e);const s=this._attributeStore.createDisplayIdForObjectId(e);r.setDisplayId(s),this._attributeStore.setAttributeData(s,r,this._evalOptions)}const s=this.getDisplayIds(t),i=this.getDisplayIds(e.removed);this._attributeStore.sendUpdates();const n=new Hc;n.applyOverrides(e);for(const e of this._sendStates.values())yield new ya(e.subscription,null,s,!1,n.queryInfo);for(const e of this._sendStates.values()){const t=n.getTileReader(e.subscription.tile);yield new ya(e.subscription,t,i,!1,n.queryInfo)}for(const t of e.removed)this._attributeStore.releaseDisplayIdForObjectId(t);for(const e of t)this._attributeStore.releaseDisplayIdForObjectId(e)}async*updateChunks(){if(this._source.chunks().length){await this._updateAttributeData();for(const e of this._sendStates.values())yield*this._update(e)}}async _updateAttributeData(){for(const e of this._source.chunks()){const{chunkId:t,reader:r}=e;if(!this.handledChunksForIdCreation.has(t)){this.handledChunksForIdCreation.add(t);const e=r.getCursor();for(;e.next();){const t=this._attributeStore.createDisplayIdForObjectId(e.getObjectId());e.setDisplayId(t)}}}for(const e of this._source.chunks())if(!this.handledChunksForAttributeData.has(e.chunkId)){this.handledChunksForAttributeData.add(e.chunkId);const t=e.reader.getCursor();for(;t.next();){const e=t.getDisplayId();this._attributeStore.setAttributeData(e,t,this._evalOptions)}}this._attributeStore.sendUpdates()}*_update(e){const{subscription:t,handledChunks:r}=e;for(const s of this._source.chunks()){const{chunkId:i}=s;if(r.has(i))continue;r.add(i);const n=s.getTileReader(t.tile);n&&(yield new fa(e.subscription,n,!1,s.end,s.queryInfo))}}}var Yc=r(19402);class qc{constructor(e){this.data=e,this._referenceCount=0}increment(){this._referenceCount+=1}decrement(){this._referenceCount+=1}empty(){return 0===this._referenceCount}}class $c{constructor(){this._freeIdsGenerationA=[],this._freeIdsGenerationB=[],this._idCounter=1,this._freeIds=this._freeIdsGenerationA,this._objectIdToDisplayId=new Map}incrementGeneration(){this._freeIds=this._freeIds===this._freeIdsGenerationA?this._freeIdsGenerationB:this._freeIdsGenerationA}createIdForObjectId(e){let t=this._objectIdToDisplayId.get(e);return t||(t=new qc((0|this._getFreeId())>>>0),t.increment(),this._objectIdToDisplayId.set(e,t)),t.data}releaseIdForObjectId(e){const t=this._objectIdToDisplayId.get(e);t&&(t.decrement(),t.empty()&&(this._objectIdToDisplayId.delete(e),this._freeIds.push(t.data)))}_getFreeId(){return this._freeIds.length?this._freeIds.pop():this._idCounter++}}const Xc=()=>u.Z.getLogger("esri.views.layers.2d.features.support.AttributeStore"),Kc=(Xc(),()=>null),Qc={sharedArrayBuffer:(0,n.Z)("esri-shared-array-buffer"),atomics:(0,n.Z)("esri-atomics")};class Jc{constructor(e,t,r,s){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;const{pixelType:i,layout:n,textureOnly:o}=s;this.textureOnly=o||!1,this.pixelType=i,this._ctype=t,this.layout=n,this._resetRange(),this._shared=e,this.size=r,o||(this.data=this._initData(i,r,e,t))}get buffer(){return this.data?.buffer}unsetComponentAllTexels(e,t){const r=this.data;for(let s=0;s<this.size*this.size;s++)r[s*this.texelSize+e]&=~t;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(e,t){const r=this.data;for(let s=0;s<this.size*this.size;s++)r[s*this.texelSize+e]|=255&t;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(e,t,r){const s=this.data;for(const i of r)s[i*this.texelSize+e]|=t,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}setComponentTexel(e,t,r){this.data[r*this.texelSize+e]|=t,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}unsetComponentTexel(e,t,r){this.data[r*this.texelSize+e]&=~t,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}getData(e,t){const r=lo(e);return this.data[r*this.texelSize+t]}setData(e,t,r){const s=lo(e),i=1<<t;0!=(this.layout&i)?null!=this.data&&(this.data[s*this.texelSize+t]=r,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):Xc().error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}lock(){this.pixelType===Ke.Br.UNSIGNED_BYTE&&this._shared&&Qc.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,1)}unlock(){this.pixelType===Ke.Br.UNSIGNED_BYTE&&this._shared&&Qc.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,0)}expand(e){if(this.size=e,!this.textureOnly){const t=this._initData(this.pixelType,e,this._shared,this._ctype),r=this.data;t.set(r),this.data=t}}toMessage(){const e=this.dirtyStart,t=this.dirtyEnd,r=this.texelSize;if(e>t)return null;this._resetRange();const s=!(this._shared||"local"===this._ctype),i=this.pixelType,n=this.layout,o=this.data;return{start:e,end:t,data:s&&o.slice(e*r,(t+1)*r)||null,pixelType:i,layout:n}}_initData(e,t,r,s){const i=r&&"local"!==s?SharedArrayBuffer:ArrayBuffer,n=function(e){switch(e){case Ke.Br.UNSIGNED_BYTE:return Uint8Array;case Ke.Br.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case Ke.Br.FLOAT:return Float32Array;default:return void u.Z.getLogger("esri.views.2d.engine.webgl.Utils").error(new h.Z("webgl-utils",`Unable to handle type ${e}`))}}(e),o=new n(new i(t*t*4*n.BYTES_PER_ELEMENT));for(let e=0;e<o.length;e+=4)o[e+1]=255;return o}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class el{constructor(e){this._client=e,this.updatingHandles=new Yc.R,this._filters=[],this._blocks=new Array,this._attributeComputeInfo=null,this._abortController=new AbortController,this._size=32,this._nextUpdate=null,this._currUpdate=null,this._idsToHighlight=new Set,this._referencesScale=!1,this._referencesGeometry=!1,this.version=0,this._idGenerator=new $c}destroy(){this._abortController.abort(),this.updatingHandles.destroy()}_initialize(e){if(null!=this._blockDescriptors)return;const t=e.capabilities.supportsTextureFloat?Ke.Br.FLOAT:Ke.Br.UNSIGNED_BYTE;Kc(`Creating AttributeStore ${Qc.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:Ke.Br.UNSIGNED_BYTE,layout:1},{pixelType:Ke.Br.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:Ke.Br.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}get referencesScale(){return this._referencesScale}get referencesGeometry(){return this._referencesGeometry}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}incrementDisplayIdGeneration(){this._idGenerator.incrementGeneration()}createDisplayIdForObjectId(e){return this._idGenerator.createIdForObjectId(e)}releaseDisplayIdForObjectId(e){return this._idGenerator.releaseIdForObjectId(e)}isUpdating(){const e=this.updatingHandles.updating||!!this._nextUpdate;return(0,n.Z)("esri-2d-log-updating")&&console.log(`Updating AttributeStore: ${e}\n -> updatingHandles ${this.updatingHandles.updating} (currUpdate: ${!!this._currUpdate})\n -> nextUpdate: ${!!this._nextUpdate}\n`),e}async update(e,t,r,s,i=0){const o=(0,L.Hg)(this._schema,e);if(this.version=i,o&&((0,n.Z)("esri-2d-update-debug")&&console.debug(`Version[${i}] AttributeStore.update`,{changed:o}),this._schema=e,this._attributeComputeInfo=null,this._initialize(e),null!=e))if(r&&(this._filters=await Promise.all(e.filters.map((e=>e?Ba.create({geometryType:r.geometryType,hasM:!1,hasZ:!1,timeInfo:r.timeInfo,fieldsIndex:new z.Z(r.fields),spatialReference:s??r.spatialReference,filterJSON:e}):null)))),"subtype"!==e.type)this._attributeComputeInfo={isSubtype:!1,map:new Map},await Promise.all(e.bindings.map((async e=>{const r=await this._bind(t,e);this._referencesGeometry=this._referencesGeometry||(r?.referencesGeometry()??!1),this._referencesScale=this._referencesScale||(r?.referencesScale()??!1)})));else{this._attributeComputeInfo={isSubtype:!0,subtypeField:e.subtypeField,map:new Map},this._referencesScale=!1,this._referencesGeometry=!1;for(const r in e.bindings){const s=e.bindings[r];await Promise.all(s.map((async e=>{const s=await this._bind(t,e,parseInt(r,10));this._referencesGeometry=this._referencesGeometry||(s?.referencesGeometry()??!1),this._referencesScale=this._referencesScale||(s?.referencesScale()??!1)})))}}}async setHighlight(e,t){const r=this._getBlock(0),s=t.map((e=>lo(e)));r.lock(),r.unsetComponentAllTexels(0,1),r.setComponent(0,1,s),r.unlock(),this._idsToHighlight.clear();for(const t of e)this._idsToHighlight.add(t);await this.sendUpdates()}setData(e,t,r,s){const i=lo(e);this._ensureSizeForTexel(i),this._getBlock(t).setData(e,r,s)}getData(e,t,r){return this._getBlock(t).getData(e,r)}getHighlightFlag(e){return this._idsToHighlight.has(e)?G.BB:0}unsetAttributeData(e){const t=lo(e);this._getBlock(0).setData(t,0,0)}setAttributeData(e,t,r){const s=lo(e);this._ensureSizeForTexel(s),this._getBlock(0).setData(s,0,this.getFilterFlags(t));const i=this._attributeComputeInfo,n=this._schema.capabilities.supportsTextureFloat?1:2;let o=null;i&&(o=i.isSubtype?i.map.get(t.readAttribute(i.subtypeField)):i.map,o?.size&&o.forEach(((e,i)=>{const o=i*n%4,a=Math.floor(i*n/4),c=this._getBlock(a+G.wi.VV);let l=e.field?.read(t,r);if(e.valueRepresentation&&(l=function(e,t){if(!e||!t)return e;switch(t){case"radius":case"distance":return 2*e;case"diameter":case"width":return e;case"area":return Math.sqrt(e)}return e}(l,e.valueRepresentation)),(null===l||isNaN(l)||l===1/0||l===-1/0)&&(l=Et),this._schema.capabilities.supportsTextureFloat)c.setData(s,o,l);else if(l===G.k9)c.setData(s,o,255),c.setData(s,o+1,255);else{const e=(0,po.uZ)(Math.round(l),-32767,32766)+32768,t=255&e,r=(65280&e)>>8;c.setData(s,o,t),c.setData(s,o+1,r)}})))}async sendUpdates(){if(this._nextUpdate)return this._nextUpdate.promise;if(this._currUpdate)return this._nextUpdate=(0,o.hh)(),this.updatingHandles.addPromise(this._nextUpdate.promise),this._nextUpdate.promise;const e=this._blocks.map((e=>null!=e?e.toMessage():null)),t={blocks:e,version:this.version};return e.some((e=>e))?((0,n.Z)("esri-2d-update-debug")&&console.debug("AttributeStore.sendUpdate"),this._currUpdate=this._createResources().then((()=>{const e=()=>{if(this._currUpdate=null,this._nextUpdate){const e=this._nextUpdate;this._nextUpdate=null,this.sendUpdates().then((()=>e.resolve()))}else(0,n.Z)("esri-2d-update-debug")};(0,n.Z)("esri-2d-update-debug");const r=this.updatingHandles.addPromise(this._client.update(t,this._signal).then(e).catch(e));return this._client.render(this._signal),r})).catch((e=>{if((0,o.D_)(e))return this._createResourcesPromise=null,this._createResources();Xc().error(new h.Z("mapview-attribute-store","Encountered an error during client update",e))})),this._currUpdate):void 0}_ensureSizeForTexel(e){for(;e>=this._size*this._size;)if(this._expand())return}async _bind(e,t,r){const s=await e.createComputedField(t),{valueRepresentation:i}=t,n=this._attributeComputeInfo;if(n.isSubtype){const e=n.map.get(r)??new Map;e.set(t.binding,{field:s,valueRepresentation:i}),n.map.set(r,e)}else n.map.set(t.binding,{field:s,valueRepresentation:i});return s}_createResources(){if(null!=this._createResourcesPromise)return this._createResourcesPromise;this._getBlock(G.wi.Animation),this._getBlock(G.wi.GPGPU),Kc("Initializing AttributeStore");const e={shared:Qc.sharedArrayBuffer&&!("local"===this._client.type),size:this._size,blocks:this._blocks.map((e=>null!=e?{textureOnly:e.textureOnly,buffer:e.buffer,pixelType:e.pixelType}:null))},t=this._client.initialize(e,this._signal).catch((e=>{(0,o.D_)(e)?this._createResourcesPromise=null:Xc().error(new h.Z("mapview-attribute-store","Encountered an error during client initialization",e))}));return this._createResourcesPromise=t,t.then((()=>null==this._createResourcesPromise?this._createResources():void 0)),t}_getBlock(e){const t=this._blocks[e];if(null!=t)return t;Kc(`Initializing AttributeBlock at index ${e}`);const r=Qc.sharedArrayBuffer,s=this._client.type,i=new Jc(r,s,this._size,this._blockDescriptors[e]);return this._blocks[e]=i,this._createResourcesPromise=null,i}_expand(){if(this._size<this._schema.capabilities.maxTextureSize){const e=this._size<<=1;Kc("Expanding block size to",e,this._blocks);for(const t of this._blocks)t?.expand(e);return this._createResourcesPromise=null,this._size=e,0}return Xc().error(new h.Z("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}isVisible(e){return!!(2&this._getBlock(0).getData(e,0))}getFilterFlags(e){let t=0;for(let r=0;r<this._filters.length;r++){const s=!!(1<<r),i=this._filters[r];t|=(!s||null==i||i.check(e)?1:0)<<r}let r=0;if(this._idsToHighlight.size){const t=e.getObjectId();r=this.getHighlightFlag(t)}return t<<1|r}}class tl{constructor(e,t){this._connection=e,this._source=t,this._attributeStore=new el({type:"remote",initialize:e=>(0,o.R8)(this._connection.attributeView.initialize(e)),update:e=>(0,o.R8)(this._connection.attributeView.requestUpdate(e)),render:()=>(0,o.R8)(this._connection.container.requestRender())}),this._version=1,this._proxy=new ra({fetch:(e,t)=>this._connection.layerView.fetch(e,t),fetchDictionary:(e,t)=>this._connection.layerView.fetchDictionary(e,t)})}destroy(){this._proxy.destory(),this._strategy?.destroy(),this._attributeStore.destroy()}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}getDisplayFeatures(e){return this._strategy?this._strategy.getDisplayFeatures(e):{features:[],aggregates:[]}}getFeatureObjectIdsForAggregate(e){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(e):[]}setHighlight(e){if(!this._strategy)return void this._attributeStore.setHighlight(e,[]);const t=this._strategy.getDisplayIds(e);this._attributeStore.setHighlight(e,t)}onSubscribe(e){this._strategy?.onSubscribe(e)}onUnsubscribe(e){this._strategy?.onUnsubscribe(e)}async update(e,t,r,s,i){const o=e.processor,a=(0,L.Hg)(this._schema,o);if(!a&&!s)return;(0,n.Z)("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:a,schema:o}),this._schema=o;const c=e.source.service,l=U.Z.fromJSON(e.source.outSpatialReference),u=new Ma({fields:new z.Z,spatialReference:l});return await this._attributeStore.update(o.storage,u,c,l,t),this._strategy?.invalidateAttributeData(),s||(0,L.uD)(a,"mesh")?((0,L.uD)(a,"mesh.strategy")&&await this._updateStrategy(o.mesh.strategy,l,i),this._updateSortKey(u,"sortKey"in o.mesh?o.mesh.sortKey:null),((0,L.uD)(a,"mesh.factory")||"dictionary"===o.mesh.factory.symbology.type)&&(this._factory=await ea.create(u,this._proxy,o.mesh.factory,r)),this._invalidate(),this._version=t,this._attributeStore.incrementDisplayIdGeneration(),this._connection.container.updateRenderState(this._version)):void 0}async applyOverride(e){if(!this._strategy)return;const t=this._strategy.applyOverride(e);for await(const e of t)try{await this._process(e)}catch(e){}this._source.applyOverride(e)}async updateChunks(){if(!this._strategy)return;const e=this._strategy.updateChunks(),t=[];for await(const r of e)t.push(this._process(r));try{await Promise.all(t)}catch{}}async _updateStrategy(e,t,r){switch(this._strategy?.destroy(),e.type){case"feature":this._strategy=new jc(this._source,this._attributeStore);break;case"binning":this._strategy=await oc.create(e,t,this._source,this._attributeStore);break;case"cluster":this._strategy=await cc.create(this._connection,e,t,this._source,this._attributeStore)}for(const e of r)this._strategy.onSubscribe(e)}async _updateSortKey(e,t){if(this._sortInfo=(0,R.SC)(this._sortInfo?.computed),null!=t){const r=await e.createComputedField(t);this._sortInfo={...t,computed:r}}}_invalidate(){this._strategy&&this._strategy.invalidate()}async _process(e){const t=e.subscription;if((0,n.Z)("esri-2d-update-debug")){const e=t.tile;console.debug(`Version[${this._version}] Tile[${e.key.id}] Processor._process`)}await this._fetchResources(e),(0,o.k_)(t.signal);const r=await this._write(e,t.tile.arcadeEvaluationOptions),s=t.tile.tileInfoView.tileInfo.isWrappable,{message:i,transferList:a}=r.serialize(s),c=e.createMessage(i,this._version);if((0,o.k_)(t.signal),await this._connection.container.onMessage(c,{signal:t.signal,transferList:a}),(0,n.Z)("esri-2d-update-debug")){const e=t.tile;console.debug(`Version[${this._version}] Tile[${e.key.id}] Processor._process.await`)}}async _fetchResources(e){await this._fetchMatcherResources(e),await this._fetchWriterResources(e)}async _fetchMatcherResources(e){if(e.reader)return this._factory.enqueueMatcherRequests(this._proxy,e.reader)}async _fetchWriterResources(e){if(!e.reader)return;const t=e.reader.getCursor(),r=e.subscription.tile.arcadeEvaluationOptions;for(;t.next();)this._factory.enqueueWriterRequests(this._proxy,t,r);await this._proxy.fetchEnqueuedResources()}async _write(e,t){const r=e.subscription.tile,s=e.reader?.getCursor(),i=s?.getSize()??0,n=new K(r.key.id,!0,i);if(!s)return n;const o=r.arcadeEvaluationOptions;for(;s.next();){const e=this._getSortKeyValue(s,t);n.entityStart(s.getDisplayId(),e),this._factory.write(n,this._proxy,s,o),n.entityEnd()}return n}_getSortKeyValue(e,t){if(!this._sortInfo)return 0;const{computed:r,order:s,byRenderer:i}=this._sortInfo,n=i?this._factory.getSortKey(e,t):r?.read(e,t);return null==n||isNaN(n)?0:n*("asc"===s?-1:1)}}var rl=r(3172),sl=r(34599);class il{static from(e){let t=0,r=0,s=0;return e.forEach((e=>{const i=e._readGeometry();i&&(r+=i.isPoint?1:i.lengths.reduce(((e,t)=>e+t),0),s+=i.isPoint?1:i.lengths.length,t+=1)})),new il(t,r,s)}constructor(e,t,r){this.featureCount=e,this.vertexCount=t,this.ringCount=r}toJSON(){return{featureCount:this.featureCount,ringCount:this.featureCount,vertexCount:this.featureCount}}}var nl=r(92835);class ol{constructor(){this.sourceDataChanged=!1,this.outFieldsChanged=!1}}function al(e){return"stream"===e.serviceInfo.type}class cl{constructor(){this._version=0}get version(){return this._version}get serviceInfo(){return this._serviceInfo}get pageSize(){if("stream"===this._serviceInfo.type)throw new Error("InternalError: StreamService does not support paged queries");const{query:e}=this._serviceInfo.capabilities,t=e.supportsMaxRecordCountFactor?4:null,r=(e.maxRecordCount??8e3)*(t??1);return Math.min(8e3,r)}update(e,t){const r=new ol;this._serviceInfo=e.service,this._version=t;const s=this._queryInfo,i=function(e){const t=e.service,r=U.Z.fromJSON(e.outSpatialReference),s="orderByFields"in t&&t.orderByFields?t.orderByFields:t.objectIdField+" ASC";return{returnCentroid:"esriGeometryPolygon"===t.geometryType,returnGeometry:!0,timeReferenceUnknownClient:"stream"!==t.type&&t.timeReferenceUnknownClient,outFields:e.availableFields,outSpatialReference:r,orderByFields:[s],where:e.definitionExpression||"1=1",serviceFilter:"stream"===t.type?t.serviceFilter??null:null,purgeOptions:"stream"===t.type?t.purgeOptions:null,gdbVersion:e.gdbVersion,historicMoment:e.historicMoment?new Date(e.historicMoment):null,timeExtent:e.timeExtent?nl.Z.fromJSON(e.timeExtent):null}}(e),n=e.service.fields.length;let o=function(e,t){const r=new Set;return e&&e.forEach((e=>r.add(e))),t&&t.forEach((e=>r.add(e))),r.has("*")?["*"]:Array.from(r)}(s?.outFields,i.outFields);o=o.length>=.75*n?["*"]:o,o.sort(),i.outFields=o;const a=(0,L.Hg)(s,i);return a?((0,L.uD)(a,"outFields")&&(r.outFieldsChanged=!0),(0,L.V7)(a,["timeExtent","where","serviceFilter","purgeOptions","gdbVersion","historicMoment","customParameters"])&&(r.sourceDataChanged=!0),this._queryInfo=i,r):r}createPatchFieldsQuery(e,t){const r=e.clone();if("*"===this._queryInfo.outFields[0]){if("*"===(r.outFields??[])[0])return null;r.outFields=this._queryInfo.outFields}else{const e=new Set(this._queryInfo.outFields),s=[];for(const r of e)t.has(r)||s.push(r);if(0===s.length)return null;r.outFields=s}return r.returnGeometry=!1,r.returnCentroid=!1,r.quantizationParameters=null,r.cacheHint=!0,r}createQuery(e={}){if(!this._queryInfo)throw new Error("InternalError: queryInfo should be defined");return new ka.Z({...this._queryInfo,...e})}createTileQuery(e,t){if("stream"===this._serviceInfo.type)throw new Error("InternalError: StreamService does not support tile queries");const r=this._serviceInfo.capabilities,s=this._serviceInfo.geometryType,i=this.createQuery(t);return i.quantizationParameters=t.quantizationParameters??e.getQuantizationParameters(),i.resultType="tile",i.geometry=e.extent,r.query.supportsQuantization?"esriGeometryPolyline"===s&&(i.maxAllowableOffset=e.resolution*(0,n.Z)("feature-polyline-generalization-factor")):"esriGeometryPolyline"!==s&&"esriGeometryPolygon"!==s||(i.maxAllowableOffset=e.resolution,"esriGeometryPolyline"===s&&(i.maxAllowableOffset*=(0,n.Z)("feature-polyline-generalization-factor"))),i.defaultSpatialReferenceEnabled=r.query.supportsDefaultSpatialReference,i.compactGeometryEnabled=r.query.supportsCompactGeometry,r.query.supportsMaxRecordCountFactor&&(i.maxRecordCountFactor=4),i}createPagedTileQuery(e,t){const r=this.pageSize;return this.createTileQuery(e,{start:r*t,num:r,returnExceededLimitFeatures:!0})}createPagedQuery(e){const t=this.pageSize;return this.createQuery({start:t*e,num:t,returnExceededLimitFeatures:!0,maxRecordCountFactor:4})}}let ll=class extends E.Z{constructor(e){super(),this._connection=e,this._enabledEventTypes=new Set,this._updateInfo={websocket:0,client:0},this._lastTime=performance.now(),this.addHandles([(0,c.YP)((()=>this._strategy?.connectionStatus??"disconnected"),(e=>{this._layerView.setProperty({propertyName:"pipelineConnectionStatus",value:e})}),{initial:!0}),(0,c.YP)((()=>this._strategy?.errorString||null),(e=>this._layerView.setProperty({propertyName:"pipelineErrorString",value:e})),{initial:!0})])}destroy(){this._strategy=null,this.removeAllHandles()}get _layerView(){return this._connection.layerView}set strategy(e){null==this._strategy&&this._resetUpdateInfo(performance.now());const t="event-handles";this.removeHandles(t),null!=e&&this.addHandles([e.events.on("data-received",(e=>this._onFeature(e))),e.events.on("message-received",(e=>this._onWebSocketMessage(e))),e.events.on("features-updated",(e=>this._onUpdate(e))),e.events.on("tick",(()=>this._onTick()))],t),this._strategy=e}updateCustomParameters(e){null!=e&&this._strategy?.updateCustomParameters(e)}sendMessageToSocket(e){this._strategy?.sendMessageToSocket(e)}sendMessageToClient(e){this._strategy?.sendMessageToClient(e)}enableEvent(e,t){t?this._enabledEventTypes.add(e):this._enabledEventTypes.delete(e)}disconnect(){this._strategy?.disconnect()}connect(){this._strategy?.connect()}clear(){this._strategy?.clear()}_onWebSocketMessage(e){this._enabledEventTypes.has("message-received")&&this._layerView.emitEvent({name:"message-received",event:e})}_onFeature(e){this._updateInfo.websocket++,this._enabledEventTypes.has("data-received")&&this._layerView.emitEvent({name:"data-received",event:{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry}})}_onUpdate(e){this._updateInfo.client+=e}_onTick(){const e=performance.now(),t=e-this._lastTime;if(t>2500){const r=Math.round(this._updateInfo.client/(t/1e3)),s=Math.round(this._updateInfo.websocket/(t/1e3));this._resetUpdateInfo(e),this._layerView.emitEvent({name:"update-rate",event:{client:r,websocket:s}})}}_resetUpdateInfo(e){this._lastTime=e,this._updateInfo.client=0,this._updateInfo.websocket=0}};(0,s._)([(0,l.Cb)()],ll.prototype,"_strategy",void 0),ll=(0,s._)([(0,A.j)("esri.views.2d.layers.features.sources.StreamMessenger")],ll);class ul{constructor(e,t){this._queryInfo=e,this._store=t,this._controller=new AbortController}destroy(){this._controller.abort()}get _options(){return{signal:this._controller.signal}}async fetch(e,t){throw new Error("InternalError: LoadStrategy does not support fetching")}}var hl=r(80903),dl=r(82397),pl=r(16467),_l=r(45091),fl=r(77863);const yl=268435455;class gl{constructor(){this.hasFeatures=!1,this.exceededTransferLimit=!1,this.fieldCount=0,this.featureCount=0,this.objectIdFieldIndex=0,this.vertexCount=0,this.offsets={attributes:new Array,geometry:new Array},this.centroid=new Array}}const ml=268435455,xl=128e3,bl={small:{delta:new Int32Array(128),decoded:new Int32Array(128)},large:{delta:new Int32Array(xl),decoded:new Int32Array(xl)}};function vl(e){return e<=bl.small.delta.length?bl.small:(e<=bl.large.delta.length||(bl.large.delta=new Int32Array(Math.round(1.25*e)),bl.large.decoded=new Int32Array(Math.round(1.25*e))),bl.large)}function wl(e){for(;e.next();){if(1===e.tag())return e.getMessage();e.skip()}return null}function Sl(e,t,r,s,i,n){return.5*Math.abs(e*s+r*n+i*t-e*n-r*t-i*s)}function Il(e,t,r,s){return 0==e*s-r*t&&e*r+t*s>0}class Tl extends sc{static fromBuffer(e,t,r=!1){const s=t.geometryType,i=function(e){try{const t=2,r=new _l.Z(new Uint8Array(e),new DataView(e));for(;r.next();){if(r.tag()===t)return wl(r.getMessage());r.skip()}}catch(e){const t=new h.Z("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:e});u.Z.getLogger("esri.view.2d.layers.features.support.FeatureSetReaderPBF").error(t)}return null}(e),n=function(e,t,r=!1){const s=e.asUnsafe(),i=s.pos(),n=new gl;let o=0,a=0,c=null,l=null,u=null,d=!1;const p=[];for(;s.next();)switch(s.tag()){case 1:c=s.getString();break;case 3:l=s.getString();break;case 12:u=s.processMessage(fl.G$);break;case 9:if(n.exceededTransferLimit=s.getBool(),n.exceededTransferLimit){n.offsets.geometry=r?new Float64Array(8e3):new Int32Array(8e3),n.centroid=r?new Float64Array(16e3):new Int32Array(16e3);for(let e=0;e<n.centroid.length;e++)n.centroid[e]=yl}break;case 13:{const e=s.processMessage(fl.wn);e.index=o++,p.push(e);break}case 15:{const e=s.getLength(),i=s.pos()+e;if(!n.exceededTransferLimit){const e=n.offsets.geometry,t=n.centroid;e.push(0),t.push(yl),t.push(yl)}!d&&n.exceededTransferLimit&&(d=!0,n.offsets.attributes=r?new Float64Array(8e3*o):new Uint32Array(8e3*o));let c=a*o;for(;s.pos()<i&&s.next();)switch(s.tag()){case 1:{d?n.offsets.attributes[c++]=s.pos():n.offsets.attributes.push(s.pos());const e=s.getLength();s.skipLen(e);break}case 2:if(t){const e=s.getLength(),t=s.pos()+e;for(;s.pos()<t&&s.next();)switch(s.tag()){case 3:{s.getUInt32();const e=s.getSInt64(),t=s.getSInt64();n.centroid[2*a]=e,n.centroid[2*a+1]=t;break}default:s.skip()}}else{n.offsets.geometry[a]=s.pos();const e=s.getLength();n.vertexCount+=e,s.skipLen(e)}break;case 4:{const e=s.getLength(),t=s.pos()+e;for(;s.pos()<t&&s.next();)switch(s.tag()){case 3:{s.getUInt32();const e=s.getSInt64(),t=s.getSInt64();n.centroid[2*a]=e,n.centroid[2*a+1]=t;break}default:s.skip()}break}default:s.skip()}a++,n.hasFeatures=!0;break}default:s.skip()}const _=c||l;if(!_)throw new h.Z("FeatureSet has no objectId or globalId field name");return n.fields=new z.Z(p),n.featureCount=a,n.fieldCount=o,n.objectIdFieldIndex=n.fields.get(_)?.index,n.transform=u,n.displayIds=new Uint32Array(n.featureCount),n.groupIds=new Uint16Array(n.featureCount),s.move(i),n}(i,"esriGeometryPoint"===s,r);return new Tl(i,n,t)}constructor(e,t,r){super(r),this._hasNext=!1,this._isPoints=!1,this._featureIndex=-1,this._featureOffset=0,this._cache={area:0,unquantGeometry:void 0,geometry:void 0,centroid:void 0,legacyFeature:void 0,optFeature:void 0},this._geometryType=r.geometryType,this._reader=e,this._header=t,this._hasNext=t.hasFeatures,this._isPoints="esriGeometryPoint"===r.geometryType}get _size(){return this._header.featureCount}get fields(){return this._header.fields}get geometryType(){return this._geometryType}get hasZ(){return!1}get hasM(){return!1}get hasFeatures(){return this._header.hasFeatures}get hasNext(){return this._hasNext}get exceededTransferLimit(){return this._header.exceededTransferLimit}getSize(){return this._size}getInTransform(){return this._header.transform}getCursor(){return this.copy()}getIndex(){return this._featureIndex}setIndex(e){this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0,this._featureIndex=e}getAttributeHash(){let e="";for(const t of this._header.fields.fields)e+=this._readAttributeAtIndex(t.index)+".";return e}getObjectId(){return this._readAttributeAtIndex(this._header.objectIdFieldIndex)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(e){this._header.displayIds[this._featureIndex]=e}readGeometryArea(){return this._cache.area||this._readGeometry(!0),this._cache.area}copy(){const e=this._reader.clone(),t=new Tl(e,this._header,this.metadata);return this.copyInto(t),t}next(){for(this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0;++this._featureIndex<this._size&&!this._getExists(););return this._featureIndex<this._size}_readX(){return this._header.centroid[2*this._featureIndex]}_readY(){return this._header.centroid[2*this._featureIndex+1]}_readServerCentroid(){const e=this._header.centroid[2*this._featureIndex],t=this._header.centroid[2*this._featureIndex+1];return e===ml?null:new de.Z([],[e,t])}_readGeometry(e=!1){if(void 0===this._cache.geometry){let t=null;if(this._isPoints){if(this._header.centroid[2*this._featureIndex]===ml)return null;const e=this._header.centroid[2*this._featureIndex],r=this._header.centroid[2*this._featureIndex+1];t=new de.Z([],[e,r])}else{const r=this._header.offsets.geometry[this._featureIndex],s=this._reader;if(0===r)return null;s.move(r);try{t=e?this._parseGeometryForDisplay(s):this._parseGeometry(s)}catch(e){return console.error("Failed to parse geometry!",e),null}}return this._cache.geometry=t,t}return this._cache.geometry}_readAttribute(e,t){const r=this._header.fields.get(e);if(null==r)return;let s=this._readAttributeAtIndex(r.index);"esriFieldTypeTimestampOffset"===this.fields.get(e)?.type&&(s=this.parseTimestampOffset(s));const i=this._header.fields.isDateField(r.name);return t?null==s?s:i?new Date(s):s:s}_readAttributes(){const e={};for(const t of this._header.fields.fields)e[t.name]=this._readAttributeAtIndex(t.index);return e}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._featureOffset=this._featureOffset,e._hasNext=this._hasNext}_readAttributeAtIndex(e){const t=this._header.offsets.attributes[this._featureIndex*this._header.fieldCount+e],r=this._reader;return r.move(t),function(e){const t=e.getLength(),r=e.pos()+t;for(;e.pos()<r&&e.next();)switch(e.tag()){case 1:return e.getString();case 2:return e.getFloat();case 3:return e.getDouble();case 4:return e.getSInt32();case 5:return e.getUInt32();case 6:return e.getInt64();case 7:return e.getUInt64();case 8:return e.getSInt64();case 9:return e.getBool();default:return e.skip(),null}return null}(r)}_readGeometryDeltaDecoded(e=!1){if(void 0===this._cache.unquantGeometry){const t=this._readGeometry(e);if(!t)return this._cache.unquantGeometry=void 0,null;if(!this.getInTransform())return this._cache.unquantGeometry=t,t;const r=vl(t.coords.length).decoded,s=t.clone(r),i=s.coords;let n=0;for(const e of s.lengths){for(let t=1;t<e;t++){const e=2*(n+t),r=2*(n+t-1);i[e]+=i[r],i[e+1]+=i[r+1]}n+=e}return this._cache.unquantGeometry=s,s}return this._cache.unquantGeometry}_parseGeometry(e){const t=e.asUnsafe(),r=t.getLength(),s=t.pos()+r,i=[],n=[];for(;t.pos()<s&&t.next();)switch(t.tag()){case 2:{const e=t.getUInt32(),r=t.pos()+e;for(;t.pos()<r;)n.push(t.getUInt32());break}case 3:{const e=t.getUInt32(),r=t.pos()+e;for(i.push(t.getSInt64()),i.push(t.getSInt64()),this.hasZ&&t.getSInt64(),this.hasM&&t.getSInt64();t.pos()<r;)i.push(t.getSInt64()),i.push(t.getSInt64()),this.hasZ&&t.getSInt64(),this.hasM&&t.getSInt64();break}default:t.skip()}return new de.Z(n,i)}_parseGeometryForDisplay(e){const t=e.asUnsafe(),r=t.getLength(),s=t.pos()+r,i=[],n=[];let o=0,a=0,c=null,l=0;const u="esriGeometryPolygon"===this.geometryType;for(;t.pos()<s&&t.next();)switch(t.tag()){case 2:{const e=t.getUInt32(),r=t.pos()+e;for(;t.pos()<r;){const e=t.getUInt32();i.push(e),o+=e}c=vl(2*o).delta;break}case 3:{t.getUInt32();const e=2+(this.hasZ?1:0)+(this.hasM?1:0);(0,R.O3)(c);for(const r of i)if(a+e*r>c.length)for(let e=0;e<r;e++)t.getSInt32(),t.getSInt32(),this.hasZ&&t.getSInt32(),this.hasM&&t.getSInt32();else if(u){const e=this.getAreaSimplificationThreshold(r,this._header.vertexCount);let s=2,i=1;const o=!1;let u=t.getSInt32(),h=t.getSInt32();c[a++]=u,c[a++]=h,this.hasZ&&t.getSInt32(),this.hasM&&t.getSInt32();let d=t.getSInt32(),p=t.getSInt32();for(this.hasZ&&t.getSInt32(),this.hasM&&t.getSInt32();s<r;){let r=t.getSInt32(),n=t.getSInt32();this.hasZ&&t.getSInt32(),this.hasM&&t.getSInt32();const o=u+d,_=h+p;Sl(u,h,o,_,o+r,_+n)>=e?(l+=-.5*(o-u)*(_+h),i>1&&Il(c[a-2],c[a-1],d,p)?(c[a-2]+=d,c[a-1]+=p):(c[a++]=d,c[a++]=p,i++),u=o,h=_):(r+=d,n+=p),d=r,p=n,s++}i<3||o?a-=2*i:(l+=-.5*(u+d-u)*(h+p+h),Il(c[a-2],c[a-1],d,p)?(c[a-2]+=d,c[a-1]+=p,n.push(i)):(c[a++]=d,c[a++]=p,n.push(++i)))}else{let e=0,s=t.getSInt32(),i=t.getSInt32();this.hasZ&&t.getSInt32(),this.hasM&&t.getSInt32(),c[a++]=s,c[a++]=i,e+=1;for(let n=1;n<r;n++){const r=t.getSInt32(),o=t.getSInt32(),u=s+r,h=i+o;l+=-.5*(u-s)*(h+i),this.hasZ&&t.getSInt32(),this.hasM&&t.getSInt32(),n>2&&Il(c[a-2],c[a-1],r,o)?(c[a-2]+=r,c[a-1]+=o):(c[a++]=r,c[a++]=o,e+=1),s=u,i=h}n.push(e)}break}default:t.skip()}return this._cache.area=l,n.length?new de.Z(n,c):null}}class El{constructor(e,t){this.service=e,this._metadata=t}destroy(){}}class Rl extends El{constructor(e,t){super(e,t),this._portsOpen=async function(e){const t=new hl.Z;return await t.open(e,{}),t}(e.source).then((e=>this.client=e))}destroy(){this.client.close(),this.client=null}async executeQuery(e,t){await this._portsOpen;const r=await this.client.invoke("queryFeatures",e.toJSON(),t);return ic.fromFeatureSet(r,this._metadata)}}class Al extends El{async executeQuery(e,t){const{data:r}=await(0,sl.n7)(this.service.source,e,t),s=!e.quantizationParameters;return Tl.fromBuffer(r,this._metadata,s)}}class Cl extends El{async executeQuery(e,t){const{source:r,capabilities:s,spatialReference:i,objectIdField:n,geometryType:o}=this.service;if(null!=e.quantizationParameters&&!s.query.supportsQuantization){const s=e.clone(),o=(0,dl.vY)(s.quantizationParameters);s.quantizationParameters=null;const{data:a}=await(0,sl.JT)(r,s,i,t),c=(0,ia.h_)(a,n);return(0,ia.RZ)(o,c),ic.fromOptimizedFeatureSet(c,this._metadata)}const{data:a}=await(0,sl.JT)(r,e,this.service.spatialReference,t);return"esriGeometryPoint"===o&&(a.features=a.features?.filter((e=>{if(null!=e.geometry){const t=e.geometry;return Number.isFinite(t.x)&&Number.isFinite(t.y)}return!0}))),ic.fromFeatureSet(a,this._metadata)}}class Ml extends El{async executeQuery(e,t){const{capabilities:r}=this.service;if(e.quantizationParameters&&!r.query.supportsQuantization){const r=e.clone(),s=(0,dl.vY)(r.quantizationParameters);r.quantizationParameters=null;const i=await(0,pl.WW)(this.service.source,e,t);return(0,ia.RZ)(s,i),ic.fromOptimizedFeatureSet(i,this._metadata)}const s=await(0,pl.WW)(this.service.source,e,t);return ic.fromOptimizedFeatureSet(s,this._metadata)}}class Fl extends ul{constructor(e,t,r,s){super(e,t),this._queryInfo=e,this._metadata=r,this._eventLog=s,this._queue=new M.e({concurrency:8,process:async e=>this._adapter.executeQuery(e.query,e.options)}),this._adapter=function(e,t){const{capabilities:r}=e;return function(e){return"ogc-source"===e?.type}(e.source)?new Ml(e,t):function(e){return Array.isArray(e.source)}(e)?new Rl(e,t):r.query.supportsFormatPBF&&(0,n.Z)("featurelayer-pbf")?new Al(e,t):new Cl(e,t)}(this._queryInfo.serviceInfo,r)}async updateFields(){const e=Array.from(this._store.chunks()).map((async e=>{const t=ka.Z.fromJSON(e.queryInfo.queryJSON);if(t)try{return await this._tryUpdateFields(e.reader,t),null}catch(e){return e}})),t=(await Promise.all(e)).filter((e=>e));if(t.length)throw new h.Z("featurelayer-query","Encountered errors when downloading fields",{errors:t})}async fetch(e,t){const r=await this._enqueue(e,t);return await this._tryUpdateFields(r,e),r}async _tryUpdateFields(e,t){const r=this._queryInfo.createPatchFieldsQuery(t,e.fields);if(!r)return;const s=await this._enqueue(r,this._options);e.joinAttributes(s)}async _enqueue(e,t){return this._eventLog.onEvent({type:"fetchStart"}),this._queue.push({query:e,options:t}).finally((()=>{this._eventLog.onEvent({type:"fetchEnd",done:0===this._queue.length})}))}}class Nl extends Fl{constructor(){super(...arguments),this._chunksById=new Map}unload(e){this._removeChunks(e.tile)}_addChunk(e){const t=e.tile.id,r=this._queryInfo.version;this._chunksById.has(t)||this._chunksById.set(t,[]);const s=e.size();(s||e.first||e.end)&&((0,n.Z)("esri-2d-update-debug")&&console.debug(`Version[${r}] Chunk[${e.chunkId}] ATileLoadStrategy.addChunk [count=${s}]`),this._chunksById.get(t).push(e),this._store.insert(e,r))}_removeChunks(e){const t=this._chunksById.get(e.key.id)??[];for(const r of t){if((0,n.Z)("esri-2d-update-debug")){const t=this._queryInfo.version;console.debug(`Version[${t}] Tile[${e.key.id}] Chunk[${r.chunkId}] ATileLoadStrategy.removeChunk`)}this._store.remove(r)}this._chunksById.delete(e.key.id)}}class Ol extends Zc{constructor(e,t,r,s,i,n){super(),this._reader=e,this._queryJSON=t,this._tile=r,this._sourceTile=s,this._sourceTileDepth=i,this._end=n,this.chunkId=`${this._tile.key.id}.${this._sourceTile?.key.id}${this._end?"e":""}`}get queryInfo(){return{type:"drill-down-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,sourceTileDepth:this._sourceTileDepth,sourceTileId:this._sourceTile?.key.id,size:this.size(),end:this.end}}get first(){return 0===this._sourceTileDepth}get reader(){return this._reader}get end(){return this._end}get tile(){return this._tile}getTileReader(e){return this._tile.key.id===e.key.id?this.reader:null}}class Pl{constructor(e,t){this.subscription=e,this._tileIdToResult=new Map,this._controller=new AbortController,(0,o.fu)(e.options,(()=>this._controller.abort())),(0,o.fu)(t,(()=>this._controller.abort()))}get(e){return this._tileIdToResult.get(e)}set(e,t){this._tileIdToResult.set(e,t)}get options(){return{signal:this._controller.signal}}}class kl extends Nl{constructor(){super(...arguments),this._loadStates=new Map}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}async load(e){this._loadStates.has(e.key.id)||this._loadStates.set(e.key.id,new Pl(e,this._options));const t=this._loadStates.get(e.key.id);let r;try{for await(const r of this._fetchChunkInfos(t,e.tile,0)){const{queryJSON:t,reader:s,sourceTile:i,sourceTileDepth:n,tile:a}=r,c=new Ol(s,t,a,i,n,!1);(0,o.k_)(e.options),this._addChunk(c)}}catch(e){r=e}const s=new Ol(ic.empty(this._metadata),null,e.tile,null,-1,!0);if(this._addChunk(s),r)throw r}unload(e){super.unload(e),this._loadStates.delete(e.key.id)}async*_fetchChunkInfos(e,t,r){let s=e.get(t.id);const i=!!s;if(s||(s=await this._fetchChunkInfo(e,t,r),e.set(t.id,s)),s.reader.exceededTransferLimit&&r<(0,n.Z)("featurelayer-query-max-depth"))for(const s of t.createChildTiles())yield*this._fetchChunkInfos(e,s,r+1);else i||(yield s)}async _fetchChunkInfo(e,t,r){const s=e.subscription.tile.getQuantizationParameters(),i=this._queryInfo.createTileQuery(t,{returnExceededLimitFeatures:!1,quantizationParameters:s});return{reader:await this.fetch(i,e.subscription.options),queryJSON:i.toJSON(),tile:e.subscription.tile,sourceTile:t,sourceTileDepth:r}}}class Dl extends Zc{constructor(e,t,r,s,i){super(),this._reader=e,this._queryJSON=t,this._tile=r,this._page=s,this._end=i,this.chunkId=`${this._tile.key.id}.${this._page}${this.end?"e":""}`}get queryInfo(){return{type:"paged-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}get reader(){return this._reader}get first(){return 0===this._page}get end(){return!this._end}get page(){return this._page}get tile(){return this._tile}getTileReader(e){return this._tile.key.id===e.key.id?this.reader:null}}class Bl{constructor(e,t){this.subscription=e,this._pages=new Set,this._controller=new AbortController,this._done=!1,(0,o.fu)(e.options,(()=>this._controller.abort())),(0,o.fu)(t,(()=>this._controller.abort()))}resetAbortController(){this._controller=new AbortController}get pageStart(){let e=-1;for(const t of this._pages.values())e=Math.max(e,t);return e+1}get done(){return this._done}get options(){return{signal:this._controller.signal}}add(e,t){this._pages.add(e),this._done=this._done||t}}class Ll extends Nl{constructor(){super(...arguments),this._loadStates=new Map}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}async load(e){this._loadStates.has(e.key.id)||this._loadStates.set(e.key.id,new Bl(e,this._options));const t=this._loadStates.get(e.key.id);let r;t.resetAbortController();try{await this._fetchPages(t)}catch(e){r=e}const s=new Dl(ic.empty(this._metadata),null,e.tile,-1,!0);if(this._addChunk(s),r)throw r}unload(e){super.unload(e),this._loadStates.delete(e.key.id)}async _fetchPages(e){let t=0,r=e.pageStart,s=1;for(;t<20&&!e.done;){const i=[];for(let t=0;t<s;t++)i.push(this._fetchChunk(e,r++));const n=await Promise.all(i);for(const t of n)(0!==t.size()||t.first)&&(e.add(t.page,!t.reader.exceededTransferLimit),(0,o.k_)(e.options),this._addChunk(t));t++,s=Math.min(s+1,4)}}async _fetchChunk(e,t){const r=e.subscription.tile,s=this._queryInfo.createPagedTileQuery(r,t),i=await this.fetch(s,e.options);return new Dl(i,s.toJSON(),r,t,!1)}}class Ul extends Zc{constructor(e,t,r,s){super(),this._reader=e,this._queryJSON=t,this._page=r,this._end=s,this.chunkId=`${this._page}${this.end?"e":""}`}get reader(){return this._reader}get first(){return 0===this._page}get end(){return this._end}get queryInfo(){return{type:"snapshot",chunkId:this.chunkId,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}getTileReader(e){const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}class zl extends Fl{constructor(e,t,r,s,i){super(e,t,s,i),this._random=new a.Z(1e3),this._promise=this._downloadPages(r)}get about(){return{willQueryAllFeatures:!0,willQueryFullResolutionGeometry:!0}}load(e){return this._promise}unload(e){}async _downloadPages(e){const t=Math.ceil(e/this._queryInfo.pageSize),r=Array.from({length:t},((e,t)=>t)).sort(((e,t)=>this._random.getInt()-this._random.getInt())),s=await Promise.all(r.map((e=>this._downloadPage(e)))),i=new Ul(ic.empty(this._metadata),null,-1,!0);this._store.insert(i,this._queryInfo.version);const n=s.filter((e=>e));if(n.length)throw new h.Z("featurelayer-query","Encountered errors when downloading data",{errors:n})}async _downloadPage(e){try{const t=this._queryInfo.createPagedQuery(e),r=await this.fetch(t,this._options),s=new Ul(r,t.toJSON(),e,!1);return(0,o.k_)(this._options),this._store.insert(s,this._queryInfo.version),null}catch(e){return e}}}class Gl{constructor(e){this.size=0,this._start=0,this.maxSize=e,this._buffer=new Array(e)}get entries(){return this._buffer}enqueue(e){if(this.size===this.maxSize){const t=this._buffer[this._start];return this._buffer[this._start]=e,this._start=(this._start+1)%this.maxSize,t}return this._buffer[(this._start+this.size++)%this.maxSize]=e,null}dequeue(){if(0===this.size)return null;const e=this._buffer[this._start];return this._buffer[this._start]=null,this.size--,this._start=(this._start+1)%this.maxSize,e}peek(){return 0===this.size?null:this._buffer[this._start]}find(e){if(0===this.size)return null;for(const t of this._buffer)if(null!=t&&e(t))return t;return null}clear(e){let t=this.dequeue();for(;null!=t;)e&&e(t),t=this.dequeue()}}const Vl="__esri_timestamp__";class Zl{constructor(e,t,r,s,i=128){this._trackIdToObservations=new Map,this._idCounter=0,this._lastPurge=performance.now(),this._addOrUpdated=new Map,this._removed=[],this._maxAge=0,this._timeInfo=r,this._purgeOptions=s,this.store=e,this.objectIdField=t,this.purgeInterval=i,this._useGeneratedIds="__esri_stream_id__"===this.objectIdField}removeById(e){this._removed.push(e)}removeByTrackId(e){const t=this._trackIdToObservations.get(e);if(t)for(const e of t.entries)this._removed.push(e)}add(e){if(this._useGeneratedIds){const t=this._nextId();e.attributes[this.objectIdField]=t,e.objectId=t}else e.objectId=e.attributes[this.objectIdField];const t=e.objectId;if(this._addOrUpdated.set(t,e),this._maxAge=Math.max(this._maxAge,e.attributes[this._timeInfo.startTimeField]),!this._timeInfo.trackIdField)return null==this._trackIdLessObservations&&(this._trackIdLessObservations=new Gl(1e5)),void this._trackIdLessObservations.enqueue(t);const r=e.attributes[this._timeInfo.trackIdField];if(!this._trackIdToObservations.has(r)){const e=null!=this._purgeOptions?.maxObservations?this._purgeOptions.maxObservations:1e3,t=(0,po.uZ)(e,0,1e3);this._trackIdToObservations.set(r,new Gl(t))}const s=this._trackIdToObservations.get(r),i=s?.enqueue(t);null!=i&&(this._addOrUpdated.has(i)?this._addOrUpdated.delete(i):this._removed.push(i))}checkForUpdates(){const e=this._getToAdd(),t=this._getToRemove(),r=performance.now();r-this._lastPurge>=this.purgeInterval&&(this._purge(r),this._lastPurge=r);const s=[];if(null!=t)for(const e of t){const t=this.store.removeById(e);null!=t&&s.push(t)}const i=[];if(null!=e){const s=new Set(t??[]);for(const t of e)s.has(t.objectId)||(t.attributes[Vl]=r,this.store.add(t),i.push(t))}(i.length||s?.length)&&this.store.update(i,s)}_getToAdd(){if(!this._addOrUpdated.size)return null;const e=new Array(this._addOrUpdated.size);let t=0;return this._addOrUpdated.forEach((r=>e[t++]=r)),this._addOrUpdated.clear(),e}_getToRemove(){const e=this._removed;return this._removed.length?(this._removed=[],e):null}_nextId(){const e=this._idCounter;return this._idCounter=(this._idCounter+1)%4294967294+1,e}_purge(e){const t=this._purgeOptions;null!=t&&(this._purgeSomeByDisplayCount(t),this._purgeByAge(t),this._purgeByAgeReceived(e,t),this._purgeTracks())}_purgeSomeByDisplayCount(e){if(!e.displayCount)return;let t=this.store.size;if(t>e.displayCount){if(this._timeInfo.trackIdField)for(const r of this._trackIdToObservations.values())if(t>e.displayCount&&r.size){const e=r.dequeue();this._removed.push(e),t--}if(null!=this._trackIdLessObservations){let r=t-e.displayCount;for(;r-- >0;){const e=this._trackIdLessObservations.dequeue();null!=e&&this._removed.push(e)}}}}_purgeByAge(e){const t=this._timeInfo?.startTimeField;if(!e.age||!t)return;const r=60*e.age*1e3,s=this._maxAge-r;this.store.forEach((e=>{e.attributes[t]<s&&this._removed.push(e.objectId)}))}_purgeByAgeReceived(e,t){if(!t.ageReceived)return;const r=e-60*t.ageReceived*1e3;this.store.forEach((e=>{e.attributes[Vl]<r&&this._removed.push(e.objectId)}))}_purgeTracks(){this._trackIdToObservations.forEach(((e,t)=>{0===e.size&&this._trackIdToObservations.delete(t)}))}}var Hl=r(95047);let Wl=class extends E.Z{constructor(e){super(e)}get connectionStatus(){return this.connection?.connectionStatus}get errorString(){return this.connection?.errorString}};(0,s._)([(0,l.Cb)()],Wl.prototype,"connection",void 0),(0,s._)([(0,l.Cb)()],Wl.prototype,"connectionStatus",null),(0,s._)([(0,l.Cb)()],Wl.prototype,"errorString",null),Wl=(0,s._)([(0,A.j)("esri.views.2d.layers.features.sources.StreamConnectionState")],Wl);class jl{constructor(e,t){this._metadata=e,this._onUpdate=t,this._objectIdToFeature=new Map}get size(){return this._objectIdToFeature.size}get reader(){return ic.fromFeatures([...this._objectIdToFeature.values()],this._metadata)}add(e){this._objectIdToFeature.set(e.objectId,e)}forEach(e){this._objectIdToFeature.forEach(e)}removeById(e){const t=this._objectIdToFeature.get(e);return t?(this._objectIdToFeature.delete(e),t):null}clear(){this._objectIdToFeature=new Map}update(e,t){this._onUpdate(e?.length??0)}}class Yl extends Zc{constructor(e){super(),this._reader=e,this.chunkId="stream-chunk"}get reader(){return this._reader}get first(){return!0}get end(){return!0}get queryInfo(){return{type:"stream",chunkId:this.chunkId,size:this.size(),end:this.end}}getTileReader(e){const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}class ql extends ul{constructor(e,t,r,s){super(e,t),this._queryInfo=e,this._streamOptions=r,this._connectionState=new Wl,this.events=new ca.Z;const{objectIdField:i,timeInfo:n,purgeOptions:o}=e.serviceInfo;this._stagingStore=new jl(s,(e=>this.events.emit("features-updated",e))),this._manager=new Zl(this._stagingStore,i,n,o),this.connect()}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}get connectionStatus(){return this._connectionState.connectionStatus}get errorString(){return this._connectionState?.errorString}get service(){return this._queryInfo.serviceInfo}async refresh(){this._manager.checkForUpdates(),this._chunk&&this._store.remove(this._chunk),this._chunk=new Yl(this._stagingStore.reader),this._store.insert(this._chunk,this._queryInfo.version),this.events.emit("tick")}destroy(){super.destroy(),this.disconnect()}async load(e){}unload(e){}async updateFields(){this.disconnect(),this.clear(),this.connect()}disconnect(){this._connection=(0,R.SC)(this._connection),this._connectionState.connection=null,this._handlesGroup?.remove()}connect(){if(null!=this._connection)return;const{geometryType:e,source:t,spatialReference:r,serviceFilter:s,maxReconnectionAttempts:n,maxReconnectionInterval:o,customParameters:a}=this._queryInfo.serviceInfo;this._connection=(0,Hl.createConnection)(t,r,this._streamOptions.outSR,e,s,n,o,a??{}),this._handlesGroup=(0,i.AL)([this._connection.on("data-received",(e=>this._onFeature(e))),this._connection.on("message-received",(e=>this._onWebSocketMessage(e)))]),this._connectionState.connection=this._connection}clear(){this._manager.checkForUpdates(),this._stagingStore.clear()}updateCustomParameters(e){this._connection?.updateCustomParameters(e)}sendMessageToSocket(e){this._connection?.sendMessageToSocket(e)}sendMessageToClient(e){this._connection?.sendMessageToClient(e)}_onWebSocketMessage(e){if("type"in e)switch(e.type){case"delete":if(e.objectIds)for(const t of e.objectIds)this._manager.removeById(t);if(e.trackIds)for(const t of e.trackIds)this._manager.removeByTrackId(t);break;case"clear":this.clear()}this.events.emit("message-received",e)}_onFeature(e){try{this._manager.add(e),this.events.emit("data-received",e)}catch(e){}}}class $l{constructor(e){this._onChange=e,this._chunks=new Map,this._overrideChunk=new Hc,this.events=new ca.Z,this.featureAdapter=new Da}destroy(){this.clear()}clear(){for(const e of this.chunks())this.events.emit("remove",e);this._chunks.clear()}*chunks(){this._overrideChunk&&(yield this._overrideChunk),yield*this._chunks.values()}insert(e,t){(0,n.Z)("esri-2d-update-debug")&&console.debug(`Version[${t}] Chunk[${e.chunkId}] SourceChunkStore.insert`),this._overrideChunk.overridenIds.size&&e.reader.removeIds(this._overrideChunk.overridenIds),this._chunks.set(e.chunkId,e),this.events.emit("changed"),this._onChange()}remove(e){(0,n.Z)("esri-2d-update-debug")&&console.debug(`Chunk[${e.chunkId}] SourceChunkStore.remove`),this._chunks.delete(e.chunkId),this.events.emit("remove",e)}applyOverrides(e){this._overrideChunk.applyOverrides(e);for(const e of this._chunks.values())e.reader.removeIds(this._overrideChunk.overridenIds)}forEach(e){const t=new Set;for(const r of this.chunks()){const s=r.reader.getCursor();for(;s.next();){const r=s.getObjectId();t.has(r)||(e(s.copy()),t.add(r))}}}forEachUnsafe(e){const t=new Set;for(const r of this.chunks()){const s=r.reader.getCursor();for(;s.next();){const r=s.getObjectId();t.has(r)||(e(s),t.add(r))}}}forEachInBounds(e,t){const r=new Set;for(const s of this.chunks()){const i=s.queryFeaturesInBounds(e);for(;i.next();){const e=i.getObjectId();r.has(e)||(t(i.copy()),r.add(e))}}}forEachBounds(e,t){const r=(0,la.Ue)();for(const s of e)s.getBounds(r)&&t(r)}}class Xl{constructor(e,t,r,s){this._aggregateAdapter=e,this._subscriptions=t,this._onChange=r,this._connection=s,this._updatingHandles=new Yc.R,this._queryInfo=new cl,this._store=new $l(this._onChange)}destroy(){this._strategy.destroy(),this._store.destroy(),this._streamMessenger?.destroy()}get _eventLog(){return this._connection.eventLog}get metadata(){if(!this._metadata)throw new Error("InternalError: Metadata not defined. Was update called?");return this._metadata}get service(){return this._schema.service}get store(){return this._store}get streamMessenger(){return this._streamMessenger}get statistics(){return il.from(this._store)}get updating(){return this._updatingHandles.updating}get queryEngine(){if(!this._queryEngine){const{outSpatialReference:e,definitionExpression:t,availableFields:r}=this._schema,{objectIdField:s,geometryType:i,timeInfo:n}=this._schema.service;this._queryEngine=new aa.q({featureStore:this._store,fieldsIndex:z.Z.fromJSON(this._schema.service.fieldsIndex),geometryType:i,objectIdField:s,hasM:!1,hasZ:!1,spatialReference:e,cacheSpatialQueries:!0,aggregateAdapter:this._aggregateAdapter,timeInfo:n,definitionExpression:t,availableFields:r})}return this._queryEngine}get isStream(){return al(this._queryInfo)}chunks(){return Array.from(this._store.chunks())}onSubscribe(e){this._eventLog.onEvent({type:"subscribe",tile:e.tile.id});const t=this._strategy?.load(e);t&&(t.then((()=>this._eventLog.onEvent({type:"loaded",tile:e.tile.id}))).catch((t=>this._eventLog.onEvent({type:"error",tile:e.tile.id,error:t}))),this._updatingHandles.addPromise(t))}onResume(e){this._updatingHandles.addPromise((0,o.R8)(this._strategy?.load(e)))}onUnsubscribe(e){this._eventLog.onEvent({type:"unsubscribe",tile:e.tile.id}),this._strategy?.unload(e)}getOverride(e){return this._updatingHandles.addPromise(this._doGetOverride(e))}applyOverride(e){this._store.applyOverrides(e)}async update(e,t,r){const s=e.source,i=this._schema,o=(0,L.Hg)(i,s);if(null==o)return{outFieldsChanged:!1,sourceDataChanged:!1};if(this._schema=s,(0,L.$c)(o,"sourceRefreshVersion")&&this._strategy?.refresh)return await this._strategy.refresh(),{sourceDataChanged:!0,outFieldsChanged:!1};this._queryEngine?.destroy(),this._queryEngine=null,this._metadata=new La(this._schema.service),null==this._lastEditDate&&"lastEditDate"in this._schema.service&&(this._lastEditDate=this._schema.service.lastEditDate),null==this._streamMessenger&&"stream"===this._schema.service.type&&(this._streamMessenger=new ll(r));const a=this._queryInfo.update(this._schema,t);if((0,n.Z)("esri-2d-update-debug")&&console.debug(`Version[${t}] FeatureSource.update`,{changeState:a}),a.sourceDataChanged=a.sourceDataChanged||i?.sourceRefreshVersion!==this._schema.sourceRefreshVersion,a.sourceDataChanged)await this._updateStrategy(t);else if(a.outFieldsChanged)if(await this._queryLastEditDateChanged())await this._updateStrategy(t);else{this._eventLog.onEvent({type:"updateFieldsStart"});try{await this._strategy.updateFields(),this._eventLog.onEvent({type:"updateFieldsEnd"})}catch(e){this._eventLog.onEvent({type:"updateFieldsError",error:e})}}return a}async _doGetOverride({edits:e}){const t=[],r=[];for(const s of e.removed)null!=s.objectId&&-1!==s.objectId?t.push(s.objectId):r.push(s.globalId);t.push(...this._mapGlobalIdsToObjectIds(r));const s=e.addOrModified.map((({objectId:e})=>e)),i=this._queryInfo.createQuery({objectIds:s});return{reader:await this._strategy.fetch(i),removed:t}}_mapGlobalIdsToObjectIds(e){const t=new Set(e),r=this.service.globalIdField,s=[];return this._store.forEachUnsafe((e=>{const i=e.readAttribute(r);t.has(i)&&s.push(e.getObjectId())})),s}async _queryLastEditDateChanged(){if(null==this._lastEditDate)return!1;const e=this._schema.service.source,t={...e.query,f:"json"},r=(await(0,rl.Z)(e.path,{query:t,responseType:"json"})).data.editingInfo.lastEditDate;return r!==this._lastEditDate&&(this._lastEditDate=r,!0)}async _createStrategy(){const e=this._queryInfo.serviceInfo,t="remote"===e.type&&e.isSourceHosted,r=Array.isArray(e.source),s=t||r;if(al(this._queryInfo)){const e=new ql(this._queryInfo,this._store,{outSR:this._schema.outSpatialReference},this.metadata);return this._streamMessenger.strategy=e,e}if(!function(e){const t=e.serviceInfo.type;return"memory"===t||"remote"===t}(this._queryInfo))throw new Error("Unknown load strategy!");const i=await this._supportSnapshotMode();return i?new zl(this._queryInfo,this._store,i.featureCount,this.metadata,this._eventLog):s?new Ll(this._queryInfo,this._store,this.metadata,this._eventLog):new kl(this._queryInfo,this._store,this.metadata,this._eventLog)}async _updateStrategy(e){const t=await this._createStrategy();this._eventLog.onEvent({type:"updateStrategyStart",about:t.about});const r=!!this._strategy;this._store.clear(),this._strategy?.destroy(),this._strategy=t,(0,n.Z)("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureSource.updateStrategy`,{strategy:t});const s=Array.from(this._subscriptions.values());if(!s.length)return void this._eventLog.onEvent({type:"updateStrategyEnd"});const i=Promise.all(s.map((e=>this._strategy.load(e).then((()=>this._eventLog.onEvent({type:"loaded",tile:e.tile.id}))).catch((t=>this._eventLog.onEvent({type:"error",tile:e.tile.id,error:t}))))));this._updatingHandles.addPromise(i);try{r&&await i}catch(e){(0,o.H9)(e)}this._eventLog.onEvent({type:"updateStrategyEnd"}),(0,n.Z)("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureSource.updateStrategyEnd`,{strategy:t})}async _supportSnapshotMode(){const e=this._schema.service;if("stream"===e.type||"memory"===e.type)return null;if(!e.supportsSnapshotMinThreshold)return null;const t=e.source,r=this._queryInfo.createQuery();r.returnGeometry=!1;const s=(await(0,sl.hH)(t,r)).data.count,{min:i,max:n}=e.snapshotCountThresholds;return s<=i||e.supportsSnapshotMaxThreshold&&s<n?{featureCount:s}:null}}var Kl=r(61247);class Ql{constructor(e,t){this._handles=new Kl.Z,this._abortController=new AbortController,this._resolver=(0,o.hh)(),this._isDone=!1,this._aborted=!1,this.tile=e,this._version=t,this._handles.add([])}destroy(){this.pause(),this._handles.destroy()}get key(){return this.tile.key}get version(){return this._version}set version(e){this._version=e}get signal(){return this._abortController.signal}get options(){return{signal:this._abortController.signal}}get done(){return this._resolver.promise}get isDone(){return this._isDone}resolve(){this._isDone=!0,this._resolver.resolve()}get paused(){return this._aborted}resume(){this._abortController=new AbortController,this._aborted=!1}pause(){this._aborted||(this._aborted=!0,this._abortController.abort())}}var Jl=r(3894),eu=r(6570),tu=r(6388);class ru{constructor(e,t){this.key=new _.Z(0,0,0,0),this.bounds=(0,D.Ue)(),this.objectIds=new Set,this.key.set(t);const r=e.getLODInfoAt(this.key);this.tileInfoView=e,this.tileInfoView.getTileBounds(this.bounds,this.key,!0),this.resolution=r.resolution,this.scale=r.scale,this.level=r.level}get lod(){return this.tileInfoView.getLODInfoAt(this.key)}get id(){return this.key.id}get extent(){return eu.Z.fromBounds(this.bounds,this.tileInfoView.tileInfo.spatialReference)}get transform(){return{originPosition:"upperLeft",scale:[this.resolution,this.resolution],translate:[this.bounds[0],this.bounds[3]]}}get arcadeEvaluationOptions(){return{$view:{scale:this.scale}}}createChildTiles(){const e=this.key.getChildKeys(),t=Jl.Z.acquire();for(let r=0;r<e.length;r++)t[r]=new ru(this.tileInfoView,e[r]);return t}getQuantizationParameters(){return tu.Z.fromJSON({mode:"view",originPosition:"upperLeft",tolerance:this.resolution,extent:{xmin:this.bounds[0],ymin:this.bounds[1],xmax:this.bounds[2],ymax:this.bounds[3],spatialReference:this.tileInfoView.tileInfo.spatialReference}})}}class su{constructor(e){this.edit=e,this.resolver=(0,o.hh)()}}class iu{constructor(){this._aggregateAdapter={getFeatureObjectIds:e=>this._processor.getFeatureObjectIdsForAggregate(e)},this._subscriptions=new Map,this._preventChunkUpdates=!1}destroy(){this._subscriptions.clear(),this._processor.destroy(),this._source.destroy(),this._handles.remove(),this._editState=null,this._tileInfoView=null}onDetach(){this.destroy(),this._initialize(this._connection)}_initialize(e){this._source=new Xl(this._aggregateAdapter,this._subscriptions,(()=>this._updateChunks()),e),this._handles=(0,i.AL)([(0,c.YP)((()=>this.updatingData),(e=>{this._updateChunks(),this._connection.layerView.setDataUpdating(e)}))]),this._processor=new tl(e,this._source)}set remoteClient(e){this._connection=new B(e),this._initialize(this._connection)}get features(){return this._source.queryEngine}get aggregates(){return this._processor.aggregateQueryEngine}get processor(){return this._processor}get streamMessenger(){return null==this._source.streamMessenger&&(0,n.Z)("esri-2d-update-debug")&&console.error("Pipeline error -- main thread tried to access nonexistent stream messenger"),this._source.streamMessenger}get updatingData(){return this._source.updating}async onEdits(e){if(null!=this._editState)throw new Error("InternalError - Already processing an edit");this._editState=new su(e);const t=this._editState.resolver.promise;return this._updateChunks(),t}async updateSubscriptions(e){if((0,n.Z)("esri-2d-update-debug")&&console.debug("Pipeline.updateSubscriptions",e),!this._tileInfoView){const t=d.Z.fromJSON(e.tileInfoJSON);this._tileInfoView=new T(t)}for(const t of e.subscribe)this._subscribe(t);for(const t of e.unsubscribe)this._unsubscribe(t);if((0,n.Z)("featurelayer-query-pausing-enabled"))for(const t of e.pause)this._pauseSubscription(t)}async update(e,t){if(this._preventChunkUpdates=!0,(0,n.Z)("esri-2d-update-debug")&&console.debug(`Version[${t}] Pipeline.updateStart`,{schema:e}),!this._tileInfoView){const t=d.Z.fromJSON(e.source.tileInfoJSON);this._tileInfoView=new T(t)}const r={tileInfo:this._tileInfoView?.tileInfo};try{const s=(await this._source.update(e,t,this._connection)).sourceDataChanged,i=Array.from(this._subscriptions.values());await this._processor.update(e,t,r,s,i),this._preventChunkUpdates=!1,await this._updateChunks()}catch(e){console.error(e)}(0,n.Z)("esri-2d-update-debug")&&console.debug(`Version[${t}] Pipeline.updateEnd`)}queryStatistics(){return this._source.statistics.toJSON()}async queryVisibleFeatures(e,t){return this.features.executeQuery(e,t)}async getSampleFeatures(e){const t=this._source.chunks();if(t.reduce(((e,t)=>e+t.size()),0)<=e.minFeatureCount){if(!this._source.updating){const e=[];return this._source.store.forEachUnsafe((t=>e.push(t.readLegacyFeatureWorldSpace()))),e}return null}const r=new Set,s=[],i=t.map((e=>e.reader.getCursor())),n=new a.Z,o=3*e.sampleSize;for(let a=0;a<o&&s.length<e.sampleSize;a++){const e=i[n.getIntRange(0,t.length-1)];if(0===e.getSize())continue;const o=n.getIntRange(0,e.getSize()-1);e.setIndex(o);const a=e.getObjectId();r.has(a)||(r.add(a),s.push(e.readLegacyFeatureWorldSpace()))}return s.length>=e.sampleSize?s:null}_subscribe(e){const t=e.tileId;if(this._subscriptions.has(t)){const r=this._subscriptions.get(t);return void(r.paused&&((0,n.Z)("esri-2d-update-debug")&&console.debug(`Tile[${t}] Pipeline.resume`),r.resume(),r.version=e.version,this._source.onResume(r)))}(0,n.Z)("esri-2d-update-debug")&&console.debug(`Tile[${t}] Pipeline.subscribe`);const r=new ru(this._tileInfoView,t),s=new Ql(r,e.version);this._subscriptions.set(t,s),this._source.onSubscribe(s),this._processor.onSubscribe(s)}_unsubscribe(e){const t=this._subscriptions.get(e);t&&((0,n.Z)("esri-2d-update-debug")&&console.debug(`Tile[${e}] Pipeline.unsubscribe`),this._source.onUnsubscribe(t),this._processor.onUnsubscribe(t),this._subscriptions.delete(t.key.id),t.destroy())}_pauseSubscription(e){const t=this._subscriptions.get(e);t&&((0,n.Z)("esri-2d-update-debug")&&console.debug(`Tile[${e}] Pipeline.pause`),t.pause())}async _updateChunks(){if(!this._preventChunkUpdates){if(null!=this._editState){(0,n.Z)("esri-2d-update-debug")&&console.debug("Pipeline.handleEdit",this._editState.edit);const e=this._editState;this._editState=null;const t=await this._source.getOverride(e.edit);await this._processor.applyOverride(t),e.resolver.resolve()}try{await this._processor.updateChunks()}catch(e){(0,o.H9)(e)}}}}(0,s._)([(0,l.Cb)()],iu.prototype,"updatingData",null)},55415:(e,t,r)=>{r.d(t,{Z:()=>i});var s=r(71143);class i{static getId(e,t,r,s){return"object"==typeof e?`${e.level}/${e.row}/${e.col}/${e.world}`:`${e}/${t}/${r}/${s}`}constructor(e,t,r,s){this.set(e,t,r,s)}get key(){return this}get id(){return this.toString()}set id(e){this.set(e)}get hash(){const e=4095&this.row,t=4095&this.col,r=63&this.level;return(3&this.world)<<30|t<<22|e<<8|r}acquire(e,t,r,s){this.set(e,t,r,s)}contains(e){const t=e.level-this.level;return t>=0&&this.row===e.row>>t&&this.col===e.col>>t&&this.world===e.world}containsChild(e){const t=e.level-this.level;return t>0&&this.row===e.row>>t&&this.col===e.col>>t&&this.world===e.world}equals(e){return this.level===e.level&&this.row===e.row&&this.col===e.col&&this.world===e.world}clone(){return new i(this)}release(){this.level=0,this.row=0,this.col=0,this.world=0}set(e,t,r,s){if(null==e)this.level=0,this.row=0,this.col=0,this.world=0;else if("object"==typeof e)this.level=e.level||0,this.row=e.row||0,this.col=e.col||0,this.world=e.world||0;else if("string"==typeof e){const[t,r,s,i]=e.split("/");this.level=parseFloat(t),this.row=parseFloat(r),this.col=parseFloat(s),this.world=parseFloat(i)}else this.level=+e,this.row=+t,this.col=+r,this.world=+s||0;return this}toString(){return`${this.level}/${this.row}/${this.col}/${this.world}`}getParentKey(){return this.level<=0?null:new i(this.level-1,this.row>>1,this.col>>1,this.world)}getNeighborId(e,t){return`${this.level}/${this.row+t}/${this.col+e}/${this.world}`}getChildKeys(){const e=this.level+1,t=this.row<<1,r=this.col<<1,s=this.world;return[new i(e,t,r,s),new i(e,t,r+1,s),new i(e,t+1,r,s),new i(e,t+1,r+1,s)]}compareRowMajor(e){return this.row<e.row?-1:this.row>e.row?1:this.col<e.col?-1:this.col>e.col?1:0}}i.pool=new s.Z(i,null,null,25,50)},11726:(e,t,r)=>{r.d(t,{hu:()=>i,yK:()=>n}),r(46505),r(11077),(0,r(22549).Ue)();class s{constructor(e){this.message=e}toString(){return`AssertException: ${this.message}`}}function i(e,t){if(!e){t=t||"Assertion";const e=new Error(t).stack;throw new s(`${t} at ${e}`)}}function n(e,t,r,s){let i,n=(r[0]-e[0])/t[0],o=(s[0]-e[0])/t[0];n>o&&(i=n,n=o,o=i);let a=(r[1]-e[1])/t[1],c=(s[1]-e[1])/t[1];if(a>c&&(i=a,a=c,c=i),n>c||a>o)return!1;a>n&&(n=a),c<o&&(o=c);let l=(r[2]-e[2])/t[2],u=(s[2]-e[2])/t[2];return l>u&&(i=l,l=u,u=i),!(n>u||l>o||(u<o&&(o=u),o<0))}},79384:(e,t,r)=>{r.d(t,{e:()=>d});var s=r(70586),i=r(95330),n=r(64830),o=r(58971),a=r(10661);class c{constructor(e){this._observable=new a.s,this._map=new Map(e)}get size(){return(0,o.it)(this._observable),this._map.size}clear(){this._map.size>0&&(this._map.clear(),this._observable.notify())}delete(e){const t=this._map.delete(e);return t&&this._observable.notify(),t}entries(){return(0,o.it)(this._observable),this._map.entries()}forEach(e,t){(0,o.it)(this._observable),this._map.forEach(((r,s)=>e.call(t,r,s,this)),t)}get(e){return(0,o.it)(this._observable),this._map.get(e)}has(e){return(0,o.it)(this._observable),this._map.has(e)}keys(){return(0,o.it)(this._observable),this._map.keys()}set(e,t){return this._map.set(e,t),this._observable.notify(),this}values(){return(0,o.it)(this._observable),this._map.values()}[Symbol.iterator](){return(0,o.it)(this._observable),this._map[Symbol.iterator]()}get[Symbol.toStringTag](){return this._map[Symbol.toStringTag]}}var l=r(1654),u=r(95528);class h{constructor(e,t){this.item=e,this.controller=t,this.promise=null}}class d{constructor(e){this._schedule=null,this._task=null,this._deferreds=new c,this._controllers=new c,this._processingItems=new c,this._pausedSignal=(0,u.t)(!1),this.concurrency=1,e.concurrency&&(this.concurrency=e.concurrency),this._queue=new n.Z(e.peeker),this.process=e.process;const t=e.scheduler;e.priority&&t&&(this._task=t.registerTask(e.priority,this))}destroy(){this.clear(),this._schedule=(0,s.hw)(this._schedule),this._task=(0,s.hw)(this._task)}get updating(){return!!this._task?.updating||this.running}get length(){return this._processingItems.size+this._queue.length}abort(e){const t=this._controllers.get(e);t&&t.abort()}clear(){this._queue.clear();const e=[];this._controllers.forEach((t=>e.push(t))),this._controllers.clear(),e.forEach((e=>e.abort())),this._processingItems.clear(),this._cancelNext()}forEach(e){this._deferreds.forEach(((t,r)=>e(r)))}get(e){const t=this._deferreds.get(e);return t?t.promise:void 0}isOngoing(e){return this._processingItems.has(e)}has(e){return this._deferreds.has(e)}pause(){this._pausedSignal.value||(this._pausedSignal.value=!0,this._cancelNext())}push(e,t){const r=this.get(e);if(r)return r;const s=new AbortController;let n=null;t&&(n=(0,i.fu)(t,(()=>s.abort())));const o=()=>{a.remove(),null!=n&&n.remove(),this._removeItem(e),this._queue.remove(e),this._scheduleNext()},a=(0,i.$F)(s.signal,(()=>{const t=this._processingItems.get(e);t&&t.controller.abort(),o(),c.reject((0,i.zE)())})),c=(0,i.hh)();return this._deferreds.set(e,c),this._controllers.set(e,s),c.promise.then(o,o),this._queue.push(e),this._scheduleNext(),c.promise}last(){return this._queue.last()}peek(){return this._queue.peek()}popLast(){const e=this._queue.popLast();return e&&this._removeItem(e),e}reset(){const e=[];this._processingItems.forEach((t=>e.push(t))),this._processingItems.clear();for(const t of e)this._queue.push(t.item),t.controller.abort();this._scheduleNext()}resume(){this._pausedSignal.value&&(this._pausedSignal.value=!1,this._scheduleNext())}takeAll(){const e=[];for(;this._queue.length;)e.push(this._queue.pop());return this.clear(),e}get running(){return!this._pausedSignal.value&&this._queue.length>0&&this._processingItems.size<this.concurrency}runTask(e){for(;!e.done&&this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop()),e.madeProgress()}_removeItem(e){this._deferreds.delete(e),this._controllers.delete(e),this._processingItems.delete(e)}_scheduleNext(){this._task||this._pausedSignal.value||this._schedule||(this._schedule=(0,l.Os)((()=>{this._schedule=null,this._next()})))}_next(){for(;this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop())}_cancelNext(){this._schedule&&(this._schedule.remove(),this._schedule=null)}_processResult(e,t){this._canProcessFulfillment(e)&&(this._scheduleNext(),this._deferreds.get(e.item).resolve(t))}_processError(e,t){this._canProcessFulfillment(e)&&(this._scheduleNext(),this._deferreds.get(e.item).reject(t))}_canProcessFulfillment(e){return!!this._deferreds.get(e.item)&&this._processingItems.get(e.item)===e}_process(e){if(null==e)return;let t;const r=new AbortController,s=new h(e,r);this._processingItems.set(e,s);try{t=this.process(e,r.signal)}catch(e){this._processError(s,e)}(0,i.y8)(t)?(s.promise=t,t.then((e=>this._processResult(s,e)),(e=>this._processError(s,e)))):this._processResult(s,t)}get test(){return{update:e=>this.runTask(e)}}}},35371:(e,t,r)=>{var s,i,n,o,a,c,l,u,h,d,p,_,f,y,g,m,x,b,v,w,S,I,T;r.d(t,{Br:()=>m,Ho:()=>v,LR:()=>c,Lu:()=>E,MX:()=>i,No:()=>f,Tg:()=>x,VI:()=>y,VY:()=>I,Wf:()=>l,_g:()=>S,cw:()=>p,db:()=>o,e8:()=>_,g:()=>u,l1:()=>b,lP:()=>g,lk:()=>s,q_:()=>R,qi:()=>w,w0:()=>a,wb:()=>h,xS:()=>d,zi:()=>n}),function(e){e[e.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",e[e.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",e[e.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT"}(s||(s={})),function(e){e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(i||(i={})),function(e){e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA"}(n||(n={})),function(e){e[e.ADD=32774]="ADD",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.SUBTRACT=32778]="SUBTRACT",e[e.REVERSE_SUBTRACT=32779]="REVERSE_SUBTRACT"}(o||(o={})),function(e){e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER"}(a||(a={})),function(e){e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(c||(c={})),function(e){e[e.CW=2304]="CW",e[e.CCW=2305]="CCW"}(l||(l={})),function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT"}(u||(u={})),function(e){e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS"}(h||(h={})),function(e){e[e.ZERO=0]="ZERO",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP"}(d||(d={})),function(e){e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(p||(p={})),function(e){e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.REPEAT=10497]="REPEAT",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(_||(_={})),function(e){e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY"}(f||(f={})),function(e){e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.RED=6403]="RED",e[e.RG=33319]="RG",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER"}(y||(y={})),function(e){e[e.RGBA4=32854]="RGBA4",e[e.R16F=33325]="R16F",e[e.RG16F=33327]="RG16F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.R32F=33326]="R32F",e[e.RG32F=33328]="RG32F",e[e.RGBA32F=34836]="RGBA32F",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB5_A1=32855]="RGB5_A1",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.RGB16F=34843]="RGB16F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.RGB565=36194]="RGB565",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2=32857]="RGB10_A2",e[e.RGB10_A2UI=36975]="RGB10_A2UI"}(g||(g={})),function(e){e[e.FLOAT=5126]="FLOAT",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.INT=5124]="INT",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV"}(m||(m={})),function(e){e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8"}(x||(x={})),function(e){e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.STATIC_READ=35045]="STATIC_READ",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.STREAM_COPY=35042]="STREAM_COPY"}(b||(b={})),function(e){e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER"}(v||(v={})),function(e){e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER"}(w||(w={})),function(e){e[e.Texture=0]="Texture",e[e.BufferObject=1]="BufferObject",e[e.VertexArrayObject=2]="VertexArrayObject",e[e.Shader=3]="Shader",e[e.Program=4]="Program",e[e.FramebufferObject=5]="FramebufferObject",e[e.Renderbuffer=6]="Renderbuffer",e[e.TransformFeedback=7]="TransformFeedback",e[e.Sync=8]="Sync",e[e.UNCOUNTED=9]="UNCOUNTED",e[e.LinesOfCode=9]="LinesOfCode",e[e.Uniform=10]="Uniform",e[e.COUNT=11]="COUNT"}(S||(S={})),function(e){e[e.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",e[e.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",e[e.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",e[e.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",e[e.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",e[e.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",e[e.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",e[e.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",e[e.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",e[e.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",e[e.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",e[e.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",e[e.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",e[e.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",e[e.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",e[e.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15"}(I||(I={})),function(e){e[e.NONE=0]="NONE",e[e.BACK=1029]="BACK"}(T||(T={}));const E=33306;var R,A,C,M,F,N,O;!function(e){e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"}(R||(R={})),function(e){e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT=5124]="INT",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY"}(A||(A={})),function(e){e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS"}(C||(C={})),function(e){e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED"}(M||(M={})),function(e){e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED"}(F||(F={})),function(e){e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE"}(N||(N={})),function(e){e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT"}(O||(O={}))}}]);
|