Files
ADHA_mobile_project/assets/ExpandedCIM-0020ab0e.js
T
2024-02-28 17:06:42 +05:00

2 lines
156 KiB
JavaScript

import{ay as As,lV as kt,ic as ai,f as li,as as U,id as hi,ij as Ri,lW as $s,eI as J,lX as Fs,eE as Es,lB as Ze,jK as ae,lO as Xi,jM as Qe,lY as gi,gB as pe,lP as Hi,lt as Ne,ls as yi,z as he,aq as Ns,al as q,am as at,an as Ge,hU as zt,bb as ht,at as Gs,ak as Pi,jQ as Rs,eL as ti,fa as Di,s as Xs,lZ as Hs,Y as Ds,l_ as _e,hB as Yi,ey as Vi,js as $,l$ as At}from"./index-b5c8f851.js";import{C as Ys}from"./BidiEngine-9a40f2f4.js";import{a as E,l as Vs}from"./visualVariablesUtils-f4ae79f2.js";import{t as Mi,c as Bs,n as de}from"./GeometryUtils-984e8446.js";import{O as vt,P as ve,R as k,k as X,B as $t,A as ge,X as rt,o as _t,Y as Re,Z as Ft,K as ye,U as j,w as lt,C as Ws,l as Us,a as Js,u as qs,y as js,b as xi,c as Ks,m as Zs,f as bi,i as Ie,e as Xe,n as He}from"./enums-f1a6a48a.js";import{b,F as It,k as ci,S as ui,x as Bi,G as Wi,P as wt,L as ei,w as we,h as Qs,g as tr,m as er,d as ir,I as sr,A as rr,i as nr,l as or,u as H,p as Pe,e as w,s as ar,c as lr,t as Si}from"./utils-ebbcf3da.js";import{t as Gt,g as Me,f as hr}from"./GeometryUtils-7a7937c3.js";import{e as Ui,w as Ji,a5 as qi,a as ji}from"./definitions-1467ba4a.js";import{w as V,E as xe,S as cr}from"./color-0916c686.js";import{t as ur}from"./Rect-ea14f53a.js";import{U as fr,v as mr,q as pr,k as _r}from"./quantizationUtils-50e37a76.js";import{o as dr}from"./floatRGBA-ba8d5dad.js";const Ki="arial-unicode-ms",Ci="woff2",vi=new Map,gr=new Set;let yr=class{constructor(t,e){this.fontFace=t,this.promise=e}};async function ho(c){const t=Pr(c),e=vi.get(t);if(e)return e.promise;const i=new FontFace(c.family,`url('${As.fontsUrl}/woff2/${t}.${Ci}') format('${Ci}')`,{style:c.style,weight:c.weight}),r=document.fonts;if(r.has(i)&&i.status==="loading")return i.loaded;const s=i.load().then(()=>(r.add(i),i));return vi.set(t,new yr(i,s)),gr.add(i),s}function Zi(c){if(!c)return Ki;const t=c.toLowerCase().split(" ").join("-");switch(t){case"serif":return"noto-serif";case"sans-serif":return"arial-unicode-ms";case"monospace":return"ubuntu-mono";case"fantasy":return"cabin-sketch";case"cursive":return"redressed";default:return t}}function Pr(c){const t=Mr(c)+xr(c);return Zi(c.family)+(t.length>0?t:"-regular")}function Mr(c){if(!c.weight)return"";switch(c.weight.toLowerCase()){case"bold":case"bolder":return"-bold"}return""}function xr(c){if(!c.style)return"";switch(c.style.toLowerCase()){case"italic":case"oblique":return"-italic"}return""}const De=new Ys;function fi(c){if(c==null)return["",!1];if(!De.hasBidiChar(c))return[c,!1];let t;return t=De.checkContextual(c)==="rtl"?"IDNNN":"ICNNN",[De.bidiTransform(c,t,"VLYSN"),!0]}let Ot=class{constructor(){this.setIdentity()}getAngle(){return(this.rz==null||this.rz===0&&this.rzCos!==1&&this.rzSin!==0)&&(this.rz=Math.atan2(this.rzSin,this.rzCos)),this.rz}setIdentity(){this.tx=0,this.ty=0,this.tz=0,this.s=1,this.rx=0,this.ry=0,this.rz=0,this.rzCos=1,this.rzSin=0}setTranslate(t,e){this.tx=t,this.ty=e}setTranslateZ(t){this.tz=t}setRotateCS(t,e){this.rz=void 0,this.rzCos=t,this.rzSin=e}setRotate(t){this.rz=t,this.rzCos=void 0,this.rzSin=void 0}setRotateY(t){this.ry=t}setScale(t){this.s=t}setMeasure(t){this.m=t}};const br=512;let nt,ii=class{constructor(t){this._geometry=t}next(){const t=this._geometry;return this._geometry=null,t}};function mi(c,t){nt||(nt=new Bs(0,0,0,1));const e=c.geometryType==="esriGeometryPolygon",i=e?Mi.Polygon:Mi.LineString,r=e?3:2;let s,n;for(nt.reset(i),nt.setPixelMargin(t+1),nt.setExtent(br);c.nextPath();)if(!(c.pathSize<r)){for(c.nextPoint(),s=c.x,n=-c.y,nt.moveTo(s,n);c.nextPoint();)s=c.x,n=-c.y,nt.lineTo(s,n);e&&nt.close()}const o=nt.result(!1);if(o){const a=E.createEmptyOptimizedCIM(c.geometryType);for(const l of o){a.startPath();for(const h of l)a.pushXY(h.x,-h.y)}return a.reset(),a}return null}let Sr=class{applyColorSubstituition(t,e){if(!e)return t;this._rasterizationCanvas||(this._rasterizationCanvas=document.createElement("canvas"));const{width:i,height:r}=t,s=this._rasterizationCanvas,n=s.getContext("2d",{willReadFrequently:!0});t!==s&&(s.width=i,s.height=r,n.drawImage(t,0,0,i,r));const o=n.getImageData(0,0,i,r).data;if(e){for(const l of e)if(l&&l.oldColor&&l.oldColor.length===4&&l.newColor&&l.newColor.length===4){const[h,u,m,f]=l.oldColor,[_,p,d,g]=l.newColor;if(h===_&&u===p&&m===d&&f===g)continue;for(let y=0;y<o.length;y+=4)h===o[y]&&u===o[y+1]&&m===o[y+2]&&f===o[y+3]&&(o[y]=_,o[y+1]=p,o[y+2]=d,o[y+3]=g)}}const a=new ImageData(o,i,r);return n.putImageData(a,0,0),s}tintImageData(t,e){if(!e||e.length<4)return t;this._rasterizationCanvas||(this._rasterizationCanvas=document.createElement("canvas"));const{width:i,height:r}=t,s=this._rasterizationCanvas,n=s.getContext("2d",{willReadFrequently:!0});t!==s&&(s.width=i,s.height=r,n.drawImage(t,0,0,i,r));const o=n.getImageData(0,0,i,r),a=new Uint8Array(o.data),l=[e[0]/255,e[1]/255,e[2]/255,e[3]/255];for(let u=0;u<a.length;u+=4)a[u]*=l[0],a[u+1]*=l[1],a[u+2]*=l[2],a[u+3]*=l[3];const h=new ImageData(new Uint8ClampedArray(a.buffer),i,r);return n.putImageData(h,0,0),s}},Qi=class Rt{static local(){return Rt.instance===null&&(Rt.instance=new Rt),Rt.instance}execute(t,e,i,r,s){return new Cr(t,e,i)}};Qi.instance=null;let Cr=class{constructor(t,e,i){this._inputGeometries=t,this._angleTolerance=e.angleTolerance!==void 0?e.angleTolerance:120,this._maxCosAngle=Math.cos((1-Math.abs(this._angleTolerance)/180)*Math.PI)}next(){let t=this._inputGeometries.next();for(;t;){if(t.geometryType==="esriGeometryPolygon")this._isClosed=!0;else if(t.geometryType==="esriGeometryPolyline")this._isClosed=!1;else{if(t.geometryType!=="esriGeometryEnvelope"){t=this._inputGeometries.next();continue}if(this._maxCosAngle)return t;this._isClosed=!0}for(;t.nextPath();)this._processPath(t);return t.reset(),t}return null}_processPath(t){if(t.nextPoint()){const e=t.x,i=t.y;let r=e,s=i,n=t.pathSize,o=0,a=0,l=0,h=0,u=0,m=0;this._isClosed&&++n;for(let f=1;t.nextPoint()||f<n;++f){let _,p;this._isClosed&&f===n-1?(_=e,p=i):(_=t.x,p=t.y);const d=_-r,g=p-s,y=Math.sqrt(d*d+g*g);f>1&&y>0&&l>0&&(o*d+a*g)/y/l<=this._maxCosAngle&&t.setControlPointAt(f-1),f===1&&(h=d,u=g,m=y),y>0&&(r=_,s=p,o=d,a=g,l=y)}this._isClosed&&l>0&&m>0&&(o*h+a*u)/m/l<=this._maxCosAngle&&t.setControlPointAt(0)}}};function Ye(c,t){c[4]=t}let ce=class{constructor(t,e=!0,i=!0,r=0){this.isClosed=!1,this.geometryCursor=null,this.geometryCursor=!e&&t.geometryType==="esriGeometryPolygon"||!i&&t.geometryType==="esriGeometryPolyline"?null:t,this.geomUnitsPerPoint=r,this.iteratePath=!1,this.internalPlacement=new Ot}next(){if(!this.geometryCursor)return null;for(;this.iteratePath||this.geometryCursor.nextPath();){this.geometryCursor.seekPathStart();const t=this.processPath(this.geometryCursor);if(t)return t}return this.geometryCursor=null,null}},Ae=class{constructor(t,e,i,r=0){this.isClosed=!1,this.inputGeometries=t,this.acceptPolygon=e,this.acceptPolyline=i,this.geomUnitsPerPoint=r,this.iteratePath=!1,this.multiPathCursor=null}next(){for(;;){if(!this.multiPathCursor){let t=this.inputGeometries.next();for(;t&&(this.isClosed=this.acceptPolygon&&t.geometryType==="esriGeometryPolygon"||t.geometryType==="esriGeometryEnvelope",this.multiPathCursor=t,!this.multiPathCursor);)t=this.inputGeometries.next();if(!this.multiPathCursor)return null}for(;this.iteratePath||this.multiPathCursor.nextPath();){this.multiPathCursor.seekPathStart();const t=this.processPath(this.multiPathCursor);if(t)return t}this.multiPathCursor=null}}};const le=.03;let ct=class{constructor(t=0,e=!1){}isEmpty(t){if(!t.nextPoint())return!0;let e,i,r,s;for(e=t.x,i=t.y;t.nextPoint();e=i,i=s)if(r=t.x,s=t.y,r!==e||s!==i)return t.seekPathStart(),!1;return t.seekPathStart(),!0}normalize(t){const e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);e!==0&&(t[0]/=e,t[1]/=e)}getLength(t,e,i,r){const s=i-t,n=r-e;return Math.sqrt(s*s+n*n)}getSegLength(t){const[[e,i],[r,s]]=t;return this.getLength(e,i,r,s)}getCoord2D(t,e,i,r,s){return[t+(i-t)*s,e+(r-e)*s]}getSegCoord2D(t,e){const[[i,r],[s,n]]=t;return this.getCoord2D(i,r,s,n,e)}getAngle(t,e,i,r,s){const n=i-t,o=r-e;return Math.atan2(o,n)}getAngleCS(t,e,i,r,s){const n=i-t,o=r-e,a=Math.sqrt(n*n+o*o);return a>0?[n/a,o/a]:[1,0]}getSegAngleCS(t,e){const[[i,r],[s,n]]=t;return this.getAngleCS(i,r,s,n,e)}cut(t,e,i,r,s,n){return[s<=0?[t,e]:this.getCoord2D(t,e,i,r,s),n>=1?[i,r]:this.getCoord2D(t,e,i,r,n)]}getSubCurve(t,e,i){const r=E.createEmptyOptimizedCIM("esriGeometryPolyline");return this.appendSubCurve(r,t,e,i)?r:null}appendSubCurve(t,e,i,r){t.startPath(),e.seekPathStart();let s=0,n=!0;if(!e.nextPoint())return!1;let o=e.x,a=e.y;for(;e.nextPoint();){const l=this.getLength(o,a,e.x,e.y);if(l!==0){if(n){if(s+l>i){const h=(i-s)/l;let u=1,m=!1;s+l>=r&&(u=(r-s)/l,m=!0);const f=this.cut(o,a,e.x,e.y,h,u);if(f&&t.pushPoints(f),m)break;n=!1}}else{if(s+l>r){const h=this.cut(o,a,e.x,e.y,0,(r-s)/l);h&&t.pushPoint(h[1]);break}t.pushXY(e.x,e.y)}s+=l,o=e.x,a=e.y}else o=e.x,a=e.y}return!0}getCIMPointAlong(t,e){if(!t.nextPoint())return null;let i,r,s,n,o=0;for(i=t.x,r=t.y;t.nextPoint();i=s,r=n){s=t.x,n=t.y;const a=this.getLength(i,r,s,n);if(a!==0){if(o+a>e){const l=(e-o)/a;return this.getCoord2D(i,r,s,n,l)}o+=a}}return null}offset(t,e,i,r,s){if(!t||t.length<2)return null;let n=0,o=t[n++],a=n;for(;n<t.length;){const m=t[n];m[0]===o[0]&&m[1]===o[1]||(n!==a&&(t[a]=t[n]),o=t[a++]),n++}const l=t[0][0]===t[a-1][0]&&t[0][1]===t[a-1][1];if(l&&--a,a<(l?3:2))return null;const h=[];o=l?t[a-1]:null;let u=t[0];for(let m=0;m<a;m++){const f=m===a-1?l?t[0]:null:t[m+1];if(o)if(f){const _=[f[0]-u[0],f[1]-u[1]];this.normalize(_);const p=[u[0]-o[0],u[1]-o[1]];this.normalize(p);const d=p[0]*_[1]-p[1]*_[0],g=p[0]*_[0]+p[1]*_[1];if(d===0&&g===1){u=f;continue}if(d>=0==e<=0){if(g<1){const y=[_[0]-p[0],_[1]-p[1]];this.normalize(y);const P=Math.sqrt((1+g)/2);if(P>1/r){const M=-Math.abs(e)/P;h.push([u[0]-y[0]*M,u[1]-y[1]*M])}}}else switch(i){case vt.Mitered:{const y=Math.sqrt((1+g)/2);if(y>0&&1/y<r){const P=[_[0]-p[0],_[1]-p[1]];this.normalize(P);const M=Math.abs(e)/y;h.push([u[0]-P[0]*M,u[1]-P[1]*M]);break}}case vt.Bevelled:h.push([u[0]+p[1]*e,u[1]-p[0]*e]),h.push([u[0]+_[1]*e,u[1]-_[0]*e]);break;case vt.Rounded:if(g<1){h.push([u[0]+p[1]*e,u[1]-p[0]*e]);const y=Math.floor(2.5*(1-g));if(y>0){const P=1/y;let M=P;for(let x=1;x<y;x++,M+=P){const S=[p[1]*(1-M)+_[1]*M,-p[0]*(1-M)-_[0]*M];this.normalize(S),h.push([u[0]+S[0]*e,u[1]+S[1]*e])}}h.push([u[0]+_[1]*e,u[1]-_[0]*e])}break;case vt.Square:default:if(d<0)h.push([u[0]+(p[1]+p[0])*e,u[1]+(p[1]-p[0])*e]),h.push([u[0]+(_[1]-_[0])*e,u[1]-(_[0]+_[1])*e]);else{const y=Math.sqrt((1+Math.abs(g))/2),P=[_[0]-p[0],_[1]-p[1]];this.normalize(P);const M=e/y;h.push([u[0]-P[0]*M,u[1]-P[1]*M])}}}else{const _=[u[0]-o[0],u[1]-o[1]];this.normalize(_),h.push([u[0]+_[1]*e,u[1]-_[0]*e])}else{const _=[f[0]-u[0],f[1]-u[1]];this.normalize(_),h.push([u[0]+_[1]*e,u[1]-_[0]*e])}o=u,u=f}return h.length<(l?3:2)?null:(l&&h.push([h[0][0],h[0][1]]),h)}};const Ve=1.7320508075688772,vr=5,wr=ve.OpenEnded;let ts=class Xt{static local(){return Xt.instance===null&&(Xt.instance=new Xt),Xt.instance}execute(t,e,i,r,s){return new kr(t,e,i)}};ts.instance=null;class kr extends Ae{constructor(t,e,i){super(t,!1,!0),this._curveHelper=new ct,this._width=(e.width!==void 0?e.width:vr)*i,this._arrowType=e.geometricEffectArrowType!==void 0?e.geometricEffectArrowType:e.arrowType!==void 0?e.arrowType:wr,this._offsetFlattenError=le*i}processPath(t){const e=E.createEmptyOptimizedCIM(t.geometryType);switch(this._arrowType){case ve.OpenEnded:default:this._constructSimpleArrow(e,t,!0);break;case ve.Block:this._constructSimpleArrow(e,t,!1);break;case ve.Crossed:this._constructCrossedArrow(e,t)}return e}_constructSimpleArrow(t,e,i){const r=e.pathLength();let s=this._width;r<2*s&&(s=r/2);const n=this._curveHelper.getSubCurve(e,0,r-s);if(!n||!n.nextPath())return;n.seekPathStart();const o=s/2;if(this._curveHelper.isEmpty(n))return;const a=kt(n),l=this._constructOffset(a,-o);if(!l)return;const h=this._constructOffset(a,o);if(!h)return;const u=this._constructArrowBasePoint(l,-o/2);if(!u)return;const m=this._constructArrowBasePoint(h,o/2);if(!m)return;e.seekInPath(e.pathSize-1);const f=[e.x,e.y];t.pushPath(h),t.nextPath(),t.nextPoint(),t.setControlPoint(),t.pushPoint(m),t.nextPoint(),t.setControlPoint(),t.pushPoint(f),t.nextPoint(),t.setControlPoint(),t.pushPoint(u),t.nextPoint(),t.setControlPoint(),t.pushPoints(l.reverse()),t.setControlPoint(),i||(t.setControlPointAt(0),t.setControlPointAt(t.pathSize-1),t.pushPoint(h[0])),t.reset()}_constructCrossedArrow(t,e){const i=e.pathLength();let r=this._width;i<r*(1+Ve+1)&&(r=i/(1+Ve+1)),e.seekPathStart();const s=this._curveHelper.getSubCurve(e,0,i-r*(1+Ve));if(!s)return;s.nextPath();const n=r/2;if(this._curveHelper.isEmpty(s))return;const o=kt(s),a=this._constructOffset(o,n);if(!a)return;const l=this._constructOffset(o,-n);if(!l)return;const h=this._curveHelper.getSubCurve(e,0,i-r);if(!h||(h.nextPath(),this._curveHelper.isEmpty(h)))return;const u=kt(h),m=this._constructOffset(u,n);if(!m)return;const f=this._constructOffset(u,-n);if(!f)return;const _=m[m.length-1],p=this._constructArrowBasePoint(m,n/2);if(!p)return;const d=f[f.length-1],g=this._constructArrowBasePoint(f,-n/2);if(!g)return;e.seekInPath(e.pathSize-1);const y=[e.x,e.y];t.pushPath(a),t.nextPath(),t.nextPoint(),t.setControlPoint(),t.pushPoint(d),t.nextPoint(),t.setControlPoint(),t.pushPoint(g),t.nextPoint(),t.setControlPoint(),t.pushPoint(y),t.nextPoint(),t.setControlPoint(),t.pushPoint(p),t.nextPoint(),t.setControlPoint(),t.pushPoint(_),t.nextPoint(),t.setControlPoint(),t.pushPoints(l.reverse()),t.nextPoint(),t.setControlPoint(),t.reset()}_constructOffset(t,e){return this._curveHelper.offset(t,e,vt.Rounded,4,this._offsetFlattenError)}_constructArrowBasePoint(t,e){if(!t||t.length<2)return null;const i=t[t.length-2],r=t[t.length-1],s=[r[0]-i[0],r[1]-i[1]];return this._curveHelper.normalize(s),[r[0]+s[1]*e,r[1]-s[0]*e]}}let es=class Ht{static local(){return Ht.instance===null&&(Ht.instance=new Ht),Ht.instance}execute(t,e,i,r,s,n){return new Ir(t,e,i,r,s,n)}};es.instance=null;let Ir=class{constructor(t,e,i,r,s,n){this._inputGeometries=t,this._tileKey=r,this._geometryEngine=s,this._curveHelper=new ct,this._size=(e.size!==void 0?e.size:1)*i,this._maxInflateSize=n*i,this._offsetFlattenError=le*i}next(){let t;for(;t=this._inputGeometries.next();){if(this._size===0)return t;if(t.geometryType==="esriGeometryEnvelope"){if(this._size>0){const s=E.createEmptyOptimizedCIM(t.geometryType),n=ai(t)[0],o=this._curveHelper.offset(n,this._size,vt.Rounded,4,this._offsetFlattenError);if(o)return s.pushPath(o),s}else if(this._size<0){const s=t.asJSON();if(Math.min(s.xmax-s.xmin,s.ymax-s.ymin)+2*this._size>0)return E.fromJSONCIM({xmin:s.xmin-this._size,xmax:s.xmax+this._size,ymin:s.ymin-this._size,ymax:s.ymax+this._size})}}const e=this._geometryEngine;if(e==null)return null;const i=this._tileKey?mi(t,this._maxInflateSize):t;if(!i)continue;const r=e.buffer(li.WebMercator,i.asJSON(),this._size,1);return r?E.fromJSONCIM(r):null}return null}},is=class Dt{static local(){return Dt.instance===null&&(Dt.instance=new Dt),Dt.instance}execute(t,e,i,r,s){return new Lr(t,e,i)}};is.instance=null;let Lr=class{constructor(t,e,i){this._defaultPointSize=20,this._inputGeometries=t,this._geomUnitsPerPoint=i,this._rule=e.rule??k.FullGeometry,this._defaultSize=this._defaultPointSize*i}next(){let t;for(;t=this._inputGeometries.next();){const e=this._processGeom(ai(t));if(e&&e.length)return E.fromJSONCIM({paths:e})}return null}_clone(t){return[t[0],t[1]]}_mid(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}_mix(t,e,i,r){return[t[0]*e+i[0]*r,t[1]*e+i[1]*r]}_add(t,e){return[t[0]+e[0],t[1]+e[1]]}_add2(t,e,i){return[t[0]+e,t[1]+i]}_sub(t,e){return[t[0]-e[0],t[1]-e[1]]}_dist(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}_norm(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}_normalize(t,e=1){const i=e/this._norm(t);t[0]*=i,t[1]*=i}_leftPerpendicular(t){const e=-t[1],i=t[0];t[0]=e,t[1]=i}_leftPerp(t){return[-t[1],t[0]]}_rightPerpendicular(t){const e=t[1],i=-t[0];t[0]=e,t[1]=i}_rightPerp(t){return[t[1],-t[0]]}_dotProduct(t,e){return t[0]*e[0]+t[1]*e[1]}_crossProduct(t,e){return t[0]*e[1]-t[1]*e[0]}_rotateDirect(t,e,i){const r=t[0]*e-t[1]*i,s=t[0]*i+t[1]*e;t[0]=r,t[1]=s}_makeCtrlPt(t){const e=[t[0],t[1]];return Ye(e,1),e}_addAngledTicks(t,e,i,r){const s=this._sub(i,e);this._normalize(s);const n=this._crossProduct(s,this._sub(r,e));let o;o=n>0?this._rightPerp(s):this._leftPerp(s);const a=Math.abs(n)/2,l=[];l.push([e[0]+(o[0]-s[0])*a,e[1]+(o[1]-s[1])*a]),l.push(e),l.push(i),l.push([i[0]+(o[0]+s[0])*a,i[1]+(o[1]+s[1])*a]),t.push(l)}_addBezier2(t,e,i,r,s){if(s--==0)return void t.push(r);const n=this._mid(e,i),o=this._mid(i,r),a=this._mid(n,o);this._addBezier2(t,e,n,a,s),this._addBezier2(t,a,o,r,s)}_addBezier3(t,e,i,r,s,n){if(n--==0)return void t.push(s);const o=this._mid(e,i),a=this._mid(i,r),l=this._mid(r,s),h=this._mid(o,a),u=this._mid(a,l),m=this._mid(h,u);this._addBezier3(t,e,o,h,m,n),this._addBezier3(t,m,u,l,s,n)}_add90DegArc(t,e,i,r,s){const n=s??this._crossProduct(this._sub(i,e),this._sub(r,e))>0,o=this._mid(e,i),a=this._sub(o,e);n?this._leftPerpendicular(a):this._rightPerpendicular(a),o[0]+=a[0],o[1]+=a[1],this._addBezier3(t,e,this._mix(e,.33333,o,.66667),this._mix(i,.33333,o,.66667),i,4)}_addArrow(t,e,i){const r=e[0],s=e[1],n=e[e.length-1],o=this._sub(r,s);this._normalize(o);const a=this._crossProduct(o,this._sub(n,s)),l=.5*a,h=this._leftPerp(o),u=[n[0]-h[0]*a,n[1]-h[1]*a],m=e.length-1,f=[];f.push(i?[-h[0],-h[1]]:h);let _=[-o[0],-o[1]];for(let p=1;p<m-1;p++){const d=this._sub(e[p+1],e[p]);this._normalize(d);const g=this._dotProduct(d,_),y=this._crossProduct(d,_),P=Math.sqrt((1+g)/2),M=this._sub(d,_);this._normalize(M),M[0]/=P,M[1]/=P,f.push(y<0?[-M[0],-M[1]]:M),_=d}f.push(this._rightPerp(_));for(let p=f.length-1;p>0;p--)t.push([e[p][0]+f[p][0]*l,e[p][1]+f[p][1]*l]);t.push([u[0]+f[0][0]*l,u[1]+f[0][1]*l]),t.push([u[0]+f[0][0]*a,u[1]+f[0][1]*a]),t.push(r),t.push([u[0]-f[0][0]*a,u[1]-f[0][1]*a]),t.push([u[0]-f[0][0]*l,u[1]-f[0][1]*l]);for(let p=1;p<f.length;p++)t.push([e[p][0]-f[p][0]*l,e[p][1]-f[p][1]*l])}_cp2(t,e,i){return t.length>=2?t[1]:this._add2(t[0],e*this._defaultSize,i*this._defaultSize)}_cp3(t,e,i,r){if(t.length>=3)return t[2];const s=this._mix(t[0],1-i,e,i),n=this._sub(e,t[0]);return this._normalize(n),this._rightPerpendicular(n),[s[0]+n[0]*r*this._defaultSize,s[1]+n[1]*r*this._defaultSize]}_arrowPath(t){if(t.length>2)return t;const e=t[0],i=this._cp2(t,-4,0),r=this._sub(e,i);this._normalize(r);const s=this._rightPerp(r);return[e,i,[e[0]+(s[0]-r[0])*this._defaultSize,e[1]+(s[1]-r[1])*this._defaultSize]]}_arrowLastSeg(t){const e=t[0],i=this._cp2(t,-4,0);let r;if(t.length>=3)r=t[t.length-1];else{const s=this._sub(e,i);this._normalize(s);const n=this._rightPerp(s);r=[e[0]+(n[0]-s[0])*this._defaultSize,e[1]+(n[1]-s[1])*this._defaultSize]}return[i,r]}_processGeom(t){if(!t)return null;const e=[];for(const i of t){if(!i||i.length===0)continue;const r=i.length;let s=i[0];switch(this._rule){case k.PerpendicularFromFirstSegment:{const n=this._cp2(i,0,-1),o=this._cp3(i,n,.5,4),a=[];a.push(o),a.push(this._mid(s,n)),e.push(a);break}case k.ReversedFirstSegment:{const n=this._cp2(i,0,-1);e.push([n,s]);break}case k.PerpendicularToSecondSegment:{const n=this._cp2(i,-4,1),o=this._cp3(i,n,.882353,-1.94),a=[];a.push(this._mid(n,o)),a.push(s),e.push(a);break}case k.SecondSegmentWithTicks:{const n=this._cp2(i,-4,1),o=this._cp3(i,n,.882353,-1.94),a=this._sub(o,n);let l;l=this._crossProduct(a,this._sub(s,n))>0?this._rightPerp(l):this._leftPerp(a);const h=[];h.push([n[0]+(l[0]-a[0])/3,n[1]+(l[1]-a[1])/3]),h.push(n),h.push(o),h.push([o[0]+(l[0]+a[0])/3,o[1]+(l[1]+a[1])/3]),e.push(h);break}case k.DoublePerpendicular:{const n=this._cp2(i,0,-1),o=this._cp3(i,n,.5,3),a=this._mid(s,n),l=this._sub(a,o);this._normalize(l);const h=this._crossProduct(l,this._sub(s,o));this._leftPerpendicular(l);const u=[];u.push(s),u.push([o[0]+l[0]*h,o[1]+l[1]*h]),e.push(u);const m=[];m.push([o[0]-l[0]*h,o[1]-l[1]*h]),m.push(n),e.push(m);break}case k.OppositeToFirstSegment:{const n=this._cp2(i,0,-1),o=this._cp3(i,n,.5,3),a=this._mid(s,n),l=this._sub(a,o);this._normalize(l);const h=this._crossProduct(l,this._sub(s,o));this._leftPerpendicular(l);const u=[];u.push([o[0]+l[0]*h,o[1]+l[1]*h]),u.push([o[0]-l[0]*h,o[1]-l[1]*h]),e.push(u);break}case k.TriplePerpendicular:{const n=this._cp2(i,0,-1),o=this._cp3(i,n,.5,4),a=this._mid(s,n),l=this._sub(a,o);this._normalize(l);const h=this._crossProduct(l,this._sub(s,o));this._leftPerpendicular(l);const u=[];u.push([o[0]+l[0]*h*.8,o[1]+l[1]*h*.8]),u.push([a[0]+.8*(s[0]-a[0]),a[1]+.8*(s[1]-a[1])]),e.push(u),e.push([o,a]);const m=[];m.push([o[0]-l[0]*h*.8,o[1]-l[1]*h*.8]),m.push([a[0]+.8*(n[0]-a[0]),a[1]+.8*(n[1]-a[1])]),e.push(m);break}case k.HalfCircleFirstSegment:{const n=this._cp2(i,0,-1),o=this._cp3(i,n,.5,4),a=this._mid(s,n);let l=this._sub(n,s);const h=Math.cos(Math.PI/18),u=Math.sin(Math.PI/18),m=Math.sqrt((1+h)/2),f=Math.sqrt((1-h)/2),_=[];let p;this._crossProduct(l,this._sub(o,s))>0?(_.push(s),l=this._sub(s,a),p=n):(_.push(n),l=this._sub(n,a),p=s),this._rotateDirect(l,m,f),l[0]/=m,l[1]/=m;for(let d=1;d<=18;d++)_.push(this._add(a,l)),this._rotateDirect(l,h,u);_.push(p),e.push(_);break}case k.HalfCircleSecondSegment:{const n=this._cp2(i,0,-1),o=this._cp3(i,n,1,-1);let a=this._sub(s,n);this._normalize(a);const l=this._crossProduct(a,this._sub(o,n))/2;this._leftPerpendicular(a);const h=[n[0]+a[0]*l,n[1]+a[1]*l];a=this._sub(n,h);const u=Math.cos(Math.PI/18);let m=Math.sin(Math.PI/18);l>0&&(m=-m);const f=[n];for(let _=1;_<=18;_++)this._rotateDirect(a,u,m),f.push(this._add(h,a));e.push(f);break}case k.HalfCircleExtended:{const n=this._cp2(i,0,-2),o=this._cp3(i,n,1,-1);let a;if(r>=4)a=i[3];else{const _=this._sub(s,n);a=this._add(o,_)}const l=this._dist(n,o)/2/.75,h=this._sub(n,s);this._normalize(h,l);const u=this._sub(o,a);this._normalize(u,l);const m=[a,o];e.push(m);const f=[this._clone(o)];this._addBezier3(f,o,this._add(o,u),this._add(n,h),n,4),f.push(s),e.push(f);break}case k.OpenCircle:{const n=this._cp2(i,-2,0),o=this._sub(n,s),a=Math.cos(Math.PI/18),l=-Math.sin(Math.PI/18),h=[n];for(let u=1;u<=33;u++)this._rotateDirect(o,a,l),h.push(this._add(s,o));e.push(h);break}case k.CoverageEdgesWithTicks:{const n=this._cp2(i,0,-1);let o,a;if(r>=3)o=i[2];else{const m=this._sub(n,s),f=this._leftPerp(m);o=[s[0]+f[0]-.25*m[0],s[1]+f[1]-.25*m[1]]}if(r>=4)a=i[3];else{const m=this._mid(s,n),f=this._sub(s,n);this._normalize(f),this._leftPerpendicular(f);const _=this._crossProduct(f,this._sub(o,m));this._rightPerpendicular(f),a=[o[0]+f[0]*_*2,o[1]+f[1]*_*2]}const l=this._sub(n,s);let h,u;h=this._crossProduct(l,this._sub(o,s))>0?this._rightPerp(l):this._leftPerp(l),u=[],u.push(o),u.push(s),u.push([s[0]+(h[0]-l[0])/3,s[1]+(h[1]-l[1])/3]),e.push(u),h=this._crossProduct(l,this._sub(a,n))>0?this._rightPerp(h):this._leftPerp(l),u=[],u.push([n[0]+(h[0]+l[0])/3,n[1]+(h[1]+l[1])/3]),u.push(n),u.push(a),e.push(u);break}case k.GapExtentWithDoubleTicks:{const n=this._cp2(i,0,2),o=this._cp3(i,n,0,1);let a;if(r>=4)a=i[3];else{const l=this._sub(n,s);a=this._add(o,l)}this._addAngledTicks(e,s,n,this._mid(o,a)),this._addAngledTicks(e,o,a,this._mid(s,n));break}case k.GapExtentMidline:{const n=this._cp2(i,2,0),o=this._cp3(i,n,0,1);let a;if(r>=4)a=i[3];else{const h=this._sub(n,s);a=this._add(o,h)}const l=[];l.push(this._mid(s,o)),l.push(this._mid(n,a)),e.push(l);break}case k.Chevron:{const n=this._cp2(i,-1,-1);let o;if(r>=3)o=i[2];else{const a=this._sub(n,s);this._leftPerpendicular(a),o=this._add(s,a)}e.push([n,this._makeCtrlPt(s),o]);break}case k.PerpendicularWithArc:{const n=this._cp2(i,0,-2),o=this._cp3(i,n,.5,-1);let a=this._sub(n,s);const l=this._norm(a);a[0]/=l,a[1]/=l;const h=this._crossProduct(a,this._sub(o,s));let u=this._dotProduct(a,this._sub(o,s));u<.05*l?u=.05*l:u>.95*l&&(u=.95*l);const m=[s[0]+a[0]*u,s[1]+a[1]*u];this._leftPerpendicular(a);let f=[];f.push([m[0]-a[0]*h,m[1]-a[1]*h]),f.push([m[0]+a[0]*h,m[1]+a[1]*h]),e.push(f);const _=[n[0]+a[0]*h,n[1]+a[1]*h];a=this._sub(n,_);const p=Math.cos(Math.PI/18);let d=Math.sin(Math.PI/18);h<0&&(d=-d),f=[s,n];for(let g=1;g<=9;g++)this._rotateDirect(a,p,d),f.push(this._add(_,a));e.push(f);break}case k.ClosedHalfCircle:{const n=this._cp2(i,2,0),o=this._mid(s,n),a=this._sub(n,o),l=Math.cos(Math.PI/18),h=Math.sin(Math.PI/18),u=[s,n];for(let m=1;m<=18;m++)this._rotateDirect(a,l,h),u.push(this._add(o,a));e.push(u);break}case k.TripleParallelExtended:{const n=this._cp2(i,0,-2),o=this._cp3(i,n,1,-2),a=this._mid(s,n),l=this._sub(o,n);this._normalize(l);const h=Math.abs(this._crossProduct(l,this._sub(a,n)))/2,u=this._dist(n,o),m=[n,s];m.push([s[0]+l[0]*u*.5,s[1]+l[1]*u*.5]),e.push(m);const f=[];f.push([a[0]-l[0]*h,a[1]-l[1]*h]),f.push([a[0]+l[0]*u*.375,a[1]+l[1]*u*.375]),Ye(f[f.length-1],1),f.push([a[0]+l[0]*u*.75,a[1]+l[1]*u*.75]),e.push(f);const _=[n,o];e.push(_);break}case k.ParallelWithTicks:{const n=this._cp2(i,3,0),o=this._cp3(i,n,.5,-1),a=this._sub(o,n);this._normalize(a);const l=this._crossProduct(a,this._sub(o,s));this._leftPerpendicular(a),this._addAngledTicks(e,s,n,o),this._addAngledTicks(e,this._mix(s,1,a,l),this._mix(n,1,a,l),this._mid(s,n));break}case k.Parallel:{const n=this._cp2(i,3,0),o=this._cp3(i,n,.5,-1),a=this._sub(n,s);this._normalize(a);const l=this._leftPerp(a),h=this._crossProduct(a,this._sub(o,s));let u=[s,n];e.push(u),u=[],u.push([s[0]+l[0]*h,s[1]+l[1]*h]),u.push([n[0]+l[0]*h,n[1]+l[1]*h]),e.push(u);break}case k.PerpendicularToFirstSegment:{const n=this._cp2(i,3,0),o=this._cp3(i,n,.5,-1),a=this._mid(s,n),l=this._sub(n,s);this._normalize(l);const h=this._crossProduct(l,this._sub(o,s));this._leftPerpendicular(l);const u=[];u.push([a[0]-l[0]*h*.25,a[1]-l[1]*h*.25]),u.push([a[0]+l[0]*h*1.25,a[1]+l[1]*h*1.25]),e.push(u);break}case k.ParallelOffset:{const n=this._cp2(i,3,0),o=this._cp3(i,n,.5,-1),a=this._sub(n,s);this._normalize(a);const l=this._crossProduct(a,this._sub(o,s));this._leftPerpendicular(a);const h=[];h.push([s[0]-a[0]*l,s[1]-a[1]*l]),h.push([n[0]-a[0]*l,n[1]-a[1]*l]),e.push(h);const u=[];u.push([s[0]+a[0]*l,s[1]+a[1]*l]),u.push([n[0]+a[0]*l,n[1]+a[1]*l]),e.push(u);break}case k.OffsetOpposite:{const n=this._cp2(i,3,0),o=this._cp3(i,n,.5,-1),a=this._sub(n,s);this._normalize(a);const l=this._crossProduct(a,this._sub(o,s));this._leftPerpendicular(a);const h=[];h.push([s[0]-a[0]*l,s[1]-a[1]*l]),h.push([n[0]-a[0]*l,n[1]-a[1]*l]),e.push(h);break}case k.OffsetSame:{const n=this._cp2(i,3,0),o=this._cp3(i,n,.5,-1),a=this._sub(n,s);this._normalize(a);const l=this._crossProduct(a,this._sub(o,s));this._leftPerpendicular(a);const h=[];h.push([s[0]+a[0]*l,s[1]+a[1]*l]),h.push([n[0]+a[0]*l,n[1]+a[1]*l]),e.push(h);break}case k.CircleWithArc:{let n=this._cp2(i,3,0);const o=this._cp3(i,n,.5,-1);let a,l;if(r>=4)a=i[3],l=this._crossProduct(this._sub(a,n),this._sub(o,n))>0;else{a=n,l=this._crossProduct(this._sub(a,s),this._sub(o,s))>0;const _=24*this._geomUnitsPerPoint,p=this._sub(a,s);this._normalize(p,_);const d=Math.sqrt(2)/2;this._rotateDirect(p,d,l?d:-d),n=this._add(s,p)}const h=this._sub(n,s),u=Math.cos(Math.PI/18),m=Math.sin(Math.PI/18),f=[n];for(let _=1;_<=36;_++)this._rotateDirect(h,u,m),f.push(this._add(s,h));this._add90DegArc(f,n,a,o,l),Ye(f[f.length-8],1),e.push(f);break}case k.DoubleJog:{let n,o,a=this._cp2(i,-3,1);if(n=r>=3?i[2]:this._add(s,this._sub(s,a)),r>=4)o=i[3];else{const g=s;s=a,o=n;const y=this._dist(s,g),P=this._dist(o,g);let M=30*this._geomUnitsPerPoint;.5*y<M&&(M=.5*y),.5*P<M&&(M=.5*P),a=this._mix(s,M/y,g,(y-M)/y),n=this._mix(o,M/P,g,(P-M)/P)}const l=this._mid(s,a),h=this._mid(o,n),u=this._dist(s,a),m=this._dist(n,o);let f=Math.min(u,m)/8;f=Math.min(f,24*this._geomUnitsPerPoint);const _=Math.cos(Math.PI/4);let p=this._sub(s,a);this._normalize(p,f),this._crossProduct(p,this._sub(o,a))>0?this._rotateDirect(p,_,-_):this._rotateDirect(p,_,_);let d=[];d.push(a),d.push(this._add(l,p)),d.push(this._sub(l,p)),d.push(s),e.push(d),p=this._sub(o,n),this._normalize(p,f),this._crossProduct(p,this._sub(s,n))<0?this._rotateDirect(p,_,_):this._rotateDirect(p,_,-_),d=[],d.push(n),d.push(this._add(h,p)),d.push(this._sub(h,p)),d.push(o),e.push(d);break}case k.PerpendicularOffset:{const n=this._cp2(i,-4,1),o=this._cp3(i,n,.882353,-1.94),a=this._sub(o,n);this._crossProduct(a,this._sub(s,n))>0?this._rightPerpendicular(a):this._leftPerpendicular(a);const l=[a[0]/8,a[1]/8],h=this._sub(this._mid(n,o),l);e.push([h,s]);break}case k.LineExcludingLastSegment:{const n=this._arrowPath(i),o=[];let a=n.length-2;for(;a--;)o.push(n[a]);e.push(o);break}case k.MultivertexArrow:{const n=this._arrowPath(i),o=[];this._addArrow(o,n,!1),e.push(o);break}case k.CrossedArrow:{const n=this._arrowPath(i),o=[];this._addArrow(o,n,!0),e.push(o);break}case k.ChevronArrow:{const[n,o]=this._arrowLastSeg(i),a=10*this._geomUnitsPerPoint,l=this._sub(s,n);this._normalize(l);const h=this._crossProduct(l,this._sub(o,n)),u=this._leftPerp(l),m=[o[0]-u[0]*h*2,o[1]-u[1]*h*2],f=[];f.push([o[0]+l[0]*a,o[1]+l[1]*a]),f.push(s),f.push([m[0]+l[0]*a,m[1]+l[1]*a]),e.push(f);break}case k.ChevronArrowOffset:{const[n,o]=this._arrowLastSeg(i),a=this._sub(s,n);this._normalize(a);const l=this._crossProduct(a,this._sub(o,n));this._leftPerpendicular(a);const h=[o[0]-a[0]*l,o[1]-a[1]*l],u=[];u.push([h[0]+a[0]*l*.5,h[1]+a[1]*l*.5]),u.push(this._mid(h,s)),u.push([h[0]-a[0]*l*.5,h[1]-a[1]*l*.5]),e.push(u);break}case k.PartialFirstSegment:{const[n,o]=this._arrowLastSeg(i),a=this._sub(s,n);this._normalize(a);const l=this._crossProduct(a,this._sub(o,n));this._leftPerpendicular(a);const h=[o[0]-a[0]*l,o[1]-a[1]*l];e.push([n,h]);break}case k.Arch:{const n=this._cp2(i,0,-1),o=this._cp3(i,n,.5,1),a=this._sub(s,n),l=this._mix(o,1,a,.55),h=this._mix(o,1,a,-.55),u=[s];this._addBezier2(u,s,l,o,4),this._addBezier2(u,o,h,n,4),e.push(u);break}case k.CurvedParallelTicks:{const n=this._cp2(i,-4,1),o=this._cp3(i,n,.882353,-1.94),a=this._sub(o,n);this._crossProduct(a,this._sub(s,n))>0?this._rightPerpendicular(a):this._leftPerpendicular(a);const l=[a[0]/8,a[1]/8],h=this._sub(this._mid(n,o),l),u=this._sub(this._mix(n,.75,o,.25),l),m=this._sub(this._mix(n,.25,o,.75),l),f=[n];this._addBezier2(f,n,u,h,3),this._addBezier2(f,h,m,o,3),e.push(f);for(let _=0;_<8;_++){const p=f[2*_+1],d=[this._clone(p)];d.push(this._add(p,[a[0]/4,a[1]/4])),e.push(d)}break}case k.Arc90Degrees:{const n=this._cp2(i,0,-1),o=this._cp3(i,n,.5,1),a=[n];this._add90DegArc(a,n,s,o),e.push(a);break}case k.FullGeometry:default:e.push(i)}}return e}},ss=class Yt{static local(){return Yt.instance===null&&(Yt.instance=new Yt),Yt.instance}execute(t,e,i,r,s){return new zr(t,e,i)}};ss.instance=null;let zr=class extends Ae{constructor(t,e,i){super(t,!0,!0),this._curveHelper=new ct,this._beginCut=(e.beginCut!==void 0?e.beginCut:1)*i,this._endCut=(e.endCut!==void 0?e.endCut:1)*i,this._middleCut=(e.middleCut!==void 0?e.middleCut:0)*i,this._invert=e.invert!==void 0&&e.invert,this._beginCut<0&&(this._beginCut=0),this._endCut<0&&(this._endCut=0),this._middleCut<0&&(this._middleCut=0)}processPath(t){const{_beginCut:e,_endCut:i,_middleCut:r}=this,s=t.pathLength(),n=E.createEmptyOptimizedCIM("esriGeometryPolyline");if(this._invert){if(e!==0||i!==0||r!==0)if(e+i+r>=s)for(n.startPath();t.nextPoint();)n.pushXY(t.x,t.y);else this._curveHelper.appendSubCurve(n,t,0,e),this._curveHelper.appendSubCurve(n,t,.5*(s-r),.5*(s+r)),this._curveHelper.appendSubCurve(n,t,s-i,i)}else if(e===0&&i===0&&r===0)for(n.startPath();t.nextPoint();)n.pushXY(t.x,t.y);else e+i+r<s&&(r===0?this._curveHelper.appendSubCurve(n,t,e,s-i):(this._curveHelper.appendSubCurve(n,t,e,.5*(s-r)),this._curveHelper.appendSubCurve(n,t,.5*(s+r),s-i)));return n.totalSize===0?null:n}};const wi=1e-7;let $e=class{constructor(){this._values=[],this.extPtGap=0,this.ctrlPtGap=0,this._length=0,this._currentValue=0}isEmpty(){return this._values.length===0}size(){return this._values.length}init(t,e,i=!0){if(this._setEmpty(),!t||t.length===0)return!1;for(let r=0;r<t.length;r++){let s=Math.abs(t[r]);i&&s<wi&&(s=wi),this._values.push(s),this._length+=s}return e&&1&t.length&&(this._length*=2),this._length!==0&&(this.ctrlPtGap=this.extPtGap=0,this._currentValue=-1,!0)}scale(t){const e=this._values?this._values.length:0;for(let i=0;i<e;++i)this._values[i]*=t;this._length*=t,this.extPtGap*=t,this.ctrlPtGap*=t}addValue(t){this._length+=t,this._values.push(t)}firstValue(){return this._values[0]}lastValue(){return this._values[this._values.length-1]}nextValue(){return this._currentValue++,this._currentValue===this._values.length&&(this._currentValue=0),this._values[this._currentValue]}reset(){this._currentValue=-1}length(){return this._length}_setEmpty(){this.extPtGap=this.ctrlPtGap=this._length=0,this._currentValue=-1,this._values.length=0}},ot=class{constructor(){this.pt=null,this.ca=0,this.sa=0}};var pt;(function(c){c[c.FAIL=0]="FAIL",c[c.END=1]="END",c[c.CONTINUE=2]="CONTINUE"})(pt||(pt={}));let be=class{constructor(){this.reset()}reset(){this.segment=null,this.segmentLength=0,this.abscissa=0,this.isPathEnd=!1,this.isPartEnd=!1}isValid(){return this.segment!==null}copyTo(t){t.segment=this.segment,t.segmentLength=this.segmentLength,t.abscissa=this.abscissa,t.isPathEnd=this.isPathEnd,t.isPartEnd=this.isPartEnd}},Fe=class extends ct{constructor(t=0,e=!1){super(t,e),this._tolerance=le,this._currentPosition=new be}updateTolerance(t){this._tolerance=le*t}init(t,e,i=!0){return i?(this._patternLength=e.length(),this._partExtPtGap=e.extPtGap,this._partCtrlPtGap=e.ctrlPtGap):(this._patternLength=0,this._partExtPtGap=0,this._partCtrlPtGap=0),this._currentPosition.reset(),this._partSegCount=0,this._pathCursor=t,this._seg=-1,this._setPosAtNextPart()}curPositionIsValid(){return this._currentPosition.isValid()}nextPosition(t,e=pt.FAIL){const i=new be;return!!this._nextPosition(t,i,null,e)&&(i.copyTo(this._currentPosition),!0)}curPointAndAngle(t){t.pt=this._getPoint(this._currentPosition);const[e,i]=this._getAngleCS(this._currentPosition);t.ca=e,t.sa=i}nextPointAndAngle(t,e,i=pt.FAIL){const r=new be;if(!this._nextPosition(t,r,null,i))return!1;r.copyTo(this._currentPosition),e.pt=this._getPoint(r);const[s,n]=this._getAngleCS(r);return e.ca=s,e.sa=n,!0}nextCurve(t){if(t===0)return null;const e=E.createEmptyOptimizedCIM("esriGeometryPolyline");e.startPath(),e.nextPath();const i=new be;return this._nextPosition(t,i,e,pt.END)?(i.copyTo(this._currentPosition),e):null}isPathEnd(){return this._currentPosition.isPathEnd}getPathEnd(){return this._currentPosition.segment[1]}getPt(t){return this._pathCursor.seekInPath(t),[this._pathCursor.x,this._pathCursor.y]}getSeg(t){return[this.getPt(t),this.getPt(t+1)]}_nextPosition(t,e,i,r){if(this._currentPosition.isPathEnd)return!1;let s=this._currentPosition.abscissa;for(this._currentPosition.segmentLength>0&&(s/=this._currentPosition.segmentLength),this._currentPosition.copyTo(e);e.abscissa+t*this._partLengthRatio>e.segmentLength+this._tolerance;){if(i){if(i.pathSize===0)if(s===0){const o=e.segment[0];i.pushXY(o[0],o[1])}else i.pushPoint(this.getSegCoord2D(e.segment,s));const n=e.segment[1];i.pushXY(n[0],n[1])}if(s=0,t-=(e.segmentLength-e.abscissa)/this._partLengthRatio,this._partSegCount)e.segment=this._nextSegment(),e.segmentLength=this.getSegLength(e.segment),e.abscissa=0,this._partSegCount--;else{if(!this._setPosAtNextPart())return r!==pt.FAIL&&(e.segmentLength=this.getSegLength(e.segment),e.isPartEnd=!0,r===pt.END?(e.abscissa=e.segmentLength,e.isPathEnd=!0):e.abscissa=e.segmentLength+t,!0);this._currentPosition.copyTo(e)}}if(e.abscissa+=t*this._partLengthRatio,i){i.pathSize===0&&(s===0?i.pushPoint(e.segment[0]):i.pushPoint(this.getSegCoord2D(e.segment,s)));const n=e.abscissa/e.segmentLength;n===1?i.pushPoint(e.segment[1]):i.pushPoint(this.getSegCoord2D(e.segment,n))}return this._partSegCount||Math.abs(e.abscissa-e.segmentLength)<this._tolerance&&(e.isPathEnd=this._partIsLast,e.isPartEnd=!0),!0}_getPoint(t){const e=t.segmentLength<=0?0:t.abscissa/t.segmentLength;return this.getSegCoord2D(this._currentPosition.segment,e)}_getAngleCS(t){const e=t.segmentLength<=0?0:t.abscissa/t.segmentLength;return this.getSegAngleCS(this._currentPosition.segment,e)}_setPosAtNextPart(){for(;this._partSegCount;)this._hasNextSegment()&&this._nextSegment(),this._partSegCount--;if(!this._hasNextSegment())return!1;for(this._partLength=0,this._partIsLast=!0,this._partSegCount=0;this._hasNextSegment();)if(this._partLength+=this.getSegLength(this._nextSegment()),this._partSegCount++,this._pathCursor.getControlPointAt(this._getEndPointIndex())){this._partIsLast=!this._hasNextSegment();break}let t=this._partSegCount;for(;t;)this._previousSegment(),--t;this._currentPosition.segment=this._nextSegment(),this._currentPosition.segmentLength=this.getSegLength(this._currentPosition.segment),this._currentPosition.abscissa=0,this._currentPosition.isPathEnd=this._currentPosition.isPartEnd=!1,--this._partSegCount;const e=this._getStartPointIndex();this._ctrlPtBegin=this._pathCursor.getControlPointAt(e);let i=e+this._partSegCount+1;if(i>=this._pathCursor.pathSize&&(i=0),this._ctrlPtEnd=this._pathCursor.getControlPointAt(i),this._patternLength>0){const r=this._ctrlPtBegin?this._partCtrlPtGap:this._partExtPtGap,s=this._ctrlPtEnd?this._partCtrlPtGap:this._partExtPtGap;let n=Math.round((this._partLength-(r+s))/this._patternLength);n<=0&&(n=r+s>0?0:1),this._partLengthRatio=this._partLength/(r+s+n*this._patternLength),this._partLengthRatio<.01&&(this._partLengthRatio=1)}else this._partLengthRatio=1;return!0}_hasNextSegment(){return this._seg<this._pathCursor.pathSize-2}_previousSegment(){return this.getSeg(--this._seg)}_nextSegment(){return this.getSeg(++this._seg)}_getStartPointIndex(){return this._seg}_getEndPointIndex(){return this._seg+1}},rs=class Vt{static local(){return Vt.instance===null&&(Vt.instance=new Vt),Vt.instance}execute(t,e,i,r,s){return new Or(t,e,i)}};rs.instance=null;let Or=class extends Ae{constructor(t,e,i){super(t,!0,!0),this._firstCurve=null,this._walker=new Fe,this._walker.updateTolerance(i),this._endings=e.lineDashEnding,this._customDashPos=-(e.offsetAlongLine??0)*i,this._offsetAtEnd=(e.customEndingOffset??0)*i,this._pattern=new $e,this._pattern.init(e.dashTemplate,!0),this._pattern.scale(i)}processPath(t){if(this._pattern.length()===0){this.iteratePath=!1;const r=kt(t);return E.fromJSONCIM({paths:[r]})}if(!this.iteratePath){let r=!0;switch(this._endings){case X.HalfPattern:case X.HalfGap:default:this._pattern.extPtGap=0;break;case X.FullPattern:this.isClosed||(this._pattern.extPtGap=.5*this._pattern.firstValue());break;case X.FullGap:this.isClosed||(this._pattern.extPtGap=.5*this._pattern.lastValue());break;case X.NoConstraint:this.isClosed||(r=!1);break;case X.Custom:this.isClosed||(this._pattern.extPtGap=.5*this._offsetAtEnd)}const s=t.pathLength();if(this._pattern.isEmpty()||s<.1*this._pattern.length()){const n=kt(t);return E.fromJSONCIM({paths:[n]})}if(!this._walker.init(t,this._pattern,r)){const n=kt(t);return E.fromJSONCIM({paths:[n]})}}let e;if(this.iteratePath)e=this._pattern.nextValue();else{let r;switch(this._endings){case X.HalfPattern:default:r=.5*this._pattern.firstValue();break;case X.HalfGap:r=.5*-this._pattern.lastValue();break;case X.FullGap:r=-this._pattern.lastValue();break;case X.FullPattern:r=0;break;case X.NoConstraint:case X.Custom:r=-this._customDashPos}let s=r/this._pattern.length();s-=Math.floor(s),r=s*this._pattern.length(),this._pattern.reset(),e=this._pattern.nextValue();let n=!1;for(;r>=e;)r-=e,e=this._pattern.nextValue(),n=!n;e-=r,n?(this._walker.nextPosition(e),e=this._pattern.nextValue()):this.isClosed&&(this._firstCurve=this._walker.nextCurve(e),e=this._pattern.nextValue(),this._walker.nextPosition(e),e=this._pattern.nextValue())}let i=this._walker.nextCurve(e);if(i)if(this._walker.isPathEnd()){if(this.iteratePath=!1,this._firstCurve){for(this._firstCurve.nextPath();this._firstCurve.nextPoint();)i.pushXY(this._firstCurve.x,this._firstCurve.y);this._firstCurve=null}}else e=this._pattern.nextValue(),!this._walker.nextPosition(e)||this._walker.isPathEnd()?(this.iteratePath=!1,this._firstCurve&&(i.pushCursor(this._firstCurve),this._firstCurve=null)):this.iteratePath=!0;else this.iteratePath=!1,i=this._firstCurve,this._firstCurve=null;return i==null||i.reset(),i}},ns=class Bt{static local(){return Bt.instance===null&&(Bt.instance=new Bt),Bt.instance}execute(t,e,i,r,s,n){return new Tr(t,e,i,r,s,n)}};ns.instance=null;let Tr=class{constructor(t,e,i,r,s,n){switch(this._inputGeometries=t,this._tileKey=r,this._geometryEngine=s,this._maxInflateSize=n*i,this._width=(e.width!==void 0?e.width:2)*i,e.method){case $t.Mitered:case $t.Bevelled:case $t.Rounded:case $t.TrueBuffer:case $t.Square:}this._option=e.option}next(){let t;for(;t=this._inputGeometries.next();){if(t.geometryType==="esriGeometryEnvelope"&&this._width>0){const e=t.asJSON();return Math.min(e.xmax-e.xmin,e.ymax-e.ymin)-2*this._width<0?t:E.fromJSONCIM({paths:[[[e.xmin+this._width,e.ymin+this._width],[e.xmax-this._width,e.ymin+this._width],[e.xmax-this._width,e.ymax-this._width],[e.xmin+this._width,e.ymax-this._width],[e.xmin+this._width,e.ymin+this._width]],[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]})}if(t.geometryType==="esriGeometryPolygon"){if(this._width===0)return t.clone();const e=this._geometryEngine;if(e==null)return null;const i=this._tileKey?mi(t,this._maxInflateSize):t.clone();if(!i)continue;const r=e.buffer(li.WebMercator,i.asJSON(),-this._width,1);if(r)for(const s of r.rings)s&&i.pushPath(s.reverse());return i}}return null}},os=class Wt{static local(){return Wt.instance===null&&(Wt.instance=new Wt),Wt.instance}execute(t,e,i,r,s){return new Ar(t,e,i)}};os.instance=null;let Ar=class extends Ae{constructor(t,e,i){super(t,!1,!0),this._curveHelper=new ct,this._length=(e.length!==void 0?e.length:20)*i,this._angle=e.angle!==void 0?e.angle:225,this._position=e.position!==void 0?e.position:50,this._length<0&&(this._length=-this._length),this._position<20&&(this._position=20),this._position>80&&(this._position=80),this._mirror=!1}processPath(t){const e=E.createEmptyOptimizedCIM("esriGeometryPolyline");if(this._curveHelper.isEmpty(t))return null;t.seekInPath(0);const i=t.x,r=t.y;t.seekInPath(t.pathSize-1);const s=t.x,n=t.y,o=[s-i,n-r];this._curveHelper.normalize(o);const a=i+(s-i)*this._position/100,l=r+(n-r)*this._position/100,h=Math.cos((90-this._angle)/180*Math.PI);let u=Math.sin((90-this._angle)/180*Math.PI);this._mirror&&(u=-u),this._mirror=!this._mirror;const m=[a-this._length/2*h,l-this._length/2*u],f=[a+this._length/2*h,l+this._length/2*u];return e.pushPath([[i,r],m,f,[s,n]]),e}},as=class Ut{static local(){return Ut.instance===null&&(Ut.instance=new Ut),Ut.instance}execute(t,e,i,r,s){return new $r(t,e,i)}};as.instance=null;let $r=class{constructor(t,e,i){this._inputGeometries=t,this._offsetX=e.offsetX!==void 0?e.offsetX*i:0,this._offsetY=e.offsetY!==void 0?e.offsetY*i:0}next(){let t=this._inputGeometries.next();for(;t;){if(t.totalSize>0)return this._move(t.clone(),this._offsetX,this._offsetY);t=this._inputGeometries.next()}return null}_move(t,e,i){for(;t.nextPath();)for(;t.nextPoint();)t.x=t.x+e,t.y=t.y+i;return t.reset(),t}},ls=class Jt{static local(){return Jt.instance===null&&(Jt.instance=new Jt),Jt.instance}execute(t,e,i,r,s,n){return new Fr(t,e,i,r,s,n)}};ls.instance=null;let Fr=class{constructor(t,e,i,r,s,n){this._inputGeometries=t,this._tileKey=r,this._geometryEngine=s,this._curveHelper=new ct,this._offset=(e.offset??1)*i,this._method=e.method,this._maxInflateSize=n*i,this._option=e.option,this._offsetFlattenError=le*i}next(){let t;for(;t=this._inputGeometries.next();){if(this._offset===0)return t.clone();if(t.geometryType==="esriGeometryEnvelope"){if(this._method===vt.Rounded&&this._offset>0){const n=kt(t),o=this._curveHelper.offset(n,-this._offset,this._method,4,this._offsetFlattenError);if(o){const a=E.createEmptyOptimizedCIM(t.geometryType);return a.pushPath(o),a}return null}const s=t.asJSON();if(U(s)&&Math.min(s.xmax-s.xmin,s.ymax-s.ymin)+2*this._offset>0)return E.fromJSONCIM({xmin:s.xmin-this._offset,xmax:s.xmax+this._offset,ymin:s.ymin-this._offset,ymax:s.ymax+this._offset})}const e=this._geometryEngine;if(e==null)continue;const i=this._tileKey?mi(t,this._maxInflateSize):t.clone();if(!i)continue;const r=e.offset(li.WebMercator,i.asJSON(),-this._offset,1,this._method,4,this._offsetFlattenError);return r?E.fromJSONCIM(r):null}return null}},hs=class qt{static local(){return qt.instance===null&&(qt.instance=new qt),qt.instance}execute(t,e,i,r,s){return new Er(t,e,i)}};hs.instance=null;let Er=class{constructor(t,e,i){this._inputGeometries=t,this._reverse=e.reverse===void 0||e.reverse}next(){let t=this._inputGeometries.next();for(;t;){if(!this._reverse)return t;if(t.geometryType==="esriGeometryPolyline")return Nr(t.clone());t=this._inputGeometries.next()}return null}};function Nr(c){for(;c.nextPath();)for(let t=0;t<c.pathSize/2;t++){c.seekInPath(t);const e=c.x,i=c.y;c.seekInPath(c.pathSize-t-1);const r=c.x,s=c.y;c.x=e,c.y=i,c.seekInPath(t),c.x=r,c.y=s}return c.reset(),c}let cs=class jt{static local(){return jt.instance===null&&(jt.instance=new jt),jt.instance}execute(t,e,i,r,s){return new Gr(t,e,i)}};cs.instance=null;let Gr=class{constructor(t,e,i){this._inputGeometries=t,this._rotateAngle=e.angle!==void 0?e.angle*Math.PI/180:0}next(){let t=this._inputGeometries.next();for(;t;){if(this._rotateAngle===0||t.geometryType==="esriGeometryPoint")return t;if(t.totalSize>0){const e=hi(t),i=(e[2]+e[0])/2,r=(e[3]+e[1])/2;return t.reset(),this._rotate(t.clone(),i,r)}t=this._inputGeometries.next()}return null}_rotate(t,e,i){const r=Math.cos(this._rotateAngle),s=Math.sin(this._rotateAngle);for(;t.nextPath();)for(;t.nextPoint();){const n=t.x-e,o=t.y-i;t.x=e+n*r-o*s,t.y=i+n*s+o*r}return t.reset(),t}},us=class Kt{static local(){return Kt.instance===null&&(Kt.instance=new Kt),Kt.instance}execute(t,e,i,r,s){return new Rr(t,e,i)}};us.instance=null;let Rr=class{constructor(t,e,i){this._inputGeometries=t,this._xFactor=e.XScaleFactor!==void 0?e.XScaleFactor:1.15,this._yFactor=e.YScaleFactor!==void 0?e.YScaleFactor:1.15}next(){const t=this._inputGeometries.next();if(t){if(this._xFactor===1&&this._yFactor===1||t.geometryType==="esriGeometryPoint")return t;if(t.totalSize>0){const e=hi(t),i=(e[2]+e[0])/2,r=(e[3]+e[1])/2;return t.reset(),this._scaleCursor(t.clone(),i,r)}}return null}_scaleCursor(t,e,i){for(;t.nextPath();)for(;t.nextPoint();)t.x=e+(t.x-e)*this._xFactor,t.y=i+(t.y-i)*this._yFactor;return t.reset(),t}},fs=class Zt{static local(){return Zt.instance===null&&(Zt.instance=new Zt),Zt.instance}execute(t,e,i,r,s){return new Xr(t,e,i)}};fs.instance=null;let Xr=class{constructor(t,e,i){this._inputGeometries=t,this._height=(e.amplitude!==void 0?e.amplitude:2)*i,this._period=(e.period!==void 0?e.period:3)*i,this._style=e.waveform,this._height<=0&&(this._height=Math.abs(this._height)),this._period<=0&&(this._period=Math.abs(this._period)),this._pattern=new $e,this._pattern.addValue(this._period),this._pattern.addValue(this._period),this._walker=new Fe,this._walker.updateTolerance(i)}next(){let t=this._inputGeometries.next();for(;t;){if(this._height===0||this._period===0)return t;const e=this._processGeom(t);if(e)return e;t=this._inputGeometries.next()}return null}_processGeom(t){const e=E.createEmptyOptimizedCIM(t.geometryType);for(;t.nextPath();){e.startPath();const i=t.pathLength();if(this._walker.init(t,this._pattern))switch(this._style){case ge.Sinus:default:this._constructCurve(e,i,!1);break;case ge.Square:this._constructSquare(e,i);break;case ge.Triangle:this._constructTriangle(e,i);break;case ge.Random:this._constructCurve(e,i,!0)}else for(;t.nextPoint();)e.pushXY(t.x,t.y)}return e}_constructCurve(t,e,i){let r=Math.round(e/this._period);r===0&&(r=1);const s=r*16+1,n=e/r,o=this._period/16,a=1/s,l=2*Math.PI*e/n,h=2*Math.PI*Math.random(),u=2*Math.PI*Math.random(),m=2*Math.PI*Math.random(),f=.75-Math.random()/2,_=.75-Math.random()/2,p=new ot;this._walker.curPointAndAngle(p),t.pushPoint(p.pt);let d=0;for(;;){if(!this._walker.nextPointAndAngle(o,p)){t.pushPoint(this._walker.getPathEnd());break}{const g=d;let y;if(d+=a,i){const P=this._height/2*(1+.3*Math.sin(f*l*g+h));y=P*Math.sin(l*g+u),y+=P*Math.sin(_*l*g+m),y/=2}else y=.5*this._height*Math.sin(.5*l*g);t.pushXY(p.pt[0]-y*p.sa,p.pt[1]+y*p.ca)}}}_constructSquare(t,e){Math.round(e/this._period);let i=!0;for(;;){let r=!1;if(this._walker.curPositionIsValid()){const s=new ot;this._walker.curPointAndAngle(s);const n=new ot;if(this._walker.nextPointAndAngle(this._period,n)){const o=new ot;this._walker.nextPointAndAngle(this._period,o)&&(i?(t.pushPoint(s.pt),i=!1):t.pushPoint(s.pt),t.pushXY(s.pt[0]-this._height/2*s.sa,s.pt[1]+this._height/2*s.ca),t.pushXY(n.pt[0]-this._height/2*n.sa,n.pt[1]+this._height/2*n.ca),t.pushXY(n.pt[0]+this._height/2*n.sa,n.pt[1]-this._height/2*n.ca),t.pushXY(o.pt[0]+this._height/2*o.sa,o.pt[1]-this._height/2*o.ca),r=!0)}}if(!r){t.pushPoint(this._walker.getPathEnd());break}}}_constructTriangle(t,e){Math.round(e/this._period);let i=!0;for(;;){let r=!1;if(this._walker.curPositionIsValid()){const s=new ot;this._walker.curPointAndAngle(s);const n=new ot;if(this._walker.nextPointAndAngle(this._period/2,n)){const o=new ot;this._walker.nextPointAndAngle(this._period,o)&&(this._walker.nextPosition(this._period/2)&&(i?(t.pushPoint(s.pt),i=!1):t.pushPoint(s.pt),t.pushXY(n.pt[0]-this._height/2*n.sa,n.pt[1]+this._height/2*n.ca),t.pushXY(o.pt[0]+this._height/2*o.sa,o.pt[1]-this._height/2*o.ca)),r=!0)}}if(!r){t.pushPoint(this._walker.getPathEnd());break}}}},ms=class Qt{static local(){return Qt.instance===null&&(Qt.instance=new Qt),Qt.instance}execute(t,e,i,r,s){return new Hr(t,e,i)}};ms.instance=null;let Hr=class extends ce{constructor(t,e,i){super(t),this._geometryWalker=new Fe,this._geometryWalker.updateTolerance(i),this._angleToLine=e.angleToLine??!0,this._offset=(e.offset?e.offset:0)*i,this._originalEndings=e.endings,this._offsetAtEnd=(e.customEndingOffset?e.customEndingOffset:0)*i,this._position=-(e.offsetAlongLine?e.offsetAlongLine:0)*i,this._pattern=new $e,this._pattern.init(e.placementTemplate,!1),this._pattern.scale(i),this._endings=this._originalEndings}processPath(t){if(this._pattern.isEmpty())return null;let e;if(this.iteratePath)e=this._pattern.nextValue();else{this._originalEndings===rt.WithFullGap&&this.isClosed?this._endings=rt.WithMarkers:this._endings=this._originalEndings,this._pattern.extPtGap=0;let r,s=!0;switch(this._endings){case rt.NoConstraint:r=-this._position,r=this._adjustPosition(r),s=!1;break;case rt.WithHalfGap:default:r=-this._pattern.lastValue()/2;break;case rt.WithFullGap:r=-this._pattern.lastValue(),this._pattern.extPtGap=this._pattern.lastValue();break;case rt.WithMarkers:r=0;break;case rt.Custom:r=-this._position,r=this._adjustPosition(r),this._pattern.extPtGap=.5*this._offsetAtEnd}if(!this._geometryWalker.init(t,this._pattern,s))return null;this._pattern.reset();let n=0;for(;r>n;)r-=n,n=this._pattern.nextValue();n-=r,e=n,this.iteratePath=!0}const i=new ot;return this._geometryWalker.nextPointAndAngle(e,i)?this._endings===rt.WithFullGap&&this._geometryWalker.isPathEnd()?(this.iteratePath=!1,null):this._endings===rt.WithMarkers&&this._geometryWalker.isPathEnd()&&(this.iteratePath=!1,this.isClosed)?null:(this.internalPlacement.setTranslate(i.pt[0]-this._offset*i.sa,i.pt[1]+this._offset*i.ca),this._angleToLine&&this.internalPlacement.setRotateCS(i.ca,i.sa),this.internalPlacement):(this.iteratePath=!1,null)}_adjustPosition(t){let e=t/this._pattern.length();return e-=Math.floor(e),e*this._pattern.length()}},ps=class te{static local(){return te.instance===null&&(te.instance=new te),te.instance}execute(t,e,i,r,s){return new Dr(t,e,i)}};ps.instance=null;let Dr=class extends ce{constructor(t,e,i){super(t,!1,!0),this._curveHelper=new ct,this._angleToLine=e.angleToLine===void 0||e.angleToLine,this._offset=e.offset!==void 0?e.offset*i:0,this._type=e.extremityPlacement,this._position=e.offsetAlongLine!==void 0?e.offsetAlongLine*i:0,this._beginProcessed=!1}processPath(t){let e;switch(this._type){case _t.Both:default:this._beginProcessed?(e=this._atExtremities(t,this._position,!1),this._beginProcessed=!1,this.iteratePath=!1):(e=this._atExtremities(t,this._position,!0),this._beginProcessed=!0,this.iteratePath=!0);break;case _t.JustBegin:e=this._atExtremities(t,this._position,!0);break;case _t.JustEnd:e=this._atExtremities(t,this._position,!1);case _t.None:}return e}_atExtremities(t,e,i){if(i||t.seekPathEnd(),i?t.nextPoint():t.prevPoint()){let r=0,[s,n]=[0,0],[o,a]=[t.x,t.y];for(;i?t.nextPoint():t.prevPoint();){s=o,n=a,o=t.x,a=t.y;const l=this._curveHelper.getLength(s,n,o,a);if(r+l>e){const h=(e-r)/l,[u,m]=this._curveHelper.getAngleCS(s,n,o,a,h),f=this._curveHelper.getCoord2D(s,n,o,a,h);return this.internalPlacement.setTranslate(f[0]-this._offset*m,f[1]+this._offset*u),this._angleToLine&&this.internalPlacement.setRotateCS(-u,-m),this.internalPlacement}r+=l}}return null}},_s=class ee{static local(){return ee.instance===null&&(ee.instance=new ee),ee.instance}execute(t,e,i,r,s){return new Yr(t,e,i)}};_s.instance=null;let Yr=class extends ce{constructor(t,e,i){super(t),this._walker=new Fe,this._walker.updateTolerance(i),this._angleToLine=e.angleToLine===void 0||e.angleToLine,this._offset=e.offset!==void 0?e.offset*i:0,this._beginGap=e.beginPosition!==void 0?e.beginPosition*i:0,this._endGap=e.endPosition!==void 0?e.endPosition*i:0,this._flipFirst=e.flipFirst===void 0||e.flipFirst,this._pattern=new $e,this._pattern.init(e.positionArray,!1,!1),this._subPathLen=0,this._posCount=this._pattern.size(),this._isFirst=!0,this._prevPos=0}processPath(t){if(this._pattern.isEmpty())return null;let e;if(this.iteratePath){const o=this._pattern.nextValue()*this._subPathLen,a=this._beginGap+o;e=a-this._prevPos,this._prevPos=a}else{if(this._posCount=this._pattern.size(),this._isFirst=!0,this._prevPos=0,this._subPathLen=t.pathLength()-this._beginGap-this._endGap,this._subPathLen<0)return this.iteratePath=!1,null;if(!this._walker.init(t,this._pattern,!1))return null;this._pattern.reset();const o=this._pattern.nextValue()*this._subPathLen,a=this._beginGap+o;e=a-this._prevPos,this._prevPos=a,this.iteratePath=!0}const i=new ot;if(!this._walker.nextPointAndAngle(e,i,pt.END))return this.iteratePath=!1,null;this.internalPlacement.setTranslate(i.pt[0]-this._offset*i.sa,i.pt[1]+this._offset*i.ca);const r=this._isFirst&&this._flipFirst;let s,n;return this._angleToLine?(s=i.ca,n=i.sa):(s=1,n=0),r&&(s=-s,n=-n),this.internalPlacement.setRotateCS(s,n),this._isFirst=!1,this._posCount--,this._posCount===0&&(this.iteratePath=!1),this.internalPlacement}};const mt=512,Vr=10,Z=24,Le=1e-6;let ds=class ie{static local(){return ie.instance===null&&(ie.instance=new ie),ie.instance}execute(t,e,i,r,s){return new Br(t,e,i,r,s)}};ds.instance=null;let Br=class xt{constructor(t,e,i,r,s){if(this._xMin=0,this._xMax=0,this._yMin=0,this._yMax=0,this._currentX=0,this._currentY=0,this._accelerationMap=null,this._testInsidePolygon=!1,this._verticalSubdivision=!0,this._stepX=Math.abs(e.stepX??16)*i,this._stepY=Math.abs(e.stepY??16)*i,this._stepX=Math.round(128*this._stepX)/128,this._stepY=Math.round(128*this._stepY)/128,this._stepX!==0&&this._stepY!==0){if(this._gridType=e.gridType??Re.Fixed,this._gridType===Re.Random){const n=e.seed??13,o=1;this._randomLCG=new Ri(n*o),this._randomness=(e.randomness??100)/100,this._gridAngle=0,this._shiftOddRows=!1,this._cosAngle=1,this._sinAngle=0,this._offsetX=0,this._offsetY=0,this._buildRandomValues()}else{if(this._randomness=0,this._gridAngle=e.gridAngle??0,this._shiftOddRows=e.shiftOddRows??!1,this._offsetX=(e.offsetX??0)*i,this._offsetY=(e.offsetY??0)*i,this._cosAngle=Math.cos(this._gridAngle/180*Math.PI),this._sinAngle=-Math.sin(this._gridAngle/180*Math.PI),this._stepX)if(this._offsetX<0)for(;this._offsetX<-.5*this._stepX;)this._offsetX+=this._stepX;else for(;this._offsetX>=.5*this._stepX;)this._offsetX-=this._stepX;if(this._stepY)if(this._offsetY<0)for(;this._offsetY<-.5*this._stepY;)this._offsetY+=this._stepY;else for(;this._offsetY>=.5*this._stepY;)this._offsetY-=this._stepY}if(this._graphicOriginX=0,this._graphicOriginY=0,r!=null){const[n,o,a,l]=r.split("/"),h=parseFloat(n),u=parseFloat(o),m=parseFloat(a),f=parseFloat(l);this._graphicOriginX=-(f*2**h+m)*mt,this._graphicOriginY=u*mt,this._testInsidePolygon=!0}this._internalPlacement=new Ot,this._calculateMinMax(t),this._geometryCursor=t}}next(){return this._geometryCursor?this._nextInside():null}_buildRandomValues(){if(!xt._randValues){xt._randValues=[];for(let t=0;t<Z;t++)for(let e=0;e<Z;e++)xt._randValues.push(this._randomLCG.getFloat()),xt._randValues.push(this._randomLCG.getFloat())}}_calculateMinMax(t){let e,i,r,s,n,o,a,l,h,u,m,f,_,p;this._xMin=0,this._xMax=0,this._yMin=0,this._yMax=0,a=l=_=m=Number.MAX_VALUE,h=u=p=f=-Number.MAX_VALUE;const d=this._cosAngle!==1;for(t.reset();t.nextPath();)for(;t.nextPoint();)o=t.x,n=t.y,e=o-this._graphicOriginX-this._offsetX,i=n-this._graphicOriginY-this._offsetY,d?(r=this._cosAngle*e-this._sinAngle*i,s=this._sinAngle*e+this._cosAngle*i):(r=e,s=i),a=Math.min(a,r),h=Math.max(h,r),l=Math.min(l,s),u=Math.max(u,s),m=Math.min(m,n),f=Math.max(f,n),_=Math.min(_,o),p=Math.max(p,o);m=m!==Number.MAX_VALUE?m:-mt-this._stepY,f=f!==-Number.MAX_VALUE?f:this._stepY,_=_!==Number.MAX_VALUE?_:-this._stepX,p=p!==-Number.MAX_VALUE?p:mt+this._stepX;const g=f-m,y=p-_;if(this._verticalSubdivision=g>=y,this._polygonMin=this._verticalSubdivision?m:_,this._testInsidePolygon){let P=0-this._graphicOriginX-this._offsetX-this._stepX,M=mt-this._graphicOriginX-this._offsetX+this._stepX,x=-mt-this._graphicOriginY-this._offsetY-this._stepY,S=0-this._graphicOriginY-this._offsetY+this._stepY;if(d){const v=[[P,x],[P,S],[M,x],[M,S]];P=x=Number.MAX_VALUE,M=S=-Number.MAX_VALUE;for(const C of v){const I=this._cosAngle*C[0]-this._sinAngle*C[1],L=this._sinAngle*C[0]+this._cosAngle*C[1];P=Math.min(P,I),M=Math.max(M,I),x=Math.min(x,L),S=Math.max(S,L)}}a=a!==Number.MAX_VALUE?Math.max(a,P):P,l=l!==Number.MAX_VALUE?Math.max(l,x):x,h=h!==-Number.MAX_VALUE?Math.min(h,M):M,u=u!==-Number.MAX_VALUE?Math.min(u,S):S}this._xMin=Math.round(a/this._stepX),this._xMax=Math.round(h/this._stepX),this._yMin=Math.round(l/this._stepY),this._yMax=Math.round(u/this._stepY),this._currentX=this._xMax+1,this._currentY=this._yMin-1,this._buildAccelerationMap(t,_,p,m,f)}_buildAccelerationMap(t,e,i,r,s){t.reset();const n=new Map,o=this._verticalSubdivision,a=o?s-r:i-e;let l=Math.ceil(a/Vr);if(l<=1)return;const h=Math.floor(a/l);let u,m,f,_,p,d,g,y,P,M,x;for(l++,this._delta=h,o?(P=-mt-this._stepY,M=this._stepY,x=r):(P=-this._stepX,M=mt+this._stepX,x=e);t.nextPath();)if(!(t.pathSize<2)&&t.nextPoint())for(u=t.x,m=t.y;t.nextPoint();u=f,m=_){if(f=t.x,_=t.y,o){if(m===_||m<P&&_<P||m>M&&_>M)continue;p=Math.min(m,_),d=Math.max(m,_)}else{if(u===f||u<P&&f<P||u>M&&f>M)continue;p=Math.min(u,f),d=Math.max(u,f)}for(;p<d;)g=Math.floor((p-x)/h),ki(g,u,m,f,_,n),p+=h;y=Math.floor((d-x)/h),y>g&&ki(y,u,m,f,_,n)}this._accelerationMap=n}_nextInside(){for(;;){if(this._currentX>this._xMax){if(this._currentY++,this._currentY>this._yMax)return null;this._currentX=this._xMin,this._shiftOddRows&&this._currentY%2&&this._currentX--}let t=this._currentX*this._stepX+this._offsetX;this._shiftOddRows&&this._currentY%2&&(t+=.5*this._stepX);const e=this._currentY*this._stepY+this._offsetY;let i,r;if(this._currentX++,this._gridType===Re.Random){const s=(this._currentX%Z+Z)%Z,n=(this._currentY%Z+Z)%Z;i=this._graphicOriginX+t+this._stepX*this._randomness*(.5-xt._randValues[n*Z+s])*2/3,r=this._graphicOriginY+e+this._stepY*this._randomness*(.5-xt._randValues[n*Z+s+1])*2/3}else i=this._graphicOriginX+this._cosAngle*t+this._sinAngle*e,r=this._graphicOriginY-this._sinAngle*t+this._cosAngle*e;if(!this._testInsidePolygon||this._isInsidePolygon(i,r,this._geometryCursor))return this._internalPlacement.setTranslate(i,r),this._internalPlacement}}_isInsidePolygon(t,e,i){if(this._accelerationMap==null)return Wr(t,e,i);t+=Le,e+=Le;const r=this._verticalSubdivision,s=r?e:t,n=Math.floor((s-this._polygonMin)/this._delta),o=this._accelerationMap.get(n);if(!o)return!1;let a,l,h,u=0;for(const m of o){if(a=m[0],l=m[1],r){if(a[1]>e==l[1]>e)continue;h=(l[0]-a[0])*(e-a[1])-(l[1]-a[1])*(t-a[0])}else{if(a[0]>t==l[0]>t)continue;h=(l[1]-a[1])*(t-a[0])-(l[0]-a[0])*(e-a[1])}h>0?u++:u--}return u!==0}};function Wr(c,t,e){let i,r,s,n,o=0;for(c+=Le,t+=Le,e.reset();e.nextPath();)if(e.nextPoint())for(i=e.x,r=e.y;e.nextPoint();i=s,r=n)s=e.x,n=e.y,r>t!=n>t&&((s-i)*(t-r)-(n-r)*(c-i)>0?o++:o--);return o!==0}function ki(c,t,e,i,r,s){let n=s.get(c);n||(n=[],s.set(c,n)),n.push([[t,e],[i,r]])}const Ur=.001;let gs=class se{static local(){return se.instance===null&&(se.instance=new se),se.instance}execute(t,e,i,r,s){return new Jr(t,e,i)}};gs.instance=null;let Jr=class extends ce{constructor(t,e,i){super(t),this._curveHelper=new ct,this._angleToLine=e.angleToLine===void 0||e.angleToLine,this._offset=e.offset!==void 0?e.offset*i:0,this._relativeTo=e.relativeTo,this._position=e.startPointOffset!==void 0?e.startPointOffset*i:0,this._epsilon=Ur*i}processPath(t){const e=this._position;if(this._relativeTo===Ft.SegmentMidpoint){if(this.iteratePath||(this.iteratePath=!0),t.nextPoint()){let[r,s]=[t.x,t.y],[n,o]=[0,0];for(;t.nextPoint();){n=t.x,o=t.y;const a=this._curveHelper.getLength(r,s,n,o);if(a<this._epsilon){r=n,s=o;continue}const l=.5+this._position/a,[h,u]=this._curveHelper.getAngleCS(r,s,n,o,l),m=this._curveHelper.getCoord2D(r,s,n,o,l);return this.internalPlacement.setTranslate(m[0]-this._offset*u,m[1]+this._offset*h),this._angleToLine&&this.internalPlacement.setRotateCS(h,u),this.internalPlacement}}return this.iteratePath=!1,null}const i=this._relativeTo===Ft.LineEnd;return this.onLine(t,e,i)}onLine(t,e,i){let r,s=!1;switch(this._relativeTo){case Ft.LineMiddle:default:t.seekPathStart(),r=t.pathLength()/2+e;break;case Ft.LineBeginning:r=e;break;case Ft.LineEnd:r=e,s=!0}i?t.seekPathEnd():t.seekPathStart();let n=0;if(i?t.prevPoint():t.nextPoint()){let[o,a]=[t.x,t.y],[l,h]=[0,0];for(;i?t.prevPoint():t.nextPoint();){l=t.x,h=t.y;const u=this._curveHelper.getLength(o,a,l,h);if(n+u>r){const m=(r-n)/u,[f,_]=this._curveHelper.getAngleCS(o,a,l,h,m),p=this._curveHelper.getCoord2D(o,a,l,h,m),d=s?-this._offset:this._offset;return this.internalPlacement.setTranslate(p[0]-d*_,p[1]+d*f),this._angleToLine&&(s?this.internalPlacement.setRotateCS(-f,-_):this.internalPlacement.setRotateCS(f,_)),this.internalPlacement}o=l,a=h,n+=u}}return null}};const qr=1e-15;let ys=class re{static local(){return re.instance===null&&(re.instance=new re),re.instance}execute(t,e,i,r,s){return new jr(t,e,i)}};ys.instance=null;let jr=class extends ce{constructor(t,e,i){super(t),this._curveHelper=new ct,this._angleToLine=e.angleToLine===void 0||e.angleToLine,this._offset=e.offset!==void 0?e.offset*i:0,this._endPoints=e.placeOnEndPoints===void 0||e.placeOnEndPoints,this._controlPoints=e.placeOnControlPoints===void 0||e.placeOnControlPoints,this._regularVertices=e.placeOnRegularVertices===void 0||e.placeOnRegularVertices,this._tags=[],this._tagIterator=0}processPath(t){if(this.iteratePath||(this._preparePath(t),this.iteratePath=!0),this._tagIterator>=this._tags.length)return this._tags.length=0,this._tagIterator=0,this.iteratePath=!1,null;const e=this._tags[this._tagIterator];this._angleToLine&&this.internalPlacement.setRotate(e[2]);let i=e[0],r=e[1];if(this._offset!==0){const s=Math.cos(e[2]),n=Math.sin(e[2]);i-=this._offset*n,r+=this._offset*s}return this.internalPlacement.setTranslate(i,r),this._tagIterator++,this.internalPlacement}_preparePath(t){this._tags.length=0,this._tagIterator=0,t.seekPathStart();const e=t.isClosed();let i=0,r=!1,s=0,n=0;if(t.seekPathStart(),t.nextPoint()){let o=t.x,a=t.y,l=t.getControlPoint(),h=!0,u=t.nextPoint();for(;u;){const m=t.x,f=t.y,_=t.getControlPoint();(this._angleToLine||this._offset!==0)&&(s=this._curveHelper.getAngle(o,a,m,f,0)),h?(h=!1,e?(i=s,r=l):(this._endPoints||this._controlPoints&&l)&&this._tags.push([o,a,s])):l?this._controlPoints&&this._tags.push([o,a,Se(n,s)]):this._regularVertices&&this._tags.push([o,a,Se(n,s)]),(this._angleToLine||this._offset!==0)&&(n=this._curveHelper.getAngle(o,a,m,f,1)),u=t.nextPoint(),u||(e?_||r?this._controlPoints&&this._tags.push([m,f,Se(n,i)]):this._regularVertices&&this._tags.push([m,f,Se(n,i)]):(this._endPoints||this._controlPoints&&_)&&this._tags.push([m,f,n])),o=m,a=f,l=_}}this._tagIterator=0}};function Se(c,t){const e=Math.PI;for(;Math.abs(t-c)>e+2*qr;)t-c>e?t-=2*e:t+=2*e;return(c+t)/2}let Ps=class ne{static local(){return ne.instance===null&&(ne.instance=new ne),ne.instance}execute(t,e,i,r,s){return new Kr(t,e,i)}};Ps.instance=null;let Kr=class{constructor(t,e,i){this._geometryCursor=t,this._offsetX=e.offsetX!==void 0?e.offsetX*i:0,this._offsetY=e.offsetY!==void 0?e.offsetY*i:0,this._method=e.method!==void 0?e.method:ye.OnPolygon,this._internalPlacement=new Ot}next(){const t=this._geometryCursor;return this._geometryCursor=null,t?this._polygonCenter(t):null}_polygonCenter(t){let e=!1;switch(this._method){case ye.CenterOfMass:{const i=$s(t);i&&(this._internalPlacement.setTranslate(i[0]+this._offsetX,i[1]+this._offsetY),e=!0)}break;case ye.BoundingBoxCenter:{const i=hi(t);i&&(this._internalPlacement.setTranslate((i[2]+i[0])/2+this._offsetX,(i[3]+i[1])/2+this._offsetY),e=!0)}break;case ye.OnPolygon:default:{const i=Vs(t);i!==null&&(this._internalPlacement.setTranslate(i[0]+this._offsetX,i[1]+this._offsetY),e=!0)}}return e?this._internalPlacement:null}};function si(c){if(!c)return null;switch(c.type){case"CIMGeometricEffectAddControlPoints":return Qi.local();case"CIMGeometricEffectArrow":return ts.local();case"CIMGeometricEffectBuffer":return es.local();case"CIMGeometricEffectControlMeasureLine":return is.local();case"CIMGeometricEffectCut":return ss.local();case"CIMGeometricEffectDashes":return rs.local();case"CIMGeometricEffectDonut":return ns.local();case"CIMGeometricEffectJog":return os.local();case"CIMGeometricEffectMove":return as.local();case"CIMGeometricEffectOffset":return ls.local();case"CIMGeometricEffectReverse":return hs.local();case"CIMGeometricEffectRotate":return cs.local();case"CIMGeometricEffectScale":return us.local();case"CIMGeometricEffectWave":return fs.local()}return null}function Zr(c){if(!c)return null;switch(c.type){case"CIMMarkerPlacementAlongLineSameSize":return ms.local();case"CIMMarkerPlacementAtExtremities":return ps.local();case"CIMMarkerPlacementAtRatioPositions":return _s.local();case"CIMMarkerPlacementInsidePolygon":return ds.local();case"CIMMarkerPlacementOnLine":return gs.local();case"CIMMarkerPlacementOnVertices":return ys.local();case"CIMMarkerPlacementPolygonCenter":return Ps.local()}return null}function Be(c){const t=c.getFrame(0);if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement)return t;const e=document.createElement("canvas");e.width=c.width,e.height=c.height;const i=e.getContext("2d");return t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0),e}let Ms=class{constructor(t=0,e=0,i=0,r=0){this.x=t,this.y=e,this.width=i,this.height=r}get isEmpty(){return this.width<=0||this.height<=0}union(t){this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.width=Math.max(this.width,t.width),this.height=Math.max(this.height,t.height)}};function Qr(c){return`rgb(${c.slice(0,3).toString()})`}function We(c){return`rgba(${c.slice(0,3).toString()},${c[3]})`}let xs=class{constructor(t){t&&(this._textRasterizationCanvas=t)}rasterizeText(t,e){var T,N;this._textRasterizationCanvas||(this._textRasterizationCanvas=document.createElement("canvas"));const i=this._textRasterizationCanvas,r=i.getContext("2d");this._setFontProperties(r,e),this._parameters=e,this._textLines=t.split(/\r?\n/),this._lineHeight=this._computeLineHeight();const{decoration:s,weight:n}=e.font;this._lineThroughWidthOffset=s&&s==="line-through"?.1*this._lineHeight:0;const o=e.backgroundColor!=null||e.borderLine!=null,a=o?Fs:0,l=this._computeTextWidth(r,e)+2*a,h=this._lineHeight*this._textLines.length+2*a;if(i.width=l+2*this._lineThroughWidthOffset,i.height=h,i.width===0||i.height===0)return i.width=i.height=1,{size:[0,0],image:new Uint32Array(0),sdf:!1,simplePattern:!1,anchorX:0,anchorY:0,canvas:i};this._renderedLineHeight=Math.round(this._lineHeight*e.pixelRatio),this._renderedHaloSize=J(e.halo.size)*e.pixelRatio,this._renderedWidth=l*e.pixelRatio,this._renderedHeight=h*e.pixelRatio,this._lineThroughWidthOffset*=e.pixelRatio;const u=e.color??[0,0,0,0],m=e.halo&&e.halo.color?e.halo.color:[0,0,0,0];this._fillStyle=We(u),this._haloStyle=Qr(m);const f=this._renderedLineHeight,_=this._renderedHaloSize;r.save(),r.clearRect(0,0,i.width,i.height),this._setFontProperties(r,e);const p=a*e.pixelRatio,d=tn(r.textAlign,this._renderedWidth-2*p)+_+p,g=_+p,y=_>0;let P=this._lineThroughWidthOffset,M=0;if(o){r.save();const z=e.backgroundColor??[0,0,0,0],F=((T=e.borderLine)==null?void 0:T.color)??[0,0,0,0],B=2*J(((N=e.borderLine)==null?void 0:N.size)??0);r.fillStyle=We(z),r.strokeStyle=We(F),r.lineWidth=B,r.fillRect(0,0,i.width,i.height),r.strokeRect(0,0,i.width,i.height),r.restore()}y&&this._renderHalo(r,d,g,P,M,e),M+=g,P+=d;for(const z of this._textLines)y?(r.globalCompositeOperation="destination-out",r.fillStyle="rgb(0, 0, 0)",r.fillText(z,P,M),r.globalCompositeOperation="source-over",r.fillStyle=this._fillStyle,r.fillText(z,P,M)):(r.fillStyle=this._fillStyle,r.fillText(z,P,M)),s&&s!=="none"&&this._renderDecoration(r,P,M,s,n),M+=f;r.restore();const x=this._renderedWidth+2*this._lineThroughWidthOffset,S=this._renderedHeight,v=r.getImageData(0,0,x,S),C=new Uint8Array(v.data);if(e.premultiplyColors){let z;for(let F=0;F<C.length;F+=4)z=C[F+3]/255,C[F]=C[F]*z,C[F+1]=C[F+1]*z,C[F+2]=C[F+2]*z}let I,L;switch(e.horizontalAlignment){case"left":I=-.5;break;case"right":I=.5;break;default:I=0}switch(e.verticalAlignment){case"bottom":L=-.5;break;case"top":L=.5;break;default:L=0}return{size:[x,S],image:new Uint32Array(C.buffer),sdf:!1,simplePattern:!1,anchorX:I,anchorY:L,canvas:i}}_renderHalo(t,e,i,r,s,n){const o=this._renderedWidth,a=this._renderedHeight;this._haloRasterizationCanvas||(this._haloRasterizationCanvas=document.createElement("canvas")),this._haloRasterizationCanvas.width=o,this._haloRasterizationCanvas.height=a;const l=this._haloRasterizationCanvas,h=l.getContext("2d");h.clearRect(0,0,o,a),this._setFontProperties(h,n);const{decoration:u,weight:m}=n.font;h.fillStyle=this._haloStyle,h.strokeStyle=this._haloStyle,h.lineJoin="round",this._renderHaloNative(h,e,i,u,m),t.globalAlpha=this._parameters.halo.color[3],t.drawImage(l,0,0,o,a,r,s,o,a),t.globalAlpha=1}_renderHaloNative(t,e,i,r,s){const n=this._renderedLineHeight,o=this._renderedHaloSize;for(const a of this._textLines){const l=2*o,h=5,u=.1;for(let m=0;m<h;m++){const f=(1-(h-1)*u+m*u)*l;t.lineWidth=f,t.strokeText(a,e,i),r&&r!=="none"&&this._renderDecoration(t,e,i,r,s,f)}i+=n}}_setFontProperties(t,e){const i=Math.max(e.size,.5),r=e.font,s=`${r.style} ${r.weight} ${J(i*e.pixelRatio).toFixed(1)}px ${r.family}, sans-serif`;let n;switch(t.font=s,t.textBaseline="top",e.horizontalAlignment){case"left":default:n="left";break;case"right":n="right";break;case"center":n="center"}t.textAlign=n}computeTextSize(t,e){this._textRasterizationCanvas||(this._textRasterizationCanvas=document.createElement("canvas"));const i=this._textRasterizationCanvas,r=i.getContext("2d");this._setFontProperties(r,e),this._parameters=e,this._textLines=t.split(/\r?\n/),this._lineHeight=this._computeLineHeight();const s=this._computeTextWidth(r,e),n=this._lineHeight*this._textLines.length;return i.width=s,i.height=n,[s*e.pixelRatio,n*e.pixelRatio]}_computeTextWidth(t,e){let i=0;for(const s of this._textLines)i=Math.max(i,t.measureText(s).width);const r=e.font;return(r.style==="italic"||r.style==="oblique"||typeof r.weight=="string"&&(r.weight==="bold"||r.weight==="bolder")||typeof r.weight=="number"&&r.weight>600)&&(i+=.3*t.measureText("w").width),i+=2*J(this._parameters.halo.size),Math.round(i)}_computeLineHeight(){let t=1.275*this._parameters.size;const e=this._parameters.font.decoration;return e&&e==="underline"&&(t*=1.3),Math.round(t+2*J(this._parameters.halo.size))}_renderDecoration(t,e,i,r,s,n){const o=.9*this._lineHeight,a=s==="bold"?.06:s==="bolder"?.09:.04;switch(t.textAlign){case"center":e-=this._renderedWidth/2;break;case"right":e-=this._renderedWidth}const l=t.textBaseline;if(r==="underline")switch(l){case"top":i+=o;break;case"middle":i+=o/2}else if(r==="line-through")switch(l){case"top":i+=o/1.5;break;case"middle":i+=o/3}const h=n?1.5*n:Math.ceil(o*a);t.save(),t.beginPath(),t.strokeStyle=t.fillStyle,t.lineWidth=h,t.moveTo(e-this._lineThroughWidthOffset,i),t.lineTo(e+this._renderedWidth+2*this._lineThroughWidthOffset,i),t.stroke(),t.restore()}};function tn(c,t){return c==="center"?.5*t:c==="right"?t:0}let oe=class ri{constructor(t,e,i,r){this.center=Es(t,e),this.centerT=Ze(),this.halfWidth=i/2,this.halfHeight=r/2,this.width=i,this.height=r}get x(){return this.center[0]}get y(){return this.center[1]}get blX(){return this.center[0]+this.halfWidth}get blY(){return this.center[1]+this.halfHeight}get trX(){return this.center[0]-this.halfWidth}get trY(){return this.center[1]-this.halfHeight}get xmin(){return this.x-this.halfWidth}get xmax(){return this.x+this.halfWidth}get ymin(){return this.y-this.halfHeight}get ymax(){return this.y+this.halfHeight}set x(t){this.center[0]=t}set y(t){this.center[1]=t}clone(){return new ri(this.x,this.y,this.width,this.height)}serialize(t){return t.writeF32(this.center[0]),t.writeF32(this.center[1]),t.push(this.width),t.push(this.height),t}findCollisionDelta(t,e=4){const i=Math.abs(t.centerT[0]-this.centerT[0]),r=Math.abs(t.centerT[1]-this.centerT[1]),s=(t.halfWidth+this.halfWidth+e)/i,n=(t.halfHeight+this.halfHeight+e)/r,o=Math.min(s,n);return Math.log2(o)}extend(t){const e=Math.min(this.xmin,t.xmin),i=Math.min(this.ymin,t.ymin),r=Math.max(this.xmax,t.xmax)-e,s=Math.max(this.ymax,t.ymax)-i,n=e+r/2,o=i+s/2;this.width=r,this.height=s,this.halfWidth=r/2,this.halfHeight=s/2,this.x=n,this.y=o}static deserialize(t){const e=t.readF32(),i=t.readF32(),r=t.readInt32(),s=t.readInt32();return new ri(e,i,r,s)}};const pi=26,bs=4,en=pi+bs,sn=pi-6,Ii=3,G=8,rn=Math.PI/180,nn=8,Li=1.5;let Ss=class{constructor(t,e,i,r){this._rotationT=ae(),this._xBounds=0,this._yBounds=0,this.minZoom=0,this.maxZoom=255,this._bounds=null;const s=i.rect,n=new Float32Array(8);t*=r,e*=r;const o=i.code?s.width*r:i.metrics.width,a=i.code?s.height*r:i.metrics.height;this.width=o,this.height=a,n[0]=t,n[1]=e,n[2]=t+o,n[3]=e,n[4]=t,n[5]=e+a,n[6]=t+o,n[7]=e+a,this._data=n,this._setTextureCoords(s),this._scale=r,this._mosaic=i,this.x=t,this.y=e,this.maxOffset=Math.max(t+o,e+a)}get mosaic(){return this._mosaic}set angle(t){this._angle=t,Xi(this._rotationT,-t),this._setOffsets(this._data)}get angle(){return this._angle}get xTopLeft(){return this._data[0]}get yTopLeft(){return this._data[1]}get xBottomRight(){return this._data[6]}get yBottomRight(){return this._data[7]}get texcoords(){return this._texcoords}get textureBinding(){return this._mosaic.textureBinding}get offsets(){return this._offsets||this._setOffsets(this._data),this._offsets}get char(){return String.fromCharCode(this._mosaic.code)}get code(){return this._mosaic.code}get bounds(){if(!this._bounds){const{height:t,width:e}=this._mosaic.metrics,i=e*this._scale,r=Math.abs(t)*this._scale,s=new Float32Array(8);s[0]=this.x,s[1]=this.y,s[2]=this.x+i,s[3]=this.y,s[4]=this.x,s[5]=this.y+r,s[6]=this.x+i,s[7]=this.y+r;const n=Qe(ae(),this._rotationT,this._transform);gi(s,s,n);let o=1/0,a=1/0,l=0,h=0;for(let p=0;p<4;p++){const d=s[2*p],g=s[2*p+1];o=Math.min(o,d),a=Math.min(a,g),l=Math.max(l,d),h=Math.max(h,g)}const u=l-o,m=h-a,f=o+u/2,_=a+m/2;this._bounds=new oe(f,_,u,m)}return this._bounds}setTransform(t){this._transform=t,this._offsets=null}_setOffsets(t){this._offsets||(this._offsets={upperLeft:0,upperRight:0,lowerLeft:0,lowerRight:0});const e=this._offsets,i=new Float32Array(8),r=Qe(ae(),this._rotationT,this._transform);gi(i,t,r),e.upperLeft=V(i[0]*G,i[1]*G),e.upperRight=V(i[2]*G,i[3]*G),e.lowerLeft=V(i[4]*G,i[5]*G),e.lowerRight=V(i[6]*G,i[7]*G)}_setTextureCoords({x:t,y:e,width:i,height:r}){this._texcoords={upperLeft:V(t,e),upperRight:V(t+i,e),lowerLeft:V(t,e+r),lowerRight:V(t+i,e+r)}}};const on=(c,t)=>({code:0,page:0,sdf:!0,rect:new ur(0,0,11,8),textureBinding:t,metrics:{advance:0,height:4,width:c,left:0,top:0}});function Et(c,t){return c.forEach(e=>Hi(e,e,t)),{upperLeft:V(G*c[0][0],G*c[0][1]),upperRight:V(G*c[1][0],G*c[1][1]),lowerLeft:V(G*c[2][0],G*c[2][1]),lowerRight:V(G*c[3][0],G*c[3][1])}}let an=class{constructor(t,e,i){this._rotation=0,this._decorate(t,e,i),this.glyphs=t,this.bounds=this._createBounds(t),this.isMultiline=e.length>1,this._hasRotation=i.angle!==0,this._transform=this._createGlyphTransform(this.bounds,i),this._borderLineSize=i.borderLineSize,(i.borderLineSize||i.hasBackground)&&([this.bounds,this.background]=this.shapeBackground(this._transform));for(const r of t)r.setTransform(this._transform)}setRotation(t){if(t===0&&this._rotation===0)return;this._rotation=t;const e=this._transform,i=Xi(ae(),t);Qe(e,i,e);for(const r of this.glyphs)r.setTransform(this._transform)}_decorate(t,e,i){if(!i.decoration||i.decoration==="none"||!t.length)return;const r=i.scale,s=i.decoration==="underline"?en:sn,n=t[0].textureBinding;for(const o of e){const a=o.startX*r,l=o.startY*r,h=(o.width+o.glyphWidthEnd)*r;t.push(new Ss(a,l+s*r,on(h,n),1))}}shapeBackground(t){const e=nn,{xmin:i,ymin:r,xmax:s,ymax:n,x:o,y:a,width:l,height:h}=this.bounds,u=Math.min(l,h)+2*e-Li,m=Math.min(J(this._borderLineSize||0),u),f=(Li+m)/2,_=this._borderLineSize?f:0,p=[i-e,r-e],d=[s+e,r-e],g=[i-e,n+e],y=[s+e,n+e],P=Et([[p[0]-f,p[1]-f],[d[0]+f,d[1]-f],[p[0]+_,p[1]+_],[d[0]-_,d[1]+_]],t),M=Et([[g[0]+_,g[1]-_],[y[0]-_,y[1]-_],[g[0]-f,g[1]+f],[y[0]+f,y[1]+f]],t),x=Et([[p[0]-f,p[1]-f],[p[0]+_,p[1]+_],[g[0]-f,g[1]+f],[g[0]+_,g[1]-_]],t),S=Et([[d[0]-_,d[1]+_],[d[0]+f,d[1]-f],[y[0]-_,y[1]-_],[y[0]+f,y[1]+f]],t),v={main:Et([p,d,g,y],t),top:P,bot:M,left:x,right:S};return[new oe(o,a,l+2*f,h+2*f),v]}get boundsT(){const t=this.bounds,e=pe(Ze(),t.x,t.y);if(Hi(e,e,this._transform),this._hasRotation){const i=Math.max(t.width,t.height);return new oe(e[0],e[1],i,i)}return new oe(e[0],e[1],t.width,t.height)}_createBounds(t){let e=1/0,i=1/0,r=0,s=0;for(const a of t)e=Math.min(e,a.xTopLeft),i=Math.min(i,a.yTopLeft),r=Math.max(r,a.xBottomRight),s=Math.max(s,a.yBottomRight);const n=r-e,o=s-i;return new oe(e+n/2,i+o/2,n,o)}_createGlyphTransform(t,e){const i=rn*e.angle,r=ae(),s=Ze();return Ne(r,r,pe(s,e.xOffset,-e.yOffset)),e.isCIM?yi(r,r,i):(Ne(r,r,pe(s,t.x,t.y)),yi(r,r,i),Ne(r,r,pe(s,-t.x,-t.y))),r}};class Ce{constructor(t,e,i,r,s,n){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(e,i)),this.end=Math.max(0,Math.max(e,i)),this.end<t.length&&(this.glyphWidthEnd=t[this.end].metrics.width),this.width=r,this.yMin=s,this.yMax=n}}const ni=c=>c===10,zi=c=>c===32;function ln(c,t,e){const i=new Array,r=1/e.scale,s=e.maxLineWidth*r,n=t?c.length-1:0,o=t?-1:c.length,a=t?-1:1;let l=n,h=0,u=0,m=l,f=m,_=0,p=1/0,d=0;for(;l!==o;){const{code:y,metrics:P}=c[l],M=Math.abs(P.top);if(ni(y)||zi(y)||(p=Math.min(p,M),d=Math.max(d,M+P.height)),ni(y))l!==n&&(i.push(new Ce(c,m,l-a,h,p,d)),p=1/0,d=0),h=0,m=l+a,f=l+a,u=0;else if(zi(y))f=l+a,u=0,_=P.advance,h+=P.advance;else if(h>s){if(f!==m){const x=f-2*a;h-=_,i.push(new Ce(c,m,x,h-u,p,d)),p=1/0,d=0,m=f,h=u}else i.push(new Ce(c,m,l-a,h,p,d)),p=1/0,d=0,m=l,f=l,h=0;h+=P.advance,u+=P.advance}else h+=P.advance,u+=P.advance;l+=a}const g=new Ce(c,m,l-a,h,p,d);return g.start>=0&&g.end<c.length&&i.push(g),i}function hn(c,t){let e=0;for(let s=0;s<c.length;s++){const{width:n}=c[s];e=Math.max(n,e)}const i=t.decoration==="underline"?bs:0,r=c[0].yMin;return{x:0,y:r,height:c[c.length-1].yMax+t.lineHeight*(c.length-1)+i-r,width:e}}function Cs(c,t,e){const i=e.scale,r=new Array,s=ln(c,t,e),n=hn(s,e),{vAlign:o,hAlign:a}=e,l=o===Gt.Baseline?1:0,h=l?0:o-1,u=(1-l)*-n.y+h*(n.height/2)+(l?1:0)*-pi;for(let m=0;m<s.length;m++){const{start:f,end:_,width:p}=s[m];let d=-1*(a+1)*(p/2)-Ii;const g=m*e.lineHeight+u-Ii;s[m].startX=d,s[m].startY=g;for(let y=f;y<=_;y++){const P=c[y];if(ni(P.code))continue;const M=new Ss(d+P.metrics.left,g-P.metrics.top,P,i);d+=P.metrics.advance,r.push(M)}}return new an(r,s,e)}const Mt=Math.PI/180,vs=he.getLogger("esri.symbols.cim.CIMSymbolDrawHelper"),St=4,ze=10,cn=10,_i=4,Ee=10;let bt=class tt{constructor(t){this._t=t}static createIdentity(){return new tt([1,0,0,0,1,0])}clone(){const t=this._t;return new tt(t.slice())}transform(t){const e=this._t;return[e[0]*t[0]+e[1]*t[1]+e[2],e[3]*t[0]+e[4]*t[1]+e[5]]}static createScale(t,e){return new tt([t,0,0,0,e,0])}scale(t,e){const i=this._t;return i[0]*=t,i[1]*=t,i[2]*=t,i[3]*=e,i[4]*=e,i[5]*=e,this}scaleRatio(){return Math.sqrt(this._t[0]*this._t[0]+this._t[1]*this._t[1])}static createTranslate(t,e){return new tt([0,0,t,0,0,e])}translate(t,e){const i=this._t;return i[2]+=t,i[5]+=e,this}static createRotate(t){const e=Math.cos(t),i=Math.sin(t);return new tt([e,-i,0,i,e,0])}rotate(t){return tt.multiply(this,tt.createRotate(t),this)}angle(){const t=this._t[0],e=this._t[3],i=Math.sqrt(t*t+e*e);return[t/i,e/i]}static multiply(t,e,i){const r=t._t,s=e._t,n=r[0]*s[0]+r[3]*s[1],o=r[1]*s[0]+r[4]*s[1],a=r[2]*s[0]+r[5]*s[1]+s[2],l=r[0]*s[3]+r[3]*s[4],h=r[1]*s[3]+r[4]*s[4],u=r[2]*s[3]+r[5]*s[4]+s[5],m=i._t;return m[0]=n,m[1]=o,m[2]=a,m[3]=l,m[4]=h,m[5]=u,i}invert(){const t=this._t;let e=t[0]*t[4]-t[1]*t[3];if(e===0)return new tt([0,0,0,0,0,0]);e=1/e;const i=(t[1]*t[5]-t[2]*t[4])*e,r=(t[2]*t[3]-t[0]*t[5])*e,s=t[4]*e,n=-t[1]*e,o=-t[3]*e,a=t[0]*e;return new tt([s,n,i,o,a,r])}},di=class{constructor(t,e){this._resourceManager=t,this._transfos=[],this._sizeTransfos=[],this._geomUnitsPerPoint=1,this._placementPool=new Gs(Ot,void 0,void 0,100),this._earlyReturn=!1,this._mapRotation=0,this._transfos.push(e||bt.createIdentity()),this._sizeTransfos.push(e?e.scaleRatio():1)}setTransform(t,e){this._transfos=[t||bt.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():1)]}setGeomUnitsPerPoint(t){this._geomUnitsPerPoint=t}transformPt(t){return this._transfos[this._transfos.length-1].transform(t)}transformSize(t){return t*this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformPt(t){return this._transfos[this._transfos.length-1].invert().transform(t)}reverseTransformSize(t){return t/this._sizeTransfos[this._sizeTransfos.length-1]}getTransformAngle(){return this._transfos[this._transfos.length-1].angle()}geomUnitsPerPoint(){return this.isEmbedded()?1:this._geomUnitsPerPoint}isEmbedded(){return this._transfos.length>1}back(){return this._transfos[this._transfos.length-1]}push(t,e){const i=e?t.scaleRatio():1;bt.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*i)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.splice(-1,1)}drawSymbol(t,e,i){if(t)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this.drawMultiLayerSymbol(t,e);break;case"CIMTextSymbol":this.drawTextSymbol(t,e,i)}}drawMultiLayerSymbol(t,e){if(!t||!e)return;const i=t.symbolLayers;if(!i)return;const r=t.effects;if(r&&r.length>0){const s=this.executeEffects(r,e);if(s){let n=s.next();for(;n;)this.drawSymbolLayers(i,n.asJSON()),n=s.next()}}else this.drawSymbolLayers(i,e)}executeEffects(t,e){const i=this._resourceManager.geometryEngine;let r=new ii(E.fromJSONCIM(e));for(const s of t){const n=si(s);n&&(r=n.execute(r,s,this.geomUnitsPerPoint(),null,i))}return r}drawSymbolLayers(t,e){let i=t.length;for(;i--;){const r=t[i];if(!r||r.enable===!1)continue;const s=r.effects;if(s&&s.length>0){const n=this.executeEffects(s,e);if(n){let o=null;for(;(o=n.next())&&(this.drawSymbolLayer(r,o.asJSON()),!this._earlyReturn););}}else this.drawSymbolLayer(r,e);if(this._earlyReturn)return}}drawSymbolLayer(t,e){switch(t.type){case"CIMSolidFill":this.drawSolidFill(e,t.color);break;case"CIMHatchFill":this.drawHatchFill(e,t);break;case"CIMPictureFill":this.drawPictureFill(e,t);break;case"CIMGradientFill":this.drawGradientFill(e,t);break;case"CIMSolidStroke":this.drawSolidStroke(e,t.color,t.width,t.capStyle,t.joinStyle,t.miterLimit);break;case"CIMPictureStroke":this.drawPictureStroke(e,t);break;case"CIMGradientStroke":this.drawGradientStroke(e,t);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":this.drawMarkerLayer(t,e)}}drawHatchFill(t,e){const i=this._buildHatchPolyline(e,t,this.geomUnitsPerPoint());i&&(this.pushClipPath(t),this.drawMultiLayerSymbol(e.lineSymbol,i),this.popClipPath())}drawPictureFill(t,e){}drawGradientFill(t,e){}drawPictureStroke(t,e){}drawGradientStroke(t,e){}drawMarkerLayer(t,e){const i=t.markerPlacement;if(i){const r=Zr(i);if(r){const s=i.type==="CIMMarkerPlacementInsidePolygon"||i.type==="CIMMarkerPlacementPolygonCenter"&&i.clipAtBoundary;s&&this.pushClipPath(e);const n=r.execute(E.fromJSONCIM(e),i,this.geomUnitsPerPoint(),null,this._resourceManager.geometryEngine);if(n){let o=null;for(;(o=n.next())&&(this.drawMarker(t,o),!this._earlyReturn););}s&&this.popClipPath()}}else{const r=this._placementPool.acquire();if(Pi(e))r.tx=e.x,r.ty=e.y,this.drawMarker(t,r);else if(q(e)){const s=Rs(e);s&&([r.tx,r.ty]=s,this.drawMarker(t,r))}else for(const s of e.points)if(r.tx=s[0],r.ty=s[1],this.drawMarker(t,r),this._earlyReturn)break;this._placementPool.release(r)}}drawMarker(t,e){switch(t.type){case"CIMCharacterMarker":case"CIMPictureMarker":this.drawPictureMarker(t,e);break;case"CIMVectorMarker":this.drawVectorMarker(t,e)}}drawPictureMarker(t,e){if(!t)return;const i=this._resourceManager.getResource(t.url),r=b(t.size,ze);if(i==null||r<=0)return;const s=i.width,n=i.height;if(!s||!n)return;const o=s/n,a=b(t.scaleX,1),l=bt.createIdentity(),h=t.anchorPoint;if(h){let d=h.x,g=h.y;t.anchorPointUnits!=="Absolute"&&(d*=r*o*a,g*=r),l.translate(-d,-g)}let u=b(t.rotation);t.rotateClockwise&&(u=-u),this._mapRotation&&(u+=this._mapRotation),u&&l.rotate(u*Mt);let m=b(t.offsetX),f=b(t.offsetY);if(m||f){if(this._mapRotation){const d=Mt*this._mapRotation,g=Math.cos(d),y=Math.sin(d),P=m*y+f*g;m=m*g-f*y,f=P}l.translate(m,f)}const _=this.geomUnitsPerPoint();_!==1&&l.scale(_,_);const p=e.getAngle();p&&l.rotate(p),l.translate(e.tx,e.ty),this.push(l,!1),this.drawImage(t,r),this.pop()}drawVectorMarker(t,e){if(!t)return;const i=t.markerGraphics;if(!i)return;const r=b(t.size,ze),s=t.frame,n=s?s.ymax-s.ymin:0,o=r&&n?r/n:1,a=bt.createIdentity();s&&a.translate(.5*-(s.xmax+s.xmin),.5*-(s.ymax+s.ymin));const l=t.anchorPoint;if(l){let p=l.x,d=l.y;t.anchorPointUnits!=="Absolute"?s&&(p*=s.xmax-s.xmin,d*=s.ymax-s.ymin):(p/=o,d/=o),a.translate(-p,-d)}o!==1&&a.scale(o,o);let h=b(t.rotation);t.rotateClockwise&&(h=-h),this._mapRotation&&(h+=this._mapRotation),h&&a.rotate(h*Mt);let u=b(t.offsetX),m=b(t.offsetY);if(u||m){if(this._mapRotation){const p=Mt*this._mapRotation,d=Math.cos(p),g=Math.sin(p),y=u*g+m*d;u=u*d-m*g,m=y}a.translate(u,m)}const f=this.geomUnitsPerPoint();f!==1&&a.scale(f,f);const _=e.getAngle();_&&a.rotate(_),a.translate(e.tx,e.ty),this.push(a,t.scaleSymbolsProportionally);for(const p of i)if(p!=null&&p.symbol&&p.geometry||vs.error("Invalid marker graphic",p),this.drawSymbol(p.symbol,p.geometry,p.textString),this._earlyReturn)break;this.pop()}drawTextSymbol(t,e,i){if(!t||!Pi(e)||b(t.height,Ee)<=0)return;const r=bt.createIdentity();let s=b(t.angle);s=-s,s&&r.rotate(s*Mt);const n=b(t.offsetX),o=b(t.offsetY);(n||o)&&r.translate(n,o);const a=this.geomUnitsPerPoint();a!==1&&r.scale(a,a),r.translate(e.x,e.y),this.push(r,!1),this.drawText(t,i),this.pop()}_buildHatchPolyline(t,e,i){let r=b(t.separation,_i)*i,s=b(t.rotation);if(r===0)return null;r<0&&(r=-r);let n=0;const o=.5*r;for(;n>o;)n-=r;for(;n<-o;)n+=r;const a=ti();Di(a,e),a[0]-=o,a[1]-=o,a[2]+=o,a[3]+=o;const l=[[a[0],a[1]],[a[0],a[3]],[a[2],a[3]],[a[2],a[1]]];for(;s>180;)s-=180;for(;s<0;)s+=180;const h=Math.cos(s*Mt),u=Math.sin(s*Mt),m=-r*u,f=r*h;let _,p,d,g;n=b(t.offsetX)*i*u-b(t.offsetY)*i*h,_=d=Number.MAX_VALUE,p=g=-Number.MAX_VALUE;for(const C of l){const I=C[0],L=C[1],T=h*I+u*L,N=-u*I+h*L;_=Math.min(_,T),d=Math.min(d,N),p=Math.max(p,T),g=Math.max(g,N)}d=Math.floor(d/r)*r;let y=h*_-u*d-m*n/r,P=u*_+h*d-f*n/r,M=h*p-u*d-m*n/r,x=u*p+h*d-f*n/r;const S=1+Math.round((g-d)/r),v=[];for(let C=0;C<S;C++)y+=m,P+=f,M+=m,x+=f,v.push([[y,P],[M,x]]);return{paths:v}}},un=class extends di{constructor(t,e){super(t,e),this.reset()}reset(){this._xmin=this._ymin=1/0,this._xmax=this._ymax=-1/0,this._clipCount=0}envelope(){return new Ms(this._xmin,this._ymin,this._xmax-this._xmin,this._ymax-this._ymin)}bounds(){return Ns(this._xmin,this._ymin,this._xmax,this._ymax)}drawSolidFill(t){if(t&&!(this._clipCount>0))if(q(t))this._processPath(t.rings,0);else if(at(t))this._processPath(t.paths,0);else if(U(t)){const e=Ct(t);e&&this._processPath(e.rings,0)}else console.error("drawSolidFill Unexpected geometry type!")}drawSolidStroke(t,e,i){if(!t||this._clipCount>0)return;const r=.5*this.transformSize(b(i,St));if(q(t))this._processPath(t.rings,r);else if(at(t))this._processPath(t.paths,r);else if(U(t)){const s=Ct(t);s&&this._processPath(s.rings,r)}else console.error("drawSolidStroke unexpected geometry type!")}drawMarkerLayer(t,e){q(e)&&t.markerPlacement&&(t.markerPlacement.type==="CIMMarkerPlacementInsidePolygon"||t.markerPlacement.type==="CIMMarkerPlacementPolygonCenter"&&t.markerPlacement.clipAtBoundary)?this._processPath(e.rings,0):super.drawMarkerLayer(t,e)}drawHatchFill(t,e){this.drawSolidFill(t)}drawPictureFill(t,e){this.drawSolidFill(t)}drawGradientFill(t,e){this.drawSolidFill(t)}drawPictureStroke(t,e){this.drawSolidStroke(t,null,e.width)}drawGradientStroke(t,e){this.drawSolidStroke(t,null,e.width)}pushClipPath(t){this.drawSolidFill(t),this._clipCount++}popClipPath(){this._clipCount--}drawImage(t,e){const{url:i}=t,r=b(t.scaleX,1);let s=r*e,n=e;const o=this._resourceManager.getResource(i);e||o==null||(s=r*o.width,n=o.height),this._merge(this.transformPt([-s/2,-n/2]),0),this._merge(this.transformPt([-s/2,n/2]),0),this._merge(this.transformPt([s/2,-n/2]),0),this._merge(this.transformPt([s/2,n/2]),0)}drawText(t,e){if(!e||e.length===0)return;this._textRasterizer||(this._textRasterizer=new xs);const i=Ls(t),[r,s]=this._textRasterizer.computeTextSize(e,i);let n=0;switch(t.horizontalAlignment){case"Left":n=r/2;break;case"Right":n=-r/2}let o=0;switch(t.verticalAlignment){case"Bottom":o=s/2;break;case"Top":o=-s/2;break;case"Baseline":o=s/6}this._merge(this.transformPt([-r/2+n,-s/2+o]),0),this._merge(this.transformPt([-r/2+n,s/2+o]),0),this._merge(this.transformPt([r/2+n,-s/2+o]),0),this._merge(this.transformPt([r/2+n,s/2+o]),0)}_processPath(t,e){if(t)for(const i of t){const r=i?i.length:0;if(r>1){this._merge(this.transformPt(i[0]),e);for(let s=1;s<r;s++)this._merge(this.transformPt(i[s]),e)}}}_merge(t,e){t[0]-e<this._xmin&&(this._xmin=t[0]-e),t[0]+e>this._xmax&&(this._xmax=t[0]+e),t[1]-e<this._ymin&&(this._ymin=t[1]-e),t[1]+e>this._ymax&&(this._ymax=t[1]+e)}};class Wo extends di{constructor(){super(...arguments),this._searchPoint=[0,0],this._searchDistPoint=0,this._textInfo=null}hitTest(t,e,i,r,s,n){const o=n*J(1);this.setTransform(),this.setGeomUnitsPerPoint(o),this._searchPoint=[(t[0]+t[2])/2,(t[1]+t[3])/2],this._searchDistPoint=(t[2]-t[0])/2/o,this._textInfo=r;const a=e&&(e.type==="CIMPointSymbol"&&e.angleAlignment!=="Map"||e.type==="CIMTextSymbol");return this._mapRotation=a?s:0,this._earlyReturn=!1,this.drawSymbol(e,i),this._earlyReturn}drawSolidFill(t,e){this._hitTestFill(t)}drawHatchFill(t,e){this._hitTestFill(t)}drawPictureFill(t,e){this._hitTestFill(t)}drawGradientFill(t,e){this._hitTestFill(t)}drawSolidStroke(t,e,i,r,s,n){this._hitTestStroke(t,i)}drawPictureStroke(t,e){this._hitTestStroke(t,e.width)}drawGradientStroke(t,e){this._hitTestStroke(t,e.width)}drawMarkerLayer(t,e){t.markerPlacement&&(t.markerPlacement.type==="CIMMarkerPlacementInsidePolygon"||t.markerPlacement.type==="CIMMarkerPlacementPolygonCenter"&&t.markerPlacement.clipAtBoundary)?this._hitTestFill(e):super.drawMarkerLayer(t,e)}pushClipPath(t){}popClipPath(){}drawImage(t,e){const{url:i}=t,r=b(t.scaleX,1),s=this._resourceManager.getResource(i);if(s==null||s.height===0||e===0)return;const n=e*this.geomUnitsPerPoint(),o=n*r*(s.width/s.height),a=this.reverseTransformPt(this._searchPoint),l=this._searchDistPoint;Math.abs(a[0])<o/2+l&&Math.abs(a[1])<n/2+l&&(this._earlyReturn=!0)}drawText(t,e){var y,P;const i=this._textInfo;if(!i)return;const r=i.get(t);if(!r)return;const{text:s,mosaicItem:n}=r;if(!((y=n==null?void 0:n.glyphMosaicItems)!=null&&y.length))return;const o=b(t.height,Ee),{lineGapType:a,lineGap:l}=t,h=a?Is(a,b(l),o):0,u=fi(s)[1],m=n.glyphMosaicItems,f=((P=t.callout)==null?void 0:P.type)==="CIMBackgroundCallout",_=Cs(m,u,{scale:o/Ui,angle:0,xOffset:0,yOffset:0,hAlign:ws(t.horizontalAlignment),vAlign:ks(t.verticalAlignment),maxLineWidth:512,lineHeight:Ji*Math.max(.25,Math.min(h||1,4)),decoration:t.font.decoration||"none",isCIM:!0,hasBackground:f}),p=this.reverseTransformPt(this._searchPoint),d=p[0],g=p[1];for(const M of _.glyphs)if(d>M.xTopLeft&&d<M.xBottomRight&&g>-M.yBottomRight&&g<-M.yTopLeft){this._earlyReturn=!0;break}}_hitTestFill(t){let e=null;if(U(t)){const r=t;e=[[[r.xmin,r.ymin],[r.xmin,r.ymax],[r.xmax,r.ymax],[r.xmax,r.ymin],[r.xmin,r.ymin]]]}else if(q(t))e=t.rings;else{if(!at(t))return;e=t.paths}const i=this.reverseTransformPt(this._searchPoint);if(this._pointInPolygon(i,e)&&(this._earlyReturn=!0),!this._earlyReturn){const r=this.reverseTransformSize(this._searchDistPoint)*this.geomUnitsPerPoint();this._nearLine(i,e,r)&&(this._earlyReturn=!0)}}_hitTestStroke(t,e){let i=null;if(U(t)){const o=t;i=[[[o.xmin,o.ymin],[o.xmin,o.ymax],[o.xmax,o.ymax],[o.xmax,o.ymin],[o.xmin,o.ymin]]]}else if(q(t))i=t.rings;else{if(!at(t))return;i=t.paths}const r=this.reverseTransformPt(this._searchPoint),s=b(e,St)*this.geomUnitsPerPoint(),n=this.reverseTransformSize(this._searchDistPoint)*this.geomUnitsPerPoint();this._nearLine(r,i,s/2+n)&&(this._earlyReturn=!0)}_pointInPolygon(t,e){let i=0;for(const r of e){const s=r.length;for(let n=1;n<s;n++){const o=r[n-1],a=r[n];o[1]>t[1]!=a[1]>t[1]&&((a[0]-o[0])*(t[1]-o[1])-(a[1]-o[1])*(t[0]-o[0])>0?i++:i--)}}return i!==0}_nearLine(t,e,i){for(const r of e){const s=r.length;for(let n=1;n<s;n++){const o=r[n-1],a=r[n];let l=(a[0]-o[0])*(a[0]-o[0])+(a[1]-o[1])*(a[1]-o[1]);if(l===0)continue;l=Math.sqrt(l);const h=((a[0]-o[0])*(t[1]-o[1])-(a[1]-o[1])*(t[0]-o[0]))/l;if(Math.abs(h)<i){const u=((a[0]-o[0])*(t[0]-o[0])+(a[1]-o[1])*(t[1]-o[1]))/l;if(u>-i&&u<l+i)return!0}}}return!1}}class fn extends di{constructor(t,e,i,r){super(e,i),this._applyAdditionalRenderProps=r,this._colorSubstitutionHelper=new Sr,this._ctx=t}drawSolidFill(t,e){if(!t)return;if(q(t))this._buildPath(t.rings,!0);else if(at(t))this._buildPath(t.paths,!0);else if(U(t))this._buildPath(Ct(t).rings,!0);else{if(!Ge(t))return;console.log("CanvasDrawHelper.drawSolidFill - No implementation!")}const i=this._ctx;i.fillStyle=typeof e=="string"?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",i.fill("evenodd")}drawSolidStroke(t,e,i,r,s,n){if(!t||!e||i===0)return;if(q(t))this._buildPath(t.rings,!0);else if(at(t))this._buildPath(t.paths,!1);else{if(!U(t))return void console.log("CanvasDrawHelper.drawSolidStroke isn't implemented!");this._buildPath(Ct(t).rings,!0)}const o=this._ctx;o.strokeStyle=typeof e=="string"?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",o.lineWidth=Math.max(this.transformSize(i),.5),this._setCapStyle(r),this._setJoinStyle(s),o.miterLimit=n,o.stroke()}pushClipPath(t){if(this._ctx.save(),q(t))this._buildPath(t.rings,!0);else if(at(t))this._buildPath(t.paths,!0);else{if(!U(t))return;this._buildPath(Ct(t).rings,!0)}this._ctx.clip("evenodd")}popClipPath(){this._ctx.restore()}drawImage(t,e){const{colorSubstitutions:i,url:r,tintColor:s}=t,n=b(t.scaleX,1),o=this._resourceManager.getResource(r);if(o==null)return;let a=e*(o.width/o.height),l=e;e||(a=o.width,l=o.height);const h=It(r)||"src"in o&&It(o.src);let u="getFrame"in o?Be(o):o;i&&(u=this._colorSubstitutionHelper.applyColorSubstituition(u,i)),this._applyAdditionalRenderProps&&!h&&s&&(u=this._colorSubstitutionHelper.tintImageData(u,s));const m=this.transformPt([0,0]),[f,_]=this.getTransformAngle(),p=this.transformSize(1),d=this._ctx;d.save(),d.setTransform({m11:n*p*f,m12:n*p*_,m21:-p*_,m22:p*f,m41:m[0],m42:m[1]}),d.drawImage(u,-a/2,-l/2,a,l),d.restore()}drawText(t,e){if(!e||e.length===0)return;this._textRasterizer||(this._textRasterizer=new xs);const i=Ls(t);i.size*=this.transformSize(zt(1));const r=this._textRasterizer.rasterizeText(e,i);if(!r)return;const{size:s,anchorX:n,anchorY:o,canvas:a}=r,l=s[0]*(n+.5),h=s[1]*(o-.5),u=this._ctx,m=this.transformPt([0,0]),[f,_]=this.getTransformAngle(),p=1;u.save(),u.setTransform({m11:p*f,m12:p*_,m21:-p*_,m22:p*f,m41:m[0]-p*l,m42:m[1]+p*h}),u.drawImage(a,0,0),u.restore()}drawPictureFill(t,e){if(!t)return;let{colorSubstitutions:i,height:r,offsetX:s,offsetY:n,rotation:o,scaleX:a,tintColor:l,url:h}=e;const u=this._resourceManager.getResource(h);if(u==null)return;if(q(t))this._buildPath(t.rings,!0);else if(at(t))this._buildPath(t.paths,!0);else if(U(t))this._buildPath(Ct(t).rings,!0);else{if(!Ge(t))return;console.log("CanvasDrawHelper.drawPictureFill - No implementation!")}const m=this._ctx,f=It(h)||"src"in u&&It(u.src);let _,p="getFrame"in u?Be(u):u;if(i&&(p=this._colorSubstitutionHelper.applyColorSubstituition(p,i)),this._applyAdditionalRenderProps){f||l&&(p=this._colorSubstitutionHelper.tintImageData(p,l)),_=m.createPattern(p,"repeat");const d=this.transformSize(1);o||(o=0),s?s*=d:s=0,n?n*=d:n=0,r&&(r*=d);const g=r?r/u.height:1,y=a&&r?a*r/u.width:1;if(o!==0||g!==1||y!==1||s!==0||n!==0){const P=new DOMMatrix;P.rotateSelf(0,0,-o).translateSelf(s,n).scaleSelf(y,g,1),_.setTransform(P)}}else _=m.createPattern(p,"repeat");m.save(),m.fillStyle=_,m.fill("evenodd"),m.restore()}drawPictureStroke(t,e){if(!t)return;let{colorSubstitutions:i,capStyle:r,joinStyle:s,miterLimit:n,tintColor:o,url:a,width:l}=e;const h=this._resourceManager.getResource(a);if(h==null)return;let u;if(q(t))u=t.rings;else if(at(t))u=t.paths;else{if(!U(t))return Ge(t)?void console.log("CanvasDrawHelper.drawPictureStroke - No implementation!"):void 0;u=Ct(t).rings}l||(l=h.width);const m=It(a)||"src"in h&&It(h.src);let f="getFrame"in h?Be(h):h;i&&(f=this._colorSubstitutionHelper.applyColorSubstituition(f,i)),this._applyAdditionalRenderProps&&(m||o&&(f=this._colorSubstitutionHelper.tintImageData(f,o)));const _=Math.max(this.transformSize(J(l)),.5),p=_/f.width,d=this._ctx,g=d.createPattern(f,"repeat-y");let y,P;d.save(),this._setCapStyle(r),this._setJoinStyle(s),n!==void 0&&(d.miterLimit=n),d.lineWidth=_;for(let M of u)if(M=ht(M),_n(M),M&&!(M.length<=1)){y=this.transformPt(M[0]);for(let x=1;x<M.length;x++){P=this.transformPt(M[x]);const S=mn(y,P),v=new DOMMatrix;v.translateSelf(0,y[1]-_/2).scaleSelf(p,p,1).rotateSelf(0,0,90-S),g.setTransform(v),d.strokeStyle=g,d.beginPath(),d.moveTo(y[0],y[1]),d.lineTo(P[0],P[1]),d.stroke(),y=P}}d.restore()}_buildPath(t,e){const i=this._ctx;if(i.beginPath(),t)for(const r of t){const s=r?r.length:0;if(s>1){let n=this.transformPt(r[0]);i.moveTo(n[0],n[1]);for(let o=1;o<s;o++)n=this.transformPt(r[o]),i.lineTo(n[0],n[1]);e&&i.closePath()}}}_setCapStyle(t){switch(t){case j.Butt:this._ctx.lineCap="butt";break;case j.Round:this._ctx.lineCap="round";break;case j.Square:this._ctx.lineCap="square"}}_setJoinStyle(t){switch(t){case lt.Bevel:this._ctx.lineJoin="bevel";break;case lt.Round:this._ctx.lineJoin="round";break;case lt.Miter:this._ctx.lineJoin="miter"}}}function mn(c,t){const e=t[0]-c[0],i=t[1]-c[1];return 180/Math.PI*Math.atan2(i,e)}const Ct=c=>c?{spatialReference:c.spatialReference,rings:[[[c.xmin,c.ymin],[c.xmin,c.ymax],[c.xmax,c.ymax],[c.xmax,c.ymin],[c.xmin,c.ymin]]]}:null,ws=c=>{switch(c){case"Left":return Me.Left;case"Right":return Me.Right;case"Center":return Me.Center;case"Justify":return vs.warnOnce("Horizontal alignment 'justify' is not implemented. Falling back to 'center'."),Me.Center}},ks=c=>{switch(c){case"Top":return Gt.Top;case"Center":return Gt.Center;case"Bottom":return Gt.Bottom;case"Baseline":return Gt.Baseline}},Is=(c,t,e)=>{switch(c){case"ExtraLeading":return 1+t/e;case"Multiple":return t;case"Exact":return t/e}};function Ls(c,t=1){var g;const e=ci(c),i=ui(c.fontStyleName),r=c.fontFamilyName??Ki,{weight:s,style:n}=i,o=t*(c.height||5),a=Bi(c.horizontalAlignment),l=Wi(c.verticalAlignment),h=wt(c),u=wt(c.haloSymbol),m=u?t*(0|c.haloSize):0,f=((g=c.callout)==null?void 0:g.type)==="CIMBackgroundCallout"?c.callout.backgroundSymbol:null,_=wt(f),p=ei(f),d=we(f);return{color:h,size:o,horizontalAlignment:a,verticalAlignment:l,font:{family:r,style:Qs(n),weight:tr(s),decoration:e},halo:{size:m||0,color:u,style:n},backgroundColor:_,borderLine:p!=null&&d!=null?{size:p,color:d}:null,pixelRatio:1,premultiplyColors:!0}}const pn=1e-4;function _n(c){let t,e,i,r,s,n=c[0],o=1;for(;o<c.length;)t=c[o][0]-n[0],e=c[o][1]-n[1],r=t!==0?e/t:Math.PI/2,i!==void 0&&r-i<=pn?(c.splice(o-1,1),n=s):(s=n,n=c[o],o++),i=r}function Lt(c,t,e,i,r){if(c==null)return null;const s=c.referencesGeometry()&&r?dn(t,i,r):t,n=c.repurposeFeature(s);try{return c.evaluate({...e,$feature:n},c.services)}catch(o){return he.getLogger("esri.views.2d.support.arcadeOnDemand").warn("Feature arcade evaluation failed:",o),null}}const Ue=new Map;function dn(c,t,e){const{transform:i,hasZ:r,hasM:s}=e;Ue.has(t)||Ue.set(t,gn(t));const n=Ue.get(t)(c.geometry,i,r,s);return{...c,geometry:n}}function gn(c){const t={};switch(c){case"esriGeometryPoint":return(e,i,r,s)=>_r(i,t,e,r,s);case"esriGeometryPolygon":return(e,i,r,s)=>pr(i,t,e,r,s);case"esriGeometryPolyline":return(e,i,r,s)=>mr(i,t,e,r,s);case"esriGeometryMultipoint":return(e,i,r,s)=>fr(i,t,e,r,s);default:return he.getLogger("esri.views.2d.support.arcadeOnDemand").error(new Xs("mapview-arcade",`Unable to handle geometryType: ${c}`)),e=>e}}const zs=Math.PI,yn=zs/2,Oi=Math.PI/180,Q=96/72,Ti=4,Oe=he.getLogger("esri.symbols.cim.CIMSymbolHelper");function Uo(c){if(!(c!=null&&c.type))return null;let t;switch(c.type){case"cim":return c.data;case"web-style":return c;case"simple-marker":{const e=Y.fromSimpleMarker(c);if(!e)return null;t=e;break}case"picture-marker":t=Y.fromPictureMarker(c);break;case"simple-line":t=Y.fromSimpleLineSymbol(c);break;case"simple-fill":t=Y.fromSimpleFillSymbol(c);break;case"picture-fill":t=Y.fromPictureFillSymbol(c);break;case"text":t=Y.fromTextSymbol(c)}return{type:"CIMSymbolReference",symbol:t}}function ke(c,t,e){switch(t.type){case"CIMSymbolReference":return ke(c,t.symbol,e);case"CIMPointSymbol":e==null&&(e={x:0,y:0}),c.drawSymbol(t,e);break;case"CIMLineSymbol":e==null&&(e={paths:[[[0,0],[10,0]]]}),c.drawSymbol(t,e);break;case"CIMPolygonSymbol":e==null&&(e={rings:[[[0,0],[0,10],[10,10],[10,0],[0,0]]]}),c.drawSymbol(t,e);break;case"CIMTextSymbol":{const i={x:0,y:0};c.drawSymbol(t,i);break}case"CIMVectorMarker":{const i=new Ot;c.drawMarker(t,i);break}}return c.envelope()}function Pn(c){if(!c)return 0;switch(c.type){case"CIMMarkerPlacementAlongLineSameSize":case"CIMMarkerPlacementAlongLineRandomSize":case"CIMMarkerPlacementAtExtremities":case"CIMMarkerPlacementAtMeasuredUnits":case"CIMMarkerPlacementAtRatioPositions":case"CIMMarkerPlacementOnLine":case"CIMMarkerPlacementOnVertices":return Math.abs(c.offset);default:return 0}}function Mn(c){if(!c)return 0;switch(c.type){case"CIMGeometricEffectArrow":return Math.abs(.5*c.width);case"CIMGeometricEffectBuffer":return Math.abs(c.size);case"CIMGeometricEffectExtension":case"CIMGeometricEffectRadial":return Math.abs(c.length);case"CIMGeometricEffectJog":return Math.abs(.5*c.length);case"CIMGeometricEffectMove":return Math.max(Math.abs(b(c.offsetX)),Math.abs(b(c.offsetY)));case"CIMGeometricEffectOffset":case"CIMGeometricEffectOffsetTangent":return Math.abs(c.offset);case"CIMGeometricEffectRegularPolygon":return Math.abs(c.radius);case"CIMGeometricEffectRotate":case"CIMGeometricEffectScale":default:return 0;case"CIMGeometricEffectTaperedPolygon":return .5*Math.max(Math.abs(c.fromWidth),Math.abs(c.toWidth));case"CIMGeometricEffectWave":return Math.abs(c.amplitude);case"CIMGeometricEffectDonut":return Math.abs(c.width)}}function Te(c){if(!c)return 0;let t=0;for(const e of c)t+=Mn(e);return t}class Jo{getSymbolInflateSize(t,e,i,r,s){return t||(t=[0,0,0,0]),e?this._getInflateSize(t,e,i,r,s):t}static safeSize(t){const e=Math.max(Math.abs(t[0]),Math.abs(t[2])),i=Math.max(Math.abs(t[1]),Math.abs(t[3]));return Math.sqrt(e*e+i*i)}_vectorMarkerBounds(t,e,i,r){let s=!0;const n=ti();if(e!=null&&e.markerGraphics)for(const o of e.markerGraphics){const a=[0,0,0,0];o.geometry&&(Di(n,o.geometry),a[0]=0,a[1]=0,a[2]=0,a[3]=0,this.getSymbolInflateSize(a,o.symbol,i,0,r),n[0]+=a[0],n[1]+=a[1],n[2]+=a[2],n[3]+=a[3],s?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],s=!1):(t[0]=Math.min(t[0],n[0]),t[1]=Math.min(t[1],n[1]),t[2]=Math.max(t[2],n[2]),t[3]=Math.max(t[3],n[3])))}return t}_getInflateSize(t,e,i,r,s){if(wn(e)){const n=this._getLayersInflateSize(t,e.symbolLayers,i,r,s),o=Te(e.effects);return o>0&&(n[0]-=o,n[1]-=o,n[2]+=o,n[3]+=o),n}return this._getTextInflatedSize(t,e,s)}_getLayersInflateSize(t,e,i,r,s){let n=!0;if(!e)return t;for(const o of e){if(!o)continue;let a=[0,0,0,0];switch(o.type){case"CIMSolidFill":case"CIMPictureFill":case"CIMHatchFill":case"CIMGradientFill":break;case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":{const h=o;let u=h.width;u!=null&&(h.capStyle===j.Square||h.joinStyle===lt.Miter?u/=1.4142135623730951:u/=2,a[0]=-u,a[1]=-u,a[2]=u,a[3]=u);break}case"CIMCharacterMarker":case"CIMVectorMarker":case"CIMPictureMarker":{const h=o;if(o.type==="CIMVectorMarker"){const p=o;if(a=this._vectorMarkerBounds(a,p,i,s),p.frame){const d=(p.frame.xmin+p.frame.xmax)/2,g=(p.frame.ymin+p.frame.ymax)/2;if(a[0]-=d,a[1]-=g,a[2]-=d,a[3]-=g,p.size!=null){const y=p.size/(p.frame.ymax-p.frame.ymin);a[0]*=y,a[1]*=y,a[2]*=y,a[3]*=y}}}else if(o.type==="CIMPictureMarker"){const p=o,d=i.getResource(p.url);let g=1;if(d!=null&&d.height&&(g=d.width/d.height),h.size!=null){const y=h.size/2,P=h.size*g*p.scaleX/2;a=[-P,-y,P,y]}}else if(h.size!=null){const p=h.size/2;a=[-p,-p,p,p]}if(h.anchorPoint){let p,d;h.anchorPointUnits==="Absolute"?(p=h.anchorPoint.x,d=h.anchorPoint.y):(p=h.anchorPoint.x*(a[2]-a[0]),d=h.anchorPoint.y*(a[3]-a[1])),a[0]-=p,a[1]-=d,a[2]-=p,a[3]-=d}let u=b(h.rotation);if(h.rotateClockwise&&(u=-u),r&&(u-=r),u){const p=Oi*u,d=Math.cos(p),g=Math.sin(p),y=ti([de,de,-de,-de]);_e(y,[a[0]*d-a[1]*g,a[0]*g+a[1]*d]),_e(y,[a[0]*d-a[3]*g,a[0]*g+a[3]*d]),_e(y,[a[2]*d-a[1]*g,a[2]*g+a[1]*d]),_e(y,[a[2]*d-a[3]*g,a[2]*g+a[3]*d]),a=y}let m=b(h.offsetX),f=b(h.offsetY);if(r){const p=Oi*r,d=Math.cos(p),g=Math.sin(p),y=m*g+f*d;m=m*d-f*g,f=y}a[0]+=m,a[1]+=f,a[2]+=m,a[3]+=f;const _=Pn(h.markerPlacement);_>0&&(a[0]-=_,a[1]-=_,a[2]+=_,a[3]+=_);break}}const l=Te(o.effects);l>0&&(a[0]-=l,a[1]-=l,a[2]+=l,a[3]+=l),n?(t[0]=a[0],t[1]=a[1],t[2]=a[2],t[3]=a[3],n=!1):(t[0]=Math.min(t[0],a[0]),t[1]=Math.min(t[1],a[1]),t[2]=Math.max(t[2],a[2]),t[3]=Math.max(t[3],a[3]))}return t}_getTextInflatedSize(t,e,i){var p,d;const r=e.height??Ee;if(t[0]=-r/2,t[1]=-r/2,t[2]=r/2,t[3]=r/2,!i)return t;const s=i.get(e);if(!s)return t;const{text:n,mosaicItem:o}=s;if(!((p=o==null?void 0:o.glyphMosaicItems)!=null&&p.length))return t;const{lineGapType:a,lineGap:l}=e,h=a?Is(a,l??0,r):0,u=fi(n)[1],m=o.glyphMosaicItems,f=((d=e.callout)==null?void 0:d.type)==="CIMBackgroundCallout",_=Cs(m,u,{scale:r/Ui,angle:b(e.angle),xOffset:b(e.offsetX),yOffset:b(e.offsetY),hAlign:ws(e.horizontalAlignment),vAlign:ks(e.verticalAlignment),maxLineWidth:512,lineHeight:Ji*Math.max(.25,Math.min(h||1,4)),decoration:e.font.decoration||"none",isCIM:!0,hasBackground:f}).boundsT;return t[0]=_.x-_.halfWidth,t[1]=-_.y-_.halfHeight,t[2]=_.x+_.halfWidth,t[3]=-_.y+_.halfHeight,t}}class Y{static getEnvelope(t,e,i){if(!t)return null;const r=new un(i);if(Array.isArray(t)){let s;for(const n of t)s?s.union(ke(r,n,e)):s=ke(r,n,e);return s}return ke(r,t,e)}static getTextureAnchor(t,e){const i=this.getEnvelope(t,null,e);if(!i)return[0,0,0];const r=(i.x+.5*i.width)*Q,s=(i.y+.5*i.height)*Q,n=i.width*Q+2,o=i.height*Q+2;return[-r/n,-s/o,o]}static rasterize(t,e,i,r,s=!0){const n=i||this.getEnvelope(e,null,r);if(!n)return[null,0,0,0,0];const o=(n.x+.5*n.width)*Q,a=(n.y+.5*n.height)*Q;t.width=n.width*Q,t.height=n.height*Q,i||(t.width+=2,t.height+=2);const l=t.getContext("2d"),h=bt.createScale(Q,-Q);h.translate(.5*t.width-o,.5*t.height+a);const u=new fn(l,r,h);switch(e.type){case"CIMPointSymbol":{const _={type:"point",x:0,y:0};u.drawSymbol(e,_);break}case"CIMVectorMarker":{const _=new Ot;u.drawMarker(e,_);break}}const m=l.getImageData(0,0,t.width,t.height),f=new Uint8Array(m.data);if(s){let _;for(let p=0;p<f.length;p+=4)_=f[p+3]/255,f[p]=f[p]*_,f[p+1]=f[p+1]*_,f[p+2]=f[p+2]*_}return[f,t.width,t.height,-o/t.width,-a/t.height]}static fromTextSymbol(t){const{angle:e,color:i,font:r,haloColor:s,haloSize:n,horizontalAlignment:o,kerning:a,text:l,verticalAlignment:h,xoffset:u,yoffset:m,backgroundColor:f,borderLineColor:_,borderLineSize:p}=t;let d,g,y,P,M,x;r&&(d=r.family,g=r.style,y=r.weight,P=r.size,M=r.decoration);let S=!1;return l&&(S=fi(l)[1]),(f||p)&&(x={type:"CIMBackgroundCallout",margin:null,backgroundSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",color:D(f)},{type:"CIMSolidStroke",color:D(_),width:p}]},accentBarSymbol:null,gap:null,leaderLineSymbol:null,lineStyle:null}),{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,anchorPointUnits:"Relative",dominantSizeAxis3D:"Y",size:10,billboardMode3D:"FaceNearPlane",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",angle:e,blockProgression:Ws.BTT,depth3D:1,extrapolateBaselines:!0,fontEffects:Us.Normal,fontEncoding:Js.Unicode,fontFamilyName:d||"Arial",fontStyleName:Sn(g,y),fontType:qs.Unspecified,haloSize:n,height:P,hinting:js.Default,horizontalAlignment:xn(o??"center"),kerning:a,letterWidth:100,ligatures:!0,lineGapType:"Multiple",offsetX:b(u),offsetY:b(m),strikethrough:M==="line-through",underline:M==="underline",symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:D(i)}]},haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:D(s)}]},shadowColor:[0,0,0,255],shadowOffsetX:1,shadowOffsetY:1,textCase:"Normal",textDirection:S?xi.RTL:xi.LTR,verticalAlignment:bn(h??"baseline"),verticalGlyphOrientation:Ks.Right,wordSpacing:100,billboardMode3D:Zs.FaceNearPlane,callout:x},textString:l}],scaleSymbolsProportionally:!0,respectFrame:!0}],scaleX:1,angleAlignment:"Display"}}static fromPictureFillSymbol(t){const{height:e,outline:i,width:r,xoffset:s,xscale:n,yoffset:o,yscale:a}=t,l=[],h={type:"CIMPolygonSymbol",symbolLayers:l};if(i){const p=Ai(i);p&&l.push(p)}let u=t.url;t.type==="esriPFS"&&t.imageData&&(u=t.imageData);const m="angle"in t?t.angle??0:0,f=(r??0)*(n||1),_=(e??0)*(a||1);return l.push({type:"CIMPictureFill",invertBackfaceTexture:!1,scaleX:1,textureFilter:bi.Picture,tintColor:null,url:u,height:_,width:f,offsetX:b(s),offsetY:b(o),rotation:b(-m),colorSubstitutions:null}),h}static fromSimpleFillSymbol(t){const{color:e,style:i,outline:r}=t,s=[],n={type:"CIMPolygonSymbol",symbolLayers:s};if(r){const o=Ai(r);o&&s.push(o)}if(i&&i!=="solid"&&i!=="none"&&i!=="esriSFSSolid"&&i!=="esriSFSNull"){const o={type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",color:D(e),capStyle:j.Butt,joinStyle:lt.Miter,width:.75}]};let a=0;const l=zt(kn(i)?8:10);switch(i){case"vertical":case"esriSFSVertical":a=90;break;case"forward-diagonal":case"esriSFSForwardDiagonal":case"diagonal-cross":case"esriSFSDiagonalCross":a=-45;break;case"backward-diagonal":case"esriSFSBackwardDiagonal":a=45;break;case"cross":case"esriSFSCross":a=0}s.push({type:"CIMHatchFill",lineSymbol:o,offsetX:0,offsetY:0,rotation:a,separation:l}),i==="cross"||i==="esriSFSCross"?s.push({type:"CIMHatchFill",lineSymbol:ht(o),offsetX:0,offsetY:0,rotation:90,separation:l}):i!=="diagonal-cross"&&i!=="esriSFSDiagonalCross"||s.push({type:"CIMHatchFill",lineSymbol:ht(o),offsetX:0,offsetY:0,rotation:45,separation:l})}else!i||i!=="solid"&&i!=="esriSFSSolid"||s.push({type:"CIMSolidFill",enable:!0,color:D(e)});return n}static fromSimpleLineSymbol(t){const{cap:e,color:i,join:r,marker:s,miterLimit:n,style:o,width:a}=t;let l=null;o!=="solid"&&o!=="none"&&o!=="esriSLSSolid"&&o!=="esriSLSNull"&&(l=[{type:"CIMGeometricEffectDashes",dashTemplate:oi(o,e),lineDashEnding:"NoConstraint",scaleDash:!0,offsetAlongLine:null}]);const h=[];if(s){let u;switch(s.placement){case"begin-end":u=_t.Both;break;case"begin":u=_t.JustBegin;break;case"end":u=_t.JustEnd;break;default:u=_t.None}const m=Y.fromSimpleMarker(s,a,i).symbolLayers[0];m.markerPlacement={type:"CIMMarkerPlacementAtExtremities",angleToLine:!0,offset:0,extremityPlacement:u,offsetAlongLine:0},h.push(m)}return h.push({type:"CIMSolidStroke",color:o!=="none"&&o!=="esriSLSNull"?D(i):[0,0,0,0],capStyle:Os(e),joinStyle:Ts(r),miterLimit:n,width:a,effects:l}),{type:"CIMLineSymbol",symbolLayers:h}}static fromPictureMarker(t){const{angle:e,height:i,width:r,xoffset:s,yoffset:n}=t;let o=t.url;return t.type==="esriPMS"&&t.imageData&&(o=t.imageData),{type:"CIMPointSymbol",symbolLayers:[{type:"CIMPictureMarker",invertBackfaceTexture:!1,scaleX:1,textureFilter:bi.Picture,tintColor:null,url:o,size:i,width:r,offsetX:b(s),offsetY:b(n),rotation:b(-e)}]}}static fromSimpleMarker(t,e,i){const{style:r}=t,s=t.color??i;if(r==="path"){const h=[];if("outline"in t&&t.outline){const f=t.outline;h.push({type:"CIMSolidStroke",enable:!0,width:J(Math.round(zt(f.width))),color:D(f.color),path:t.path})}h.push({type:"CIMSolidFill",enable:!0,color:D(s),path:t.path});const[u,m]=Nt("square");return{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,rotation:b(-t.angle),size:b(t.size||6),offsetX:b(t.xoffset),offsetY:b(t.yoffset),frame:u,markerGraphics:[{type:"CIMMarkerGraphic",geometry:m,symbol:{type:"CIMPolygonSymbol",symbolLayers:h}}]}]}}const n=[];let o,a;if("outline"in t&&t.outline&&t.outline.style!=="none"&&t.outline.style!=="esriSLSNull"){const h=t.outline,u=h.style!=="solid"&&h.style!=="esriSLSSolid";[o,a]=u?Nt(r,t.size):Nt(r);const m=t.style!=="cross"&&t.style!=="x"||(t==null?void 0:t.outline.style)==="dot"||(t==null?void 0:t.outline.style)==="short-dot"?X.HalfGap:X.FullPattern,f=u?[{type:"CIMGeometricEffectAddControlPoints"},{type:"CIMGeometricEffectDashes",dashTemplate:oi(h.style,null).map(_=>h.width&&h.width>0?_*h.width:_),lineDashEnding:m,controlPointEnding:X.FullPattern}]:void 0;n.push({type:"CIMSolidStroke",capStyle:u?j.Round:j.Butt,enable:!0,width:h.width!=null&&h.width>.667?J(Math.round(zt(h.width))):h.width,color:D(h.color),effects:f})}else!e||t.type!=="line-marker"||t.style!=="cross"&&t.style!=="x"?[o,a]=Nt(r):([o,a]=Nt(r),n.push({type:"CIMSolidStroke",enable:!0,width:e,color:D(s)}));n.push({type:"CIMSolidFill",enable:!0,color:D(s)});const l={type:"CIMPolygonSymbol",symbolLayers:n};return{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,rotation:b(-t.angle),size:b(t.size||6*e),offsetX:b(t.xoffset),offsetY:b(t.yoffset),frame:o,markerGraphics:[{type:"CIMMarkerGraphic",geometry:a,symbol:l}]}]}}static fromCIMHatchFill(t,e){var a;const i=e*(t.separation??_i),r=i/2,s=ht(t.lineSymbol);(a=s.symbolLayers)==null||a.forEach(l=>{var h;switch(l.type){case"CIMSolidStroke":l.width!=null&&(l.width*=e),(h=l.effects)==null||h.forEach(u=>{u.type==="CIMGeometricEffectDashes"&&(u.dashTemplate=u.dashTemplate.map(m=>m*e))});break;case"CIMVectorMarker":{l.size!=null&&(l.size*=e);const u=l.markerPlacement;u!=null&&"placementTemplate"in u&&(u.placementTemplate=u.placementTemplate.map(m=>m*e));break}}});let n=this._getLineSymbolPeriod(s)||Ti;for(;n<Ti;)n*=2;const o=n/2;return{type:"CIMVectorMarker",frame:{xmin:-o,xmax:o,ymin:-r,ymax:r},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{paths:[[[-o,0],[o,0]]]},symbol:s}],size:i}}static fetchResources(t,e,i){if(t&&e)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":{const r=t.symbolLayers;if(!r)return;for(const s of r)switch(Ln(s,e,i),s.type){case"CIMPictureFill":case"CIMHatchFill":case"CIMGradientFill":case"CIMPictureStroke":case"CIMGradientStroke":case"CIMCharacterMarker":case"CIMPictureMarker":"url"in s&&s.url&&i.push(e.fetchResource(s.url,null));break;case"CIMVectorMarker":{const n=s.markerGraphics;if(!n)continue;for(const o of n)if(o){const a=o.symbol;a&&Y.fetchResources(a,e,i)}}}break}}}static fetchFonts(t,e,i){if(t&&e){if("symbolLayers"in t&&t.symbolLayers){for(const r of t.symbolLayers)if(r.type==="CIMVectorMarker"&&r.markerGraphics)for(const s of r.markerGraphics)s!=null&&s.symbol&&Y.fetchFonts(s.symbol,e,i)}else if(t.type==="CIMTextSymbol"){const{fontFamilyName:r,fontStyleName:s}=t;if(!r||r.toLowerCase()==="calcitewebcoreicons")return;const{style:n,weight:o}=ui(s),a=ci(t),l=new Hs({family:r,style:n,weight:o,decoration:a});i.push(e.loadFont(l).catch(()=>{Oe.error(`Unsupported font ${r} in CIM symbol`)}))}}}static _getLineSymbolPeriod(t){if(t){const e=this._getEffectsRepeat(t.effects);if(e)return e;if(t.symbolLayers){for(const i of t.symbolLayers)if(i){const r=this._getEffectsRepeat(i.effects);if(r)return r;switch(i.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const s=this._getPlacementRepeat(i.markerPlacement);if(s)return s}}}}}return 0}static _getEffectsRepeat(t){if(t){for(const e of t)if(e)switch(e.type){case"CIMGeometricEffectDashes":{const i=e.dashTemplate;if(i&&i.length){let r=0;for(const s of i)r+=s;return 1&i.length&&(r*=2),r}break}case"CIMGeometricEffectWave":return e.period;default:Oe.error(`unsupported geometric effect type ${e.type}`)}}return 0}static _getPlacementRepeat(t){if(t)switch(t.type){case"CIMMarkerPlacementAlongLineSameSize":case"CIMMarkerPlacementAlongLineRandomSize":case"CIMMarkerPlacementAlongLineVariableSize":{const e=t.placementTemplate;if(e&&e.length){let i=0;for(const r of e)i+=+r;return 1&e.length&&(i*=2),i}break}}return 0}static fromCIMInsidePolygon(t){const e=t.markerPlacement,i={...t};i.markerPlacement=null,i.anchorPoint=null;const r=Math.abs(e.stepX),s=Math.abs(e.stepY),n=(e.randomness??100)/100;let o,a,l,h;if(e.gridType==="Random"){const u=zt(qi),m=Math.max(Math.floor(u/r),1),f=Math.max(Math.floor(u/s),1);o=m*r/2,a=f*s/2,l=2*a;const _=new Ri(e.seed),p=n*r/1.5,d=n*s/1.5;h=[];for(let g=0;g<m;g++)for(let y=0;y<f;y++){const P=g*r-o+p*(.5-_.getFloat()),M=y*s-a+d*(.5-_.getFloat());h.push({x:P,y:M}),g===0&&h.push({x:P+2*o,y:M}),y===0&&h.push({x:P,y:M+2*a})}}else e.shiftOddRows===!0?(o=r/2,a=s,l=2*s,h=[{x:-o,y:0},{x:o,y:0},{x:0,y:a},{x:0,y:-a}]):(o=r/2,a=s/2,l=s,h=[{x:-r,y:0},{x:0,y:-s},{x:-r,y:-s},{x:0,y:0},{x:r,y:0},{x:0,y:s},{x:r,y:s},{x:-r,y:s},{x:r,y:-s}]);return{type:"CIMVectorMarker",frame:{xmin:-o,xmax:o,ymin:-a,ymax:a},markerGraphics:h.map(u=>({type:"CIMMarkerGraphic",geometry:u,symbol:{type:"CIMPointSymbol",symbolLayers:[i]}})),size:l}}static getSize(t){if(t)switch(t.type){case"CIMTextSymbol":return t.height;case"CIMPointSymbol":{let e=0;if(t.symbolLayers){for(const i of t.symbolLayers)if(i)switch(i.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const r=i.size;r!=null&&r>e&&(e=r);break}}}return e}case"CIMLineSymbol":case"CIMPolygonSymbol":{let e=0;if(t.symbolLayers){for(const i of t.symbolLayers)if(i)switch(i.type){case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":{const r=i.width;r!=null&&r>e&&(e=r);break}case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":if(i.markerPlacement&&er(i.markerPlacement)){const r=i.size;r!=null&&r>e&&(e=r)}}}return e}}}static getMarkerScaleRatio(t){if(t&&t.type==="CIMVectorMarker"&&t.scaleSymbolsProportionally!==!1&&t.frame&&t.size!=null){const e=t.frame.ymax-t.frame.ymin;return t.size/e}return 1}}class O{static findApplicableOverrides(t,e,i){if(t&&e){if(t.primitiveName){let r=!1;for(const s of i)if(s.primitiveName===t.primitiveName){r=!0;break}if(!r)for(const s of e)s.primitiveName===t.primitiveName&&i.push(s)}switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(t.effects)for(const r of t.effects)O.findApplicableOverrides(r,e,i);if(t.symbolLayers)for(const r of t.symbolLayers)O.findApplicableOverrides(r,e,i);break;case"CIMTextSymbol":break;case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":case"CIMSolidFill":case"CIMPictureFill":case"CIMHatchFill":case"CIMGradientFill":case"CIMVectorMarker":case"CIMCharacterMarker":case"CIMPictureMarker":if(t.effects)for(const r of t.effects)O.findApplicableOverrides(r,e,i);if(t.markerPlacement&&O.findApplicableOverrides(t.markerPlacement,e,i),t.type==="CIMVectorMarker"){if(t.markerGraphics)for(const r of t.markerGraphics)O.findApplicableOverrides(r,e,i),O.findApplicableOverrides(r.symbol,e,i)}else t.type==="CIMCharacterMarker"?O.findApplicableOverrides(t.symbol,e,i):t.type==="CIMHatchFill"?O.findApplicableOverrides(t.lineSymbol,e,i):t.type==="CIMPictureMarker"&&O.findApplicableOverrides(t.animatedSymbolProperties,e,i)}}}static findEffectOverrides(t,e,i){if(!e||!t)return;const r=t.length;for(let s=0;s<r;s++){const n=t[s],o=n==null?void 0:n.primitiveName;if(o){let a=!1;for(const l of i)if(l.primitiveName===o){a=!0;break}if(!a)for(const l of e)l.primitiveName===o&&i.push(l)}}}static async resolveSymbolOverrides(t,e,i,r,s,n,o){if(!(t!=null&&t.symbol))return null;let{symbol:a,primitiveOverrides:l}=t;const h=!!l;if(!h&&!r)return a;a=ht(a);let u=!0;if(e||(e={attributes:{}},u=!1),h){if(u||(l=l.filter(m=>{var f;return!((f=m.valueExpressionInfo)!=null&&f.expression.includes("$feature"))})),o||(l=l.filter(m=>{var f;return!((f=m.valueExpressionInfo)!=null&&f.expression.includes("$view"))})),l.length>0){const m=rr(e.attributes);await O.evaluateOverrides(l,e,{spatialReference:i,fields:m,geometryType:s},n,o)}O.applyOverrides(a,l)}return r&&O.applyDictionaryTextOverrides(a,e,r),a}static async evaluateOverrides(t,e,i,r,s){if(!e)return;let n;for(const o of t){const a=o.valueExpressionInfo;if(a&&(i!=null&&i.geometryType)){n||(n=[]),o.value=void 0;const l=Yi(a.expression,i.spatialReference,i.fields).then(h=>{o.value=Lt(h,e,{$view:s},i.geometryType,r)});n.push(l)}}n!==void 0&&n.length>0&&await Promise.all(n)}static applyDictionaryTextOverrides(t,e,i,r="Normal"){if(t!=null&&t.type)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":case"CIMTextSymbol":{const s=t.symbolLayers;if(!s)return;for(const n of s)n&&n.type==="CIMVectorMarker"&&O.applyDictionaryTextOverrides(n,e,i,t.type==="CIMTextSymbol"?t.textCase:r)}break;case"CIMVectorMarker":{const s=t.markerGraphics;if(!s)return;for(const n of s)n&&O.applyDictionaryTextOverrides(n,e,i)}break;case"CIMMarkerGraphic":{const s=t.textString;if(s&&s.includes("[")){const n=nr(s,i);t.textString=or(e,n,r)}}}}static applyOverrides(t,e,i,r){if(t.primitiveName){for(const s of e)if(s.primitiveName===t.primitiveName){const n=In(s.propertyName);if(r&&r.push({cim:t,nocapPropertyName:n,value:t[n]}),s.expression&&(s.value=O.toValue(s.propertyName,s.expression)),i){let o=!1;for(const a of i)a.primitiveName===t.primitiveName&&(o=!0);o||i.push(s)}s.value!=null&&(t[n]=s.value)}}switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(t.effects)for(const s of t.effects)O.applyOverrides(s,e,i,r);if(t.symbolLayers)for(const s of t.symbolLayers)O.applyOverrides(s,e,i,r);break;case"CIMTextSymbol":break;case"CIMSolidStroke":case"CIMSolidFill":case"CIMVectorMarker":if(t.effects)for(const s of t.effects)O.applyOverrides(s,e,i,r);if(t.type==="CIMVectorMarker"&&t.markerGraphics)for(const s of t.markerGraphics)O.applyOverrides(s,e,i,r),O.applyOverrides(s.symbol,e,i,r)}}static restoreOverrides(t){for(const e of t)e.cim[e.nocapPropertyName]=e.value}static buildOverrideKey(t){let e="";for(const i of t)i.value!==void 0&&(e+=`${i.primitiveName}${i.propertyName}${JSON.stringify(i.value)}`);return e}static toValue(t,e){if(t==="DashTemplate")return e.split(" ").map(i=>Number(i));if(t==="Color"){const i=new Vi(e).toRgba();return i[3]*=255,i}return e}}const Os=c=>{if(!c)return j.Butt;switch(c){case"butt":return j.Butt;case"square":return j.Square;case"round":return j.Round}},Ts=c=>{if(!c)return lt.Miter;switch(c){case"miter":return lt.Miter;case"round":return lt.Round;case"bevel":return lt.Bevel}},xn=c=>{if(c==null)return"Center";switch(c){case"left":return"Left";case"right":return"Right";case"center":return"Center"}},bn=c=>{if(c==null)return"Center";switch(c){case"baseline":return"Baseline";case"top":return"Top";case"middle":return"Center";case"bottom":return"Bottom"}},D=c=>{if(!c)return[0,0,0,0];const{r:t,g:e,b:i,a:r}=c;return[t,e,i,255*r]},Sn=(c,t)=>{const e=Cn(t),i=vn(c);return e&&i?`${e}-${i}`:`${e}${i}`},Cn=c=>{if(!c)return"";switch(c.toLowerCase()){case"bold":case"bolder":return"bold"}return""},vn=c=>{if(!c)return"";switch(c.toLowerCase()){case"italic":case"oblique":return"italic"}return""},oi=(c,t)=>{const e=Ds("safari")?.001:0,i=t==="butt";switch(c){case"dash":case"esriSLSDash":return i?[4,3]:[3,4];case"dash-dot":case"esriSLSDashDot":return i?[4,3,1,3]:[3,4,e,4];case"dot":case"esriSLSDot":return i?[1,3]:[e,4];case"long-dash":case"esriSLSLongDash":return i?[8,3]:[7,4];case"long-dash-dot":case"esriSLSLongDashDot":return i?[8,3,1,3]:[7,4,e,4];case"long-dash-dot-dot":case"esriSLSDashDotDot":return i?[8,3,1,3,1,3]:[7,4,e,4,e,4];case"short-dash":case"esriSLSShortDash":return i?[4,1]:[3,2];case"short-dash-dot":case"esriSLSShortDashDot":return i?[4,1,1,1]:[3,2,e,2];case"short-dash-dot-dot":case"esriSLSShortDashDotDot":return i?[4,1,1,1,1,1]:[3,2,e,2,e,2];case"short-dot":case"esriSLSShortDot":return i?[1,1]:[e,2];case"solid":case"esriSLSSolid":case"none":return Oe.error("Unexpected: style does not require rasterization"),[0,0];default:return Oe.error(`Tried to rasterize SLS, but found an unexpected style: ${c}!`),[0,0]}};function wn(c){return c.symbolLayers!==void 0}const Nt=(c,t=100)=>{const e=t/2;let i,r;const s=c;if(s==="circle"||s==="esriSMSCircle"){let o=Math.acos(1-.25/e),a=Math.ceil(zs/o/4);a===0&&(a=1),o=yn/a,a*=4;const l=[];l.push([e,0]);for(let h=1;h<a;h++)l.push([e*Math.cos(h*o),-e*Math.sin(h*o)]);l.push([e,0]),i={rings:[l]},r={xmin:-e,ymin:-e,xmax:e,ymax:e}}else if(s==="cross"||s==="esriSMSCross")i={paths:[[[0,e],[0,-e]],[[e,0],[-e,0]]]},r={xmin:-e,ymin:-e,xmax:e,ymax:e};else if(s==="diamond"||s==="esriSMSDiamond")i={rings:[[[-e,0],[0,e],[e,0],[0,-e],[-e,0]]]},r={xmin:-e,ymin:-e,xmax:e,ymax:e};else if(s==="square"||s==="esriSMSSquare")i={rings:[[[-e,-e],[-e,e],[e,e],[e,-e],[-e,-e]]]},r={xmin:-e,ymin:-e,xmax:e,ymax:e};else if(s==="x"||s==="esriSMSX")i={paths:[[[e,e],[-e,-e]],[[e,-e],[-e,e]]]},r={xmin:-e,ymin:-e,xmax:e,ymax:e};else if(s==="triangle"||s==="esriSMSTriangle"){const n=t*.5773502691896257,o=-n,a=2/3*t,l=a-t;i={rings:[[[o,l],[0,a],[n,l],[o,l]]]},r={xmin:o,ymin:l,xmax:n,ymax:a}}else s==="arrow"&&(i={rings:[[[-50,50],[50,0],[-50,-50],[-33,-20],[-33,20],[-50,50]]]},r={xmin:-e,ymin:-e,xmax:e,ymax:e});return[r,i]},kn=c=>c==="vertical"||c==="horizontal"||c==="cross"||c==="esriSFSCross"||c==="esriSFSVertical"||c==="esriSFSHorizontal",In=c=>c&&c.charAt(0).toLowerCase()+c.substr(1);function Ln(c,t,e){if(!(!c.effects||t.geometryEngine!=null)){if(t.geometryEnginePromise)return void e.push(t.geometryEnginePromise);ir(c.effects)&&(t.geometryEnginePromise=sr(),e.push(t.geometryEnginePromise),t.geometryEnginePromise.then(i=>t.geometryEngine=i))}}function Ai(c){if(!c)return null;let t=null;const{cap:e,color:i,join:r,miterLimit:s,style:n,width:o}=c;return n!=="solid"&&n!=="none"&&n!=="esriSLSSolid"&&n!=="esriSLSNull"&&(t=[{type:"CIMGeometricEffectDashes",dashTemplate:oi(n,e),lineDashEnding:"NoConstraint",scaleDash:!0,offsetAlongLine:null}]),{type:"CIMSolidStroke",color:n!=="esriSLSNull"&&n!=="none"?D(i):[0,0,0,0],capStyle:Os(e),joinStyle:Ts(r),miterLimit:s,width:o,effects:t}}function zn(c){var t;if(!c)return null;switch(c.type){case"CIMPointSymbol":{const e=c.symbolLayers;return e&&e.length===1?zn(e[0]):null}case"CIMVectorMarker":{const e=c.markerGraphics;if(!e||e.length!==1)return null;const i=e[0];if(!i)return null;const r=i.geometry;if(!r)return null;const s=i.symbol;return!s||s.type!=="CIMPolygonSymbol"&&s.type!=="CIMLineSymbol"||(t=s.symbolLayers)!=null&&t.some(n=>!!n.effects)?null:{geom:r,asFill:s.type==="CIMPolygonSymbol"}}case"sdf":return{geom:c.geom,asFill:c.asFill}}return null}function On(c){return c?c.rings?c.rings:c.paths?c.paths:c.xmin!==void 0&&c.ymin!==void 0&&c.xmax!==void 0&&c.ymax!==void 0?[[[c.xmin,c.ymin],[c.xmin,c.ymax],[c.xmax,c.ymax],[c.xmax,c.ymin],[c.xmin,c.ymin]]]:null:null}function Tn(c){let t=1/0,e=-1/0,i=1/0,r=-1/0;for(const s of c)for(const n of s)n[0]<t&&(t=n[0]),n[0]>e&&(e=n[0]),n[1]<i&&(i=n[1]),n[1]>r&&(r=n[1]);return new Ms(t,i,e-t,r-i)}function $i(c){let t=1/0,e=-1/0,i=1/0,r=-1/0;for(const s of c)for(const n of s)n[0]<t&&(t=n[0]),n[0]>e&&(e=n[0]),n[1]<i&&(i=n[1]),n[1]>r&&(r=n[1]);return[t,i,e,r]}function Fi(c){return c?c.rings?$i(c.rings):c.paths?$i(c.paths):U(c)?[c.xmin,c.ymin,c.xmax,c.ymax]:null:null}function Ei(c,t,e,i,r){const[s,n,o,a]=c;if(o<s||a<n)return[0,0,0];const l=o-s,h=a-n,u=128,m=ji,f=Math.floor(.5*(.5*u-m)),_=(u-2*(f+m))/Math.max(l,h),p=Math.round(l*_)+2*f,d=Math.round(h*_)+2*f;let g=1;t&&(g=d/_/(t.ymax-t.ymin));let y=0,P=0,M=1;i&&(r?t&&e&&t.ymax-t.ymin>0&&(M=(t.xmax-t.xmin)/(t.ymax-t.ymin),y=i.x/(e*M),P=i.y/e):(y=i.x,P=i.y)),t&&(y=.5*(t.xmax+t.xmin)+y*(t.xmax-t.xmin),P=.5*(t.ymax+t.ymin)+P*(t.ymax-t.ymin)),y-=s,P-=n,y*=_,P*=_,y+=f,P+=f;let x=y/p-.5,S=P/d-.5;return r&&e&&(x*=e*M,S*=e),[g,x,S]}function qo(c){const t=On(c.geom),e=Tn(t),i=128,r=ji,s=Math.floor(.5*(.5*i-r)),n=(i-2*(s+r))/Math.max(e.width,e.height),o=Math.round(e.width*n)+2*s,a=Math.round(e.height*n)+2*s,l=[];for(const u of t)if(u&&u.length>1){const m=[];for(const f of u){let[_,p]=f;_-=e.x,p-=e.y,_*=n,p*=n,_+=s-.5,p+=s-.5,c.asFill?m.push([_,p]):m.push([Math.round(_),Math.round(p)])}if(c.asFill){const f=m.length-1;m[0][0]===m[f][0]&&m[0][1]===m[f][1]||m.push(m[0])}l.push(m)}const h=An(l,o,a,s);return c.asFill&&$n(l,o,a,s,h),[Fn(h,s),o,a]}function An(c,t,e,i){const r=t*e,s=new Array(r),n=i*i+1;for(let o=0;o<r;++o)s[o]=n;for(const o of c){const a=o.length;for(let l=1;l<a;++l){const h=o[l-1],u=o[l];let m,f,_,p;h[0]<u[0]?(m=h[0],f=u[0]):(m=u[0],f=h[0]),h[1]<u[1]?(_=h[1],p=u[1]):(_=u[1],p=h[1]);let d=Math.floor(m)-i,g=Math.floor(f)+i,y=Math.floor(_)-i,P=Math.floor(p)+i;d<0&&(d=0),g>t&&(g=t),y<0&&(y=0),P>e&&(P=e);const M=u[0]-h[0],x=u[1]-h[1],S=M*M+x*x;for(let v=d;v<g;v++)for(let C=y;C<P;C++){let I,L,T=(v-h[0])*M+(C-h[1])*x;T<0?(I=h[0],L=h[1]):T>S?(I=u[0],L=u[1]):(T/=S,I=h[0]+T*M,L=h[1]+T*x);const N=(v-I)*(v-I)+(C-L)*(C-L),z=(e-C-1)*t+v;N<s[z]&&(s[z]=N)}}}for(let o=0;o<r;++o)s[o]=Math.sqrt(s[o]);return s}function $n(c,t,e,i,r){for(const s of c){const n=s.length;for(let o=1;o<n;++o){const a=s[o-1],l=s[o];let h,u,m,f;a[0]<l[0]?(h=a[0],u=l[0]):(h=l[0],u=a[0]),a[1]<l[1]?(m=a[1],f=l[1]):(m=l[1],f=a[1]);let _=Math.floor(h),p=Math.floor(u)+1,d=Math.floor(m),g=Math.floor(f)+1;_<i&&(_=i),p>t-i&&(p=t-i),d<i&&(d=i),g>e-i&&(g=e-i);for(let y=d;y<g;++y){if(a[1]>y==l[1]>y)continue;const P=(e-y-1)*t;for(let M=_;M<p;++M)M<(l[0]-a[0])*(y-a[1])/(l[1]-a[1])+a[0]&&(r[P+M]=-r[P+M]);for(let M=i;M<_;++M)r[P+M]=-r[P+M]}}}}function Fn(c,t){const e=2*t,i=c.length,r=new Uint8Array(4*i);for(let s=0;s<i;++s){const n=.5-c[s]/e;dr(n,r,4*s)}return r}function En(c,t){let e;if(typeof c=="string")e=$(c+`-seed(${t})`);else{let i=12;e=c^t;do e=107*(e>>8^e)+i|0;while(--i!=0)}return(1+e/(1<<31))/2}function Nn(c){return Math.floor(En(c,Gn)*Rn)}const Gn=53290320,Rn=10,Xn=96/72;let Ni=class{static executeEffects(t,e,i,r){const s=Xn,n=Te(t);let o=new ii(e);for(const a of t){const l=si(a);l&&(o=l.execute(o,a,s,i,r,n))}return o}static applyEffects(t,e,i){if(!t)return e;const r=Te(t);let s,n=new ii(E.fromJSONCIM(e));for(const l of t){const h=si(l);h&&(n=h.execute(n,l,1,null,i,r))}const o=[];let a=null;for(;s=n.next();)o.push(...ai(s)),a=s.geometryType;return o.length===0||a===null?null:a==="esriGeometryPolygon"?{rings:o}:{paths:o}}};const Gi=.05;function Hn(c){return Math.max(Math.round(c/Gi),1)*Gi}const Dn=new Set(["StartTimeOffset","Duration","RepeatDelay"]);function Yn(c,t){return Dn.has(t)?Hn(c):c}const Vn=he.getLogger("esri.symbols.cim.cimAnalyzer");function Je(c){switch(c){case"Butt":return Xe.BUTT;case"Square":return Xe.SQUARE;default:return Xe.ROUND}}function qe(c){switch(c){case"Bevel":return He.BEVEL;case"Miter":return He.MITER;default:return He.ROUND}}function Bn(c){const t=c.markerPlacement;return t&&t.angleToLine?Ie.MAP:Ie.SCREEN}class Ko{constructor(t,e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],this._resourceManager=t,this._info=e}async analyzeSymbolReference(t,e,i){if(this._cimLayers=i??[],!t)return this._cimLayers;if(t.primitiveOverrides){this._primitiveOverrides=t.primitiveOverrides,this._poMap={};const n=[],o=this._info;for(const a of this._primitiveOverrides){const l=a.valueExpressionInfo;if(l&&o){const h=l.expression,u=Yi(h,o.spatialReference,o.fields).then(m=>{m!=null&&this._setPoMap(a.primitiveName,a.propertyName,m)});n.push(u)}else a.value!=null&&this._setPoMap(a.primitiveName,a.propertyName,a.value);n.length>0&&await Promise.all(n)}}const r=t.symbol,s=[];return Y.fetchResources(r,this._resourceManager,s),s.length>0&&await Promise.all(s),this._analyzeSymbol(r,e),this._cimLayers}_analyzeSymbol(t,e){switch(t==null?void 0:t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(t,e,1,0,0,0)}}_analyzeMultiLayerSymbol(t,e,i,r,s,n){const o=t==null?void 0:t.symbolLayers;if(!o)return;const a=t.effects;let l=Ie.SCREEN;const h=Y.getSize(t)??0;t.type==="CIMPointSymbol"&&t.angleAlignment==="Map"&&(l=Ie.MAP);const u=t.type==="CIMPolygonSymbol";let m=o.length;for(;m--;){const f=o[m];if(!f||f.enable===!1)continue;let _;a!=null&&a.length&&(_=[...a]);const p=f.effects;p!=null&&p.length&&(a?_.push(...p):_=[...p]);const d=[];let g;O.findEffectOverrides(_,this._primitiveOverrides,d),g=d.length>0?this._createEffectsOverrideFunction(_,d):_;const y=[];switch(O.findApplicableOverrides(f,this._primitiveOverrides,y),f.type){case"CIMSolidFill":this._analyzeSolidFill(f,g);break;case"CIMPictureFill":this._analyzePictureFill(f,g);break;case"CIMHatchFill":this._analyzeHatchFill(f,g);break;case"CIMGradientFill":this._analyzeGradientFill(f,g);break;case"CIMSolidStroke":this._analyzeSolidStroke(f,g,u,h);break;case"CIMPictureStroke":this._analyzePictureStroke(f,g,u,h);break;case"CIMGradientStroke":this._analyzeGradientStroke(f,g,u,h);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{t.type==="CIMLineSymbol"&&(l=Bn(f));const P=[],M=f.primitiveName;M&&P.push(M),this._analyzeMarker(f,g,null,P,l,h,1,e,i,r,s,n);break}default:Vn.error("Cannot analyze CIM layer",f.type)}}}_analyzeSolidFill(t,e){const i=t.primitiveName,r=H(t.color),[s,n]=this._analyzePrimitiveOverrides(i,e,null,null),o=$(JSON.stringify(t)+n).toString();this._cimLayers.push({type:"fill",templateHash:o,materialHash:s?()=>o:o,cim:t,materialOverrides:null,colorLocked:!!t.colorLocked,color:this._createOverrideFunction(i,"Color",r,R),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:e,applyRandomOffset:!1,sampleAlphaOnly:!0})}_analyzePictureFill(t,e){const i=t.primitiveName,r=Pe(t),[s,n]=this._analyzePrimitiveOverrides(i,e,null,null),o=$(JSON.stringify(t)+n).toString(),a=$(`${t.url}${JSON.stringify(t.colorSubstitutions)}`).toString(),l=b(t.height,cn);let h=b(t.scaleX,1);if("width"in t&&typeof t.width=="number"){const u=t.width;let m=1;const f=this._resourceManager.getResource(t.url);f!=null&&(m=f.width/f.height),h/=m*(l/u)}this._cimLayers.push({type:"fill",templateHash:o,materialHash:s?()=>a:a,cim:t,materialOverrides:null,colorLocked:!!t.colorLocked,effects:e,color:this._createOverrideFunction(i,"TintColor",r,R),height:this._createOverrideFunction(i,"Height",l),scaleX:this._createOverrideFunction(i,"ScaleX",h),angle:this._createOverrideFunction(i,"Rotation",b(t.rotation)),offsetX:this._createOverrideFunction(i,"OffsetX",b(t.offsetX)),offsetY:this._createOverrideFunction(i,"OffsetY",b(t.offsetY)),url:t.url,applyRandomOffset:!1,sampleAlphaOnly:!1})}_analyzeHatchFill(t,e){var m,f;const i=t.primitiveName,r=this._analyzeMaterialOverrides(i,["Rotation","OffsetX","OffsetY"]);let[s,n]=this._analyzePrimitiveOverrides(i,e,null,null);const o=$(JSON.stringify(t)+n).toString(),a=$(`${t.separation}${JSON.stringify(t.lineSymbol)}`).toString();let l={r:255,g:255,b:255,a:1},h=!1;const u=(f=(m=t.lineSymbol)==null?void 0:m.symbolLayers)==null?void 0:f.find(_=>{var p;return _.type==="CIMSolidStroke"&&((p=this._poMap[_.primitiveName])==null?void 0:p.Color)!=null});if(u){l=H(u.color),l=this._createOverrideFunction(u.primitiveName,"Color",l,R);const _=typeof l=="function";s=s||_,h=u.color!=null||_}this._cimLayers.push({type:"fill",templateHash:o,materialHash:s&&r?this._createMaterialHashFunction(a,r):a,cim:t,materialOverrides:r,colorLocked:!!t.colorLocked,effects:e,color:l,height:this._createOverrideFunction(i,"Separation",b(t.separation,_i)),scaleX:1,angle:this._createOverrideFunction(i,"Rotation",b(t.rotation)),offsetX:this._createOverrideFunction(i,"OffsetX",b(t.offsetX)),offsetY:this._createOverrideFunction(i,"OffsetY",b(t.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!h})}_analyzeGradientFill(t,e){const i=t.primitiveName,[r,s]=this._analyzePrimitiveOverrides(i,e,null,null),n=$(JSON.stringify(t)+s).toString();this._cimLayers.push({type:"fill",templateHash:n,materialHash:r?()=>n:n,cim:t,materialOverrides:null,colorLocked:!!t.colorLocked,effects:e,color:{r:128,g:128,b:128,a:1},height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,applyRandomOffset:!1,sampleAlphaOnly:!1})}_analyzeSolidStroke(t,e,i,r){const s=t.primitiveName,n=H(t.color),o=b(t.width,St),a=Je(t.capStyle),l=qe(t.joinStyle),h=t.miterLimit,[u,m]=this._analyzePrimitiveOverrides(s,e,null,null),f=$(JSON.stringify(t)+m).toString();let _,p;if(e&&e instanceof Array&&e.length>0){const d=e[e.length-1];if(d.type==="CIMGeometricEffectDashes"&&d.lineDashEnding==="NoConstraint"&&d.offsetAlongLine===null){const g=(e=[...e]).pop();_=g.dashTemplate,p=g.scaleDash}}this._cimLayers.push({type:"line",templateHash:f,materialHash:u?()=>f:f,cim:t,materialOverrides:null,isOutline:i,colorLocked:!!t.colorLocked,effects:e,color:this._createOverrideFunction(s,"Color",n,R),width:this._createOverrideFunction(s,"Width",o),cap:this._createOverrideFunction(s,"CapStyle",a),join:this._createOverrideFunction(s,"JoinStyle",l),miterLimit:h&&this._createOverrideFunction(s,"MiterLimit",h),referenceWidth:r,zOrder:je(t.name),dashTemplate:_,scaleDash:p,sampleAlphaOnly:!0})}_analyzePictureStroke(t,e,i,r){const s=$(`${t.url}${JSON.stringify(t.colorSubstitutions)}`).toString(),n=t.primitiveName,o=Pe(t),a=b(t.width,St),l=Je(t.capStyle),h=qe(t.joinStyle),u=t.miterLimit,[m,f]=this._analyzePrimitiveOverrides(n,e,null,null),_=$(JSON.stringify(t)+f).toString();this._cimLayers.push({type:"line",templateHash:_,materialHash:m?()=>s:s,cim:t,materialOverrides:null,isOutline:i,colorLocked:!!t.colorLocked,effects:e,color:this._createOverrideFunction(n,"TintColor",o,R),width:this._createOverrideFunction(n,"Width",a),cap:this._createOverrideFunction(n,"CapStyle",l),join:this._createOverrideFunction(n,"JoinStyle",h),miterLimit:u&&this._createOverrideFunction(n,"MiterLimit",u),referenceWidth:r,zOrder:je(t.name),dashTemplate:null,scaleDash:!1,url:t.url,sampleAlphaOnly:!1})}_analyzeGradientStroke(t,e,i,r){const s=t.primitiveName,n=b(t.width,St),o=Je(t.capStyle),a=qe(t.joinStyle),l=t.miterLimit,[h,u]=this._analyzePrimitiveOverrides(s,e,null,null),m=$(JSON.stringify(t)+u).toString();this._cimLayers.push({type:"line",templateHash:m,materialHash:h?()=>m:m,cim:t,materialOverrides:null,isOutline:i,colorLocked:!!t.colorLocked,effects:e,color:{r:128,g:128,b:128,a:1},width:this._createOverrideFunction(s,"Width",n),cap:this._createOverrideFunction(s,"CapStyle",o),join:this._createOverrideFunction(s,"JoinStyle",a),miterLimit:l&&this._createOverrideFunction(s,"MiterLimit",l),referenceWidth:r,zOrder:je(t.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeMarker(t,e,i,r,s,n,o,a,l,h,u,m,f=!1){if(this._analyzeMarkerInsidePolygon(t,e))return;const _=b(t.size,ze),p=b(t.rotation),d=b(t.offsetX),g=b(t.offsetY);let y=this._createOverrideFunction(t.primitiveName,"Size",_),P=this._createOverrideFunction(t.primitiveName,"Rotation",p),M=this._createOverrideFunction(t.primitiveName,"OffsetX",d),x=this._createOverrideFunction(t.primitiveName,"OffsetY",g);y=this._transformSize(y,o),P=this._transformRotation(P,!!t.rotateClockwise,h);const S=this._transformOffsetX(M,x,h,o,u),v=this._transformOffsetY(M,x,h,o,m);switch(M=S,x=v,t.type){case"CIMPictureMarker":this._analyzePictureMarker(t,e,i,r,s,n,y,P,M,x,t.colorLocked||f);break;case"CIMVectorMarker":this._analyzeVectorMarker(t,e,i,r,s,n,o,a,y,P,M,x,t.colorLocked||f)}}_analyzeMarkerInsidePolygon(t,e){const{markerPlacement:i,type:r}=t;if(!i||i.type!=="CIMMarkerPlacementInsidePolygon")return!1;if(r==="CIMVectorMarker"||r==="CIMPictureMarker"){const d=t.primitiveName;if(d){const[y,P]=this._analyzePrimitiveOverrides([d],e,null,null);if(y)return!1}const g=i.primitiveName;if(g){const[y,P]=this._analyzePrimitiveOverrides([g],e,null,null);if(y)return!1}if(r==="CIMVectorMarker"){const{markerGraphics:y}=t;if(y)for(const P of y){const{symbol:M}=P;if((M==null?void 0:M.type)==="CIMPolygonSymbol"&&M.symbolLayers){const{symbolLayers:x}=M;for(const S of x)if(S.type==="CIMSolidStroke")return!1}}}else{const{animatedSymbolProperties:y}=t;if(y)return!1}}const s=i,n=Math.abs(s.stepX),o=Math.abs(s.stepY);if(n===0||o===0)return!0;const a=new Set(["Rotation","OffsetX","OffsetY"]),l=this._primitiveOverrides.filter(d=>d.primitiveName!==t.primitiveName||!a.has(d.propertyName)),h="url"in t&&typeof t.url=="string"?t.url:void 0,u=$(JSON.stringify(t)).toString();let m,f,_=null;if(i.gridType==="Random"){const d=zt(qi),g=Math.max(Math.floor(d/n),1),y=Math.max(Math.floor(d/o),1);m=o*y,_=P=>P?P*y:0,f=g*n/m}else i.shiftOddRows?(m=2*o,_=d=>d?2*d:0,f=n/o*.5):(m=o,_=null,f=n/o);const p=Pe(t);return this._cimLayers.push({type:"fill",templateHash:u,materialHash:u,cim:t,materialOverrides:l,colorLocked:!!t.colorLocked,effects:e,color:p,height:this._createOverrideFunction(s.primitiveName,"StepY",m,_),scaleX:f,angle:s.gridAngle,offsetX:b(s.offsetX),offsetY:b(s.offsetY),url:h,applyRandomOffset:i.gridType==="Random",sampleAlphaOnly:!h,hasUnresolvedReplacementColor:!0}),!0}_analyzePictureMarker(t,e,i,r,s,n,o,a,l,h,u){let m=b(t.scaleX,1);const f=Pe(t),_=$(`${t.url}${JSON.stringify(t.colorSubstitutions)}${JSON.stringify(t.animatedSymbolProperties)}`).toString();i||(i=this._createMarkerPlacementOverrideFunction(t.markerPlacement));const p=this._createAnimatedSymbolPropertiesOverrideFunction(t.animatedSymbolProperties),[d,g]=this._analyzePrimitiveOverrides(r,e,i,p),y=$(JSON.stringify(t)+g).toString(),P=t.anchorPoint??{x:0,y:0};if("width"in t&&typeof t.width=="number"){const S=t.width;let v=1;const C=this._resourceManager.getResource(t.url);C!=null&&(v=C.width/C.height),m/=v*(b(t.size)/S)}function M(S,v){return p!=null?Si(p,S,v):null}const x=t.animatedSymbolProperties&&t.animatedSymbolProperties.randomizeStartTime===!0?(S,v,C,I)=>{const L=Nn(I??0),T=M(S,v);return _+`-MATERIALGROUP(${L})-ASP(${JSON.stringify(T)})`}:d?(S,v)=>{const C=M(S,v);return _+`-ASP(${JSON.stringify(C)})`}:_;this._cimLayers.push({type:"marker",templateHash:y,materialHash:x,cim:t,materialOverrides:null,colorLocked:!!t.colorLocked||!!u,effects:e,scaleSymbolsProportionally:!1,alignment:s,size:o,scaleX:this._createOverrideFunction(t.primitiveName,"ScaleX",m),rotation:a,offsetX:l,offsetY:h,color:this._createOverrideFunction(t.primitiveName,"TintColor",f,R),anchorPoint:{x:P.x,y:P.y},isAbsoluteAnchorPoint:t.anchorPointUnits!=="Relative",outlineColor:{r:0,g:0,b:0,a:0},outlineWidth:0,frameHeight:0,rotateClockwise:!1,referenceSize:n,sizeRatio:1,markerPlacement:i,url:t.url,animatedSymbolProperties:p})}_analyzeVectorMarker(t,e,i,r,s,n,o,a,l,h,u,m,f){const _=t.markerGraphics;if(!_)return;const p=t.frame;let d=0,g=1;t.scaleSymbolsProportionally&&p&&(d=p.ymax-p.ymin,g=this._transformSize(l,1/d)),g=this._transformSize(g,o),i||(i=this._createMarkerPlacementOverrideFunction(t.markerPlacement));for(const y of _)if(y){const P=y.symbol;if(!P)continue;const M=y.primitiveName;M&&r.push(M);let x=u,S=m;if((P.type==="CIMPointSymbol"||P.type==="CIMTextSymbol")&&p){let v=0,C=0;const I=y.geometry;"x"in I&&"y"in I&&(v+=I.x-.5*(p.xmin+p.xmax),C+=I.y-.5*(p.ymin+p.ymax));const L=t.anchorPoint;L&&(t.anchorPointUnits==="Absolute"?(v-=L.x,C-=L.y):p&&(v-=(p.xmax-p.xmin)*L.x,C-=(p.ymax-p.ymin)*L.y)),x=this._transformOffsetX(v,C,h,g,u),S=this._transformOffsetY(v,C,h,g,m)}switch(P.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":a||Un(P)?this._analyzeMultiLayerGraphicNonSDF(t,e,i,null,y,r,s,n,d,!!f||!!t.colorLocked):this._analyzeMultiLayerGraphic(t,e,i,null,y,r,s,n,d,g,l,h,x,S,!!f||!!t.colorLocked);break;case"CIMTextSymbol":this._analyzeTextGraphic(t,e,i,y,r,s,n,d,g,l,h,x,S,!!f||!!t.colorLocked)}M&&r.pop()}}_analyzeMultiLayerGraphic(t,e,i,r,s,n,o,a,l,h,u,m,f,_,p){const d=s.symbol,g=d.symbolLayers;if(!g)return;let y=g.length;if(Wn(g))return void this._analyzeCompositeMarkerGraphic(t,e,i,r,s,g,n,o,a,l,u,m,f,_,!!p||!!t.colorLocked);const P=this._resourceManager.geometryEngine,M=Ni.applyEffects(d.effects,s.geometry,P);if(M)for(;y--;){const x=g[y];if(!x||x.enable===!1)continue;const S=x.primitiveName;switch(S&&n.push(S),x.type){case"CIMSolidFill":case"CIMSolidStroke":{const v=Ni.applyEffects(x.effects,M,P),C=Fi(v);if(!C)continue;const I=t.anchorPointUnits!=="Relative",[L,T,N]=Ei(C,t.frame,t.size,t.anchorPoint,I),z=x.type==="CIMSolidFill",F={type:"sdf",geom:v,asFill:z},B=x.path,K=z?H(wt(x)):B==null?H(we(x)):{r:0,g:0,b:0,a:0},et=z?{r:0,g:0,b:0,a:0}:H(we(x)),it=ei(x)??0;if(!z&&!it)break;const W=s.primitiveName;let ut=null;z&&!x.colorLocked&&(ut=this._createOverrideFunction(W,"FillColor",K,R));let dt=null;z||x.colorLocked||(dt=this._createOverrideFunction(W,"StrokeColor",et,R));const gt=this._createOverrideFunction(W,"StrokeWidth",it);let ft=!1,A="";for(const st of this._primitiveOverrides)n.includes(st.primitiveName)&&(st.value!=null?A+=`-${st.primitiveName}-${st.propertyName}-${JSON.stringify(st.value)}`:st.valueExpressionInfo&&(ft=!0));(e!=null&&typeof e=="function"||i!=null&&typeof i=="function")&&(ft=!0),(w(u)||w(m)||w(f)||w(_))&&(ft=!0);const ue=JSON.stringify({...t,markerGraphics:null}),Tt=$(JSON.stringify(F)+B).toString(),fe=$(JSON.stringify(s)+JSON.stringify(x)+ue+A).toString();this._cimLayers.push({type:"marker",templateHash:fe,materialHash:ft?()=>Tt:Tt,cim:F,materialOverrides:null,colorLocked:!!x.colorLocked||!!p,effects:e,scaleSymbolsProportionally:!!t.scaleSymbolsProportionally,alignment:o,anchorPoint:{x:T,y:N},isAbsoluteAnchorPoint:I,size:u,rotation:m,offsetX:f,offsetY:_,scaleX:1,frameHeight:l,rotateClockwise:!1,referenceSize:a,sizeRatio:L,color:w(ut)?ut:this._createOverrideFunction(S,"Color",K,R),outlineColor:w(dt)?dt:this._createOverrideFunction(S,"Color",et,R),outlineWidth:w(gt)?gt:this._createOverrideFunction(S,"Width",it),markerPlacement:i,animatedSymbolProperties:r,path:B});break}case"CIMVectorMarker":x.markerPlacement?this._analyzeMultiLayerGraphicNonSDF(t,e,i,r,s,n,o,a,l,!!p||!!x.colorLocked):this._analyzeMarker(x,e,i,n,o,a,h,!1,u,m,f,_,!!p||!!t.colorLocked);break;default:this._analyzeMultiLayerGraphicNonSDF(t,e,i,r,s,n,o,a,l,!!p||!!t.colorLocked)}S&&n.pop()}}_analyzeTextGraphic(t,e,i,r,s,n,o,a,l,h,u,m,f,_){var st;const p=[];O.findApplicableOverrides(r,this._primitiveOverrides,p);const d=r.geometry;if(!("x"in d)||!("y"in d))return;const g=r.symbol,y=ci(g),P=ui(g.fontStyleName),M=Zi(g.fontFamilyName);g.font={family:M,decoration:y,...P};let x=b(g.height,Ee),S=b(g.angle),v=b(g.offsetX),C=b(g.offsetY);x=this._transformSize(x,l),S=this._transformRotation(S,!1,u);const I=this._transformOffsetX(v,C,u,l,m),L=this._transformOffsetY(v,C,u,l,f);v=I,C=L;const T=H(wt(g));let N=H(we(g)),z=ei(g)??0;z||(N=H(wt(g.haloSymbol)),z=b(g.haloSize)),z=this._transformSize(z,l);let F=!1;if((st=g.symbol)!=null&&st.symbolLayers)for(const yt of g.symbol.symbolLayers)wt(yt)!=null&&(F=!!yt.colorLocked);const B=r.primitiveName;let K=null;F||(K=this._createOverrideFunction(B,"Color",T,R));let et=null,it=null,W=0;if(g.callout&&g.callout.type==="CIMBackgroundCallout"){const yt=g.callout;if(yt.backgroundSymbol){const me=yt.backgroundSymbol.symbolLayers;if(me)for(const Pt of me)Pt.type==="CIMSolidFill"?et=H(Pt.color):Pt.type==="CIMSolidStroke"&&(it=H(Pt.color),W=b(Pt.width,St))}}const[ut,dt]=this._analyzePrimitiveOverrides(s,e,i,null),gt=JSON.stringify(t.effects)+Number(t.colorLocked||_).toString()+JSON.stringify(t.anchorPoint)+t.anchorPointUnits+JSON.stringify(t.markerPlacement)+t.size.toString(),ft=$(JSON.stringify(r)+gt+dt).toString();let A=this._createOverrideFunction(r.primitiveName,"TextString",r.textString??"",ar,g.textCase);if(A==null)return;const{fontStyleName:ue}=g,Tt=M+(ue?"-"+ue.toLowerCase():"-regular"),fe=Tt;typeof A=="string"&&A.includes("[")&&g.fieldMap&&(A=lr(g.fieldMap,A,g.textCase)),this._cimLayers.push({type:"text",templateHash:ft,materialHash:ut||typeof A=="function"||/\[(.*?)\]/.test(A)?(yt,me,Pt)=>fe+"-"+Si(A,yt,me,Pt):fe+"-"+$(A),cim:g,materialOverrides:null,colorLocked:!!_||!!F,effects:e,alignment:n,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:t.anchorPointUnits!=="Relative",fontName:Tt,decoration:y,weight:P.weight,style:P.style,size:x,angle:S,offsetX:v,offsetY:C,horizontalAlignment:Bi(g.horizontalAlignment),verticalAlignment:Wi(g.verticalAlignment),text:A,color:w(K)?K:T,outlineColor:N,outlineSize:z,backgroundColor:et,borderLineColor:it,borderLineWidth:W,lineWidth:null,referenceSize:o,sizeRatio:1,markerPlacement:i})}_analyzeMultiLayerGraphicNonSDF(t,e,i,r,s,n,o,a,l,h){const u=this._buildSimpleMarker(t,s),m=t.primitiveName,f=this._analyzeMaterialOverrides(m,["Rotation","OffsetX","OffsetY"]),[_,p]=this._analyzePrimitiveOverrides(n,null,null,null),[d,g,y]=Y.getTextureAnchor(u,this._resourceManager),P=b(t.rotation),M=b(t.offsetX),x=b(t.offsetY),S=$(JSON.stringify(u)+p).toString(),v=f&&f.length>0||e!=null&&typeof e=="function";this._cimLayers.push({type:"marker",templateHash:S,materialHash:v&&f?this._createMaterialHashFunction(S,f):S,cim:u,materialOverrides:f,colorLocked:!!t.colorLocked||!!h,effects:e,scaleSymbolsProportionally:!!t.scaleSymbolsProportionally,alignment:o,anchorPoint:{x:d,y:g},isAbsoluteAnchorPoint:!1,size:b(t.size,ze),rotation:this._createOverrideFunction(m,"Rotation",P),offsetX:this._createOverrideFunction(m,"OffsetX",M),offsetY:this._createOverrideFunction(m,"OffsetY",x),color:{r:255,g:255,b:255,a:1},outlineColor:{r:0,g:0,b:0,a:0},outlineWidth:0,scaleX:1,frameHeight:l,rotateClockwise:!!t.rotateClockwise,referenceSize:a,sizeRatio:y/J(t.size),markerPlacement:i,animatedSymbolProperties:r,avoidSDFRasterization:!0})}_buildSimpleMarker(t,e){return{type:t.type,enable:!0,name:t.name,colorLocked:t.colorLocked,primitiveName:t.primitiveName,anchorPoint:t.anchorPoint,anchorPointUnits:t.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:t.rotateClockwise,rotation:0,size:t.size,billboardMode3D:t.billboardMode3D,depth3D:t.depth3D,frame:t.frame,markerGraphics:[e],scaleSymbolsProportionally:t.scaleSymbolsProportionally,respectFrame:t.respectFrame,clippingPath:t.clippingPath}}_analyzeCompositeMarkerGraphic(t,e,i,r,s,n,o,a,l,h,u,m,f,_,p){const d=s.geometry,g=n[0],y=n[1],P=Fi(d);if(!P)return;const M=t.anchorPointUnits!=="Relative",[x,S,v]=Ei(P,t.frame,t.size,t.anchorPoint,M),C={type:"sdf",geom:d,asFill:!0},I=y.path,L=y.primitiveName,T=g.primitiveName,N=H(y.color),z=H(g.color),F=b(g.width,St),B=s.primitiveName;let K=null;y.colorLocked||p||(K=this._createOverrideFunction(B,"FillColor",N,R));let et=null;g.colorLocked||p||(et=this._createOverrideFunction(B,"StrokeColor",z,R));const it=this._createOverrideFunction(B,"StrokeWidth",F);let W=!1,ut="";for(const A of this._primitiveOverrides)(A.primitiveName===L||A.primitiveName===T||o.includes(A.primitiveName))&&(A.value!=null?ut+=`-${A.primitiveName}-${A.propertyName}-${JSON.stringify(A.value)}`:A.valueExpressionInfo&&(W=!0));i!=null&&typeof i=="function"&&(W=!0),(w(u)||w(m)||w(f)||w(_))&&(W=!0);const dt=JSON.stringify({...t,markerGraphics:null}),gt=$(JSON.stringify(C)+I).toString(),ft=$(JSON.stringify(s)+JSON.stringify(y)+JSON.stringify(g)+dt+ut).toString();this._cimLayers.push({type:"marker",templateHash:ft,materialHash:W?()=>gt:gt,cim:C,materialOverrides:null,colorLocked:!!p,effects:e,scaleSymbolsProportionally:!!t.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:S,y:v},isAbsoluteAnchorPoint:M,size:u,rotation:m,offsetX:f,offsetY:_,scaleX:1,frameHeight:h,rotateClockwise:!1,referenceSize:l,sizeRatio:x,color:w(K)?K:this._createOverrideFunction(L,"Color",N,R),outlineColor:w(et)?et:this._createOverrideFunction(T,"Color",z,R),outlineWidth:w(it)?it:this._createOverrideFunction(T,"Width",F),markerPlacement:i,path:I,animatedSymbolProperties:r})}_createMaterialHashFunction(t,e){var r;const i=(r=this._info)==null?void 0:r.geometryType;if(i){const s=this._poMap;for(const n of e)if(n.valueExpressionInfo){const o=s[n.primitiveName]&&s[n.primitiveName][n.propertyName];o instanceof At&&(n.fn=(a,l,h)=>Lt(o,a,{$view:h},i,l))}}return(s,n,o)=>{for(const a of e)a.fn&&(a.value=a.fn(s,n,o));return $(t+O.buildOverrideKey(e)).toString()}}_setPoMap(t,e,i){let r;this._poMap[t]?r=this._poMap[t]:(r={},this._poMap[t]=r),r[e]=i}_createOverrideFunction(t,e,i,r,s){var l;if(t==null)return i;const n=this._poMap[t];if(n==null)return i;const o=n[e];if(typeof o=="string"||typeof o=="number"||o instanceof Array)return r?r.call(null,o,s):o;const a=(l=this._info)==null?void 0:l.geometryType;return o!=null&&o instanceof At&&a!=null?(h,u,m)=>{let f=Lt(o,h,{$view:m},a,u);return f!==null&&r&&(f=r.call(null,f,s)),f!==null?f:i}:i}_createEffectsOverrideFunction(t,e){var s;const i=this._poMap,r=(s=this._info)==null?void 0:s.geometryType;for(const n of e)if(n.valueExpressionInfo&&r){const o=i[n.primitiveName]&&i[n.primitiveName][n.propertyName];o instanceof At&&(n.fn=(a,l,h)=>Lt(o,a,{$view:h},r,l))}return(n,o,a)=>{for(const h of e)h.fn&&(h.value=h.fn(n,o,a));const l=[];for(let h of t){const u=h==null?void 0:h.primitiveName;if(u){let m=!1;for(const f of e)if(f.primitiveName===u){const _=Ke(f.propertyName);f.value!=null&&f.value!==h[_]&&(m||(h=ht(h),m=!0),h[_]=f.value)}}l.push(h)}return l}}_createMarkerPlacementOverrideFunction(t){var s;const e=[];if(O.findApplicableOverrides(t,this._primitiveOverrides,e),t==null||e.length===0)return t;const i=this._poMap,r=(s=this._info)==null?void 0:s.geometryType;for(const n of e)if(n.valueExpressionInfo&&r){const o=i[n.primitiveName]&&i[n.primitiveName][n.propertyName];o instanceof At&&(n.fn=(a,l,h)=>Lt(o,a,{$view:h},r,l))}return(n,o,a)=>{for(const u of e)u.fn&&(u.value=u.fn(n,o,a));const l=ht(t),h=t.primitiveName;for(const u of e)if(u.primitiveName===h){const m=Ke(u.propertyName);u.value!=null&&u.value!==l[m]&&(l[m]=u.value)}return l}}_createAnimatedSymbolPropertiesOverrideFunction(t){var r;const e=[];if(O.findApplicableOverrides(t,this._primitiveOverrides,e),t==null||e.length===0)return t;const i=(r=this._info)==null?void 0:r.geometryType;if(i){const s=this._poMap;for(const n of e)if(n.valueExpressionInfo){const o=s[n.primitiveName]&&s[n.primitiveName][n.propertyName];o instanceof At&&(n.fn=(a,l,h)=>Lt(o,a,{$view:h},i,l))}}return(s,n,o)=>{for(const h of e)h.fn&&(h.value=h.fn(s,n,o));const a=ht(t),l=t.primitiveName;for(const h of e)if(h.primitiveName===l){const u=Ke(h.propertyName);if(h.value!=null){const m=Yn(h.value,h.propertyName);m!==a[u]&&(a[u]=m)}}return a}}_analyzePrimitiveOverrides(t,e,i,r){let s=!1,n="";typeof t=="string"&&(t=[t]);for(const o of this._primitiveOverrides)t!=null&&t.includes(o.primitiveName)&&(o.value!=null?n+=`-${o.primitiveName}-${o.propertyName}-${JSON.stringify(o.value)}`:o.valueExpressionInfo&&(s=!0));return e!=null&&typeof e=="function"&&(s=!0),i!=null&&typeof i=="function"&&(s=!0),r!=null&&typeof r=="function"&&(s=!0),[s,n]}_analyzeMaterialOverrides(t,e){return this._primitiveOverrides.filter(i=>i.primitiveName!==t||!e.includes(i.propertyName))}_transformSize(t,e){return w(t)||w(e)?(i,r,s)=>(w(t)?t(i,r,s):t)*(w(e)?e(i,r,s):e):t*e}_transformRotation(t,e,i){return w(t)||w(i)?(r,s,n)=>{const o=w(t)?t(r,s,n):t,a=w(i)?i(r,s,n):i;return e?a-o:a+o}:e?i-t:i+t}_transformOffsetX(t,e,i,r,s){if(!(w(t)||w(e)||w(i)||w(r)||w(s))){const n=i*Math.PI/180;if(n){const o=Math.cos(n),a=Math.sin(n);return(o*t-a*e)*r+s}return t*r+s}return(n,o,a)=>{let l=w(i)?i(n,o,a):i;const h=w(r)?r(n,o,a):r,u=w(t)?t(n,o,a):t,m=w(s)?s(n,o,a):s;return l?(l*=Math.PI/180,(Math.cos(l)*u-Math.sin(l)*(w(e)?e(n,o,a):e))*h+m):u*h+m}}_transformOffsetY(t,e,i,r,s){if(!(w(t)||w(e)||w(i)||w(r)||w(s))){const n=i*Math.PI/180;if(n){const o=Math.cos(n);return(Math.sin(n)*t+o*e)*r+s}return e*r+s}return(n,o,a)=>{let l=w(i)?i(n,o,a):i;const h=w(r)?r(n,o,a):r,u=w(e)?e(n,o,a):e,m=w(s)?s(n,o,a):s;if(l){l*=Math.PI/180;const f=Math.cos(l);return(Math.sin(l)*(w(t)?t(n,o,a):t)+f*u)*h+m}return u*h+m}}}function je(c){if(c&&c.indexOf("Level_")===0){const t=parseInt(c.substr(6),10);if(!isNaN(t))return t}return 0}function R(c){if(!c||c.length===0)return null;const t=new Vi(c).toRgba();return{r:t[0],g:t[1],b:t[2],a:t[3]}}function Ke(c){return c&&c.charAt(0).toLowerCase()+c.substr(1)}function Zo(c,t){if(!t||t.length===0)return c;const e=ht(c);return O.applyOverrides(e,t),e}const Wn=c=>c&&c.length===2&&c[0].enable&&c[1].enable&&c[0].type==="CIMSolidStroke"&&c[1].type==="CIMSolidFill"&&c[0].path==null&&c[1].path==null&&!c[0].effects&&!c[1].effects;function Un(c){const t=c.symbolLayers;if(!t||t.length!==2)return!1;const e=t.find(r=>{var s;return(s=r.effects)==null?void 0:s.find(n=>n.type==="CIMGeometricEffectDashes")}),i=t.find(r=>{var s;return(s=r.effects)==null?void 0:s.find(n=>n.type==="CIMGeometricEffectAddControlPoints")});return!!e&&!!i}const Jn={marker:xe.MARKER,fill:xe.FILL,line:xe.LINE,text:xe.TEXT};class Qo{constructor(t,e,i,r){const s={minScale:e==null?void 0:e.minScale,maxScale:e==null?void 0:e.maxScale},n=qn(s);this.layers=t,this.data=e,this.hash=this._createHash()+n,this.rendererKey=i;const o={isOutline:!1,placement:null,symbologyType:cr.DEFAULT,vvFlags:i};for(const a of t){const l=Jn[a.type];o.isOutline=a.type==="line"&&a.isOutline,a.materialKey=hr(l,o),a.maxVVSize=r,a.scaleInfo=s,a.templateHash+=n}}get type(){return"expanded-cim"}_createHash(){let t="";for(const e of this.layers)t+=e.templateHash;return t}}function qn(c){return c.minScale||c.maxScale?c.minScale+"-"+c.maxScale:""}export{Cs as S,Zo as V,Jo as a,Uo as b,ho as c,oi as d,Ms as e,qo as f,En as g,Pr as h,fi as i,Zr as j,Ni as k,zn as l,Qo as m,Y as n,Nn as o,Ko as p,Lt as s,Wo as t};