@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
1 lines • 601 kB
JavaScript
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[8885,9187],{79187(t,e,s){s.r(e),s.d(e,{Envelope2D:()=>r});var i=s(55537),n=s(83661);class r{static construct(t,e,s,i){return new r(t,e,s,i)}constructor(t,e,s,i){this.m_EnvelopeType=2,void 0===t?(this.xmin=Number.NaN,this.ymin=Number.NaN,this.xmax=Number.NaN,this.ymax=Number.NaN):"number"==typeof t?(this.xmin=t,this.ymin=e,this.xmax=s,this.ymax=i):(this.xmin=t.xmin,this.ymin=t.ymin,this.xmax=t.xmax,this.ymax=t.ymax),this.normalize()}static constructEmpty(){return new r(Number.NaN,Number.NaN,Number.NaN,Number.NaN)}clone(){return new r(this)}assign(t){return this.xmin=t.xmin,this.xmax=t.xmax,this.ymin=t.ymin,this.ymax=t.ymax,this}width(){return this.xmax-this.xmin}height(){return this.ymax-this.ymin}maxDimension(){return Math.max(this.width(),this.height())}minDimension(){return Math.min(this.width(),this.height())}sqrDiagonal(){const t=this.width(),e=this.height();return t*t+e*e}diagonal(){return Math.sqrt(this.sqrDiagonal())}getCenterX(){return.5*(this.xmin+this.xmax)}getCenterY(){return.5*(this.ymin+this.ymax)}getCenter(){return n.P.construct(this.getCenterX(),this.getCenterY())}queryCenter(t){t.x=.5*(this.xmin+this.xmax),t.y=.5*(this.ymin+this.ymax)}setEmpty(){this.xmin=Number.NaN,this.ymin=Number.NaN,this.xmax=Number.NaN,this.ymax=Number.NaN}setInfinite(){this.xmin=Number.NEGATIVE_INFINITY,this.xmax=Number.POSITIVE_INFINITY,this.ymin=Number.NEGATIVE_INFINITY,this.ymax=Number.POSITIVE_INFINITY}isDegenerate(t){return!this.isEmpty()&&(this.width()<=t||this.height()<=t)}isZero(){return!(this.isEmpty()||this.width()&&this.height())}isEmpty(){return Number.isNaN(this.xmin)||Number.isNaN(this.ymin)||Number.isNaN(this.xmax)||Number.isNaN(this.ymax)}mergeNeCoords(t,e){this.xmin>t?this.xmin=t:this.xmax<t&&(this.xmax=t),this.ymin>e?this.ymin=e:this.ymax<e&&(this.ymax=e)}mergeNe(t){this.mergeNeCoords(t.x,t.y)}mergeCoords(t,e){this.isEmpty()?(this.xmin=t,this.ymin=e,this.xmax=t,this.ymax=e):(this.xmin>t?this.xmin=t:this.xmax<t&&(this.xmax=t),this.ymin>e?this.ymin=e:this.ymax<e&&(this.ymax=e))}merge(t){this.mergeCoords(t.x,t.y)}mergeEnvelope2D(t){t.isEmpty()||(this.mergeCoords(t.xmin,t.ymin),this.mergeNeCoords(t.xmax,t.ymax))}mergePoints(t,e){for(let s=0;s<e;){if(!this.isEmpty()){for(let i=s;i<e;i++)this.mergeNe(t[i]);break}this.setCoords(t[s]),s++}}mergePointsInterleaved(t,e,s){for(let i=2*e,n=i+2*s;i<n;i+=2)this.mergeCoords(t.read(i),t.read(i+1))}inflateCoords(t,e){this.isEmpty()||(this.xmin-=t,this.xmax+=t,this.ymin-=e,this.ymax+=e,(this.xmin>this.xmax||this.ymin>this.ymax)&&this.setEmpty())}getInflatedCoords(t,e){const s=this.clone();return s.inflateCoords(t,e),s}inflate(t){this.inflateCoords(t,t)}getInflated(t){const e=this.clone();return e.inflateCoords(t,t),e}zoom(t,e){this.isEmpty()||this.setCoords({center:this.getCenter(),width:t*this.width(),height:e*this.height()})}scale(t){t<0&&this.setEmpty(),this.xmin*=t,this.xmax*=t,this.ymin*=t,this.ymax*=t}equals(t,e){return!(!this.isEmpty()||!t.isEmpty())||(e?Math.abs(this.xmin-t.xmin)<=e&&Math.abs(this.ymin-t.ymin)<=e&&Math.abs(this.xmax-t.xmax)<=e&&Math.abs(this.ymax-t.ymax)<=e:this.xmin===t.xmin&&this.ymin===t.ymin&&this.xmax===t.xmax&&this.ymax===t.ymax)}setCoords(t){void 0!==t.xmin?(this.xmin=t.xmin,this.xmax=t.xmax,this.ymin=t.ymin,this.ymax=t.ymax):void 0!==t.x?(this.xmin=t.x,this.xmax=t.x,this.ymin=t.y,this.ymax=t.y):void 0!==t.pt1?(this.xmin=t.pt1.x,this.ymin=t.pt1.y,this.xmax=t.pt2.x,this.ymax=t.pt2.y,this.normalize()):void 0!==t.env2D?(this.xmin=t.env2D.xmin,this.xmax=t.env2D.xmax,this.ymin=t.env2D.ymin,this.ymax=t.env2D.ymax,this.normalize()):void 0!==t.pt?(this.xmin=t.pt.x,this.xmax=t.pt.x,this.ymin=t.pt.y,this.ymax=t.pt.y):void 0!==t.center?(this.xmin=t.center.x-.5*t.width,this.xmax=this.xmin+t.width,this.ymin=t.center.y-.5*t.height,this.ymax=this.ymin+t.height,this.normalize()):(0,i.t)("unrecognized input type for setCoords"),this.normalize()}queryIntervalX(t){this.isEmpty()?t.setEmpty():t.setCoords(this.xmin,this.xmax)}queryIntervalY(t){this.isEmpty()?t.setEmpty():t.setCoords(this.ymin,this.ymax)}setFromPoints(t,e){if(0===e)return void this.setEmpty();if(Array.isArray(t)){const s=t;this.setCoords(s[0]);for(let t=1;t<e;){if(!this.isEmpty()){for(let i=t;i<e;i++)this.mergeNe(s[i]);return}this.setCoords(s[t]),t++}return}const s=t;this.setCoords({x:s[0],y:s[1]});for(let t=1,i=2*e;t<i;t+=2){if(!this.isEmpty()){for(let i=t,n=2*e;i<n;i+=2)this.mergeNeCoords(s[i],s[i+1]);return}this.setCoords({x:s[t],y:s[t+1]}),t+=2}}normalize(){let t=!1;this.xmin<=this.xmax||([this.xmin,this.xmax]=[this.xmax,this.xmin],t=!0),this.ymin<=this.ymax||([this.ymin,this.ymax]=[this.ymax,this.ymin],t=!0),!t||this.xmin<=this.xmax&&this.ymin<=this.ymax||this.setEmpty()}isValid(){return this.isEmpty()||this.xmin<=this.xmax&&this.ymin<=this.ymax}getLowerLeft(){return new n.P(this.xmin,this.ymin)}getLowerRight(){return new n.P(this.xmax,this.ymin)}getUpperLeft(){return new n.P(this.xmin,this.ymax)}getUpperRight(){return new n.P(this.xmax,this.ymax)}move(t,e){this.isEmpty()||(this.xmin+=t,this.ymin+=e,this.xmax+=t,this.ymax+=e)}centerAtCoords(t,e){this.move(t-this.getCenterX(),e-this.getCenterY())}centerAt(t){this.centerAtCoords(t.x,t.y)}containsCoords(t,e){return t>=this.xmin&&t<=this.xmax&&e>=this.ymin&&e<=this.ymax}contains(t){return this.containsCoords(t.x,t.y)}containsEnvelope(t){return t.xmin>=this.xmin&&t.xmax<=this.xmax&&t.ymin>=this.ymin&&t.ymax<=this.ymax}containsExclusiveCoords(t,e){return t>this.xmin&&t<this.xmax&&e>this.ymin&&e<this.ymax}containsExclusive(t){return this.containsExclusiveCoords(t.x,t.y)}containsExclusiveEnvelope(t){return t.xmin>this.xmin&&t.xmax<this.xmax&&t.ymin>this.ymin&&t.ymax<this.ymax}isIntersecting(t){return(this.xmin<=t.xmin?this.xmax>=t.xmin:t.xmax>=this.xmin)&&(this.ymin<=t.ymin?this.ymax>=t.ymin:t.ymax>=this.ymin)}isIntersectingNe(t){return(this.xmin<=t.xmin?this.xmax>=t.xmin:t.xmax>=this.xmin)&&(this.ymin<=t.ymin?this.ymax>=t.ymin:t.ymax>=this.ymin)}intersect(t){if(this.isEmpty())return!1;if(t.isEmpty())return this.setEmpty(),!1;t.xmin>this.xmin&&(this.xmin=t.xmin),t.xmax<this.xmax&&(this.xmax=t.xmax),t.ymin>this.ymin&&(this.ymin=t.ymin),t.ymax<this.ymax&&(this.ymax=t.ymax);const e=this.xmin<=this.xmax&&this.ymin<=this.ymax;return e||this.setEmpty(),e}queryCorner(t){switch(3&t){case 0:return new n.P(this.xmin,this.ymin);case 1:return new n.P(this.xmin,this.ymax);case 2:return new n.P(this.xmax,this.ymax);default:return new n.P(this.xmax,this.ymin)}}queryCorners(t){t[0].setCoords(this.xmin,this.ymin),t[1].setCoords(this.xmin,this.ymax),t[2].setCoords(this.xmax,this.ymax),t[3].setCoords(this.xmax,this.ymin)}queryCornersReversed(t){t[0].setCoords(this.xmin,this.ymin),t[1].setCoords(this.xmax,this.ymin),t[2].setCoords(this.xmax,this.ymax),t[3].setCoords(this.xmin,this.ymax)}reaspect(t,e){if(this.isEmpty())return;const s=t/e,i=.5*this.width(),n=.5*this.height()*s;if(i<=n){const t=this.getCenterX();this.xmin=t-n,this.xmax=t+n}else{const t=i/s,e=this.getCenterY();this.ymin=e-t,this.ymax=e+t}this.normalize()}getArea(){return this.isEmpty()?0:this.width()*this.height()}getLength(){return this.isEmpty()?0:2*(this.width()+this.height())}clipCode(t){return(t.x<this.xmin?1:0)|(t.x>this.xmax?1:0)<<1|(t.y<this.ymin?1:0)<<2|(t.y>this.ymax?1:0)<<3}clipLine(t,e){let s=this.clipCode(t),i=this.clipCode(e);if(s&i)return 0;if(!(s|i))return 4;const n=(s?1:0)|(i?2:0);do{const n=e.x-t.x,o=e.y-t.y;if(Math.abs(n)>Math.abs(o)?s&r.XMASK?(s&r.XLESSXMIN?(t.y+=o*(this.xmin-t.x)/n,t.x=this.xmin):(t.y+=o*(this.xmax-t.x)/n,t.x=this.xmax),s=this.clipCode(t)):i&r.XMASK?(i&r.XLESSXMIN?(e.y+=o*(this.xmin-e.x)/n,e.x=this.xmin):(e.y+=o*(this.xmax-e.x)/n,e.x=this.xmax),i=this.clipCode(e)):s?(s&r.YLESSYMIN?(t.x+=n*(this.ymin-t.y)/o,t.y=this.ymin):(t.x+=n*(this.ymax-t.y)/o,t.y=this.ymax),s=this.clipCode(t)):(i&r.YLESSYMIN?(e.x+=n*(this.ymin-e.y)/o,e.y=this.ymin):(e.x+=n*(this.ymax-e.y)/o,e.y=this.ymax),i=this.clipCode(e)):s&r.YMASK?(s&r.YLESSYMIN?(t.x+=n*(this.ymin-t.y)/o,t.y=this.ymin):(t.x+=n*(this.ymax-t.y)/o,t.y=this.ymax),s=this.clipCode(t)):i&r.YMASK?(i&r.YLESSYMIN?(e.x+=n*(this.ymin-e.y)/o,e.y=this.ymin):(e.x+=n*(this.ymax-e.y)/o,e.y=this.ymax),i=this.clipCode(e)):s?(s&r.XLESSXMIN?(t.y+=o*(this.xmin-t.x)/n,t.x=this.xmin):(t.y+=o*(this.xmax-t.x)/n,t.x=this.xmax),s=this.clipCode(t)):(i&r.XLESSXMIN?(e.y+=o*(this.xmin-e.x)/n,e.x=this.xmin):(e.y+=o*(this.xmax-e.x)/n,e.x=this.xmax),i=this.clipCode(e)),s&i)return 0}while(s|i);return n}distanceFromEnvelope(t){return Math.sqrt(this.sqrDistanceEnvelope(t,null,null))}distance(t){return Math.sqrt(this.sqrDistance(t))}sqrDistanceEnvelope(t,e,s){if(!e&&!s){if(this.isEmpty()||t.isEmpty())return Number.NaN;let e,s=0,i=0;return e=this.xmin-t.xmax,e>s&&(s=e),e=this.ymin-t.ymax,e>i&&(i=e),e=t.xmin-this.xmax,e>s&&(s=e),e=t.ymin-this.ymax,e>i&&(i=e),s*s+i*i}if(this.isEmpty()||t.isEmpty())return e&&e.setNAN(),s&&s.setNAN(),Number.NaN;let i,n=0,r=0;const o=Math.max(this.xmin,t.xmin),a=Math.max(this.ymin,t.ymin);return e&&e.setCoords(o,a),s&&s.setCoords(o,a),i=this.xmin-t.xmax,i>n&&(n=i,e&&(e.x=this.xmin),s&&(s.x=t.xmax)),i=this.ymin-t.ymax,i>r&&(r=i,e&&(e.y=this.ymin),s&&(s.y=t.ymax)),i=t.xmin-this.xmax,i>n&&(n=i,e&&(e.x=this.xmax),s&&(s.x=t.xmin)),i=t.ymin-this.ymax,i>r&&(r=i,e&&(e.y=this.ymax),s&&(s.y=t.ymin)),n*n+r*r}sqrDistance(t,e){if(void 0===e){if(this.isEmpty()||t.isNAN())return Number.NaN;let e,s=0,i=0;return e=this.xmin-t.x,e>s&&(s=e),e=this.ymin-t.y,e>i&&(i=e),e=t.x-this.xmax,e>s&&(s=e),e=t.y-this.ymax,e>i&&(i=e),s*s+i*i}if(this.isEmpty()||t.isNAN())return e.setNAN(),Number.NaN;e.assign(t);let s,i=0,n=0;return s=this.xmin-t.x,s>i&&(i=s,e.x=this.xmin),s=this.ymin-t.y,s>n&&(n=s,e.y=this.ymin),s=t.x-this.xmax,s>i&&(i=s,e.x=this.xmax),s=t.y-this.ymax,s>n&&(n=s,e.y=this.ymax),i*i+n*n}sqrMaxMinDistanceEnvelope(t){if(this.isEmpty()||t.isEmpty())return Number.NaN;let e=Number.MAX_VALUE;{const s=n.P.sqrDistanceCoords(this.xmin,this.ymin,t.xmax,t.ymin),i=n.P.sqrDistanceCoords(this.xmin,this.ymin,t.xmax,t.ymax),r=n.P.sqrDistanceCoords(this.xmin,this.ymax,t.xmax,t.ymin),o=n.P.sqrDistanceCoords(this.xmin,this.ymax,t.xmax,t.ymax),a=Math.max(s,i),h=Math.max(r,o),m=Math.max(a,h);e=Math.min(m,e)}{const s=n.P.sqrDistanceCoords(this.xmin,this.ymin,t.xmin,t.ymax),i=n.P.sqrDistanceCoords(this.xmin,this.ymin,t.xmax,t.ymax),r=n.P.sqrDistanceCoords(this.xmax,this.ymin,t.xmin,t.ymax),o=n.P.sqrDistanceCoords(this.xmax,this.ymin,t.xmax,t.ymax),a=Math.max(s,i),h=Math.max(r,o),m=Math.max(a,h);e=Math.min(m,e)}{const s=n.P.sqrDistanceCoords(this.xmax,this.ymin,t.xmin,t.ymin),i=n.P.sqrDistanceCoords(this.xmax,this.ymin,t.xmin,t.ymax),r=n.P.sqrDistanceCoords(this.xmax,this.ymax,t.xmin,t.ymin),o=n.P.sqrDistanceCoords(this.xmax,this.ymax,t.xmin,t.ymax),a=Math.max(s,i),h=Math.max(r,o),m=Math.max(a,h);e=Math.min(m,e)}{const s=n.P.sqrDistanceCoords(this.xmin,this.ymax,t.xmin,t.ymin),i=n.P.sqrDistanceCoords(this.xmin,this.ymax,t.xmax,t.ymin),r=n.P.sqrDistanceCoords(this.xmax,this.ymax,t.xmin,t.ymin),o=n.P.sqrDistanceCoords(this.xmax,this.ymax,t.xmax,t.ymin),a=Math.max(s,i),h=Math.max(r,o),m=Math.max(a,h);e=Math.min(m,e)}return e}sqrMaxDistanceEnvelope(t){if(this.isEmpty()||t.isEmpty())return Number.NaN;let e=0;const s=(0,n.m)(n.P,4);this.queryCorners(s);const i=(0,n.m)(n.P,4);t.queryCorners(i);for(let t=0;t<4;t++)for(let r=0;r<4;r++){const o=n.P.sqrDistance(s[t],i[r]);o>e&&(e=o)}return e}sqrMaxMinDistance(t){const e=n.P.sqrDistance(t,this.getLowerLeft()),s=n.P.sqrDistance(t,this.getUpperLeft()),i=n.P.sqrDistance(t,this.getLowerRight()),r=n.P.sqrDistance(t,this.getUpperRight());let o,a=Math.max(e,s);return o=Math.max(e,i),a>o&&(a=o),o=Math.max(s,r),a>o&&(a=o),o=Math.max(i,r),a>o&&(a=o),a}sqrMinDistance(t){return this.contains(t)?0:this.sqrDistance(t)}sqrMaxDistance(t){let e=n.P.sqrDistance(t,this.getLowerLeft());return e=Math.max(n.P.sqrDistance(t,this.getUpperLeft()),e),e=Math.max(n.P.sqrDistance(t,this.getUpperRight()),e),e=Math.max(n.P.sqrDistance(t,this.getLowerRight()),e),e}snapToBoundary(t){if(t.isNAN())return!1;if(this.isEmpty())return t.setNAN(),!0;let e=!0;if(t.x<this.xmin?t.x=this.xmin:t.x>this.xmax?t.x=this.xmax:e=!1,t.y<this.ymin?t.y=this.ymin:t.y>this.ymax?t.y=this.ymax:e=!1,e)return!0;if(t.x===this.xmin||t.x===this.xmax||t.y===this.ymin||t.y===this.ymax)return!1;const s=this.xmax-t.x,i=t.x-this.xmin,n=this.ymax-t.y,r=t.y-this.ymin;return Math.max(s,i)>Math.max(n,r)?t.y=r<n?this.ymin:this.ymax:t.x=i<s?this.xmin:this.xmax,!0}snapClip(t){const e=(0,n.s)(t.x,this.xmin,this.xmax),s=(0,n.s)(t.y,this.ymin,this.ymax);return n.P.construct(e,s)}boundaryDistance(t){if(this.isEmpty()||t.isNAN())return Number.NaN;if(t.x===this.xmin)return t.y-this.ymin;const e=this.ymax-this.ymin,s=this.xmax-this.xmin;if(t.y===this.ymax)return e+t.x-this.xmin;if(t.x===this.xmax)return e+s+this.ymax-t.y;if(t.y===this.ymin)return 2*e+s+this.xmax-t.x;const i=new n.P;return i.setCoordsPoint2D(t),this.snapToBoundary(i),this.boundaryDistance(i)}envelopeSide(t){if(this.isEmpty())return-1;let e=this.boundaryDistance(t);const s=this.ymax-this.ymin,i=this.xmax-this.xmin;return e<s?0:(e-=s)<i?1:e-i<s?2:3}querySide(t,e){switch(t){case 0:e.constructFromCoords(this.xmin,this.ymin,this.xmin,this.ymax);break;case 1:e.constructFromCoords(this.xmin,this.ymax,this.xmax,this.ymax);break;case 2:e.constructFromCoords(this.xmax,this.ymax,this.xmax,this.ymin);break;case 3:e.constructFromCoords(this.xmax,this.ymin,this.xmin,this.ymin);break;default:(0,i.a)("query_side")}return e}isPointOnBoundary(t,e){return Math.abs(t.x-this.xmin)<=e||Math.abs(t.x-this.xmax)<=e||Math.abs(t.y-this.ymin)<=e||Math.abs(t.y-this.ymax)<=e}calculateToleranceFromEnvelope(){return this.isEmpty()?(0,n.g)():(Math.abs(this.xmin)+Math.abs(this.xmax)+Math.abs(this.ymin)+Math.abs(this.ymax)+1)*(0,n.g)()}toString(){return`[${this.xmin}, ${this.ymin}, ${this.xmax}, ${this.ymax}]`}}r.XLESSXMIN=1,r.YLESSYMIN=4,r.XMASK=3,r.YMASK=12},88885(t,e,s){s.d(e,{$:()=>B,A:()=>lr,B:()=>ir,C:()=>fs,D:()=>Yn,E:()=>ls,F:()=>Vn,H:()=>xt,I:()=>dt,J:()=>_t,K:()=>wt,L:()=>Fr,M:()=>_,N:()=>qn,O:()=>Mn,P:()=>rs,Q:()=>Sr,R:()=>w,S:()=>Rr,T:()=>Ut,U:()=>dn,V:()=>_r,W:()=>j,X:()=>ms,Y:()=>wr,Z:()=>Ir,_:()=>y,a:()=>Dt,a0:()=>nt,a1:()=>Ar,a2:()=>Tr,a3:()=>Mr,a4:()=>An,a5:()=>C,a6:()=>jn,a7:()=>us,a8:()=>Dn,a9:()=>u,b:()=>bn,c:()=>At,d:()=>Nn,e:()=>_s,f:()=>cs,g:()=>O,i:()=>ds,l:()=>In,n:()=>as,s:()=>l,x:()=>fe,y:()=>Ci,z:()=>ur});var i=s(55537),n=s(95213),r=s(83661),o=s(79187),a=s(11878),h=s(61691);class m{constructor(){this.posStream=null,this.streams=null}get(t){return t>0?this.streams[t-1]:this.posStream}set(t,e){t>0?this.streams[t-1]=e:this.posStream=e}destroyAndSetSize(t){if(this.streams=null,t>1){this.streams=new Array(t-1);for(let e=0;e<t-1;++e)this.streams[e]=null}this.posStream=null}swap(t){[this.streams,t.streams]=[t.streams,this.streams],[this.posStream,t.posStream]=[t.posStream,this.posStream]}empty(){return null===this.posStream&&null===this.streams}}function u(t,e,s){if(t)for(let t=e.length-1;t>=0;--t)s(e[t]);else e.forEach(s)}function l(t,e){let s=(0,r.B)(t);const i=e.length/(0,r.i)();for(let t=0;t<e.length;++t){const t=Math.trunc(s*i);s=(0,r.B)(s);const n=Math.trunc(s*i),o=e[t];e[t]=e[n],e[n]=o}}var c=n.V;const g="can not assign an empty point to a vertex";class d{constructor(t){if(this.m_accelerators=null,void 0!==t&&t.move)this.m_description=t.move.m_description,t.move.m_description=(0,n.l)(),this.m_vertexAttributes=t.move.m_vertexAttributes,t.move.m_vertexAttributes=new m,this.m_envelopeData=t.move.m_envelopeData,t.move.m_envelopeData=new n.m,this.m_pointCount=t.move.m_pointCount,this.m_reservedPointCount=t.move.m_reservedPointCount,this.m_flags=t.move.m_flags,this.m_bFillRule=t.move.m_bFillRule,this.m_bPathStarted=t.move.m_bPathStarted,this.m_bPolygon=t.move.m_bPolygon,this.m_simpleTolerance=t.move.m_simpleTolerance;else{const e=void 0!==t&&t.vd?t.vd:(0,n.l)();this.m_description=e,this.m_vertexAttributes=new m,this.m_envelopeData=new n.m,this.m_pointCount=0,this.m_reservedPointCount=-1,this.m_flags=4063,this.m_bFillRule=this.m_bPathStarted=this.m_bPolygon=!1,this.m_simpleTolerance=0,void 0!==t&&t.copy&&t.copy.copyTo(this)}}equalsBase(t,e){if(!(0,i.i)(t.getGeometryType()))return!1;const s=t;if(this===s)return!0;if(!this.m_description.equals(s.getDescription()))return!1;if(this.isEmptyImpl()!==s.isEmptyImpl())return!1;if(this.isEmptyImpl())return!0;const n=this.getPointCount();if(n!==s.getPointCount())return!1;for(let t=0;t<this.m_description.getAttributeCount();t++){const i=this.m_description.getSemantics(t),r=this.getAttributeStreamRef(i),o=s.getAttributeStreamRef(i),a=c.getComponentCount(i);if(!r.equals(o,0,n*a,e))return!1}if(e){if(!this.equalsImplTol(t,e))return!1}else if(!this.equalsImpl(t))return!1;return!0}transformAttribute(t,e,s,r,o){if(this.addAttribute(t),!this.isEmpty()&&(0!==s||1!==r)){if(0===t){const t=new a.T;return 0===o?0===e?(t.setShiftCoords(s,0),t.scale(r,1)):1===e?(t.setShiftCoords(0,s),t.scale(1,r)):(0,i.a)(""):0===e?(t.setScaleCoords(1/r,1),t.shiftCoords(-s,0)):1===e?(t.setScaleCoords(1,1/r),t.shiftCoords(0,-s)):(0,i.a)(""),void this.applyTransformation(t)}(function(t,e,s,n,r){(e<0||s<0||n<1||e+n*(s-1)+1>t.size())&&(0,i.a)("Index out of bound");for(let i=e,o=e+n*(s-1)+1;i<o;i+=n)t.writeAsDbl(i,r(t.readAsDbl(i)))})(this.getAttributeStreamRef(t),e,this.getPointCount(),c.getComponentCount(t),(0,n.x)(s,r,o)),this.notifyModified()}}getDescription(){return this.m_description}assignVertexDescription(t){this.m_description!==t&&this.assignVertexDescriptionImpl(t)}mergeVertexDescriptionImpl(t){const e=this.getDescription(),s=(0,n.n)(e,t);this.assignVertexDescription(s)}mergeVertexDescription(t){this.m_description!==t&&(this.m_description.hasAttributesFrom(t)||this.mergeVertexDescriptionImpl(t))}hasAttribute(t){return this.m_description.hasAttribute(t)}addAttribute(t){if(this.m_description.hasAttribute(t))return;const e=(0,n.o)(this.m_description,t);this.assignVertexDescription(e)}dropAttribute(t){if(!this.m_description.hasAttribute(t))return;const e=(0,n.r)(this.m_description,t);this.assignVertexDescription(e)}dropAllAttributes(){const t=(0,n.l)();t!==this.m_description&&this.assignVertexDescription(t)}getAttributeStreamRef(t){this.throwIfEmpty(),this.m_description.hasAttribute(t)||(0,i.a)("AttributeStream : Geometry does not have the attribute");const e=this.m_description.getAttributeIndex(t);return this.m_vertexAttributes.get(e)}setAttributeStreamRef(t,e){e||(0,i.a)("stream"),e&&c.getPersistence(t)!==e.getPersistence()&&(0,i.a)(""),this.addAttribute(t);const s=this.m_description.getAttributeIndex(t);this.m_vertexAttributes.empty()&&this.m_vertexAttributes.destroyAndSetSize(this.m_description.getAttributeCount()),this.m_vertexAttributes.set(s,e),this.notifyModifiedFlags(2001)}notifyModifiedFlags(t){65535===t&&(this.m_reservedPointCount=-1,this.notifyModifiedAllImpl()),this.setDirtyFlagProtected(t,!0),this.clearAccelerators(),32&t&&this.verifyAllStreamsAfterSizeChange()}notifyModified(){this.notifyModifiedFlags(2001)}getPointCount(){return this.m_pointCount}getPointByVal(t,e){const s=e;s.assignVertexDescription(this.m_description);for(let e=0;e<this.m_description.getAttributeCount();e++){const i=this.m_description.getSemantics(e);for(let n=0,r=c.getComponentCount(i);n<r;n++){const o=this.m_vertexAttributes.get(e).readAsDbl(r*t+n);s.setAttributeBasic(i,n,o)}}}setPointByValNoCurves(t,e){const s=e;s.isEmpty()&&(0,i.a)(g);const n=s.getDescription();n!==this.m_description&&this.mergeVertexDescription(n);const r=this.m_vertexAttributes.get(0);r.write(2*t,s.getX()),r.write(2*t+1,s.getY());for(let e=1,i=this.m_description.getAttributeCount();e<i;e++){const i=this.m_description.getSemantics(e),n=c.getComponentCount(i);for(let r=0;r<n;r++){const o=s.getAttributeAsDbl(i,r);this.m_vertexAttributes.get(e).writeAsDbl(t*n+r,o)}}this.notifyModifiedFlags(2001)}setPointByValFromArrayNoCurves(t,e,s,n){(0,i.g)(0)}getPointByValAsArray(t,e,s,n){(0,i.g)(0)}isEmpty(){return this.isEmptyImpl()}isEmptyImpl(){return 0===this.m_pointCount}getAttributeAsDbl(t,e,s){const n=c.getComponentCount(t);s>=n&&(0,i.r)("");const r=this.m_description.getAttributeIndex(t);return r>=0?this.m_vertexAttributes.get(r).readAsDbl(e*n+s):c.getDefaultValue(t)}queryAttributeAsDbl(t,e,s,n){const r=c.getComponentCount(t);n<r&&(0,i.r)("");const o=this.m_description.getAttributeIndex(t);if(o>=0){const t=e*r,i=this.m_vertexAttributes.get(o);for(let e=0;e<r;e++)s[e]=i.readAsDbl(t+e)}else{const e=c.getDefaultValue(t);for(let t=0;t<r;t++)s[t]=e}}getAttributeAsInt(t,e,s){return Math.trunc(this.getAttributeAsDbl(t,e,s))}queryAttributeAsInt(t,e,s,n){(0,i.g)(0)}setAttributeNoCurves(t,e,s,n){const r=c.getComponentCount(t);s>=r&&(0,i.r)(""),this.addAttribute(t);const o=this.m_description.getAttributeIndex(t);this.notifyModifiedFlags(2001),this.m_vertexAttributes.get(o).writeAsDbl(e*r+s,n)}setAttributeFromArrayNoCurves(t,e,s,n){(e<0||e>=this.m_pointCount)&&(0,i.r)("");const r=c.getComponentCount(t);n<r&&(0,i.r)(""),this.addAttribute(t);const o=this.m_description.getAttributeIndex(t);this.notifyModifiedFlags(2001);const a=this.m_vertexAttributes.get(o);for(let t=0;t<r;++t)a.writeAsDbl(e*r+t,s[t])}getXY(t){return this.m_vertexAttributes.get(0).readPoint2D(2*t)}queryXY(t,e){return this.m_vertexAttributes.get(0).queryPoint2D(2*t,e)}setXYNoCurves(t,e){this.m_vertexAttributes.get(0).writePoint2D(2*t,e),this.notifyModifiedFlags(2001)}setXYCoordsNoCurves(t,e,s){const i=this.m_vertexAttributes.get(0);i.write(2*t,e),i.write(2*t+1,s),this.notifyModifiedFlags(2001)}getXYZ(t){const e=this.m_vertexAttributes.get(0),s=n.f.getNAN();return s.x=e.read(2*t),s.y=e.read(2*t+1),this.m_description.hasAttribute(1)?s.z=this.m_vertexAttributes.get(1).read(t):s.z=c.getDefaultValue(1),s}setXYZNoCurves(t,e){this.addAttribute(1),this.notifyModifiedFlags(2001);const s=this.m_vertexAttributes.get(0);s.write(2*t,e.x),s.write(2*t+1,e.y),this.m_vertexAttributes.get(1).write(t,e.z)}queryEnvelope(t){t instanceof o.Envelope2D||t instanceof n.p?this.updateEnvelope(t):(this.updateAllDirtyIntervals(!0),this.m_envelopeData.copyTo(this.m_description,t))}queryLooseEnvelope(t){this.updateLooseEnvelope(t)}queryInterval(t,e){const s=r.E.constructEmpty();return this.isEmptyImpl()||(this.updateAllDirtyIntervals(!0),this.m_envelopeData.queryInterval(this.m_description,t,e,s)),s}setAttributeBasic(t,e,s){this.setAttributeImpl(t,e,s)}setAttributeImpl(t,e,s){if(this.addAttribute(t),this.isEmpty())return;let i=!1;const n=c.getComponentCount(t),r=this.getAttributeStreamRef(t),o=Number.isNaN(s);if(1===r.getPersistence()){const t=r;for(let r=e,a=this.m_pointCount*n;r<a;r+=n){const e=t.read(r);(o||e===s)&&Number.isNaN(e)||(t.write(r,s),i=!0)}}else for(let t=e,o=this.m_pointCount*n;t<o;t+=n)r.readAsDbl(t)!==s&&(r.writeAsDbl(t,s),i=!0);i&&this.notifyModifiedFlags(2001)}replaceNaNs(t,e){if(this.addAttribute(t),this.isEmpty())return;let s=!1;const i=c.getComponentCount(t),n=this.getAttributeStreamRef(t);for(let t=0;t<i;t++)if(1===n.getPersistence()){const t=n;for(let n=0,r=this.m_pointCount*i;n<r;n++){const i=t.read(n);Number.isNaN(i)&&(t.write(n,e),s=!0)}}else for(let t=0,r=this.m_pointCount*i;t<r;t++){const i=n.readAsDbl(t);Number.isNaN(i)&&(n.writeAsDbl(t,e),s=!0)}s&&this.notifyModifiedFlags(2001)}calculateLength3D(t){return(0,i.g)(0),0}setEnvelopeForImport(t){this.m_description.equals(t.getDescription())||(0,i.a)(""),this.m_envelopeData=new n.m({moveEnv:t}),this.setDirtyFlagProtected(192,!1)}copyTo(t){t.getGeometryType()!==this.getGeometryType()&&(0,i.a)(""),this!==t&&this.copyToUnchecked(t,!1)}queryCoordinates(t,e,s,n){let r=n<0?this.m_pointCount:n;if(r=Math.min(r,s+e),(s<0||r<s||this.m_pointCount>0&&s>=this.m_pointCount)&&(0,i.a)(""),0===this.m_pointCount)return r;const o=this.getAttributeStreamRef(0);for(let e=2*s,i=2*r,n=0;e<i;e+=2,n++)o.queryPoint2D(e,t[n]);return r}queryCoordinates3D(t,e,s,n){let r=n<0?this.m_pointCount:n;if(r=Math.min(r,s+e),(s<0||r<s||this.m_pointCount>0&&s>=this.m_pointCount)&&(0,i.a)(""),0===this.m_pointCount)return r;const o=this.getAttributeStreamRef(0);let a=null;const h=c.getDefaultValue(1),m=this.m_description.hasAttribute(1);m&&(a=this.getAttributeStreamRef(1));let u=0;for(let e=s;e<r;e++,u++)t[u].x=o.read(2*e),t[u].y=o.read(2*e+1),t[u].z=m?a.read(e):h;return r}clearAndSetDirtyFlagProtected(t,e){let s=0;const i=t&~e,n=e|i;s=this.m_flags,(s&n)!==e&&(this.m_flags=s&~i|e)}getIsSimple(t,e){e[0]=0;let s=-1;const i=this.m_flags,n=this.m_simpleTolerance;return 1&i||(s=(14&i)>>1,e[0]=n,n<t&&(s=-1)),s}setIsSimple(t,e,s=!1){if(2===t?(0,i.g)(this.getGeometryType()===i.G.enumPolyline):1===t?(0,i.g)(this.getGeometryType()===i.G.enumMultiPoint||this.getGeometryType()===i.G.enumPolyline):3===t&&(0,i.g)(this.getGeometryType()===i.G.enumPolygon),-1===t)this.setDirtyFlagProtected(17,!0);else{let i=t<<1;s||(i|=16);const n=31;this.clearAndSetDirtyFlagProtected(n,i),this.m_simpleTolerance!==e&&(this.m_simpleTolerance=e)}}attributeStreamIsAllocated(t){this.throwIfEmpty();const e=this.m_description.getAttributeIndex(t);return e>=0&&null!==this.m_vertexAttributes.get(e)}capacity(){return-1===this.m_reservedPointCount&&0===this.m_pointCount?0:this.m_reservedPointCount}getDescriptionImpl(){return this.m_description}copyToUnchecked(t,e=!1){e&&this.hasDirtyFlag(32)&&(0,i.s)("Cannot do shallow clone on unprepared geometry");const s=t,n=this.getGeometryType(),r=s.getGeometryType();(0,i.g)(n===r||n===i.G.enumPolygon&&r===i.G.enumPolyline,"failure in copyToUnchcked"),s.clearAccelerators(),s.m_description=this.m_description,s.m_vertexAttributes.destroyAndSetSize(0),s.m_envelopeData.releaseAttributes();const o=this.m_description.getAttributeCount(),a=new m;if(!this.m_vertexAttributes.empty()){a.destroyAndSetSize(o);for(let t=0;t<o;t++)if(this.m_vertexAttributes.get(t))if(e)a.set(t,this.m_vertexAttributes.get(t));else{const e=c.getComponentCount(this.m_description.getSemantics(t));a.set(t,this.m_vertexAttributes.get(t).restrictedClone(this.getPointCount()*e))}}if(this.m_envelopeData.copyToIfNotNull(this.m_description,s.m_envelopeData),s.m_flags=this.m_flags,s.m_simpleTolerance=this.m_simpleTolerance,n!==r){const t=[Number.NaN];s.getIsSimple(0,t)>=3?s.setIsSimple(1,t[0]):s.setIsSimple(-1,0)}s.m_vertexAttributes.swap(a),a.destroyAndSetSize(0),s.m_pointCount=this.m_pointCount,s.hasDirtyFlag(32)||s.m_vertexAttributes.empty()?((0,i.g)(!e||0===s.m_pointCount),s.m_reservedPointCount=-1):s.m_reservedPointCount=s.m_pointCount;try{this.copyToImpl(s,e)}catch(t){throw s.setEmpty(),t}s.verifyAllStreamsAfterSizeChange()}buildRasterizedGeometryAccelerator(t,e){return!1}getAccelerators(){return this.m_accelerators}clearAccelerators(){this.m_accelerators&&this.m_accelerators.release(),this.m_accelerators=null}ensureUniqueAccelerators(){if(this.m_accelerators&&!this.m_accelerators.uniqueUse()){const t=this.m_accelerators.clone();this.m_accelerators.release(),this.m_accelerators=t}}interpolateTwoVertices(t,e,s,o){(t<0||t>=this.m_pointCount)&&(0,i.r)(""),(e<0||e>=this.m_pointCount)&&(0,i.r)(""),o.assignVertexDescription(this.m_description);const a=(0,r.d)(c.maxComponentCount(),Number.NaN),h=(0,r.d)(c.maxComponentCount(),Number.NaN),m=(0,n.q)();let u=0;for(let o=0;o<this.m_description.getAttributeCount();o++){const l=this.m_description.getSemantics(o),g=c.getInterpolation(l),d=c.getComponentCount(l),_=c.getDefaultValue(l);this.queryAttributeAsDbl(l,t,a,d),this.queryAttributeAsDbl(l,e,h,d),(0,i.g)(u+d<=n.O),(0,r.A)(g,a,h,m,u,d,s,_),u+=d}!function(t,e){const s=t.getDescription().getTotalComponentCount();t.setX(e[0]),t.setY(e[1]),(0,r.b)(t.getAttributeArray(),e,0,2,s-2)}(o,m)}getShortestDistance(t,e){return r.P.distance(this.getXY(t),this.getXY(e))}getShortestSqrDistance(t,e){return r.P.sqrDistance(this.getXY(t),this.getXY(e))}resizeImpl(t){if(t<0&&(0,i.a)(),(t=Math.ceil(t))===this.m_pointCount)return;this.m_pointCount=t;const e=this.m_pointCount<=this.m_reservedPointCount?2001:4095;this.notifyModifiedFlags(e)}assignVertexDescriptionImpl(t){if(!this.m_vertexAttributes.empty()){const e=(0,n.t)();(0,n.u)(t,this.m_description,e);const s=new m;s.destroyAndSetSize(t.getAttributeCount());for(let i=0;i<t.getAttributeCount();i++){const t=e[i];-1!==t?s.set(i,this.m_vertexAttributes.get(t)):this.m_reservedPointCount=-1}s.swap(this.m_vertexAttributes)}this.m_description=t,this.m_envelopeData.releaseAttributes(),this.notifyModifiedFlags(4095)}hasDirtyFlag(t){return 0!==(this.m_flags&t)}setDirtyFlagProtected(t,e){e?this.m_flags|=t:this.m_flags&=~t}notifyModifiedAllImpl(){}verifyAllStreamsAfterSizeChange(){this.hasDirtyFlag(32)&&this.verifyAllStreamsAfterSizeChangeImpl()}verifyAllStreamsAfterSizeChangeImpl(){if(this.hasDirtyFlag(32)){if(this.m_reservedPointCount<this.m_pointCount){this.m_vertexAttributes.empty()&&this.m_vertexAttributes.destroyAndSetSize(this.m_description.getAttributeCount()),this.m_reservedPointCount=-1;let t=Number.MAX_SAFE_INTEGER,e=0;e=this.m_pointCount<4?3:this.m_pointCount<=128?2*this.m_pointCount:Math.trunc((4*this.m_pointCount+2)/3);for(let s=0;s<this.m_description.getAttributeCount();s++){const i=this.m_description.getSemantics(s);let r=0;if(null!==this.m_vertexAttributes.get(s)){const t=c.getComponentCount(i);r=this.m_vertexAttributes.get(s).size()/t,r<this.m_pointCount&&(this.m_vertexAttributes.get(s).resize(e*t,c.getDefaultValue(i)),r=e)}else this.m_vertexAttributes.set(s,(0,n.v)(i,e)),r=e;r<t&&(t=r)}this.m_reservedPointCount=t}this.verifyStreamsAfterSizeChangeExtraImpl(),this.setDirtyFlagProtected(32,!1)}}verifyStreamsAfterSizeChangeExtraImpl(){}updateAllDirtyIntervals(t){if(t?this.hasDirtyFlag(192):this.hasDirtyFlag(128)){if(this.isEmpty())return this.hasDirtyFlag(192)&&this.m_envelopeData.setEmpty(this.m_description),void this.setDirtyFlagProtected(192,!1);const e=this.updateXYImpl(t),s=new n.E({vd:this.m_description});s.setEnvelope(e);for(let t=1;t<this.m_description.getAttributeCount();t++){const e=this.m_description.getSemantics(t),i=c.getComponentCount(e),n=this.m_vertexAttributes.get(t);for(let t=0;t<i;t++){const o=new r.E;o.setEmpty();for(let e=0;e<this.m_pointCount;e++){const s=n.readAsDbl(e*i+t);o.mergeCoordinate(s)}s.setIntervalEnvelope(e,t,o)}}(t?this.hasDirtyFlag(192):this.hasDirtyFlag(128))&&(this.m_envelopeData=new n.m({moveEnv:s}),this.clearDirtyIntervalsFlag(t))}}updateXYImpl(t){const e=o.Envelope2D.constructEmpty(),s=this.m_vertexAttributes.get(0);return e.mergePointsInterleaved(s,0,this.m_pointCount),e}updateEnvelope3D(t){(0,i.g)(0)}updateLooseEnvelope(t){this.updateAllDirtyIntervals(!1),t instanceof o.Envelope2D?t.assign(this.m_envelopeData.m_envelope2D):this.m_envelopeData.queryEnvelope3D(this.m_description,t)}updateEnvelope(t){this.updateAllDirtyIntervals(!0),t.assign(this.m_envelopeData.m_envelope2D)}setEmptyImpl(){this.m_pointCount=0,this.m_reservedPointCount=-1,this.m_vertexAttributes.destroyAndSetSize(0),this.notifyModifiedFlags(4095)}clearDirtyIntervalsFlag(t){this.setDirtyFlagProtected(192,!1)}reserveImpl(t,e){if(t<0&&(0,i.a)(""),0===t)return;let s=t=Math.ceil(t);if(this.m_reservedPointCount<s){this.m_vertexAttributes.empty()&&this.m_vertexAttributes.destroyAndSetSize(this.m_description.getAttributeCount()),e?(null===this.m_vertexAttributes.get(0)&&this.m_vertexAttributes.set(0,(0,n.w)(0,0)),this.m_vertexAttributes.get(0).resizeRounded(2*s),s=this.m_vertexAttributes.get(0).size()>>1):null===this.m_vertexAttributes.get(0)?this.m_vertexAttributes.set(0,(0,n.w)(0,s)):this.m_vertexAttributes.get(0).resize(2*s);for(let t=1;t<this.m_description.getAttributeCount();t++){const e=this.m_description.getSemantics(t),i=c.getComponentCount(e);null!==this.m_vertexAttributes.get(t)?this.m_vertexAttributes.get(t).resize(s*i):this.m_vertexAttributes.set(t,(0,n.w)(e,s))}this.reserveImplImpl(s,e),this.m_reservedPointCount=s}}reserveRounded(t){t<0&&(0,i.a)(),t=Math.ceil(t),this.reserveImpl(t,!0)}reserveImplImpl(t,e){}throwIfEmpty(){this.isEmptyImpl()&&(0,i.u)("")}exportVertexAttributes(){const t=this.getPointCount(),e=this.m_description.getAttributeIndex(1),s=this.m_description.getAttributeIndex(2),i=this.m_vertexAttributes.posStream,n=e>0?this.m_vertexAttributes.get(e):void 0,r=s>0?this.m_vertexAttributes.get(s):void 0,o=i?.getArray()??new Float64Array,a=n?.getArray(),h=r?.getArray();return{vertexCount:t,vertexXY:o,vertexZ:a,vertexM:h}}}class _ extends d{constructor(t){super(t),t&&(t.points?this.addPoints2D(t.points,t.pointsSize,0,-1):t.point&&this.add(t.point))}assignCopy(t){return t.copyTo(this),this}assignMove(t){return t.copyTo(this),t.setEmpty(),this}insertPoint2D(t,e){t>this.getPointCount()&&(0,i.a)("invalid point index"),t<0&&(t=this.getPointCount());const s=this.m_pointCount;this.resizeNoInit(this.m_pointCount+1);for(let i=0,r=this.m_description.getAttributeCount();i<r;i++){const r=this.m_description.getSemantics(i),o=n.V.getComponentCount(r);if(0===r)this.m_vertexAttributes.get(i).insert(o*t,e,o*s);else{const e=n.V.getDefaultValue(r);this.m_vertexAttributes.get(i).insertRange(o*t,e,o,o*s)}}this.notifyModifiedFlags(2001)}insertPoint(t,e){e.isEmpty()&&(0,i.a)(g),t<0&&(t=this.getPointCount()),this.mergeVertexDescription(e.getDescription());const s=this.m_pointCount;this.resizeNoInit(this.m_pointCount+1);for(let i=0,r=this.m_description.getAttributeCount();i<r;i++){const r=this.m_description.getSemantics(i),o=n.V.getComponentCount(r);if(e.hasAttribute(r))this.m_vertexAttributes.get(i).insertAttributes(o*t,e,r,o*s);else{const e=n.V.getDefaultValue(r);this.m_vertexAttributes.get(i).insertRange(o*t,e,o,o*s)}}this.notifyModifiedFlags(2001)}insertPoints(t,e,s){if((t>this.getPointCount()||s<0)&&(0,i.r)(""),t<0&&(t=this.getPointCount()),0===s)return;const r=e[0].getDescription();this.mergeVertexDescription(r);const o=this.m_pointCount;this.resizeNoInit(this.m_pointCount+s);for(let i=0,a=this.m_description.getAttributeCount();i<a;i++){const a=this.m_description.getSemantics(i),h=n.V.getComponentCount(a);if(this.m_vertexAttributes.get(i))if(r.hasAttribute(a))this.m_vertexAttributes.get(i).insertAttributesFromPoints(t*h,e,s,a,o*h);else{const e=n.V.getDefaultValue(a);this.m_vertexAttributes.get(i).insertRange(h*t,e,h*s,h*o)}}this.notifyModifiedFlags(2001)}insertPoints2D(t,e,s){if((t>this.getPointCount()||s<0)&&(0,i.a)("invalid point index"),t<0&&(t=this.getPointCount()),0===s)return;const r=this.m_pointCount;this.resizeNoInit(this.m_pointCount+s);for(let i=0,o=this.m_description.getAttributeCount();i<o;i++){const o=this.m_description.getSemantics(i),a=n.V.getComponentCount(o);if(this.m_vertexAttributes.get(i))if(0===o)this.m_vertexAttributes.get(i).insertRangeFromPoints(a*t,e,0,s,!0,a*r);else{const e=n.V.getDefaultValue(o);this.m_vertexAttributes.get(i).insertRange(a*t,e,a,a*r)}}this.notifyModifiedFlags(2001)}removePoints(t,e){if((t<0||e<0||t+e>this.getPointCount())&&(0,i.r)("remove_points"),0!==e){for(let s=0,i=this.m_description.getAttributeCount();s<i;s++)if(this.m_vertexAttributes.get(s)){const i=this.m_description.getSemantics(s),r=n.V.getComponentCount(i);this.m_vertexAttributes.get(s).eraseRange(r*t,r*e,r*this.m_pointCount)}this.m_pointCount-=e,this.m_reservedPointCount>0&&(this.m_reservedPointCount-=e),this.notifyModifiedFlags(2001)}}removePoint(t){for(let e=0,s=this.m_description.getAttributeCount();e<s;e++)if(this.m_vertexAttributes.get(e)){const s=this.m_description.getSemantics(e),i=n.V.getComponentCount(s);this.m_vertexAttributes.get(e).eraseRange(i*t,i,i*this.m_pointCount)}this.m_pointCount--,this.m_reservedPointCount>0&&this.m_reservedPointCount--,this.notifyModifiedFlags(2001)}calculateEnvelope2D(){return this.updateXYImpl(!0)}resizeNoInit(t){this.resizeImpl(t)}resizeAndInitNonPositionAttributes(t){const e=this.m_pointCount;if(this.resizeImpl(t),this.m_pointCount>e)for(let t=1,s=this.m_description.getAttributeCount();t<s;t++){const s=this.m_description.getSemantics(t),i=n.V.getDefaultValue(s),r=n.V.getComponentCount(s);this.m_vertexAttributes.get(t).insertRange(r*e,i,r*(this.m_pointCount-e),r*e)}}queryCoordinates3D(t,e,s,r){let o=r<0?this.m_pointCount:r;if(o=Math.min(o,s+e),(s<0||o<s||this.m_pointCount>0&&s>=this.m_pointCount)&&(0,i.a)(""),0===this.m_pointCount)return o;const a=this.getAttributeStreamRef(0);let h=null;const m=n.V.getDefaultValue(1),u=this.m_description.hasAttribute(1);u&&(h=this.getAttributeStreamRef(1));let l=0;for(let e=s;e<o;e++,l++)t[l].x=a.read(2*e),t[l].y=a.read(2*e+1),t[l].z=u?h.read(e):m;return o}queryAttributeAsInt(t,e,s,n){(0,i.g)(0)}add(t){t.isEmpty()&&(0,i.a)(g),this.resizeAndInitNonPositionAttributes(this.m_pointCount+1),this.setPointByValNoCurves(this.m_pointCount-1,t)}addXY(t,e){this.resizeAndInitNonPositionAttributes(this.m_pointCount+1);const s=new r.P(t,e);this.setXYNoCurves(this.m_pointCount-1,s)}addXYZ(t,e,s){this.resizeAndInitNonPositionAttributes(this.m_pointCount+1);const i=new n.f;i.setCoords(t,e,s),this.setXYZNoCurves(this.m_pointCount-1,i)}addPoint2D(t){this.addXY(t.x,t.y)}addPoint3D(t){this.addXYZ(t.x,t.y,t.z)}addPoints(t,e,s){this===t&&(0,i.a)("Multi_point_impl.add");const r=s<0?t.getPointCount():s;if((e<0||e>t.getPointCount()||r<e)&&(0,i.a)(""),e===r)return;const o=t.getDescription();this.mergeVertexDescription(o);const a=r-e,h=this.m_pointCount;this.resizeNoInit(this.m_pointCount+a);for(let s=0,i=this.m_description.getAttributeCount();s<i;s++){const i=this.m_description.getSemantics(s),r=n.V.getComponentCount(i),m=this.getAttributeStreamRef(i);if(o.hasAttribute(i)){const s=t.getAttributeStreamRef(i);m.insertRangeFromStream(h*r,s,e*r,a*r,!0,1,h*r)}else{const t=n.V.getDefaultValue(i);m.insertRange(h*r,t,a*r,h*r)}}}addPoints2D(t,e,s,n){let r=e;const o=n<0?r:n;if((r<0||s<0||s>r||o<s)&&(0,i.a)(""),s===o)return;r=o-s;const a=this.m_pointCount;this.resizeAndInitNonPositionAttributes(this.m_pointCount+r);const h=this.getAttributeStreamRef(0);for(let e=0;e<r;++e)h.writePoint2D(2*(a+e),t[s+e]);this.notifyModifiedFlags(2001)}addPoints3D(t,e,s,n){let o=e;const a=n<0?o:n;if((o<0||s<0||s>o||a<s)&&(0,i.a)(""),this.addAttribute(1),s===a)return;o=a-s;const h=this.m_pointCount;this.resizeAndInitNonPositionAttributes(this.m_pointCount+o);const m=this.getAttributeStreamRef(0),u=new r.P;for(let e=0;e<o;e++)u.x=t[s+e].x,u.y=t[s+e].y,m.writePoint2D(2*(h+e),u);const l=this.getAttributeStreamRef(1);for(let e=0;e<o;e++)l.write(h+e,t[s+e].z);this.notifyModifiedFlags(2001)}setPointByVal(t,e){this.setPointByValNoCurves(t,e)}setXY(t,e){this.setXYNoCurves(t,e)}setXYCoords(t,e,s){this.setXYCoordsNoCurves(t,e,s)}setXYZ(t,e){this.setXYZNoCurves(t,e)}setAttribute(t,e,s,i){this.setAttributeNoCurves(t,e,s,i)}getGeometryType(){return i.G.enumMultiPoint}getDimension(){return 0}createInstance(){return new _({vd:this.getDescription()})}setEmpty(){this.setEmptyImpl()}applyTransformation(t){if(this.isEmpty())return;if(t.isIdentity())return;const e=this.m_vertexAttributes.get(0);1===t.m_TransformationType?e.applyTransformation(t,0,this.m_pointCount):(0,i.t)("3d xform not impl"),this.notifyModifiedFlags(2001)}calculateArea2D(){return 0}calculateLength2D(){return 0}calculateLength3D(t){return 0}equals(t,e){return t.getGeometryType()===i.G.enumMultiPoint&&this.equalsBase(t,e)}queryEnvelope(t){4===t.m_EnvelopeType?(this.updateAllDirtyIntervals(!0),this.m_envelopeData.copyTo(this.m_description,t)):2===t.m_EnvelopeType?this.updateEnvelope(t):(0,i.t)("")}getImpl(){return this}getBoundary(){return null}reserve(t){this.reserveImpl(t)}clone(){const t=this.createInstance();return this.copyTo(t),t}swap(t){(0,i.g)(0)}buildQuadTreeAccelerator(t){return!1}getHashCodeImpl(){return(0,i.g)(0),0}equalsImpl(t){return!0}equalsImplTol(t,e){return!0}copyToImpl(t,e){}toFlatGeometry(){return{type:"multipoint",...this.exportVertexAttributes(),...n.y}}}_.type=i.G.enumMultiPoint;class p{constructor(){this.m_EnvelopeType=5,this.envAabb=o.Envelope2D.constructEmpty(),this.envRot=o.Envelope2D.constructEmpty()}static constructEmpty(){return new p}width(){return this.envAabb.width()}height(){return this.envAabb.height()}maxDim(){return Math.max(this.width(),this.height())}setEmpty(){this.envAabb.setEmpty(),this.envRot.setEmpty()}setCoords(t){this.envAabb.setCoords(t),this.envRot.setCoords({x:f(t),y:x(t)})}setFromPoints(t,e){this.setEmpty(),this.mergePoints(t,e)}mergeNe(t){this.envAabb.mergeNe(t),this.envRot.mergeNeCoords(f(t),x(t))}mergePoints(t,e){this.envAabb.mergePoints(t,e);for(let s=0;s<e;){if(!this.envRot.isEmpty()){for(let i=s;i<e;i++){const e=f(t[i]),s=x(t[i]);this.envRot.mergeNeCoords(e,s)}break}{const e=f(t[s]),i=x(t[s]);this.envRot.setCoords({x:e,y:i}),s++}}}isIntersectingPoint2D(t){return!(!this.envAabb.contains(t)||!this.envRot.containsCoords(f(t),x(t)))}isIntersectingW(t){return this.envAabb.isIntersecting(t.envAabb)&&this.envRot.isIntersecting(t.envRot)}containsW(t){return!(!this.envAabb.containsEnvelope(t.envAabb)||!this.envRot.containsEnvelope(t.envRot))}containsPoint2D(t){return this.isIntersectingPoint2D(t)}intersectW(t){const e=this.envAabb.intersect(t.envAabb),s=this.envRot.intersect(t.envRot);return e&&!s&&this.envAabb.setEmpty(),s&&!e&&this.envRot.setEmpty(),e&&s}inflate(t){this.envAabb.inflateCoords(t,t);const e=t*(0,r.D)();this.envRot.inflateCoords(e,e),e<0&&p.st_reduceEmpty(this)}static st_reduceEmpty(t){const e=t.envAabb.isEmpty(),s=t.envRot.isEmpty();e&&!s?t.envRot.setEmpty():s&&!e&&t.envAabb.setEmpty()}sqrMaxMinDistance(t){const e=this.envAabb.sqrMaxMinDistance(t),s=this.envRot.sqrMaxMinDistance(P(t))/2;return Math.max(e,s)}sqrMinDistance(t){const e=this.envAabb.sqrMinDistance(t),s=this.envRot.sqrMinDistance(P(t))/2;return Math.max(e,s)}sqrMaxDistance(t){const e=this.envAabb.sqrMaxDistance(t),s=this.envRot.sqrMaxDistance(P(t))/2;return Math.max(e,s)}getEnvelope2D(){return this.envAabb}getRotatedEnvelope2D(){return this.envRot}xyRot(t,e){const s=function(t,e){return t-e}(t.x,t.y),i=function(t,e){return t+e}(t.x,t.y);e.setCoords(s,i)}}function f(t){return t.x-t.y}function x(t){return t.x+t.y}function P(t){return new r.P(f(t),x(t))}class y{constructor(){this.x=r.H.getNAN(),this.y=r.H.getNAN()}static getNAN(){return new y}static constructPoint2D(t){const e=new y;return e.x.set(t.x),e.y.set(t.y),e}static constructCoords(t,e){const s=new y;return s.x.set(t),s.y.set(e),s}static constructCoordsE(t,e){const s=new y;return s.setCoordsE(t,e),s}get 0(){return this.x.clone()}set 0(t){this.x.setE(t)}get 1(){return this.y.clone()}set 1(t){this.y.setE(t)}clone(){return(new y).setE(this)}scaleThis(t){return this.x.mulThisE(t),this.y.mulThisE(t),this}setCoords(t,e){return this.x.set(t),this.y.set(e),this}setCoordsE(t,e){return this.x.setE(t),this.y.setE(e),this}set(t){return this.x.set(t.x),this.y.set(t.y),this}setE(t){return this.x.setE(t.x),this.y.setE(t.y),this}setWithEps(t,e){return this.x.setWithEps(t.x,e),this.y.setWithEps(t.y,e),this}getUnitVector(){const t=this.clone();return t.normalize(),t}sqrLength(){return this.x.sqr().addE(this.y.sqr())}length(){return this.sqrLength().sqrt()}mulE(t){const e=new y;return e.setCoordsE(this.x.mulE(t),this.y.mulE(t)),e}mul(t){const e=new y;return e.setCoordsE(this.x.mul(t),this.y.mul(t)),e}mulThis(t){return this.x.mulThis(t),this.y.mulThis(t),this}mulThisE(t){return this.x.mulThisE(t),this.y.mulThisE(t),this}divE(t){return this.clone().divThisE(t)}divThisE(t){return this.x.divThisE(t),this.y.divThisE(t),this}normalize(){const t=this.length();0===t.value()?(this.x=r.I.clone(),this.y=r.J.clone()):(this.x.divThisE(t),this.y.divThisE(t))}addE(t){return this.clone().addThisE(t)}addThisE(t){return this.x.addThisE(t.x),this.y.addThisE(t.y),this}subE(t){return this.clone().subThisE(t)}subThisE(t){return this.x.subThisE(t.x),this.y.subThisE(t.y),this}static distance(t,e){return t.subE(e).length()}negateThis(){return this.x.negateThis(),this.y.negateThis(),this}eq(t){return this.x.eq(t.x)&&this.y.eq(t.y)}isZero(){return this.x.isZero()&&this.y.isZero()}isTrueZero(){return!this.x.value()&&!this.y.value()}rotateDirect(t,e){const s=this.x.mulE(t).subThisE(this.y.mulE(e)),i=this.x.mulE(e).addThisE(this.y.mulE(t));return this.x.setE(s),this.y.setE(i),this}rotateReverse(t,e){const s=this.x.mulE(t).addThisE(this.y.mulE(e)),i=this.x.negate().mulThisE(e).addThisE(this.y.mulE(t));return this.x.setE(s),this.y.setE(i),this}dotProduct(t){return this.x.mulE(t.x).addE(this.y.mulE(t.y))}crossProduct(t){return this.x.mulE(t.y).subE(this.y.mulE(t.x))}value(){return r.P.construct(this.x.value(),this.y.value())}}class v{constructor(){this.a11=new r.H(1),this.a12=new r.H(0),this.a21=new r.H(0),this.a22=new r.H(1)}clone(){const t=new v;return t.a11.setE(this.a11),t.a12.setE(this.a12),t.a21.setE(this.a21),t.a22.setE(this.a22),t}assign(t){return this.a11.setE(t.a11),this.a12.setE(t.a12),this.a21.setE(t.a21),this.a22.setE(t.a22),this}mulThis(t){const e=this.a11.mulE(t.a11).addThisE(this.a12.mulE(t.a21)),s=this.a11.mulE(t.a12).addThisE(this.a12.mulE(t.a22)),i=this.a21.mulE(t.a11).addThisE(this.a22.mulE(t.a21)),n=this.a21.mulE(t.a12).addThisE(this.a22.mulE(t.a22));return this.a11=e,this.a12=s,this.a21=i,this.a22=n,this}mulLeftThis(t){const e=t.clone();return this.assign(e.mulThis(this)),this}det(){return this.a11.mulE(this.a22).subThisE(this.a12.mulE(this.a21))}invertThis(){const t=this.det();if(0!==t.value()){const e=this.a22.divE(t),s=this.a12.negate().divThisE(t),i=this.a21.negate().divThisE(t),n=this.a11.divE(t);this.a11=e,this.a12=s,this.a21=i,this.a22=n}else this.setZero();return!t.isZero()}transposeThis(){return this.a21=(0,r.c)(this.a12,this.a12=this.a21),this}eigenSymmetric(t,e){const s=this.a12.clone();s.addThisE(this.a21),s.mulThisByPower2(.5);let i=new r.H(1),n=new r.H(0);if(s.isZero())t[0].setE(this.a11),t[1].setE(this.a22);else{const e=new r.H(1);if(this.a11.ne(this.a22)){const o=this.a11.subE(this.a22).divE(s);o.mulThisByPower2(.5);const a=o.sqr();e.setE(o),e.absThis(),e.subThisE(a.add(1).sqrtThis()),o.gt(r.J)&&e.negateThis();const h=e.sqr().addThis(1).sqrtThis().invThis();n=e.mulE(h),i.setE(h);const m=e.mulE(s);t[0]=this.a11.addE(m),t[1]=this.a22.subE(m)}else i=new r.H(1/Math.sqrt(2)),n=i.clone(),t[0]=this.a11.addE(s),t[1]=this.a22.subE(s)}e[0].x=i.toDouble(),e[0].y=n.toDouble(),e[1].x=n.negate().toDouble(),e[1].y=i.toDouble(),Math.abs(t[0].toDouble())>Math.abs(t[1].toDouble())&&(t[1]=(0,r.c)(t[0],t[0]=t[1]),e[1]=(0,r.c)(e[0],e[0]=e[1]))}setZero(){this.a11.set(0),this.a21.set(0),this.a12.set(0),this.a22.set(0)}}class C{static constructPoint2D(t){return new C(r.M.constructDouble(t.x),r.M.constructDouble(t.y))}constructor(t,e){if(void 0===t)return this.x=(new r.M).setNAN(),void(this.y=(new r.M).setNAN());this.x=t.clone(),this.y=e.clone()}assignPoint2D(t){return this.x.setDouble(t.x),this.y.setDouble(t.y),this}setCoords(t,e){return this.x.setThis(t),this.y.setThis(e),this}asPoint2D(){return new r.P(this.x.value(),this.y.value())}crossProduct(t){return this.x.mul(t.y).sub(this.y.mul(t.x))}leftPerpendicularThis(){const t=this.x.clone();this.x=this.y.clone().negate(),this.y=t}clone(){return new C(this.x,this.y)}dotProduct(t){return this.x.mul(t.x).add(this.y.mul(t.y))}add(t){return new C(this.x.add(t.x),this.y.add(t.y))}sub(t){return new C(this.x.sub(t.x),this.y.sub(t.y))}sqrLength(){return this.x.sqr().addThis(this.y.sqr())}mulThis(t){return this.x.mulThis(t),this.y.mulThis(t),this}mul(t){return this.clone().mulThis(t)}subThis(t){return this.x.subThis(t.x),this.y.subThis(t.y),this}addThis(t){return this.x.addThis(t.x),this.y.addThis(t.y),this}}var E=n.V;function b(t){let e=!1;for(let s=0;s<2;s++){const i=(0,r.F)(t[0][s],t[3][s]);i>0?((0,r.F)(t[0][s],t[1][s])<0&&(t[1][s]=t[0][s],e=!0),(0,r.F)(t[1][s],t[3][s])<0&&(t[1][s]=t[3][s],e=!0),(0,r.F)(t[0][s],t[2][s])<0&&(t[2][s]=t[0][s],e=!0),(0,r.F)(t[2][s],t[3][s])<0&&(t[2][s]=t[3][s],e=!0),(0,r.F)(t[1][s],t[2][s])<0&&(t[2][s]=t[1][s],e=!0)):i<0?((0,r.F)(t[0][s],t[1][s])>0&&(t[1][s]=t[0][s],e=!0),(0,r.F)(t[1][s],t[3][s])>0&&(t[1][s]=t[3][s],e=!0),(0,r.F)(t[0][s],t[2][s])>0&&(t[2][s]=t[0][s],e=!0),(0,r.F)(t[2][s],t[3][s])>0&&(t[2][s]=t[3][s],e=!0),(0,r.F)(t[1][s],t[2][s])>0&&(t[2][s]=t[1][s],e=!0)):t[1][s]===t[0][s]&&t[2][s]===t[0][s]||(t[1][s]=t[0][s],t[2][s]=t[0][s],e=!0)}return e}function D(t,e){const s=t.getStartXY();if(s.equals(e.getStartXY()))return!0;if(s.equals(e.getEndXY()))return!0;const i=t.getEndXY();return!!i.equals(e.getStartXY())||!!i.equals(e.getEndXY())}function S(t,e){let s=t.calculateLowerLength2D();return!(s>e)&&(!!t.isLine()||(s=t.calculateUpperLength2D(),s<=e||0!==e&&t.calculateLength2D()<=e))}function w(t,e,s){const n=(0,r.m)(r.P,4);let o=t.queryControlPointsHelper(n);const a=(0,r.m)(r.P,4);let h=e.queryControlPointsHelper(a);n[0].equals(a[0])||(0,i.w)("");const m=t.getGeometryType();if(m===e.getGeometryType()&&n.map((t,e)=>a[e].equals(t)).reduce((t,e)=>t&&e)){if(m!==i.G.enumRationalBezier2)return 0;{const s=e,i=[0,0,0],n=[0,0,0];if(t.queryWeights(i),s.queryWeights(n),i.map((t,e)=>n[e]===t).reduce((t,e)=>t&&e))return 0}}for(;o>2&&n[1].equals(n[0]);)n.splice(1,1),o--;for(;h>2&&a[1].equals(a[0]);)a.splice(1,1),h--;(n[1].equals(n[0])||a[1].equals(n[0]))&&(0,i.w)("");const u=r.P.compareVectorsOrigin(n[0],n[1],a[1]);if(0===u){const s=C.constructPoint2D(n[0]),i=new C;t.queryCoord2DMP(1e-16,i),i.sub(s);const r=new C;return e.queryCoord2DMP(1e-16,r),r.sub(s),r.crossProduct(i).sign()}return u}function A(t,e,s,n,o,a,h,m){let u=t.calculateUpperLength2D(),l=e.calculateUpperLength2D(),c=t,g=e,d=!1;u>l&&(g=(0,r.c)(c,c=g),n=(0,r.c)(s,s=n),l=(0,r.c)(u,u=l),d=!0);const _=0===s;{h[0]=_?1:0;const t=c.getCoord2D(h[0]);m[0]=g.getClosestCoordinate(t,!1);const e=g.getCoord2D(m[0]);if(r.P.distance(t,e)<=o){const e=[.5,.75,.25,.1,.9];let s=!0;for(let i=0;i<e.length;i++)if(t.assign(c.getCoord2D(e[i])),!g.isCloserThanDistance(t,new r.E(0,1),o)){s=!1;break}if(s)return d&&(m[0]=(0,r.c)(h[0],h[0]=m[0])),1}}if(u<=3*o)return 0;let p=(0,r.s)(Math.max(o/u,.1),0,.5),f=.01*o,x=0,P=0,y=p,v=-1,C=0,E=1/32;for(let t=0;;t++){(0,i.g)(t<4095);const e=_?p:1-p,s=c.getCoord2D(e),u=g.getClosestCoordinate(s,!1);if(u===n)return C;const l=g.getCoord2D(u),b=r.P.distance(s,l);if(0===t&&(v=b),b<=f?(E=.5,P=b,x=p):(y=p,v=b),Math.abs(P-v)>.1*f&&y-x>1e-16)p=(0,r.q)(x,y,E);else{if(h[C]=e,m[C]=u,d