1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./nrASHU5P.js","./DRgiDEN2.js","./B-w4eJoj.js","./CHD0lyzs.js","./BKo8lDSc.js","./BXMmjf2r.js","./entry.yl3JvA9_.css","./rgTJtiXT.js","./Dz1-lNgB.js","./5NANFwRa.js","./AppLoading.CNLK6d_r.css","./t-4calJe.js","./DhKvRtBc.js","./B4Etc2lL.js","./AppImage.Cf6nWnQs.css","./ms8H21pT.js","./nauSyJ0z.js","./CkupUPKS.js","./B171RX97.js","./C3a6pkRZ.js","./syX9hxR-.js","./DEZMo_LK.js","./Cq_-5aMa.js","./CSpA3g0I.js","./BLmdiW3M.js","./e1dlHu4m.js","./Cp_8tW2x.js","./ZgFz7oVd.js","./DgD7CcEq.js","./DsR2am4z.js","./z-H7fO4w.js","./KYjebW4v.js","./DtyHg4-G.js","./MtSiOt06.js","./C0wm8_Yw.js","./BW1F0gsM.js","./DWbEPKI_.js","./BWsS6_hI.js","./Djp3mnm5.js","./CoFyWZBA.js","./DZeR9-jd.js","./6WZ2r7E5.js","./B3ZHMZPn.js","./cfs20awI.js","./eERWlLEP.js","./BOY7LLoh.js","./BjMuZ_Hi.js","./CXuNdDbs.js","./Bac6OxMA.js","./DYmrInUu.js","./w06oInkp.js","./Widget.-UrB7MXG.css","./JE0n4tz-.js","./BkblYdNc.js","./DKhZ92HF.js","./B_WVyS6w.js","./DSGiw4VB.js","./VxeEsj1r.js","./Bi6C4OG6.js","./Cgb6qxNH.js","./CtubtRqG.js","./B-SwU3Vp.js","./BmQWBkLQ.js","./Bdjb6dZw.js","./QQC62dOK.js","./C785G8XV.js","./oEHkgdPz.js","./CY_NAbc8.js","./9UR75SVV.js","./CaVKkSa6.js","./m6NjTGFE.js","./Cl3ydSjC.js","./C2Vv77XM.js","./B1N-tmtC.js","./Oc3VpIqZ.js","./C1Ta_GD1.js","./DQOO6RKE.js","./Bz5a4r0X.js"])))=>i.map(i=>d[i]); 2import{L as we}from"./BXMmjf2r.js";import{B as Ye,j as Je,cE as Vt,d7 as F,cC as dr,W,eO as pr,g as he,f as Gt,w as fr,bs as mr,r as xe,G as Qe,H as st,ar as _r,bq as gr,hv as yr,e$ as at,f6 as qt,f5 as Nt,fd as br,d6 as wr,F as Re,i9 as xr,q as nt,b4 as Mr,a5 as ot,ia as Sr,eC as Ut,p as vr,aY as _e,dk as We,N as Cr,aa as lt,bU as ht,ib as Pr,f9 as ct,hA as Or,g0 as $e,df as Ae,fU as kr}from"./DRgiDEN2.js";import{r as zr}from"./BkblYdNc.js";import{h as Fe,P as Tr,Q as Rr,S as ut,j as Fr,T as Ir,U as Br}from"./nrASHU5P.js";import{i as $r}from"./dvwljMEN.js";import{q as Ar,u as Er,_ as le,t as Dr,h as dt,n as Lr,k as Vr,l as Gr,o as qr}from"./DeFyxnTI.js";import{w as se,x as Nr,n as Ee,L as Ur}from"./CkupUPKS.js";import{l as pt,n as Wr,q as Hr}from"./0rco64Nk.js";import{o as T,a as Se}from"./Dg3Pc1ma.js";import{c as ke,d as ft,h as jr,s as Xr,x as Yr}from"./By1LYKEY.js";import{Q as P,Z as mt,b as _t,U as Wt,o as Jr,M as $,p as Qr,N as Kr,k as ve,I as v,X as De,q as Le,d as Z,x as Zr,A as gt,T as ei,L as ti,v as ri,z as ii,F as si,H as ai,D as ni,O as oi,_ as Ht,f as li}from"./BBqMFtVK.js";import{l as hi,f as ci,u as ui,g as di,o as pi}from"./Cv6F_OOs.js";import{r as He}from"./CwWs91wn.js";import{OverrideHelper as re}from"./DtOty4W7.js";import{s as jt,x as fi,r as yt,C as Xt,y as je,B as Yt,u as Oe,a as Y,q as Ve,G as mi,H as bt,A as _i,z as gi,F as yi,v as bi,E as Xe,R as wi,S as pe,T as xi,U as Mi,$ as wt,t as Si,_ as vi,Y as Ci}from"./Oc3VpIqZ.js";import{s as Pi,n as Oi,o as ki,e as Ke}from"./BexkRpWl.js";import{x as zi,a as Ti}from"./7Rn0DheJ.js";import{r as Ri,a as Fi,v as Jt,E as Ii,e as Bi,h as $i,f as Ze,C as Ai,b as et,x as Ei,R as Di,y as Li,c as Vi,d as Gi,g as qi,P as Ni,q as Ui}from"./yq0qdUn4.js";import{l as ec,i as tc}from"./yq0qdUn4.js";import{_ as ge,N as tt,R as ye,G as Qt,E as Kt,D as Wi}from"./DQOO6RKE.js";import{e as ze}from"./CdW_LAVR.js";import{h as Zt}from"./CWzTGOLV.js";import{f as Hi,g as ji,h as Xi}from"./B8wvtvlZ.js";import{r as er}from"./ctgcC1kd.js";import{s as Yi,a as Ji,x as Qi}from"./DEuVqFFh.js";import{QueueProcessor as Ki}from"./DzEQSOBj.js";import{i as Zi}from"./D8Jz8PBt.js";import{t as L}from"./CUzevAry.js";import{g as es,p as ts,j as rs}from"./B2wYPEtV.js";import{h as R,E as U,d as is}from"./C1Ta_GD1.js";import{n as xt}from"./BJoSwlow.js";import{e as Mt}from"./DMYXcBad.js";import{r as ss}from"./idX3O8Qe.js";import{h as as,m as ns}from"./CNlrCRjR.js";import{r as os,n as tr}from"./Cgb6qxNH.js";import{u as Ge}from"./C2Vv77XM.js";import{e as V}from"./DDjZAYSk.js";import{n as J}from"./DUPllro5.js";import{t as be}from"./CVzmm3VW.js";import{m as G,i as rt,a as ls}from"./CICLQ0CA.js";import{x as hs}from"./BOg1L1ZK.js";import{load as cs,execute as us}from"./CLKi8sBm.js";import{O as ic}from"./aHg9OYsz.js";import{i as ac}from"./D3pgULmM.js";import{w as ds}from"./CSpA3g0I.js";import{h as ps}from"./JE0n4tz-.js";import{r as St}from"./oypF5bYk.js";import{a as qe}from"./CaVKkSa6.js";import{Y as fs,H as ms}from"./BWsS6_hI.js";import{L as _s}from"./C785G8XV.js";import{u as gs}from"./Xfxdqiat.js";import{t as ys,u as bs,l as ws}from"./ByRpGiJX.js";import"./B-w4eJoj.js";import"./CHD0lyzs.js";import"./BKo8lDSc.js";import"./rgTJtiXT.js";import"./Dz1-lNgB.js";import"./5NANFwRa.js";import"./t-4calJe.js";import"./DhKvRtBc.js";import"./B4Etc2lL.js";import"./C3a6pkRZ.js";import"./ms8H21pT.js";import"./nauSyJ0z.js";import"./Cq_-5aMa.js";import"./BLmdiW3M.js";import"./B171RX97.js";import"./syX9hxR-.js";import"./DEZMo_LK.js";import"./e1dlHu4m.js";import"./Cp_8tW2x.js";import"./ZgFz7oVd.js";import"./DgD7CcEq.js";import"./DsR2am4z.js";import"./z-H7fO4w.js";import"./KYjebW4v.js";import"./DtyHg4-G.js";import"./MtSiOt06.js";import"./C0wm8_Yw.js";import"./BW1F0gsM.js";import"./DWbEPKI_.js";import"./Djp3mnm5.js";import"./CoFyWZBA.js";import"./DZeR9-jd.js";import"./6WZ2r7E5.js";import"./B3ZHMZPn.js";import"./cfs20awI.js";import"./eERWlLEP.js";import"./BOY7LLoh.js";import"./BjMuZ_Hi.js";import"./CXuNdDbs.js";import"./Bac6OxMA.js";import"./DYmrInUu.js";import"./w06oInkp.js";import"./DKhZ92HF.js";import"./B_WVyS6w.js";import"./DSGiw4VB.js";import"./VxeEsj1r.js";import"./Bi6C4OG6.js";import"./CtubtRqG.js";import"./B-SwU3Vp.js";import"./BmQWBkLQ.js";import"./Bdjb6dZw.js";import"./QQC62dOK.js";import"./m6NjTGFE.js";import"./Cl3ydSjC.js";import"./B1N-tmtC.js";import"./Bz5a4r0X.js";import"./D83ZGnB5.js";import"./DPb6J-GU.js";import"./BvER9tXK.js";import"./BJ6sgNqX.js";import"./CN4mhCGG.js";import"./DgHVnJ_m.js";import"./C_G6WZgc.js";import"./C8zGwbjb.js";import"./P9OqbP8k.js";import"./GKolV7NZ.js";import"./Cn69bFco.js";import"./DoqygTqb.js";import"./BUra4Lwg.js";import"./DAcMyVRc.js";import"./DFlbJ4P1.js";import"./BHCTTJyW.js";import"./BrvA2Dm3.js";import"./SJXvxPYD.js";import"./CM20zWxH.js";import"./D-ieW9DP.js";import"./Dy4nO8bV.js";import"./CP4okrYX.js";import"./CCZO1s3j.js";import"./Yv3K8v22.js";import"./DicbBBDj.js";import"./D6XwHbQx.js";import"./D6qTqnUg.js";import"./j5I05dgm.js";import"./CujHzHWW.js";import"./Dl44MAex.js";import"./Cnv-_NvB.js";import"./BHYAGdRm.js";import"./BuvA_UA6.js";import"./WCVSSNPR.js";import"./G2XYGDs6.js";import"./IPf4Irev.js";import"./BQUJOtn5.js";import"./CX8y9w8U.js";import"./B5ABIbk5.js";import"./BWk5NkEF.js";import"./BxwiLzUd.js";import"./DmELWv-n.js";import"./i3xCdcsn.js";import"./CbKInKq8.js";import"./C-7k5etQ.js";import"./CJZR-Wao.js";import"./CLKq0EbL.js";import"./C0NvqqaF.js";import"./HQEWcjmo.js";import"./CMLxVKdU.js";import"./CvaWXq7H.js";import"./D8AHXy_W.js";import"./Bp85kKiB.js";import"./oEHkgdPz.js";import"./BtzZDucr.js";import"./DmxaQ-k8.js";import"./1R8LrmqA.js";import"./DEVxQh73.js";import"./BJRpZlUf.js";import"./ZUik1Ud6.js";import"./CY_NAbc8.js";import"./9UR75SVV.js";import"./DAeBPgXD.js";function j(o,e,t){return{transform:Fs(o,e,t.transform),fromColor:Is(o,e,t.fromColor),toColor:Bs(o,e,t.toColor),colorMix:$s(o,e,t.colorMix),toOpacity:Es(o,e,t.toOpacity),opacityMix:Ds(o,e,t.opacityMix),shift:Ls(o,e,t.shift),hasAnimations:t.hasAnimations||xs(e),hasShiftAnimation:t.hasShiftAnimation||Ms(e),hasMotionAnimations:t.hasMotionAnimations||vs(e)}}function xs(o){return"animations"in o&&!!o.animations&&o.animations.length>0}function Ms(o){return"animations"in o&&!!o.animations&&o.animations.some(e=>e.type==="CIMSymbolAnimationMoveAlongLine")}const Ss=new Set(["CIMSymbolAnimationOffset","CIMSymbolAnimationRotation","CIMSymbolAnimationSize","CIMSymbolAnimationScale"]);function vs(o){return"animations"in o&&!!o.animations&&o.animations.some(e=>Ss.has(e.type))}function rr(o){return!pt.forceStaticPath&&(pt.forceAnimatedPath||o.hasAnimations)}function Cs(o,e,t){if(e.type==="CIMCharacterMarker")return Ye.getLogger("animationUtils").error("#handleMarker()","CIM character markers do not support animations"),t;const r=P(o,e,"OffsetX"),i=P(o,e,"OffsetY");if(e.type==="CIMPictureMarker")return{...t,transform:{type:"AnimatedTransform",relativeTranslation:!1,absoluteScale:!0,translation:O([r,i]),rotation:O(0),scale:O(P(o,e,"Size")),parent:t.transform}};const s=e.frame,a=s.ymax-s.ymin;return{...t,transform:{type:"AnimatedTransform",relativeTranslation:!1,absoluteScale:!1,translation:O([r,i]),rotation:O(0),scale:O({type:"Process",op:"Divide",left:P(o,e,"Size"),right:a}),parent:t.transform}}}function ir(o,e){let t=0,r=0;const i=o.anchorPointUnits!=="Absolute";return o.anchorPoint&&(t=-o.anchorPoint.x,r=-o.anchorPoint.y),{...e,transform:{type:"AnimatedTransform",relativeTranslation:i,absoluteScale:!1,translation:O([t,r]),rotation:O(0),scale:O(1),parent:e.transform}}}function Ps(o,e){return o.anchorPointUnits==="Absolute"?e:ir(o,e)}function Os(o,e){return o.anchorPointUnits!=="Absolute"?e:ir(o,e)}function ks(o,e,t){return{...o,transform:{type:"AnimatedTransform",relativeTranslation:!1,absoluteScale:!1,translation:O([e,t]),rotation:O(0),scale:O(1),parent:o.transform}}}function zs(o,e){const t=e?.5*-(e.xmin+e.xmax):0,r=e?.5*-(e.ymin+e.ymax):0;let i=0,s=0;if("x"in o&&"y"in o)i=o.x+t,s=o.y+r;else{const a=ke(o);a&&(i=(a[0]+a[2])/2+t,s=(a[1]+a[3])/2+r)}return[i,s]}function Ts(o,e){switch(e.type){case"CIMPictureMarker":case"CIMVectorMarker":return P(o,e,"Rotation")}return 0}function Rs(o,e){switch(e.type){case"CIMPictureMarker":case"CIMVectorMarker":return P(o,e,"RotateClockwise")}return 0}function sr(o,e){switch(e.type){case"CIMPointSymbol":case"CIMVectorMarker":return[1,1,1,1];case"CIMSolidStroke":case"CIMSolidFill":return P(o,e,"Color");case"CIMPictureMarker":case"CIMPictureStroke":case"CIMPictureFill":return P(o,e,"TintColor")}return[1,1,1,1]}function Fs(o,e,t){return{type:"AnimatedTransform",relativeTranslation:!1,absoluteScale:!1,translation:Gs(o,e),rotation:qs(o,e),scale:Vs(o,e),parent:t}}function Is(o,e,t){return{type:"AnimatedColor",color:O(sr(o,e)),opacity:O(1),parent:t,applyToChildren:!1}}function Bs(o,e,t){const r=te(e);let i,s=As(t);if(s)i=[1,1,1,1];else{i=sr(o,e);const a=r?.find(n=>n.type==="CIMSymbolAnimationColor");a&&(i=P(o,a,"ToColor"),s=a.colorMode==="Override")}return{type:"AnimatedColor",color:O(i),opacity:O(1),parent:t,applyToChildren:s}}function $s(o,e,t){const r=te(e),i=r?.find(s=>
2s.type==="CIMSymbolAnimationColor");return i?{type:"AnimatedColor",color:O([1,1,1,1]),opacity:{from:0,to:1,timing:ae(o,i?.animatedSymbolProperties)},parent:[1,1,1,1],applyToChildren:!1}:t}function As(o){return typeof o=="object"&&"applyToChildren"in o&&o.applyToChildren}function Es(o,e,t){const r=te(e);let i=O(1);const s=r?.find(a=>a.type==="CIMSymbolAnimationTransparency");return s&&(i=O({type:"Process",op:"Transparency",value:P(o,s,"ToTransparency")})),{type:"AnimatedColor",color:O([1,1,1,1]),opacity:i,parent:t,applyToChildren:!1}}function Ds(o,e,t){const r=te(e),i=r?.find(s=>s.type==="CIMSymbolAnimationTransparency");return i?{type:"AnimatedColor",color:O([1,1,1,1]),opacity:{from:0,to:1,timing:ae(o,i?.animatedSymbolProperties)},parent:[1,1,1,1],applyToChildren:!1}:t}function Ls(o,e,t){const r=te(e),i=r?.find(p=>p.type==="CIMSymbolAnimationMoveAlongLine");if(!i)return t;let s,a;const n=ae(o,i.animatedSymbolProperties),l=mt(o,i,"DistanceAlong"),h=mt(o,i,"Speed"),c=l&&P(o,i,"DistanceAlong"),u=h&&P(o,i,"Speed"),d=i.continuous===!0;if(c!==!1)s={type:"Process",op:"Divide",left:c,right:100},a=!0;else if(u!==!1)s={type:"Process",op:"Multiply",left:u,right:n.duration},a=!1;else{if(!d)throw new Error("Either distanceAlong, speed or continuous must be specified.");s=1,a=!0}return{type:"AnimatedShift",multiplyByLineLength:a,shift:{from:0,to:s,timing:n},parent:t}}function ae(o,e){if(!e)return{duration:1,startTimeOffset:0,repeatDelay:0,timeOriginSelector:"Local",repeatType:"Loop",easing:"Linear",playAnimation:1,reverseAnimation:0};const t=P(o,e,"Duration");let r;P(o,e,"RandomizeStartTime")?r={type:"Process",op:"Random",min:0,max:t,seed:P(o,e,"RandomizeStartSeed")}:r=P(o,e,"StartTimeOffset");const i=P(o,e,"RepeatDelay"),s=P(o,e,"PlayAnimation"),a=P(o,e,"ReverseAnimation"),n=_t(e.repeatType,T.CIMAnimatedSymbolProperties.repeattype);return{duration:t,startTimeOffset:r,repeatDelay:i,timeOriginSelector:n==="None"?"Local":"Global",repeatType:n,easing:_t(e.easing,T.CIMAnimatedSymbolProperties.easing),playAnimation:s,reverseAnimation:a}}function Vs(o,e){const t=te(e);let r;r=e.type==="CIMPictureMarker"||e.type==="CIMVectorMarker"?P(o,e,"Size"):e.type==="CIMSolidStroke"||e.type==="CIMPictureStroke"?P(o,e,"Width"):Wt(e)||10;const i=t?.find(s=>s.type==="CIMSymbolAnimationScale");if(!i){const s=t?.find(a=>a.type==="CIMSymbolAnimationSize");return s?{from:1,to:{type:"Process",op:"Divide",left:P(o,s,"ToSize"),right:r},timing:ae(o,s.animatedSymbolProperties)}:O(1)}return{from:1,to:P(o,i,"ScaleFactor"),timing:ae(o,i.animatedSymbolProperties)}}function te(o){return"animations"in o&&o.animations||[]}function Gs(o,e){const t=te(e),r=t?.find(i=>i.type==="CIMSymbolAnimationOffset");return r?{from:[0,0],to:[P(o,r,"OffsetX"),P(o,r,"OffsetY")],timing:ae(o,r.animatedSymbolProperties)}:O([0,0])}function qs(o,e){const t=te(e),r=Rs(o,e),i={type:"Process",op:"Divide",left:Ts(o,e),right:{type:"Process",op:"Cond",condition:r,ifTrue:-1,ifFalse:1}},s=t?.find(n=>n.type==="CIMSymbolAnimationRotation");if(!s)return O(i);const a={type:"Process",op:"Add",left:P(o,s,"ToRotation"),right:{type:"Process",op:"Divide",left:i,right:-1}};return{from:i,to:{type:"Process",op:"Add",left:i,right:{type:"Process",op:"Cond",condition:P(o,s,"RotateClockwise"),ifTrue:{type:"Process",op:"MatchWinding",sign:-1,angle:a},ifFalse:{type:"Process",op:"MatchWinding",sign:1,angle:a}}},timing:ae(o,s.animatedSymbolProperties)}}function O(o){return{from:o,to:o,timing:{duration:1,startTimeOffset:0,repeatDelay:0,timeOriginSelector:"Local",repeatType:"Loop",easing:"Linear",playAnimation:1,reverseAnimation:0}}}function ar(o){if(o==null||typeof o!="object")return!1;if(o.animations&&Array.isArray(o.animations)&&o.animations.length>0)return!0;for(const e in o)if(ar(o[e]))return!0;return!1}const Ns=.01;function Us(o){if(!o.frame)return o;const{markerGraphics:e}=o;if(!e||e.length===0)return o;let t=0,r=0,i=0,s=0;for(const x of e){const{geometry:w,symbol:M}=x;if(!w||!M||!("symbolLayers"in M))continue;const{symbolLayers:b}=M;if(b)for(const S of b){const{effects:C}=S,k=He.applyEffects(C,w),z=ke(k);z&&(t=Math.min(t,z[0]),r=Math.min(r,z[1]),i=Math.max(i,z[2]),s=Math.max(s,z[3]))}}const{xmin:a,ymin:n,xmax:l,ymax:h}=o.frame,c=(l-a)/2,u=(h-n)/2,d=(l+a)/2,p=(h+n)/2;if(c<=0||u<=0)return o;const m=(d-t)/c,_=(i-d)/c,g=(p-r)/u,f=(s-p)/u,y=Math.max(Math.max(m,_),Math.max(g,f));return y<=1+Ns||(o=Je(o)).frame&&(o.frame.xmin=(o.frame.xmin-d)*y+d,o.frame.ymin=(o.frame.ymin-p)*y+p,o.frame.xmax=(o.frame.xmax-d)*y+d,o.frame.ymax=(o.frame.ymax-p)*y+p,o.respectFrame!==!1&&(o.size*=y)),o}const vt=()=>Ye.getLogger("esri.symbols.cim.cimAnalyzer");function Ws(o){const e=o.markerPlacement;return e&&e.angleToLine?1:0}class Hs{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],this._hasTextStringTemplates=!1,e&&(this._resourceManager=e)}analyzeSymbolReference(e,t,r){if(this._cimLayers=r??[],!e)return this._cimLayers;if(this._reset(),this._hasTextStringTemplates=e.hasTextStringTemplates??!1,e.primitiveOverrides){this._primitiveOverrides=e.primitiveOverrides;for(const i of this._primitiveOverrides){const s=i.valueExpressionInfo;if(s)this._setPoMap(i.primitiveName,i.propertyName,s);else if(i.value!=null){let a=i.value;i.propertyName.includes("Color")&&($r(a)&&(a=Jr(a)),a=$(a)),this._setPoMap(i.primitiveName,i.propertyName,a)}}}return this._analyzeSymbol(e.symbol,t),this._cimLayers}_reset(){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[]}
2_analyzeSymbol(e,t){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,t)}}_analyzeMultiLayerSymbol(e,t){const r=e?.symbolLayers;if(!r)return;for(let c=0;c<r.length;c++){const u=r[c];u.type==="CIMVectorMarker"&&(r[c]=Us(u))}const i=e.effects;let s=0;const a=Wt(e)??0;if(e.type==="CIMPointSymbol"&&e.angleAlignment==="Map"&&(s=1),Qs(r,i))return this._analyzeCompositeOutlineFill(r,i,a);let n={transform:[0,0,0,1],fromColor:[1,1,1,1],toColor:[1,1,1,1],colorMix:[0,0,0,0],toOpacity:[1,1,1,1],opacityMix:[0,0,0,0],shift:[1,1,1,1],hasAnimations:ar(e),hasShiftAnimation:!1,hasMotionAnimations:!1};n=j(this._poMap,e,n);const l=e.type==="CIMPolygonSymbol";let h=r.length;for(;h--;){const c=r[h];if(!c||c.enable===!1)continue;let u;i?.length&&(u=[...i]);const d=c.effects;d?.length&&(i?u.push(...d):u=[...d]);let p=null;if(u){p=[];for(const _ of u){const g=re.findEffectOverrides(_,this._primitiveOverrides);g&&p.push(g)}}const m=[];switch(re.findApplicableOverrides(c,this._primitiveOverrides,m),c.type){case"CIMSolidFill":this._analyzeSolidFill(c,p,n,Kr(r));break;case"CIMPictureFill":this._analyzePictureFill(c,p,n);break;case"CIMHatchFill":this._analyzeHatchFill(c,p,n);break;case"CIMGradientFill":this._analyzeGradientFill(c,p);break;case"CIMSolidStroke":this._analyzeSolidStroke(c,p,l,a,n);break;case"CIMPictureStroke":this._analyzePictureStroke(c,p,l,a,n);break;case"CIMGradientStroke":this._analyzeGradientStroke(c,p,l,a);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{e.type!=="CIMLineSymbol"&&e.type!=="CIMPolygonSymbol"||(s=Ws(c));const _=[],g=c.primitiveName;g&&_.push(g);const f=l&&Qr(c.markerPlacement);this._analyzeMarker(c,p,null,_,s,a,t,[],n,!1,f);break}default:vt().error("Cannot analyze CIM layer",c.type)}}}_analyzeSolidFill(e,t,r,i){const{primitiveName:s,type:a}=e,n=$(e.color),l=j(this._poMap,e,r);if(!i&&t?.some(h=>h.effect.type==="CIMGeometricEffectTaperedPolygon")){const h=this._getValueOrOverrideExpression(a,s,"Color",n);return void this._cimLayers.push({type:"outlineFill",colorLocked:!!e.colorLocked,color:h,effects:t,outlineColor:h,outlineColorLocked:!!e.colorLocked,...hi,outlineEffects:t})}this._cimLayers.push({type:"fill",spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(a,s,"Color",n),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:t,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1,animationParams:X(l)})}_analyzePictureFill(e,t,r){const{primitiveName:i,type:s}=e,a=ve(e),n=v(e.height,T.CIMPictureFill.height);let l=v(e.scaleX,1);if("width"in e&&typeof e.width=="number"){const u=e.width;let d=1;const p=this._resourceManager.getResource(e.url);p!=null&&(d=p.width/p.height),l/=d*(n/u)}const h={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(i,s)},c=j(this._poMap,e,r);this._cimLayers.push({type:"fill",spriteRasterizationParam:h,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(s,i,"TintColor",a),height:this._getValueOrOverrideExpression(s,i,"Height",n),scaleX:this._getValueOrOverrideExpression(s,i,"ScaleX",l),angle:this._getValueOrOverrideExpression(s,i,"Rotation",v(e.rotation)),offsetX:this._getValueOrOverrideExpression(s,i,"OffsetX",v(e.offsetX)),offsetY:this._getValueOrOverrideExpression(s,i,"OffsetY",v(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1,animationParams:X(c)})}_analyzeHatchFill(e,t,r){const{primitiveName:i,type:s}=e,a=j(this._poMap,e,r),n=this._analyzeMaterialOverrides(i,["Rotation","OffsetX","OffsetY"]),l=De(n);let h=[255,255,255,1],c=!1;if(e.lineSymbol?.symbolLayers)for(const d of e.lineSymbol.symbolLayers){if(d.type!=="CIMSolidStroke")continue;const p=d.primitiveName??i;c||!p||d.colorLocked||this._poMap[p]?.Color==null&&this._poMap[p]?.StrokeColor==null||(h=$(d.color),h=this._maybeGetValueOrOverrideExpression(p,"StrokeColor")??this._getValueOrOverrideExpression(s,p,"Color",h),c=!0);const m=this._maybeGetValueOrOverrideExpression(p,"StrokeWidth");if(m){let _=null,g=null;typeof m=="number"?_=m:g=m.valueExpressionInfo;let f=l.find(y=>y.propertyName==="strokeWidth");f?f.propertyName="width":(f={type:"CIMPrimitiveOverride",primitiveName:p,propertyName:"width",valueExpressionInfo:g,value:_,defaultValue:Le(s,"width")},l.push(f))}}const u={type:"sprite-rasterization-param",resource:e,overrides:l};this._cimLayers.push({type:"fill",spriteRasterizationParam:u,colorLocked:!!e.colorLocked,effects:t,color:h,height:this._getValueOrOverrideExpression(s,i,"Separation",v(e.separation,T.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(s,i,"Rotation",v(e.rotation)),offsetX:this._getValueOrOverrideExpression(s,i,"OffsetX",v(e.offsetX)),offsetY:this._getValueOrOverrideExpression(s,i,"OffsetY",v(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnl
vendor: 4,425 bytes, line 2
2y:!0,hasUnresolvedReplacementColor:!c,animationParams:X(a)})}_analyzeGradientFill(e,t){const{angle:r,gradientMethod:i,gradientSize:s,gradientSizeUnits:a,gradientType:n,interval:l,primitiveName:h,type:c}=e,u=T.CIMGradientFill,d=e.colorRamp;this._cimLayers.push({type:"gradientFill",spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(h,c)},colorLocked:!1,effects:t,color:[255,255,255,1],gradientMethod:this._getValueOrOverrideExpression(c,h,"GradientMethod",i??"Linear"),angle:this._getValueOrOverrideExpression(c,h,"Angle",v(r,u.angle)),gradientType:this._getValueOrOverrideExpression(c,h,"GradientType",n??u.gradientType),interval:this._getValueOrOverrideExpression(c,h,"Interval",v(l,d.type==="CIMFixedColorRamp"?d.colors.length:u.interval)),gradientSize:this._getValueOrOverrideExpression(c,h,"GradientSize",v(s,u.gradientSize)),gradientSizeUnits:a==="Absolute"?Se.Absolute:a==="Relative"?Se.Relative:u.gradientSizeUnits})}_analyzeCompositeOutlineFill(e,t,r){const i=e.find(d=>d.type==="CIMSolidFill"),s=e.find(d=>d.type==="CIMSolidStroke");if(i==null||s==null)return;const a=[...t??[],...i.effects??[]].map(d=>re.findEffectOverrides(d,this._primitiveOverrides)).filter(d=>d!=null),n=[...t??[],...s.effects??[]].map(d=>re.findEffectOverrides(d,this._primitiveOverrides)).filter(d=>d!=null),l=v(s.width,T.CIMSolidStroke.width),h=Z(s.capStyle,T.CIMSolidStroke.capstyle),c=Z(s.joinStyle,T.CIMSolidStroke.joinstyle),u=s.miterLimit;this._cimLayers.push({type:"outlineFill",colorLocked:!!i.colorLocked,color:this._getValueOrOverrideExpression(i.type,i.primitiveName,"Color",$(i.color)),effects:a,outlineColorLocked:!!s.colorLocked,outlineColor:this._getValueOrOverrideExpression(s.type,s.primitiveName,"Color",$(s.color)),outlineWidth:this._getValueOrOverrideExpression(s.type,s.primitiveName,"Width",l),cap:this._getValueOrOverrideExpression(s.type,s.primitiveName,"CapStyle",h),join:this._getValueOrOverrideExpression(s.type,s.primitiveName,"JoinStyle",c),miterLimit:u&&this._getValueOrOverrideExpression(s.type,s.primitiveName,"MiterLimit",u),referenceWidth:r,outlineEffects:n})}_analyzeSolidStroke(e,t,r,i,s){const{primitiveName:a,type:n}=e,l=$(e.color),h=v(e.width,T.CIMSolidStroke.width),c=Z(e.capStyle,T.CIMSolidStroke.capstyle),u=Z(e.joinStyle,T.CIMSolidStroke.joinstyle),d=e.miterLimit;let p,m,_,g,f=[];if(this._analyzePrimitiveOverrides(a,t,null,null)&&(f=this._getPrimitiveMaterialOverrides(a,n)),t&&Array.isArray(t)&&t.length>0){const w=t[t.length-1].effect;w&&w.type==="CIMGeometricEffectDashes"&&w.lineDashEnding==="NoConstraint"&&(p=w.dashTemplate,m=w.scaleDash,_=w.offsetAlongLine,g=w.primitiveName,(t=[...t]).pop())}g!=null&&f.push(...this._getPrimitiveMaterialOverrides(g,n).filter(w=>w.propertyName==="dashTemplate"));const y=p!==void 0?{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:p,primitiveName:g},overrides:f}:null,x=j(this._poMap,e,s);this._cimLayers.push({type:"line",spriteRasterizationParam:y,isOutline:r,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(n,a,"Color",l),width:this._getValueOrOverrideExpression(n,a,"Width",h),cap:this._getValueOrOverrideExpression(n,a,"CapStyle",c),join:this._getValueOrOverrideExpression(n,a,"JoinStyle",u),miterLimit:d&&this._getValueOrOverrideExpression(n,a,"MiterLimit",d),referenceWidth:i,zOrder:Ct(e.name),dashTemplate:this._maybeGetValueOrOverrideExpression(g,"DashTemplate")??p,offsetAlongLine:this._getValueOrOverrideExpression(n,g,"OffsetAlongLine",_??0),scaleDash:m,sampleAlphaOnly:!0,animationParams:X(x)})}_analyzePictureStroke(e,t,r,i,s){const{primitiveName:a,type:n}=e,l=ve(e),h=v(e.width,T.CIMPictureStroke.width),c=Z(e.capStyle,T.CIMPictureStroke.capstyle),u=Z(e.joinStyle,T.CIMPictureStroke.joinstyle),d=e.miterLimit,p={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(a,n)},m=j(this._poMap,e,s);this._cimLayers.push({type:"line",spriteRasterizationParam:p,isOutline:r,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(n,a,"TintColor",l),width:this._getValueOrOverrideExpression(n,a,"Width",h),cap:this._getValueOrOverrideExpression(n,a,"CapStyle",c),join:this._getValueOrOverrideExpression(n,a,"JoinStyle",u),miterLimit:d&&this._getValueOrOverrideExpression(n,a,"MiterLimit",d),referenceWidth:i,zOrder:Ct(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnl
2y:!1,animationParams:X(m)})}_analyzeGradientStroke(e,t,r,i){const{gradientMethod:s,gradientSize:a,gradientSizeUnits:n,gradientType:l,interval:h,primitiveName:c,type:u}=e,d=T.CIMGradientStroke,p=v(e.width,d.width),m=Z(e.capStyle,d.capstyle),_=Z(e.joinStyle,d.joinstyle),g=e.miterLimit,f=e.colorRamp;this._cimLayers.push({type:"gradientStroke",spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(c,u)},colorLocked:!!e.colorLocked,effects:t,color:[255,255,255,1],width:this._getValueOrOverrideExpression(u,c,"Width",p),cap:this._getValueOrOverrideExpression(u,c,"CapStyle",m),join:this._getValueOrOverrideExpression(u,c,"JoinStyle",_),miterLimit:g&&this._getValueOrOverrideExpression(u,c,"MiterLimit",g),referenceWidth:i,isOutline:r,gradientMethod:this._getValueOrOverrideExpression(u,c,"GradientMethod",s??d.gradientMethod),gradientType:this._getValueOrOverrideExpression(u,c,"GradientType",l??d.gradientType),interval:this._getValueOrOverrideExpression(u,c,"Interval",v(h,f.type==="CIMFixedColorRamp"?f.colors.length:d.interval)),gradientSize:this._getValueOrOverrideExpression(u,c,"GradientSize",v(a,d.gradientSize)),gradientSizeUnits:n==="Absolute"?Se.Absolute:n==="Relative"?Se.Relative:d.gradientSizeUnits})}_analyzeMarker(e,t,r,i,s,a,n,l,h,c=!1,u=!1){c||=!!e.colorLocked;let d=h;if(d=Os(e,d),d=Cs(this._poMap,e,d),d=Ps(e,d),d=j(this._poMap,e,d),this._analyzeMarkerInsidePolygon(e,t,c,d))return;const p=v(e.size,T.CIMVectorMarker.size),m=v(e.rotation),_=v(e.offsetX),g=v(e.offsetY),{primitiveName:f,type:y}=e,x=this._getValueOrOverrideExpression(y,f,"Size",p),w=this._getValueOrOverrideExpression(y,f,"Rotation",m),M=this._getValueOrOverrideExpression(y,f,"OffsetX",_),b=this._getValueOrOverrideExpression(y,f,"OffsetY",g);switch(e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,t,r,i,s,a,x,w,M,b,l,d,c,u);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,t,r,i,s,a,x,w,M,b,l,d,n,c,u)}}_analyzeMarkerInsidePolygon(e,t,r,i){const{markerPlacement:s,type:a}=e;if(!s||s.type!=="CIMMarkerPlacementInsidePolygon"||i.hasMotionAnimations)return!1;if(a==="CIMVectorMarker"||a==="CIMPictureMarker"){const p=e.primitiveName;if(p&&this._analyzePrimitiveOverrides([p],t,null,null))return!1;const m=s.primitiveName;if(m&&this._analyzePrimitiveOverrides([m],t,null,null))return!1;if(a==="CIMVectorMarker"){const{markerGraphics:_}=e;if(_)for(const g of _){const{symbol:f}=g;if(f?.type==="CIMPolygonSymbol"&&f.symbolLayers){const{symbolLayers:y}=f;for(const x of y)if(x.type==="CIMSolidStroke")return!1}}}else{const{animatedSymbolProperties:_}=e;if(_)return!1}}const n=Math.abs(s.stepX),l=Math.abs(s.stepY);if(n===0||l===0)return!0;let h,c;if(s.gridType==="Random"){const p=Nr(fi),m=Math.max(Math.floor(p/n),1);h=l*Math.max(Math.floor(p/l),1),c=m*n/h}else s.shiftOddRows?(h=2*l,c=n/l*.5):(h=l,c=n/l);const u=ve(e),d=e.type==="CIMCharacterMarker"?null:{type:"sprite-rasterization-param",resource:e,overrides:[]};return this._cimLayers.push({type:"fill",spriteRasterizationParam:d,colorLocked:r,effects:t,color:u,height:h,scaleX:c,angle:s.gridAngle??0,offsetX:v(s.offsetX),offsetY:v(s.offsetY),applyRandomOffset:s.gridType==="Random",sampleAlphaOnly:e.type!=="CIMPictureMarker",hasUnresolvedReplacementColor:!0,animationParams:X(i)}),!0}_analyzePictureMarker(e,t,r,i,s,a,n,l,h,c,u,d,p,m){const{animatedSymbolProperties:_,primitiveName:g,type:f}=e;let y=v(e.scaleX,1);const x=ve(e);r||(r=this._createMarkerPlacementOverrideExpression(e.markerPlacement));const w=this._createGIFAnimatedSymbolPropertiesOverrideExpression(_),M=e.anchorPoint??{x:0,y:0};if("width"in e&&typeof e.width=="number"){const z=e.width;let A=1;const I=this._resourceManager.getResource(e.url);I!=null&&(A=I.width/I.height),y/=A*(v(e.size)/z)}const b=[...i];let S;e.primitiveName&&b.push(e.primitiveName),_||w?S={type:"animated",url:e.url,urlHash:"H"+Vt(e.url),playAnimation:e.animatedSymbolProperties?.playAnimation,reverseAnimation:e.animatedSymbolProperties?.reverseAnimation,randomizeStartTime:e.animatedSymbolProperties?.randomizeStartTime,randomizeStartSeed:e.animatedSymbolProperties?.randomizeStartSeed,startTimeOffset:e.animatedSymbolProperties?.startTimeOffset,duration:e.animatedSymbolProperties?.duration,repeatType:e.animatedSymbolProperties?.repeatType,repeatDelay:e.animatedSymbolProperties?.repeatDelay}:(S=Je(e),S.markerPlacement=null);const C={type:"sprite-rasterization-param",resource:S,overrides:this._getMaterialOverrides(b,f)};w&&C.overrides.push(...w.overrides);const k=n;this._cimLayers.push({type:"marker",spriteRasterizationParam:C,colorLocked:p,effects:t,scaleSymbolsProportionally:!1,alignment:s,size:n,scaleX:this._getValueOrOverrideExpression(f,g,"ScaleX",y),rotation:l,offsetX:h,offsetY:c,transform:{type:"cim-marker-transform-param",params:u},color:this._getValueOrOverrideExpression(f,g,"TintColor",x),anchorPoint:{x:M.x,y:M.y},isAbsoluteAnchorPoint:e.anchorPointUnits!=="Relative",outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:a,sizeRatio:1,isOutline:m,markerPlacement:r,animationParams:X(d),baseSize:k})}_analyzeVectorMarker(e,t,r,i,s,a,n,l,h,c,u,d,p,m,_){const g=e.markerGraphics;if(!g)return;const f=e.frame;let y=0;y=f?f.ymax-f.ymin:a;const x=!!e.scaleSymbolsProportionally;if(y){const w={offsetX:h,offsetY:c,rotation:l,size:n,frameHeight:y,rotateClockWise:!!e.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:x};u=[...u,w]}r||(r=this._createMarkerPlacementOverrideExpression(e.markerPlacement));for(const w of g)if(w){const M=w.symbol;if(!M)continue;const b=w.primitiveName;b&&i.push(b);let S,C=d;if((M.type==="CIMPointSymbol"||M.type==="CIMTextSymbol")&&f){let I=0,B=0;const q=w.geometry;"x"in q&&"y"in q&&(I+=q.x-.5*(f.xmin+f.xmax),B+=q.y-.5*(f.ymin+f.ymax));const E=e.anchorPoint;let Q=!1;E&&(e.anchorPointUnits==="Absolute"?(I-=E.x,B-=E.y,Q=!0):f&&(I-=(f.xmax-f.xmin)*E.x,B-=(f.ymax-f.ymin)*E.y));const K={offsetX:I,offsetY:B,rotation:0,size:0,frameHeight:0,rotateClockWise:!1,absoluteAnchorPoint:Q,scaleSymbolsProportionally:x};S=[...u,K]}const k=w.geometry,[z,A]=zs(k,f);switch(z===0&&A===0||(C=ks(C,z,A)),M.type==="CIMPointSymbol"&&(C=j(this._poMap,M,C)),M.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":p||Ys(M)?(C={...C,transform:{type:"AnimatedTransform",relativeTranslation:!1,absoluteScale:!0,translation:O([0,0]),rotation:O(0),scale:O(y),parent:d.transform}},this._analyzeMultiLayerGraphicNonSDF(e,t,r,w,i,s,a,S??u,C,y,m,_)):this._analyzeMultiLayerGraphic(e,t,r,w,i,s,a,S??u,C,y,m,_);break;case"CIMTextSymbol":this._analyzeTextGraphic(t,r,w,i,s,a,S??u,m)}b&&i.pop()}}_analyzeMultiLayerGraphic(e,t,r,i,s,a,n,l,h,c,u,d){const p=i.symbol,m=p.symbolLayers;if(m){if(!Xs(m)||rr(h))return Js(m)?(Ar(p,_=>{_.colorLocked&&(u=!0)}),void this._analyzeMultiLayerGraphicNonSDF(e,t,r,i,s,a,n,l,h,c,u,d)):void this._analyzeMarkerGraphicSymbolLayers(e,t,r,i,s,a,n,l,h,c,u,d);this._analyzeCompositeMarkerGraphic(e,t,r,i,m,a,n,l,c,u,d)}}_analyzeMarkerGraphicSymbolLayers(e,t,r,i,s,a,n,l,h,c,u,d){const p=i.symbol,m=p.symbolLayers;if(!m)return;const _=He.applyEffects(p.effects,i.geometry);if(!_)return;let g=m.length;for(;g--;){const f=m[g];if(!f||f.enable===!1)continue;const y=f.primitiveName;switch(y&&s.push(y),f.type){case"CIMSolidFill":case"CIMSolidStroke":{const x=He.applyEffects(f.effects,_),w=ke(x);if(!w)continue;const M=e.anchorPointUnits!=="Relative",b=f.type==="CIMSolidStroke"?f.width:0,{frameSizeRatio:S,anch
2orX:C,anchorY:k,widthRatio:z,sdfPaddingRatio:A,sdfTextureSize:I}=ft(w,e.frame,e.size,e.anchorPoint,M,b,e.scaleSymbolsProportionally),B=f.type==="CIMSolidFill",q={type:"sdf",geometry:x,sdfPaddingRatio:A,asFill:B,sdfTextureSize:I},{path:E}=f,Q=B?$(Zr(f)):E==null?$(gt(f)):[0,0,0,0],K=B?[0,0,0,0]:$(gt(f));if(!B&&!b)break;const ne=i.primitiveName;let ce=null;B&&!f.colorLocked&&(ce=this._maybeGetValueOrOverrideExpression(ne,"FillColor"));let ue=null;B||f.colorLocked||(ue=this._maybeGetValueOrOverrideExpression(ne,"StrokeColor"));const Me=ce??this._getValueOrOverrideExpression(f.type,y,"Color",Q),Ie=ue??this._getValueOrOverrideExpression(f.type,y,"Color",K),de=this._maybeGetValueOrOverrideExpression(ne,"StrokeWidth")??this._getValueOrOverrideExpression(f.type,y,"Width",b),Be=E?{type:"sprite-rasterization-param",resource:{type:"path",path:E,asFill:B},overrides:[]}:{type:"sprite-rasterization-param",resource:q,overrides:[]},D=j(this._poMap,f,h),N=v(e.size,T.CIMVectorMarker.size),H=this._getValueOrOverrideExpression(e.type,e.primitiveName,"Size",N);this._cimLayers.push({type:"marker",spriteRasterizationParam:Be,colorLocked:!!f.colorLocked||!!u,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:C,y:k},isAbsoluteAnchorPoint:M,size:c,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:c,widthRatio:z,rotateClockwise:!1,referenceSize:n,sizeRatio:S,color:Me,outlineColor:Ie,outlineWidth:de,isOutline:d,markerPlacement:r,animationParams:X(D),isStroke:f.type!=="CIMSolidFill",baseSize:H,...jr(x,I,A)});break}case"CIMPictureMarker":case"CIMVectorMarker":if(f.markerPlacement){vt().error("Error analyzing CIM, got unexpected marker placement");break}this._analyzeMarker(f,t,r,s,a,n,!1,l,h,u,d)}y&&s.pop()}}_analyzeTextGraphic(e,t,r,i,s,a,n,l){const h=[];re.findApplicableOverrides(r,this._primitiveOverrides,h);const c=r.geometry;if(!("x"in c)||!("y"in c))return;const u=r.symbol,d=ei(u),p=ti(u.fontStyleName),m=Er(u.fontFamilyName);u.font={family:m,decoration:d,...p};const _=v(u.height,T.CIMTextSymbol.height),g=v(u.angle),f=v(u.offsetX),y=v(u.offsetY),{haloSymbol:x}=u,w=v(u.haloSize,0);let M=[0,0,0,0];if(x?.symbolLayers?.length){const D=x.symbolLayers;for(const N of D)if(N.color){M=this._getValueOrOverrideExpression(u?.haloSymbol?.type??"CIMPolygonSymbol",N.primitiveName,"Color",$(N.color));break}}const b=r.primitiveName;let S=[0,0,0,1],C=[0,0,0,0],k=0,z=!1;if(u.symbol?.symbolLayers)for(const D of u.symbol.symbolLayers){const N=D.primitiveName;if(D.type==="CIMSolidStroke")C=this._getValueOrOverrideExpression("CIMSolidStroke",N,"Color",$(D.color)),k=this._getValueOrOverrideExpression("CIMSolidStroke",N,"Width",ri(D)??0);else if(D.type==="CIMSolidFill"){const H=$(D.color);z=z??!!D.colorLocked,S=this._getValueOrOverrideExpression("CIMSolidFill",N??b,"Color",H)}}let A=null,I=null,B=null,q=null,E=null;b&&(A=this._maybeGetValueOrOverrideExpression(b,"TextSize"),I=this._maybeGetValueOrOverrideExpression(b,"TextAngle"),B=this._maybeGetValueOrOverrideExpression(b,"TextOffsetX"),q=this._maybeGetValueOrOverrideExpression(b,"TextOffsetY"),z||(E=this._maybeGetValueOrOverrideExpression(b,"FillColor")));const Q=E??S;let K=null,ne=null,ce=0;if(u.callout?.type==="CIMBackgroundCallout"){const D=u.callout;if(D.backgroundSymbol){const N=D.backgroundSymbol.symbolLayers;if(N)for(const H of N)H.type==="CIMSolidFill"?K=$(H.color):H.type==="CIMSolidStroke"&&(ne=$(H.color),ce=v(H.width,T.CIMSolidStroke.width))}}const ue=this._getValueOrOverrideExpression(u.type,r.primitiveName,"TextString",r.textString??"");if(ue==null)return;const{fontStyleName:Me}=u,Ie=m+(Me?"-"+Me.toLowerCase():"-regular"),de=this._getMaterialOverrides(i,u.type);de.push(...this._getPrimitiveMaterialOverrides(r.primitiveName,u.type)),this._collectDictionaryTemplateOverrides(de,r);const Be={type:"text-rasterization-param",resource:{type:"text",textString:r.textString??"",font:u.font,symbol:u,primitiveName:r.primitiveName},overrides:de};this._cimLayers.push({type:"text",lineWidth:u.lineWidth,textRasterizationParam:Be,colorLocked:!!l||!!z,effects:e,alignment:s,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:Ie,decoration:d,haloSize:w,haloColor:M,weight:p.weight,style:p.style,size:A??_,angle:I??g,offsetX:B??f,offsetY:q??y,transform:{type:"cim-marker-transform-param",params:n},horizontalAlignment:si(u.horizontalAlignment),verticalAlignment:ii(u.verticalAlignment),text:ue,color:Q,outlineColor:C,outlineSize:k,backgroundColor:K,borderLineColor:ne,borderLineWidth:ce,referenceSize:a,sizeRatio:1,markerPlacement:t})}_collectDictionaryTemplateOverrides(e,t){if(t.textString&&this._hasTextStringTemplates){const r=ai(t.symbol);e.push({propertyName:"textString",defaultValue:"",valueExpressionInfo:{type:"dictionary-template",textCase:r,template:t.textString},primitiveName:t.primitiveName})}}_analyzeMultiLayerGraphicNonSDF(e,t,r,i,s,a,n,l,h,c,u,d){const p=js(e,i),m=e.primitiveName,_=this._analyzeMaterialOverrides(m,["Rotation","OffsetX","OffsetY"]),g=De(_),[f,y,x]=le.getTextureAnchor(p,this._resourceManager,jt),w=this._getMaterialOverrides(s,e.type);w.push(...g);const M={type:"sprite-rasterization-param",resource:{...p,avoidSDFRasterization:!0},overrides:w},b=v(e.size,T.CIMVectorMarker.size),S=this._getValueOrOverrideExpression(e.type,m,"Size",b);this._cimLayers.push({type:"marker",spriteRasterizationParam:M,c
2olorLocked:u,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:f,y},isAbsoluteAnchorPoint:!1,size:c,rotation:0,offsetX:0,offsetY:0,transform:{type:"cim-marker-transform-param",params:l},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:c,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:n,sizeRatio:x/se(e.size),isOutline:d,markerPlacement:r,animationParams:X(h),baseSize:S})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;const t=[];return re.findApplicableOverrides(e,this._primitiveOverrides,t),{type:"cim-marker-placement-param",placement:e,overrides:Pt(t)}}_createGIFAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;const t=[];return re.findApplicableOverrides(e,this._primitiveOverrides,t),{type:"cim-gif-animation-params",animation:e,overrides:Pt(t)}}_analyzeCompositeMarkerGraphic(e,t,r,i,s,a,n,l,h,c,u){const d=i.geometry,p=s[0],m=s[1],_=ke(d);if(!_)return;const g=e.anchorPointUnits!=="Relative",f=v(p.width,T.CIMSolidStroke.width),{frameSizeRatio:y,anchorX:x,anchorY:w,widthRatio:M,sdfPaddingRatio:b,sdfTextureSize:S}=ft(_,e.frame,e.size,e.anchorPoint,g,f,e.scaleSymbolsProportionally),{path:C}=m,k=m.primitiveName,z=p.primitiveName,A=i.primitiveName;let I=null;m.colorLocked||c||(I=this._maybeGetValueOrOverrideExpression(A,"FillColor"));const B=I??this._getValueOrOverrideExpression(m.type,k,"Color",$(m.color));let q=null;p.colorLocked||c||(q=this._maybeGetValueOrOverrideExpression(A,"StrokeColor"));const E=q??this._getValueOrOverrideExpression(p.type,z,"Color",$(p.color)),Q=this._maybeGetValueOrOverrideExpression(A,"StrokeWidth")??this._getValueOrOverrideExpression(p.type,z,"Width",f),K={type:"sprite-rasterization-param",resource:C?{type:"path",path:C,asFill:!0}:{type:"sdf",geometry:d,sdfTextureSize:S,sdfPaddingRatio:b,asFill:!0},overrides:[]};this._cimLayers.push({type:"marker",spriteRasterizationParam:K,colorLocked:c,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x,y:w},isAbsoluteAnchorPoint:g,size:h,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:h,widthRatio:M,rotateClockwise:!1,referenceSize:n,sizeRatio:y,color:B,outlineColor:E,outlineWidth:Q,isOutline:u,markerPlacement:r})}_setPoMap(e,t,r){let i;this._poMap[e]?i=this._poMap[e]:(i={},this._poMap[e]=i),i[t]=r}_maybeGetValueOrOverrideExpression(e,t,r){return this._getValueOrOverrideExpression("",e,t,r,!1)}_getValueOrOverrideExpression(e,t,r,i,s=!0){if(s&&!ni(i)&&(i=Le(e,r.toLowerCase())),t==null)return i;const a=this._poMap[t];if(a==null)return i;const n=a[r];return typeof n=="string"||typeof n=="number"||Array.isArray(n)?n:n?{valueExpressionInfo:n,defaultValue:i}:i}_analyzePrimitiveOverrides(e,t,r,i){if(e==null)return!1;typeof e=="string"&&(e=[e]);for(const s of this._primitiveOverrides)if(e.includes(s.primitiveName)&&s.valueExpressionInfo)return!0;if(t!=null){for(const s of t)if(s?.overrides.length>0)return!0}if(r!=null){for(const s of r)if(s?.overrides.length>0)return!0}if(i!=null){for(const s of i)if(s?.overrides.length>0)return!0}return!1}_getMaterialOverrides(e,t){if(!e)return[];const r=[];for(const i of e)r.push(...this._getPrimitiveMaterialOverrides(i,t));return r}_getPrimitiveMaterialOverrides(e,t){if(!e)return[];const r=De(this._primitiveOverrides.filter(i=>i.primitiveName===e));return r.forEach(i=>i.defaultValue=Le(t,i.propertyName.toLowerCase())),r}_analyzeMaterialOverrides(e,t){return this._primitiveOverrides.filter(r=>r.primitiveName!==e||!t.includes(r.propertyName))}}function js(o,e){return{type:o.type,enable:!0,name:o.name,colorLocked:o.colorLocked,primitiveName:o.primitiveName,anchorPoint:o.anchorPoint,anchorPointUnits:o.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:o.rotateClockwise,rotation:0,size:o.size,billboardMode3D:o.billboardMode3D,depth3D:o.depth3D,frame:o.frame,markerGraphics:[e],scaleSymbolsProportionally:o.scaleSymbolsProportionally,respectFrame:o.respectFrame,clippingPath:o.clippingPath}}function Ct(o){if(o?.startsWith("Level_")){const e=parseInt(o.slice(6),10);if(!isNaN(e))return e}return 0}const Xs=o=>
2o&&o.length===2&&o[0].enable&&o[1].enable&&o[0].type==="CIMSolidStroke"&&o[1].type==="CIMSolidFill"&&o[0].path==null&&o[1].path==null&&!o[0].effects&&!o[1].effects&&!o[0].animations&&!o[1].animations;function Ys(o){const e=o.symbolLayers;if(!e)return!1;const t=e.find(i=>i.effects?.find(s=>s.type==="CIMGeometricEffectDashes"&&s.dashTemplate!=null)),r=e.find(i=>i.effects?.find(s=>s.type==="CIMGeometricEffectAddControlPoints"));return!!t||!!r}function Js(o){return o.some(e=>e.type!=="CIMSolidFill"&&e.type!=="CIMSolidStroke"&&(e.type!=="CIMVectorMarker"&&e.type!=="CIMPictureMarker"||e.markerPlacement!=null))}function Qs(o,e){if(e?.some(t=>t.type==="CIMGeometricEffectRadial")&&e?.some(t=>t.type==="CIMGeometricEffectTaperedPolygon")&&o.length===2){const t=o.find(s=>s.type==="CIMSolidFill"),r=o.find(s=>s.type==="CIMSolidStroke"),i=r?.effects?.some(s=>s.type==="CIMGeometricEffectDashes");if(t!=null&&r!=null&&!i)return!0}return!1}function Pt(o){return Je(o).map(e=>({...e,propertyName:oi(e.propertyName)}))}function X(o){return rr(o)?{type:"animation-params",params:o}:null}const Ot={stencil:Ti,tileDebugInfo:zi};let nr=class{constructor(){this._initialized=!1}dispose(){this._program=F(this._program),this._vertexArrayObject=F(this._vertexArrayObject)}render(e,t,r,i){e&&(this._initialized||this._initialize(e),e.setBlendFunctionSeparate(1,771,1,771),e.bindVAO(this._vertexArrayObject),e.useProgram(this._program),t.setSamplingMode(r),e.bindTexture(t,0),this._program.setUniform1i("u_tex",0),this._program.setUniform1f("u_opacity",i),e.drawArrays(ge.TRIANGLE_STRIP,0,4),e.bindTexture(null,0),e.bindVAO(null))}_initialize(e){if(this._initialized)return!0;const t=new Int8Array(16);t[0]=-1,t[1]=-1,t[2]=0,t[3]=0,t[4]=1,t[5]=-1,t[6]=1,t[7]=0,t[8]=-1,t[9]=1,t[10]=0,t[11]=1,t[12]=1,t[13]=1,t[14]=1,t[15]=1;const r=new Zt(e,new er(e,Hi,t));return this._program=ze(e,Ri,r.locations),this._vertexArrayObject=r,this._initialized=!0,!0}},Ks=class{constructor(e){this._rctx=e,this._programByKey=new Map}dispose(){this._programByKey.forEach(e=>e.dispose()),this._programByKey.clear()}getProgram(e,t=[]){const r=e.vsPath+"."+e.fsPath+JSON.stringify(t);if(this._programByKey.has(r))return this._programByKey.get(r);const i={...t.map(c=>typeof c=="string"?{name:c,value:!0}:c).reduce((c,u)=>({...c,[u.name]:u.value}),{})},{vsPath:s,fsPath:a,locations:n}=e,l=Yi(s,a,i),h=this._rctx.programCache.acquire(l.vertexShader,l.fragmentShader,n);if(!h)throw new Error("Unable to get program for key: ${key}");return this._programByKey.set(r,h),h}},kt=class{constructor(){this._programCache=new Map}destroy(){for(const e of this._programCache.values())e.destroy();this._programCache.clear()}getProgram(e,t,r,i,s,a){const n=a??e.getShaderKey(t,r,i,s);let l=this._programCache.get(n);return l||(l=e.getProgram(t,r,i,s),this._programCache.set(n,l)),l}},Zs=class{constructor(){this._currentPipelineStateNeedsUpdate=!1,this._programCache=new kt}dispose(){this._programCache.destroy()}clearShaderCache(){this._programCache.destroy(),this._programCache=new kt}setShader(e){return this._shaderState={shader:e.shader,uniforms:e.uniforms,defines:e.defines,optionalAttributes:e.optionalAttributes,useComputeBuffer:e.useComputeBuffer??!1},this._shaderState}setPipelineState(e){e!==this._currentPipelineState&&(this._currentPipelineState=e,this._currentPipelineStateNeedsUpdate=!0)}updatePipelineState(e){this._currentPipelineStateNeedsUpdate&&(this._currentPipelineStateNeedsUpdate=!1,this._updatePipelineState(e))}getPipelineState(){return this._currentPipelineState}setStencilRef(e,t){if(this._currentPipelineState==null)throw new Error("Pipeline state not defined. Call setPipelineState before calling submitDraw ");const{stencil:r}=this._currentPipelineState;if(r){const{test:i}=r;if(i){const{compare:s,mask:a}=i;if(t==null)throw new Error("InternalError: Stencil reference expected for target but not defined");e.setStencilFunctionSeparate(1032,s,t,a)}}}setPipelineStateNeedsUpdate(e){this._currentPipelineStateNeedsUpdate=e}getShaderState(){return this._shaderState}getProgramCache(){return this._programCache}submitDraw(e,t,r){let i=r?.stencilRef;if(!this._shaderState)return null;const{shader:s,uniforms:a,defines:n,optionalAttributes:l}=this._shaderState,h=e.context,c=t.getAttributePrecisionPackFactors(),u=this._programCache.getProgram(s,c,a,n??{},l??{});if(u.setUniforms(a),u.bind(h),this.updatePipelineState(h),i==null){const d=t.getStencilReference();d!=null&&(i=d)}return i!=null&&this.setStencilRef(h,i),t.draw(e,s.locationInfo),u.cleanupTemporaryTextures(),{vertexShader:u.vertexShader,fragmentShader:u.fragmentShader}}submitDrawMesh(e,t,r,i){this.submitDrawMeshUntyped(e,t,r,i)}submitDrawMeshUntyped(e,t,r,i){const s=i?.parts,a=i?.stencilRef,{precisionFactors:n,materialKey:l}=t,{shader:h,uniforms:c,defines:u,optionalAttributes:d}=this.setShader(t),p=this._programCache.getProgram(h,n||{},c,u??{},d??{},l);if(p.setUniforms(c),p.bind(e),this.updatePipelineState(e),this.setStencilRef(e,a),s)for(const m of s)r.bind(e,t.shader.locationInfo,m),r.draw(e);else for(let m=0;m<r.parts.length;m++)r.bind(e,t.shader.locationInfo,m),r.draw(e);r.unbind(e),p.cleanupTemporaryTextures()}_updatePipelineState(e){if(this._currentPipelineState==null)throw new Error("Pipeline state not defined.
2Call setPipelineState before calling submitDraw ");const{color:t,depth:r,stencil:i}=this._currentPipelineState;if(t){const{blendMode:s,write:a}=t;switch(e.setColorMask(...a),e.setBlendingEnabled(s!=="none"),e.setBlendEquation(32774),s){case"composite":e.setBlendFunctionSeparate(1,771,1,771);break;case"additive":e.setBlendFunctionSeparate(1,1,1,1);break;case"custom":{const{blendParameters:n}=t,{dstAlpha:l,dstRGB:h,srcAlpha:c,srcRGB:u}=n;e.setBlendFunctionSeparate(u,h,c,l);break}case"delete":e.setBlendEquation(32779),e.setBlendFunctionSeparate(1,771,1,771);break;case"none":e.setBlendingEnabled(!1)}}else e.setColorMask(!1,!1,!1,!1);if(r){const{test:s,write:a}=r;a?(e.setDepthWriteEnabled(!0),e.setDepthRange(a.zNear,a.zFar)):e.setDepthWriteEnabled(!1),s?(e.setDepthTestEnabled(!0),e.setDepthFunction(s)):e.setDepthTestEnabled(!1)}else e.setDepthTestEnabled(!1),e.setDepthWriteEnabled(!1);if(i){const{test:s,write:a}=i;if(s){const{op:n}=s;e.setStencilTestEnabled(!0),e.setStencilOpSeparate(1032,n.fail,n.zFail,n.zPass)}else e.setStencilTestEnabled(!1);if(a){const{mask:n}=a;e.setStencilWriteMask(n)}else e.setStencilWriteMask(0)}else e.setStencilTestEnabled(!1),e.setStencilWriteMask(0)}};const ea=512;let ta=class{constructor(e){this._resourceManager=e,this._cachedRasterizationCanvas=null}dispose(){this._cachedRasterizationCanvas=null}get _canvas(){return this._cachedRasterizationCanvas||(this._cachedRasterizationCanvas=document.createElement("canvas")),this._cachedRasterizationCanvas}rasterizeJSONResource(e){switch(e.type){case"dash":{const t=Ht(e.dashTemplate),[r,i,s]=ui(t);return{size:[i,s],image:new Uint32Array(r.buffer),sdf:!0,simplePattern:!0,anchorX:0,anchorY:0}}case"fill-style":{const[t,r,i,s]=ci(this._canvas,e,yt);return{size:[r,i],image:new Uint32Array(t.buffer),sdf:!1,simplePattern:!0,anchorX:0,anchorY:0,rasterizationScale:s}}case"sdf":return zt(e);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMPictureMarker":case"CIMVectorMarker":return this._rasterizeCIMJSONResource(e)}}_rasterizeCIMJSONResource(e){switch(e.type){case"CIMGradientFill":case"CIMGradientStroke":{const[t,r,i]=di(this._canvas,e);return{size:[r,i],image:new Uint32Array(t.buffer),sdf:!1,simplePattern:!1,anchorX:0,anchorY:0,samplingMode:e.gradientType==="Discrete"||e.colorRamp.type==="CIMFixedColorRamp"?"Nearest":"Linear"}}case"CIMHatchFill":{const t=le.fromCIMHatchFill(e,yt);return this._rasterizeCIMVectorMarker(t)}case"CIMPictureMarker":{const t=le.fromCIMInsidePolygon(e);return this._rasterizeCIMVectorMarker(t)}case"CIMVectorMarker":{if(e.markerPlacement?.type==="CIMMarkerPlacementInsidePolygon"){const r=le.fromCIMInsidePolygon(e);return this._rasterizeCIMVectorMarker(r)}const t=Xr(e);return t&&!e.avoidSDFRasterization?zt(t):this._rasterizeCIMVectorMarker(e,!1,jt)}}}_rasterizeCIMVectorMarker(e,t=!0,r){const i=t?Dr.fromExtent(e.frame):null,[s,a,n,l,h]=le.rasterize(this._canvas,e,i,this._resourceManager,!0,r);return s?{size:[a,n],image:new Uint32Array(s.buffer),sdf:!1,simplePattern:!1,anchorX:l,anchorY:h}:null}rasterizeImageResource(e,t,r,i){this._canvas.width=e,this._canvas.height=t;const s=this._canvas.getContext("2d",{willReadFrequently:!0});r instanceof ImageData?s.putImageData(r,0,0):(r.setAttribute("width",`${e}px`),r.setAttribute("height",`${t}px`),s.drawImage(r,0,0,e,t));const a=s.getImageData(0,0,e,t),n=new Uint8Array(a.data);if(i){for(const p of i)if(p&&p.oldColor&&p.oldColor.length===4&&p.newColor&&p.newColor.length===4){const[m,_,g,f]=p.oldColor,[y,x,w,M]=p.newColor;if(m===y&&_===x&&g===w&&f===M)continue;for(let b=0;b<n.length;b+=4)m===n[b]&&_===n[b+1]&&g===n[b+2]&&f===n[b+3]&&(n[b]=y,n[b+1]=x,n[b+2]=w,n[b+3]=M)}}let l;for(let p=0;p<n.length;p+=4)l=n[p+3]/255,n[p]=n[p]*l,n[p+1]=n[p+1]*l,n[p+2]=n[p+2]*l;let h=n,c=e,u=t;const d=ea;if(c>=d||u>=d){const p=c/u;p>1?(c=d,u=Math.round(d/p)):(u=d,c=Math.round(d*p)),h=new Uint8Array(4*c*u);const m=new Uint8ClampedArray(h.buffer);li(n,e,t,m,c,u,!1)}return{size:[c,u],image:new Uint32Array(h.buffer),sdf:!1,simplePattern:!1,anchorX:0,anchorY:0}}};function zt(o){if(!o)return null;const{data:e,width:t,height:r,sdfPaddingRatio:i,sdfDecodeCoeff:s}=Yr(o);return e?{size:[t,r],image:new Uint32Array(e.buffer),sdf:!0,simplePattern:!0,sdfPaddingRatio:i,sdfDecodeCoeff:s,anchorX:0,anchorY:0}:null}let Ne=null;async function ra(){return Ne||(Ne=ia()),Ne}async function ia(){const o=await we(()=>import("./C5152nUd.js"),[],import.meta.url);return await o.default({module_or_path:dr("esri/libs/text/pkg/bundle_bg.wasm")}),o}const fe=1e20;class sa{constructor(e){this.sdfSizePx=e.sdfSizePx,this.sdfBufferPx=e.sdfBufferPx,this.radius=e.radius,this.cutoff=e.cutoff;const t=e.sdfSizePx+8*e.sdfBufferPx;this.canvasSize=t;const r=this._createCanvas(t);this.context=r.getContext("2d",{willReadFrequently:!0}
2),this.context.imageSmoothingEnabled=!1,this.context.fillStyle="black",this.context.strokeStyle="black",this.gridOuter=new Float64Array(t*t),this.gridInner=new Float64Array(t*t),this.gridValues=new Float64Array(t),this.parabolaBoundaries=new Float64Array(t+1),this.parabolaIndices=new Uint16Array(t)}draw(e,t){const{context:r,gridInner:i,gridOuter:s,sdfSizePx:a,sdfBufferPx:n,canvasSize:l,cutoff:h,radius:c}=this;this.context.fillStyle="black",this.context.strokeStyle="black",this.context.clearRect(0,0,l,l);const u=e.paintCurves(t,r,a,n);if(!u)return null;const d=Math.ceil(u.width),p=Math.ceil(u.height),m=u.top,_=u.left;u.free();const g=d+2*n,f=p+2*n,y=new Uint8ClampedArray(Math.max(g*f,0)),x={buffer:y,width:d,height:p,top:m,left:_};if(d===0||p===0)return x;const w=r.getImageData(n,n,d,p);s.fill(fe,0,y.length),i.fill(0,0,y.length);for(let M=0;M<p;M++)for(let b=0;b<d;b++){const S=w.data[4*(M*d+b)+3]/255;if(S===0)continue;const C=(M+n)*g+b+n;if(S===1)s[C]=0,i[C]=fe;else{const k=.5-S;s[C]=k>0?k*k:0,i[C]=k<0?k*k:0}}this._edt(s,0,0,g,f,g),this._edt(i,0,0,g,f,g);for(let M=0;M<y.length;M++){const b=Math.sqrt(s[M])-Math.sqrt(i[M]);y[M]=Math.round(255-255*(b/c+h))}return x}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}_edt(e,t,r,i,s,a){for(let n=t;n<t+i;n++)this._edt1d(e,r*a+n,a,s);for(let n=r;n<r+s;n++)this._edt1d(e,n*a+t,1,i)}_edt1d(e,t,r,i){const s=this.parabolaIndices,a=this.parabolaBoundaries,n=this.gridValues;s[0]=0,a[0]=-fe,a[1]=fe,n[0]=e[t];for(let l=1,h=0,c=0;l<i;l++){n[l]=e[t+l*r];const u=l*l;do{const d=s[h];c=(n[l]-n[d]+u-d*d)/(l-d)/2}while(c<=a[h]&&--h>-1);h++,s[h]=l,a[h]=c,a[h+1]=fe}for(let l=0,h=0;l<i;l++){for(;a[h+1]<l;)h++;const c=s[h],u=l-c;e[t+l*r]=n[c]+u*u}}}let Te=class{constructor(e,t){this._width=0,this._height=0,this._free=[],this._width=e,this._height=t,this._free.push(new L(0,0,e,t))}get width(){return this._width}get height(){return this._height}allocate(e,t){if(e>this._width||t>this._height)return new L;let r=null,i=-1;for(let s=0;s<this._free.length;++s){const a=this._free[s];e<=a.width&&t<=a.height&&(r===null||a.y<=r.y&&a.x<=r.x)&&(r=a,i=s)}return r===null?new L:(this._free.splice(i,1),r.width<r.height?(r.width>e&&this._free.push(new L(r.x+e,r.y,r.width-e,t)),r.height>t&&this._free.push(new L(r.x,r.y+t,r.width,r.height-t))):(r.width>e&&this._free.push(new L(r.x+e,r.y,r.width-e,r.height)),r.height>t&&this._free.push(new L(r.x,r.y+t,e,r.height-t))),new L(r.x,r.y,e,t))}release(e){for(let t=0;t<this._free.length;++t){const r=this._free[t];if(r.y===e.y&&r.height===e.height&&r.x+r.width===e.x)r.width+=e.width;else if(r.x===e.x&&r.width===e.width&&r.y+r.height===e.y)r.height+=e.height;else if(e.y===r.y&&e.height===r.height&&e.x+e.width===r.x)r.x=e.x,r.width+=e.width;else{if(e.x!==r.x||e.width!==r.width||e.y+e.height!==r.y)continue;r.y=e.y,r.height+=e.height}this._free.splice(t,1),this.release(e)}this._free.push(e)}};const aa=256,na=.25,oa=o=>Math.floor(o/256);function la(o){const e=new Set;for(const t of o)e.add(oa(t));return e}function Tt(o,e,t){return o.has(e)||o.set(e,t().then(()=>{o.delete(e)}).catch(r=>{o.delete(e),pr(r)})),o.get(e)}const ha=o=>({rect:new L(0,0,0,0),page:0,metrics:{left:0,width:0,height:0,advance:0,top:0},code:o,sdf:!0});let ca=class{constructor(e,t,r){this.width=0,this.height=0,this._dirties=[],this._glyphData=[],this._currentPage=0,this._glyphCache={},this._glyphCacheById={},this._textures=[],this._rangePromises=new Map,this._facePromises=new Map,this._preloadCache={},this._glyphSDFCreator=new sa({sdfSizePx:Yt,sdfBufferPx:je,radius:Xt,cutoff:na}),this._faces=new Map,this.width=e,this.height=t,this._glyphSource=r,this._binPack=new Te(e,t),this._glyphData.push(new Uint8Array(e*t)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs()}dispose(){this._binPack=null;for(const e of this._textures)e&&e.dispose();this._textures.length=0,this._glyphData.length=0}_initDecorationGlyphs(){const e=[117,149,181,207,207,181,149,117],t=[],r=[];for(let a=0;a<e.length;a++){const n=e[a];for(let l=0;l<11;l++){const h=a>=3&&a<5&&l>=3&&l<8?255:0;t.push(n),r.push(h)}}const i={metrics:{width:5,height:2,left:0,top:0,advance:0},bitmap:new Uint8Array(t)},s={metrics:{width:5,height:2,left:0,top:0,advance:0},bitmap:new Uint8Array(r)};this._recordGlyph(i,Oe),this._recordGlyph(s,Oe)}getTexture(e,t){if(!this._textures[t]){const r=new R(this.width,this.height);r.pixelFormat=6406,r.wrapMode=33071,this._textures[t]=new U(e,r,new Uint8Array(this.width*this.height))}return this._dirties[t]&&(this._textures[t].setData(this._glyphData[t]),this._dirties[t]=!1),this._textures[t]}async getGlyphItems(e,t,r,i){let s,a,n=!1;if(t){const l=this._getGlyphCacheById(r),h=await this.getFace(r),c=this._glyphSDFCreator.sdfSizePx,[u,d,p]=dt(e,!1);n=d;const m=new Uint32Array(Array.from(u).map((_,g)=>p.levels[p.targetToSource[g]]));s={baseline:h.baseline()/c,midline:h.midline()/c},a=h.shape(u,m,c).map(_=>this._getMosaicItemComplex(l,_,h))}else{const[l,h,c]=dt(e);n=h;const u=this._getGlyphCache(r),d=es(l);await this._fetchRanges(r,d,i),a=d.map(p=>this._getMosaicItem(u,r,p))}return{isRightToLeft:n,glyphs:a,faceInfo:s}}async getFace(e){if(this._faces.has(e))return this._faces.get(e);const t=this._glyphSource.woffURL(e);return await Tt(this._facePromises,e,async()=>{const r=await he(t,{responseType:"array-buffer"}),i=(await ra()).Face.parseWoff2(new Uint8Array(r.data));this._faces.set(e,i)}),this._faces.get(e)}_getMosaicItem(e,t,r){if(!e[r]){const i=this._glyphSource.getGlyph(t,r);if(!i?.metrics)return ha(r);const s=this._recordGlyph(i,Oe),a=this._currentPage,n=i.metrics;e[r]={rect:s,page:a,metrics:n,code:r,sdf:!0},this._invalidate()}return e[r]}_getMosaicItemComplex(e,t,r){if(!e[t.glyphId]){const i=this._glyphSDFCreator.draw(r,t.glyphId),s={width:i?.width??0,height:i?.he
2ight??0,left:i?.left??0,top:i?.top??0,advance:t.xAdvance};let a=new L(0,0,0,0);if(i){const l={bitmap:i.buffer,metrics:s};a=this._recordGlyph(l,je)}const n=t.isNewline?10:t.isWhitespace?32:NaN;e[t.glyphId]={rect:a,page:this._currentPage,metrics:s,sdf:!0,code:n}}return e[t.glyphId]}bind(e,t,r,i){const s=this.getTexture(e,r);s.setSamplingMode(t),e.bindTexture(s,i)}preloadASCIIGlyphCache(e){const t=this._preloadCache[e];if(t!=null)return t;const r=this._glyphSource.preloadASCIIRange(e).then(()=>{const i=this._getGlyphCache(e);for(let s=0;s<256;s++)this._getMosaicItem(i,e,s)});return this._preloadCache[e]=r,r}_getGlyphCache(e){return this._glyphCache[e]||(this._glyphCache[e]={}),this._glyphCache[e]}_getGlyphCacheById(e){return this._glyphCacheById[e]||(this._glyphCacheById[e]={}),this._glyphCacheById[e]}_invalidate(){this._dirties[this._currentPage]=!0}async _fetchRanges(e,t,r){const i=la(t),s=[];i.forEach(a=>{s.push(this._fetchRange(e,a,r))}),await Promise.all(s)}async _fetchRange(e,t,r){if(t>aa)return;const i=e+t;return Tt(this._rangePromises,i,()=>this._glyphSource.getRange(e,t,r))}_allocNewPage(){this._dirties[this._currentPage]||(this._glyphData[this._currentPage]=null),this._currentPage=this._glyphData.length,this._glyphData.push(new Uint8Array(this.width*this.height)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs(),this._binPack=new Te(this.width,this.height)}_recordGlyph(e,t){const r=e.metrics;let i;if(r.width===0)i=new L(0,0,0,0);else{const s=r.width+2*t,a=r.height+2*t;i=this._binPack.allocate(s,a),i.isEmpty&&(this._allocNewPage(),i=this._binPack.allocate(s,a));const n=this._glyphData[this._currentPage],l=e.bitmap;let h,c;if(l)for(let u=0;u<a;u++){h=s*u,c=this.width*(i.y+u)+i.x;for(let d=0;d<s;d++)n[c+d]=l[h+d]}W("esri-glyph-debug")&&this._showDebugPage(n)}return i}_showDebugPage(e){const t=document.createElement("canvas"),r=t.getContext("2d"),i=new ImageData(this.width,this.height),s=i.data;t.width=this.width,t.height=this.height,t.style.border="1px solid black";for(let a=0;a<e.length;++a)s[4*a]=e[a],s[4*a+1]=0,s[4*a+2]=0,s[4*a+3]=255;r.putImageData(i,0,0),document.body.appendChild(t)}},Rt=class{constructor(e){for(this._metrics=[],this._bitmaps=[];e.next();)switch(e.tag()){case 1:{const t=e.getMessage();for(;t.next();)switch(t.tag()){case 3:{const r=t.getMessage();let i,s,a,n,l,h,c;for(;r.next();)switch(r.tag()){case 1:i=r.getUInt32();break;case 2:s=r.getBytes();break;case 3:a=r.getUInt32();break;case 4:n=r.getUInt32();break;case 5:l=r.getSInt32();break;case 6:h=r.getSInt32();break;case 7:c=r.getUInt32();break;default:r.skip()}r.release(),i&&(this._metrics[i]={width:a,height:n,left:l,top:h,advance:c},this._bitmaps[i]=s);break}default:t.skip()}t.release();break}default:e.skip()}}getMetrics(e){return this._metrics[e]}getBitmap(e){return this._bitmaps[e]}},ua=class{constructor(){this._ranges=[]}getRange(e){return this._ranges[e]}addRange(e,t){this._ranges[e]=t}},da=class{constructor(e){this._glyphInfo={},this._baseURL=e,this._woff2URL=`${Gt.fontsUrl}/woff2/{fontstack}.woff2`}async getRange(e,t,r){const i=this._getFontStack(e);if(i.getRange(t))return;const s=256*t,a=s+255,n=this._baseURL.replace("{fontstack}",e).replace("{range}",s+"-"+a);return he(n,{responseType:"array-buffer",...r}).then(l=>{i.addRange(t,new Rt(new xt(new Uint8Array(l.data),new DataView(l.data))))})}async preloadASCIIRange(e){const t=this._getFontStack(e),r=0,i=255,s=this._baseURL.replace("{fontstack}",e).replace("{range}",r+"-"+i),a=await he(s,{responseType:"array-buffer"}),n=new Rt(new xt(new Uint8Array(a.data),new DataView(a.data)));for(let l=r;l<=i;l++)t.getRange(l)||t.addRange(l,n)}getGlyph(e,t){const r=this._getFontStack(e);if(!r)return;const i=Math.floor(t/256),s=r.getRange(i);return s?{metrics:s.getMetrics(t),bitmap:s.getBitmap(t)}:void 0}woffURL(e){return this._woff2URL.replace("{fontstack}",e)}_getFontStack(e){let t=this._glyphInfo[e];return t||(t=this._glyphInfo[e]=new ua),t}};const me=1e20;let pa=class{constructor(e,t=2){this._textureSize=e,this._rasterizationScale=t,this._canvasSize=this._textureSize*this._rasterizationScale,this._svg=null;const{_canvasSize:r}=this,i=document.createElement("canvas");i.width=i.height=r,this._context=i.getContext("2d",{willReadFrequently:!1}),this._gridOuter=new Float64Array(r*r),this._gridInner=new Float64Array(r*r),this._f=new Float64Array(r),this._d=new Float64Array(r),this._z=new Float64Array(r+1),this._v=new Int16Array(r)}dispose(){this._context=this._gridOuter=this._gridInner=this._f=this._d=this._z=this._v=null,this._svg=Lr(this._svg)}draw(e,t,r){const{_canvasSize:i,_textureSize:s,_rasterizationScale:a}=this,n=s/4;this._initSVG();const l=this.createSVGString(e,t);return new Promise((h,c)=>{const u=new Image;u.src="data:image/svg+xml; charset=utf8, "+encodeURIComponent(l),u.onload=()=>{u.onload=null,this._context.clearRect(0,0,i,i),this._context.drawImage(u,0,0,i,i);const p=this._context.getImageData(0,0,i,i),m=new Uint8Array(s*s*4);for(let _=0;_<i*i;_++){const g=p.data[4*_+3]/255;this._gridOuter[_]=g===1?0:g===0?me:Math.max(0,.5-g)**2,this._gridInner[_]=g===1?me:g===0?0:Math.max(0,g-.5)**2}this._edt(this._gridOuter,i,i),this._edt(this._gridInner,i,i);for(let _=0;_<s*s;_++){let g=0;for(let f=0;f<a;f++){const y=Math.floor(_/s)*a+f;
2for(let x=0;x<a;x++){const w=y*i+(_%s*a+x);g+=this._gridOuter[w]-this._gridInner[w]}}g/=a*a,g/=a,pi(.5-g/(2*n),m,4*_)}h(m)};const d=r?.signal;d&&fr(d,()=>c(mr()))})}_initSVG(){return this._svg||(this._svg=Vr()),this._svg}createSVGString(e,t){const r=this._initSVG(),i=Gr("path");i.setAttribute("d",e),r.appendChild(i);const s=i.getBBox(),a=s.width/s.height,n=this._canvasSize/2;let l,h,c;if(a>1){l=n/s.width;const m=n*(1/a);h=this._canvasSize/4,c=n-m/2}else l=n/s.height,h=n-n*a/2,c=this._canvasSize/4;const u=-s.x*l+h,d=-s.y*l+c;i.setAttribute("style",`transform: matrix(${l}, 0, 0, ${l}, ${u}, ${d})`),i.setAttribute("stroke-width",""+.5/l);const p=`<svg style="fill:${t?"red":"none"}; stroke:${t?"none":"red"}" height="${this._canvasSize}" width="${this._canvasSize}" xmlns="http://www.w3.org/2000/svg">${r.innerHTML}</svg>`;return r.removeChild(i),p}_edt(e,t,r){const i=this._f,s=this._d,a=this._v,n=this._z;for(let l=0;l<t;l++){for(let h=0;h<r;h++)i[h]=e[h*t+l];this._edt1d(i,s,a,n,r);for(let h=0;h<r;h++)e[h*t+l]=s[h]}for(let l=0;l<r;l++){for(let h=0;h<t;h++)i[h]=e[l*t+h];this._edt1d(i,s,a,n,t);for(let h=0;h<t;h++)e[l*t+h]=Math.sqrt(s[h])}}_edt1d(e,t,r,i,s){r[0]=0,i[0]=-me,i[1]=+me;for(let a=1,n=0;a<s;a++){let l=(e[a]+a*a-(e[r[n]]+r[n]*r[n]))/(2*a-2*r[n]);for(;l<=i[n];)n--,l=(e[a]+a*a-(e[r[n]]+r[n]*r[n]))/(2*a-2*r[n]);n++,r[n]=a,i[n]=l,i[n+1]=+me}for(let a=0,n=0;a<s;a++){for(;i[n+1]<a;)n++;t[a]=(a-r[n])*(a-r[n])+e[r[n]]}}};function ee(o){return o&&o.type==="static"}let fa=class or{constructor(e,t,r=0){this._mosaicPages=[],this._maxItemSize=0,this._currentPage=0,this._pageWidth=0,this._pageHeight=0,this._mosaicRects=new Map,this._spriteCopyQueue=[],this.pixelRatio=1,this._pageWidth=e,this._pageHeight=t,r>0&&(this._maxItemSize=r),this.pixelRatio=window.devicePixelRatio||1,this._binPack=new Te(this._pageWidth,this._pageHeight);const i=Math.floor(this._pageWidth),s=Math.floor(this._pageHeight);this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(i*s)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0})}getWidth(e){return e>=this._mosaicPages.length?-1:this._mosaicPages[e].size[0]}getHeight(e){return e>=this._mosaicPages.length?-1:this._mosaicPages[e].size[1]}getPageTexture(e){return e<this._mosaicPages.length?this._mosaicPages[e].texture:null}has(e){return this._mosaicRects.has(e)}get itemCount(){return this._mosaicRects.size}getSpriteItem(e){return this._mosaicRects.get(e)}addSpriteItem(e,t,r,i,s,a,n=1,l="Linear",h=.5,c=1){if(this._mosaicRects.has(e))return this._mosaicRects.get(e);let u,d,p;if(ee(r)?[u,d,p]=this._allocateImage(t[0],t[1]):(u=new L(0,0,t[0],t[1]),d=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:r,size:[t[0]+2*Y,t[1]+2*Y],dirty:!0,texture:void 0})),u.width<=0||u.height<=0)return null;const m={type:"sprite",rect:u,width:t[0],height:t[1],sdf:s,simplePattern:a,rasterizationScale:n,samplingMode:l,sdfPaddingRatio:h,sdfDecodeCoeff:c,page:d};return this._mosaicRects.set(e,m),ee(r)&&(W("esri-mosaic-debug")&&this._showDebugSprite(t,r.data),this._copy({rect:u,spriteSize:t,spriteData:r.data,page:d,pageSize:p,repeat:i,sdf:s})),m}hasItemsToProcess(){return this._spriteCopyQueue.length!==0}processNextItem(){const e=this._spriteCopyQueue.pop();e&&this._copy(e)}getMosaicItemPosition(e){const t=this.getSpriteItem(e),r=t?.rect;if(!r)return null;r.width=t.width,r.height=t.height;const i=t.width,s=t.height,a=Y,n=this._mosaicPages[t.page].size;return{size:[t.width,t.height],tl:[(r.x+a)/n[0],(r.y+a)/n[1]],br:[(r.x+a+i)/n[0],(r.y+a+s)/n[1]],page:t.page}}bind(e,t,r=0,i=0){const s=this._mosaicPages[r],a=s.mosaicsData;let n=s.texture;if(n||(n=Ft(e,s.size),s.texture=n),n.setSamplingMode(t),e.bindTexture(n,i),ee(a))s.dirty&&(n.setData(new Uint8Array(a.data.buffer)),n.generateMipmap(),W("esri-mosaic-debug")&&this._showDebugPage(r));else{const l=a.data;l.hasFrameData&&(l.loadFrame(n),n.generateMipmap())}s.dirty=!1}getTexture(e,t=0){const{context:r}=e,i=this._mosaicPages[t],s=i.mosaicsData;let a=i.texture;if(a||(a=Ft(r,i.size),i.texture=a),ee(s))i.dirty&&(a.setData(new Uint8Array(s.data.buffer)),a.generateMipmap(),W("esri-mosaic-debug")&&this._showDebugPage(t));else{const n=s.data;n.update(e),n.hasFrameData&&(n.loadFrame(a),a.generateMipmap())}return i.dirty=!1,a}dispose(){this._binPack=null;for(const e of this._mosaicPages){const t=e.texture;t&&t.dispose();const r=e.mosaicsData;ee(r)||r.data.destroy()}this._mosaicPages=null,this._mosaicRects.clear()}static _copyBits(e,t,r,i,s,a,n,l,h,c,u){let d=i*t+r,p=l*a+n;if(u){p-=a;for(let m=-1;m<=c;m++,d=((m+c)%c+i)*t+r,p+=a)for(let _=-1;_<=h;_++)s[p+_]=e[d+(_+h)%h]}else for(let m=0;m<c;m++){for(let _=0;_<h;_++)s[p+_]=e[d+_];d+=t,p+=a}}_copy(e){if(e.page>=this._mosaicPages.length)return;const t=this._mosaicPages[e.page],r=t.mosaicsData;if(!ee(t.mosaicsData))throw new xe("mapview-invalid-resource","unsuitable data type!");const i=e.spriteData,s=r.data;or._copyBits(i,e.spriteSize[0],0,0,s,e.pageSize[0],e.rect.x+Y,e.re
vendor: 1,836 bytes, line 2
2ct.y+Y,e.spriteSize[0],e.spriteSize[1],e.repeat),t.dirty=!0}_allocateImage(e,t){e+=2*Y,t+=2*Y;const r=Math.max(e,t);if(this._maxItemSize&&this._maxItemSize<r){const s=2**Math.ceil(Mt(e)),a=2**Math.ceil(Mt(t)),n=new L(0,0,e,t);return this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(s*a)},size:[s,a],dirty:!0,texture:void 0}),[n,this._mosaicPages.length-1,[s,a]]}const i=this._binPack.allocate(e,t);if(i.width<=0){const s=this._mosaicPages[this._currentPage];return!s.dirty&&ee(s.mosaicsData)&&(s.mosaicsData.data=null),this._currentPage=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(this._pageWidth*this._pageHeight)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0}),this._binPack=new Te(this._pageWidth,this._pageHeight),this._allocateImage(e,t)}return[i,this._currentPage,[this._pageWidth,this._pageHeight]]}_showDebugSprite([e,t],r){const i=document.createElement("canvas");i.width=e,i.height=t,i.setAttribute("style",`position: absolute; top: ${4+204*ma++}px; right: 208px; width: 200px; height: 200px; border: 1px solid black;`);const s=i.getContext("2d"),a=new ImageData(e,t);a.data.set(new Uint8Array(r.buffer)),s.putImageData(a,0,0),document.body.appendChild(i)}_showDebugPage(e){const t=this._mosaicPages[e],{size:[r,i],mosaicsData:s}=t;if(!ee(s))return;const a=`mosaicDebugPage${e}`,n=document.getElementById(a)??document.createElement("canvas");n.id=a,n.width=r,n.height=i,n.setAttribute("style",`position: absolute; top: ${4+204*e}px; right: 4px; width: 200px; height: 200px; border: 1px solid black;`);const l=n.getContext("2d"),h=new ImageData(r,i);h.data.set(new Uint8Array(s.data.buffer)),l.putImageData(h,0,0),document.body.appendChild(n)}},ma=0;function Ft(o,e){const t=new R(e[0],e[1]);return t.wrapMode=33071,new U(o,t,null)}
2let _a=class{constructor(e,t,r,i){this._animation=e,this._frameData=null;const s=a=>{this._frameData=a,t.requestRender()};this.frameCount=this._animation.frameDurations.length,this.width=this._animation.width,this.height=this._animation.height,this._playAnimation=r.playAnimation??!1,this._player=as(this._animation,r,i,s)}destroy(){}loadFrame(e){const t=this._frameData;if(t==null)return;const r="width"in t?t.width:t.codedWidth,i="height"in t?t.height:t.codedHeight;e.updateData(0,Y,Y,r,i,t),this._frameData=null}get hasFrameData(){return this._frameData!=null}update(e){this._playAnimation&&ns(e,this._player)}},ga=class{constructor(){this._entries=new ba,this._nodes=new Map,this._book=new wa}add(e){let t=this._entries.get(e);if(!t){const r=this._book.add(e),i=new Object;t={location:r,references:0,handle:i};const s=this._entries.set(e,t);this._nodes.set(i,s)}return t.references++,t}remove(e){const t=this._nodes.get(e.handle);t&&t.payload&&(t.payload.references--,t.payload.references===0&&(this._book.remove(t.payload.location),this._entries.delete(t),this._nodes.delete(e.handle)))}getTexture(e,t){return this._book.getTexture(e,t)}destroy(){this._book.destroy()}},ya=class lr{constructor(e,t){this.parent=e,this.key=t,this.payload=null,this._children=new Map}get(e){return this._children.get(e)}ensure(e){let t=this._children.get(e);return t||(t=new lr(this,e),this._children.set(e,t)),t}delete(e){this._children.delete(e)}},ba=class{constructor(){this._root=new ya(null,NaN)}set(e,t){let r=this._root;for(const i of e)for(const s of i)r=r.ensure(s);return r.payload=t,r}delete(e){e.parent?.delete(e.key)}get(e){let t=this._root;for(const r of e)for(const i of r){const s=t.get(i);if(!s)return;t=s}return t.payload||void 0}},wa=class{constructor(){this._pages=[]}add(e){this._pages.length===0&&this._pages.push(new It);let t=this._pages.length-1,r=this._pages[t].add(e);if(r||(this._pages.push(new It),t=this._pages.length-1,r=this._pages[t].add(e)),!r)throw new Error("Data allocation failed.");return{...r,page:t}}remove(e){this._pages[e.page].remove(e)}getTexture(e,t){return this._pages[t].getTexture(e)}destroy(){}},It=class{constructor(){this._cursor={row:0,column:0},this._columns=1024,this._rows=1024,this._data=new Float32Array(this._columns*this._rows*4),this._texture=null,this._textureCursor={row:0,column:0}}add(e){if(e.length>this._columns)throw new Error(`The maximum allocation size is ${this._columns} texels.`);const t={...this._cursor};if(t.column+=e.length,t.column>=this._columns&&(t.column=e.length,t.row++),t.row>=this._rows)return null;this._cursor=t;const r={...this._cursor};r.column-=e.length;let i=4*(r.row*this._columns+r.column);for(let s=0;s<e.length;s++)this._data[i++]=e[s][0],this._data[i++]=e[s][1],this._data[i++]=e[s][2],this._data[i++]=e[s][3];return r}remove(e){}getTexture(e){if(!this._texture){const i=new R(this._columns,this._rows);i.pixelFormat=6408,i.dataType=tt.FLOAT,i.wrapMode=33071,i.samplingMode=9728,i.hasMipmap=!1;const s=new is(e,i);this._texture=new U(e,s)}if(this._cursor.row===this._textureCursor.row&&this._cursor.column===this._textureCursor.column)return this._texture;const t=this._textureCursor.row,r=this._cursor.row-t+1;return this._texture.updateData(0,0,t,this._columns,r,this._data,t),this._textureCursor.row=this._cursor.row,this._textureCursor.column=this._cursor.column,this._texture}destroy(){this._texture?.dispose()}};const Bt="arial-unicode-ms-regular",xa=new RegExp("[\\u0695\\u0698\\u06a9\\u06af\\u06b5\\u06be\\u06c6\\u06cc\\u06ce\\u06d5\\u06ca]|\\p{Script=Thai}|\\p{Script=Lao}|\\p{Script=Tamil}|\\p{Script=Khmer}","u"),hr=()=>Ye.getLogger("esri.views.MapView"),oe=(o,e,t)=>hr().error(new xe(o,e,t)),Ma=(o,e="")=>hr().warnOnce(o,e);let Sa=class cr{static fromMosaic(e,t){return new cr(e,t.page,t.sdf,t.samplingMode)}
2constructor(e,t,r,i){this.mosaicType=e,this.page=t,this.sdf=r,this.samplingMode=i}};class va{constructor(e){this._requestRender=e,this._resourceManager=new Zi,this._invalidFonts=new Set,this._sdfConverter=new pa(Ve),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new Ki({concurrency:10,process:async(t,r)=>{Qe(r);try{return await he(t,{responseType:"image",signal:r})}catch(i){throw st(i)?i:new xe("mapview-invalid-resource",`Could not fetch requested resource at ${t}`,i)}}}),this.animationStore=new ga,this._spriteMosaic=new fa(2048,2048,500),this._glyphSource=new da(`${Gt.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new ca(1024,1024,this._glyphSource),this._rasterizer=new ta(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}async rasterizeItem(e,t){if(e==null)return oe("mapview-null-resource","Unable to rasterize null resource"),null;if(e.type==="animation-info"){const{resource:s}=e,a=this.animationStore.add(s),{location:n}=a;return{rect:new L(n.column,n.row,s.length,1),page:n.page,type:"sprite",width:s.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if(e.type!=="cim-rasterization-info")return oe("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:r}=e;if(r.type==="text"){const s=await this._rasterizeText(r,t);for(const a of s.glyphs)this._setTextureBinding(1,a);return s}const i=await this._rasterizeSprite(r,t);return i&&this._setTextureBinding(0,i),i}getMosaicInfo(e,t,r=!1){const i=this._getTextureBindingInfo(e,t,r);return i?{size:i.size,texture:{texture:i.texture,unit:i.type==="sprite"?mi:bt}}:(oe("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0],texture:{texture:null,unit:0}})}_getTextureBindingInfo(e,t,r){const{context:i}=e,s=this._bindingInfos[t-1],a=s.page,n=s.samplingMode==="Nearest"?9728:r?9987:9729;switch(s.mosaicType){case 0:{const l=[this.sprites.getWidth(a),this.sprites.getHeight(a)],h=this._spriteMosaic.getTexture(e,a);return h.setSamplingMode(n),{type:"sprite",texture:h,size:l}}case 1:{const l=[this.glyphs.width,this.glyphs.height],h=this._glyphMosaic.getTexture(i,a);return this._glyphMosaic.bind(i,n,a,bt),h.setSamplingMode(n),{type:"glyph",texture:h,size:l}}default:return oe("mapview-texture-manager",`Cannot handle unknown type ${s.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|(t.samplingMode==="Nearest"?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const r=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(r)){const i=Sa.fromMosaic(e,t),s=this._bindingInfos.length+1;this._hashToBindingIndex.set(r,s),this._bindingInfos.push(i)}t.textureBinding=this._hashToBindingIndex.get(r)}async _rasterizeText(e,t){const{font:r,textString:i}=e,s=qr(r),a=this._invalidFonts.has(s),n=!!W("esri-2d-force-complex-shaping")||!!W("esri-2d-complex-shaping")&&xa.test(i),l=n?Yt:gi,h=n?Xt:_i,c=n?je:Oe;try{const u=a?Bt:s;W("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(u);const{isRightToLeft:d,glyphs:p,faceInfo:m}=await this._glyphMosaic.getGlyphItems(i,n,u,t);return{type:"glyphs",glyphs:p,faceInfo:m,isRightToLeft:d,sdfSize:l,sdfRadius:h,sdfPadding:c}}catch{Ma(`Font ${s} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(s);const{isRightToLeft:d,glyphs:p,faceInfo:m}=await this._glyphMosaic.getGlyphItems(i,n,Bt,t);return{type:"glyphs",glyphs:p,faceInfo:m,isRightToLeft:d,sdfSize:l,sdfRadius:h,sdfPadding:c}}}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}:${ts(e.markerPlacement)}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${Ht(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geometry)}.${e.sdfTextureSize}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(ss(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const r=Vt(this._hashSpriteResource(e));if(this._spriteMosaic.has(r))return this._spriteMosaic.getSpriteItem(r);if("url"in e&&e.url||e.type==="CIMPictureFill"||e.type==="CIMPictureStroke"||e.type==="CIMPictureMarker"||e.type==="CIMVectorMarker"){const i=[];le.fetchResources({type:"CIMPointSymbol",symbolLayers:[e]},this._resourceManager,i),i.length>0&&await Promise.all(i)}switch(e.type){case"CIMPictureMarker":return e.markerPlacement?.type==="CIMMarkerPlacementInsidePolygon"?this._rasterizeJSONResource(r,e):this._handleAsyncResource(r,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(r,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(r,e)}}_rasterizeJSONResource(e,t){const r=this._rasterizer.rasterizeJSONResource(t);if(r){const{size:i,image:s,sdf:a,simplePattern:n,rasterizationScale:l,samplingMode:h,sdfPaddingRatio:c,sdfDecodeCoeff:u}=r;return this._addItemToMosaic(e,i,{type:"static",data:s},Ce(t),a,n,l,h,c,u)}return null}async _handleAsyncResource(e,t,r){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let i;return i=t.type==="path"?this._handleSVG(t,e,r):this._handleImage(t,e,r),this._ongoingRasterizations.set(e,i),i.finally(()=>this._ongoingRasterizations.delete(e)),i}async _handleSVG(e,t,r){const i=[Ve,Ve],{asFill:s}=e,a=await this._sdfConverter.draw(e.path,s,r);return this._addItemToMosaic(t,i,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}_handleGIFOrPNG(e,t,r){const i=e.url,s=this.resourceManager.getResource(i);if(s==null)return null;const{width:a,height:n}=s;if(s instanceof HTMLImageElement){if(e.type==="animated")return oe("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const d="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:p,sdf:m,image:_}=this._rasterizer.rasterizeImageResource(a,n,s,d);return this._addItemToMosaic(t,p,{type:"static",data:_},Ce(e),m,!1)}let l,h,c;e.type==="animated"?(l=!1,h={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},c=e.startGroup||0):(l=Ce(e),h={type:"CIMAnimatedSymbolProperties",playAnimation:!0},c=0);const u=new _a(s,this._requestRender,h,c);return this._addItemToMosaic(t,[u.width,u.height],{type:"animated",data:u},l,!1,!1)}async _handleImage(e,t,r){const i=e.url;if(Pa(i)||ka(i))return this._handleGIFOrPNG(e,t,r);if(e.type==="animated")return oe("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let s;const a=this.resourceManager.getResource(i);if(a!=null&&a instanceof HTMLImageElement)s=a;else{const{data:p}=await this._imageRequestQueue.push(i,{...r});s=p}if(rs(i)){if("width"in e&&"height"in e)s.width=se(e.width),s.height=se(e.height);else if("cim"in e){const p=e;s.width=se(p.width??p.scaleX*p.size),s.height=se(p.size)}}if(!s.width||!s.height)return null;const n=s.width,l=s.height,h="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:c,sdf:u,image:d}=this._rasterizer.rasterizeImageResource(n,l,s,h);return this._addItemToMosaic(t,c,{type:"static",data:d},Ce(e),u,!1)}catch(s){throw st(s)?s:new xe("mapview-invalid-resource",`Could not fetch requested resource at ${i}. ${s.message}`)}}_addItemToMosaic(e,t,r,i,s,a,n,l,h,c){return this._spriteMosaic.addSpriteItem(e,t,r,i,s,a,n,l,h,c)}}function Ce(o){switch(o.type){case"CIMVectorMarker":case"CIMPictureMarker":return za(o);default:return!0}}const Ca=o=>o!=null&&o.startsWith("data:image/gif"),Pa=o=>o&&(o.includes(".gif")||Ca(o)),Oa=o=>o!=null&&o.startsWith("data:image/png"),ka=o=>o&&(o.includes(".png")||Oa(o)),za=o=>o&&"markerPlacement"in o&&o.markerPlacement&&o.markerPlacement.type==="CIMMarkerPlacementInsidePolygon";class Ta{constructor(e){this._queue=[],this._refreshable=e}destroy(){this._queue=[]}enqueueTextureUpdate(e,t){const r=_r(),i=e,s=yi,a=Math.ceil(i.height/s);Qe(t);for(let n=0;n<a;n++){const l=n*s,h=n===a-1,c=h?i.height-s*n:s;this._queue.push({type:"chunk",request:e,resolver:r,chunk:n,chunkOffset:l,destHeight:c,chunkIsLast:h,options:t})}return gr(t,n=>r.reject(n)),r.promise}upload(){const e=performance.now();let t=0;for(;this._queue.length;){const r=this._queue.shift();if(r){if(r.options.signal!=null&&r.options.signal.aborted)continue;switch(r.type){case"chunk":this._uploadChunk(r);break;case"no-chunk":this._uploadNoChunk(r)}++t;const i=performance.now()-e;if(i+i/t>=bi)break}}this._queue.length&&this._refreshable.requestRender()}_uploadChunk(e){const{request:t,resolver:r,chunkOffset:i,chunkIsLast:s,destHeight:a}=e,{data:n,texture:l,width:h}=t;n!=null&&(l.updateData(0,0,i,h,a,n,i),s&&r.resolve())}_uploadNoChunk(e){const{request:t,resolver:r}=e,{data:i,texture:s}=t;s.setData(i),r.resolve()}}const Ra=os(-.5,-.5);class Fa{constructor(){this._centerNdc=Ee(),this._pxToNdc=Ee(),this._worldDimensionsPx=Ee(),this._mat3=Fe(),this._initialized=!1}dispose(){this._program=F(this._program),this._quad=F(this._quad)}render(e,t,r){const{context:i}=e,s=this._updateGeometry(e,r);if(t!=null){const{r:a,g:n,b:l,a:h}=t;i.setClearColor(h*a/255,h*n/255,h*l/255,h)}else i.setClearColor(0,0,0,0);if(i.setStencilFunction(519,0,255),i.setStencilWriteMask(255),!s)return i.setClearStencil(Xe),void i.clear(17408);i.setClearStencil(wi),i.clear(17408),this._initialized||this._initialize(i),i.setDepthWriteEnabled(!1),i.setDepthTestEnabled(!1),i.setColorMask(!1,!1,!1,!1),i.setBlendingEnabled(!1),i.setStencilOp(7680,7680,7681),i.setStencilFunction(519,Xe,255),i.setStencilTestEnabled(!0),i.useProgram(this._program),this._program.setUniformMatrix3fv("u_worldExtent",this._mat3),this._quad.bind(),this._quad.draw(),this._quad.unbind()}_initialize(e){this._initialized||(this._quad=new Ji(e,[0,0,1,0,0,1,1,1]),this._program=ze(e,Fi,this._quad.locations),this._initialized=!0)}_updateGeometry(e,t){const{state:r,pixelRatio:i}=e,{size:s,rotation:a}=r,n=Math.round(s[0]*i),l=Math.round(s[1]*i);if(!r.spatialReference.isWrappable)return!1;const h=br(a),c=Math.abs(Math.cos(h)),u=Math.abs(Math.sin(h)),d=Math.round(n*c+l*u),p=Math.round(i*r.worldScreenWidth);if(d<=p)return!1;const m=n*u+l*c,_=(t.left-t.right)*i/n,g=(t.bottom-t.top)*i/l;Ge(this._worldDimensionsPx,p,m,1),Ge(this._pxToNdc,2/n,-2/l,1),Ge(this._centerNdc,_,g,1);const f=this._mat3;return yr(f,this._centerNdc),at(f,f,this._pxToNdc),a!==0&&qt(f,f,h),at(f,f,this._worldDimensionsPx),Nt(f,f,Ra),!0}}let Ia=class extends J{constructor(){super(...arguments),this.type=5,this._backBufferTexture=null,this.shaders={blend:new Ii,opacity:new Jt}}shutdown(){super.shutdown(),this._backBufferTexture!==null&&(this._backBufferTexture.dispose(),this._backBufferTexture=null)}
2render(e,t){const{context:r,state:i,pixelRatio:s,inFadeTransition:a,painter:n}=e,{size:l}=i,h=r.getBoundFramebufferObject();let c,u;h!=null?(c=h.width,u=h.height):(c=Math.round(s*l[0]),u=Math.round(s*l[1]));const{blendMode:d}=t;if(d==="normal"){const f={shader:this.shaders.opacity,uniforms:{config:{layerTexture:{texture:t.colorTexture,unit:0},opacity:t.config.opacity}},defines:null,optionalAttributes:null,useComputeBuffer:!1};return n.setPipelineState(V),void n.submitDrawMesh(r,f,n.quadMesh)}const p=this._createOrResizeTexture(e,c,u);h.copyToTexture(0,0,c,u,0,0,p);const m={color:{write:[!0,!0,!0,!0],blendMode:"custom",blendParameters:{srcRGB:1,dstRGB:0,srcAlpha:1,dstAlpha:0}},depth:!1,stencil:!1};n.setPipelineState(m);const _={backbufferTexture:{texture:p,unit:0},layerTexture:{texture:t.colorTexture,unit:1},inFadeOpacity:a?1:0,...t.config},g={shader:this.shaders.blend,uniforms:{config:_},defines:{blendMode:d},optionalAttributes:null,useComputeBuffer:!1};n.submitDrawMesh(r,g,n.quadMesh)}_createOrResizeTexture(e,t,r){const{context:i}=e;if(this._backBufferTexture!==null&&this._backBufferTexture.descriptor?.width===t&&this._backBufferTexture.descriptor?.height===r)return this._backBufferTexture;if(this._backBufferTexture===null){const s=new R(t,r);s.internalFormat=6408,s.wrapMode=33071,this._backBufferTexture=new U(i,s)}else this._backBufferTexture.resize(t,r);return this._backBufferTexture}},Ba=class{constructor(){this._blendTechnique=new Ia}dispose(e){this._blendTechnique?.shutdown()}draw(e,t,r,i,s){this._blendTechnique.render(e,{colorTexture:t,config:{opacity:s,samplingMode:r},blendMode:i})}},it=class{constructor(){this.name=this.constructor.name}createOptions(e,t){return null}},$t=class extends it{constructor(e){super(),this.name=this.constructor.name,this.defines=[e]}dispose(){}bind({context:e,painter:t}){this._prev=e.getBoundFramebufferObject();const r=t.getFbos().effect0;e.bindFramebuffer(r),e.setColorMask(!0,!0,!0,!0),e.setClearColor(0,0,0,0),e.clear(16384)}unbind(){}draw(e,t){const{context:r,painter:i}=e,s=i.getPostProcessingEffects(t),a=r.getBoundFramebufferObject();for(const{postProcessingTechnique:n,effect:l}of s)n.render(e,{layerFBO:a,effect:l});r.bindFramebuffer(this._prev),r.setStencilTestEnabled(!1),i.blitTexture(r,a.colorTexture,9728),r.setStencilTestEnabled(!0)}};class $a{constructor(){this._width=void 0,this._height=void 0,this._resources=null}dispose(){this._resources&&(this._resources.quadGeometry.dispose(),this._resources.quadVAO.dis
2pose(),this._resources.highlightProgram.dispose(),this._resources.blurProgram.dispose(),this._resources=null)}preBlur(e,t){e.bindTexture(t,pe),e.useProgram(this._resources.blurProgram),this._resources.blurProgram.setUniform4fv("u_direction",[1,0,1/this._width,0]),this._resources.blurProgram.setUniformMatrix4fv("u_channelSelector",Tr),e.bindVAO(this._resources.quadVAO),e.drawArrays(ge.TRIANGLE_STRIP,0,4),e.bindVAO(null)}finalBlur(e,t){e.bindTexture(t,pe),e.useProgram(this._resources.blurProgram),this._resources.blurProgram.setUniform4fv("u_direction",[0,1,0,1/this._height]),this._resources.blurProgram.setUniformMatrix4fv("u_channelSelector",Rr),e.bindVAO(this._resources.quadVAO),e.drawArrays(ge.TRIANGLE_STRIP,0,4),e.bindVAO(null)}renderHighlight(e,t,r){e.bindTexture(t,pe),e.useProgram(this._resources.highlightProgram),r.applyHighlightOptions(e,this._resources.highlightProgram),e.bindVAO(this._resources.quadVAO),e.setBlendingEnabled(!0),e.setBlendFunction(1,771),e.drawArrays(ge.TRIANGLE_STRIP,0,4),e.bindVAO(null)}_initialize(e,t,r){this._width=t,this._height=r;const i=new er(e,[new be("a_position",2,ye.BYTE,0,4),new be("a_texcoord",2,ye.BYTE,2,4)],new Int8Array([-1,-1,0,0,1,-1,1,0,-1,1,0,1,1,1,1,1]).buffer),s=new Zt(e,i),a=ze(e,Bi,s.locations),n=ze(e,$i,s.locations);e.useProgram(a),a.setUniform1i("u_texture",pe),a.setUniform1i("u_shade",xi),a.setUniform1f("u_sigma",ut),e.useProgram(n),n.setUniform1i("u_texture",pe),n.setUniform1f("u_sigma",ut),this._resources={quadGeometry:i,quadVAO:s,highlightProgram:a,blurProgram:n}}setup(e,t,r){this._resources?(this._width=t,this._height=r):this._initialize(e,t,r)}}function At(o,e,t){const r=new R(e,t);return r.wrapMode=33071,new G(o,r,new rt(36168,e,t))}let Aa=class{constructor(){this._width=void 0,this._height=void 0,this._resources=null}dispose(){this._resources&&(this._resources.sharedBlur1Fbo.dispose(),this._resources.sharedBlur2Fbo.dispose(),this._resources=null)}_initialize(e,t,r){this._width=t,this._height=r;const i=At(e,t,r),s=At(e,t,r);this._resources={sharedBlur1Fbo:i,sharedBlur2Fbo:s}}setup(e,t,r){!this._resources||this._width===t&&this._height===r||this.dispose(),this._resources||this._initialize(e,t,r)}get sharedBlur1Tex(){return this._resources.sharedBlur1Fbo.colorTexture}get sharedBlur1Fbo(){return this._resources.sharedBlur1Fbo}get sharedBlur2Tex(){return this._resources.sharedBlur2Fbo.colorTexture}get sharedBlur2Fbo(){return this._resources.sharedBlur2Fbo}};const ie=4,Pe=4/ie;let Ea=class extends it{constructor(){super(...arguments),this.defines=["highlight"],this._hlRenderer=new $a,this._width=void 0,this._height=void 0,this._boundFBO=null,this._hlSurfaces=new Aa,this._adjustedWidth=void 0,this._adjustedHeight=void 0,this._blitRenderer=new nr}dispose(){this._hlSurfaces?.dispose(),this._hlRenderer?.dispose(),this._boundFBO=null}bind(e){const{context:t,painter:r}=e,{width:i,height:s}=t.getViewport(),a=r.getFbos().effect0;this.setup(e,i,s),t.bindFramebuffer(a),t.setColorMask(!0,!0,!0,!0),t.setClearColor(0,0,0,0),t.clear(16384)}unbind(){}setup({context:e},t,r){this._width=t,this._height=r;const i=t%ie,s=r%ie;t+=i<ie/2?-i:ie-i,r+=s<ie/2?-s:ie-s,this._adjustedWidth=t,this._adjustedHeight=r,this._boundFBO=e.getBoundFramebufferObject();const a=Math.round(t*Pe),n=Math.round(r*Pe);this._hlRenderer.setup(e,a,n),this._hlSurfaces.setup(e,a,n)}draw(e){const{context:t,passOptions:r}=e,i=r.activeGradient,s=t.getBoundFramebufferObject();t.setViewport(0,0,this._adjustedWidth*Pe,this._adjustedHeight*Pe),t.bindFramebuffer(this._hlSurfaces.sharedBlur1Fbo),t.setStencilTestEnabled(!1),t.setClearColor(0,0,0,0),t.clear(16384),this._blitRenderer.render(t,s.colorTexture,9728,1),t.setStencilTestEnabled(!1),t.setBlendingEnabled(!1),t.setColorMask(!1,!1,!1,!0),t.bindFramebuffer(this._hlSurfaces.sharedBlur2Fbo),t.setClearColor(0,0,0,0),t.clear(16384),this._hlRenderer.preBlur(t,this._hlSurfaces.sharedBlur1Tex),t.bindFramebuffer(this._hlSurfaces.sharedBlur1Fbo),t.setClearColor(0,0,0,0),t.clear(16384),this._hlRenderer.finalBlur(t,this._hlSurfaces.sharedBlur2Tex),t.bindFramebuffer(this._boundFBO),t.setBlendingEnabled(!0),t.setColorMask(!0,!0,
2!0,!0),t.setViewport(0,0,this._width,this._height),this._hlRenderer.renderHighlight(t,this._hlSurfaces.sharedBlur1Tex,i),this._boundFBO=null}},Da=class extends it{constructor(){super(...arguments),this.name=this.constructor.name,this.defines=["hittest"]}dispose(){this._fbo!=null&&this._fbo.dispose()}createOptions({pixelRatio:e},t){if(!t.length)return null;const r=t.shift(),i=r.x,s=r.y;this._outstanding=r;const a=W("esri-mobile");return{type:"hittest",distance:(a?wt:vi)*e,smallSymbolDistance:(a?wt:Si)*e,smallSymbolSizeThreshold:Mi,position:[i,s]}}bind(e){const{context:t,attributeView:r}=e;if(!r.size)return;const i=r.getBlock(2);if(i==null)return;const s=i.getFBO(t);t.setViewport(0,0,r.size,r.size),t.bindFramebuffer(s),t.setColorMask(!0,!0,!0,!0),t.setClearColor(0,0,0,0),t.clear(16640)}unbind(){}draw(e){if(this._outstanding==null)return;const t=this._outstanding;this._outstanding=null,this._resolve(e,t.resolvers)}async _resolve(e,t){const{context:r,attributeView:i}=e,s=i.getBlock(2);if(s==null)return void t.forEach(h=>h.resolve([]));const a=s.getFBO(r),n=new Uint8Array(a.width*a.height*4);try{await a.readPixelsAsync(0,0,a.width,a.height,6408,tt.UNSIGNED_BYTE,n)}catch{return void t.forEach(c=>c.resolve([]))}const l=[];for(let h=0;h<n.length;h+=4){const c=h/4;n[h]&&l.push(c)}t.forEach(h=>h.resolve(l))}};const Et=5,La=[1,0],Va=[0,1],Ga=[1,.8,.6,.4,.2],qa=[1,1,1];class Na extends J{constructor(){super(...arguments),this.type=6,this._intensityFBO=null,this._compositeFBO=null,this._mipsFBOs=new Array(Et),this._nMips=Et,this._kernelSizeArray=[3,5,7,9,11],this._size=[0,0],this.shaders={luminosityPass:new Ei,gaussianBlur:new et,composite:new Ai,blit:new Ze}}shutdown(){if(super.shutdown(),this._intensityFBO=F(this._intensityFBO),this._compositeFBO=F(this._compositeFBO),this._mipsFBOs){for(let e=0;e<this._nMips;e++)this._mipsFBOs[e]&&(this._mipsFBOs[e].horizontal.dispose(),this._mipsFBOs[e].vertical.dispose());this._mipsFBOs=null}}render(e,t){const{layerFBO:r}=t,{width:i,height:s}=r,{strength:a,radius:n,threshold:l}=t.effect;this._createOrResizeResources(e,i,s),this._renderLuminosityHighPass(e,r,l),this._renderGaussianBlur(e,r),this._renderComposite(e,r,a,n),this._renderBlit(e,r)}_renderLuminosityHighPass(e,t,r){const{context:i,painter:s}=e,{width:a,height:n}=t,l={...V,color:{write:[!0,!0,!0,!0],blendMode:"custom",blendParameters:{srcRGB:1,dstRGB:771,srcAlpha:1,dstAlpha:771}},stencil:{write:{mask:0},test:!1}};s.setPipelineState(l),i.bindFramebuffer(this._intensityFBO);const h=[Math.round(a/2),Math.round(n/2)];
vendor: 11,116 bytes, line 2
2i.setViewport(0,0,h[0],h[1]),i.setClearColor(0,0,0,0),i.clear(16384),s.submitDrawMesh(i,{shader:this.shaders.luminosityPass,uniforms:{luminosityHighPassConfig:{luminosityTexture:{texture:t.colorTexture,unit:0},defaultColor:[0,0,0],defaultOpacity:0,luminosityThreshold:r,smoothWidth:.01}},defines:null,optionalAttributes:null,useComputeBuffer:!1},s.quadMesh)}_renderGaussianBlur(e,t){const{context:r,painter:i}=e,{width:s,height:a}=t,n={...V,color:{write:[!0,!0,!0,!0],blendMode:"none"}};i.setPipelineState(n);let l=this._intensityFBO.colorTexture;const h=[Math.round(s/2),Math.round(a/2)];for(let c=0;c<this._nMips;c++){r.setViewport(0,0,h[0],h[1]);const u=this._mipsFBOs[c];r.bindFramebuffer(u.horizontal),i.submitDrawMesh(r,{shader:this.shaders.gaussianBlur,uniforms:{gaussianBlurConfig:{texture:{texture:l,unit:c+1},texSize:h,direction:La,sigma:this._kernelSizeArray[c]}},defines:{kernelRadius:this._kernelSizeArray[c]},optionalAttributes:null,useComputeBuffer:!1},i.quadMesh),l=u.horizontal.colorTexture,r.bindFramebuffer(u.vertical),i.submitDrawMesh(r,{shader:this.shaders.gaussianBlur,uniforms:{gaussianBlurConfig:{texture:{texture:l,unit:c+1},texSize:h,direction:Va,sigma:this._kernelSizeArray[c]}},defines:{kernelRadius:this._kernelSizeArray[c]},optionalAttributes:null,useComputeBuffer:!1},i.quadMesh),l=u.vertical.colorTexture,h[0]=Math.round(h[0]/2),h[1]=Math.round(h[1]/2)}}_renderComposite(e,t,r,i){const{context:s,painter:a}=e,{width:n,height:l}=t;s.setViewport(0,0,n,l),s.bindFramebuffer(this._compositeFBO),a.submitDrawMesh(s,{shader:this.shaders.composite,uniforms:{compositeConfig:{blurTexture1:{texture:this._mipsFBOs[0].vertical.colorTexture,unit:1},blurTexture2:{texture:this._mipsFBOs[1].vertical.colorTexture,unit:2},blurTexture3:{texture:this._mipsFBOs[2].vertical.colorTexture,unit:3},blurTexture4:{texture:this._mipsFBOs[3].vertical.colorTexture,unit:4},blurTexture5:{texture:this._mipsFBOs[4].vertical.colorTexture,unit:5},bloomStrength:r,bloomRadius:i,bloomFactors:Ga,bloomTintColor:qa}},defines:{numMips:this._nMips},optionalAttributes:null,useComputeBuffer:!1},a.quadMesh)}_renderBlit(e,t){const{context:r,painter:i}=e;r.bindFramebuffer(t);const s={blitTexture:{texture:this._compositeFBO.colorTexture,unit:6}},a={...V,color:{write:[!0,!0,!0,!0],blendMode:"custom",blendParameters:{srcRGB:1,dstRGB:1,srcAlpha:1,dstAlpha:1}}};i.setPipelineState(a),i.submitDrawMesh(r,{shader:this.shaders.blit,uniforms:{blitConfig:s},defines:null,optionalAttributes:null,useComputeBuffer:!1},i.quadMesh)}_createOrResizeResources(e,t,r){const{context:i}=e;if(this._compositeFBO&&this._size[0]===t&&this._size[1]===r)return;this._size[0]=t,this._size[1]=r;const s=[Math.round(t/2),Math.round(r/2)];if(this._compositeFBO)this._compositeFBO.resize(t,r);else{const a=new R(t,r);a.internalFormat=6408,a.wrapMode=33071,this._compositeFBO=new G(i,a)}if(this._intensityFBO)this._intensityFBO.resize(s[0],s[1]);else{const a=new R(s[0],s[1]);a.internalFormat=6408,a.wrapMode=33071,this._intensityFBO=new G(i,a)}for(let a=0;a<this._nMips;a++){if(this._mipsFBOs[a])this._mipsFBOs[a].horizontal.resize(s[0],s[1]),this._mipsFBOs[a].vertical.resize(s[0],s[1]);else{const n=new R(s[0],s[1]);n.internalFormat=6408,n.wrapMode=33071,this._mipsFBOs[a]={horizontal:new G(i,n),vertical:new G(i,n)}}s[0]=Math.round(s[0]/2),s[1]=Math.round(s[1]/2)}}}const Ua=[1,0],Wa=[0,1];let Ha=class extends J{constructor(){super(...arguments),this.type=7,this._blurFBO=null,this._size=[0,0],this.shaders={gaussianBlur:new et,radialBlur:new Di,blit:new Ze}}shutdown(){super.shutdown(),this._blurFBO=F(this._blurFBO)}render(e,t){const{type:r,radius:i}=t.effect,{layerFBO:s}=t;i!==0&&(this._createOrResizeResources(e),r==="blur"?this._gaussianBlur(e,s,t.effect.radius):this._radialBlur(e,t.layerFBO))}_gaussianBlur(e,t,r){const{context:i,state:s,painter:a,pixelRatio:n}=e,{size:l}=s,h=[Math.round(n*l[0]),Math.round(n*l[1])],c=this._blurFBO,u={...V,color:{write:[!0,!0,!0,!0],blendMode:"none"}};a.setPipelineState(u),i.bindFramebuffer(c),a.submitDrawMesh(i,{shader:this.shaders.gaussianBlur,uniforms:{gaussianBlurConfig:{texture:{texture:t.colorTexture,unit:4},texSize:h,direction:Ua,sigma:r}},defines:{kernelRadius:Math.ceil(r)},optionalAttributes:null,useComputeBuffer:!1},a.quadMesh),i.bindFramebuffer(t);const d={color:{write:[!0,!0,!0,!0],blendMode:"none"},depth:{write:!1,test:!1},stencil:{write:{mask:0},test:!1}};a.setPipelineState(d),a.submitDrawMesh(i,{shader:this.shaders.gaussianBlur,uniforms:{gaussianBlurConfig:{texture:{texture:c?.colorTexture,unit:5},texSize:h,direction:Wa,sigma:r}},defines:{kernelRadius:Math.ceil(r)},optionalAttributes:null,useComputeBuffer:!1},a.quadMesh),a.setPipelineState({...V,stencil:{test:{mask:255,compare:514,op:{fail:7680,zFail:7680,zPass:7680}},write:!1},color:{write:[!0,!0,!0,!0],blendMode:"additive"}})}_radialBlur(e,t){const{context:r,painter:i}=e,s=this._blurFBO;r.bindFramebuffer(s);const a={...V,color:{write:[!0,!0,!0,!0],blendMode:"none"}};i.setPipelineState(a),i.submitDrawMeshUntyped(r,{shader:this.shaders.radialBlur,uniforms:{radialBlurConfig:{texture:{texture:t.colorTexture,unit:4}}},defines:null,optionalAttributes:null,useComputeBuffer:!1},i.quadMesh),r.bindFramebuffer(t),i.setPipelineState({...V,color:{write:[!0,!0,!0,!0],blendMode:"custom",blendParameters:{srcRGB:1,dstRGB:771,srcAlpha:1,dstAlpha:771}}}),i.submitDrawMeshUntyped(r,{shader:this.shaders.blit,uniforms:{blitConfig:{blitTexture:{texture:s?.colorTexture,unit:5}}},defines:null,optionalAttributes:null,useComputeBuffer:!1},i.quadMesh)}_createOrResizeResources(e){const{context:t,state:r,pixelRatio:i}=e,{size:s}=r,a=Math.round(i*s[0]),n=Math.round(i*s[1]);if(!this._blurFBO||this._size[0]!==a||this._size[1]!==n)if(this._size[0]=a,this._size[1]=n,this._blurFBO)this._blurFBO.resize(a,n);else{const l=new R(a,n);l.internalFormat=6408,l.wrapMode=33071,this._blurFBO=new G(t,l)}}};class ja extends J{constructor(){super(...arguments),this.type=9,this._layerFBOTexture=null,this._size=[0,0],this.shaders={filterEffect:new Li}}shutdown(){super.shutdown(),this._layerFBOTexture=F(this._layerFBOTexture)}render(e,t){const{width:r,height:i}=t.layerFBO;this._createOrResizeResources(e,r,i);const{context:s,painter:a}=e,n=t.effect.colorMatrix,l=this._layerFBOTexture;s.bindFramebuffer(t.layerFBO),t.layerFBO.copyToTexture(0,0,r,i,0,0,l);const h={color:{write:[!0,!0,!0,!0],blendMode:"none"},depth:!1,stencil:!1};a.setPipelineState(h);const c={colorTexture:{texture:l,unit:2},coefficients:n};a.submitDrawMesh(s,{shader:this.shaders.filterEffect,uniforms:{filterEffectConfig:c},defines:null,optionalAttributes:null,useComputeBuffer:!1},a.quadMesh),a.setPipelineState({...V,stencil:{test:{mask:255,compare:514,op:{fail:7680,zFail:7680,zPass:7680}},write:!1}})}_createOrResizeResources(e,t,r){const{context:i}=e;if(!this._layerFBOTexture||this._size[0]!==t||this._size[1]!==r)if(this._size[0]=t,this._size[1]=r,this._layerFBOTexture)this._layerFBOTexture.resize(t,r);else{const s=new R(t,r);s.internalFormat=6408,s.wrapMode=33071,this._layerFBOTexture=new U(i,s)}}}const Xa=[1,0],Ya=[0,1];let Ja=class extends J{constructor(){super(...arguments),this.type=13,this._layerFBOTexture=null,this._horizontalBlurFBO=null,this._verticalBlurFBO=null,this._size=[0,0],this.shaders={gaussianBlur:new et,composite:new Vi,blit:new Ze}}shutdown(){super.shutdown(),this._horizontalBlurFBO=F(this._horizontalBlurFBO),this._verticalBlurFBO=F(this._verticalBlurFBO),this._layerFBOTexture=F(this._layerFBOTexture)}render(e,t){const{context:r,state:i,painter:s}=e,{layerFBO:a}=t,n=a.width,l=a.height,h=[Math.round(n),Math.round(l)],{blurRadius:c,offsetX:u,offsetY:d,color:p}=t.effect,m=[se(u),se(d)];this._createOrResizeResources(e,n,l,h);const _=this._horizontalBlurFBO,g=this._verticalBlurFBO,f={color:{write:[!0,!0,!0,!0],blendMode:"none"},depth:{write:!1,test:!1},stencil:{write:{mask:0},test:!1}};s.setPipelineState(f);const y=this._layerFBOTexture;a.copyToTexture(0,0,n,l,0,0,y),r.setViewport(0,0,h[0],h[1]),r.bindFramebuffer(_),s.submitDrawMesh(r,{shader:this.shaders.gaussianBlur,uniforms:{gaussianBlurConfig:{texture:{texture:a.colorTexture,unit:4},texSize:h,direction:Xa,sigma:c}},defines:{kernelRadius:Math.ceil(c)},optionalAttributes:null,useComputeBuffer:!1},s.quadMesh),r.bindFramebuffer(g),s.submitDrawMesh(r,{shader:this.shaders.gaussianBlur,uniforms:{gaussianBlurConfig:{texture:{texture:_?.colorTexture,unit:5},texSize:h,direction:Ya,sigma:c}},defines:{kernelRadius:Math.ceil(c)},optionalAttributes:null,useComputeBuffer:!1},s.quadMesh),r.bindFramebuffer(a),r.setViewport(0,0,n,l),s.submitDrawMesh(r,{shader:this.shaders.composite,uniforms:{compositeConfig:{blurTexture:{texture:g?.colorTexture,unit:2},layerFBOTexture:{texture:y,unit:3},shadowColor:[p[3]*(p[0]/255),p[3]*(p[1]/255),p[3]*(p[2]/255),p[3]],displayViewMat3:i.displayMat3,shadowOffset:m}},defines:null,optionalAttributes:null,useComputeBuffer:!1},s.quadMesh),s.setPipelineState({...V,stencil:{test:{mask:255,compare:514,op:{fail:7680,zFail:7680,zPass:7680}},write:!1}})}_createOrResizeResources(e,t,r,i){const{context:s}=e;if(!this._horizontalBlurFBO||this._size[0]!==t||this._size[1]!==r){if(this._size[0]=t,this._size[1]=r,this._horizontalBlurFBO)this._horizontalBlurFBO.resize(i[0],i[1]);else{const a=new R(i[0],i[1]);a.internalFormat=6408,a.wrapMode=33071,this._horizontalBlurFBO=new G(s,a)}if(this._verticalBlurFBO)this._verticalBlurFBO.resize(i[0],i[1]);else{const a=new R(i[0],i[1]);a.internalFormat=6408,a.wrapMode=33071,this._verticalBlurFBO=new G(s,a)}if(this._layerFBOTexture)this._layerFBOTexture.resize(t,r);else{const a=new R(t,r);a.internalFormat=6408,a.wrapMode=33071,this._layerFBOTexture=new U(s,a)}}}};class Qa extends J{constructor(){super(...arguments),this.type=24,this._layerFBOTexture=null,this._size=[0,0],this.shaders={opacity:new Jt}}shutdown(){super.shutdown(),this._layerFBOTexture=F(this._layerFBOTexture)}render(e,t){const{layerFBO:r}=t,{width:i,height:s}=r;this._createOrResizeResources(e,i,s);const{context:a,painter:n}=e,{amount:l}=t.effect,h=this._layerFBOTexture;a.bindFramebuffer(r),t.layerFBO.copyToTexture(0,0,i,s,0,0,h);const c={color:{write:[!0,!0,!0,!0],blendMode:"custom",blendParameters:{srcRGB:1,dstRGB:771,srcAlpha:1,dstAlpha:771}},depth:!1,stencil:!1},u={layerTexture:{texture:h,unit:0},opacity:l};h.setSamplingMode(9728),a.setClearColor(0,0,0,0),a.clear(16384),n.setPipelineState(c),n.submitDrawMesh(a,{shader:this.shaders.opacity,uniforms:{config:u},defines:null,optionalAttributes:null,useComputeBuffer:!1},n.quadMesh)}_createOrResizeResources(e,t,r){const{context:i}=e;if(!this._layerFBOTexture||this._size[0]!==t||this._size[1]!==r)if(this._size[0]=t,this._size[1]=r,this._layerFBOTexture)this._layerFBOTexture.resize(t,r);else{const s=new R(t,r);s.internalFormat=6408,s.wrapMode=33071,s.samplingMode=9728,this._layerFBOTexture=new U(i,s)}}}function Ka(o){switch(o){case"bloom":case"blur":case"opacity":case"drop-shadow":return o;default:return"colorize"}}const Za={colorize:()=>new ja,blur:()=>new Ha,bloom:()=>new Na,opacity:()=>new Qa,"drop-shadow":()=>new Ja};let en=class{constructor(){this._effectMap=new Map}
2dispose(){this._effectMap.forEach(e=>e.shutdown()),this._effectMap.clear()}getPostProcessingEffects(e){if(!e||e.length===0)return[];const t=[];for(const r of e){const i=Ka(r.type);let s=this._effectMap.get(i);s||(s=Za[i](),this._effectMap.set(i,s)),t.push({postProcessingTechnique:s,effect:r})}return t}},tn=class{constructor(e,t){this.brushes=e,this.name=t.name,this.drawPhase=t.drawPhase||1,this._targetFn=t.target,this.effects=t.effects||[],this.enableDefaultDraw=t.enableDefaultDraw??(()=>!0),this.forceDrawByDisplayOrder=!!t.forceDrawByDisplayOrder}render(e){const{context:t,profiler:r}=e,i=this._targetFn(),s=this.drawPhase&e.drawPhase;if(r.recordPassStart(this.name),s){this.enableDefaultDraw()&&this._doRender(e,i),r.recordPassEnd();for(const a of this.effects){if(!a.enable())continue;const n=a.apply,l=a.args?.(),h=t.getViewport(),c=t.getBoundFramebufferObject(),u=e.passOptions;this._bindEffect(e,n,l),this._doRender(e,i,n.defines),this._drawAndUnbindEffect(e,n,h,c,u,l)}}}_doRender(e,t,r){if(t==null)return;const{profiler:i,context:s}=e;for(const a of this.brushes){if(i.recordBrushStart(a.name),a.brushEffect!=null){const n=s.getViewport(),l=s.getBoundFramebufferObject(),h=e.passOptions;this._bindEffect(e,a.brushEffect),this._drawWithBrush(a,e,t,r),this._drawAndUnbindEffect(e,a.brushEffect,n,l,h)}else this._drawWithBrush(a,e,t,r);i.recordBrushEnd()}}_drawWithBrush(e,t,r,i){wr(r)?(e.prepareState(t,i),e.drawMany(t,r,i)):r.visible&&(e.prepareState(t,i),e.draw(t,r,i))}_bindEffect(e,t,r){const{profiler:i}=e;i.recordPassStart(this.name+"."+t.name),t.bind(e,r);const s=t.createOptions(e,r);e.passOptions=s}_drawAndUnbindEffect(e,t,r,i,s,a){const{profiler:n,context:l}=e;e.passOptions=s,n.recordBrushStart(t.name),t.draw(e,a),t.unbind(e,a),l.bindFramebuffer(i);const{x:h,y:c,width:u,height:d}=r;l.setViewport(h,c,u,d),n.recordBrushEnd(),n.recordPassEnd()}};class rn{constructor(e,t){this.context=e,this._blitRenderer=new nr,this._worldExtentRenderer=new Fa,this._brushCache=new Map,this._lastWidth=null,this._lastHeight=null,this._blendEffect=new Ba,this._stencilBuf=null,this._prevBeforeLayerFBOStack=[],this._fboPool=[],this.effects={highlight:new Ea,hittest:new Da,insideEffect:new $t("inside"),outsideEffect:new $t("outside")},this.materialManager=new Ks(e),this.textureManager=new va(t),this.textureUploadManager=new Ta(t),this._effectsManager=new en,this._quadMesh=Pi.fromVertexStream(e,[0,0,1,0,0,1,1,1]),this._renderingDevice=new Zs}dispose(){if(this.materialManager.dispose(),this.textureManager.dispose(),this.textureUploadManager.destroy(),this._blitRenderer=F(this._blitRenderer),this._worldExtentRenderer=F(this._worldExtentRenderer),this._quadMesh=Re(this._quadMesh),this._brushCache&&(this._brushCache.forEach(e=>e.dispose()),this._brushCache.clear(),this._brushCache=null),this._fbos){let e;for(e in this._fbos)this._fbos[e]&&this._fbos[e].dispose()}for(const e of this._fboPool)e.dispose();if(this._fboPool.length=0,this.effects){let e;for(e in this.effects)this.effects[e]&&this.effects[e].dispose()}this._effectsManager.dispose(),this._blendEffect.dispose(this.context),this._renderingDevice.dispose()}get blitRenderer(){return this._blitRenderer}get quadMesh(){return this._quadMesh}getFbos(){if(!this._fbos)throw new Error("InternalError: Painter FBOs not initialized");return this._fbos}acquireFbo(e,t){let r;if(this._fboPool.length>0)r=this._fboPool.pop();else{const i=new R(e,t);i.samplingMode=9728,i.wrapMode=33071,r=new G(this.context,i,this._stencilBuf)}return r.width===e&&r.height===t||r.resize(e,t),r}releaseFbo(e){this._fboPool.push(e)}getSharedStencilBuffer(){return this._stencilBuf}beforeRenderPhases(e,t,r){const{context:i}=e;this._worldExtentRenderer.render(e,t,r);const{width:s,height:a}=i.getViewport();if(this.updateFBOs(s,a),this._prevFBO=i.getBoundFramebufferObject(),i.bindFramebuffer(this.getFbos().output),i.setColorMask(!0,!0,!0,!0),t!=null){const{r:n,g:l,b:h,a:c}=t;i.setClearColor(c*n/255,c*l/255,c*h/255,c)}else i.setClearColor(0,0,0,0);i.setDepthWriteEnabled(!0),i.setClearDepth(1),i.clear(16640),i.setDepthWriteEnabled(!1)}afterRenderPhases(e){const{context:t}=e;t.bindFramebuffer(this._prevFBO),t.setStencilFunction(514,Xe,255),t.setStencilTestEnabled(!0),t.setDepthTestEnabled(!1),this.blitTexture(t,this.getFbos().output.colorTexture,9728)}beforeRenderLayer(e,t,r){const{context:i,blendMode:s,effects:a,drawPhase:n,requireFBO:l}=e;if(i.setClearColor(0,0,0,0),l||Dt(n,s,a,r)){const h=i.getBoundFramebufferObject();this._prevBeforeLayerFBOStack.push(h);const{width:c,height:u}=i.getViewport(),d=this.acquireFbo(c,u);
2i.bindFramebuffer(d),i.setColorMask(!0,!0,!0,!0),i.setClearColor(0,0,0,0),i.setDepthWriteEnabled(!0),i.setClearDepth(1),i.clear(16640),i.setDepthWriteEnabled(!1)}i.setDepthWriteEnabled(!1),i.setDepthTestEnabled(!1),i.setStencilTestEnabled(!0),i.setClearStencil(t),i.setStencilWriteMask(255),i.clear(1024)}afterRenderLayer(e,t){const{context:r,blendMode:i,effects:s,requireFBO:a,drawPhase:n}=e;if(a||Dt(n,i,s,t)){const l=r.getBoundFramebufferObject();s!=null&&s.length>0&&n===1&&(r.setColorMask(!0,!0,!0,!0),this._applyEffects(e,s,l)),r.bindFramebuffer(this._prevBeforeLayerFBOStack.pop()),r.setStencilTestEnabled(!1),r.setStencilWriteMask(0),r.setBlendingEnabled(!0),r.setBlendFunctionSeparate(1,771,1,771),r.setColorMask(!0,!0,!0,!0);const h=i==null||n===16||n===2||n===128?"normal":i;this._blendEffect.draw(e,l.colorTexture,9728,h,t),this.releaseFbo(l)}}renderObject(e,t,r,i){const s=Ot[r];if(!s)return;let a=this._brushCache.get(s);a===void 0&&(a=new s,this._brushCache.set(s,a)),a.prepareState(e),a.draw(e,t)}renderObjects(e,t,r,i){const s=Ot[r];if(!s)return;let a=this._brushCache.get(s);a===void 0&&(a=new s,this._brushCache.set(s,a)),a.drawMany(e,t,i)}registerRenderPass(e){const t=e.brushes.map(r=>(this._brushCache.has(r)||this._brushCache.set(r,new r),this._brushCache.get(r)));return new tn(t,e)}blitTexture(e,t,r,i=1){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(1,771,1,771),e.setColorMask(!0,!0,!0,!0),this._blitRenderer.render(e,t,r,i),this._renderingDevice.setPipelineStateNeedsUpdate(!0)}getPostProcessingEffects(e){return this._effectsManager.getPostProcessingEffects(e)}updateFBOs(e,t){if(e!==this._lastWidth||t!==this._lastHeight){if(this._lastWidth=e,this._lastHeight=t,this._fbos){let s;for(s in this._fbos)this._fbos[s].resize(e,t);return}const r=new R(e,t);r.samplingMode=9728,r.wrapMode=33071;const i=new rt(Qt.DEPTH24_STENCIL8,e,t);this._stencilBuf=new ls(this.context,i),this._fbos={output:new G(this.context,r,this._stencilBuf),effect0:new G(this.context,r,this._stencilBuf)}}}_applyEffects(e,t,r){const{context:i}=e,s=this._effectsManager.getPostProcessingEffects(t);for(const{postProcessingTechnique:a,effect:n}of s)i.bindFramebuffer(r),a.render(e,{layerFBO:r,effect:n});this._renderingDevice.setPipelineStateNeedsUpdate(!0)}setShader(e){return this._renderingDevice.setShader(e)}clearShaderCache(){this._renderingDevice.clearShaderCache()}setPipelineState(e){return this._renderingDevice.setPipelineState(e)}getPipelineState(){return this._renderingDevice.getPipelineState()}submitDraw(e,t,r){return this._renderingDevice.submitDraw(e,t,r)}submitDrawMesh(e,t,r,i){this._renderingDevice.submitDrawMesh(e,t,r,i)}submitDrawMeshUntyped(e,t,r,i){this._renderingDevice.submitDrawMeshUntyped(e,t,r,i)}updatePipelineState(e){return this._renderingDevice.updatePipelineState(e)}setStencilRef(e,t){return this._renderingDevice.setStencilRef(e,t)}}function Dt(o,e,t,r){return o!==4&&o!==2&&o!==16&&o!==128&&(r!==1||e!=null&&e!=="normal"||t!=null&&t.length>0)}let sn=class{constructor(){this._candidateTiles=[]}schedule(e){this._candidateTiles.includes(e)||this._candidateTiles.push(e)}reshuffle(e){const t=[];for(const r of this._candidateTiles)e>0?(r.reshuffle(),e--):t.push(r);this._candidateTiles=t}};const an=2e3;class ur extends Oi{constructor(e,t,r){super(),this.meshWriterRegistry=new hs,this._trash=new Set,this._renderRemainingTime=0,this._lastFrameRenderTime=0,this._renderRequested=zr(!1),this.stage=this,this._stationary=!0,this._animationsEnabled=!0,this._reshuffleManager=new sn,this._managedCanvas=r,this.context=new Qi(this._managedCanvas.gl,t.contextOptions??new Fr),this.painter=new rn(this.context,this),this._cimAnalyzer=new Hs(this.painter.textureManager.resourceManager),W("esri-2d-profiler")&&e!=null&&(this._debugOutput=document.createElement("div"),this._debugOutput.setAttribute("style","margin: 24px 64px; position: absolute; color: red;"),e.appendChild(this._debugOutput));const i=()=>this.highlightGradient;this._renderParameters={drawPhase:0,state:this.state,pixelRatio:window.devicePixelRatio,stationary:!1,globalOpacity:1,blendMode:null,deltaTime:-1,time:0,inFa
2deTransition:!1,effects:null,context:this.context,painter:this.painter,timeline:t.timeline||new Ir,renderingOptions:t.renderingOptions,requestRender:()=>this.requestRender(),allowDelayedRender:!1,requireFBO:!1,profiler:new Gi(this.context,this._debugOutput),dataUploadCounter:0,get highlightGradient(){return i()},reshuffleManager:this._reshuffleManager,backgroundColor:t.backgroundColor,animationsEnabled:!0};let s=a=>this.renderFrame(a);t.renderFrame!=null&&(s=t.renderFrame),this._taskHandle=xr({render:a=>s(a)}),this._taskHandle.pause(),this._lostWebGLContextHandle=this._managedCanvas.events.on("webgl-context-lost",a=>this.emit("webgl-error",{error:new xe("webgl-context-lost",a.statusMessage)})),this._bufferPool=new ji,Wr()}destroy(){super.destroy(),Hr(this.context),this.removeAllChildren(),this._emptyTrash(),this._taskHandle=nt(this._taskHandle),this._lostWebGLContextHandle=nt(this._lostWebGLContextHandle),this._managedCanvas.destroy(),this._debugOutput?.parentNode?.removeChild(this._debugOutput),this._bufferPool.destroy(),this.painter.dispose(),this.context.dispose(),this._managedCanvas=null}get textureManager(){return this.painter.textureManager}get profiler(){return this._renderParameters.profiler}get backgroundColor(){return this._renderParameters.backgroundColor}set backgroundColor(e){this._renderParameters.backgroundColor=e,this.requestRender()}get canvas(){return this._managedCanvas.canvas}get bufferPool(){return this._bufferPool}get cimAnalyzer(){return this._cimAnalyzer}get effectiveVisible(){return this.visible}get renderingOptions(){return this._renderingOptions}set renderingOptions(e){this._renderingOptions=e,this.requestRender()}get renderRequested(){return this._renderRequested.value}get state(){return this._state}set state(e){this._state=e,this.requestRender()}get stationary(){return this._stationary}set stationary(e){this._stationary!==e&&(this._stationary=e,this.requestRender())}get animationsEnabled(){return this._animationsEnabled}set animationsEnabled(e){this._animationsEnabled!==e&&(this._animationsEnabled=e,this._animationsEnabled&&this.requestRender())}trashDisplayObject(e){this._trash.add(e),this.requestRender()}untrashDisplayObject(e){return this._trash.delete(e)}requestRender(){this._renderRemainingTime=an,this.renderRequested||(this._renderRequested.value=!0,this._taskHandle.resume())}renderFrame(e){const t=this._lastFrameRenderTime?e.time-this._lastFrameRenderTime:0;this._renderRemainingTime-=t,this._renderRemainingTime<=0&&this._taskHandle.pause(),this._lastFrameRenderTime=e.time,this._renderRequested.value=!1,this._renderParameters.state=this._state,this._renderParameters.stationary=this.stationary,this._renderParameters.pixelRatio=window.devicePixelRatio,this._renderParameters.globalOpacity=1,this._renderParameters.time=e.time,this._renderParameters.deltaTime=e.deltaTime,this._renderParameters.effects=null,this._renderParameters.animationsEnabled=this._animationsEnabled,this.processRender(this._renderParameters),this._emptyTrash()}_createTransforms(){return{displayViewScreenMat3:Fe()}}renderChildren(e){this._reshuffleManager.reshuffle(Ci),this._managedCanvas.render(e,()=>this._renderChildren(this.children,e))}_renderChildren(e,t){for(const i of e)i.beforeRender(t);const r=this.context;this.painter.textureUploadManager.upload(),r.resetInfo(),t.profiler.recordStart("drawLayers"),t.dataUploadCounter=0,this.painter.beforeRenderPhases(t,t.backgroundColor,this.state.padding),t.drawPhase=1;for(const i of e)i.processRender(t);if(this.children.some(i=>i.hasHighlight)){t.drawPhase=16;for(const i of e)i.processRender(t)}if(this.children.some(i=>i.hasLabels)){t.drawPhase=2;for(const i of e)i.processRender(t)}if(W("esri-tiles-debug")){t.drawPhase=64;for(const i of e)i.processRender(t)}t.drawPhase=128;for(const i of e)i.processRender(t);this.painter.afterRenderPhases(t),t.profiler.recordEnd("drawLayers"),r.logInfo();for(const i of e)i.afterRender(t)}doRender(e){const t=this.context,{state:r,pixelRatio:i}=e;this._managedCanvas.resize(e),t.setViewport(0,0,i*r.size[0],i*r.size[1]),t.setDepthWriteEnabled(!0),t.setStencilWriteMask(255),this.renderChildren(e)}
2async takeScreenshot(e,t,r,i){const s=Math.round(this.state.size[0]*e.resolutionScale),a=Math.round(this.state.size[1]*e.resolutionScale),n=e.resolutionScale,l=this.context,h=this._state.clone();if(i!=null){const y=h.viewpoint;h.viewpoint.rotation=i,h.viewpoint=y}const c={...this._renderParameters,drawPhase:null,globalOpacity:1,stationary:!0,state:h,pixelRatio:n,time:performance.now(),deltaTime:0,blendMode:null,effects:null,inFadeTransition:!1,backgroundColor:r},u=new R(s,a);u.wrapMode=33071,u.internalFormat=Kt.RGBA8,u.isImmutable=!0;const d=new G(l,u,new rt(Qt.DEPTH24_STENCIL8,s,a)),p=l.getBoundFramebufferObject(),m=l.getViewport();l.bindFramebuffer(d),l.setViewport(0,0,s,a),this._renderChildren(t??this.children,c);const _=this._readbackScreenshot(d,{...e.cropArea,y:a-(e.cropArea.y+e.cropArea.height)});l.bindFramebuffer(p),l.setViewport(m.x,m.y,m.width,m.height),this.requestRender();const g=await _;let f;return e.outputScale===1?f=g:(f=new ImageData(Math.round(g.width*e.outputScale),Math.round(g.height*e.outputScale)),(await we(async()=>{const{resampleHermite:y}=await import("./nrASHU5P.js").then(x=>x.a6);return{resampleHermite:y}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77]),import.meta.url)).resampleHermite(g,f,!0)),d.dispose(),f}async _readbackScreenshot(e,t){const r=(await we(async()=>{const{createEmptyImageData:i}=await import("./nrASHU5P.js").then(s=>s.a6);return{createEmptyImageData:i}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77]),import.meta.url)).createEmptyImageData(t.width,t.height,document.createElement("canvas"));return await e.readPixelsAsync(t.x,t.y,t.width,t.height,6408,tt.UNSIGNED_BYTE,new Uint8Array(r.data.buffer)),r}_emptyTrash(){for(;this._trash.size>0;){const e=Array.from(this._trash);this._trash.clear();for(const t of e)t.processDetach()}}}class nn extends J{constructor(){super(...arguments),this.type=34,this._mesh=null,this.shaders={geometry:new qi}}render(e,t){const{context:r,painter:i}=e,{texture:s,textureCoords:a}=t,n=this._getMesh(e),l=t.ndcRect[2],h=t.ndcRect[3],c=t.ndcRect[0],u=t.ndcRect[1],d=new Float32Array(180);for(let _=0;_<6;_++){const g=h*_/5;for(let f=0;f<6;f++){const y=l*f/5,{u:x,v:w}=a[6*_+f];d[5*(6*_+f)]=c+y,d[5*(6*_+f)+1]=u-g,d[5*(6*_+f)+2]=x,d[5*(6*_+f)+3]=w,d[5*(6*_+f)+4]=1}}n.vertexBuffers.get("geometry")?.setData(d);const p={texture:{texture:s,unit:0},opacity:t.opacity},m={shader:this.shaders.geometry,uniforms:{config:p},defines:{},optionalAttributes:null,useComputeBuffer:!1};i.setPipelineState(V),i.submitDrawMeshUntyped(r,m,n)}shutdown(){Re(this._mesh)}_getMesh(e){const{context:t}=e,r=new Uint32Array(150);for(let i=0;i<5;i++)for(let s=0;s<5;s++){const a=6*(5*i+s),n=6*(i+1)+s+1,l=n-1,h=n-6,c=n-7;r[a]=n,r[a+1]=l,r[a+2]=h,r[a+3]=l,r[a+4]=c,r[a+5]=h}return this._mesh||(this._mesh=new ki(t,{vertex:{geometry:{data:new Float32Array(180),layout:[new be("position",2,ye.FLOAT,0,20),new be("texcoord",2,ye.FLOAT,8,20),new be("w",1,ye.FLOAT,16,20)]}},index:{index:{data:r}},groups:[{primitive:ge.TRIANGLES,index:"index"}],parts:[{group:0,start:0,count:r.length}]})),this._mesh}}class on extends Ke{constructor(e,t){super(),this._controlPointsOwner=t,this.readbackScreenCoords=Xi(),this.videoTextureCoords=new Array(36),this.overlayTextureCoords=new Array(36),this._prevFBO=null,this._acquiredFBO=null,this._isBound=!1,this._hasCoordinates=!1,this._geIsLoaded=!1,this._ndcRect=[0,0,2,2],this._technique=new nn,this.visible=!1,this.stage=e;for(let r=0;r<6;r++){const i=r/5;for(let s=0;s<6;s++){const a=s/5;this.videoTextureCoords[6*r+s]={u:a,v:i}}}}getMesh(e){throw new Error("Method not implemented.")}destroy(){super.destroy(),F(this._readbackTexture)}bind(e){const{context:t,pixelRatio:r,state:i}=e;if(this._update(e),!this.ready||this.readbackScreenCoords[2]===0||this.readbackScreenCoords[3]===0)return this.requestRender(),!1;const{size:s}=i,a=Math.round(r*s[0]),n=Math.round(r*s[1]),l=new R(a,n);return l.samplingMode=9729,l.wrapMode=33071,this._acquiredFBO||(this._acquiredFBO=new G(t,l)),this._acquiredFBO.resize(a,n),t.bindFramebuffer(this._acquiredFBO),this._isBound=!0,!0}unbind(e){if(!this._isBound)return;const{context:t,pixelRatio:r,state:i}=e,{size:s}=i,a=this._acquiredFBO;if(!a.getColorTexture(Wi))throw new Error("Failed to get color texture from FBO.");const n=this._getReadbackTexture(e),l=this.readbackScreenCoords,h=Math.round(r*l[0]),c=Math.round(r*(s[1]-l[1]))-n.descriptor.height,u=h+n.descriptor.width,d=c+n.descriptor.height,p=Math.max(h,0),m=Math.max(c,0),_=Math.min(u,a.width)-p,g=Math.min(d,a.height)-m;_>0&&g>0&&a.copyToTexture(p,m,_,g,p-h,m-c,n),t.bindFramebuffer(this._prevFBO)}_update(e){const{state:t}=e,r=this._controlPointsOwner,i=r.groundControlPoints(),s=r.getSize(),a=t.size,n=i?.length;if(!n)return;if(cs().then(()=>{this._geIsLoaded=!0}),!this._geIsLoaded)return void this.requestRender();const l=s[0],h=s[1],c=a[0],u=h/a[1],d=l/c;if(u>d){const b=d/u*2,S=(2-b)/2;this._ndcRect[0]=-1+S,this._ndcRect[1]=1,this._ndcRect[2]=b,this._ndcRect[3]=2}else{const b=u/d*2,S=(2-b)/2;this._ndcRect[0]=-1,this._ndcRect[1]=1-S,this._ndcRect[2]=2,this._ndcRect[3]=b}const p=new Array(n),m=t.spatialReference;for(let b=0;b<n;b++){const{lat:S,lon:C}=i[b],k=new Mr(C,S);p[b]=us(k,m)}const _=[];let g=1/0,f=1/0,y=-1/0,x=-1/0;for(const b of p){const S=tr();t.toScreen(S,b.x,b.y),_.push({x:S[0],y:S[1]}),g=Math.min(g,S[0]),f=Math.min(f,S[1]),y=Math.max(y,S[0]),x=Math.max(x,S[1])}const w=[g,x],M=[y,f];this.readbackScreenCoords[0]=Math.max(Math.floor(w[0]),0),this.readbackScreenCoords[1]=Math.max(Math.floor(M[1]),0),this.readbackScreenCoords[2]=Math.ceil(M[0]),this.readbackScreenCoords[3]=Math.ceil(w[1]);for(let b=0;b<_.length;b++){const S=_[b],C=(S.x-g)/(y-g),k=(x-S.y)/(x-f);this.overlayTextureCoords[b]={u:C,v:k}}this._hasCoordinates=!0}_createTransforms(){return null}doRender(e){this._readbackTexture&&this._hasCoordinates?this._technique.render(e,{texture:this._readbackTexture,textureCoords:this.overlayTextureCoords,op
2acity:1,ndcRect:this._ndcRect}):this.requestRender()}_getReadbackTexture(e){const{context:t,pixelRatio:r}=e,i=Math.round(r*Math.abs(this.readbackScreenCoords[2]-this.readbackScreenCoords[0])),s=Math.round(r*Math.abs(this.readbackScreenCoords[3]-this.readbackScreenCoords[1]));if(this._readbackTexture)this._readbackTexture.resize(i,s);else{const a=new R(i,s);a.wrapMode=33071,a.internalFormat=Kt.RGBA8,this._readbackTexture=new U(t,a)}return this._readbackTexture}}let ln=class extends ur{constructor(e,t,r){super(null,t={...t,renderFrame:i=>{}},new Br(null,{canvas:e})),this._requestRender=r,this.viewIsReady=!1,this.videoScreenRenderer=new on(this,t),this.videoScreenRenderer.visible=!0}requestRender(){this._requestRender()}processRender(e){this.videoScreenRenderer.bind(e),e.backgroundColor=Ur.fromArray([0,0,0,0]),super.processRender(e),this.videoScreenRenderer.unbind(e)}};class Yh extends ur{constructor(e,t,r){super(e,t={...t,renderFrame:i=>{this.render(i)}},r),this._childStage=new ln(r.canvas,t,()=>this.requestRender())}get childStage(){return this._childStage}render(e){this._childStage.viewIsReady?(this._childStage.context.enforceState(),this._childStage.renderFrame(e)):this.requestRender(),this.context.enforceState(),super.renderFrame(e)}processRender(e){super.processRender(e),this._childStage.viewIsReady&&this._childStage.visible&&this._childStage.videoScreenRenderer.processRender(e)}}class hn extends J{constructor(){super(...arguments),this.type=21,this._resourcePixelRatio=1,this._position=[0,0,0,0],this.shaders={magnifier:new Ni}}updateResources(e,t,r,i){e.pixelRatio!==this._resourcePixelRatio&&this._destroyResources(),this._readbackTexture||this._initializeResources(e,t,r,i);const{context:s,pixelRatio:a}=e,{factor:n,offset:l,position:h}=i,{size:c}=e.state,u=i.size*a,d=1/n,p=Math.ceil(d*u);this._readbackTexture.resize(p,p);const m=a*c[0],_=a*c[1],g=.5*p,f=.5*p,y=ot(a*h.x,g,m-g-1),x=ot(_-a*h.y,f,_-f-1),w=y-g,M=x-f,b=this._readbackTexture;s.bindTexture(b,0),s.gl.copyTexImage2D(b.descriptor.target,0,b.descriptor.pixelFormat,w,M,p,p,0);const S=(y+l.x*a)/m*2-1,C=(x-l.y*a)/_*2-1,k=u/m*2,z=u/_*2;this._position[0]=S,this._position[1]=C,this._position[2]=k,this._position[3]=z}render(e,t){const{context:r,painter:i}=e;i.setPipelineState(V);const s={readbackTexture:{texture:this._readbackTexture,unit:0},maskTexture:{texture:this._maskTexture,unit:7},overlayTexture:{texture:this._overlayTexture,unit:6},drawPos:this._position,...t};i.submitDrawMesh(r,{shader:this.shaders.magnifier,uniforms:{config:s},defines:null,optionalAttributes:null,useComputeBuffer:!1},i.quadMesh)}shutdown(){this._destroyResources()}_initializeResources(e,t,r,i){const s=e.context;this._resourcePixelRatio=e.pixelRatio;const a=Math.ceil(i.size*e.pixelRatio);r.width=a,r.height=a;const n=new R(Math.ceil(a/i.factor));n.internalFormat=6408,n.wrapMode=33071,n.samplingMode=9728,n.flipped=!0,n.preMultiplyAlpha=!Sr(r.src)||!e.context.driverTest.svgPremultipliesAlpha.result,this._overlayTexture=new U(s,n,r),t.width=a,t.height=a,n.pixelFormat=n.internalFormat=6406,this._maskTexture=new U(s,n,t),n.pixelFormat=n.internalFormat=6408,n.samplingMode=9729,n.flipped=!1,this._readbackTexture=new U(s,n)}_destroyResources(){F(this._maskTexture),F(this._overlayTexture),F(this._readbackTexture),this._maskTexture=null,this._overlayTexture=null,this._readbackTexture=null}}async function cn(o){const e=we(()=>import("./BZIDpTf0.js"),[],import.meta.url),t=we(()=>import("./DKwEt0oU.js"),[],import.meta.url),r=St((await e).default,{signal:o}),i=St((await t).default,{signal:o}),s={mask:await r,overlay:await i};return Qe(o),s}class Jh extends Ke{constructor(){super(),this._handles=new Ut,this._magnifierTechnique=new hn,this.updatingHandles=new ps,this.visible=!1}destroy(){super.destroy(),this._handles=Re(this._handles),this._magnifierTechnique.shutdown(),this._resourcesTask=vr(this._resourcesTask)}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){this._backgroundColor=e,this.requestRender()}get magnifier(){return this._magnifier}set magnifier(e){this._magnifier=e,this._handles.removeAll(),this._handles.add([_e(()=>e.version,()=>{this.visible=e.visible&&e.position!=null&&e.size>0,this.requestRender()},We),_e(()=>[e.maskUrl,e.overlayUrl],()=>this._reloadResources()),_e(()=>e.size,()=>{this._magnifierTechnique.shutdown(),this.requestRender()})])}_createTransforms(){return{displayViewScreenMat3:Fe()}}doRender(e){if(!this._resourcesTask)return void this._reloadResources();if(e.drawPhase!==1||!this._canRender())return;const t=this._magnifier;if(t.position==null)return;this._magnifierTechnique.updateResources(e,this._mask,this._overlay,t);const r=this.backgroundColor,i=r?[r.a*r.r/255,r.a*r.g/255,r.a*r.b/255,r.a]:[1,1,1,1];this._magnifierTechnique.render(e,{background:i,maskEnabled:t.maskEnabled?1:0,overlayEnabled:t.overlayEnabled?1:0})}_canRender(){return this._mask&&this._overlay&&this._magnifier!=null}_reloadResources(){this._resourcesTask&&this._resourcesTask.abort();const e=this._magnifier!=null?this._magnifier.maskUrl:null,t=this._magnifier!=null?this._magnifier.overlayUrl:null;this._resourcesTask=ds(async r=>{const i=e==null||t==null?cn(r):null,s=e!=null?he(e,{responseType:"image",signal:r}).then(h=>
2h.data):i.then(h=>h.mask),a=t!=null?he(t,{responseType:"image",signal:r}).then(h=>h.data):i.then(h=>h.overlay),[n,l]=await Promise.all([s,a]);this._mask=n,this._overlay=l,this._magnifierTechnique.shutdown(),this.requestRender()}),this.updatingHandles.addPromise(this._resourcesTask.promise)}}class un extends J{constructor(){super(...arguments),this.type=17,this.shaders={grid:new Ui}}render(e,t){const{context:r,painter:i}=e;i.setPipelineState(V),i.submitDrawMesh(r,{shader:this.shaders.grid,uniforms:t,defines:null,optionalAttributes:null,useComputeBuffer:!1},i.quadMesh)}}const Ue=tr();class Qh extends Ke{constructor(){super(),this._handles=new Ut,this._projectedCenter=null,this._metersPerSRUnit=null,this._technique=new un,this._grid=null,this.visible=!0}destroy(){super.destroy(),this._handles=Re(this._handles),this._technique.shutdown()}get grid(){return this._grid}set grid(e){this._grid=e,this._handles.removeAll(),this._handles.add([_e(()=>e?.center,()=>{this._projectedCenter=null},We),_e(()=>[e?.center,e?.dynamicScaling,e?.majorLineColor,e?.majorLineInterval,e?.minorLineColor,e?.rotateWithMap,e?.rotation,e?.spacing,e?.units],()=>this.requestRender(),We)])}_createTransforms(){return{displayViewScreenMat3:Fe()}}doRender(e){if(e.drawPhase!==1||this.grid==null||!this.visible)return;const{spacing:t,units:r,majorLineInterval:i,dynamicScaling:s,majorLineColor:a,minorLineColor:n}=this.grid;if(t===0||(this._updateDerivedValues(e),this._projectedCenter==null||this._metersPerSRUnit==null))return;const{scale:l,spatialReference:h}=e.state,c=Cr(t,r,"meters"),u=this._metersPerSRUnit*gs(l,h),d=c/u;if(!s&&d<ys)return;const p=c*ws(i,d,s);this._updateTransform(e,u,p),this._technique.render(e,{transform:{dvs:this.transforms.displayViewScreenMat3},config:{pxPerCell:p/u,minorLineColor:Lt(n),majorLineColor:Lt(a),majorLineInterval:i,halfWidth:.25,aaWidth:.5}})}_updateDerivedValues(e){if(!this.grid)return;const{center:t}=this.grid,{spatialReference:r}=e.state;this._projectedCenter&<(this._projectedCenter.spatialReference,r)||(this._metersPerSRUnit=null,lt(t.spatialReference,r)?this._projectedCenter=t:fs(t.spatialReference,r)?this._projectedCenter=ms(t,r):this.requestRender()),this._metersPerSRUnit==null&&this._projectedCenter!=null&&(this._metersPerSRUnit=bs(this._projectedCenter))}_updateTransform(e,t,r){const{grid:i}=this,{center:s,rotation:a,size:n,spatialReference:l}=e.state;if(i==null||this._projectedCenter==null||this._metersPerSRUnit==null)return;const h=t*(n[0]/2),c=t*(n[1]/2),u=this._metersPerSRUnit/r,d=this._projectedCenter,p=ht(i.rotation),m=ht(a),_=this.transforms.displayViewScreenMat3;Pr(_,-p);const g=l.isWrappable?_s(d.x,s[0],l):d.x,f=ct(Ue,g,d.y),y=Or(Ue,s,f);$e(y,y,u),i.rotateWithMap||Ae(y,y,qe,-m),Ae(y,y,qe,-p),$e(y,y,1/i.majorLineInterval),dn(y,y),$e(y,y,i.majorLineInterval),Ae(y,y,qe,p),Nt(_,_,y),i.rotateWithMap&&qt(_,_,m);const x=ct(Ue,h/r,c/r);kr(_,_,x)}}function dn(o,e){return o[0]=e[0]-Math.trunc(e[0]),o[1]=e[1]-Math.trunc(e[1]),o}function Lt(o){const[e,t,r,i]=o.toArray().map(s=>s/255);return[e*i,t*i,r*i,i]}export{ln as ChildStage,ac as GraphicContainer,ic as GraphicsView2D,Qh as GridView2D,ec as LabelManager,Jh as MagnifierView2D,tc as MapViewNavigation,Yh as ParentStage,ur as Stage};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.