earthsdk3 3.6.2 → 3.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/earthsdk3.iife.js +3 -3
- package/dist/earthsdk3.js +417 -412
- package/dist/earthsdk3.umd.cjs +3 -3
- package/dist/types/ESObjects/general/ES3DTileset/index.d.ts +4 -0
- package/dist/types/ESObjects/general/ES3DTileset/index.d.ts.map +1 -1
- package/dist/types/ESObjects/general/ESPipeserTileset.d.ts +1 -0
- package/dist/types/ESObjects/general/ESPipeserTileset.d.ts.map +1 -1
- package/dist/types/ESObjects/general/ESRtsFeatureEditing/index.d.ts +1 -0
- package/dist/types/ESObjects/general/ESRtsFeatureEditing/index.d.ts.map +1 -1
- package/dist/types/ESObjects/general/ESRtsTileset/index.d.ts +1 -0
- package/dist/types/ESObjects/general/ESRtsTileset/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/earthsdk3.iife.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var EarthSDK3=function(v){"use strict";var sR=Object.defineProperty;var oR=(v,Xs,Eu)=>Xs in v?sR(v,Xs,{enumerable:!0,configurable:!0,writable:!0,value:Eu}):v[Xs]=Eu;var f=(v,Xs,Eu)=>oR(v,typeof Xs!="symbol"?Xs+"":Xs,Eu);var ss;function Xs(){var n;const r=((n=window==null?void 0:window.navigator)==null?void 0:n.userAgent)??"unknown";let t="Unknown";/Windows/.test(r)?t="Windows":/Macintosh/.test(r)?t="MacOS":/Linux/.test(r)?t="Linux":/Android/.test(r)?t="Android":/iOS|iPhone|iPad|iPod/.test(r)&&(t="iOS");let e="Unknown";return/x64|x86_64|Win64|WOW64/.test(r)?e="x64":/x86|i686|Win32/.test(r)?e="x86":/arm64|aarch64/.test(r)?e="arm64":/arm/.test(r)&&(e="arm"),{os:t.toLocaleLowerCase(),arch:e.toLocaleLowerCase()}}const Eu=Date.now();function u_(r){var a;const{os:t,arch:e}=Xs(),n={version:r.version,commitdate:r.date,commitId:r.commitId,runningTime:(Date.now()-Eu)/1e3/60|0,date:new Date().toLocaleString(),href:((a=window==null?void 0:window.location)==null?void 0:a.href)??"unknown",os:t,arch:e},s={method:"GET",headers:new Headers,redirect:"follow"},o=window.encodeURIComponent(JSON.stringify(n));fetch(`https://account.bjxbsj.cn/api/product/record?product=EarthSDKJS&content=${o}`,s).then(u=>u.text()).then(u=>console.log(u)).catch(u=>console.log("error",u))}v.copyright=void 0;try{const r="earthsdk3",t="3.6.
|
|
1
|
+
var EarthSDK3=function(v){"use strict";var sR=Object.defineProperty;var oR=(v,Xs,Eu)=>Xs in v?sR(v,Xs,{enumerable:!0,configurable:!0,writable:!0,value:Eu}):v[Xs]=Eu;var f=(v,Xs,Eu)=>oR(v,typeof Xs!="symbol"?Xs+"":Xs,Eu);var ss;function Xs(){var n;const r=((n=window==null?void 0:window.navigator)==null?void 0:n.userAgent)??"unknown";let t="Unknown";/Windows/.test(r)?t="Windows":/Macintosh/.test(r)?t="MacOS":/Linux/.test(r)?t="Linux":/Android/.test(r)?t="Android":/iOS|iPhone|iPad|iPod/.test(r)&&(t="iOS");let e="Unknown";return/x64|x86_64|Win64|WOW64/.test(r)?e="x64":/x86|i686|Win32/.test(r)?e="x86":/arm64|aarch64/.test(r)?e="arm64":/arm/.test(r)&&(e="arm"),{os:t.toLocaleLowerCase(),arch:e.toLocaleLowerCase()}}const Eu=Date.now();function u_(r){var a;const{os:t,arch:e}=Xs(),n={version:r.version,commitdate:r.date,commitId:r.commitId,runningTime:(Date.now()-Eu)/1e3/60|0,date:new Date().toLocaleString(),href:((a=window==null?void 0:window.location)==null?void 0:a.href)??"unknown",os:t,arch:e},s={method:"GET",headers:new Headers,redirect:"follow"},o=window.encodeURIComponent(JSON.stringify(n));fetch(`https://account.bjxbsj.cn/api/product/record?product=EarthSDKJS&content=${o}`,s).then(u=>u.text()).then(u=>console.log(u)).catch(u=>console.log("error",u))}v.copyright=void 0;try{const r="earthsdk3",t="3.6.3",e="2025-12-22T03:45:39.000Z",n="北京西部世界科技有限公司",i="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",s="aa1f9890101d404875e17142255a5b00304f8f89",a=((Date.now()-1766375139e3)/36e5).toFixed(1),u=`%c🌏 ${r}%c ${t}.${s.slice(0,8)}.${e} (距今${a}个小时)
|
|
2
2
|
%c${i?i+`
|
|
3
3
|
`:""}当前网站正在使用${r},此软件版权归${n}所有
|
|
4
|
-
`;v.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","
|
|
4
|
+
`;v.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","aa1f9890101d404875e17142255a5b00304f8f89")},get info(){return u},get date(){return"2025-12-22T03:45:39.000Z"},get author(){return"suplyang"},get version(){return"3.6.3"},get name(){return"earthsdk3"},get commitId(){return"aa1f9890101d404875e17142255a5b00304f8f89"},print(){console.info(this.info,`
|
|
5
5
|
font-size: 18px;
|
|
6
6
|
font-weight: 1000;
|
|
7
7
|
line-height: 1;
|
|
@@ -65,7 +65,7 @@ northing meters`+r;var d=c/2,p=0,g=0,y,w,b,m,E;return d>0&&(y=1e5/Math.pow(10,d)
|
|
|
65
65
|
`);var s=t+(e?" ":"│ ");r.left&&Fg(r.left,s,!1,n,i),r.right&&Fg(r.right,s,!0,n,i)}}var kg=function(){function r(t){t===void 0&&(t=iN),this._root=null,this._size=0,this._comparator=t}return r.prototype.insert=function(t,e){return this._size++,this._root=Lg(t,e,this._root,this._comparator)},r.prototype.add=function(t,e){var n=new jo(t,e);this._root===null&&(n.left=n.right=null,this._size++,this._root=n);var i=this._comparator,s=Vo(t,this._root,i),o=i(t,s.key);return o===0?this._root=s:(o<0?(n.left=s.left,n.right=s,s.left=null):o>0&&(n.right=s.right,n.left=s,s.right=null),this._size++,this._root=n),this._root},r.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},r.prototype._remove=function(t,e,n){var i;if(e===null)return null;e=Vo(t,e,n);var s=n(t,e.key);return s===0?(e.left===null?i=e.right:(i=Vo(t,e.left,n),i.right=e.right),this._size--,i):e},r.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=Vo(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},r.prototype.findStatic=function(t){for(var e=this._root,n=this._comparator;e;){var i=n(t,e.key);if(i===0)return e;i<0?e=e.left:e=e.right}return null},r.prototype.find=function(t){return this._root&&(this._root=Vo(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},r.prototype.contains=function(t){for(var e=this._root,n=this._comparator;e;){var i=n(t,e.key);if(i===0)return!0;i<0?e=e.left:e=e.right}return!1},r.prototype.forEach=function(t,e){for(var n=this._root,i=[],s=!1;!s;)n!==null?(i.push(n),n=n.left):i.length!==0?(n=i.pop(),t.call(e,n),n=n.right):s=!0;return this},r.prototype.range=function(t,e,n,i){for(var s=[],o=this._comparator,a=this._root,u;s.length!==0||a;)if(a)s.push(a),a=a.left;else{if(a=s.pop(),u=o(a.key,e),u>0)break;if(o(a.key,t)>=0&&n.call(i,a))return this;a=a.right}return this},r.prototype.keys=function(){var t=[];return this.forEach(function(e){var n=e.key;return t.push(n)}),t},r.prototype.values=function(){var t=[];return this.forEach(function(e){var n=e.data;return t.push(n)}),t},r.prototype.min=function(){return this._root?this.minNode(this._root).key:null},r.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},r.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},r.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},r.prototype.at=function(t){for(var e=this._root,n=!1,i=0,s=[];!n;)if(e)s.push(e),e=e.left;else if(s.length>0){if(e=s.pop(),i===t)return e;i++,e=e.right}else n=!0;return null},r.prototype.next=function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var i=this._comparator;e;){var s=i(t.key,e.key);if(s===0)break;s<0?(n=e,e=e.left):e=e.right}return n},r.prototype.prev=function(t){var e=this._root,n=null;if(t.left!==null){for(n=t.left;n.right;)n=n.right;return n}for(var i=this._comparator;e;){var s=i(t.key,e.key);if(s===0)break;s<0?e=e.left:(n=e,e=e.right)}return n},r.prototype.clear=function(){return this._root=null,this._size=0,this},r.prototype.toList=function(){return aN(this._root)},r.prototype.load=function(t,e,n){e===void 0&&(e=[]),n===void 0&&(n=!1);var i=t.length,s=this._comparator;if(n&&Vg(t,e,0,i-1,s),this._root===null)this._root=Gg(t,e,0,i),this._size=i;else{var o=uN(this.toList(),oN(t,e),s);i=this._size+i,this._root=jg({head:o},0,i)}return this},r.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(r.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),r.prototype.toString=function(t){t===void 0&&(t=function(n){return String(n.key)});var e=[];return Fg(this._root,"",!0,function(n){return e.push(n)},t),e.join("")},r.prototype.update=function(t,e,n){var i=this._comparator,s=g1(t,this._root,i),o=s.left,a=s.right;i(t,e)<0?a=Lg(e,n,a,i):o=Lg(e,n,o,i),this._root=sN(o,a,i)},r.prototype.split=function(t){return g1(t,this._root,this._comparator)},r.prototype[Symbol.iterator]=function(){var t,e,n;return rN(this,function(i){switch(i.label){case 0:t=this._root,e=[],n=!1,i.label=1;case 1:return n?[3,6]:t===null?[3,2]:(e.push(t),t=t.left,[3,5]);case 2:return e.length===0?[3,4]:(t=e.pop(),[4,t]);case 3:return i.sent(),t=t.right,[3,5];case 4:n=!0,i.label=5;case 5:return[3,1];case 6:return[2]}})},r}();function Gg(r,t,e,n){var i=n-e;if(i>0){var s=e+Math.floor(i/2),o=r[s],a=t[s],u=new jo(o,a);return u.left=Gg(r,t,e,s),u.right=Gg(r,t,s+1,n),u}return null}function oN(r,t){for(var e=new jo(null,null),n=e,i=0;i<r.length;i++)n=n.next=new jo(r[i],t[i]);return n.next=null,e.next}function aN(r){for(var t=r,e=[],n=!1,i=new jo(null,null),s=i;!n;)t?(e.push(t),t=t.left):e.length>0?(t=s=s.next=e.pop(),t=t.right):n=!0;return s.next=null,i.next}function jg(r,t,e){var n=e-t;if(n>0){var i=t+Math.floor(n/2),s=jg(r,t,i),o=r.head;return o.left=s,r.head=r.head.next,o.right=jg(r,i+1,e),o}return null}function uN(r,t,e){for(var n=new jo(null,null),i=n,s=r,o=t;s!==null&&o!==null;)e(s.key,o.key)<0?(i.next=s,s=s.next):(i.next=o,o=o.next),i=i.next;return s!==null?i.next=s:o!==null&&(i.next=o),n.next}function Vg(r,t,e,n,i){if(!(e>=n)){for(var s=r[e+n>>1],o=e-1,a=n+1;;){do o++;while(i(r[o],s)<0);do a--;while(i(r[a],s)>0);if(o>=a)break;var u=r[o];r[o]=r[a],r[a]=u,u=t[o],t[o]=t[a],t[a]=u}Vg(r,t,e,a,i),Vg(r,t,a+1,n,i)}}const ro=11102230246251565e-32,$n=134217729,lN=(3+8*ro)*ro;function Bg(r,t,e,n,i){let s,o,a,u,l=t[0],h=n[0],c=0,d=0;h>l==h>-l?(s=l,l=t[++c]):(s=h,h=n[++d]);let p=0;if(c<r&&d<e)for(h>l==h>-l?(o=l+s,a=s-(o-l),l=t[++c]):(o=h+s,a=s-(o-h),h=n[++d]),s=o,a!==0&&(i[p++]=a);c<r&&d<e;)h>l==h>-l?(o=s+l,u=o-s,a=s-(o-u)+(l-u),l=t[++c]):(o=s+h,u=o-s,a=s-(o-u)+(h-u),h=n[++d]),s=o,a!==0&&(i[p++]=a);for(;c<r;)o=s+l,u=o-s,a=s-(o-u)+(l-u),l=t[++c],s=o,a!==0&&(i[p++]=a);for(;d<e;)o=s+h,u=o-s,a=s-(o-u)+(h-u),h=n[++d],s=o,a!==0&&(i[p++]=a);return(s!==0||p===0)&&(i[p++]=s),p}function hN(r,t){let e=t[0];for(let n=1;n<r;n++)e+=t[n];return e}function Zh(r){return new Float64Array(r)}const cN=(3+16*ro)*ro,dN=(2+12*ro)*ro,fN=(9+64*ro)*ro*ro,$u=Zh(4),m1=Zh(8),v1=Zh(12),_1=Zh(16),lr=Zh(4);function pN(r,t,e,n,i,s,o){let a,u,l,h,c,d,p,g,y,w,b,m,E,_,S,C,P,x;const M=r-i,O=e-i,I=t-s,T=n-s;_=M*T,d=$n*M,p=d-(d-M),g=M-p,d=$n*T,y=d-(d-T),w=T-y,S=g*w-(_-p*y-g*y-p*w),C=I*O,d=$n*I,p=d-(d-I),g=I-p,d=$n*O,y=d-(d-O),w=O-y,P=g*w-(C-p*y-g*y-p*w),b=S-P,c=S-b,$u[0]=S-(b+c)+(c-P),m=_+b,c=m-_,E=_-(m-c)+(b-c),b=E-C,c=E-b,$u[1]=E-(b+c)+(c-C),x=m+b,c=x-m,$u[2]=m-(x-c)+(b-c),$u[3]=x;let A=hN(4,$u),G=dN*o;if(A>=G||-A>=G||(c=r-M,a=r-(M+c)+(c-i),c=e-O,l=e-(O+c)+(c-i),c=t-I,u=t-(I+c)+(c-s),c=n-T,h=n-(T+c)+(c-s),a===0&&u===0&&l===0&&h===0)||(G=fN*o+lN*Math.abs(A),A+=M*h+T*a-(I*l+O*u),A>=G||-A>=G))return A;_=a*T,d=$n*a,p=d-(d-a),g=a-p,d=$n*T,y=d-(d-T),w=T-y,S=g*w-(_-p*y-g*y-p*w),C=u*O,d=$n*u,p=d-(d-u),g=u-p,d=$n*O,y=d-(d-O),w=O-y,P=g*w-(C-p*y-g*y-p*w),b=S-P,c=S-b,lr[0]=S-(b+c)+(c-P),m=_+b,c=m-_,E=_-(m-c)+(b-c),b=E-C,c=E-b,lr[1]=E-(b+c)+(c-C),x=m+b,c=x-m,lr[2]=m-(x-c)+(b-c),lr[3]=x;const nt=Bg(4,$u,4,lr,m1);_=M*h,d=$n*M,p=d-(d-M),g=M-p,d=$n*h,y=d-(d-h),w=h-y,S=g*w-(_-p*y-g*y-p*w),C=I*l,d=$n*I,p=d-(d-I),g=I-p,d=$n*l,y=d-(d-l),w=l-y,P=g*w-(C-p*y-g*y-p*w),b=S-P,c=S-b,lr[0]=S-(b+c)+(c-P),m=_+b,c=m-_,E=_-(m-c)+(b-c),b=E-C,c=E-b,lr[1]=E-(b+c)+(c-C),x=m+b,c=x-m,lr[2]=m-(x-c)+(b-c),lr[3]=x;const J=Bg(nt,m1,4,lr,v1);_=a*h,d=$n*a,p=d-(d-a),g=a-p,d=$n*h,y=d-(d-h),w=h-y,S=g*w-(_-p*y-g*y-p*w),C=u*l,d=$n*u,p=d-(d-u),g=u-p,d=$n*l,y=d-(d-l),w=l-y,P=g*w-(C-p*y-g*y-p*w),b=S-P,c=S-b,lr[0]=S-(b+c)+(c-P),m=_+b,c=m-_,E=_-(m-c)+(b-c),b=E-C,c=E-b,lr[1]=E-(b+c)+(c-C),x=m+b,c=x-m,lr[2]=m-(x-c)+(b-c),lr[3]=x;const st=Bg(J,v1,4,lr,_1);return _1[st-1]}function gN(r,t,e,n,i,s){const o=(t-s)*(e-i),a=(r-i)*(n-s),u=o-a,l=Math.abs(o+a);return Math.abs(u)>=cN*l?u:-pN(r,t,e,n,i,s,l)}const Kh=(r,t)=>r.ll.x<=t.x&&t.x<=r.ur.x&&r.ll.y<=t.y&&t.y<=r.ur.y,zg=(r,t)=>{if(t.ur.x<r.ll.x||r.ur.x<t.ll.x||t.ur.y<r.ll.y||r.ur.y<t.ll.y)return null;const e=r.ll.x<t.ll.x?t.ll.x:r.ll.x,n=r.ur.x<t.ur.x?r.ur.x:t.ur.x,i=r.ll.y<t.ll.y?t.ll.y:r.ll.y,s=r.ur.y<t.ur.y?r.ur.y:t.ur.y;return{ll:{x:e,y:i},ur:{x:n,y:s}}};let Bo=Number.EPSILON;Bo===void 0&&(Bo=Math.pow(2,-52));const mN=Bo*Bo,y1=(r,t)=>{if(-Bo<r&&r<Bo&&-Bo<t&&t<Bo)return 0;const e=r-t;return e*e<mN*r*t?0:r<t?-1:1};class vN{constructor(){this.reset()}reset(){this.xRounder=new w1,this.yRounder=new w1}round(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}class w1{constructor(){this.tree=new kg,this.round(0)}round(t){const e=this.tree.add(t),n=this.tree.prev(e);if(n!==null&&y1(e.key,n.key)===0)return this.tree.remove(t),n.key;const i=this.tree.next(e);return i!==null&&y1(e.key,i.key)===0?(this.tree.remove(t),i.key):t}}const Qh=new vN,qd=(r,t)=>r.x*t.y-r.y*t.x,E1=(r,t)=>r.x*t.x+r.y*t.y,S1=(r,t,e)=>{const n=gN(r.x,r.y,t.x,t.y,e.x,e.y);return n>0?-1:n<0?1:0},Wd=r=>Math.sqrt(E1(r,r)),_N=(r,t,e)=>{const n={x:t.x-r.x,y:t.y-r.y},i={x:e.x-r.x,y:e.y-r.y};return qd(i,n)/Wd(i)/Wd(n)},yN=(r,t,e)=>{const n={x:t.x-r.x,y:t.y-r.y},i={x:e.x-r.x,y:e.y-r.y};return E1(i,n)/Wd(i)/Wd(n)},C1=(r,t,e)=>t.y===0?null:{x:r.x+t.x/t.y*(e-r.y),y:e},b1=(r,t,e)=>t.x===0?null:{x:e,y:r.y+t.y/t.x*(e-r.x)},wN=(r,t,e,n)=>{if(t.x===0)return b1(e,n,r.x);if(n.x===0)return b1(r,t,e.x);if(t.y===0)return C1(e,n,r.y);if(n.y===0)return C1(r,t,e.y);const i=qd(t,n);if(i==0)return null;const s={x:e.x-r.x,y:e.y-r.y},o=qd(s,t)/i,a=qd(s,n)/i,u=r.x+a*t.x,l=e.x+o*n.x,h=r.y+a*t.y,c=e.y+o*n.y,d=(u+l)/2,p=(h+c)/2;return{x:d,y:p}};class si{static compare(t,e){const n=si.comparePoints(t.point,e.point);return n!==0?n:(t.point!==e.point&&t.link(e),t.isLeft!==e.isLeft?t.isLeft?1:-1:zo.compare(t.segment,e.segment))}static comparePoints(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}constructor(t,e){t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=e}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");const e=t.point.events;for(let n=0,i=e.length;n<i;n++){const s=e[n];this.point.events.push(s),s.point=this.point}this.checkForConsuming()}checkForConsuming(){const t=this.point.events.length;for(let e=0;e<t;e++){const n=this.point.events[e];if(n.segment.consumedBy===void 0)for(let i=e+1;i<t;i++){const s=this.point.events[i];s.consumedBy===void 0&&n.otherSE.point.events===s.otherSE.point.events&&n.segment.consume(s.segment)}}}getAvailableLinkedEvents(){const t=[];for(let e=0,n=this.point.events.length;e<n;e++){const i=this.point.events[e];i!==this&&!i.segment.ringOut&&i.segment.isInResult()&&t.push(i)}return t}getLeftmostComparator(t){const e=new Map,n=i=>{const s=i.otherSE;e.set(i,{sine:_N(this.point,t.point,s.point),cosine:yN(this.point,t.point,s.point)})};return(i,s)=>{e.has(i)||n(i),e.has(s)||n(s);const{sine:o,cosine:a}=e.get(i),{sine:u,cosine:l}=e.get(s);return o>=0&&u>=0?a<l?1:a>l?-1:0:o<0&&u<0?a<l?-1:a>l?1:0:u<o?-1:u>o?1:0}}}let EN=0;class zo{static compare(t,e){const n=t.leftSE.point.x,i=e.leftSE.point.x,s=t.rightSE.point.x,o=e.rightSE.point.x;if(o<n)return 1;if(s<i)return-1;const a=t.leftSE.point.y,u=e.leftSE.point.y,l=t.rightSE.point.y,h=e.rightSE.point.y;if(n<i){if(u<a&&u<l)return 1;if(u>a&&u>l)return-1;const c=t.comparePoint(e.leftSE.point);if(c<0)return 1;if(c>0)return-1;const d=e.comparePoint(t.rightSE.point);return d!==0?d:-1}if(n>i){if(a<u&&a<h)return-1;if(a>u&&a>h)return 1;const c=e.comparePoint(t.leftSE.point);if(c!==0)return c;const d=t.comparePoint(e.rightSE.point);return d<0?1:d>0?-1:1}if(a<u)return-1;if(a>u)return 1;if(s<o){const c=e.comparePoint(t.rightSE.point);if(c!==0)return c}if(s>o){const c=t.comparePoint(e.rightSE.point);if(c<0)return 1;if(c>0)return-1}if(s!==o){const c=l-a,d=s-n,p=h-u,g=o-i;if(c>d&&p<g)return 1;if(c<d&&p>g)return-1}return s>o?1:s<o||l<h?-1:l>h?1:t.id<e.id?-1:t.id>e.id?1:0}constructor(t,e,n,i){this.id=++EN,this.leftSE=t,t.segment=this,t.otherSE=e,this.rightSE=e,e.segment=this,e.otherSE=t,this.rings=n,this.windings=i}static fromRing(t,e,n){let i,s,o;const a=si.comparePoints(t,e);if(a<0)i=t,s=e,o=1;else if(a>0)i=e,s=t,o=-1;else throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);const u=new si(i,!0),l=new si(s,!1);return new zo(u,l,[n],[o])}replaceRightSE(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}comparePoint(t){if(this.isAnEndpoint(t))return 0;const e=this.leftSE.point,n=this.rightSE.point,i=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x<e.x?1:-1;const s=(t.y-e.y)/i.y,o=e.x+s*i.x;if(t.x===o)return 0;const a=(t.x-e.x)/i.x,u=e.y+a*i.y;return t.y===u?0:t.y<u?-1:1}getIntersection(t){const e=this.bbox(),n=t.bbox(),i=zg(e,n);if(i===null)return null;const s=this.leftSE.point,o=this.rightSE.point,a=t.leftSE.point,u=t.rightSE.point,l=Kh(e,a)&&this.comparePoint(a)===0,h=Kh(n,s)&&t.comparePoint(s)===0,c=Kh(e,u)&&this.comparePoint(u)===0,d=Kh(n,o)&&t.comparePoint(o)===0;if(h&&l)return d&&!c?o:!d&&c?u:null;if(h)return c&&s.x===u.x&&s.y===u.y?null:s;if(l)return d&&o.x===a.x&&o.y===a.y?null:a;if(d&&c)return null;if(d)return o;if(c)return u;const p=wN(s,this.vector(),a,t.vector());return p===null||!Kh(i,p)?null:Qh.round(p.x,p.y)}split(t){const e=[],n=t.events!==void 0,i=new si(t,!0),s=new si(t,!1),o=this.rightSE;this.replaceRightSE(s),e.push(s),e.push(i);const a=new zo(i,o,this.rings.slice(),this.windings.slice());return si.comparePoints(a.leftSE.point,a.rightSE.point)>0&&a.swapEvents(),si.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),s.checkForConsuming()),e}swapEvents(){const t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let e=0,n=this.windings.length;e<n;e++)this.windings[e]*=-1}consume(t){let e=this,n=t;for(;e.consumedBy;)e=e.consumedBy;for(;n.consumedBy;)n=n.consumedBy;const i=zo.compare(e,n);if(i!==0){if(i>0){const s=e;e=n,n=s}if(e.prev===n){const s=e;e=n,n=s}for(let s=0,o=n.rings.length;s<o;s++){const a=n.rings[s],u=n.windings[s],l=e.rings.indexOf(a);l===-1?(e.rings.push(a),e.windings.push(u)):e.windings[l]+=u}n.rings=null,n.windings=null,n.consumedBy=e,n.leftSE.consumedBy=e.leftSE,n.rightSE.consumedBy=e.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};const e=this._afterState.rings,n=this._afterState.windings,i=this._afterState.multiPolys;for(let a=0,u=this.rings.length;a<u;a++){const l=this.rings[a],h=this.windings[a],c=e.indexOf(l);c===-1?(e.push(l),n.push(h)):n[c]+=h}const s=[],o=[];for(let a=0,u=e.length;a<u;a++){if(n[a]===0)continue;const l=e[a],h=l.poly;if(o.indexOf(h)===-1)if(l.isExterior)s.push(h);else{o.indexOf(h)===-1&&o.push(h);const c=s.indexOf(l.poly);c!==-1&&s.splice(c,1)}}for(let a=0,u=s.length;a<u;a++){const l=s[a].multiPoly;i.indexOf(l)===-1&&i.push(l)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(Gi.type){case"union":{const n=t.length===0,i=e.length===0;this._isInResult=n!==i;break}case"intersection":{let n,i;t.length<e.length?(n=t.length,i=e.length):(n=e.length,i=t.length),this._isInResult=i===Gi.numMultiPolys&&n<i;break}case"xor":{const n=Math.abs(t.length-e.length);this._isInResult=n%2===1;break}case"difference":{const n=i=>i.length===1&&i[0].isSubject;this._isInResult=n(t)!==n(e);break}default:throw new Error(`Unrecognized operation type found ${Gi.type}`)}return this._isInResult}}class P1{constructor(t,e,n){if(!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=n,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const i=Qh.round(t[0][0],t[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};let s=i;for(let o=1,a=t.length;o<a;o++){if(typeof t[o][0]!="number"||typeof t[o][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let u=Qh.round(t[o][0],t[o][1]);u.x===s.x&&u.y===s.y||(this.segments.push(zo.fromRing(s,u,this)),u.x<this.bbox.ll.x&&(this.bbox.ll.x=u.x),u.y<this.bbox.ll.y&&(this.bbox.ll.y=u.y),u.x>this.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),s=u)}(i.x!==s.x||i.y!==s.y)&&this.segments.push(zo.fromRing(s,i,this))}getSweepEvents(){const t=[];for(let e=0,n=this.segments.length;e<n;e++){const i=this.segments[e];t.push(i.leftSE),t.push(i.rightSE)}return t}}class SN{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new P1(t[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let n=1,i=t.length;n<i;n++){const s=new P1(t[n],this,!1);s.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.interiorRings.push(s)}this.multiPoly=e}getSweepEvents(){const t=this.exteriorRing.getSweepEvents();for(let e=0,n=this.interiorRings.length;e<n;e++){const i=this.interiorRings[e].getSweepEvents();for(let s=0,o=i.length;s<o;s++)t.push(i[s])}return t}}class x1{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof t[0][0][0]=="number"&&(t=[t])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let n=0,i=t.length;n<i;n++){const s=new SN(t[n],this);s.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.polys.push(s)}this.isSubject=e}getSweepEvents(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const i=this.polys[e].getSweepEvents();for(let s=0,o=i.length;s<o;s++)t.push(i[s])}return t}}class Hd{static factory(t){const e=[];for(let n=0,i=t.length;n<i;n++){const s=t[n];if(!s.isInResult()||s.ringOut)continue;let o=null,a=s.leftSE,u=s.rightSE;const l=[a],h=a.point,c=[];for(;o=a,a=u,l.push(a),a.point!==h;)for(;;){const d=a.getAvailableLinkedEvents();if(d.length===0){const y=l[0].point,w=l[l.length-1].point;throw new Error(`Unable to complete output ring starting at [${y.x}, ${y.y}]. Last matching segment found ends at [${w.x}, ${w.y}].`)}if(d.length===1){u=d[0].otherSE;break}let p=null;for(let y=0,w=c.length;y<w;y++)if(c[y].point===a.point){p=y;break}if(p!==null){const y=c.splice(p)[0],w=l.splice(y.index);w.unshift(w[0].otherSE),e.push(new Hd(w.reverse()));continue}c.push({index:l.length,point:a.point});const g=a.getLeftmostComparator(o);u=d.sort(g)[0].otherSE;break}e.push(new Hd(l))}return e}constructor(t){this.events=t;for(let e=0,n=t.length;e<n;e++)t[e].segment.ringOut=this;this.poly=null}getGeom(){let t=this.events[0].point;const e=[t];for(let l=1,h=this.events.length-1;l<h;l++){const c=this.events[l].point,d=this.events[l+1].point;S1(c,t,d)!==0&&(e.push(c),t=c)}if(e.length===1)return null;const n=e[0],i=e[1];S1(n,t,i)===0&&e.shift(),e.push(e[0]);const s=this.isExteriorRing()?1:-1,o=this.isExteriorRing()?0:e.length-1,a=this.isExteriorRing()?e.length:-1,u=[];for(let l=o;l!=a;l+=s)u.push([e[l].x,e[l].y]);return u}isExteriorRing(){if(this._isExteriorRing===void 0){const t=this.enclosingRing();this._isExteriorRing=t?!t.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let t=this.events[0];for(let i=1,s=this.events.length;i<s;i++){const o=this.events[i];si.compare(t,o)>0&&(t=o)}let e=t.segment.prevInResult(),n=e?e.prevInResult():null;for(;;){if(!e)return null;if(!n)return e.ringOut;if(n.ringOut!==e.ringOut)return n.ringOut.enclosingRing()!==e.ringOut?e.ringOut:e.ringOut.enclosingRing();e=n.prevInResult(),n=e?e.prevInResult():null}}}class I1{constructor(t){this.exteriorRing=t,t.poly=this,this.interiorRings=[]}addInterior(t){this.interiorRings.push(t),t.poly=this}getGeom(){const t=[this.exteriorRing.getGeom()];if(t[0]===null)return null;for(let e=0,n=this.interiorRings.length;e<n;e++){const i=this.interiorRings[e].getGeom();i!==null&&t.push(i)}return t}}class CN{constructor(t){this.rings=t,this.polys=this._composePolys(t)}getGeom(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const i=this.polys[e].getGeom();i!==null&&t.push(i)}return t}_composePolys(t){const e=[];for(let n=0,i=t.length;n<i;n++){const s=t[n];if(!s.poly)if(s.isExteriorRing())e.push(new I1(s));else{const o=s.enclosingRing();o.poly||e.push(new I1(o)),o.poly.addInterior(s)}}return e}}class bN{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zo.compare;this.queue=t,this.tree=new kg(e),this.segments=[]}process(t){const e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;const i=t.isLeft?this.tree.add(e):this.tree.find(e);if(!i)throw new Error(`Unable to find segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] in SweepLine tree.`);let s=i,o=i,a,u;for(;a===void 0;)s=this.tree.prev(s),s===null?a=null:s.key.consumedBy===void 0&&(a=s.key);for(;u===void 0;)o=this.tree.next(o),o===null?u=null:o.key.consumedBy===void 0&&(u=o.key);if(t.isLeft){let l=null;if(a){const c=a.getIntersection(e);if(c!==null&&(e.isAnEndpoint(c)||(l=c),!a.isAnEndpoint(c))){const d=this._splitSafely(a,c);for(let p=0,g=d.length;p<g;p++)n.push(d[p])}}let h=null;if(u){const c=u.getIntersection(e);if(c!==null&&(e.isAnEndpoint(c)||(h=c),!u.isAnEndpoint(c))){const d=this._splitSafely(u,c);for(let p=0,g=d.length;p<g;p++)n.push(d[p])}}if(l!==null||h!==null){let c=null;l===null?c=h:h===null?c=l:c=si.comparePoints(l,h)<=0?l:h,this.queue.remove(e.rightSE),n.push(e.rightSE);const d=e.split(c);for(let p=0,g=d.length;p<g;p++)n.push(d[p])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=a)}else{if(a&&u){const l=a.getIntersection(u);if(l!==null){if(!a.isAnEndpoint(l)){const h=this._splitSafely(a,l);for(let c=0,d=h.length;c<d;c++)n.push(h[c])}if(!u.isAnEndpoint(l)){const h=this._splitSafely(u,l);for(let c=0,d=h.length;c<d;c++)n.push(h[c])}}}this.tree.remove(e)}return n}_splitSafely(t,e){this.tree.remove(t);const n=t.rightSE;this.queue.remove(n);const i=t.split(e);return i.push(n),t.consumedBy===void 0&&this.tree.add(t),i}}const M1=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,PN=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class xN{run(t,e,n){Gi.type=t,Qh.reset();const i=[new x1(e,!0)];for(let c=0,d=n.length;c<d;c++)i.push(new x1(n[c],!1));if(Gi.numMultiPolys=i.length,Gi.type==="difference"){const c=i[0];let d=1;for(;d<i.length;)zg(i[d].bbox,c.bbox)!==null?d++:i.splice(d,1)}if(Gi.type==="intersection")for(let c=0,d=i.length;c<d;c++){const p=i[c];for(let g=c+1,y=i.length;g<y;g++)if(zg(p.bbox,i[g].bbox)===null)return[]}const s=new kg(si.compare);for(let c=0,d=i.length;c<d;c++){const p=i[c].getSweepEvents();for(let g=0,y=p.length;g<y;g++)if(s.insert(p[g]),s.size>M1)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const o=new bN(s);let a=s.size,u=s.pop();for(;u;){const c=u.key;if(s.size===a){const p=c.segment;throw new Error(`Unable to pop() ${c.isLeft?"left":"right"} SweepEvent [${c.point.x}, ${c.point.y}] from segment #${p.id} [${p.leftSE.point.x}, ${p.leftSE.point.y}] -> [${p.rightSE.point.x}, ${p.rightSE.point.y}] from queue.`)}if(s.size>M1)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(o.segments.length>PN)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const d=o.process(c);for(let p=0,g=d.length;p<g;p++){const y=d[p];y.consumedBy===void 0&&s.insert(y)}a=s.size,u=s.pop()}Qh.reset();const l=Hd.factory(o.segments);return new CN(l).getGeom()}}const Gi=new xN;var Ug={union:function(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return Gi.run("union",r,e)},intersection:function(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return Gi.run("intersection",r,e)},xor:function(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return Gi.run("xor",r,e)},difference:function(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return Gi.run("difference",r,e)}};function IN(r,t){var e=Hn(r),n=Hn(t),i=r.properties||{},s=Ug.difference(e.coordinates,n.coordinates);return s.length===0?null:s.length===1?ye(s[0],i):Eg(s,i)}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var e=Object(this),n=Math.max(Math.min(e.length,9007199254740991),0)||0,i=1 in arguments&&parseInt(Number(arguments[1]),10)||0;i=i<0?Math.max(n+i,0):Math.min(i,n);var s=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:n;for(s=s<0?Math.max(n+arguments[2],0):Math.min(s,n);i<s;)e[i]=t,++i;return e},writable:!0}),Number.isFinite=Number.isFinite||function(r){return typeof r=="number"&&isFinite(r)},Number.isInteger=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(r){return r!==r},Math.trunc=Math.trunc||function(r){return r<0?Math.ceil(r):Math.floor(r)};var Oa=function(){};Oa.prototype.interfaces_=function(){return[]},Oa.prototype.getClass=function(){return Oa},Oa.prototype.equalsWithTolerance=function(t,e,n){return Math.abs(t-e)<=n};var Ce=function(r){function t(e){r.call(this,e),this.name="IllegalArgumentException",this.message=e,this.stack=new r().stack}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t}(Error),Tt=function(){},T1={MAX_VALUE:{configurable:!0}};Tt.isNaN=function(t){return Number.isNaN(t)},Tt.doubleToLongBits=function(t){return t},Tt.longBitsToDouble=function(t){return t},Tt.isInfinite=function(t){return!Number.isFinite(t)},T1.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(Tt,T1);var Pr=function(){},$d=function(){},Xu=function(){};function xr(){}var F=function r(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=r.NULL_ORDINATE;else if(arguments.length===1){var t=arguments[0];this.x=t.x,this.y=t.y,this.z=t.z}else arguments.length===2?(this.x=arguments[0],this.y=arguments[1],this.z=r.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},Da={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};F.prototype.setOrdinate=function(t,e){switch(t){case F.X:this.x=e;break;case F.Y:this.y=e;break;case F.Z:this.z=e;break;default:throw new Ce("Invalid ordinate index: "+t)}},F.prototype.equals2D=function(){if(arguments.length===1){var t=arguments[0];return!(this.x!==t.x||this.y!==t.y)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return!(!Oa.equalsWithTolerance(this.x,e.x,n)||!Oa.equalsWithTolerance(this.y,e.y,n))}},F.prototype.getOrdinate=function(t){switch(t){case F.X:return this.x;case F.Y:return this.y;case F.Z:return this.z}throw new Ce("Invalid ordinate index: "+t)},F.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||Tt.isNaN(this.z))&&Tt.isNaN(t.z)},F.prototype.equals=function(t){return t instanceof F?this.equals2D(t):!1},F.prototype.equalInZ=function(t,e){return Oa.equalsWithTolerance(this.z,t.z,e)},F.prototype.compareTo=function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0},F.prototype.clone=function(){},F.prototype.copy=function(){return new F(this)},F.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},F.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return Math.sqrt(e*e+n*n+i*i)},F.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},F.prototype.hashCode=function(){var t=17;return t=37*t+F.hashCode(this.x),t=37*t+F.hashCode(this.y),t},F.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},F.prototype.interfaces_=function(){return[Pr,$d,xr]},F.prototype.getClass=function(){return F},F.hashCode=function(){if(arguments.length===1){var t=arguments[0],e=Tt.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}},Da.DimensionalComparator.get=function(){return io},Da.serialVersionUID.get=function(){return 6683108902428367e3},Da.NULL_ORDINATE.get=function(){return Tt.NaN},Da.X.get=function(){return 0},Da.Y.get=function(){return 1},Da.Z.get=function(){return 2},Object.defineProperties(F,Da);var io=function(t){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new Ce("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}}};io.prototype.compare=function(t,e){var n=t,i=e,s=io.compare(n.x,i.x);if(s!==0)return s;var o=io.compare(n.y,i.y);if(o!==0)return o;if(this._dimensionsToTest<=2)return 0;var a=io.compare(n.z,i.z);return a},io.prototype.interfaces_=function(){return[Xu]},io.prototype.getClass=function(){return io},io.compare=function(t,e){return t<e?-1:t>e?1:Tt.isNaN(t)?Tt.isNaN(e)?0:-1:Tt.isNaN(e)?1:0};var Yu=function(){};Yu.prototype.create=function(){},Yu.prototype.interfaces_=function(){return[]},Yu.prototype.getClass=function(){return Yu};var V=function(){},tc={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};V.prototype.interfaces_=function(){return[]},V.prototype.getClass=function(){return V},V.toLocationSymbol=function(t){switch(t){case V.EXTERIOR:return"e";case V.BOUNDARY:return"b";case V.INTERIOR:return"i";case V.NONE:return"-"}throw new Ce("Unknown location value: "+t)},tc.INTERIOR.get=function(){return 0},tc.BOUNDARY.get=function(){return 1},tc.EXTERIOR.get=function(){return 2},tc.NONE.get=function(){return-1},Object.defineProperties(V,tc);var Pt=function(r,t){return r.interfaces_&&r.interfaces_().indexOf(t)>-1},hr=function(){},N1={LOG_10:{configurable:!0}};hr.prototype.interfaces_=function(){return[]},hr.prototype.getClass=function(){return hr},hr.log10=function(t){var e=Math.log(t);return Tt.isInfinite(e)||Tt.isNaN(e)?e:e/hr.LOG_10},hr.min=function(t,e,n,i){var s=t;return e<s&&(s=e),n<s&&(s=n),i<s&&(s=i),s},hr.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1],n=arguments[2];return t<e?e:t>n?n:t}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],s=arguments[1],o=arguments[2];return i<s?s:i>o?o:i}},hr.wrap=function(t,e){return t<0?e- -t%e:t%e},hr.max=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2],i=t;return e>i&&(i=e),n>i&&(i=n),i}else if(arguments.length===4){var s=arguments[0],o=arguments[1],a=arguments[2],u=arguments[3],l=s;return o>l&&(l=o),a>l&&(l=a),u>l&&(l=u),l}},hr.average=function(t,e){return(t+e)/2},N1.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(hr,N1);var oi=function(t){this.str=t};oi.prototype.append=function(t){this.str+=t},oi.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},oi.prototype.toString=function(t){return this.str};var ai=function(t){this.value=t};ai.prototype.intValue=function(){return this.value},ai.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},ai.isNaN=function(t){return Number.isNaN(t)};var ec=function(){};ec.isWhitespace=function(t){return t<=32&&t>=0||t===127},ec.toUpperCase=function(t){return t.toUpperCase()};var U=function r(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof r){var e=arguments[0];this.init(e)}else if(typeof arguments[0]=="string"){var n=arguments[0];r.call(this,r.parse(n))}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.init(i,s)}},Vr={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};U.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},U.prototype.extractSignificantDigits=function(t,e){var n=this.abs(),i=U.magnitude(n._hi),s=U.TEN.pow(i);n=n.divide(s),n.gt(U.TEN)?(n=n.divide(U.TEN),i+=1):n.lt(U.ONE)&&(n=n.multiply(U.TEN),i-=1);for(var o=i+1,a=new oi,u=U.MAX_PRINT_DIGITS-1,l=0;l<=u;l++){t&&l===o&&a.append(".");var h=Math.trunc(n._hi);if(h<0)break;var c=!1,d=0;h>9?(c=!0,d="9"):d="0"+h,a.append(d),n=n.subtract(U.valueOf(h)).multiply(U.TEN),c&&n.selfAdd(U.TEN);var p=!0,g=U.magnitude(n._hi);if(g<0&&Math.abs(g)>=u-l&&(p=!1),!p)break}return e[0]=i,a.toString()},U.prototype.sqr=function(){return this.multiply(this)},U.prototype.doubleValue=function(){return this._hi+this._lo},U.prototype.subtract=function(){if(arguments[0]instanceof U){var t=arguments[0];return this.add(t.negate())}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}},U.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},U.prototype.isZero=function(){return this._hi===0&&this._lo===0},U.prototype.selfSubtract=function(){if(arguments[0]instanceof U){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},U.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},U.prototype.min=function(t){return this.le(t)?this:t},U.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof U){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],s=null,o=null,a=null,u=null,l=null,h=null,c=null,d=null;return l=this._hi/n,h=U.SPLIT*l,s=h-l,d=U.SPLIT*n,s=h-s,o=l-s,a=d-n,c=l*n,a=d-a,u=n-a,d=s*a-c+s*u+o*a+o*u,h=(this._hi-c-d+this._lo-l*i)/n,d=l+h,this._hi=d,this._lo=l-d+h,this}},U.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},U.prototype.divide=function(){if(arguments[0]instanceof U){var t=arguments[0],e=null,n=null,i=null,s=null,o=null,a=null,u=null,l=null;o=this._hi/t._hi,a=U.SPLIT*o,e=a-o,l=U.SPLIT*t._hi,e=a-e,n=o-e,i=l-t._hi,u=o*t._hi,i=l-i,s=t._hi-i,l=e*i-u+e*s+n*i+n*s,a=(this._hi-u-l+this._lo-o*t._lo)/t._hi,l=o+a;var h=l,c=o-l+a;return new U(h,c)}else if(typeof arguments[0]=="number"){var d=arguments[0];return Tt.isNaN(d)?U.createNaN():U.copy(this).selfDivide(d,0)}},U.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},U.prototype.pow=function(t){if(t===0)return U.valueOf(1);var e=new U(this),n=U.valueOf(1),i=Math.abs(t);if(i>1)for(;i>0;)i%2===1&&n.selfMultiply(e),i/=2,i>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n},U.prototype.ceil=function(){if(this.isNaN())return U.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new U(t,e)},U.prototype.compareTo=function(t){var e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0},U.prototype.rint=function(){if(this.isNaN())return this;var t=this.add(.5);return t.floor()},U.prototype.setValue=function(){if(arguments[0]instanceof U){var t=arguments[0];return this.init(t),this}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}},U.prototype.max=function(t){return this.ge(t)?this:t},U.prototype.sqrt=function(){if(this.isZero())return U.valueOf(0);if(this.isNegative())return U.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=U.valueOf(e),i=this.subtract(n.sqr()),s=i._hi*(t*.5);return n.add(s)},U.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof U){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0],n=null,i=null,s=null,o=null,a=null,u=null;return s=this._hi+e,a=s-this._hi,o=s-a,o=e-a+(this._hi-o),u=o+this._lo,n=s+u,i=u+(s-n),this._hi=n+i,this._lo=i+(n-this._hi),this}}else if(arguments.length===2){var l=arguments[0],h=arguments[1],c=null,d=null,p=null,g=null,y=null,w=null,b=null,m=null;y=this._hi+l,p=this._lo+h,b=y-this._hi,m=p-this._lo,w=y-b,g=p-m,w=l-b+(this._hi-w),g=h-m+(this._lo-g),b=w+p,c=y+b,d=b+(y-c),b=g+d;var E=c+b,_=b+(c-E);return this._hi=E,this._lo=_,this}},U.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof U){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],s=null,o=null,a=null,u=null,l=null,h=null;l=U.SPLIT*this._hi,s=l-this._hi,h=U.SPLIT*n,s=l-s,o=this._hi-s,a=h-n,l=this._hi*n,a=h-a,u=n-a,h=s*a-l+s*u+o*a+o*u+(this._hi*i+this._lo*n);var c=l+h;s=l-c;var d=h+s;return this._hi=c,this._lo=d,this}},U.prototype.selfSqr=function(){return this.selfMultiply(this)},U.prototype.floor=function(){if(this.isNaN())return U.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new U(t,e)},U.prototype.negate=function(){return this.isNaN()?this:new U(-this._hi,-this._lo)},U.prototype.clone=function(){},U.prototype.multiply=function(){if(arguments[0]instanceof U){var t=arguments[0];return t.isNaN()?U.createNaN():U.copy(this).selfMultiply(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return Tt.isNaN(e)?U.createNaN():U.copy(this).selfMultiply(e,0)}},U.prototype.isNaN=function(){return Tt.isNaN(this._hi)},U.prototype.intValue=function(){return Math.trunc(this._hi)},U.prototype.toString=function(){var t=U.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},U.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),i=e[0]+1,s=n;if(n.charAt(0)===".")s="0"+n;else if(i<0)s="0."+U.stringOfChar("0",-i)+n;else if(n.indexOf(".")===-1){var o=i-n.length,a=U.stringOfChar("0",o);s=n+a+".0"}return this.isNegative()?"-"+s:s},U.prototype.reciprocal=function(){var t=null,e=null,n=null,i=null,s=null,o=null,a=null,u=null;s=1/this._hi,o=U.SPLIT*s,t=o-s,u=U.SPLIT*this._hi,t=o-t,e=s-t,n=u-this._hi,a=s*this._hi,n=u-n,i=this._hi-n,u=t*n-a+t*i+e*n+e*i,o=(1-a-u-s*this._lo)/this._hi;var l=s+o,h=s-l+o;return new U(l,h)},U.prototype.toSciNotation=function(){if(this.isZero())return U.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),i=U.SCI_NOT_EXPONENT_CHAR+e[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var s="";n.length>1&&(s=n.substring(1));var o=n.charAt(0)+"."+s;return this.isNegative()?"-"+o+i:o+i},U.prototype.abs=function(){return this.isNaN()?U.NaN:this.isNegative()?this.negate():new U(this)},U.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},U.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},U.prototype.add=function(){if(arguments[0]instanceof U){var t=arguments[0];return U.copy(this).selfAdd(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return U.copy(this).selfAdd(e)}},U.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof U){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._hi=n,this._lo=i}},U.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},U.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},U.prototype.trunc=function(){return this.isNaN()?U.NaN:this.isPositive()?this.floor():this.ceil()},U.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},U.prototype.interfaces_=function(){return[xr,Pr,$d]},U.prototype.getClass=function(){return U},U.sqr=function(t){return U.valueOf(t).selfMultiply(t)},U.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return U.parse(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return new U(e)}},U.sqrt=function(t){return U.valueOf(t).sqrt()},U.parse=function(t){for(var e=0,n=t.length;ec.isWhitespace(t.charAt(e));)e++;var i=!1;if(e<n){var s=t.charAt(e);(s==="-"||s==="+")&&(e++,s==="-"&&(i=!0))}for(var o=new U,a=0,u=0,l=0;!(e>=n);){var h=t.charAt(e);if(e++,ec.isDigit(h)){var c=h-"0";o.selfMultiply(U.TEN),o.selfAdd(c),a++;continue}if(h==="."){u=a;continue}if(h==="e"||h==="E"){var d=t.substring(e);try{l=ai.parseInt(d)}catch(b){throw b instanceof Error?new Error("Invalid exponent "+d+" in string "+t):b}finally{}break}throw new Error("Unexpected character '"+h+"' at position "+e+" in string "+t)}var p=o,g=a-u-l;if(g===0)p=o;else if(g>0){var y=U.TEN.pow(g);p=o.divide(y)}else if(g<0){var w=U.TEN.pow(-g);p=o.multiply(w)}return i?p.negate():p},U.createNaN=function(){return new U(Tt.NaN,Tt.NaN)},U.copy=function(t){return new U(t)},U.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),i=Math.trunc(Math.floor(n)),s=Math.pow(10,i);return s*10<=e&&(i+=1),i},U.stringOfChar=function(t,e){for(var n=new oi,i=0;i<e;i++)n.append(t);return n.toString()},Vr.PI.get=function(){return new U(3.141592653589793,12246467991473532e-32)},Vr.TWO_PI.get=function(){return new U(6.283185307179586,24492935982947064e-32)},Vr.PI_2.get=function(){return new U(1.5707963267948966,6123233995736766e-32)},Vr.E.get=function(){return new U(2.718281828459045,14456468917292502e-32)},Vr.NaN.get=function(){return new U(Tt.NaN,Tt.NaN)},Vr.EPS.get=function(){return 123259516440783e-46},Vr.SPLIT.get=function(){return 134217729},Vr.MAX_PRINT_DIGITS.get=function(){return 32},Vr.TEN.get=function(){return U.valueOf(10)},Vr.ONE.get=function(){return U.valueOf(1)},Vr.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},Vr.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(U,Vr);var Ln=function(){},O1={DP_SAFE_EPSILON:{configurable:!0}};Ln.prototype.interfaces_=function(){return[]},Ln.prototype.getClass=function(){return Ln},Ln.orientationIndex=function(t,e,n){var i=Ln.orientationIndexFilter(t,e,n);if(i<=1)return i;var s=U.valueOf(e.x).selfAdd(-t.x),o=U.valueOf(e.y).selfAdd(-t.y),a=U.valueOf(n.x).selfAdd(-e.x),u=U.valueOf(n.y).selfAdd(-e.y);return s.selfMultiply(u).selfSubtract(o.selfMultiply(a)).signum()},Ln.signOfDet2x2=function(t,e,n,i){var s=t.multiply(i).selfSubtract(e.multiply(n));return s.signum()},Ln.intersection=function(t,e,n,i){var s=U.valueOf(i.y).selfSubtract(n.y).selfMultiply(U.valueOf(e.x).selfSubtract(t.x)),o=U.valueOf(i.x).selfSubtract(n.x).selfMultiply(U.valueOf(e.y).selfSubtract(t.y)),a=s.subtract(o),u=U.valueOf(i.x).selfSubtract(n.x).selfMultiply(U.valueOf(t.y).selfSubtract(n.y)),l=U.valueOf(i.y).selfSubtract(n.y).selfMultiply(U.valueOf(t.x).selfSubtract(n.x)),h=u.subtract(l),c=h.selfDivide(a).doubleValue(),d=U.valueOf(t.x).selfAdd(U.valueOf(e.x).selfSubtract(t.x).selfMultiply(c)).doubleValue(),p=U.valueOf(e.x).selfSubtract(t.x).selfMultiply(U.valueOf(t.y).selfSubtract(n.y)),g=U.valueOf(e.y).selfSubtract(t.y).selfMultiply(U.valueOf(t.x).selfSubtract(n.x)),y=p.subtract(g),w=y.selfDivide(a).doubleValue(),b=U.valueOf(n.y).selfAdd(U.valueOf(i.y).selfSubtract(n.y).selfMultiply(w)).doubleValue();return new F(d,b)},Ln.orientationIndexFilter=function(t,e,n){var i=null,s=(t.x-n.x)*(e.y-n.y),o=(t.y-n.y)*(e.x-n.x),a=s-o;if(s>0){if(o<=0)return Ln.signum(a);i=s+o}else if(s<0){if(o>=0)return Ln.signum(a);i=-s-o}else return Ln.signum(a);var u=Ln.DP_SAFE_EPSILON*i;return a>=u||-a>=u?Ln.signum(a):2},Ln.signum=function(t){return t>0?1:t<0?-1:0},O1.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Ln,O1);var Jt=function(){},nc={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};nc.X.get=function(){return 0},nc.Y.get=function(){return 1},nc.Z.get=function(){return 2},nc.M.get=function(){return 3},Jt.prototype.setOrdinate=function(t,e,n){},Jt.prototype.size=function(){},Jt.prototype.getOrdinate=function(t,e){},Jt.prototype.getCoordinate=function(){},Jt.prototype.getCoordinateCopy=function(t){},Jt.prototype.getDimension=function(){},Jt.prototype.getX=function(t){},Jt.prototype.clone=function(){},Jt.prototype.expandEnvelope=function(t){},Jt.prototype.copy=function(){},Jt.prototype.getY=function(t){},Jt.prototype.toCoordinateArray=function(){},Jt.prototype.interfaces_=function(){return[$d]},Jt.prototype.getClass=function(){return Jt},Object.defineProperties(Jt,nc);var D1=function(){},Ju=function(r){function t(){r.call(this,"Projective point not representable on the Cartesian plane.")}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(D1),sn=function(){};sn.arraycopy=function(t,e,n,i,s){for(var o=0,a=e;a<e+s;a++)n[i+o]=t[a],o++},sn.getProperty=function(t){return{"line.separator":`
|
|
66
66
|
`}[t]};var Br=function r(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var t=arguments[0];this.x=t.x,this.y=t.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],n=arguments[1];this.x=e,this.y=n,this.w=1}else if(arguments[0]instanceof r&&arguments[1]instanceof r){var i=arguments[0],s=arguments[1];this.x=i.y*s.w-s.y*i.w,this.y=s.x*i.w-i.x*s.w,this.w=i.x*s.y-s.x*i.y}else if(arguments[0]instanceof F&&arguments[1]instanceof F){var o=arguments[0],a=arguments[1];this.x=o.y-a.y,this.y=a.x-o.x,this.w=o.x*a.y-a.x*o.y}}else if(arguments.length===3){var u=arguments[0],l=arguments[1],h=arguments[2];this.x=u,this.y=l,this.w=h}else if(arguments.length===4){var c=arguments[0],d=arguments[1],p=arguments[2],g=arguments[3],y=c.y-d.y,w=d.x-c.x,b=c.x*d.y-d.x*c.y,m=p.y-g.y,E=g.x-p.x,_=p.x*g.y-g.x*p.y;this.x=w*_-E*b,this.y=m*b-y*_,this.w=y*E-m*w}};Br.prototype.getY=function(){var t=this.y/this.w;if(Tt.isNaN(t)||Tt.isInfinite(t))throw new Ju;return t},Br.prototype.getX=function(){var t=this.x/this.w;if(Tt.isNaN(t)||Tt.isInfinite(t))throw new Ju;return t},Br.prototype.getCoordinate=function(){var t=new F;return t.x=this.getX(),t.y=this.getY(),t},Br.prototype.interfaces_=function(){return[]},Br.prototype.getClass=function(){return Br},Br.intersection=function(t,e,n,i){var s=t.y-e.y,o=e.x-t.x,a=t.x*e.y-e.x*t.y,u=n.y-i.y,l=i.x-n.x,h=n.x*i.y-i.x*n.y,c=o*h-l*a,d=u*a-s*h,p=s*l-u*o,g=c/p,y=d/p;if(Tt.isNaN(g)||Tt.isInfinite(g)||Tt.isNaN(y)||Tt.isInfinite(y))throw new Ju;return new F(g,y)};var gt=function r(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof F){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof r){var e=arguments[0];this.init(e)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(arguments.length===4){var s=arguments[0],o=arguments[1],a=arguments[2],u=arguments[3];this.init(s,o,a,u)}},A1={serialVersionUID:{configurable:!0}};gt.prototype.getArea=function(){return this.getWidth()*this.getHeight()},gt.prototype.equals=function(t){if(!(t instanceof gt))return!1;var e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()},gt.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new gt;var e=this._minx>t._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,i=this._maxx<t._maxx?this._maxx:t._maxx,s=this._maxy<t._maxy?this._maxy:t._maxy;return new gt(e,i,n,s)},gt.prototype.isNull=function(){return this._maxx<this._minx},gt.prototype.getMaxX=function(){return this._maxx},gt.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof F){var t=arguments[0];return this.covers(t.x,t.y)}else if(arguments[0]instanceof gt){var e=arguments[0];return this.isNull()||e.isNull()?!1:e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&i>=this._miny&&i<=this._maxy}},gt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof gt){var t=arguments[0];return this.isNull()||t.isNull()?!1:!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}else if(arguments[0]instanceof F){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.isNull()?!1:!(n>this._maxx||n<this._minx||i>this._maxy||i<this._miny)}},gt.prototype.getMinY=function(){return this._miny},gt.prototype.getMinX=function(){return this._minx},gt.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof F){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof gt){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=i,this._maxy=i):(n<this._minx&&(this._minx=n),n>this._maxx&&(this._maxx=n),i<this._miny&&(this._miny=i),i>this._maxy&&(this._maxy=i))}},gt.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},gt.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},gt.prototype.compareTo=function(t){var e=t;return this.isNull()?e.isNull()?0:-1:e.isNull()?1:this._minx<e._minx?-1:this._minx>e._minx?1:this._miny<e._miny?-1:this._miny>e._miny?1:this._maxx<e._maxx?-1:this._maxx>e._maxx?1:this._maxy<e._maxy?-1:this._maxy>e._maxy?1:0},gt.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},gt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},gt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},gt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},gt.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},gt.prototype.expandBy=function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},gt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof gt){var t=arguments[0];return this.covers(t)}else if(arguments[0]instanceof F){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.covers(n,i)}},gt.prototype.centre=function(){return this.isNull()?null:new F((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},gt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof F){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof gt){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(arguments.length===4){var s=arguments[0],o=arguments[1],a=arguments[2],u=arguments[3];s<o?(this._minx=s,this._maxx=o):(this._minx=o,this._maxx=s),a<u?(this._miny=a,this._maxy=u):(this._miny=u,this._maxy=a)}},gt.prototype.getMaxY=function(){return this._maxy},gt.prototype.distance=function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxy<t._miny?n=t._miny-this._maxy:this._miny>t._maxy&&(n=this._miny-t._maxy),e===0?n:n===0?e:Math.sqrt(e*e+n*n)},gt.prototype.hashCode=function(){var t=17;return t=37*t+F.hashCode(this._minx),t=37*t+F.hashCode(this._maxx),t=37*t+F.hashCode(this._miny),t=37*t+F.hashCode(this._maxy),t},gt.prototype.interfaces_=function(){return[Pr,xr]},gt.prototype.getClass=function(){return gt},gt.intersects=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.x<e.x?t.x:e.x)&&n.x<=(t.x>e.x?t.x:e.x)&&n.y>=(t.y<e.y?t.y:e.y)&&n.y<=(t.y>e.y?t.y:e.y)}else if(arguments.length===4){var i=arguments[0],s=arguments[1],o=arguments[2],a=arguments[3],u=Math.min(o.x,a.x),l=Math.max(o.x,a.x),h=Math.min(i.x,s.x),c=Math.max(i.x,s.x);return!(h>l||c<u||(u=Math.min(o.y,a.y),l=Math.max(o.y,a.y),h=Math.min(i.y,s.y),c=Math.max(i.y,s.y),h>l)||c<u)}},A1.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(gt,A1);var ui={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,emptyTypeStr:/^\s*(\w+)\s*EMPTY\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},Xd=function(t){this.geometryFactory=t||new Ut};Xd.prototype.read=function(t){var e,n,i;t=t.replace(/[\n\r]/g," ");var s=ui.typeStr.exec(t);if(t.search("EMPTY")!==-1&&(s=ui.emptyTypeStr.exec(t),s[2]=void 0),s&&(n=s[1].toLowerCase(),i=s[2],Zu[n]&&(e=Zu[n].apply(this,[i]))),e===void 0)throw new Error("Could not parse WKT "+t);return e},Xd.prototype.write=function(t){return this.extractGeometry(t)},Xd.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!ys[e])return null;var n=e.toUpperCase(),i;return t.isEmpty()?i=n+" EMPTY":i=n+"("+ys[e].apply(this,[t])+")",i};var ys={coordinate:function(t){return t.x+" "+t.y},point:function(t){return ys.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=this,n=[],i=0,s=t._geometries.length;i<s;++i)n.push("("+ys.point.apply(e,[t._geometries[i]])+")");return n.join(",")},linestring:function(t){for(var e=this,n=[],i=0,s=t._points._coordinates.length;i<s;++i)n.push(ys.coordinate.apply(e,[t._points._coordinates[i]]));return n.join(",")},linearring:function(t){for(var e=this,n=[],i=0,s=t._points._coordinates.length;i<s;++i)n.push(ys.coordinate.apply(e,[t._points._coordinates[i]]));return n.join(",")},multilinestring:function(t){for(var e=this,n=[],i=0,s=t._geometries.length;i<s;++i)n.push("("+ys.linestring.apply(e,[t._geometries[i]])+")");return n.join(",")},polygon:function(t){var e=this,n=[];n.push("("+ys.linestring.apply(this,[t._shell])+")");for(var i=0,s=t._holes.length;i<s;++i)n.push("("+ys.linestring.apply(e,[t._holes[i]])+")");return n.join(",")},multipolygon:function(t){for(var e=this,n=[],i=0,s=t._geometries.length;i<s;++i)n.push("("+ys.polygon.apply(e,[t._geometries[i]])+")");return n.join(",")},geometrycollection:function(t){for(var e=this,n=[],i=0,s=t._geometries.length;i<s;++i)n.push(e.extractGeometry(t._geometries[i]));return n.join(",")}},Zu={point:function(t){if(t===void 0)return this.geometryFactory.createPoint();var e=t.trim().split(ui.spaces);return this.geometryFactory.createPoint(new F(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){var e=this;if(t===void 0)return this.geometryFactory.createMultiPoint();for(var n,i=t.trim().split(","),s=[],o=0,a=i.length;o<a;++o)n=i[o].replace(ui.trimParens,"$1"),s.push(Zu.point.apply(e,[n]));return this.geometryFactory.createMultiPoint(s)},linestring:function(t){if(t===void 0)return this.geometryFactory.createLineString();for(var e=t.trim().split(","),n=[],i,s=0,o=e.length;s<o;++s)i=e[s].trim().split(ui.spaces),n.push(new F(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLineString(n)},linearring:function(t){if(t===void 0)return this.geometryFactory.createLinearRing();for(var e=t.trim().split(","),n=[],i,s=0,o=e.length;s<o;++s)i=e[s].trim().split(ui.spaces),n.push(new F(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLinearRing(n)},multilinestring:function(t){var e=this;if(t===void 0)return this.geometryFactory.createMultiLineString();for(var n,i=t.trim().split(ui.parenComma),s=[],o=0,a=i.length;o<a;++o)n=i[o].replace(ui.trimParens,"$1"),s.push(Zu.linestring.apply(e,[n]));return this.geometryFactory.createMultiLineString(s)},polygon:function(t){var e=this;if(t===void 0)return this.geometryFactory.createPolygon();for(var n,i,s,o=t.trim().split(ui.parenComma),a,u=[],l=0,h=o.length;l<h;++l)n=o[l].replace(ui.trimParens,"$1"),i=Zu.linestring.apply(e,[n]),s=e.geometryFactory.createLinearRing(i._points),l===0?a=s:u.push(s);return this.geometryFactory.createPolygon(a,u)},multipolygon:function(t){var e=this;if(t===void 0)return this.geometryFactory.createMultiPolygon();for(var n,i=t.trim().split(ui.doubleParenComma),s=[],o=0,a=i.length;o<a;++o)n=i[o].replace(ui.trimParens,"$1"),s.push(Zu.polygon.apply(e,[n]));return this.geometryFactory.createMultiPolygon(s)},geometrycollection:function(t){var e=this;if(t===void 0)return this.geometryFactory.createGeometryCollection();t=t.replace(/,\s*([A-Za-z])/g,"|$1");for(var n=t.trim().split("|"),i=[],s=0,o=n.length;s<o;++s)i.push(e.read(n[s]));return this.geometryFactory.createGeometryCollection(i)}},zr=function(t){this.parser=new Xd(t)};zr.prototype.write=function(t){return this.parser.write(t)},zr.toLineString=function(t,e){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var ws=function(r){function t(e){r.call(this,e),this.name="RuntimeException",this.message=e,this.stack=new r().stack}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t}(Error),Yd=function(r){function t(){if(r.call(this),arguments.length===0)r.call(this);else if(arguments.length===1){var e=arguments[0];r.call(this,e)}}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(ws),Ft=function(){};Ft.prototype.interfaces_=function(){return[]},Ft.prototype.getClass=function(){return Ft},Ft.shouldNeverReachHere=function(){if(arguments.length===0)Ft.shouldNeverReachHere(null);else if(arguments.length===1){var t=arguments[0];throw new Yd("Should never reach here"+(t!==null?": "+t:""))}},Ft.isTrue=function(){var t,e;if(arguments.length===1)t=arguments[0],Ft.isTrue(t,null);else if(arguments.length===2&&(t=arguments[0],e=arguments[1],!t))throw e===null?new Yd:new Yd(e)},Ft.equals=function(){var t,e,n;if(arguments.length===2)t=arguments[0],e=arguments[1],Ft.equals(t,e,null);else if(arguments.length===3&&(t=arguments[0],e=arguments[1],n=arguments[2],!e.equals(t)))throw new Yd("Expected "+t+" but encountered "+e+(n!==null?": "+n:""))};var Pe=function(){this._result=null,this._inputLines=Array(2).fill().map(function(){return Array(2)}),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new F,this._intPt[1]=new F,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},Aa={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};Pe.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},Pe.prototype.getTopologySummary=function(){var t=new oi;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},Pe.prototype.computeIntersection=function(t,e,n,i){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=n,this._inputLines[1][1]=i,this._result=this.computeIntersect(t,e,n,i)},Pe.prototype.getIntersectionNum=function(){return this._result},Pe.prototype.computeIntLineIndex=function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var t=arguments[0],e=this.getEdgeDistance(t,0),n=this.getEdgeDistance(t,1);e>n?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},Pe.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},Pe.prototype.setPrecisionModel=function(t){this._precisionModel=t},Pe.prototype.isInteriorIntersection=function(){var t=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var e=arguments[0],n=0;n<this._result;n++)if(!(t._intPt[n].equals2D(t._inputLines[e][0])||t._intPt[n].equals2D(t._inputLines[e][1])))return!0;return!1}},Pe.prototype.getIntersection=function(t){return this._intPt[t]},Pe.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},Pe.prototype.hasIntersection=function(){return this._result!==Pe.NO_INTERSECTION},Pe.prototype.getEdgeDistance=function(t,e){var n=Pe.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1]);return n},Pe.prototype.isCollinear=function(){return this._result===Pe.COLLINEAR_INTERSECTION},Pe.prototype.toString=function(){return zr.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+zr.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},Pe.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},Pe.prototype.isIntersection=function(t){for(var e=this,n=0;n<this._result;n++)if(e._intPt[n].equals2D(t))return!0;return!1},Pe.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},Pe.prototype.interfaces_=function(){return[]},Pe.prototype.getClass=function(){return Pe},Pe.computeEdgeDistance=function(t,e,n){var i=Math.abs(n.x-e.x),s=Math.abs(n.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(n))i>s?o=i:o=s;else{var a=Math.abs(t.x-e.x),u=Math.abs(t.y-e.y);i>s?o=a:o=u,o===0&&!t.equals(e)&&(o=Math.max(a,u))}return Ft.isTrue(!(o===0&&!t.equals(e)),"Bad distance calculation"),o},Pe.nonRobustComputeEdgeDistance=function(t,e,n){var i=t.x-e.x,s=t.y-e.y,o=Math.sqrt(i*i+s*s);return Ft.isTrue(!(o===0&&!t.equals(e)),"Invalid distance calculation"),o},Aa.DONT_INTERSECT.get=function(){return 0},Aa.DO_INTERSECT.get=function(){return 1},Aa.COLLINEAR.get=function(){return 2},Aa.NO_INTERSECTION.get=function(){return 0},Aa.POINT_INTERSECTION.get=function(){return 1},Aa.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(Pe,Aa);var Uo=function(r){function t(){r.apply(this,arguments)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.isInSegmentEnvelopes=function(n){var i=new gt(this._inputLines[0][0],this._inputLines[0][1]),s=new gt(this._inputLines[1][0],this._inputLines[1][1]);return i.contains(n)&&s.contains(n)},t.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];if(this._isProper=!1,gt.intersects(i,s,n)&&rt.orientationIndex(i,s,n)===0&&rt.orientationIndex(s,i,n)===0)return this._isProper=!0,(n.equals(i)||n.equals(s))&&(this._isProper=!1),this._result=r.POINT_INTERSECTION,null;this._result=r.NO_INTERSECTION}else return r.prototype.computeIntersection.apply(this,arguments)},t.prototype.normalizeToMinimum=function(n,i,s,o,a){a.x=this.smallestInAbsValue(n.x,i.x,s.x,o.x),a.y=this.smallestInAbsValue(n.y,i.y,s.y,o.y),n.x-=a.x,n.y-=a.y,i.x-=a.x,i.y-=a.y,s.x-=a.x,s.y-=a.y,o.x-=a.x,o.y-=a.y},t.prototype.safeHCoordinateIntersection=function(n,i,s,o){var a=null;try{a=Br.intersection(n,i,s,o)}catch(u){if(u instanceof Ju)a=t.nearestEndpoint(n,i,s,o);else throw u}finally{}return a},t.prototype.intersection=function(n,i,s,o){var a=this.intersectionWithNormalization(n,i,s,o);return this.isInSegmentEnvelopes(a)||(a=new F(t.nearestEndpoint(n,i,s,o))),this._precisionModel!==null&&this._precisionModel.makePrecise(a),a},t.prototype.smallestInAbsValue=function(n,i,s,o){var a=n,u=Math.abs(a);return Math.abs(i)<u&&(a=i,u=Math.abs(i)),Math.abs(s)<u&&(a=s,u=Math.abs(s)),Math.abs(o)<u&&(a=o),a},t.prototype.checkDD=function(n,i,s,o,a){var u=Ln.intersection(n,i,s,o),l=this.isInSegmentEnvelopes(u);sn.out.println("DD in env = "+l+" --------------------- "+u),a.distance(u)>1e-4&&sn.out.println("Distance = "+a.distance(u))},t.prototype.intersectionWithNormalization=function(n,i,s,o){var a=new F(n),u=new F(i),l=new F(s),h=new F(o),c=new F;this.normalizeToEnvCentre(a,u,l,h,c);var d=this.safeHCoordinateIntersection(a,u,l,h);return d.x+=c.x,d.y+=c.y,d},t.prototype.computeCollinearIntersection=function(n,i,s,o){var a=gt.intersects(n,i,s),u=gt.intersects(n,i,o),l=gt.intersects(s,o,n),h=gt.intersects(s,o,i);return a&&u?(this._intPt[0]=s,this._intPt[1]=o,r.COLLINEAR_INTERSECTION):l&&h?(this._intPt[0]=n,this._intPt[1]=i,r.COLLINEAR_INTERSECTION):a&&l?(this._intPt[0]=s,this._intPt[1]=n,s.equals(n)&&!u&&!h?r.POINT_INTERSECTION:r.COLLINEAR_INTERSECTION):a&&h?(this._intPt[0]=s,this._intPt[1]=i,s.equals(i)&&!u&&!l?r.POINT_INTERSECTION:r.COLLINEAR_INTERSECTION):u&&l?(this._intPt[0]=o,this._intPt[1]=n,o.equals(n)&&!a&&!h?r.POINT_INTERSECTION:r.COLLINEAR_INTERSECTION):u&&h?(this._intPt[0]=o,this._intPt[1]=i,o.equals(i)&&!a&&!l?r.POINT_INTERSECTION:r.COLLINEAR_INTERSECTION):r.NO_INTERSECTION},t.prototype.normalizeToEnvCentre=function(n,i,s,o,a){var u=n.x<i.x?n.x:i.x,l=n.y<i.y?n.y:i.y,h=n.x>i.x?n.x:i.x,c=n.y>i.y?n.y:i.y,d=s.x<o.x?s.x:o.x,p=s.y<o.y?s.y:o.y,g=s.x>o.x?s.x:o.x,y=s.y>o.y?s.y:o.y,w=u>d?u:d,b=h<g?h:g,m=l>p?l:p,E=c<y?c:y,_=(w+b)/2,S=(m+E)/2;a.x=_,a.y=S,n.x-=a.x,n.y-=a.y,i.x-=a.x,i.y-=a.y,s.x-=a.x,s.y-=a.y,o.x-=a.x,o.y-=a.y},t.prototype.computeIntersect=function(n,i,s,o){if(this._isProper=!1,!gt.intersects(n,i,s,o))return r.NO_INTERSECTION;var a=rt.orientationIndex(n,i,s),u=rt.orientationIndex(n,i,o);if(a>0&&u>0||a<0&&u<0)return r.NO_INTERSECTION;var l=rt.orientationIndex(s,o,n),h=rt.orientationIndex(s,o,i);if(l>0&&h>0||l<0&&h<0)return r.NO_INTERSECTION;var c=a===0&&u===0&&l===0&&h===0;return c?this.computeCollinearIntersection(n,i,s,o):(a===0||u===0||l===0||h===0?(this._isProper=!1,n.equals2D(s)||n.equals2D(o)?this._intPt[0]=n:i.equals2D(s)||i.equals2D(o)?this._intPt[0]=i:a===0?this._intPt[0]=new F(s):u===0?this._intPt[0]=new F(o):l===0?this._intPt[0]=new F(n):h===0&&(this._intPt[0]=new F(i))):(this._isProper=!0,this._intPt[0]=this.intersection(n,i,s,o)),r.POINT_INTERSECTION)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.nearestEndpoint=function(n,i,s,o){var a=n,u=rt.distancePointLine(n,s,o),l=rt.distancePointLine(i,s,o);return l<u&&(u=l,a=i),l=rt.distancePointLine(s,n,i),l<u&&(u=l,a=s),l=rt.distancePointLine(o,n,i),l<u&&(u=l,a=o),a},t}(Pe),Ra=function(){};Ra.prototype.interfaces_=function(){return[]},Ra.prototype.getClass=function(){return Ra},Ra.orientationIndex=function(t,e,n){var i=e.x-t.x,s=e.y-t.y,o=n.x-e.x,a=n.y-e.y;return Ra.signOfDet2x2(i,s,o,a)},Ra.signOfDet2x2=function(t,e,n,i){var s=null,o=null,a=null;if(s=1,t===0||i===0)return e===0||n===0?0:e>0?n>0?-s:s:n>0?s:-s;if(e===0||n===0)return i>0?t>0?s:-s:t>0?-s:s;if(e>0?i>0?e<=i||(s=-s,o=t,t=n,n=o,o=e,e=i,i=o):e<=-i?(s=-s,n=-n,i=-i):(o=t,t=-n,n=o,o=e,e=-i,i=o):i>0?-e<=i?(s=-s,t=-t,e=-e):(o=-t,t=n,n=o,o=-e,e=i,i=o):e>=i?(t=-t,e=-e,n=-n,i=-i):(s=-s,o=-t,t=-n,n=o,o=-e,e=-i,i=o),t>0)if(n>0){if(!(t<=n))return s}else return s;else{if(n>0)return-s;if(t>=n)s=-s,t=-t,n=-n;else return-s}for(;;){if(a=Math.floor(n/t),n=n-a*t,i=i-a*e,i<0)return-s;if(i>e)return s;if(t>n+n){if(e<i+i)return s}else{if(e>i+i)return-s;n=t-n,i=e-i,s=-s}if(i===0)return n===0?0:-s;if(n===0||(a=Math.floor(t/n),t=t-a*n,e=e-a*i,e<0))return s;if(e>i)return-s;if(n>t+t){if(i<e+e)return-s}else{if(i>e+e)return s;t=n-t,e=i-e,s=-s}if(e===0)return t===0?0:s;if(t===0)return-s}};var li=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};li.prototype.countSegment=function(t,e){if(t.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){var n=t.x,i=e.x;return n>i&&(n=e.x,i=t.x),this._p.x>=n&&this._p.x<=i&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var s=t.x-this._p.x,o=t.y-this._p.y,a=e.x-this._p.x,u=e.y-this._p.y,l=Ra.signOfDet2x2(s,o,a,u);if(l===0)return this._isPointOnSegment=!0,null;u<o&&(l=-l),l>0&&this._crossingCount++}},li.prototype.isPointInPolygon=function(){return this.getLocation()!==V.EXTERIOR},li.prototype.getLocation=function(){return this._isPointOnSegment?V.BOUNDARY:this._crossingCount%2===1?V.INTERIOR:V.EXTERIOR},li.prototype.isOnSegment=function(){return this._isPointOnSegment},li.prototype.interfaces_=function(){return[]},li.prototype.getClass=function(){return li},li.locatePointInRing=function(){if(arguments[0]instanceof F&&Pt(arguments[1],Jt)){for(var t=arguments[0],e=arguments[1],n=new li(t),i=new F,s=new F,o=1;o<e.size();o++)if(e.getCoordinate(o,i),e.getCoordinate(o-1,s),n.countSegment(i,s),n.isOnSegment())return n.getLocation();return n.getLocation()}else if(arguments[0]instanceof F&&arguments[1]instanceof Array){for(var a=arguments[0],u=arguments[1],l=new li(a),h=1;h<u.length;h++){var c=u[h],d=u[h-1];if(l.countSegment(c,d),l.isOnSegment())return l.getLocation()}return l.getLocation()}};var rt=function(){},La={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};rt.prototype.interfaces_=function(){return[]},rt.prototype.getClass=function(){return rt},rt.orientationIndex=function(t,e,n){return Ln.orientationIndex(t,e,n)},rt.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,n=t[0].x,i=1;i<t.length-1;i++){var s=t[i].x-n,o=t[i+1].y,a=t[i-1].y;e+=s*(a-o)}return e/2}else if(Pt(arguments[0],Jt)){var u=arguments[0],l=u.size();if(l<3)return 0;var h=new F,c=new F,d=new F;u.getCoordinate(0,c),u.getCoordinate(1,d);var p=c.x;d.x-=p;for(var g=0,y=1;y<l-1;y++)h.y=c.y,c.x=d.x,c.y=d.y,u.getCoordinate(y+1,d),d.x-=p,g+=c.x*(h.y-d.y);return g/2}},rt.distanceLineLine=function(t,e,n,i){if(t.equals(e))return rt.distancePointLine(t,n,i);if(n.equals(i))return rt.distancePointLine(i,t,e);var s=!1;if(!gt.intersects(t,e,n,i))s=!0;else{var o=(e.x-t.x)*(i.y-n.y)-(e.y-t.y)*(i.x-n.x);if(o===0)s=!0;else{var a=(t.y-n.y)*(i.x-n.x)-(t.x-n.x)*(i.y-n.y),u=(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y),l=u/o,h=a/o;(h<0||h>1||l<0||l>1)&&(s=!0)}}return s?hr.min(rt.distancePointLine(t,n,i),rt.distancePointLine(e,n,i),rt.distancePointLine(n,t,e),rt.distancePointLine(i,t,e)):0},rt.isPointInRing=function(t,e){return rt.locatePointInRing(t,e)!==V.EXTERIOR},rt.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,i=new F;t.getCoordinate(0,i);for(var s=i.x,o=i.y,a=1;a<e;a++){t.getCoordinate(a,i);var u=i.x,l=i.y,h=u-s,c=l-o;n+=Math.sqrt(h*h+c*c),s=u,o=l}return n},rt.isCCW=function(t){var e=t.length-1;if(e<3)throw new Ce("Ring has fewer than 4 points, so orientation cannot be determined");for(var n=t[0],i=0,s=1;s<=e;s++){var o=t[s];o.y>n.y&&(n=o,i=s)}var a=i;do a=a-1,a<0&&(a=e);while(t[a].equals2D(n)&&a!==i);var u=i;do u=(u+1)%e;while(t[u].equals2D(n)&&u!==i);var l=t[a],h=t[u];if(l.equals2D(n)||h.equals2D(n)||l.equals2D(h))return!1;var c=rt.computeOrientation(l,n,h),d=!1;return c===0?d=l.x>h.x:d=c>0,d},rt.locatePointInRing=function(t,e){return li.locatePointInRing(t,e)},rt.distancePointLinePerpendicular=function(t,e,n){var i=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),s=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/i;return Math.abs(s)*Math.sqrt(i)},rt.computeOrientation=function(t,e,n){return rt.orientationIndex(t,e,n)},rt.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(e.length===0)throw new Ce("Line array must contain at least one vertex");for(var n=t.distance(e[0]),i=0;i<e.length-1;i++){var s=rt.distancePointLine(t,e[i],e[i+1]);s<n&&(n=s)}return n}else if(arguments.length===3){var o=arguments[0],a=arguments[1],u=arguments[2];if(a.x===u.x&&a.y===u.y)return o.distance(a);var l=(u.x-a.x)*(u.x-a.x)+(u.y-a.y)*(u.y-a.y),h=((o.x-a.x)*(u.x-a.x)+(o.y-a.y)*(u.y-a.y))/l;if(h<=0)return o.distance(a);if(h>=1)return o.distance(u);var c=((a.y-o.y)*(u.x-a.x)-(a.x-o.x)*(u.y-a.y))/l;return Math.abs(c)*Math.sqrt(l)}},rt.isOnLine=function(t,e){for(var n=new Uo,i=1;i<e.length;i++){var s=e[i-1],o=e[i];if(n.computeIntersection(t,s,o),n.hasIntersection())return!0}return!1},La.CLOCKWISE.get=function(){return-1},La.RIGHT.get=function(){return rt.CLOCKWISE},La.COUNTERCLOCKWISE.get=function(){return 1},La.LEFT.get=function(){return rt.COUNTERCLOCKWISE},La.COLLINEAR.get=function(){return 0},La.STRAIGHT.get=function(){return rt.COLLINEAR},Object.defineProperties(rt,La);var Es=function(){};Es.prototype.filter=function(t){},Es.prototype.interfaces_=function(){return[]},Es.prototype.getClass=function(){return Es};var bt=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},ji={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};bt.prototype.isGeometryCollection=function(){return this.getSortIndex()===bt.SORTINDEX_GEOMETRYCOLLECTION},bt.prototype.getFactory=function(){return this._factory},bt.prototype.getGeometryN=function(t){return this},bt.prototype.getArea=function(){return 0},bt.prototype.isRectangle=function(){return!1},bt.prototype.equals=function(){if(arguments[0]instanceof bt){var t=arguments[0];return t===null?!1:this.equalsTopo(t)}else if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof bt))return!1;var n=e;return this.equalsExact(n)}},bt.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},bt.prototype.geometryChanged=function(){this.apply(bt.geometryChangedFilter)},bt.prototype.geometryChangedAction=function(){this._envelope=null},bt.prototype.equalsNorm=function(t){return t===null?!1:this.norm().equalsExact(t.norm())},bt.prototype.getLength=function(){return 0},bt.prototype.getNumGeometries=function(){return 1},bt.prototype.compareTo=function(){if(arguments.length===1){var t=arguments[0],e=t;return this.getSortIndex()!==e.getSortIndex()?this.getSortIndex()-e.getSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.getSortIndex()!==n.getSortIndex()?this.getSortIndex()-n.getSortIndex():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(n,i)}},bt.prototype.getUserData=function(){return this._userData},bt.prototype.getSRID=function(){return this._SRID},bt.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},bt.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===bt.SORTINDEX_GEOMETRYCOLLECTION)throw new Ce("This method does not support GeometryCollection arguments")},bt.prototype.equal=function(t,e,n){return n===0?t.equals(e):t.distance(e)<=n},bt.prototype.norm=function(){var t=this.copy();return t.normalize(),t},bt.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},bt.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new gt(this._envelope)},bt.prototype.setSRID=function(t){this._SRID=t},bt.prototype.setUserData=function(t){this._userData=t},bt.prototype.compare=function(t,e){for(var n=t.iterator(),i=e.iterator();n.hasNext()&&i.hasNext();){var s=n.next(),o=i.next(),a=s.compareTo(o);if(a!==0)return a}return n.hasNext()?1:i.hasNext()?-1:0},bt.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},bt.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===bt.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===bt.SORTINDEX_MULTIPOINT||this.getSortIndex()===bt.SORTINDEX_MULTILINESTRING||this.getSortIndex()===bt.SORTINDEX_MULTIPOLYGON},bt.prototype.interfaces_=function(){return[$d,Pr,xr]},bt.prototype.getClass=function(){return bt},bt.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},bt.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(t[e]===null)return!0;return!1},ji.serialVersionUID.get=function(){return 8763622679187377e3},ji.SORTINDEX_POINT.get=function(){return 0},ji.SORTINDEX_MULTIPOINT.get=function(){return 1},ji.SORTINDEX_LINESTRING.get=function(){return 2},ji.SORTINDEX_LINEARRING.get=function(){return 3},ji.SORTINDEX_MULTILINESTRING.get=function(){return 4},ji.SORTINDEX_POLYGON.get=function(){return 5},ji.SORTINDEX_MULTIPOLYGON.get=function(){return 6},ji.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},ji.geometryChangedFilter.get=function(){return qg},Object.defineProperties(bt,ji);var qg=function(){};qg.interfaces_=function(){return[Es]},qg.filter=function(t){t.geometryChangedAction()};var Vi=function(){};Vi.prototype.filter=function(t){},Vi.prototype.interfaces_=function(){return[]},Vi.prototype.getClass=function(){return Vi};var Ir=function(){},Ss={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};Ir.prototype.isInBoundary=function(t){},Ir.prototype.interfaces_=function(){return[]},Ir.prototype.getClass=function(){return Ir},Ss.Mod2BoundaryNodeRule.get=function(){return Ku},Ss.EndPointBoundaryNodeRule.get=function(){return Qu},Ss.MultiValentEndPointBoundaryNodeRule.get=function(){return tl},Ss.MonoValentEndPointBoundaryNodeRule.get=function(){return el},Ss.MOD2_BOUNDARY_RULE.get=function(){return new Ku},Ss.ENDPOINT_BOUNDARY_RULE.get=function(){return new Qu},Ss.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new tl},Ss.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new el},Ss.OGC_SFS_BOUNDARY_RULE.get=function(){return Ir.MOD2_BOUNDARY_RULE},Object.defineProperties(Ir,Ss);var Ku=function(){};Ku.prototype.isInBoundary=function(t){return t%2===1},Ku.prototype.interfaces_=function(){return[Ir]},Ku.prototype.getClass=function(){return Ku};var Qu=function(){};Qu.prototype.isInBoundary=function(t){return t>0},Qu.prototype.interfaces_=function(){return[Ir]},Qu.prototype.getClass=function(){return Qu};var tl=function(){};tl.prototype.isInBoundary=function(t){return t>1},tl.prototype.interfaces_=function(){return[Ir]},tl.prototype.getClass=function(){return tl};var el=function(){};el.prototype.isInBoundary=function(t){return t===1},el.prototype.interfaces_=function(){return[Ir]},el.prototype.getClass=function(){return el};var Ue=function(){};Ue.prototype.add=function(){},Ue.prototype.addAll=function(){},Ue.prototype.isEmpty=function(){},Ue.prototype.iterator=function(){},Ue.prototype.size=function(){},Ue.prototype.toArray=function(){},Ue.prototype.remove=function(){};function Wg(r){this.message=r||""}Wg.prototype=new Error,Wg.prototype.name="IndexOutOfBoundsException";var nl=function(){};nl.prototype.hasNext=function(){},nl.prototype.next=function(){},nl.prototype.remove=function(){};var Ur=function(r){function t(){r.apply(this,arguments)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.get=function(){},t.prototype.set=function(){},t.prototype.isEmpty=function(){},t}(Ue);function rl(r){this.message=r||""}rl.prototype=new Error,rl.prototype.name="NoSuchElementException";var tt=function(r){function t(){r.call(this),this.array_=[],arguments[0]instanceof Ue&&this.addAll(arguments[0])}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.ensureCapacity=function(){},t.prototype.interfaces_=function(){return[r,Ue]},t.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},t.prototype.clear=function(){this.array_=[]},t.prototype.addAll=function(n){for(var i=this,s=n.iterator();s.hasNext();)i.add(s.next());return!0},t.prototype.set=function(n,i){var s=this.array_[n];return this.array_[n]=i,s},t.prototype.iterator=function(){return new MN(this)},t.prototype.get=function(n){if(n<0||n>=this.size())throw new Wg;return this.array_[n]},t.prototype.isEmpty=function(){return this.array_.length===0},t.prototype.size=function(){return this.array_.length},t.prototype.toArray=function(){for(var n=this,i=[],s=0,o=this.array_.length;s<o;s++)i.push(n.array_[s]);return i},t.prototype.remove=function(n){for(var i=this,s=!1,o=0,a=this.array_.length;o<a;o++)if(i.array_[o]===n){i.array_.splice(o,1),s=!0;break}return s},t}(Ur),MN=function(r){function t(e){r.call(this),this.arrayList_=e,this.position_=0}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new rl;return this.arrayList_.get(this.position_++)},t.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},t.prototype.set=function(n){return this.arrayList_.set(this.position_-1,n)},t.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},t}(nl),rc=function(r){function t(){if(r.call(this),arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.ensureCapacity(n.length),this.add(n,!0)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.ensureCapacity(i.length),this.add(i,s)}}}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={coordArrayType:{configurable:!0}};return e.coordArrayType.get=function(){return new Array(0).fill(null)},t.prototype.getCoordinate=function(i){return this.get(i)},t.prototype.addAll=function(){var i=this;if(arguments.length===2){for(var s=arguments[0],o=arguments[1],a=!1,u=s.iterator();u.hasNext();)i.add(u.next(),o),a=!0;return a}else return r.prototype.addAll.apply(this,arguments)},t.prototype.clone=function(){for(var i=this,s=r.prototype.clone.call(this),o=0;o<this.size();o++)s.add(o,i.get(o).copy());return s},t.prototype.toCoordinateArray=function(){return this.toArray(t.coordArrayType)},t.prototype.add=function(){var i=this;if(arguments.length===1){var s=arguments[0];r.prototype.add.call(this,s)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var o=arguments[0],a=arguments[1];return this.add(o,a,!0),!0}else if(arguments[0]instanceof F&&typeof arguments[1]=="boolean"){var u=arguments[0],l=arguments[1];if(!l&&this.size()>=1){var h=this.get(this.size()-1);if(h.equals2D(u))return null}r.prototype.add.call(this,u)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var c=arguments[0],d=arguments[1];return this.add(c,d),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var p=arguments[0],g=arguments[1],y=arguments[2];if(y)for(var w=0;w<p.length;w++)i.add(p[w],g);else for(var b=p.length-1;b>=0;b--)i.add(p[b],g);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof F){var m=arguments[0],E=arguments[1],_=arguments[2];if(!_){var S=this.size();if(S>0){if(m>0){var C=this.get(m-1);if(C.equals2D(E))return null}if(m<S){var P=this.get(m);if(P.equals2D(E))return null}}}r.prototype.add.call(this,m,E)}}else if(arguments.length===4){var x=arguments[0],M=arguments[1],O=arguments[2],I=arguments[3],T=1;O>I&&(T=-1);for(var A=O;A!==I;A+=T)i.add(x[A],M);return!0}},t.prototype.closeRing=function(){this.size()>0&&this.add(new F(this.get(0)),!1)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},Object.defineProperties(t,e),t}(tt),zt=function(){},Jd={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Jd.ForwardComparator.get=function(){return ic},Jd.BidirectionalComparator.get=function(){return il},Jd.coordArrayType.get=function(){return new Array(0).fill(null)},zt.prototype.interfaces_=function(){return[]},zt.prototype.getClass=function(){return zt},zt.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))},zt.ptNotInList=function(t,e){for(var n=0;n<t.length;n++){var i=t[n];if(zt.indexOf(i,e)<0)return i}return null},zt.scroll=function(t,e){var n=zt.indexOf(e,t);if(n<0)return null;var i=new Array(t.length).fill(null);sn.arraycopy(t,n,i,0,t.length-n),sn.arraycopy(t,0,i,t.length-n,n),sn.arraycopy(i,0,t,0,t.length)},zt.equals=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(t===null||e===null||t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].equals(e[n]))return!1;return!0}else if(arguments.length===3){var i=arguments[0],s=arguments[1],o=arguments[2];if(i===s)return!0;if(i===null||s===null||i.length!==s.length)return!1;for(var a=0;a<i.length;a++)if(o.compare(i[a],s[a])!==0)return!1;return!0}},zt.intersection=function(t,e){for(var n=new rc,i=0;i<t.length;i++)e.intersects(t[i])&&n.add(t[i],!0);return n.toCoordinateArray()},zt.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},zt.removeRepeatedPoints=function(t){if(!zt.hasRepeatedPoints(t))return t;var e=new rc(t,!1);return e.toCoordinateArray()},zt.reverse=function(t){for(var e=t.length-1,n=Math.trunc(e/2),i=0;i<=n;i++){var s=t[i];t[i]=t[e-i],t[e-i]=s}},zt.removeNull=function(t){for(var e=0,n=0;n<t.length;n++)t[n]!==null&&e++;var i=new Array(e).fill(null);if(e===0)return i;for(var s=0,o=0;o<t.length;o++)t[o]!==null&&(i[s++]=t[o]);return i},zt.copyDeep=function(){if(arguments.length===1){for(var t=arguments[0],e=new Array(t.length).fill(null),n=0;n<t.length;n++)e[n]=new F(t[n]);return e}else if(arguments.length===5)for(var i=arguments[0],s=arguments[1],o=arguments[2],a=arguments[3],u=arguments[4],l=0;l<u;l++)o[a+l]=new F(i[s+l])},zt.isEqualReversed=function(t,e){for(var n=0;n<t.length;n++){var i=t[n],s=e[t.length-n-1];if(i.compareTo(s)!==0)return!1}return!0},zt.envelope=function(t){for(var e=new gt,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e},zt.toCoordinateArray=function(t){return t.toArray(zt.coordArrayType)},zt.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},zt.indexOf=function(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return-1},zt.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var n=t.length-1-e,i=t[e].compareTo(t[n]);if(i!==0)return i}return 1},zt.compare=function(t,e){for(var n=0;n<t.length&&n<e.length;){var i=t[n].compareTo(e[n]);if(i!==0)return i;n++}return n<e.length?-1:n<t.length?1:0},zt.minCoordinate=function(t){for(var e=null,n=0;n<t.length;n++)(e===null||e.compareTo(t[n])>0)&&(e=t[n]);return e},zt.extract=function(t,e,n){e=hr.clamp(e,0,t.length),n=hr.clamp(n,-1,t.length);var i=n-e+1;n<0&&(i=0),e>=t.length&&(i=0),n<e&&(i=0);var s=new Array(i).fill(null);if(i===0)return s;for(var o=0,a=e;a<=n;a++)s[o++]=t[a];return s},Object.defineProperties(zt,Jd);var ic=function(){};ic.prototype.compare=function(t,e){var n=t,i=e;return zt.compare(n,i)},ic.prototype.interfaces_=function(){return[Xu]},ic.prototype.getClass=function(){return ic};var il=function(){};il.prototype.compare=function(t,e){var n=t,i=e;if(n.length<i.length)return-1;if(n.length>i.length)return 1;if(n.length===0)return 0;var s=zt.compare(n,i),o=zt.isEqualReversed(n,i);return o?0:s},il.prototype.OLDcompare=function(t,e){var n=t,i=e;if(n.length<i.length)return-1;if(n.length>i.length)return 1;if(n.length===0)return 0;for(var s=zt.increasingDirection(n),o=zt.increasingDirection(i),a=s>0?0:n.length-1,u=o>0?0:n.length-1,l=0;l<n.length;l++){var h=n[a].compareTo(i[u]);if(h!==0)return h;a+=s,u+=o}return 0},il.prototype.interfaces_=function(){return[Xu]},il.prototype.getClass=function(){return il};var Fa=function(){};Fa.prototype.get=function(){},Fa.prototype.put=function(){},Fa.prototype.size=function(){},Fa.prototype.values=function(){},Fa.prototype.entrySet=function(){};var TN=function(r){function t(){r.apply(this,arguments)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t}(Fa);function sc(r){this.message=r||""}sc.prototype=new Error,sc.prototype.name="OperationNotSupported";function Zd(){}Zd.prototype=new Ue,Zd.prototype.contains=function(){};var Hg=function(r){function t(){r.call(this),this.array_=[],arguments[0]instanceof Ue&&this.addAll(arguments[0])}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.contains=function(n){for(var i=this,s=0,o=this.array_.length;s<o;s++){var a=i.array_[s];if(a===n)return!0}return!1},t.prototype.add=function(n){return this.contains(n)?!1:(this.array_.push(n),!0)},t.prototype.addAll=function(n){for(var i=this,s=n.iterator();s.hasNext();)i.add(s.next());return!0},t.prototype.remove=function(n){throw new Error},t.prototype.size=function(){return this.array_.length},t.prototype.isEmpty=function(){return this.array_.length===0},t.prototype.toArray=function(){for(var n=this,i=[],s=0,o=this.array_.length;s<o;s++)i.push(n.array_[s]);return i},t.prototype.iterator=function(){return new NN(this)},t}(Zd),NN=function(r){function t(e){r.call(this),this.hashSet_=e,this.position_=0}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new rl;return this.hashSet_.array_[this.position_++]},t.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},t.prototype.remove=function(){throw new sc},t}(nl),Cs=0,qo=1;function R1(r){return r===null?Cs:r.color}function fe(r){return r===null?null:r.parent}function bs(r,t){r!==null&&(r.color=t)}function $g(r){return r===null?null:r.left}function L1(r){return r===null?null:r.right}function mn(){this.root_=null,this.size_=0}mn.prototype=new TN,mn.prototype.get=function(r){for(var t=this.root_;t!==null;){var e=r.compareTo(t.key);if(e<0)t=t.left;else if(e>0)t=t.right;else return t.value}return null},mn.prototype.put=function(r,t){if(this.root_===null)return this.root_={key:r,value:t,left:null,right:null,parent:null,color:Cs,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var e=this.root_,n,i;do if(n=e,i=r.compareTo(e.key),i<0)e=e.left;else if(i>0)e=e.right;else{var s=e.value;return e.value=t,s}while(e!==null);var o={key:r,left:null,right:null,value:t,parent:n,color:Cs,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?n.left=o:n.right=o,this.fixAfterInsertion(o),this.size_++,null},mn.prototype.fixAfterInsertion=function(r){var t=this;for(r.color=qo;r!=null&&r!==this.root_&&r.parent.color===qo;)if(fe(r)===$g(fe(fe(r)))){var e=L1(fe(fe(r)));R1(e)===qo?(bs(fe(r),Cs),bs(e,Cs),bs(fe(fe(r)),qo),r=fe(fe(r))):(r===L1(fe(r))&&(r=fe(r),t.rotateLeft(r)),bs(fe(r),Cs),bs(fe(fe(r)),qo),t.rotateRight(fe(fe(r))))}else{var n=$g(fe(fe(r)));R1(n)===qo?(bs(fe(r),Cs),bs(n,Cs),bs(fe(fe(r)),qo),r=fe(fe(r))):(r===$g(fe(r))&&(r=fe(r),t.rotateRight(r)),bs(fe(r),Cs),bs(fe(fe(r)),qo),t.rotateLeft(fe(fe(r))))}this.root_.color=Cs},mn.prototype.values=function(){var r=new tt,t=this.getFirstEntry();if(t!==null)for(r.add(t.value);(t=mn.successor(t))!==null;)r.add(t.value);return r},mn.prototype.entrySet=function(){var r=new Hg,t=this.getFirstEntry();if(t!==null)for(r.add(t);(t=mn.successor(t))!==null;)r.add(t);return r},mn.prototype.rotateLeft=function(r){if(r!=null){var t=r.right;r.right=t.left,t.left!=null&&(t.left.parent=r),t.parent=r.parent,r.parent===null?this.root_=t:r.parent.left===r?r.parent.left=t:r.parent.right=t,t.left=r,r.parent=t}},mn.prototype.rotateRight=function(r){if(r!=null){var t=r.left;r.left=t.right,t.right!=null&&(t.right.parent=r),t.parent=r.parent,r.parent===null?this.root_=t:r.parent.right===r?r.parent.right=t:r.parent.left=t,t.right=r,r.parent=t}},mn.prototype.getFirstEntry=function(){var r=this.root_;if(r!=null)for(;r.left!=null;)r=r.left;return r},mn.successor=function(r){if(r===null)return null;if(r.right!==null){for(var t=r.right;t.left!==null;)t=t.left;return t}else{for(var e=r.parent,n=r;e!==null&&n===e.right;)n=e,e=e.parent;return e}},mn.prototype.size=function(){return this.size_};var oc=function(){};oc.prototype.interfaces_=function(){return[]},oc.prototype.getClass=function(){return oc};function F1(){}F1.prototype=new Zd;function hi(){this.array_=[],arguments[0]instanceof Ue&&this.addAll(arguments[0])}hi.prototype=new F1,hi.prototype.contains=function(r){for(var t=this,e=0,n=this.array_.length;e<n;e++){var i=t.array_[e];if(i.compareTo(r)===0)return!0}return!1},hi.prototype.add=function(r){var t=this;if(this.contains(r))return!1;for(var e=0,n=this.array_.length;e<n;e++){var i=t.array_[e];if(i.compareTo(r)===1)return t.array_.splice(e,0,r),!0}return this.array_.push(r),!0},hi.prototype.addAll=function(r){for(var t=this,e=r.iterator();e.hasNext();)t.add(e.next());return!0},hi.prototype.remove=function(r){throw new sc},hi.prototype.size=function(){return this.array_.length},hi.prototype.isEmpty=function(){return this.array_.length===0},hi.prototype.toArray=function(){for(var r=this,t=[],e=0,n=this.array_.length;e<n;e++)t.push(r.array_[e]);return t},hi.prototype.iterator=function(){return new Kd(this)};var Kd=function(r){this.treeSet_=r,this.position_=0};Kd.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new rl;return this.treeSet_.array_[this.position_++]},Kd.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Kd.prototype.remove=function(){throw new sc};var Wo=function(){};Wo.sort=function(){var t=arguments[0],e,n,i,s;if(arguments.length===1)s=function(a,u){return a.compareTo(u)},t.sort(s);else if(arguments.length===2)i=arguments[1],s=function(a,u){return i.compare(a,u)},t.sort(s);else if(arguments.length===3){n=t.slice(arguments[1],arguments[2]),n.sort();var o=t.slice(0,arguments[1]).concat(n,t.slice(arguments[2],t.length));for(t.splice(0,t.length),e=0;e<o.length;e++)t.push(o[e])}else if(arguments.length===4)for(n=t.slice(arguments[1],arguments[2]),i=arguments[3],s=function(a,u){return i.compare(a,u)},n.sort(s),o=t.slice(0,arguments[1]).concat(n,t.slice(arguments[2],t.length)),t.splice(0,t.length),e=0;e<o.length;e++)t.push(o[e])},Wo.asList=function(t){for(var e=new tt,n=0,i=t.length;n<i;n++)e.add(t[n]);return e};var ee=function(){},qr={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};qr.P.get=function(){return 0},qr.L.get=function(){return 1},qr.A.get=function(){return 2},qr.FALSE.get=function(){return-1},qr.TRUE.get=function(){return-2},qr.DONTCARE.get=function(){return-3},qr.SYM_FALSE.get=function(){return"F"},qr.SYM_TRUE.get=function(){return"T"},qr.SYM_DONTCARE.get=function(){return"*"},qr.SYM_P.get=function(){return"0"},qr.SYM_L.get=function(){return"1"},qr.SYM_A.get=function(){return"2"},ee.prototype.interfaces_=function(){return[]},ee.prototype.getClass=function(){return ee},ee.toDimensionSymbol=function(t){switch(t){case ee.FALSE:return ee.SYM_FALSE;case ee.TRUE:return ee.SYM_TRUE;case ee.DONTCARE:return ee.SYM_DONTCARE;case ee.P:return ee.SYM_P;case ee.L:return ee.SYM_L;case ee.A:return ee.SYM_A}throw new Ce("Unknown dimension value: "+t)},ee.toDimensionValue=function(t){switch(ec.toUpperCase(t)){case ee.SYM_FALSE:return ee.FALSE;case ee.SYM_TRUE:return ee.TRUE;case ee.SYM_DONTCARE:return ee.DONTCARE;case ee.SYM_P:return ee.P;case ee.SYM_L:return ee.L;case ee.SYM_A:return ee.A}throw new Ce("Unknown dimension symbol: "+t)},Object.defineProperties(ee,qr);var ci=function(){};ci.prototype.filter=function(t){},ci.prototype.interfaces_=function(){return[]},ci.prototype.getClass=function(){return ci};var Wr=function(){};Wr.prototype.filter=function(t,e){},Wr.prototype.isDone=function(){},Wr.prototype.isGeometryChanged=function(){},Wr.prototype.interfaces_=function(){return[]},Wr.prototype.getClass=function(){return Wr};var Cn=function(r){function t(n,i){if(r.call(this,i),this._geometries=n||[],r.hasNullElements(this._geometries))throw new Ce("geometries must not contain null elements")}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={serialVersionUID:{configurable:!0}};return t.prototype.computeEnvelopeInternal=function(){for(var i=this,s=new gt,o=0;o<this._geometries.length;o++)s.expandToInclude(i._geometries[o].getEnvelopeInternal());return s},t.prototype.getGeometryN=function(i){return this._geometries[i]},t.prototype.getSortIndex=function(){return r.SORTINDEX_GEOMETRYCOLLECTION},t.prototype.getCoordinates=function(){for(var i=this,s=new Array(this.getNumPoints()).fill(null),o=-1,a=0;a<this._geometries.length;a++)for(var u=i._geometries[a].getCoordinates(),l=0;l<u.length;l++)o++,s[o]=u[l];return s},t.prototype.getArea=function(){for(var i=this,s=0,o=0;o<this._geometries.length;o++)s+=i._geometries[o].getArea();return s},t.prototype.equalsExact=function(){var i=this;if(arguments.length===2){var s=arguments[0],o=arguments[1];if(!this.isEquivalentClass(s))return!1;var a=s;if(this._geometries.length!==a._geometries.length)return!1;for(var u=0;u<this._geometries.length;u++)if(!i._geometries[u].equalsExact(a._geometries[u],o))return!1;return!0}else return r.prototype.equalsExact.apply(this,arguments)},t.prototype.normalize=function(){for(var i=this,s=0;s<this._geometries.length;s++)i._geometries[s].normalize();Wo.sort(this._geometries)},t.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},t.prototype.getBoundaryDimension=function(){for(var i=this,s=ee.FALSE,o=0;o<this._geometries.length;o++)s=Math.max(s,i._geometries[o].getBoundaryDimension());return s},t.prototype.getDimension=function(){for(var i=this,s=ee.FALSE,o=0;o<this._geometries.length;o++)s=Math.max(s,i._geometries[o].getDimension());return s},t.prototype.getLength=function(){for(var i=this,s=0,o=0;o<this._geometries.length;o++)s+=i._geometries[o].getLength();return s},t.prototype.getNumPoints=function(){for(var i=this,s=0,o=0;o<this._geometries.length;o++)s+=i._geometries[o].getNumPoints();return s},t.prototype.getNumGeometries=function(){return this._geometries.length},t.prototype.reverse=function(){for(var i=this,s=this._geometries.length,o=new Array(s).fill(null),a=0;a<this._geometries.length;a++)o[a]=i._geometries[a].reverse();return this.getFactory().createGeometryCollection(o)},t.prototype.compareToSameClass=function(){var i=this;if(arguments.length===1){var s=arguments[0],o=new hi(Wo.asList(this._geometries)),a=new hi(Wo.asList(s._geometries));return this.compare(o,a)}else if(arguments.length===2){for(var u=arguments[0],l=arguments[1],h=u,c=this.getNumGeometries(),d=h.getNumGeometries(),p=0;p<c&&p<d;){var g=i.getGeometryN(p),y=h.getGeometryN(p),w=g.compareToSameClass(y,l);if(w!==0)return w;p++}return p<c?1:p<d?-1:0}},t.prototype.apply=function(){var i=this;if(Pt(arguments[0],Vi))for(var s=arguments[0],o=0;o<this._geometries.length;o++)i._geometries[o].apply(s);else if(Pt(arguments[0],Wr)){var a=arguments[0];if(this._geometries.length===0)return null;for(var u=0;u<this._geometries.length&&(i._geometries[u].apply(a),!a.isDone());u++);a.isGeometryChanged()&&this.geometryChanged()}else if(Pt(arguments[0],ci)){var l=arguments[0];l.filter(this);for(var h=0;h<this._geometries.length;h++)i._geometries[h].apply(l)}else if(Pt(arguments[0],Es)){var c=arguments[0];c.filter(this);for(var d=0;d<this._geometries.length;d++)i._geometries[d].apply(c)}},t.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),Ft.shouldNeverReachHere(),null},t.prototype.clone=function(){var i=this,s=r.prototype.clone.call(this);s._geometries=new Array(this._geometries.length).fill(null);for(var o=0;o<this._geometries.length;o++)s._geometries[o]=i._geometries[o].clone();return s},t.prototype.getGeometryType=function(){return"GeometryCollection"},t.prototype.copy=function(){for(var i=this,s=new Array(this._geometries.length).fill(null),o=0;o<s.length;o++)s[o]=i._geometries[o].copy();return new t(s,this._factory)},t.prototype.isEmpty=function(){for(var i=this,s=0;s<this._geometries.length;s++)if(!i._geometries[s].isEmpty())return!1;return!0},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},e.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(t,e),t}(bt),Ho=function(r){function t(){r.apply(this,arguments)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={serialVersionUID:{configurable:!0}};return t.prototype.getSortIndex=function(){return bt.SORTINDEX_MULTILINESTRING},t.prototype.equalsExact=function(){if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.isEquivalentClass(i)?r.prototype.equalsExact.call(this,i,s):!1}else return r.prototype.equalsExact.apply(this,arguments)},t.prototype.getBoundaryDimension=function(){return this.isClosed()?ee.FALSE:0},t.prototype.isClosed=function(){var i=this;if(this.isEmpty())return!1;for(var s=0;s<this._geometries.length;s++)if(!i._geometries[s].isClosed())return!1;return!0},t.prototype.getDimension=function(){return 1},t.prototype.reverse=function(){for(var i=this,s=this._geometries.length,o=new Array(s).fill(null),a=0;a<this._geometries.length;a++)o[s-1-a]=i._geometries[a].reverse();return this.getFactory().createMultiLineString(o)},t.prototype.getBoundary=function(){return new Mr(this).getBoundary()},t.prototype.getGeometryType=function(){return"MultiLineString"},t.prototype.copy=function(){for(var i=this,s=new Array(this._geometries.length).fill(null),o=0;o<s.length;o++)s[o]=i._geometries[o].copy();return new t(s,this._factory)},t.prototype.interfaces_=function(){return[oc]},t.prototype.getClass=function(){return t},e.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(t,e),t}(Cn),Mr=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var t=arguments[0],e=Ir.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._geom=n,this._geomFact=n.getFactory(),this._bnRule=i}};Mr.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return e.length===1?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)},Mr.prototype.getBoundary=function(){return this._geom instanceof Me?this.boundaryLineString(this._geom):this._geom instanceof Ho?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},Mr.prototype.boundaryLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();if(t.isClosed()){var e=this._bnRule.isInBoundary(2);return e?t.getStartPoint():this._geomFact.createMultiPoint()}return this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},Mr.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},Mr.prototype.computeBoundaryCoordinates=function(t){var e=this,n=new tt;this._endpointMap=new mn;for(var i=0;i<t.getNumGeometries();i++){var s=t.getGeometryN(i);s.getNumPoints()!==0&&(e.addEndpoint(s.getCoordinateN(0)),e.addEndpoint(s.getCoordinateN(s.getNumPoints()-1)))}for(var o=this._endpointMap.entrySet().iterator();o.hasNext();){var a=o.next(),u=a.getValue(),l=u.count;e._bnRule.isInBoundary(l)&&n.add(a.getKey())}return zt.toCoordinateArray(n)},Mr.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);e===null&&(e=new Qd,this._endpointMap.put(t,e)),e.count++},Mr.prototype.interfaces_=function(){return[]},Mr.prototype.getClass=function(){return Mr},Mr.getBoundary=function(){if(arguments.length===1){var t=arguments[0],e=new Mr(t);return e.getBoundary()}else if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new Mr(n,i);return s.getBoundary()}};var Qd=function(){this.count=null};Qd.prototype.interfaces_=function(){return[]},Qd.prototype.getClass=function(){return Qd};function ON(){}function DN(){}var AN=function(){};function RN(){}function LN(){}function FN(){}var Tr=function(){},Xg={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};Tr.prototype.interfaces_=function(){return[]},Tr.prototype.getClass=function(){return Tr},Tr.chars=function(t,e){for(var n=new Array(e).fill(null),i=0;i<e;i++)n[i]=t;return String(n)},Tr.getStackTrace=function(){if(arguments.length===1){var t=arguments[0],e=new RN,n=new ON;return t.printStackTrace(n),e.toString()}else if(arguments.length===2){var i=arguments[0],s=arguments[1],o="";new DN(Tr.getStackTrace(i));for(var a=new FN,u=0;u<s;u++)try{o+=a.readLine()+Tr.NEWLINE}catch(l){if(l instanceof LN)Ft.shouldNeverReachHere();else throw l}finally{}return o}},Tr.split=function(t,e){for(var n=e.length,i=new tt,s=""+t,o=s.indexOf(e);o>=0;){var a=s.substring(0,o);i.add(a),s=s.substring(o+n),o=s.indexOf(e)}s.length>0&&i.add(s);for(var u=new Array(i.size()).fill(null),l=0;l<u.length;l++)u[l]=i.get(l);return u},Tr.toString=function(){if(arguments.length===1){var t=arguments[0];return Tr.SIMPLE_ORDINATE_FORMAT.format(t)}},Tr.spaces=function(t){return Tr.chars(" ",t)},Xg.NEWLINE.get=function(){return sn.getProperty("line.separator")},Xg.SIMPLE_ORDINATE_FORMAT.get=function(){return new AN},Object.defineProperties(Tr,Xg);var De=function(){};De.prototype.interfaces_=function(){return[]},De.prototype.getClass=function(){return De},De.copyCoord=function(t,e,n,i){for(var s=Math.min(t.getDimension(),n.getDimension()),o=0;o<s;o++)n.setOrdinate(i,o,t.getOrdinate(e,o))},De.isRing=function(t){var e=t.size();return e===0?!0:e<=3?!1:t.getOrdinate(0,Jt.X)===t.getOrdinate(e-1,Jt.X)&&t.getOrdinate(0,Jt.Y)===t.getOrdinate(e-1,Jt.Y)},De.isEqual=function(t,e){var n=t.size(),i=e.size();if(n!==i)return!1;for(var s=Math.min(t.getDimension(),e.getDimension()),o=0;o<n;o++)for(var a=0;a<s;a++){var u=t.getOrdinate(o,a),l=e.getOrdinate(o,a);if(t.getOrdinate(o,a)!==e.getOrdinate(o,a)&&!(Tt.isNaN(u)&&Tt.isNaN(l)))return!1}return!0},De.extend=function(t,e,n){var i=t.create(n,e.getDimension()),s=e.size();if(De.copy(e,0,i,0,s),s>0)for(var o=s;o<n;o++)De.copy(e,s-1,i,o,1);return i},De.reverse=function(t){for(var e=t.size()-1,n=Math.trunc(e/2),i=0;i<=n;i++)De.swap(t,i,e-i)},De.swap=function(t,e,n){if(e===n)return null;for(var i=0;i<t.getDimension();i++){var s=t.getOrdinate(e,i);t.setOrdinate(e,i,t.getOrdinate(n,i)),t.setOrdinate(n,i,s)}},De.copy=function(t,e,n,i,s){for(var o=0;o<s;o++)De.copyCoord(t,e+o,n,i+o)},De.toString=function(){if(arguments.length===1){var t=arguments[0],e=t.size();if(e===0)return"()";var n=t.getDimension(),i=new oi;i.append("(");for(var s=0;s<e;s++){s>0&&i.append(" ");for(var o=0;o<n;o++)o>0&&i.append(","),i.append(Tr.toString(t.getOrdinate(s,o)))}return i.append(")"),i.toString()}},De.ensureValidRing=function(t,e){var n=e.size();if(n===0)return e;if(n<=3)return De.createClosedRing(t,e,4);var i=e.getOrdinate(0,Jt.X)===e.getOrdinate(n-1,Jt.X)&&e.getOrdinate(0,Jt.Y)===e.getOrdinate(n-1,Jt.Y);return i?e:De.createClosedRing(t,e,n+1)},De.createClosedRing=function(t,e,n){var i=t.create(n,e.getDimension()),s=e.size();De.copy(e,0,i,0,s);for(var o=s;o<n;o++)De.copy(e,0,i,o,1);return i};var Me=function(r){function t(n,i){r.call(this,i),this._points=null,this.init(n)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={serialVersionUID:{configurable:!0}};return t.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new gt:this._points.expandEnvelope(new gt)},t.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},t.prototype.getSortIndex=function(){return r.SORTINDEX_LINESTRING},t.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},t.prototype.equalsExact=function(){var i=this;if(arguments.length===2){var s=arguments[0],o=arguments[1];if(!this.isEquivalentClass(s))return!1;var a=s;if(this._points.size()!==a._points.size())return!1;for(var u=0;u<this._points.size();u++)if(!i.equal(i._points.getCoordinate(u),a._points.getCoordinate(u),o))return!1;return!0}else return r.prototype.equalsExact.apply(this,arguments)},t.prototype.normalize=function(){for(var i=this,s=0;s<Math.trunc(this._points.size()/2);s++){var o=i._points.size()-1-s;if(!i._points.getCoordinate(s).equals(i._points.getCoordinate(o)))return i._points.getCoordinate(s).compareTo(i._points.getCoordinate(o))>0&&De.reverse(i._points),null}},t.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},t.prototype.getBoundaryDimension=function(){return this.isClosed()?ee.FALSE:0},t.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},t.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},t.prototype.getDimension=function(){return 1},t.prototype.getLength=function(){return rt.computeLength(this._points)},t.prototype.getNumPoints=function(){return this._points.size()},t.prototype.reverse=function(){var i=this._points.copy();De.reverse(i);var s=this.getFactory().createLineString(i);return s},t.prototype.compareToSameClass=function(){var i=this;if(arguments.length===1){for(var s=arguments[0],o=s,a=0,u=0;a<this._points.size()&&u<o._points.size();){var l=i._points.getCoordinate(a).compareTo(o._points.getCoordinate(u));if(l!==0)return l;a++,u++}return a<this._points.size()?1:u<o._points.size()?-1:0}else if(arguments.length===2){var h=arguments[0],c=arguments[1],d=h;return c.compare(this._points,d._points)}},t.prototype.apply=function(){var i=this;if(Pt(arguments[0],Vi))for(var s=arguments[0],o=0;o<this._points.size();o++)s.filter(i._points.getCoordinate(o));else if(Pt(arguments[0],Wr)){var a=arguments[0];if(this._points.size()===0)return null;for(var u=0;u<this._points.size()&&(a.filter(i._points,u),!a.isDone());u++);a.isGeometryChanged()&&this.geometryChanged()}else if(Pt(arguments[0],ci)){var l=arguments[0];l.filter(this)}else if(Pt(arguments[0],Es)){var h=arguments[0];h.filter(this)}},t.prototype.getBoundary=function(){return new Mr(this).getBoundary()},t.prototype.isEquivalentClass=function(i){return i instanceof t},t.prototype.clone=function(){var i=r.prototype.clone.call(this);return i._points=this._points.clone(),i},t.prototype.getCoordinateN=function(i){return this._points.getCoordinate(i)},t.prototype.getGeometryType=function(){return"LineString"},t.prototype.copy=function(){return new t(this._points.copy(),this._factory)},t.prototype.getCoordinateSequence=function(){return this._points},t.prototype.isEmpty=function(){return this._points.size()===0},t.prototype.init=function(i){if(i===null&&(i=this.getFactory().getCoordinateSequenceFactory().create([])),i.size()===1)throw new Ce("Invalid number of points in LineString (found "+i.size()+" - must be 0 or >= 2)");this._points=i},t.prototype.isCoordinate=function(i){for(var s=this,o=0;o<this._points.size();o++)if(s._points.getCoordinate(o).equals(i))return!0;return!1},t.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},t.prototype.getPointN=function(i){return this.getFactory().createPoint(this._points.getCoordinate(i))},t.prototype.interfaces_=function(){return[oc]},t.prototype.getClass=function(){return t},e.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(t,e),t}(bt),ac=function(){};ac.prototype.interfaces_=function(){return[]},ac.prototype.getClass=function(){return ac};var Xn=function(r){function t(n,i){r.call(this,i),this._coordinates=n||null,this.init(this._coordinates)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={serialVersionUID:{configurable:!0}};return t.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new gt;var i=new gt;return i.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),i},t.prototype.getSortIndex=function(){return r.SORTINDEX_POINT},t.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},t.prototype.equalsExact=function(){if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.isEquivalentClass(i)?this.isEmpty()&&i.isEmpty()?!0:this.isEmpty()!==i.isEmpty()?!1:this.equal(i.getCoordinate(),this.getCoordinate(),s):!1}else return r.prototype.equalsExact.apply(this,arguments)},t.prototype.normalize=function(){},t.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},t.prototype.getBoundaryDimension=function(){return ee.FALSE},t.prototype.getDimension=function(){return 0},t.prototype.getNumPoints=function(){return this.isEmpty()?0:1},t.prototype.reverse=function(){return this.copy()},t.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},t.prototype.compareToSameClass=function(){if(arguments.length===1){var i=arguments[0],s=i;return this.getCoordinate().compareTo(s.getCoordinate())}else if(arguments.length===2){var o=arguments[0],a=arguments[1],u=o;return a.compare(this._coordinates,u._coordinates)}},t.prototype.apply=function(){if(Pt(arguments[0],Vi)){var i=arguments[0];if(this.isEmpty())return null;i.filter(this.getCoordinate())}else if(Pt(arguments[0],Wr)){var s=arguments[0];if(this.isEmpty())return null;s.filter(this._coordinates,0),s.isGeometryChanged()&&this.geometryChanged()}else if(Pt(arguments[0],ci)){var o=arguments[0];o.filter(this)}else if(Pt(arguments[0],Es)){var a=arguments[0];a.filter(this)}},t.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},t.prototype.clone=function(){var i=r.prototype.clone.call(this);return i._coordinates=this._coordinates.clone(),i},t.prototype.getGeometryType=function(){return"Point"},t.prototype.copy=function(){return new t(this._coordinates.copy(),this._factory)},t.prototype.getCoordinateSequence=function(){return this._coordinates},t.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},t.prototype.isEmpty=function(){return this._coordinates.size()===0},t.prototype.init=function(i){i===null&&(i=this.getFactory().getCoordinateSequenceFactory().create([])),Ft.isTrue(i.size()<=1),this._coordinates=i},t.prototype.isSimple=function(){return!0},t.prototype.interfaces_=function(){return[ac]},t.prototype.getClass=function(){return t},e.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(t,e),t}(bt),so=function(){};so.prototype.interfaces_=function(){return[]},so.prototype.getClass=function(){return so};var qe=function(r){function t(n,i,s){if(r.call(this,s),this._shell=null,this._holes=null,n===null&&(n=this.getFactory().createLinearRing()),i===null&&(i=[]),r.hasNullElements(i))throw new Ce("holes must not contain null elements");if(n.isEmpty()&&r.hasNonEmptyElements(i))throw new Ce("shell is empty but holes are not");this._shell=n,this._holes=i}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={serialVersionUID:{configurable:!0}};return t.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},t.prototype.getSortIndex=function(){return r.SORTINDEX_POLYGON},t.prototype.getCoordinates=function(){var i=this;if(this.isEmpty())return[];for(var s=new Array(this.getNumPoints()).fill(null),o=-1,a=this._shell.getCoordinates(),u=0;u<a.length;u++)o++,s[o]=a[u];for(var l=0;l<this._holes.length;l++)for(var h=i._holes[l].getCoordinates(),c=0;c<h.length;c++)o++,s[o]=h[c];return s},t.prototype.getArea=function(){var i=this,s=0;s+=Math.abs(rt.signedArea(this._shell.getCoordinateSequence()));for(var o=0;o<this._holes.length;o++)s-=Math.abs(rt.signedArea(i._holes[o].getCoordinateSequence()));return s},t.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var i=this._shell.getCoordinateSequence(),s=this.getEnvelopeInternal(),o=0;o<5;o++){var a=i.getX(o);if(!(a===s.getMinX()||a===s.getMaxX()))return!1;var u=i.getY(o);if(!(u===s.getMinY()||u===s.getMaxY()))return!1}for(var l=i.getX(0),h=i.getY(0),c=1;c<=4;c++){var d=i.getX(c),p=i.getY(c),g=d!==l,y=p!==h;if(g===y)return!1;l=d,h=p}return!0},t.prototype.equalsExact=function(){var i=this;if(arguments.length===2){var s=arguments[0],o=arguments[1];if(!this.isEquivalentClass(s))return!1;var a=s,u=this._shell,l=a._shell;if(!u.equalsExact(l,o)||this._holes.length!==a._holes.length)return!1;for(var h=0;h<this._holes.length;h++)if(!i._holes[h].equalsExact(a._holes[h],o))return!1;return!0}else return r.prototype.equalsExact.apply(this,arguments)},t.prototype.normalize=function(){var i=this;if(arguments.length===0){this.normalize(this._shell,!0);for(var s=0;s<this._holes.length;s++)i.normalize(i._holes[s],!1);Wo.sort(this._holes)}else if(arguments.length===2){var o=arguments[0],a=arguments[1];if(o.isEmpty())return null;var u=new Array(o.getCoordinates().length-1).fill(null);sn.arraycopy(o.getCoordinates(),0,u,0,u.length);var l=zt.minCoordinate(o.getCoordinates());zt.scroll(u,l),sn.arraycopy(u,0,o.getCoordinates(),0,u.length),o.getCoordinates()[u.length]=u[0],rt.isCCW(o.getCoordinates())===a&&zt.reverse(o.getCoordinates())}},t.prototype.getCoordinate=function(){return this._shell.getCoordinate()},t.prototype.getNumInteriorRing=function(){return this._holes.length},t.prototype.getBoundaryDimension=function(){return 1},t.prototype.getDimension=function(){return 2},t.prototype.getLength=function(){var i=this,s=0;s+=this._shell.getLength();for(var o=0;o<this._holes.length;o++)s+=i._holes[o].getLength();return s},t.prototype.getNumPoints=function(){for(var i=this,s=this._shell.getNumPoints(),o=0;o<this._holes.length;o++)s+=i._holes[o].getNumPoints();return s},t.prototype.reverse=function(){var i=this,s=this.copy();s._shell=this._shell.copy().reverse(),s._holes=new Array(this._holes.length).fill(null);for(var o=0;o<this._holes.length;o++)s._holes[o]=i._holes[o].copy().reverse();return s},t.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},t.prototype.compareToSameClass=function(){var i=this;if(arguments.length===1){var s=arguments[0],o=this._shell,a=s._shell;return o.compareToSameClass(a)}else if(arguments.length===2){var u=arguments[0],l=arguments[1],h=u,c=this._shell,d=h._shell,p=c.compareToSameClass(d,l);if(p!==0)return p;for(var g=this.getNumInteriorRing(),y=h.getNumInteriorRing(),w=0;w<g&&w<y;){var b=i.getInteriorRingN(w),m=h.getInteriorRingN(w),E=b.compareToSameClass(m,l);if(E!==0)return E;w++}return w<g?1:w<y?-1:0}},t.prototype.apply=function(i){var s=this;if(Pt(i,Vi)){this._shell.apply(i);for(var o=0;o<this._holes.length;o++)s._holes[o].apply(i)}else if(Pt(i,Wr)){if(this._shell.apply(i),!i.isDone())for(var a=0;a<this._holes.length&&(s._holes[a].apply(i),!i.isDone());a++);i.isGeometryChanged()&&this.geometryChanged()}else if(Pt(i,ci))i.filter(this);else if(Pt(i,Es)){i.filter(this),this._shell.apply(i);for(var u=0;u<this._holes.length;u++)s._holes[u].apply(i)}},t.prototype.getBoundary=function(){var i=this;if(this.isEmpty())return this.getFactory().createMultiLineString();var s=new Array(this._holes.length+1).fill(null);s[0]=this._shell;for(var o=0;o<this._holes.length;o++)s[o+1]=i._holes[o];return s.length<=1?this.getFactory().createLinearRing(s[0].getCoordinateSequence()):this.getFactory().createMultiLineString(s)},t.prototype.clone=function(){var i=this,s=r.prototype.clone.call(this);s._shell=this._shell.clone(),s._holes=new Array(this._holes.length).fill(null);for(var o=0;o<this._holes.length;o++)s._holes[o]=i._holes[o].clone();return s},t.prototype.getGeometryType=function(){return"Polygon"},t.prototype.copy=function(){for(var i=this,s=this._shell.copy(),o=new Array(this._holes.length).fill(null),a=0;a<o.length;a++)o[a]=i._holes[a].copy();return new t(s,o,this._factory)},t.prototype.getExteriorRing=function(){return this._shell},t.prototype.isEmpty=function(){return this._shell.isEmpty()},t.prototype.getInteriorRingN=function(i){return this._holes[i]},t.prototype.interfaces_=function(){return[so]},t.prototype.getClass=function(){return t},e.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(t,e),t}(bt),sl=function(r){function t(){r.apply(this,arguments)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={serialVersionUID:{configurable:!0}};return t.prototype.getSortIndex=function(){return bt.SORTINDEX_MULTIPOINT},t.prototype.isValid=function(){return!0},t.prototype.equalsExact=function(){if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.isEquivalentClass(i)?r.prototype.equalsExact.call(this,i,s):!1}else return r.prototype.equalsExact.apply(this,arguments)},t.prototype.getCoordinate=function(){if(arguments.length===1){var i=arguments[0];return this._geometries[i].getCoordinate()}else return r.prototype.getCoordinate.apply(this,arguments)},t.prototype.getBoundaryDimension=function(){return ee.FALSE},t.prototype.getDimension=function(){return 0},t.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},t.prototype.getGeometryType=function(){return"MultiPoint"},t.prototype.copy=function(){for(var i=this,s=new Array(this._geometries.length).fill(null),o=0;o<s.length;o++)s[o]=i._geometries[o].copy();return new t(s,this._factory)},t.prototype.interfaces_=function(){return[ac]},t.prototype.getClass=function(){return t},e.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(t,e),t}(Cn),Bi=function(r){function t(n,i){n instanceof F&&i instanceof Ut&&(n=i.getCoordinateSequenceFactory().create(n)),r.call(this,n,i),this.validateConstruction()}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return t.prototype.getSortIndex=function(){return bt.SORTINDEX_LINEARRING},t.prototype.getBoundaryDimension=function(){return ee.FALSE},t.prototype.isClosed=function(){return this.isEmpty()?!0:r.prototype.isClosed.call(this)},t.prototype.reverse=function(){var i=this._points.copy();De.reverse(i);var s=this.getFactory().createLinearRing(i);return s},t.prototype.validateConstruction=function(){if(!this.isEmpty()&&!r.prototype.isClosed.call(this))throw new Ce("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<t.MINIMUM_VALID_SIZE)throw new Ce("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},t.prototype.getGeometryType=function(){return"LinearRing"},t.prototype.copy=function(){return new t(this._points.copy(),this._factory)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},e.MINIMUM_VALID_SIZE.get=function(){return 4},e.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(t,e),t}(Me),zi=function(r){function t(){r.apply(this,arguments)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={serialVersionUID:{configurable:!0}};return t.prototype.getSortIndex=function(){return bt.SORTINDEX_MULTIPOLYGON},t.prototype.equalsExact=function(){if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.isEquivalentClass(i)?r.prototype.equalsExact.call(this,i,s):!1}else return r.prototype.equalsExact.apply(this,arguments)},t.prototype.getBoundaryDimension=function(){return 1},t.prototype.getDimension=function(){return 2},t.prototype.reverse=function(){for(var i=this,s=this._geometries.length,o=new Array(s).fill(null),a=0;a<this._geometries.length;a++)o[a]=i._geometries[a].reverse();return this.getFactory().createMultiPolygon(o)},t.prototype.getBoundary=function(){var i=this;if(this.isEmpty())return this.getFactory().createMultiLineString();for(var s=new tt,o=0;o<this._geometries.length;o++)for(var a=i._geometries[o],u=a.getBoundary(),l=0;l<u.getNumGeometries();l++)s.add(u.getGeometryN(l));var h=new Array(s.size()).fill(null);return this.getFactory().createMultiLineString(s.toArray(h))},t.prototype.getGeometryType=function(){return"MultiPolygon"},t.prototype.copy=function(){for(var i=this,s=new Array(this._geometries.length).fill(null),o=0;o<s.length;o++)s[o]=i._geometries[o].copy();return new t(s,this._factory)},t.prototype.interfaces_=function(){return[so]},t.prototype.getClass=function(){return t},e.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(t,e),t}(Cn),Nr=function(t){this._factory=t||null,this._isUserDataCopied=!1},tf={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};Nr.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},Nr.prototype.edit=function(t,e){if(t===null)return null;var n=this.editInternal(t,e);return this._isUserDataCopied&&n.setUserData(t.getUserData()),n},Nr.prototype.editInternal=function(t,e){return this._factory===null&&(this._factory=t.getFactory()),t instanceof Cn?this.editGeometryCollection(t,e):t instanceof qe?this.editPolygon(t,e):t instanceof Xn?e.edit(t,this._factory):t instanceof Me?e.edit(t,this._factory):(Ft.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},Nr.prototype.editGeometryCollection=function(t,e){for(var n=this,i=e.edit(t,this._factory),s=new tt,o=0;o<i.getNumGeometries();o++){var a=n.edit(i.getGeometryN(o),e);a===null||a.isEmpty()||s.add(a)}return i.getClass()===sl?this._factory.createMultiPoint(s.toArray([])):i.getClass()===Ho?this._factory.createMultiLineString(s.toArray([])):i.getClass()===zi?this._factory.createMultiPolygon(s.toArray([])):this._factory.createGeometryCollection(s.toArray([]))},Nr.prototype.editPolygon=function(t,e){var n=this,i=e.edit(t,this._factory);if(i===null&&(i=this._factory.createPolygon(null)),i.isEmpty())return i;var s=this.edit(i.getExteriorRing(),e);if(s===null||s.isEmpty())return this._factory.createPolygon();for(var o=new tt,a=0;a<i.getNumInteriorRing();a++){var u=n.edit(i.getInteriorRingN(a),e);u===null||u.isEmpty()||o.add(u)}return this._factory.createPolygon(s,o.toArray([]))},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr},Nr.GeometryEditorOperation=function(){},tf.NoOpGeometryOperation.get=function(){return uc},tf.CoordinateOperation.get=function(){return lc},tf.CoordinateSequenceOperation.get=function(){return hc},Object.defineProperties(Nr,tf);var uc=function(){};uc.prototype.edit=function(t,e){return t},uc.prototype.interfaces_=function(){return[Nr.GeometryEditorOperation]},uc.prototype.getClass=function(){return uc};var lc=function(){};lc.prototype.edit=function(t,e){var n=this.editCoordinates(t.getCoordinates(),t);return n===null?t:t instanceof Bi?e.createLinearRing(n):t instanceof Me?e.createLineString(n):t instanceof Xn?n.length>0?e.createPoint(n[0]):e.createPoint():t},lc.prototype.interfaces_=function(){return[Nr.GeometryEditorOperation]},lc.prototype.getClass=function(){return lc};var hc=function(){};hc.prototype.edit=function(t,e){return t instanceof Bi?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Me?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Xn?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},hc.prototype.interfaces_=function(){return[Nr.GeometryEditorOperation]},hc.prototype.getClass=function(){return hc};var Ae=function(){var t=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var n=0;n<e;n++)t._coordinates[n]=new F}else if(Pt(arguments[0],Jt)){var i=arguments[0];if(i===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=i.getDimension(),this._coordinates=new Array(i.size()).fill(null);for(var s=0;s<this._coordinates.length;s++)t._coordinates[s]=i.getCoordinateCopy(s)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var o=arguments[0],a=arguments[1];this._coordinates=o,this._dimension=a,o===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var u=arguments[0],l=arguments[1];this._coordinates=new Array(u).fill(null),this._dimension=l;for(var h=0;h<u;h++)t._coordinates[h]=new F}}},k1={serialVersionUID:{configurable:!0}};Ae.prototype.setOrdinate=function(t,e,n){switch(e){case Jt.X:this._coordinates[t].x=n;break;case Jt.Y:this._coordinates[t].y=n;break;case Jt.Z:this._coordinates[t].z=n;break;default:throw new Ce("invalid ordinateIndex")}},Ae.prototype.size=function(){return this._coordinates.length},Ae.prototype.getOrdinate=function(t,e){switch(e){case Jt.X:return this._coordinates[t].x;case Jt.Y:return this._coordinates[t].y;case Jt.Z:return this._coordinates[t].z}return Tt.NaN},Ae.prototype.getCoordinate=function(){if(arguments.length===1){var t=arguments[0];return this._coordinates[t]}else if(arguments.length===2){var e=arguments[0],n=arguments[1];n.x=this._coordinates[e].x,n.y=this._coordinates[e].y,n.z=this._coordinates[e].z}},Ae.prototype.getCoordinateCopy=function(t){return new F(this._coordinates[t])},Ae.prototype.getDimension=function(){return this._dimension},Ae.prototype.getX=function(t){return this._coordinates[t].x},Ae.prototype.clone=function(){for(var t=this,e=new Array(this.size()).fill(null),n=0;n<this._coordinates.length;n++)e[n]=t._coordinates[n].clone();return new Ae(e,this._dimension)},Ae.prototype.expandEnvelope=function(t){for(var e=this,n=0;n<this._coordinates.length;n++)t.expandToInclude(e._coordinates[n]);return t},Ae.prototype.copy=function(){for(var t=this,e=new Array(this.size()).fill(null),n=0;n<this._coordinates.length;n++)e[n]=t._coordinates[n].copy();return new Ae(e,this._dimension)},Ae.prototype.toString=function(){var t=this;if(this._coordinates.length>0){var e=new oi(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var n=1;n<this._coordinates.length;n++)e.append(", "),e.append(t._coordinates[n]);return e.append(")"),e.toString()}else return"()"},Ae.prototype.getY=function(t){return this._coordinates[t].y},Ae.prototype.toCoordinateArray=function(){return this._coordinates},Ae.prototype.interfaces_=function(){return[Jt,xr]},Ae.prototype.getClass=function(){return Ae},k1.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(Ae,k1);var Ui=function(){},Yg={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};Ui.prototype.readResolve=function(){return Ui.instance()},Ui.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new Ae(t)}else if(Pt(arguments[0],Jt)){var e=arguments[0];return new Ae(e)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return i>3&&(i=3),i<2?new Ae(n):new Ae(n,i)}},Ui.prototype.interfaces_=function(){return[Yu,xr]},Ui.prototype.getClass=function(){return Ui},Ui.instance=function(){return Ui.instanceObject},Yg.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Yg.instanceObject.get=function(){return new Ui},Object.defineProperties(Ui,Yg);var G1=function(r){function t(){r.call(this),this.map_=new Map}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.get=function(n){return this.map_.get(n)||null},t.prototype.put=function(n,i){return this.map_.set(n,i),i},t.prototype.values=function(){for(var n=new tt,i=this.map_.values(),s=i.next();!s.done;)n.add(s.value),s=i.next();return n},t.prototype.entrySet=function(){var n=new Hg;return this.map_.entries().forEach(function(i){return n.add(i)}),n},t.prototype.size=function(){return this.map_.size()},t}(Fa),ne=function r(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=r.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof di){var t=arguments[0];this._modelType=t,t===r.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var e=arguments[0];this._modelType=r.FIXED,this.setScale(e)}else if(arguments[0]instanceof r){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}}},Jg={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};ne.prototype.equals=function(t){if(!(t instanceof ne))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},ne.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),i=e.getMaximumSignificantDigits();return new ai(n).compareTo(new ai(i))},ne.prototype.getScale=function(){return this._scale},ne.prototype.isFloating=function(){return this._modelType===ne.FLOATING||this._modelType===ne.FLOATING_SINGLE},ne.prototype.getType=function(){return this._modelType},ne.prototype.toString=function(){var t="UNKNOWN";return this._modelType===ne.FLOATING?t="Floating":this._modelType===ne.FLOATING_SINGLE?t="Floating-Single":this._modelType===ne.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},ne.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];if(Tt.isNaN(t))return t;if(this._modelType===ne.FLOATING_SINGLE){var e=t;return e}return this._modelType===ne.FIXED?Math.round(t*this._scale)/this._scale:t}else if(arguments[0]instanceof F){var n=arguments[0];if(this._modelType===ne.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}},ne.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===ne.FLOATING?t=16:this._modelType===ne.FLOATING_SINGLE?t=6:this._modelType===ne.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},ne.prototype.setScale=function(t){this._scale=Math.abs(t)},ne.prototype.interfaces_=function(){return[xr,Pr]},ne.prototype.getClass=function(){return ne},ne.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},Jg.serialVersionUID.get=function(){return 7777263578777804e3},Jg.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(ne,Jg);var di=function r(t){this._name=t||null,r.nameToTypeMap.put(t,this)},Zg={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};di.prototype.readResolve=function(){return di.nameToTypeMap.get(this._name)},di.prototype.toString=function(){return this._name},di.prototype.interfaces_=function(){return[xr]},di.prototype.getClass=function(){return di},Zg.serialVersionUID.get=function(){return-552860263173159e4},Zg.nameToTypeMap.get=function(){return new G1},Object.defineProperties(di,Zg),ne.Type=di,ne.FIXED=new di("FIXED"),ne.FLOATING=new di("FLOATING"),ne.FLOATING_SINGLE=new di("FLOATING SINGLE");var Ut=function r(){this._precisionModel=new ne,this._SRID=0,this._coordinateSequenceFactory=r.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Pt(arguments[0],Yu)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof ne&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},j1={serialVersionUID:{configurable:!0}};Ut.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new F(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new F(t.getMinX(),t.getMinY()),new F(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new F(t.getMinX(),t.getMinY()),new F(t.getMinX(),t.getMaxY()),new F(t.getMaxX(),t.getMaxY()),new F(t.getMaxX(),t.getMinY()),new F(t.getMinX(),t.getMinY())]),null)},Ut.prototype.createLineString=function(t){if(t){if(t instanceof Array)return new Me(this.getCoordinateSequenceFactory().create(t),this);if(Pt(t,Jt))return new Me(t,this)}else return new Me(this.getCoordinateSequenceFactory().create([]),this)},Ut.prototype.createMultiLineString=function(){if(arguments.length===0)return new Ho(null,this);if(arguments.length===1){var t=arguments[0];return new Ho(t,this)}},Ut.prototype.buildGeometry=function(t){for(var e=null,n=!1,i=!1,s=t.iterator();s.hasNext();){var o=s.next(),a=o.getClass();e===null&&(e=a),a!==e&&(n=!0),o.isGeometryCollectionOrDerived()&&(i=!0)}if(e===null)return this.createGeometryCollection();if(n||i)return this.createGeometryCollection(Ut.toGeometryArray(t));var u=t.iterator().next(),l=t.size()>1;if(l){if(u instanceof qe)return this.createMultiPolygon(Ut.toPolygonArray(t));if(u instanceof Me)return this.createMultiLineString(Ut.toLineStringArray(t));if(u instanceof Xn)return this.createMultiPoint(Ut.toPointArray(t));Ft.shouldNeverReachHere("Unhandled class: "+u.getClass().getName())}return u},Ut.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)},Ut.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof F){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}else if(Pt(arguments[0],Jt)){var e=arguments[0];return new Xn(e,this)}}},Ut.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Ut.prototype.createPolygon=function(){if(arguments.length===0)return new qe(null,null,this);if(arguments.length===1){if(Pt(arguments[0],Jt)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof Bi){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];return new qe(i,s,this)}},Ut.prototype.getSRID=function(){return this._SRID},Ut.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Cn(null,this);if(arguments.length===1){var t=arguments[0];return new Cn(t,this)}},Ut.prototype.createGeometry=function(t){var e=new Nr(this);return e.edit(t,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})},Ut.prototype.getPrecisionModel=function(){return this._precisionModel},Ut.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}else if(Pt(arguments[0],Jt)){var e=arguments[0];return new Bi(e,this)}}},Ut.prototype.createMultiPolygon=function(){if(arguments.length===0)return new zi(null,this);if(arguments.length===1){var t=arguments[0];return new zi(t,this)}},Ut.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new sl(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new sl(e,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Pt(arguments[0],Jt)){var i=arguments[0];if(i===null)return this.createMultiPoint(new Array(0).fill(null));for(var s=new Array(i.size()).fill(null),o=0;o<i.size();o++){var a=t.getCoordinateSequenceFactory().create(1,i.getDimension());De.copy(i,o,a,0,1),s[o]=t.createPoint(a)}return this.createMultiPoint(s)}}},Ut.prototype.interfaces_=function(){return[xr]},Ut.prototype.getClass=function(){return Ut},Ut.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Ut.toGeometryArray=function(t){if(t===null)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},Ut.getDefaultCoordinateSequenceFactory=function(){return Ui.instance()},Ut.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Ut.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Ut.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Ut.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Ut.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Ut.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Ut.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},j1.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(Ut,j1);var kN=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],ef=function(t){this.geometryFactory=t||new Ut};ef.prototype.read=function(t){var e;typeof t=="string"?e=JSON.parse(t):e=t;var n=e.type;if(!fi[n])throw new Error("Unknown GeoJSON type: "+e.type);return kN.indexOf(n)!==-1?fi[n].apply(this,[e.coordinates]):n==="GeometryCollection"?fi[n].apply(this,[e.geometries]):fi[n].apply(this,[e])},ef.prototype.write=function(t){var e=t.getGeometryType();if(!Ps[e])throw new Error("Geometry is not supported");return Ps[e].apply(this,[t])};var fi={Feature:function(r){var t={};for(var e in r)t[e]=r[e];if(r.geometry){var n=r.geometry.type;if(!fi[n])throw new Error("Unknown GeoJSON type: "+r.type);t.geometry=this.read(r.geometry)}return r.bbox&&(t.bbox=fi.bbox.apply(this,[r.bbox])),t},FeatureCollection:function(r){var t=this,e={};if(r.features){e.features=[];for(var n=0;n<r.features.length;++n)e.features.push(t.read(r.features[n]))}return r.bbox&&(e.bbox=this.parse.bbox.apply(this,[r.bbox])),e},coordinates:function(r){for(var t=[],e=0;e<r.length;++e){var n=r[e];t.push(new F(n[0],n[1]))}return t},bbox:function(r){return this.geometryFactory.createLinearRing([new F(r[0],r[1]),new F(r[2],r[1]),new F(r[2],r[3]),new F(r[0],r[3]),new F(r[0],r[1])])},Point:function(r){var t=new F(r[0],r[1]);return this.geometryFactory.createPoint(t)},MultiPoint:function(r){for(var t=this,e=[],n=0;n<r.length;++n)e.push(fi.Point.apply(t,[r[n]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(r){var t=fi.coordinates.apply(this,[r]);return this.geometryFactory.createLineString(t)},MultiLineString:function(r){for(var t=this,e=[],n=0;n<r.length;++n)e.push(fi.LineString.apply(t,[r[n]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(r){for(var t=this,e=fi.coordinates.apply(this,[r[0]]),n=this.geometryFactory.createLinearRing(e),i=[],s=1;s<r.length;++s){var o=r[s],a=fi.coordinates.apply(t,[o]),u=t.geometryFactory.createLinearRing(a);i.push(u)}return this.geometryFactory.createPolygon(n,i)},MultiPolygon:function(r){for(var t=this,e=[],n=0;n<r.length;++n){var i=r[n];e.push(fi.Polygon.apply(t,[i]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(r){for(var t=this,e=[],n=0;n<r.length;++n){var i=r[n];e.push(t.read(i))}return this.geometryFactory.createGeometryCollection(e)}},Ps={coordinate:function(r){return[r.x,r.y]},Point:function(r){var t=Ps.coordinate.apply(this,[r.getCoordinate()]);return{type:"Point",coordinates:t}},MultiPoint:function(r){for(var t=this,e=[],n=0;n<r._geometries.length;++n){var i=r._geometries[n],s=Ps.Point.apply(t,[i]);e.push(s.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(r){for(var t=this,e=[],n=r.getCoordinates(),i=0;i<n.length;++i){var s=n[i];e.push(Ps.coordinate.apply(t,[s]))}return{type:"LineString",coordinates:e}},MultiLineString:function(r){for(var t=this,e=[],n=0;n<r._geometries.length;++n){var i=r._geometries[n],s=Ps.LineString.apply(t,[i]);e.push(s.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(r){var t=this,e=[],n=Ps.LineString.apply(this,[r._shell]);e.push(n.coordinates);for(var i=0;i<r._holes.length;++i){var s=r._holes[i],o=Ps.LineString.apply(t,[s]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(r){for(var t=this,e=[],n=0;n<r._geometries.length;++n){var i=r._geometries[n],s=Ps.Polygon.apply(t,[i]);e.push(s.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(r){for(var t=this,e=[],n=0;n<r._geometries.length;++n){var i=r._geometries[n],s=i.getGeometryType();e.push(Ps[s].apply(t,[i]))}return{type:"GeometryCollection",geometries:e}}},Kg=function(t){this.geometryFactory=t||new Ut,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new ef(this.geometryFactory)};Kg.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===ne.FIXED&&this.reducePrecision(e),e},Kg.prototype.reducePrecision=function(t){var e=this,n,i;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(n=0,i=t.points.length;n<i;n++)e.precisionModel.makePrecise(t.points[n]);else if(t.geometries)for(n=0,i=t.geometries.length;n<i;n++)e.reducePrecision(t.geometries[n])};var V1=function(){this.parser=new ef(this.geometryFactory)};V1.prototype.write=function(t){return this.parser.write(t)};var Z=function(){},nf={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};Z.prototype.interfaces_=function(){return[]},Z.prototype.getClass=function(){return Z},Z.opposite=function(t){return t===Z.LEFT?Z.RIGHT:t===Z.RIGHT?Z.LEFT:t},nf.ON.get=function(){return 0},nf.LEFT.get=function(){return 1},nf.RIGHT.get=function(){return 2},Object.defineProperties(Z,nf);function rf(r){this.message=r||""}rf.prototype=new Error,rf.prototype.name="EmptyStackException";function pi(){this.array_=[]}pi.prototype=new Ur,pi.prototype.add=function(r){return this.array_.push(r),!0},pi.prototype.get=function(r){if(r<0||r>=this.size())throw new Error;return this.array_[r]},pi.prototype.push=function(r){return this.array_.push(r),r},pi.prototype.pop=function(r){if(this.array_.length===0)throw new rf;return this.array_.pop()},pi.prototype.peek=function(){if(this.array_.length===0)throw new rf;return this.array_[this.array_.length-1]},pi.prototype.empty=function(){return this.array_.length===0},pi.prototype.isEmpty=function(){return this.empty()},pi.prototype.search=function(r){return this.array_.indexOf(r)},pi.prototype.size=function(){return this.array_.length},pi.prototype.toArray=function(){for(var r=this,t=[],e=0,n=this.array_.length;e<n;e++)t.push(r.array_[e]);return t};var gi=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};gi.prototype.getCoordinate=function(){return this._minCoord},gi.prototype.getRightmostSide=function(t,e){var n=this.getRightmostSideOfSegment(t,e);return n<0&&(n=this.getRightmostSideOfSegment(t,e-1)),n<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),n},gi.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();Ft.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],n=t[this._minIndex+1],i=rt.computeOrientation(this._minCoord,n,e),s=!1;(e.y<this._minCoord.y&&n.y<this._minCoord.y&&i===rt.COUNTERCLOCKWISE||e.y>this._minCoord.y&&n.y>this._minCoord.y&&i===rt.CLOCKWISE)&&(s=!0),s&&(this._minIndex=this._minIndex-1)},gi.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge(),i=n.getCoordinates();if(e<0||e+1>=i.length||i[e].y===i[e+1].y)return-1;var s=Z.LEFT;return i[e].y<i[e+1].y&&(s=Z.RIGHT),s},gi.prototype.getEdge=function(){return this._orientedDe},gi.prototype.checkForRightmostCoordinate=function(t){for(var e=this,n=t.getEdge().getCoordinates(),i=0;i<n.length-1;i++)(e._minCoord===null||n[i].x>e._minCoord.x)&&(e._minDe=t,e._minIndex=i,e._minCoord=n[i])},gi.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode(),e=t.getEdges();this._minDe=e.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},gi.prototype.findEdge=function(t){for(var e=this,n=t.iterator();n.hasNext();){var i=n.next();i.isForward()&&e.checkForRightmostCoordinate(i)}Ft.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var s=this.getRightmostSide(this._minDe,this._minIndex);s===Z.LEFT&&(this._orientedDe=this._minDe.getSym())},gi.prototype.interfaces_=function(){return[]},gi.prototype.getClass=function(){return gi};var xs=function(r){function t(e,n){r.call(this,t.msgWithCoord(e,n)),this.pt=n?new F(n):null,this.name="TopologyException"}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.getCoordinate=function(){return this.pt},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.msgWithCoord=function(n,i){return i?n:n+" [ "+i+" ]"},t}(ws),sf=function(){this.array_=[]};sf.prototype.addLast=function(t){this.array_.push(t)},sf.prototype.removeFirst=function(){return this.array_.shift()},sf.prototype.isEmpty=function(){return this.array_.length===0};var bn=function(){this._finder=null,this._dirEdgeList=new tt,this._nodes=new tt,this._rightMostCoord=null,this._env=null,this._finder=new gi};bn.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.setVisited(!1)}},bn.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},bn.prototype.computeNodeDepth=function(t){for(var e=this,n=null,i=t.getEdges().iterator();i.hasNext();){var s=i.next();if(s.isVisited()||s.getSym().isVisited()){n=s;break}}if(n===null)throw new xs("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(n);for(var o=t.getEdges().iterator();o.hasNext();){var a=o.next();a.setVisited(!0),e.copySymDepths(a)}},bn.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(Z.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},bn.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},bn.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(Z.RIGHT)>=1&&e.getDepth(Z.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},bn.prototype.computeDepths=function(t){var e=this,n=new Hg,i=new sf,s=t.getNode();for(i.addLast(s),n.add(s),t.setVisited(!0);!i.isEmpty();){var o=i.removeFirst();n.add(o),e.computeNodeDepth(o);for(var a=o.getEdges().iterator();a.hasNext();){var u=a.next(),l=u.getSym();if(!l.isVisited()){var h=l.getNode();n.contains(h)||(i.addLast(h),n.add(h))}}}},bn.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},bn.prototype.getEnvelope=function(){if(this._env===null){for(var t=new gt,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next(),i=n.getEdge().getCoordinates(),s=0;s<i.length-1;s++)t.expandToInclude(i[s]);this._env=t}return this._env},bn.prototype.addReachable=function(t){var e=this,n=new pi;for(n.add(t);!n.empty();){var i=n.pop();e.add(i,n)}},bn.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(Z.LEFT,t.getDepth(Z.RIGHT)),e.setDepth(Z.RIGHT,t.getDepth(Z.LEFT))},bn.prototype.add=function(t,e){var n=this;t.setVisited(!0),this._nodes.add(t);for(var i=t.getEdges().iterator();i.hasNext();){var s=i.next();n._dirEdgeList.add(s);var o=s.getSym(),a=o.getNode();a.isVisited()||e.push(a)}},bn.prototype.getNodes=function(){return this._nodes},bn.prototype.getDirectedEdges=function(){return this._dirEdgeList},bn.prototype.interfaces_=function(){return[Pr]},bn.prototype.getClass=function(){return bn};var pe=function r(){var t=this;if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var n=arguments[0];this.init(1),this.location[Z.ON]=n}else if(arguments[0]instanceof r){var i=arguments[0];if(this.init(i.location.length),i!==null)for(var s=0;s<this.location.length;s++)t.location[s]=i.location[s]}}else if(arguments.length===3){var o=arguments[0],a=arguments[1],u=arguments[2];this.init(3),this.location[Z.ON]=o,this.location[Z.LEFT]=a,this.location[Z.RIGHT]=u}};pe.prototype.setAllLocations=function(t){for(var e=this,n=0;n<this.location.length;n++)e.location[n]=t},pe.prototype.isNull=function(){for(var t=this,e=0;e<this.location.length;e++)if(t.location[e]!==V.NONE)return!1;return!0},pe.prototype.setAllLocationsIfNull=function(t){for(var e=this,n=0;n<this.location.length;n++)e.location[n]===V.NONE&&(e.location[n]=t)},pe.prototype.isLine=function(){return this.location.length===1},pe.prototype.merge=function(t){var e=this;if(t.location.length>this.location.length){var n=new Array(3).fill(null);n[Z.ON]=this.location[Z.ON],n[Z.LEFT]=V.NONE,n[Z.RIGHT]=V.NONE,this.location=n}for(var i=0;i<this.location.length;i++)e.location[i]===V.NONE&&i<t.location.length&&(e.location[i]=t.location[i])},pe.prototype.getLocations=function(){return this.location},pe.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[Z.LEFT];this.location[Z.LEFT]=this.location[Z.RIGHT],this.location[Z.RIGHT]=t},pe.prototype.toString=function(){var t=new oi;return this.location.length>1&&t.append(V.toLocationSymbol(this.location[Z.LEFT])),t.append(V.toLocationSymbol(this.location[Z.ON])),this.location.length>1&&t.append(V.toLocationSymbol(this.location[Z.RIGHT])),t.toString()},pe.prototype.setLocations=function(t,e,n){this.location[Z.ON]=t,this.location[Z.LEFT]=e,this.location[Z.RIGHT]=n},pe.prototype.get=function(t){return t<this.location.length?this.location[t]:V.NONE},pe.prototype.isArea=function(){return this.location.length>1},pe.prototype.isAnyNull=function(){for(var t=this,e=0;e<this.location.length;e++)if(t.location[e]===V.NONE)return!0;return!1},pe.prototype.setLocation=function(){if(arguments.length===1){var t=arguments[0];this.setLocation(Z.ON,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.location[e]=n}},pe.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(V.NONE)},pe.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},pe.prototype.allPositionsEqual=function(t){for(var e=this,n=0;n<this.location.length;n++)if(e.location[n]!==t)return!1;return!0},pe.prototype.interfaces_=function(){return[]},pe.prototype.getClass=function(){return pe};var oe=function r(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var t=arguments[0];this.elt[0]=new pe(t),this.elt[1]=new pe(t)}else if(arguments[0]instanceof r){var e=arguments[0];this.elt[0]=new pe(e.elt[0]),this.elt[1]=new pe(e.elt[1])}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[0]=new pe(V.NONE),this.elt[1]=new pe(V.NONE),this.elt[n].setLocation(i)}else if(arguments.length===3){var s=arguments[0],o=arguments[1],a=arguments[2];this.elt[0]=new pe(s,o,a),this.elt[1]=new pe(s,o,a)}else if(arguments.length===4){var u=arguments[0],l=arguments[1],h=arguments[2],c=arguments[3];this.elt[0]=new pe(V.NONE,V.NONE,V.NONE),this.elt[1]=new pe(V.NONE,V.NONE,V.NONE),this.elt[u].setLocations(l,h,c)}};oe.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},oe.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},oe.prototype.isNull=function(t){return this.elt[t].isNull()},oe.prototype.setAllLocationsIfNull=function(){if(arguments.length===1){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.elt[e].setAllLocationsIfNull(n)}},oe.prototype.isLine=function(t){return this.elt[t].isLine()},oe.prototype.merge=function(t){for(var e=this,n=0;n<2;n++)e.elt[n]===null&&t.elt[n]!==null?e.elt[n]=new pe(t.elt[n]):e.elt[n].merge(t.elt[n])},oe.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},oe.prototype.getLocation=function(){if(arguments.length===1){var t=arguments[0];return this.elt[t].get(Z.ON)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return this.elt[e].get(n)}},oe.prototype.toString=function(){var t=new oi;return this.elt[0]!==null&&(t.append("A:"),t.append(this.elt[0].toString())),this.elt[1]!==null&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},oe.prototype.isArea=function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var t=arguments[0];return this.elt[t].isArea()}},oe.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},oe.prototype.setLocation=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(Z.ON,e)}else if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];this.elt[n].setLocation(i,s)}},oe.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},oe.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},oe.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new pe(this.elt[t].location[0]))},oe.prototype.interfaces_=function(){return[]},oe.prototype.getClass=function(){return oe},oe.toLineLabel=function(t){for(var e=new oe(V.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e};var Ge=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new tt,this._pts=new tt,this._label=new oe(V.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new tt,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};Ge.prototype.computeRing=function(){var t=this;if(this._ring!==null)return null;for(var e=new Array(this._pts.size()).fill(null),n=0;n<this._pts.size();n++)e[n]=t._pts.get(n);this._ring=this._geometryFactory.createLinearRing(e),this._isHole=rt.isCCW(this._ring.getCoordinates())},Ge.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},Ge.prototype.computePoints=function(t){var e=this;this._startDe=t;var n=t,i=!0;do{if(n===null)throw new xs("Found null DirectedEdge");if(n.getEdgeRing()===e)throw new xs("Directed Edge visited twice during ring-building at "+n.getCoordinate());e._edges.add(n);var s=n.getLabel();Ft.isTrue(s.isArea()),e.mergeLabel(s),e.addPoints(n.getEdge(),n.isForward(),i),i=!1,e.setEdgeRing(n,e),n=e.getNext(n)}while(n!==this._startDe)},Ge.prototype.getLinearRing=function(){return this._ring},Ge.prototype.getCoordinate=function(t){return this._pts.get(t)},Ge.prototype.computeMaxNodeDegree=function(){var t=this;this._maxNodeDegree=0;var e=this._startDe;do{var n=e.getNode(),i=n.getEdges().getOutgoingDegree(t);i>t._maxNodeDegree&&(t._maxNodeDegree=i),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},Ge.prototype.addPoints=function(t,e,n){var i=this,s=t.getCoordinates();if(e){var o=1;n&&(o=0);for(var a=o;a<s.length;a++)i._pts.add(s[a])}else{var u=s.length-2;n&&(u=s.length-1);for(var l=u;l>=0;l--)i._pts.add(s[l])}},Ge.prototype.isHole=function(){return this._isHole},Ge.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)},Ge.prototype.containsPoint=function(t){var e=this.getLinearRing(),n=e.getEnvelopeInternal();if(!n.contains(t)||!rt.isPointInRing(t,e.getCoordinates()))return!1;for(var i=this._holes.iterator();i.hasNext();){var s=i.next();if(s.containsPoint(t))return!1}return!0},Ge.prototype.addHole=function(t){this._holes.add(t)},Ge.prototype.isShell=function(){return this._shell===null},Ge.prototype.getLabel=function(){return this._label},Ge.prototype.getEdges=function(){return this._edges},Ge.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Ge.prototype.getShell=function(){return this._shell},Ge.prototype.mergeLabel=function(){if(arguments.length===1){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],i=e.getLocation(n,Z.RIGHT);if(i===V.NONE)return null;if(this._label.getLocation(n)===V.NONE)return this._label.setLocation(n,i),null}},Ge.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)},Ge.prototype.toPolygon=function(t){for(var e=this,n=new Array(this._holes.size()).fill(null),i=0;i<this._holes.size();i++)n[i]=e._holes.get(i).getLinearRing();var s=t.createPolygon(this.getLinearRing(),n);return s},Ge.prototype.interfaces_=function(){return[]},Ge.prototype.getClass=function(){return Ge};var GN=function(r){function t(){var e=arguments[0],n=arguments[1];r.call(this,e,n)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.setEdgeRing=function(n,i){n.setMinEdgeRing(i)},t.prototype.getNext=function(n){return n.getNextMin()},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ge),jN=function(r){function t(){var e=arguments[0],n=arguments[1];r.call(this,e,n)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.buildMinimalRings=function(){var n=this,i=new tt,s=this._startDe;do{if(s.getMinEdgeRing()===null){var o=new GN(s,n._geometryFactory);i.add(o)}s=s.getNext()}while(s!==this._startDe);return i},t.prototype.setEdgeRing=function(n,i){n.setEdgeRing(i)},t.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var n=this,i=this._startDe;do{var s=i.getNode();s.getEdges().linkMinimalDirectedEdges(n),i=i.getNext()}while(i!==this._startDe)},t.prototype.getNext=function(n){return n.getNext()},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ge),cr=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this._label=t}}};cr.prototype.setVisited=function(t){this._isVisited=t},cr.prototype.setInResult=function(t){this._isInResult=t},cr.prototype.isCovered=function(){return this._isCovered},cr.prototype.isCoveredSet=function(){return this._isCoveredSet},cr.prototype.setLabel=function(t){this._label=t},cr.prototype.getLabel=function(){return this._label},cr.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},cr.prototype.updateIM=function(t){Ft.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},cr.prototype.isInResult=function(){return this._isInResult},cr.prototype.isVisited=function(){return this._isVisited},cr.prototype.interfaces_=function(){return[]},cr.prototype.getClass=function(){return cr};var of=function(r){function t(){r.call(this),this._coord=null,this._edges=null;var e=arguments[0],n=arguments[1];this._coord=e,this._edges=n,this._label=new oe(0,V.NONE)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();){var i=n.next();if(i.getEdge().isInResult())return!0}return!1},t.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},t.prototype.getCoordinate=function(){return this._coord},t.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},t.prototype.computeIM=function(n){},t.prototype.computeMergedLocation=function(n,i){var s=V.NONE;if(s=this._label.getLocation(i),!n.isNull(i)){var o=n.getLocation(i);s!==V.BOUNDARY&&(s=o)}return s},t.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this._label===null?this._label=new oe(n,i):this._label.setLocation(n,i)}else return r.prototype.setLabel.apply(this,arguments)},t.prototype.getEdges=function(){return this._edges},t.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof t){var i=arguments[0];this.mergeLabel(i._label)}else if(arguments[0]instanceof oe)for(var s=arguments[0],o=0;o<2;o++){var a=n.computeMergedLocation(s,o),u=n._label.getLocation(o);u===V.NONE&&n._label.setLocation(o,a)}},t.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},t.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var i=V.NONE;this._label!==null&&(i=this._label.getLocation(n));var s=null;switch(i){case V.BOUNDARY:s=V.INTERIOR;break;case V.INTERIOR:s=V.BOUNDARY;break;default:s=V.BOUNDARY;break}this._label.setLocation(n,s)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(cr),mi=function(){this.nodeMap=new mn,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};mi.prototype.find=function(t){return this.nodeMap.get(t)},mi.prototype.addNode=function(){if(arguments[0]instanceof F){var t=arguments[0],e=this.nodeMap.get(t);return e===null&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}else if(arguments[0]instanceof of){var n=arguments[0],i=this.nodeMap.get(n.getCoordinate());return i===null?(this.nodeMap.put(n.getCoordinate(),n),n):(i.mergeLabel(n),i)}},mi.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}},mi.prototype.iterator=function(){return this.nodeMap.values().iterator()},mi.prototype.values=function(){return this.nodeMap.values()},mi.prototype.getBoundaryNodes=function(t){for(var e=new tt,n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().getLocation(t)===V.BOUNDARY&&e.add(i)}return e},mi.prototype.add=function(t){var e=t.getCoordinate(),n=this.addNode(e);n.add(t)},mi.prototype.interfaces_=function(){return[]},mi.prototype.getClass=function(){return mi};var ue=function(){},cc={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};ue.prototype.interfaces_=function(){return[]},ue.prototype.getClass=function(){return ue},ue.isNorthern=function(t){return t===ue.NE||t===ue.NW},ue.isOpposite=function(t,e){if(t===e)return!1;var n=(t-e+4)%4;return n===2},ue.commonHalfPlane=function(t,e){if(t===e)return t;var n=(t-e+4)%4;if(n===2)return-1;var i=t<e?t:e,s=t>e?t:e;return i===0&&s===3?3:i},ue.isInHalfPlane=function(t,e){return e===ue.SE?t===ue.SE||t===ue.SW:t===e||t===e+1},ue.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new Ce("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?ue.NE:ue.SE:e>=0?ue.NW:ue.SW}else if(arguments[0]instanceof F&&arguments[1]instanceof F){var n=arguments[0],i=arguments[1];if(i.x===n.x&&i.y===n.y)throw new Ce("Cannot compute the quadrant for two identical points "+n);return i.x>=n.x?i.y>=n.y?ue.NE:ue.SE:i.y>=n.y?ue.NW:ue.SW}},cc.NE.get=function(){return 0},cc.NW.get=function(){return 1},cc.SW.get=function(){return 2},cc.SE.get=function(){return 3},Object.defineProperties(ue,cc);var vn=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],n=arguments[1],i=arguments[2],s=null;this._edge=e,this.init(n,i),this._label=s}else if(arguments.length===4){var o=arguments[0],a=arguments[1],u=arguments[2],l=arguments[3];this._edge=o,this.init(a,u),this._label=l}};vn.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:rt.computeOrientation(t._p0,t._p1,this._p1)},vn.prototype.getDy=function(){return this._dy},vn.prototype.getCoordinate=function(){return this._p0},vn.prototype.setNode=function(t){this._node=t},vn.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),i=n.lastIndexOf("."),s=n.substring(i+1);t.print(" "+s+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},vn.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},vn.prototype.getDirectedCoordinate=function(){return this._p1},vn.prototype.getDx=function(){return this._dx},vn.prototype.getLabel=function(){return this._label},vn.prototype.getEdge=function(){return this._edge},vn.prototype.getQuadrant=function(){return this._quadrant},vn.prototype.getNode=function(){return this._node},vn.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),n=e.lastIndexOf("."),i=e.substring(n+1);return" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},vn.prototype.computeLabel=function(t){},vn.prototype.init=function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=ue.quadrant(this._dx,this._dy),Ft.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},vn.prototype.interfaces_=function(){return[Pr]},vn.prototype.getClass=function(){return vn};var Qg=function(r){function t(){var e=arguments[0],n=arguments[1];if(r.call(this,e),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=n,n)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var i=e.getNumPoints()-1;this.init(e.getCoordinate(i),e.getCoordinate(i-1))}this.computeDirectedLabel()}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.getNextMin=function(){return this._nextMin},t.prototype.getDepth=function(n){return this._depth[n]},t.prototype.setVisited=function(n){this._isVisited=n},t.prototype.computeDirectedLabel=function(){this._label=new oe(this._edge.getLabel()),this._isForward||this._label.flip()},t.prototype.getNext=function(){return this._next},t.prototype.setDepth=function(n,i){if(this._depth[n]!==-999&&this._depth[n]!==i)throw new xs("assigned depths do not match",this.getCoordinate());this._depth[n]=i},t.prototype.isInteriorAreaEdge=function(){for(var n=this,i=!0,s=0;s<2;s++)n._label.isArea(s)&&n._label.getLocation(s,Z.LEFT)===V.INTERIOR&&n._label.getLocation(s,Z.RIGHT)===V.INTERIOR||(i=!1);return i},t.prototype.setNextMin=function(n){this._nextMin=n},t.prototype.print=function(n){r.prototype.print.call(this,n),n.print(" "+this._depth[Z.LEFT]+"/"+this._depth[Z.RIGHT]),n.print(" ("+this.getDepthDelta()+")"),this._isInResult&&n.print(" inResult")},t.prototype.setMinEdgeRing=function(n){this._minEdgeRing=n},t.prototype.isLineEdge=function(){var n=this._label.isLine(0)||this._label.isLine(1),i=!this._label.isArea(0)||this._label.allPositionsEqual(0,V.EXTERIOR),s=!this._label.isArea(1)||this._label.allPositionsEqual(1,V.EXTERIOR);return n&&i&&s},t.prototype.setEdgeRing=function(n){this._edgeRing=n},t.prototype.getMinEdgeRing=function(){return this._minEdgeRing},t.prototype.getDepthDelta=function(){var n=this._edge.getDepthDelta();return this._isForward||(n=-n),n},t.prototype.setInResult=function(n){this._isInResult=n},t.prototype.getSym=function(){return this._sym},t.prototype.isForward=function(){return this._isForward},t.prototype.getEdge=function(){return this._edge},t.prototype.printEdge=function(n){this.print(n),n.print(" "),this._isForward?this._edge.print(n):this._edge.printReverse(n)},t.prototype.setSym=function(n){this._sym=n},t.prototype.setVisitedEdge=function(n){this.setVisited(n),this._sym.setVisited(n)},t.prototype.setEdgeDepths=function(n,i){var s=this.getEdge().getDepthDelta();this._isForward||(s=-s);var o=1;n===Z.LEFT&&(o=-1);var a=Z.opposite(n),u=s*o,l=i+u;this.setDepth(n,i),this.setDepth(a,l)},t.prototype.getEdgeRing=function(){return this._edgeRing},t.prototype.isInResult=function(){return this._isInResult},t.prototype.setNext=function(n){this._next=n},t.prototype.isVisited=function(){return this._isVisited},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.depthFactor=function(n,i){return n===V.EXTERIOR&&i===V.INTERIOR?1:n===V.INTERIOR&&i===V.EXTERIOR?-1:0},t}(vn),ol=function(){};ol.prototype.createNode=function(t){return new of(t,null)},ol.prototype.interfaces_=function(){return[]},ol.prototype.getClass=function(){return ol};var xe=function(){if(this._edges=new tt,this._nodes=null,this._edgeEndList=new tt,arguments.length===0)this._nodes=new mi(new ol);else if(arguments.length===1){var t=arguments[0];this._nodes=new mi(t)}};xe.prototype.printEdges=function(t){var e=this;t.println("Edges:");for(var n=0;n<this._edges.size();n++){t.println("edge "+n+":");var i=e._edges.get(n);i.print(t),i.eiList.print(t)}},xe.prototype.find=function(t){return this._nodes.find(t)},xe.prototype.addNode=function(){if(arguments[0]instanceof of){var t=arguments[0];return this._nodes.addNode(t)}else if(arguments[0]instanceof F){var e=arguments[0];return this._nodes.addNode(e)}},xe.prototype.getNodeIterator=function(){return this._nodes.iterator()},xe.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){var e=t.next();e.getEdges().linkResultDirectedEdges()}},xe.prototype.debugPrintln=function(t){sn.out.println(t)},xe.prototype.isBoundaryNode=function(t,e){var n=this._nodes.find(e);if(n===null)return!1;var i=n.getLabel();return i!==null&&i.getLocation(t)===V.BOUNDARY},xe.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){var e=t.next();e.getEdges().linkAllDirectedEdges()}},xe.prototype.matchInSameDirection=function(t,e,n,i){return t.equals(n)?rt.computeOrientation(t,e,i)===rt.COLLINEAR&&ue.quadrant(t,e)===ue.quadrant(n,i):!1},xe.prototype.getEdgeEnds=function(){return this._edgeEndList},xe.prototype.debugPrint=function(t){sn.out.print(t)},xe.prototype.getEdgeIterator=function(){return this._edges.iterator()},xe.prototype.findEdgeInSameDirection=function(t,e){for(var n=this,i=0;i<this._edges.size();i++){var s=n._edges.get(i),o=s.getCoordinates();if(n.matchInSameDirection(t,e,o[0],o[1])||n.matchInSameDirection(t,e,o[o.length-1],o[o.length-2]))return s}return null},xe.prototype.insertEdge=function(t){this._edges.add(t)},xe.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null},xe.prototype.addEdges=function(t){for(var e=this,n=t.iterator();n.hasNext();){var i=n.next();e._edges.add(i);var s=new Qg(i,!0),o=new Qg(i,!1);s.setSym(o),o.setSym(s),e.add(s),e.add(o)}},xe.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},xe.prototype.getNodes=function(){return this._nodes.values()},xe.prototype.findEdge=function(t,e){for(var n=this,i=0;i<this._edges.size();i++){var s=n._edges.get(i),o=s.getCoordinates();if(t.equals(o[0])&&e.equals(o[1]))return s}return null},xe.prototype.interfaces_=function(){return[]},xe.prototype.getClass=function(){return xe},xe.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.getEdges().linkResultDirectedEdges()}};var Yn=function(){this._geometryFactory=null,this._shellList=new tt;var t=arguments[0];this._geometryFactory=t};Yn.prototype.sortShellsAndHoles=function(t,e,n){for(var i=t.iterator();i.hasNext();){var s=i.next();s.isHole()?n.add(s):e.add(s)}},Yn.prototype.computePolygons=function(t){for(var e=this,n=new tt,i=t.iterator();i.hasNext();){var s=i.next(),o=s.toPolygon(e._geometryFactory);n.add(o)}return n},Yn.prototype.placeFreeHoles=function(t,e){for(var n=this,i=e.iterator();i.hasNext();){var s=i.next();if(s.getShell()===null){var o=n.findEdgeRingContaining(s,t);if(o===null)throw new xs("unable to assign hole to a shell",s.getCoordinate(0));s.setShell(o)}}},Yn.prototype.buildMinimalEdgeRings=function(t,e,n){for(var i=this,s=new tt,o=t.iterator();o.hasNext();){var a=o.next();if(a.getMaxNodeDegree()>2){a.linkDirectedEdgesForMinimalEdgeRings();var u=a.buildMinimalRings(),l=i.findShell(u);l!==null?(i.placePolygonHoles(l,u),e.add(l)):n.addAll(u)}else s.add(a)}return s},Yn.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){var n=e.next();if(n.containsPoint(t))return!0}return!1},Yn.prototype.buildMaximalEdgeRings=function(t){for(var e=this,n=new tt,i=t.iterator();i.hasNext();){var s=i.next();if(s.isInResult()&&s.getLabel().isArea()&&s.getEdgeRing()===null){var o=new jN(s,e._geometryFactory);n.add(o),o.setInResult()}}return n},Yn.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next();i.isHole()&&i.setShell(t)}},Yn.prototype.getPolygons=function(){var t=this.computePolygons(this._shellList);return t},Yn.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),i=n.getEnvelopeInternal(),s=n.getCoordinateN(0),o=null,a=null,u=e.iterator();u.hasNext();){var l=u.next(),h=l.getLinearRing(),c=h.getEnvelopeInternal();o!==null&&(a=o.getLinearRing().getEnvelopeInternal());var d=!1;c.contains(i)&&rt.isPointInRing(s,h.getCoordinates())&&(d=!0),d&&(o===null||a.contains(c))&&(o=l)}return o},Yn.prototype.findShell=function(t){for(var e=0,n=null,i=t.iterator();i.hasNext();){var s=i.next();s.isHole()||(n=s,e++)}return Ft.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n},Yn.prototype.add=function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var e=arguments[0],n=arguments[1];xe.linkResultDirectedEdges(n);var i=this.buildMaximalEdgeRings(e),s=new tt,o=this.buildMinimalEdgeRings(i,this._shellList,s);this.sortShellsAndHoles(o,this._shellList,s),this.placeFreeHoles(this._shellList,s)}},Yn.prototype.interfaces_=function(){return[]},Yn.prototype.getClass=function(){return Yn};var al=function(){};al.prototype.getBounds=function(){},al.prototype.interfaces_=function(){return[]},al.prototype.getClass=function(){return al};var Hr=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};Hr.prototype.getItem=function(){return this._item},Hr.prototype.getBounds=function(){return this._bounds},Hr.prototype.interfaces_=function(){return[al,xr]},Hr.prototype.getClass=function(){return Hr};var Is=function(){this._size=null,this._items=null,this._size=0,this._items=new tt,this._items.add(null)};Is.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t},Is.prototype.size=function(){return this._size},Is.prototype.reorder=function(t){for(var e=this,n=null,i=this._items.get(t);t*2<=this._size&&(n=t*2,n!==e._size&&e._items.get(n+1).compareTo(e._items.get(n))<0&&n++,e._items.get(n).compareTo(i)<0);t=n)e._items.set(t,e._items.get(n));this._items.set(t,i)},Is.prototype.clear=function(){this._size=0,this._items.clear()},Is.prototype.isEmpty=function(){return this._size===0},Is.prototype.add=function(t){var e=this;this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)e._items.set(n,e._items.get(Math.trunc(n/2)));this._items.set(n,t)},Is.prototype.interfaces_=function(){return[]},Is.prototype.getClass=function(){return Is};var oo=function(){};oo.prototype.visitItem=function(t){},oo.prototype.interfaces_=function(){return[]},oo.prototype.getClass=function(){return oo};var ka=function(){};ka.prototype.insert=function(t,e){},ka.prototype.remove=function(t,e){},ka.prototype.query=function(){},ka.prototype.interfaces_=function(){return[]},ka.prototype.getClass=function(){return ka};var We=function(){if(this._childBoundables=new tt,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this._level=t}}},B1={serialVersionUID:{configurable:!0}};We.prototype.getLevel=function(){return this._level},We.prototype.size=function(){return this._childBoundables.size()},We.prototype.getChildBoundables=function(){return this._childBoundables},We.prototype.addChildBoundable=function(t){Ft.isTrue(this._bounds===null),this._childBoundables.add(t)},We.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},We.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},We.prototype.interfaces_=function(){return[al,xr]},We.prototype.getClass=function(){return We},B1.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(We,B1);var $r=function(){};$r.reverseOrder=function(){return{compare:function(e,n){return n.compareTo(e)}}},$r.min=function(t){return $r.sort(t),t.get(0)},$r.sort=function(t,e){var n=t.toArray();e?Wo.sort(n,e):Wo.sort(n);for(var i=t.iterator(),s=0,o=n.length;s<o;s++)i.next(),i.set(n[s])},$r.singletonList=function(t){var e=new tt;return e.add(t),e};var je=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=n,this._distance=this.distance()};je.prototype.expandToQueue=function(t,e){var n=je.isComposite(this._boundable1),i=je.isComposite(this._boundable2);if(n&&i)return je.area(this._boundable1)>je.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(i)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new Ce("neither boundable is composite")},je.prototype.isLeaves=function(){return!(je.isComposite(this._boundable1)||je.isComposite(this._boundable2))},je.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},je.prototype.expand=function(t,e,n,i){for(var s=this,o=t.getChildBoundables(),a=o.iterator();a.hasNext();){var u=a.next(),l=new je(u,e,s._itemDistance);l.getDistance()<i&&n.add(l)}},je.prototype.getBoundable=function(t){return t===0?this._boundable1:this._boundable2},je.prototype.getDistance=function(){return this._distance},je.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},je.prototype.interfaces_=function(){return[Pr]},je.prototype.getClass=function(){return je},je.area=function(t){return t.getBounds().getArea()},je.isComposite=function(t){return t instanceof We};var Ke=function r(){if(this._root=null,this._built=!1,this._itemBoundables=new tt,this._nodeCapacity=null,arguments.length===0){var t=r.DEFAULT_NODE_CAPACITY;this._nodeCapacity=t}else if(arguments.length===1){var e=arguments[0];Ft.isTrue(e>1,"Node capacity must be greater than 1"),this._nodeCapacity=e}},af={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Ke.prototype.getNodeCapacity=function(){return this._nodeCapacity},Ke.prototype.lastNode=function(t){return t.get(t.size()-1)},Ke.prototype.size=function(){var t=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var e=arguments[0],n=0,i=e.getChildBoundables().iterator();i.hasNext();){var s=i.next();s instanceof We?n+=t.size(s):s instanceof Hr&&(n+=1)}return n}},Ke.prototype.removeItem=function(t,e){for(var n=null,i=t.getChildBoundables().iterator();i.hasNext();){var s=i.next();s instanceof Hr&&s.getItem()===e&&(n=s)}return n!==null?(t.getChildBoundables().remove(n),!0):!1},Ke.prototype.itemsTree=function(){var t=this;if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new tt:e}else if(arguments.length===1){for(var n=arguments[0],i=new tt,s=n.getChildBoundables().iterator();s.hasNext();){var o=s.next();if(o instanceof We){var a=t.itemsTree(o);a!==null&&i.add(a)}else o instanceof Hr?i.add(o.getItem()):Ft.shouldNeverReachHere()}return i.size()<=0?null:i}},Ke.prototype.insert=function(t,e){Ft.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Hr(t,e))},Ke.prototype.boundablesAtLevel=function(){var t=this;if(arguments.length===1){var e=arguments[0],n=new tt;return this.boundablesAtLevel(e,this._root,n),n}else if(arguments.length===3){var i=arguments[0],s=arguments[1],o=arguments[2];if(Ft.isTrue(i>-2),s.getLevel()===i)return o.add(s),null;for(var a=s.getChildBoundables().iterator();a.hasNext();){var u=a.next();u instanceof We?t.boundablesAtLevel(i,u,o):(Ft.isTrue(u instanceof Hr),i===-1&&o.add(u))}return null}},Ke.prototype.query=function(){var t=this;if(arguments.length===1){var e=arguments[0];this.build();var n=new tt;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,n),n}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),i)&&this.query(i,this._root,s)}else if(arguments.length===3){if(Pt(arguments[2],oo)&&arguments[0]instanceof Object&&arguments[1]instanceof We)for(var o=arguments[0],a=arguments[1],u=arguments[2],l=a.getChildBoundables(),h=0;h<l.size();h++){var c=l.get(h);t.getIntersectsOp().intersects(c.getBounds(),o)&&(c instanceof We?t.query(o,c,u):c instanceof Hr?u.visitItem(c.getItem()):Ft.shouldNeverReachHere())}else if(Pt(arguments[2],Ur)&&arguments[0]instanceof Object&&arguments[1]instanceof We)for(var d=arguments[0],p=arguments[1],g=arguments[2],y=p.getChildBoundables(),w=0;w<y.size();w++){var b=y.get(w);t.getIntersectsOp().intersects(b.getBounds(),d)&&(b instanceof We?t.query(d,b,g):b instanceof Hr?g.add(b.getItem()):Ft.shouldNeverReachHere())}}},Ke.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},Ke.prototype.getRoot=function(){return this.build(),this._root},Ke.prototype.remove=function(){var t=this;if(arguments.length===2){var e=arguments[0],n=arguments[1];return this.build(),this.getIntersectsOp().intersects(this._root.getBounds(),e)?this.remove(e,this._root,n):!1}else if(arguments.length===3){var i=arguments[0],s=arguments[1],o=arguments[2],a=this.removeItem(s,o);if(a)return!0;for(var u=null,l=s.getChildBoundables().iterator();l.hasNext();){var h=l.next();if(t.getIntersectsOp().intersects(h.getBounds(),i)&&h instanceof We&&(a=t.remove(i,h,o),a)){u=h;break}}return u!==null&&u.getChildBoundables().isEmpty()&&s.getChildBoundables().remove(u),a}},Ke.prototype.createHigherLevels=function(t,e){Ft.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return n.size()===1?n.get(0):this.createHigherLevels(n,e+1)},Ke.prototype.depth=function(){var t=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var e=arguments[0],n=0,i=e.getChildBoundables().iterator();i.hasNext();){var s=i.next();if(s instanceof We){var o=t.depth(s);o>n&&(n=o)}}return n+1}},Ke.prototype.createParentBoundables=function(t,e){var n=this;Ft.isTrue(!t.isEmpty());var i=new tt;i.add(this.createNode(e));var s=new tt(t);$r.sort(s,this.getComparator());for(var o=s.iterator();o.hasNext();){var a=o.next();n.lastNode(i).getChildBoundables().size()===n.getNodeCapacity()&&i.add(n.createNode(e)),n.lastNode(i).addChildBoundable(a)}return i},Ke.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Ke.prototype.interfaces_=function(){return[xr]},Ke.prototype.getClass=function(){return Ke},Ke.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},af.IntersectsOp.get=function(){return VN},af.serialVersionUID.get=function(){return-3886435814360241e3},af.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Ke,af);var VN=function(){},ul=function(){};ul.prototype.distance=function(t,e){},ul.prototype.interfaces_=function(){return[]},ul.prototype.getClass=function(){return ul};var z1=function(r){function t(n){n=n||t.DEFAULT_NODE_CAPACITY,r.call(this,n)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return t.prototype.createParentBoundablesFromVerticalSlices=function(i,s){var o=this;Ft.isTrue(i.length>0);for(var a=new tt,u=0;u<i.length;u++)a.addAll(o.createParentBoundablesFromVerticalSlice(i[u],s));return a},t.prototype.createNode=function(i){return new U1(i)},t.prototype.size=function(){return arguments.length===0?r.prototype.size.call(this):r.prototype.size.apply(this,arguments)},t.prototype.insert=function(){if(arguments.length===2){var i=arguments[0],s=arguments[1];if(i.isNull())return null;r.prototype.insert.call(this,i,s)}else return r.prototype.insert.apply(this,arguments)},t.prototype.getIntersectsOp=function(){return t.intersectsOp},t.prototype.verticalSlices=function(i,s){for(var o=Math.trunc(Math.ceil(i.size()/s)),a=new Array(s).fill(null),u=i.iterator(),l=0;l<s;l++){a[l]=new tt;for(var h=0;u.hasNext()&&h<o;){var c=u.next();a[l].add(c),h++}}return a},t.prototype.query=function(){if(arguments.length===1){var i=arguments[0];return r.prototype.query.call(this,i)}else if(arguments.length===2){var s=arguments[0],o=arguments[1];r.prototype.query.call(this,s,o)}else if(arguments.length===3){if(Pt(arguments[2],oo)&&arguments[0]instanceof Object&&arguments[1]instanceof We){var a=arguments[0],u=arguments[1],l=arguments[2];r.prototype.query.call(this,a,u,l)}else if(Pt(arguments[2],Ur)&&arguments[0]instanceof Object&&arguments[1]instanceof We){var h=arguments[0],c=arguments[1],d=arguments[2];r.prototype.query.call(this,h,c,d)}}},t.prototype.getComparator=function(){return t.yComparator},t.prototype.createParentBoundablesFromVerticalSlice=function(i,s){return r.prototype.createParentBoundables.call(this,i,s)},t.prototype.remove=function(){if(arguments.length===2){var i=arguments[0],s=arguments[1];return r.prototype.remove.call(this,i,s)}else return r.prototype.remove.apply(this,arguments)},t.prototype.depth=function(){return arguments.length===0?r.prototype.depth.call(this):r.prototype.depth.apply(this,arguments)},t.prototype.createParentBoundables=function(i,s){Ft.isTrue(!i.isEmpty());var o=Math.trunc(Math.ceil(i.size()/this.getNodeCapacity())),a=new tt(i);$r.sort(a,t.xComparator);var u=this.verticalSlices(a,Math.trunc(Math.ceil(Math.sqrt(o))));return this.createParentBoundablesFromVerticalSlices(u,s)},t.prototype.nearestNeighbour=function(){if(arguments.length===1){if(Pt(arguments[0],ul)){var i=arguments[0],s=new je(this.getRoot(),this.getRoot(),i);return this.nearestNeighbour(s)}else if(arguments[0]instanceof je){var o=arguments[0];return this.nearestNeighbour(o,Tt.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof t&&Pt(arguments[1],ul)){var a=arguments[0],u=arguments[1],l=new je(this.getRoot(),a.getRoot(),u);return this.nearestNeighbour(l)}else if(arguments[0]instanceof je&&typeof arguments[1]=="number"){var h=arguments[0],c=arguments[1],d=c,p=null,g=new Is;for(g.add(h);!g.isEmpty()&&d>0;){var y=g.poll(),w=y.getDistance();if(w>=d)break;y.isLeaves()?(d=w,p=y):y.expandToQueue(g,d)}return[p.getBoundable(0).getItem(),p.getBoundable(1).getItem()]}}else if(arguments.length===3){var b=arguments[0],m=arguments[1],E=arguments[2],_=new Hr(b,m),S=new je(this.getRoot(),_,E);return this.nearestNeighbour(S)[0]}},t.prototype.interfaces_=function(){return[ka,xr]},t.prototype.getClass=function(){return t},t.centreX=function(i){return t.avg(i.getMinX(),i.getMaxX())},t.avg=function(i,s){return(i+s)/2},t.centreY=function(i){return t.avg(i.getMinY(),i.getMaxY())},e.STRtreeNode.get=function(){return U1},e.serialVersionUID.get=function(){return 0x39920f7d5f261e0},e.xComparator.get=function(){return{interfaces_:function(){return[Xu]},compare:function(n,i){return r.compareDoubles(t.centreX(n.getBounds()),t.centreX(i.getBounds()))}}},e.yComparator.get=function(){return{interfaces_:function(){return[Xu]},compare:function(n,i){return r.compareDoubles(t.centreY(n.getBounds()),t.centreY(i.getBounds()))}}},e.intersectsOp.get=function(){return{interfaces_:function(){return[r.IntersectsOp]},intersects:function(n,i){return n.intersects(i)}}},e.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(t,e),t}(Ke),U1=function(r){function t(){var e=arguments[0];r.call(this,e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.computeBounds=function(){for(var n=null,i=this.getChildBoundables().iterator();i.hasNext();){var s=i.next();n===null?n=new gt(s.getBounds()):n.expandToInclude(s.getBounds())}return n},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(We),Fn=function(){};Fn.prototype.interfaces_=function(){return[]},Fn.prototype.getClass=function(){return Fn},Fn.relativeSign=function(t,e){return t<e?-1:t>e?1:0},Fn.compare=function(t,e,n){if(e.equals2D(n))return 0;var i=Fn.relativeSign(e.x,n.x),s=Fn.relativeSign(e.y,n.y);switch(t){case 0:return Fn.compareValue(i,s);case 1:return Fn.compareValue(s,i);case 2:return Fn.compareValue(s,-i);case 3:return Fn.compareValue(-i,s);case 4:return Fn.compareValue(-i,-s);case 5:return Fn.compareValue(-s,-i);case 6:return Fn.compareValue(-s,i);case 7:return Fn.compareValue(i,-s)}return Ft.shouldNeverReachHere("invalid octant value"),0},Fn.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var ao=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this._segString=t,this.coord=new F(e),this.segmentIndex=n,this._segmentOctant=i,this._isInterior=!e.equals2D(t.getCoordinate(n))};ao.prototype.getCoordinate=function(){return this.coord},ao.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},ao.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:Fn.compare(this._segmentOctant,this.coord,e.coord)},ao.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t},ao.prototype.isInterior=function(){return this._isInterior},ao.prototype.interfaces_=function(){return[Pr]},ao.prototype.getClass=function(){return ao};var Pn=function(){this._nodeMap=new mn,this._edge=null;var t=arguments[0];this._edge=t};Pn.prototype.getSplitCoordinates=function(){var t=this,e=new rc;this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var s=n.next();t.addEdgeCoordinates(i,s,e),i=s}return e.toCoordinateArray()},Pn.prototype.addCollapsedNodes=function(){var t=this,e=new tt;this.findCollapsesFromInsertedNodes(e),this.findCollapsesFromExistingVertices(e);for(var n=e.iterator();n.hasNext();){var i=n.next().intValue();t.add(t._edge.getCoordinate(i),i)}},Pn.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}},Pn.prototype.findCollapsesFromExistingVertices=function(t){for(var e=this,n=0;n<this._edge.size()-2;n++){var i=e._edge.getCoordinate(n),s=e._edge.getCoordinate(n+2);i.equals2D(s)&&t.add(new ai(n+1))}},Pn.prototype.addEdgeCoordinates=function(t,e,n){var i=this,s=this._edge.getCoordinate(e.segmentIndex),o=e.isInterior()||!e.coord.equals2D(s);n.add(new F(t.coord),!1);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)n.add(i._edge.getCoordinate(a));o&&n.add(new F(e.coord))},Pn.prototype.iterator=function(){return this._nodeMap.values().iterator()},Pn.prototype.addSplitEdges=function(t){var e=this;this.addEndpoints(),this.addCollapsedNodes();for(var n=this.iterator(),i=n.next();n.hasNext();){var s=n.next(),o=e.createSplitEdge(i,s);t.add(o),i=s}},Pn.prototype.findCollapseIndex=function(t,e,n){if(!t.coord.equals2D(e.coord))return!1;var i=e.segmentIndex-t.segmentIndex;return e.isInterior()||i--,i===1?(n[0]=t.segmentIndex+1,!0):!1},Pn.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=this,n=new Array(1).fill(null),i=this.iterator(),s=i.next();i.hasNext();){var o=i.next(),a=e.findCollapseIndex(s,o,n);a&&t.add(new ai(n[0])),s=o}},Pn.prototype.getEdge=function(){return this._edge},Pn.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},Pn.prototype.createSplitEdge=function(t,e){var n=this,i=e.segmentIndex-t.segmentIndex+2,s=this._edge.getCoordinate(e.segmentIndex),o=e.isInterior()||!e.coord.equals2D(s);o||i--;var a=new Array(i).fill(null),u=0;a[u++]=new F(t.coord);for(var l=t.segmentIndex+1;l<=e.segmentIndex;l++)a[u++]=n._edge.getCoordinate(l);return o&&(a[u]=new F(e.coord)),new Re(a,this._edge.getData())},Pn.prototype.add=function(t,e){var n=new ao(this._edge,t,e,this._edge.getSegmentOctant(e)),i=this._nodeMap.get(n);return i!==null?(Ft.isTrue(i.coord.equals2D(t),"Found equal nodes with different coordinates"),i):(this._nodeMap.put(n,n),n)},Pn.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),n=t.get(0),i=n.getCoordinate(0);if(!i.equals2D(e[0]))throw new ws("bad split edge start point at "+i);var s=t.get(t.size()-1),o=s.getCoordinates(),a=o[o.length-1];if(!a.equals2D(e[e.length-1]))throw new ws("bad split edge end point at "+a)},Pn.prototype.interfaces_=function(){return[]},Pn.prototype.getClass=function(){return Pn};var Ga=function(){};Ga.prototype.interfaces_=function(){return[]},Ga.prototype.getClass=function(){return Ga},Ga.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new Ce("Cannot compute the octant for point ( "+t+", "+e+" )");var n=Math.abs(t),i=Math.abs(e);return t>=0?e>=0?n>=i?0:1:n>=i?7:6:e>=0?n>=i?3:2:n>=i?4:5}else if(arguments[0]instanceof F&&arguments[1]instanceof F){var s=arguments[0],o=arguments[1],a=o.x-s.x,u=o.y-s.y;if(a===0&&u===0)throw new Ce("Cannot compute the octant for two identical points "+s);return Ga.octant(a,u)}};var qi=function(){};qi.prototype.getCoordinates=function(){},qi.prototype.size=function(){},qi.prototype.getCoordinate=function(t){},qi.prototype.isClosed=function(){},qi.prototype.setData=function(t){},qi.prototype.getData=function(){},qi.prototype.interfaces_=function(){return[]},qi.prototype.getClass=function(){return qi};var dc=function(){};dc.prototype.addIntersection=function(t,e){},dc.prototype.interfaces_=function(){return[qi]},dc.prototype.getClass=function(){return dc};var Re=function(){this._nodeList=new Pn(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Re.prototype.getCoordinates=function(){return this._pts},Re.prototype.size=function(){return this._pts.length},Re.prototype.getCoordinate=function(t){return this._pts[t]},Re.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Re.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},Re.prototype.setData=function(t){this._data=t},Re.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Ga.octant(t,e)},Re.prototype.getData=function(){return this._data},Re.prototype.addIntersection=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[3],o=new F(n.getIntersection(s));this.addIntersection(o,i)}},Re.prototype.toString=function(){return zr.toLineString(new Ae(this._pts))},Re.prototype.getNodeList=function(){return this._nodeList},Re.prototype.addIntersectionNode=function(t,e){var n=e,i=n+1;if(i<this._pts.length){var s=this._pts[i];t.equals2D(s)&&(n=i)}var o=this._nodeList.add(t,n);return o},Re.prototype.addIntersections=function(t,e,n){for(var i=this,s=0;s<t.getIntersectionNum();s++)i.addIntersection(t,e,n,s)},Re.prototype.interfaces_=function(){return[dc]},Re.prototype.getClass=function(){return Re},Re.getNodedSubstrings=function(){if(arguments.length===1){var t=arguments[0],e=new tt;return Re.getNodedSubstrings(t,e),e}else if(arguments.length===2)for(var n=arguments[0],i=arguments[1],s=n.iterator();s.hasNext();){var o=s.next();o.getNodeList().addSplitEdges(i)}};var mt=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new F,this.p1=new F;else if(arguments.length===1){var t=arguments[0];this.p0=new F(t.p0),this.p1=new F(t.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var e=arguments[0],n=arguments[1],i=arguments[2],s=arguments[3];this.p0=new F(e,n),this.p1=new F(i,s)}},q1={serialVersionUID:{configurable:!0}};mt.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},mt.prototype.orientationIndex=function(){if(arguments[0]instanceof mt){var t=arguments[0],e=rt.orientationIndex(this.p0,this.p1,t.p0),n=rt.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}else if(arguments[0]instanceof F){var i=arguments[0];return rt.orientationIndex(this.p0,this.p1,i)}},mt.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},mt.prototype.isVertical=function(){return this.p0.x===this.p1.x},mt.prototype.equals=function(t){if(!(t instanceof mt))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},mt.prototype.intersection=function(t){var e=new Uo;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},mt.prototype.project=function(){if(arguments[0]instanceof F){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new F(t);var e=this.projectionFactor(t),n=new F;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}else if(arguments[0]instanceof mt){var i=arguments[0],s=this.projectionFactor(i.p0),o=this.projectionFactor(i.p1);if(s>=1&&o>=1||s<=0&&o<=0)return null;var a=this.project(i.p0);s<0&&(a=this.p0),s>1&&(a=this.p1);var u=this.project(i.p1);return o<0&&(u=this.p0),o>1&&(u=this.p1),new mt(a,u)}},mt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},mt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},mt.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1},mt.prototype.distancePerpendicular=function(t){return rt.distancePointLinePerpendicular(t,this.p0,this.p1)},mt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},mt.prototype.midPoint=function(){return mt.midPoint(this.p0,this.p1)},mt.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,i=e*e+n*n;if(i<=0)return Tt.NaN;var s=((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/i;return s},mt.prototype.closestPoints=function(t){var e=this.intersection(t);if(e!==null)return[e,e];var n=new Array(2).fill(null),i=Tt.MAX_VALUE,s=null,o=this.closestPoint(t.p0);i=o.distance(t.p0),n[0]=o,n[1]=t.p0;var a=this.closestPoint(t.p1);s=a.distance(t.p1),s<i&&(i=s,n[0]=a,n[1]=t.p1);var u=t.closestPoint(this.p0);s=u.distance(this.p0),s<i&&(i=s,n[0]=this.p0,n[1]=u);var l=t.closestPoint(this.p1);return s=l.distance(this.p1),s<i&&(i=s,n[0]=this.p1,n[1]=l),n},mt.prototype.closestPoint=function(t){var e=this.projectionFactor(t);if(e>0&&e<1)return this.project(t);var n=this.p0.distance(t),i=this.p1.distance(t);return n<i?this.p0:this.p1},mt.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},mt.prototype.getLength=function(){return this.p0.distance(this.p1)},mt.prototype.compareTo=function(t){var e=t,n=this.p0.compareTo(e.p0);return n!==0?n:this.p1.compareTo(e.p1)},mt.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},mt.prototype.equalsTopo=function(t){return this.p0.equals(t.p0)&&(this.p1.equals(t.p1)||this.p0.equals(t.p1))&&this.p1.equals(t.p0)},mt.prototype.lineIntersection=function(t){try{var e=Br.intersection(this.p0,this.p1,t.p0,t.p1);return e}catch(n){if(!(n instanceof Ju))throw n}finally{}return null},mt.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},mt.prototype.pointAlongOffset=function(t,e){var n=this.p0.x+t*(this.p1.x-this.p0.x),i=this.p0.y+t*(this.p1.y-this.p0.y),s=this.p1.x-this.p0.x,o=this.p1.y-this.p0.y,a=Math.sqrt(s*s+o*o),u=0,l=0;if(e!==0){if(a<=0)throw new Error("Cannot compute offset from zero-length line segment");u=e*s/a,l=e*o/a}var h=n-l,c=i+u,d=new F(h,c);return d},mt.prototype.setCoordinates=function(){if(arguments.length===1){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=n.x,this.p1.y=n.y}},mt.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||Tt.isNaN(e))&&(e=1),e},mt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},mt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},mt.prototype.distance=function(){if(arguments[0]instanceof mt){var t=arguments[0];return rt.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}else if(arguments[0]instanceof F){var e=arguments[0];return rt.distancePointLine(e,this.p0,this.p1)}},mt.prototype.pointAlong=function(t){var e=new F;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e},mt.prototype.hashCode=function(){var t=Tt.doubleToLongBits(this.p0.x);t^=Tt.doubleToLongBits(this.p0.y)*31;var e=Math.trunc(t)^Math.trunc(t>>32),n=Tt.doubleToLongBits(this.p1.x);n^=Tt.doubleToLongBits(this.p1.y)*31;var i=Math.trunc(n)^Math.trunc(n>>32);return e^i},mt.prototype.interfaces_=function(){return[Pr,xr]},mt.prototype.getClass=function(){return mt},mt.midPoint=function(t,e){return new F((t.x+e.x)/2,(t.y+e.y)/2)},q1.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(mt,q1);var fc=function(){this.tempEnv1=new gt,this.tempEnv2=new gt,this._overlapSeg1=new mt,this._overlapSeg2=new mt};fc.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];t.getLineSegment(e,this._overlapSeg1),n.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},fc.prototype.interfaces_=function(){return[]},fc.prototype.getClass=function(){return fc};var Jn=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=i};Jn.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},Jn.prototype.computeSelect=function(t,e,n,i){var s=this._pts[e],o=this._pts[n];if(i.tempEnv1.init(s,o),n-e===1)return i.select(this,e),null;if(!t.intersects(i.tempEnv1))return null;var a=Math.trunc((e+n)/2);e<a&&this.computeSelect(t,e,a,i),a<n&&this.computeSelect(t,a,n,i)},Jn.prototype.getCoordinates=function(){for(var t=this,e=new Array(this._end-this._start+1).fill(null),n=0,i=this._start;i<=this._end;i++)e[n++]=t._pts[i];return e},Jn.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},Jn.prototype.setId=function(t){this._id=t},Jn.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},Jn.prototype.getEnvelope=function(){if(this._env===null){var t=this._pts[this._start],e=this._pts[this._end];this._env=new gt(t,e)}return this._env},Jn.prototype.getEndIndex=function(){return this._end},Jn.prototype.getStartIndex=function(){return this._start},Jn.prototype.getContext=function(){return this._context},Jn.prototype.getId=function(){return this._id},Jn.prototype.computeOverlapsInternal=function(t,e,n,i,s,o){var a=this._pts[t],u=this._pts[e],l=n._pts[i],h=n._pts[s];if(e-t===1&&s-i===1)return o.overlap(this,t,n,i),null;if(o.tempEnv1.init(a,u),o.tempEnv2.init(l,h),!o.tempEnv1.intersects(o.tempEnv2))return null;var c=Math.trunc((t+e)/2),d=Math.trunc((i+s)/2);t<c&&(i<d&&this.computeOverlapsInternal(t,c,n,i,d,o),d<s&&this.computeOverlapsInternal(t,c,n,d,s,o)),c<e&&(i<d&&this.computeOverlapsInternal(c,e,n,i,d,o),d<s&&this.computeOverlapsInternal(c,e,n,d,s,o))},Jn.prototype.interfaces_=function(){return[]},Jn.prototype.getClass=function(){return Jn};var vi=function(){};vi.prototype.interfaces_=function(){return[]},vi.prototype.getClass=function(){return vi},vi.getChainStartIndices=function(t){var e=0,n=new tt;n.add(new ai(e));do{var i=vi.findChainEnd(t,e);n.add(new ai(i)),e=i}while(e<t.length-1);var s=vi.toIntArray(n);return s},vi.findChainEnd=function(t,e){for(var n=e;n<t.length-1&&t[n].equals2D(t[n+1]);)n++;if(n>=t.length-1)return t.length-1;for(var i=ue.quadrant(t[n],t[n+1]),s=e+1;s<t.length;){if(!t[s-1].equals2D(t[s])){var o=ue.quadrant(t[s-1],t[s]);if(o!==i)break}s++}return s-1},vi.getChains=function(){if(arguments.length===1){var t=arguments[0];return vi.getChains(t,null)}else if(arguments.length===2){for(var e=arguments[0],n=arguments[1],i=new tt,s=vi.getChainStartIndices(e),o=0;o<s.length-1;o++){var a=new Jn(e,s[o],s[o+1],n);i.add(a)}return i}},vi.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var $o=function(){};$o.prototype.computeNodes=function(t){},$o.prototype.getNodedSubstrings=function(){},$o.prototype.interfaces_=function(){return[]},$o.prototype.getClass=function(){return $o};var pc=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setSegmentIntersector(t)}}};pc.prototype.setSegmentIntersector=function(t){this._segInt=t},pc.prototype.interfaces_=function(){return[$o]},pc.prototype.getClass=function(){return pc};var tm=function(r){function t(n){n?r.call(this,n):r.call(this),this._monoChains=new tt,this._index=new z1,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={SegmentOverlapAction:{configurable:!0}};return t.prototype.getMonotoneChains=function(){return this._monoChains},t.prototype.getNodedSubstrings=function(){return Re.getNodedSubstrings(this._nodedSegStrings)},t.prototype.getIndex=function(){return this._index},t.prototype.add=function(i){for(var s=this,o=vi.getChains(i.getCoordinates(),i),a=o.iterator();a.hasNext();){var u=a.next();u.setId(s._idCounter++),s._index.insert(u.getEnvelope(),u),s._monoChains.add(u)}},t.prototype.computeNodes=function(i){var s=this;this._nodedSegStrings=i;for(var o=i.iterator();o.hasNext();)s.add(o.next());this.intersectChains()},t.prototype.intersectChains=function(){for(var i=this,s=new W1(this._segInt),o=this._monoChains.iterator();o.hasNext();)for(var a=o.next(),u=i._index.query(a.getEnvelope()),l=u.iterator();l.hasNext();){var h=l.next();if(h.getId()>a.getId()&&(a.computeOverlaps(h,s),i._nOverlaps++),i._segInt.isDone())return null}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},e.SegmentOverlapAction.get=function(){return W1},Object.defineProperties(t,e),t}(pc),W1=function(r){function t(){r.call(this),this._si=null;var e=arguments[0];this._si=e}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],o=arguments[3],a=n.getContext(),u=s.getContext();this._si.processIntersections(a,i,u,o)}else return r.prototype.overlap.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(fc),re=function r(){if(this._quadrantSegments=r.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=r.CAP_ROUND,this._joinStyle=r.JOIN_ROUND,this._mitreLimit=r.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=r.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setQuadrantSegments(t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.setQuadrantSegments(e),this.setEndCapStyle(n)}else if(arguments.length===4){var i=arguments[0],s=arguments[1],o=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(s),this.setJoinStyle(o),this.setMitreLimit(a)}}},Ms={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};re.prototype.getEndCapStyle=function(){return this._endCapStyle},re.prototype.isSingleSided=function(){return this._isSingleSided},re.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=re.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=re.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==re.JOIN_ROUND&&(this._quadrantSegments=re.DEFAULT_QUADRANT_SEGMENTS)},re.prototype.getJoinStyle=function(){return this._joinStyle},re.prototype.setJoinStyle=function(t){this._joinStyle=t},re.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},re.prototype.getSimplifyFactor=function(){return this._simplifyFactor},re.prototype.getQuadrantSegments=function(){return this._quadrantSegments},re.prototype.setEndCapStyle=function(t){this._endCapStyle=t},re.prototype.getMitreLimit=function(){return this._mitreLimit},re.prototype.setMitreLimit=function(t){this._mitreLimit=t},re.prototype.setSingleSided=function(t){this._isSingleSided=t},re.prototype.interfaces_=function(){return[]},re.prototype.getClass=function(){return re},re.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},Ms.CAP_ROUND.get=function(){return 1},Ms.CAP_FLAT.get=function(){return 2},Ms.CAP_SQUARE.get=function(){return 3},Ms.JOIN_ROUND.get=function(){return 1},Ms.JOIN_MITRE.get=function(){return 2},Ms.JOIN_BEVEL.get=function(){return 3},Ms.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},Ms.DEFAULT_MITRE_LIMIT.get=function(){return 5},Ms.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(re,Ms);var Te=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=rt.COUNTERCLOCKWISE,this._inputLine=t||null},gc={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Te.prototype.isDeletable=function(t,e,n,i){var s=this._inputLine[t],o=this._inputLine[e],a=this._inputLine[n];return!this.isConcave(s,o,a)||!this.isShallow(s,o,a,i)?!1:this.isShallowSampled(s,o,t,n,i)},Te.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,n=this.findNextNonDeletedIndex(e),i=this.findNextNonDeletedIndex(n),s=!1;i<this._inputLine.length;){var o=!1;t.isDeletable(e,n,i,t._distanceTol)&&(t._isDeleted[n]=Te.DELETE,o=!0,s=!0),o?e=i:e=n,n=t.findNextNonDeletedIndex(e),i=t.findNextNonDeletedIndex(n)}return s},Te.prototype.isShallowConcavity=function(t,e,n,i){var s=rt.computeOrientation(t,e,n),o=s===this._angleOrientation;if(!o)return!1;var a=rt.distancePointLine(e,t,n);return a<i},Te.prototype.isShallowSampled=function(t,e,n,i,s){var o=this,a=Math.trunc((i-n)/Te.NUM_PTS_TO_CHECK);a<=0&&(a=1);for(var u=n;u<i;u+=a)if(!o.isShallow(t,e,o._inputLine[u],s))return!1;return!0},Te.prototype.isConcave=function(t,e,n){var i=rt.computeOrientation(t,e,n),s=i===this._angleOrientation;return s},Te.prototype.simplify=function(t){var e=this;this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=rt.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var n=!1;do n=e.deleteShallowConcavities();while(n);return this.collapseLine()},Te.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===Te.DELETE;)e++;return e},Te.prototype.isShallow=function(t,e,n,i){var s=rt.distancePointLine(e,t,n);return s<i},Te.prototype.collapseLine=function(){for(var t=this,e=new rc,n=0;n<this._inputLine.length;n++)t._isDeleted[n]!==Te.DELETE&&e.add(t._inputLine[n]);return e.toCoordinateArray()},Te.prototype.interfaces_=function(){return[]},Te.prototype.getClass=function(){return Te},Te.simplify=function(t,e){var n=new Te(t);return n.simplify(e)},gc.INIT.get=function(){return 0},gc.DELETE.get=function(){return 1},gc.KEEP.get=function(){return 1},gc.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Te,gc);var dr=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new tt},H1={COORDINATE_ARRAY_TYPE:{configurable:!0}};dr.prototype.getCoordinates=function(){var t=this._ptList.toArray(dr.COORDINATE_ARRAY_TYPE);return t},dr.prototype.setPrecisionModel=function(t){this._precisionModel=t},dr.prototype.addPt=function(t){var e=new F(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},dr.prototype.revere=function(){},dr.prototype.addPts=function(t,e){var n=this;if(e)for(var i=0;i<t.length;i++)n.addPt(t[i]);else for(var s=t.length-1;s>=0;s--)n.addPt(t[s])},dr.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1),n=t.distance(e);return n<this._minimimVertexDistance},dr.prototype.toString=function(){var t=new Ut,e=t.createLineString(this.getCoordinates());return e.toString()},dr.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new F(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},dr.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},dr.prototype.interfaces_=function(){return[]},dr.prototype.getClass=function(){return dr},H1.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(dr,H1);var Xt=function(){},ja={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};Xt.prototype.interfaces_=function(){return[]},Xt.prototype.getClass=function(){return Xt},Xt.toDegrees=function(t){return t*180/Math.PI},Xt.normalize=function(t){for(;t>Math.PI;)t-=Xt.PI_TIMES_2;for(;t<=-Math.PI;)t+=Xt.PI_TIMES_2;return t},Xt.angle=function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],i=n.x-e.x,s=n.y-e.y;return Math.atan2(s,i)}},Xt.isAcute=function(t,e,n){var i=t.x-e.x,s=t.y-e.y,o=n.x-e.x,a=n.y-e.y,u=i*o+s*a;return u>0},Xt.isObtuse=function(t,e,n){var i=t.x-e.x,s=t.y-e.y,o=n.x-e.x,a=n.y-e.y,u=i*o+s*a;return u<0},Xt.interiorAngle=function(t,e,n){var i=Xt.angle(e,t),s=Xt.angle(e,n);return Math.abs(s-i)},Xt.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Xt.PI_TIMES_2;t>=Xt.PI_TIMES_2&&(t=0)}else{for(;t>=Xt.PI_TIMES_2;)t-=Xt.PI_TIMES_2;t<0&&(t=0)}return t},Xt.angleBetween=function(t,e,n){var i=Xt.angle(e,t),s=Xt.angle(e,n);return Xt.diff(i,s)},Xt.diff=function(t,e){var n=null;return t<e?n=e-t:n=t-e,n>Math.PI&&(n=2*Math.PI-n),n},Xt.toRadians=function(t){return t*Math.PI/180},Xt.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?Xt.COUNTERCLOCKWISE:n<0?Xt.CLOCKWISE:Xt.NONE},Xt.angleBetweenOriented=function(t,e,n){var i=Xt.angle(e,t),s=Xt.angle(e,n),o=s-i;return o<=-Math.PI?o+Xt.PI_TIMES_2:o>Math.PI?o-Xt.PI_TIMES_2:o},ja.PI_TIMES_2.get=function(){return 2*Math.PI},ja.PI_OVER_2.get=function(){return Math.PI/2},ja.PI_OVER_4.get=function(){return Math.PI/4},ja.COUNTERCLOCKWISE.get=function(){return rt.COUNTERCLOCKWISE},ja.CLOCKWISE.get=function(){return rt.CLOCKWISE},ja.NONE.get=function(){return rt.COLLINEAR},Object.defineProperties(Xt,ja);var we=function r(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new mt,this._seg1=new mt,this._offset0=new mt,this._offset1=new mt,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._precisionModel=t,this._bufParams=e,this._li=new Uo,this._filletAngleQuantum=Math.PI/2/e.getQuadrantSegments(),e.getQuadrantSegments()>=8&&e.getJoinStyle()===re.JOIN_ROUND&&(this._closingSegLengthFactor=r.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)},mc={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};we.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=rt.computeOrientation(this._s0,this._s1,this._s2),i=n===rt.CLOCKWISE&&this._side===Z.LEFT||n===rt.COUNTERCLOCKWISE&&this._side===Z.RIGHT;n===0?this.addCollinear(e):i?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)},we.prototype.addLineEndCap=function(t,e){var n=new mt(t,e),i=new mt;this.computeOffsetSegment(n,Z.LEFT,this._distance,i);var s=new mt;this.computeOffsetSegment(n,Z.RIGHT,this._distance,s);var o=e.x-t.x,a=e.y-t.y,u=Math.atan2(a,o);switch(this._bufParams.getEndCapStyle()){case re.CAP_ROUND:this._segList.addPt(i.p1),this.addFilletArc(e,u+Math.PI/2,u-Math.PI/2,rt.CLOCKWISE,this._distance),this._segList.addPt(s.p1);break;case re.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(s.p1);break;case re.CAP_SQUARE:var l=new F;l.x=Math.abs(this._distance)*Math.cos(u),l.y=Math.abs(this._distance)*Math.sin(u);var h=new F(i.p1.x+l.x,i.p1.y+l.y),c=new F(s.p1.x+l.x,s.p1.y+l.y);this._segList.addPt(h),this._segList.addPt(c);break}},we.prototype.getCoordinates=function(){var t=this._segList.getCoordinates();return t},we.prototype.addMitreJoin=function(t,e,n,i){var s=!0,o=null;try{o=Br.intersection(e.p0,e.p1,n.p0,n.p1);var a=i<=0?1:o.distance(t)/Math.abs(i);a>this._bufParams.getMitreLimit()&&(s=!1)}catch(u){if(u instanceof Ju)o=new F(0,0),s=!1;else throw u}finally{}s?this._segList.addPt(o):this.addLimitedMitreJoin(e,n,i,this._bufParams.getMitreLimit())},we.prototype.addFilletCorner=function(t,e,n,i,s){var o=e.x-t.x,a=e.y-t.y,u=Math.atan2(a,o),l=n.x-t.x,h=n.y-t.y,c=Math.atan2(h,l);i===rt.CLOCKWISE?u<=c&&(u+=2*Math.PI):u>=c&&(u-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,u,c,i,s),this._segList.addPt(n)},we.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*we.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===re.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===re.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(e&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))},we.prototype.createSquare=function(t){this._segList.addPt(new F(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new F(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new F(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new F(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},we.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},we.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},we.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},we.prototype.initSideSegments=function(t,e,n){this._s1=t,this._s2=e,this._side=n,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,n,this._distance,this._offset1)},we.prototype.addLimitedMitreJoin=function(t,e,n,i){var s=this._seg0.p1,o=Xt.angle(s,this._seg0.p0),a=Xt.angleBetweenOriented(this._seg0.p0,s,this._seg1.p1),u=a/2,l=Xt.normalize(o+u),h=Xt.normalize(l+Math.PI),c=i*n,d=c*Math.abs(Math.sin(u)),p=n-d,g=s.x+c*Math.cos(h),y=s.y+c*Math.sin(h),w=new F(g,y),b=new mt(s,w),m=b.pointAlongOffset(1,p),E=b.pointAlongOffset(1,-p);this._side===Z.LEFT?(this._segList.addPt(m),this._segList.addPt(E)):(this._segList.addPt(E),this._segList.addPt(m))},we.prototype.computeOffsetSegment=function(t,e,n,i){var s=e===Z.LEFT?1:-1,o=t.p1.x-t.p0.x,a=t.p1.y-t.p0.y,u=Math.sqrt(o*o+a*a),l=s*n*o/u,h=s*n*a/u;i.p0.x=t.p0.x-h,i.p0.y=t.p0.y+l,i.p1.x=t.p1.x-h,i.p1.y=t.p1.y+l},we.prototype.addFilletArc=function(t,e,n,i,s){var o=this,a=i===rt.CLOCKWISE?-1:1,u=Math.abs(e-n),l=Math.trunc(u/this._filletAngleQuantum+.5);if(l<1)return null;for(var h=0,c=u/l,d=h,p=new F;d<u;){var g=e+a*d;p.x=t.x+s*Math.cos(g),p.y=t.y+s*Math.sin(g),o._segList.addPt(p),d+=c}},we.prototype.addInsideTurn=function(t,e){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*we.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var n=new F((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var i=new F((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(i)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},we.prototype.createCircle=function(t){var e=new F(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},we.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},we.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new dr,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*we.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},we.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var e=this._li.getIntersectionNum();e>=2&&(this._bufParams.getJoinStyle()===re.JOIN_BEVEL||this._bufParams.getJoinStyle()===re.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,rt.CLOCKWISE,this._distance))},we.prototype.closeRing=function(){this._segList.closeRing()},we.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},we.prototype.interfaces_=function(){return[]},we.prototype.getClass=function(){return we},mc.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},mc.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},mc.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},mc.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(we,mc);var kn=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};kn.prototype.getOffsetCurve=function(t,e){if(this._distance=e,e===0)return null;var n=e<0,i=Math.abs(e),s=this.getSegGen(i);t.length<=1?this.computePointCurve(t[0],s):this.computeOffsetCurve(t,n,s);var o=s.getCoordinates();return n&&zt.reverse(o),o},kn.prototype.computeSingleSidedBufferCurve=function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var s=Te.simplify(t,-i),o=s.length-1;n.initSideSegments(s[o],s[o-1],Z.LEFT),n.addFirstSegment();for(var a=o-2;a>=0;a--)n.addNextSegment(s[a],!0)}else{n.addSegments(t,!1);var u=Te.simplify(t,i),l=u.length-1;n.initSideSegments(u[0],u[1],Z.LEFT),n.addFirstSegment();for(var h=2;h<=l;h++)n.addNextSegment(u[h],!0)}n.addLastSegment(),n.closeRing()},kn.prototype.computeRingBufferCurve=function(t,e,n){var i=this.simplifyTolerance(this._distance);e===Z.RIGHT&&(i=-i);var s=Te.simplify(t,i),o=s.length-1;n.initSideSegments(s[o-1],s[0],e);for(var a=1;a<=o;a++){var u=a!==1;n.addNextSegment(s[a],u)}n.closeRing()},kn.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),i=Te.simplify(t,n),s=i.length-1;e.initSideSegments(i[0],i[1],Z.LEFT);for(var o=2;o<=s;o++)e.addNextSegment(i[o],!0);e.addLastSegment(),e.addLineEndCap(i[s-1],i[s]);var a=Te.simplify(t,-n),u=a.length-1;e.initSideSegments(a[u],a[u-1],Z.LEFT);for(var l=u-2;l>=0;l--)e.addNextSegment(a[l],!0);e.addLastSegment(),e.addLineEndCap(a[1],a[0]),e.closeRing()},kn.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case re.CAP_ROUND:e.createCircle(t);break;case re.CAP_SQUARE:e.createSquare(t);break}},kn.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided()||e===0)return null;var n=Math.abs(e),i=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],i);else if(this._bufParams.isSingleSided()){var s=e<0;this.computeSingleSidedBufferCurve(t,s,i)}else this.computeLineBufferCurve(t,i);var o=i.getCoordinates();return o},kn.prototype.getBufferParameters=function(){return this._bufParams},kn.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},kn.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(n===0)return kn.copyCoordinates(t);var i=this.getSegGen(n);return this.computeRingBufferCurve(t,e,i),i.getCoordinates()},kn.prototype.computeOffsetCurve=function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){var s=Te.simplify(t,-i),o=s.length-1;n.initSideSegments(s[o],s[o-1],Z.LEFT),n.addFirstSegment();for(var a=o-2;a>=0;a--)n.addNextSegment(s[a],!0)}else{var u=Te.simplify(t,i),l=u.length-1;n.initSideSegments(u[0],u[1],Z.LEFT),n.addFirstSegment();for(var h=2;h<=l;h++)n.addNextSegment(u[h],!0)}n.addLastSegment()},kn.prototype.getSegGen=function(t){return new we(this._precisionModel,this._bufParams,t)},kn.prototype.interfaces_=function(){return[]},kn.prototype.getClass=function(){return kn},kn.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;n<e.length;n++)e[n]=new F(t[n]);return e};var Va=function(){this._subgraphs=null,this._seg=new mt,this._cga=new rt;var t=arguments[0];this._subgraphs=t},$1={DepthSegment:{configurable:!0}};Va.prototype.findStabbedSegments=function(){var t=this;if(arguments.length===1){for(var e=arguments[0],n=new tt,i=this._subgraphs.iterator();i.hasNext();){var s=i.next(),o=s.getEnvelope();e.y<o.getMinY()||e.y>o.getMaxY()||t.findStabbedSegments(e,s.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(Pt(arguments[2],Ur)&&arguments[0]instanceof F&&arguments[1]instanceof Qg)for(var a=arguments[0],u=arguments[1],l=arguments[2],h=u.getEdge().getCoordinates(),c=0;c<h.length-1;c++){t._seg.p0=h[c],t._seg.p1=h[c+1],t._seg.p0.y>t._seg.p1.y&&t._seg.reverse();var d=Math.max(t._seg.p0.x,t._seg.p1.x);if(!(d<a.x)&&!t._seg.isHorizontal()&&!(a.y<t._seg.p0.y||a.y>t._seg.p1.y)&&rt.computeOrientation(t._seg.p0,t._seg.p1,a)!==rt.RIGHT){var p=u.getDepth(Z.LEFT);t._seg.p0.equals(h[c])||(p=u.getDepth(Z.RIGHT));var g=new Xo(t._seg,p);l.add(g)}}else if(Pt(arguments[2],Ur)&&arguments[0]instanceof F&&Pt(arguments[1],Ur))for(var y=arguments[0],w=arguments[1],b=arguments[2],m=w.iterator();m.hasNext();){var E=m.next();E.isForward()&&t.findStabbedSegments(y,E,b)}}},Va.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(e.size()===0)return 0;var n=$r.min(e);return n._leftDepth},Va.prototype.interfaces_=function(){return[]},Va.prototype.getClass=function(){return Va},$1.DepthSegment.get=function(){return Xo},Object.defineProperties(Va,$1);var Xo=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new mt(t),this._leftDepth=e};Xo.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return n!==0||(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg),n!==0)?n:this._upwardSeg.compareTo(e._upwardSeg)},Xo.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return n!==0?n:t.p1.compareTo(e.p1)},Xo.prototype.toString=function(){return this._upwardSeg.toString()},Xo.prototype.interfaces_=function(){return[Pr]},Xo.prototype.getClass=function(){return Xo};var ie=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};ie.prototype.area=function(){return ie.area(this.p0,this.p1,this.p2)},ie.prototype.signedArea=function(){return ie.signedArea(this.p0,this.p1,this.p2)},ie.prototype.interpolateZ=function(t){if(t===null)throw new Ce("Supplied point is null.");return ie.interpolateZ(t,this.p0,this.p1,this.p2)},ie.prototype.longestSideLength=function(){return ie.longestSideLength(this.p0,this.p1,this.p2)},ie.prototype.isAcute=function(){return ie.isAcute(this.p0,this.p1,this.p2)},ie.prototype.circumcentre=function(){return ie.circumcentre(this.p0,this.p1,this.p2)},ie.prototype.area3D=function(){return ie.area3D(this.p0,this.p1,this.p2)},ie.prototype.centroid=function(){return ie.centroid(this.p0,this.p1,this.p2)},ie.prototype.inCentre=function(){return ie.inCentre(this.p0,this.p1,this.p2)},ie.prototype.interfaces_=function(){return[]},ie.prototype.getClass=function(){return ie},ie.area=function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)},ie.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},ie.det=function(t,e,n,i){return t*i-e*n},ie.interpolateZ=function(t,e,n,i){var s=e.x,o=e.y,a=n.x-s,u=i.x-s,l=n.y-o,h=i.y-o,c=a*h-u*l,d=t.x-s,p=t.y-o,g=(h*d-u*p)/c,y=(-l*d+a*p)/c,w=e.z+g*(n.z-e.z)+y*(i.z-e.z);return w},ie.longestSideLength=function(t,e,n){var i=t.distance(e),s=e.distance(n),o=n.distance(t),a=i;return s>a&&(a=s),o>a&&(a=o),a},ie.isAcute=function(t,e,n){return!(!Xt.isAcute(t,e,n)||!Xt.isAcute(e,n,t)||!Xt.isAcute(n,t,e))},ie.circumcentre=function(t,e,n){var i=n.x,s=n.y,o=t.x-i,a=t.y-s,u=e.x-i,l=e.y-s,h=2*ie.det(o,a,u,l),c=ie.det(a,o*o+a*a,l,u*u+l*l),d=ie.det(o,o*o+a*a,u,u*u+l*l),p=i-c/h,g=s+d/h;return new F(p,g)},ie.perpendicularBisector=function(t,e){var n=e.x-t.x,i=e.y-t.y,s=new Br(t.x+n/2,t.y+i/2,1),o=new Br(t.x-i+n/2,t.y+n+i/2,1);return new Br(s,o)},ie.angleBisector=function(t,e,n){var i=e.distance(t),s=e.distance(n),o=i/(i+s),a=n.x-t.x,u=n.y-t.y,l=new F(t.x+o*a,t.y+o*u);return l},ie.area3D=function(t,e,n){var i=e.x-t.x,s=e.y-t.y,o=e.z-t.z,a=n.x-t.x,u=n.y-t.y,l=n.z-t.z,h=s*l-o*u,c=o*a-i*l,d=i*u-s*a,p=h*h+c*c+d*d,g=Math.sqrt(p)/2;return g},ie.centroid=function(t,e,n){var i=(t.x+e.x+n.x)/3,s=(t.y+e.y+n.y)/3;return new F(i,s)},ie.inCentre=function(t,e,n){var i=e.distance(n),s=t.distance(n),o=t.distance(e),a=i+s+o,u=(i*t.x+s*e.x+o*n.x)/a,l=(i*t.y+s*e.y+o*n.y)/a;return new F(u,l)};var Or=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new tt;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};Or.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,V.EXTERIOR,V.INTERIOR)},Or.prototype.addPolygon=function(t){var e=this,n=this._distance,i=Z.LEFT;this._distance<0&&(n=-this._distance,i=Z.RIGHT);var s=t.getExteriorRing(),o=zt.removeRepeatedPoints(s.getCoordinates());if(this._distance<0&&this.isErodedCompletely(s,this._distance)||this._distance<=0&&o.length<3)return null;this.addPolygonRing(o,n,i,V.EXTERIOR,V.INTERIOR);for(var a=0;a<t.getNumInteriorRing();a++){var u=t.getInteriorRingN(a),l=zt.removeRepeatedPoints(u.getCoordinates());e._distance>0&&e.isErodedCompletely(u,-e._distance)||e.addPolygonRing(l,n,Z.opposite(i),V.INTERIOR,V.EXTERIOR)}},Or.prototype.isTriangleErodedCompletely=function(t,e){var n=new ie(t[0],t[1],t[2]),i=n.inCentre(),s=rt.distancePointLine(i,n.p0,n.p1);return s<Math.abs(e)},Or.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=zt.removeRepeatedPoints(t.getCoordinates()),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,V.EXTERIOR,V.INTERIOR)},Or.prototype.addCurve=function(t,e,n){if(t===null||t.length<2)return null;var i=new Re(t,new oe(0,V.BOUNDARY,e,n));this._curveList.add(i)},Or.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Or.prototype.addPolygonRing=function(t,e,n,i,s){if(e===0&&t.length<Bi.MINIMUM_VALID_SIZE)return null;var o=i,a=s;t.length>=Bi.MINIMUM_VALID_SIZE&&rt.isCCW(t)&&(o=s,a=i,n=Z.opposite(n));var u=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(u,o,a)},Or.prototype.add=function(t){if(t.isEmpty())return null;t instanceof qe?this.addPolygon(t):t instanceof Me?this.addLineString(t):t instanceof Xn?this.addPoint(t):t instanceof sl?this.addCollection(t):t instanceof Ho?this.addCollection(t):t instanceof zi?this.addCollection(t):t instanceof Cn&&this.addCollection(t)},Or.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(n.length===4)return this.isTriangleErodedCompletely(n,e);var i=t.getEnvelopeInternal(),s=Math.min(i.getHeight(),i.getWidth());return e<0&&2*Math.abs(e)>s},Or.prototype.addCollection=function(t){for(var e=this,n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);e.add(i)}},Or.prototype.interfaces_=function(){return[]},Or.prototype.getClass=function(){return Or};var ll=function(){};ll.prototype.locate=function(t){},ll.prototype.interfaces_=function(){return[]},ll.prototype.getClass=function(){return ll};var Wi=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()};Wi.prototype.next=function(){if(this._atStart)return this._atStart=!1,Wi.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new rl;var t=this._parent.getGeometryN(this._index++);return t instanceof Cn?(this._subcollectionIterator=new Wi(t),this._subcollectionIterator.next()):t},Wi.prototype.remove=function(){throw new Error(this.getClass().getName())},Wi.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},Wi.prototype.interfaces_=function(){return[nl]},Wi.prototype.getClass=function(){return Wi},Wi.isAtomic=function(t){return!(t instanceof Cn)};var fr=function(){this._geom=null;var t=arguments[0];this._geom=t};fr.prototype.locate=function(t){return fr.locate(t,this._geom)},fr.prototype.interfaces_=function(){return[ll]},fr.prototype.getClass=function(){return fr},fr.isPointInRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?rt.isPointInRing(t,e.getCoordinates()):!1},fr.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!fr.isPointInRing(t,n))return!1;for(var i=0;i<e.getNumInteriorRing();i++){var s=e.getInteriorRingN(i);if(fr.isPointInRing(t,s))return!1}return!0},fr.containsPoint=function(t,e){if(e instanceof qe)return fr.containsPointInPolygon(t,e);if(e instanceof Cn)for(var n=new Wi(e);n.hasNext();){var i=n.next();if(i!==e&&fr.containsPoint(t,i))return!0}return!1},fr.locate=function(t,e){return e.isEmpty()?V.EXTERIOR:fr.containsPoint(t,e)?V.INTERIOR:V.EXTERIOR};var _n=function(){this._edgeMap=new mn,this._edgeList=null,this._ptInAreaLocation=[V.NONE,V.NONE]};_n.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),n=e-1;return e===0&&(n=this._edgeList.size()-1),this._edgeList.get(n)},_n.prototype.propagateSideLabels=function(t){for(var e=V.NONE,n=this.iterator();n.hasNext();){var i=n.next(),s=i.getLabel();s.isArea(t)&&s.getLocation(t,Z.LEFT)!==V.NONE&&(e=s.getLocation(t,Z.LEFT))}if(e===V.NONE)return null;for(var o=e,a=this.iterator();a.hasNext();){var u=a.next(),l=u.getLabel();if(l.getLocation(t,Z.ON)===V.NONE&&l.setLocation(t,Z.ON,o),l.isArea(t)){var h=l.getLocation(t,Z.LEFT),c=l.getLocation(t,Z.RIGHT);if(c!==V.NONE){if(c!==o)throw new xs("side location conflict",u.getCoordinate());h===V.NONE&&Ft.shouldNeverReachHere("found single null side (at "+u.getCoordinate()+")"),o=h}else Ft.isTrue(l.getLocation(t,Z.LEFT)===V.NONE,"found single null side"),l.setLocation(t,Z.RIGHT,o),l.setLocation(t,Z.LEFT,o)}}},_n.prototype.getCoordinate=function(){var t=this.iterator();if(!t.hasNext())return null;var e=t.next();return e.getCoordinate()},_n.prototype.print=function(t){sn.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}},_n.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},_n.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var n=e.size()-1,i=e.get(n).getLabel(),s=i.getLocation(t,Z.LEFT);Ft.isTrue(s!==V.NONE,"Found unlabelled area edge");for(var o=s,a=this.iterator();a.hasNext();){var u=a.next(),l=u.getLabel();Ft.isTrue(l.isArea(t),"Found non-area edge");var h=l.getLocation(t,Z.LEFT),c=l.getLocation(t,Z.RIGHT);if(h===c||c!==o)return!1;o=h}return!0},_n.prototype.findIndex=function(t){var e=this;this.iterator();for(var n=0;n<this._edgeList.size();n++){var i=e._edgeList.get(n);if(i===t)return n}return-1},_n.prototype.iterator=function(){return this.getEdges().iterator()},_n.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new tt(this._edgeMap.values())),this._edgeList},_n.prototype.getLocation=function(t,e,n){return this._ptInAreaLocation[t]===V.NONE&&(this._ptInAreaLocation[t]=fr.locate(e,n[t].getGeometry())),this._ptInAreaLocation[t]},_n.prototype.toString=function(){var t=new oi;t.append("EdgeEndStar: "+this.getCoordinate()),t.append(`
|
|
67
67
|
`);for(var e=this.iterator();e.hasNext();){var n=e.next();t.append(n),t.append(`
|
|
68
|
-
`)}return t.toString()},_n.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.computeLabel(t)}},_n.prototype.computeLabelling=function(t){var e=this;this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var n=[!1,!1],i=this.iterator();i.hasNext();)for(var s=i.next(),o=s.getLabel(),a=0;a<2;a++)o.isLine(a)&&o.getLocation(a)===V.BOUNDARY&&(n[a]=!0);for(var u=this.iterator();u.hasNext();)for(var l=u.next(),h=l.getLabel(),c=0;c<2;c++)if(h.isAnyNull(c)){var d=V.NONE;if(n[c])d=V.EXTERIOR;else{var p=l.getCoordinate();d=e.getLocation(c,p,t)}h.setAllLocationsIfNull(c,d)}},_n.prototype.getDegree=function(){return this._edgeMap.size()},_n.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},_n.prototype.interfaces_=function(){return[]},_n.prototype.getClass=function(){return _n};var BN=function(r){function t(){r.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.linkResultDirectedEdges=function(){var n=this;this.getResultAreaEdges();for(var i=null,s=null,o=this._SCANNING_FOR_INCOMING,a=0;a<this._resultAreaEdgeList.size();a++){var u=n._resultAreaEdgeList.get(a),l=u.getSym();if(u.getLabel().isArea())switch(i===null&&u.isInResult()&&(i=u),o){case n._SCANNING_FOR_INCOMING:if(!l.isInResult())continue;s=l,o=n._LINKING_TO_OUTGOING;break;case n._LINKING_TO_OUTGOING:if(!u.isInResult())continue;s.setNext(u),o=n._SCANNING_FOR_INCOMING;break}}if(o===this._LINKING_TO_OUTGOING){if(i===null)throw new xs("no outgoing dirEdge found",this.getCoordinate());Ft.isTrue(i.isInResult(),"unable to link last incoming dirEdge"),s.setNext(i)}},t.prototype.insert=function(n){var i=n;this.insertEdgeEnd(i,i)},t.prototype.getRightmostEdge=function(){var n=this.getEdges(),i=n.size();if(i<1)return null;var s=n.get(0);if(i===1)return s;var o=n.get(i-1),a=s.getQuadrant(),u=o.getQuadrant();return ue.isNorthern(a)&&ue.isNorthern(u)?s:!ue.isNorthern(a)&&!ue.isNorthern(u)?o:s.getDy()!==0?s:o.getDy()!==0?o:(Ft.shouldNeverReachHere("found two horizontal edges incident on node"),null)},t.prototype.print=function(n){sn.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();){var s=i.next();n.print("out "),s.print(n),n.println(),n.print("in "),s.getSym().print(n),n.println()}},t.prototype.getResultAreaEdges=function(){var n=this;if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new tt;for(var i=this.iterator();i.hasNext();){var s=i.next();(s.isInResult()||s.getSym().isInResult())&&n._resultAreaEdgeList.add(s)}return this._resultAreaEdgeList},t.prototype.updateLabelling=function(n){for(var i=this.iterator();i.hasNext();){var s=i.next(),o=s.getLabel();o.setAllLocationsIfNull(0,n.getLocation(0)),o.setAllLocationsIfNull(1,n.getLocation(1))}},t.prototype.linkAllDirectedEdges=function(){var n=this;this.getEdges();for(var i=null,s=null,o=this._edgeList.size()-1;o>=0;o--){var a=n._edgeList.get(o),u=a.getSym();s===null&&(s=u),i!==null&&u.setNext(i),i=a}s.setNext(i)},t.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var i=arguments[0],s=this.findIndex(i),o=i.getDepth(Z.LEFT),a=i.getDepth(Z.RIGHT),u=this.computeDepths(s+1,this._edgeList.size(),o),l=this.computeDepths(0,s,u);if(l!==a)throw new xs("depth mismatch at "+i.getCoordinate())}else if(arguments.length===3){for(var h=arguments[0],c=arguments[1],d=arguments[2],p=d,g=h;g<c;g++){var y=n._edgeList.get(g);y.setEdgeDepths(Z.RIGHT,p),p=y.getDepth(Z.LEFT)}return p}},t.prototype.mergeSymLabels=function(){for(var n=this.iterator();n.hasNext();){var i=n.next(),s=i.getLabel();s.merge(i.getSym().getLabel())}},t.prototype.linkMinimalDirectedEdges=function(n){for(var i=this,s=null,o=null,a=this._SCANNING_FOR_INCOMING,u=this._resultAreaEdgeList.size()-1;u>=0;u--){var l=i._resultAreaEdgeList.get(u),h=l.getSym();switch(s===null&&l.getEdgeRing()===n&&(s=l),a){case i._SCANNING_FOR_INCOMING:if(h.getEdgeRing()!==n)continue;o=h,a=i._LINKING_TO_OUTGOING;break;case i._LINKING_TO_OUTGOING:if(l.getEdgeRing()!==n)continue;o.setNextMin(l),a=i._SCANNING_FOR_INCOMING;break}}a===this._LINKING_TO_OUTGOING&&(Ft.isTrue(s!==null,"found null for first outgoing dirEdge"),Ft.isTrue(s.getEdgeRing()===n,"unable to link last incoming dirEdge"),o.setNextMin(s))},t.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,i=this.iterator();i.hasNext();){var s=i.next();s.isInResult()&&n++}return n}else if(arguments.length===1){for(var o=arguments[0],a=0,u=this.iterator();u.hasNext();){var l=u.next();l.getEdgeRing()===o&&a++}return a}},t.prototype.getLabel=function(){return this._label},t.prototype.findCoveredLineEdges=function(){for(var n=V.NONE,i=this.iterator();i.hasNext();){var s=i.next(),o=s.getSym();if(!s.isLineEdge()){if(s.isInResult()){n=V.INTERIOR;break}if(o.isInResult()){n=V.EXTERIOR;break}}}if(n===V.NONE)return null;for(var a=n,u=this.iterator();u.hasNext();){var l=u.next(),h=l.getSym();l.isLineEdge()?l.getEdge().setCovered(a===V.INTERIOR):(l.isInResult()&&(a=V.EXTERIOR),h.isInResult()&&(a=V.INTERIOR))}},t.prototype.computeLabelling=function(n){var i=this;r.prototype.computeLabelling.call(this,n),this._label=new oe(V.NONE);for(var s=this.iterator();s.hasNext();)for(var o=s.next(),a=o.getEdge(),u=a.getLabel(),l=0;l<2;l++){var h=u.getLocation(l);(h===V.INTERIOR||h===V.BOUNDARY)&&i._label.setLocation(l,V.INTERIOR)}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(_n),X1=function(r){function t(){r.apply(this,arguments)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.createNode=function(n){return new of(n,new BN)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(ol),uo=function r(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=r.orientation(t)};uo.prototype.compareTo=function(t){var e=t,n=uo.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return n},uo.prototype.interfaces_=function(){return[Pr]},uo.prototype.getClass=function(){return uo},uo.orientation=function(t){return zt.increasingDirection(t)===1},uo.compareOriented=function(t,e,n,i){for(var s=e?1:-1,o=i?1:-1,a=e?t.length:-1,u=i?n.length:-1,l=e?0:t.length-1,h=i?0:n.length-1;;){var c=t[l].compareTo(n[h]);if(c!==0)return c;l+=s,h+=o;var d=l===a,p=h===u;if(d&&!p)return-1;if(!d&&p)return 1;if(d&&p)return 0}};var Xr=function(){this._edges=new tt,this._ocaMap=new mn};Xr.prototype.print=function(t){var e=this;t.print("MULTILINESTRING ( ");for(var n=0;n<this._edges.size();n++){var i=e._edges.get(n);n>0&&t.print(","),t.print("(");for(var s=i.getCoordinates(),o=0;o<s.length;o++)o>0&&t.print(","),t.print(s[o].x+" "+s[o].y);t.println(")")}t.print(") ")},Xr.prototype.addAll=function(t){for(var e=this,n=t.iterator();n.hasNext();)e.add(n.next())},Xr.prototype.findEdgeIndex=function(t){for(var e=this,n=0;n<this._edges.size();n++)if(e._edges.get(n).equals(t))return n;return-1},Xr.prototype.iterator=function(){return this._edges.iterator()},Xr.prototype.getEdges=function(){return this._edges},Xr.prototype.get=function(t){return this._edges.get(t)},Xr.prototype.findEqualEdge=function(t){var e=new uo(t.getCoordinates()),n=this._ocaMap.get(e);return n},Xr.prototype.add=function(t){this._edges.add(t);var e=new uo(t.getCoordinates());this._ocaMap.put(e,t)},Xr.prototype.interfaces_=function(){return[]},Xr.prototype.getClass=function(){return Xr};var Yo=function(){};Yo.prototype.processIntersections=function(t,e,n,i){},Yo.prototype.isDone=function(){},Yo.prototype.interfaces_=function(){return[]},Yo.prototype.getClass=function(){return Yo};var pr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t};pr.prototype.isTrivialIntersection=function(t,e,n,i){if(t===n&&this._li.getIntersectionNum()===1){if(pr.isAdjacentSegments(e,i))return!0;if(t.isClosed()){var s=t.size()-1;if(e===0&&i===s||i===0&&e===s)return!0}}return!1},pr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},pr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},pr.prototype.getLineIntersector=function(){return this._li},pr.prototype.hasProperIntersection=function(){return this._hasProper},pr.prototype.processIntersections=function(t,e,n,i){if(t===n&&e===i)return null;this.numTests++;var s=t.getCoordinates()[e],o=t.getCoordinates()[e+1],a=n.getCoordinates()[i],u=n.getCoordinates()[i+1];this._li.computeIntersection(s,o,a,u),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,n,i)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},pr.prototype.hasIntersection=function(){return this._hasIntersection},pr.prototype.isDone=function(){return!1},pr.prototype.hasInteriorIntersection=function(){return this._hasInterior},pr.prototype.interfaces_=function(){return[Yo]},pr.prototype.getClass=function(){return pr},pr.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var _i=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.coord=new F(t),this.segmentIndex=e,this.dist=n};_i.prototype.getSegmentIndex=function(){return this.segmentIndex},_i.prototype.getCoordinate=function(){return this.coord},_i.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},_i.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},_i.prototype.isEndPoint=function(t){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===t},_i.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},_i.prototype.getDistance=function(){return this.dist},_i.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},_i.prototype.interfaces_=function(){return[Pr]},_i.prototype.getClass=function(){return _i};var Hi=function(){this._nodeMap=new mn,this.edge=null;var t=arguments[0];this.edge=t};Hi.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}},Hi.prototype.iterator=function(){return this._nodeMap.values().iterator()},Hi.prototype.addSplitEdges=function(t){var e=this;this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var s=n.next(),o=e.createSplitEdge(i,s);t.add(o),i=s}},Hi.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},Hi.prototype.createSplitEdge=function(t,e){var n=this,i=e.segmentIndex-t.segmentIndex+2,s=this.edge.pts[e.segmentIndex],o=e.dist>0||!e.coord.equals2D(s);o||i--;var a=new Array(i).fill(null),u=0;a[u++]=new F(t.coord);for(var l=t.segmentIndex+1;l<=e.segmentIndex;l++)a[u++]=n.edge.pts[l];return o&&(a[u]=e.coord),new uf(a,new oe(this.edge._label))},Hi.prototype.add=function(t,e,n){var i=new _i(t,e,n),s=this._nodeMap.get(i);return s!==null?s:(this._nodeMap.put(i,i),i)},Hi.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();if(n.coord.equals(t))return!0}return!1},Hi.prototype.interfaces_=function(){return[]},Hi.prototype.getClass=function(){return Hi};var Jo=function(){};Jo.prototype.getChainStartIndices=function(t){var e=this,n=0,i=new tt;i.add(new ai(n));do{var s=e.findChainEnd(t,n);i.add(new ai(s)),n=s}while(n<t.length-1);var o=Jo.toIntArray(i);return o},Jo.prototype.findChainEnd=function(t,e){for(var n=ue.quadrant(t[e],t[e+1]),i=e+1;i<t.length;){var s=ue.quadrant(t[i-1],t[i]);if(s!==n)break;i++}return i-1},Jo.prototype.interfaces_=function(){return[]},Jo.prototype.getClass=function(){return Jo},Jo.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var Ts=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new gt,this.env2=new gt;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new Jo;this.startIndex=e.getChainStartIndices(this.pts)};Ts.prototype.getCoordinates=function(){return this.pts},Ts.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e>n?e:n},Ts.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e<n?e:n},Ts.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[n],e.startIndex[n+1],i)}else if(arguments.length===6){var s=arguments[0],o=arguments[1],a=arguments[2],u=arguments[3],l=arguments[4],h=arguments[5],c=this.pts[s],d=this.pts[o],p=a.pts[u],g=a.pts[l];if(o-s===1&&l-u===1)return h.addIntersections(this.e,s,a.e,u),null;if(this.env1.init(c,d),this.env2.init(p,g),!this.env1.intersects(this.env2))return null;var y=Math.trunc((s+o)/2),w=Math.trunc((u+l)/2);s<y&&(u<w&&this.computeIntersectsForChain(s,y,a,u,w,h),w<l&&this.computeIntersectsForChain(s,y,a,w,l,h)),y<o&&(u<w&&this.computeIntersectsForChain(y,o,a,u,w,h),w<l&&this.computeIntersectsForChain(y,o,a,w,l,h))}},Ts.prototype.getStartIndexes=function(){return this.startIndex},Ts.prototype.computeIntersects=function(t,e){for(var n=this,i=0;i<this.startIndex.length-1;i++)for(var s=0;s<t.startIndex.length-1;s++)n.computeIntersectsForChain(i,t,s,e)},Ts.prototype.interfaces_=function(){return[]},Ts.prototype.getClass=function(){return Ts};var on=function r(){var t=this;this._depth=Array(2).fill().map(function(){return Array(3)});for(var e=0;e<2;e++)for(var n=0;n<3;n++)t._depth[e][n]=r.NULL_VALUE},Y1={NULL_VALUE:{configurable:!0}};on.prototype.getDepth=function(t,e){return this._depth[t][e]},on.prototype.setDepth=function(t,e,n){this._depth[t][e]=n},on.prototype.isNull=function(){var t=this;if(arguments.length===0){for(var e=0;e<2;e++)for(var n=0;n<3;n++)if(t._depth[e][n]!==on.NULL_VALUE)return!1;return!0}else if(arguments.length===1){var i=arguments[0];return this._depth[i][1]===on.NULL_VALUE}else if(arguments.length===2){var s=arguments[0],o=arguments[1];return this._depth[s][o]===on.NULL_VALUE}},on.prototype.normalize=function(){for(var t=this,e=0;e<2;e++)if(!t.isNull(e)){var n=t._depth[e][1];t._depth[e][2]<n&&(n=t._depth[e][2]),n<0&&(n=0);for(var i=1;i<3;i++){var s=0;t._depth[e][i]>n&&(s=1),t._depth[e][i]=s}}},on.prototype.getDelta=function(t){return this._depth[t][Z.RIGHT]-this._depth[t][Z.LEFT]},on.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?V.EXTERIOR:V.INTERIOR},on.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},on.prototype.add=function(){var t=this;if(arguments.length===1)for(var e=arguments[0],n=0;n<2;n++)for(var i=1;i<3;i++){var s=e.getLocation(n,i);(s===V.EXTERIOR||s===V.INTERIOR)&&(t.isNull(n,i)?t._depth[n][i]=on.depthAtLocation(s):t._depth[n][i]+=on.depthAtLocation(s))}else if(arguments.length===3){var o=arguments[0],a=arguments[1],u=arguments[2];u===V.INTERIOR&&this._depth[o][a]++}},on.prototype.interfaces_=function(){return[]},on.prototype.getClass=function(){return on},on.depthAtLocation=function(t){return t===V.EXTERIOR?0:t===V.INTERIOR?1:on.NULL_VALUE},Y1.NULL_VALUE.get=function(){return-1},Object.defineProperties(on,Y1);var uf=function(r){function t(){if(r.call(this),this.pts=null,this._env=null,this.eiList=new Hi(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new on,this._depthDelta=0,arguments.length===1){var e=arguments[0];t.call(this,e,null)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.pts=n,this._label=i}}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.getDepth=function(){return this._depth},t.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var i=new t(n,oe.toLineLabel(this._label));return i},t.prototype.isIsolated=function(){return this._isIsolated},t.prototype.getCoordinates=function(){return this.pts},t.prototype.setIsolated=function(n){this._isIsolated=n},t.prototype.setName=function(n){this._name=n},t.prototype.equals=function(n){var i=this;if(!(n instanceof t))return!1;var s=n;if(this.pts.length!==s.pts.length)return!1;for(var o=!0,a=!0,u=this.pts.length,l=0;l<this.pts.length;l++)if(i.pts[l].equals2D(s.pts[l])||(o=!1),i.pts[l].equals2D(s.pts[--u])||(a=!1),!o&&!a)return!1;return!0},t.prototype.getCoordinate=function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},t.prototype.print=function(n){var i=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var s=0;s<this.pts.length;s++)s>0&&n.print(","),n.print(i.pts[s].x+" "+i.pts[s].y);n.print(") "+this._label+" "+this._depthDelta)},t.prototype.computeIM=function(n){t.updateIM(this._label,n)},t.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},t.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},t.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},t.prototype.getDepthDelta=function(){return this._depthDelta},t.prototype.getNumPoints=function(){return this.pts.length},t.prototype.printReverse=function(n){var i=this;n.print("edge "+this._name+": ");for(var s=this.pts.length-1;s>=0;s--)n.print(i.pts[s]+" ");n.println("")},t.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new Ts(this)),this._mce},t.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new gt;for(var i=0;i<this.pts.length;i++)n._env.expandToInclude(n.pts[i])}return this._env},t.prototype.addIntersection=function(n,i,s,o){var a=new F(n.getIntersection(o)),u=i,l=n.getEdgeDistance(s,o),h=u+1;if(h<this.pts.length){var c=this.pts[h];a.equals2D(c)&&(u=h,l=0)}this.eiList.add(a,u,l)},t.prototype.toString=function(){var n=this,i=new oi;i.append("edge "+this._name+": "),i.append("LINESTRING (");for(var s=0;s<this.pts.length;s++)s>0&&i.append(","),i.append(n.pts[s].x+" "+n.pts[s].y);return i.append(") "+this._label+" "+this._depthDelta),i.toString()},t.prototype.isPointwiseEqual=function(n){var i=this;if(this.pts.length!==n.pts.length)return!1;for(var s=0;s<this.pts.length;s++)if(!i.pts[s].equals2D(n.pts[s]))return!1;return!0},t.prototype.setDepthDelta=function(n){this._depthDelta=n},t.prototype.getEdgeIntersectionList=function(){return this.eiList},t.prototype.addIntersections=function(n,i,s){for(var o=this,a=0;a<n.getIntersectionNum();a++)o.addIntersection(n,i,s,a)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.updateIM=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];i.setAtLeastIfValid(n.getLocation(0,Z.ON),n.getLocation(1,Z.ON),1),n.isArea()&&(i.setAtLeastIfValid(n.getLocation(0,Z.LEFT),n.getLocation(1,Z.LEFT),2),i.setAtLeastIfValid(n.getLocation(0,Z.RIGHT),n.getLocation(1,Z.RIGHT),2))}else return r.prototype.updateIM.apply(this,arguments)},t}(cr),xn=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Xr,this._bufParams=t||null};xn.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},xn.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(e!==null){var n=e.getLabel(),i=t.getLabel();e.isPointwiseEqual(t)||(i=new oe(t.getLabel()),i.flip()),n.merge(i);var s=xn.depthDelta(i),o=e.getDepthDelta(),a=o+s;e.setDepthDelta(a)}else this._edgeList.add(t),t.setDepthDelta(xn.depthDelta(t.getLabel()))},xn.prototype.buildSubgraphs=function(t,e){for(var n=new tt,i=t.iterator();i.hasNext();){var s=i.next(),o=s.getRightmostCoordinate(),a=new Va(n),u=a.getDepth(o);s.computeDepth(u),s.findResultEdges(),n.add(s),e.add(s.getDirectedEdges(),s.getNodes())}},xn.prototype.createSubgraphs=function(t){for(var e=new tt,n=t.getNodes().iterator();n.hasNext();){var i=n.next();if(!i.isVisited()){var s=new bn;s.create(i),e.add(s)}}return $r.sort(e,$r.reverseOrder()),e},xn.prototype.createEmptyResultGeometry=function(){var t=this._geomFact.createPolygon();return t},xn.prototype.getNoder=function(t){if(this._workingNoder!==null)return this._workingNoder;var e=new tm,n=new Uo;return n.setPrecisionModel(t),e.setSegmentIntersector(new pr(n)),e},xn.prototype.buffer=function(t,e){var n=this._workingPrecisionModel;n===null&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var i=new kn(n,this._bufParams),s=new Or(t,e,i),o=s.getCurves();if(o.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(o,n),this._graph=new xe(new X1),this._graph.addEdges(this._edgeList.getEdges());var a=this.createSubgraphs(this._graph),u=new Yn(this._geomFact);this.buildSubgraphs(a,u);var l=u.getPolygons();if(l.size()<=0)return this.createEmptyResultGeometry();var h=this._geomFact.buildGeometry(l);return h},xn.prototype.computeNodedEdges=function(t,e){var n=this,i=this.getNoder(e);i.computeNodes(t);for(var s=i.getNodedSubstrings(),o=s.iterator();o.hasNext();){var a=o.next(),u=a.getCoordinates();if(!(u.length===2&&u[0].equals2D(u[1]))){var l=a.getData(),h=new uf(a.getCoordinates(),new oe(l));n.insertUniqueEdge(h)}}},xn.prototype.setNoder=function(t){this._workingNoder=t},xn.prototype.interfaces_=function(){return[]},xn.prototype.getClass=function(){return xn},xn.depthDelta=function(t){var e=t.getLocation(0,Z.LEFT),n=t.getLocation(0,Z.RIGHT);return e===V.INTERIOR&&n===V.EXTERIOR?1:e===V.EXTERIOR&&n===V.INTERIOR?-1:0},xn.convertSegStrings=function(t){for(var e=new Ut,n=new tt;t.hasNext();){var i=t.next(),s=e.createLineString(i.getCoordinates());n.add(s)}return e.buildGeometry(n)};var lo=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],o=arguments[3];this._noder=n,this._scaleFactor=i,this._offsetX=s,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};lo.prototype.rescale=function(){var t=this;if(Pt(arguments[0],Ue))for(var e=arguments[0],n=e.iterator();n.hasNext();){var i=n.next();t.rescale(i.getCoordinates())}else if(arguments[0]instanceof Array){for(var s=arguments[0],o=0;o<s.length;o++)s[o].x=s[o].x/t._scaleFactor+t._offsetX,s[o].y=s[o].y/t._scaleFactor+t._offsetY;s.length===2&&s[0].equals2D(s[1])&&sn.out.println(s)}},lo.prototype.scale=function(){var t=this;if(Pt(arguments[0],Ue)){for(var e=arguments[0],n=new tt,i=e.iterator();i.hasNext();){var s=i.next();n.add(new Re(t.scale(s.getCoordinates()),s.getData()))}return n}else if(arguments[0]instanceof Array){for(var o=arguments[0],a=new Array(o.length).fill(null),u=0;u<o.length;u++)a[u]=new F(Math.round((o[u].x-t._offsetX)*t._scaleFactor),Math.round((o[u].y-t._offsetY)*t._scaleFactor),o[u].z);var l=zt.removeRepeatedPoints(a);return l}},lo.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},lo.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},lo.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},lo.prototype.interfaces_=function(){return[$o]},lo.prototype.getClass=function(){return lo};var yi=function(){this._li=new Uo,this._segStrings=null;var t=arguments[0];this._segStrings=t},J1={fact:{configurable:!0}};yi.prototype.checkEndPtVertexIntersections=function(){var t=this;if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();){var n=e.next(),i=n.getCoordinates();t.checkEndPtVertexIntersections(i[0],t._segStrings),t.checkEndPtVertexIntersections(i[i.length-1],t._segStrings)}else if(arguments.length===2){for(var s=arguments[0],o=arguments[1],a=o.iterator();a.hasNext();)for(var u=a.next(),l=u.getCoordinates(),h=1;h<l.length-1;h++)if(l[h].equals(s))throw new ws("found endpt/interior pt intersection at index "+h+" :pt "+s)}},yi.prototype.checkInteriorIntersections=function(){var t=this;if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();)for(var n=e.next(),i=this._segStrings.iterator();i.hasNext();){var s=i.next();t.checkInteriorIntersections(n,s)}else if(arguments.length===2)for(var o=arguments[0],a=arguments[1],u=o.getCoordinates(),l=a.getCoordinates(),h=0;h<u.length-1;h++)for(var c=0;c<l.length-1;c++)t.checkInteriorIntersections(o,h,a,c);else if(arguments.length===4){var d=arguments[0],p=arguments[1],g=arguments[2],y=arguments[3];if(d===g&&p===y)return null;var w=d.getCoordinates()[p],b=d.getCoordinates()[p+1],m=g.getCoordinates()[y],E=g.getCoordinates()[y+1];if(this._li.computeIntersection(w,b,m,E),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,w,b)||this.hasInteriorIntersection(this._li,m,E)))throw new ws("found non-noded intersection at "+w+"-"+b+" and "+m+"-"+E)}},yi.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},yi.prototype.checkCollapses=function(){var t=this;if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();){var n=e.next();t.checkCollapses(n)}else if(arguments.length===1)for(var i=arguments[0],s=i.getCoordinates(),o=0;o<s.length-2;o++)t.checkCollapse(s[o],s[o+1],s[o+2])},yi.prototype.hasInteriorIntersection=function(t,e,n){for(var i=0;i<t.getIntersectionNum();i++){var s=t.getIntersection(i);if(!(s.equals(e)||s.equals(n)))return!0}return!1},yi.prototype.checkCollapse=function(t,e,n){if(t.equals(n))throw new ws("found non-noded collapse at "+yi.fact.createLineString([t,e,n]))},yi.prototype.interfaces_=function(){return[]},yi.prototype.getClass=function(){return yi},J1.fact.get=function(){return new Ut},Object.defineProperties(yi,J1);var Gn=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],n=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=n,e<=0)throw new Ce("Scale factor must be non-zero");e!==1&&(this._pt=new F(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new F,this._p1Scaled=new F),this.initCorners(this._pt)},Z1={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Gn.prototype.intersectsScaled=function(t,e){var n=Math.min(t.x,e.x),i=Math.max(t.x,e.x),s=Math.min(t.y,e.y),o=Math.max(t.y,e.y),a=this._maxx<n||this._minx>i||this._maxy<s||this._miny>o;if(a)return!1;var u=this.intersectsToleranceSquare(t,e);return Ft.isTrue(!(a&&u),"Found bad envelope test"),u},Gn.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new F(this._maxx,this._maxy),this._corner[1]=new F(this._minx,this._maxy),this._corner[2]=new F(this._minx,this._miny),this._corner[3]=new F(this._maxx,this._miny)},Gn.prototype.intersects=function(t,e){return this._scaleFactor===1?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},Gn.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},Gn.prototype.getCoordinate=function(){return this._originalPt},Gn.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},Gn.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=Gn.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new gt(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},Gn.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))},Gn.prototype.intersectsToleranceSquare=function(t,e){var n=!1,i=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper())||n&&i||t.equals(this._pt)||e.equals(this._pt))},Gn.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),i=t.getCoordinate(e+1);return this.intersects(n,i)?(t.addIntersection(this.getCoordinate(),e),!0):!1},Gn.prototype.interfaces_=function(){return[]},Gn.prototype.getClass=function(){return Gn},Z1.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(Gn,Z1);var vc=function(){this.tempEnv1=new gt,this.selectedSegment=new mt};vc.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}}},vc.prototype.interfaces_=function(){return[]},vc.prototype.getClass=function(){return vc};var hl=function(){this._index=null;var t=arguments[0];this._index=t},K1={HotPixelSnapAction:{configurable:!0}};hl.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}else if(arguments.length===3){var e=arguments[0],n=arguments[1],i=arguments[2],s=e.getSafeEnvelope(),o=new Q1(e,n,i);return this._index.query(s,{interfaces_:function(){return[oo]},visitItem:function(a){var u=a;u.select(s,o)}}),o.isNodeAdded()}},hl.prototype.interfaces_=function(){return[]},hl.prototype.getClass=function(){return hl},K1.HotPixelSnapAction.get=function(){return Q1},Object.defineProperties(hl,K1);var Q1=function(r){function t(){r.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],n=arguments[1],i=arguments[2];this._hotPixel=e,this._parentEdge=n,this._hotPixelVertexIndex=i}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.isNodeAdded=function(){return this._isNodeAdded},t.prototype.select=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=n.getContext();if(this._parentEdge!==null&&s===this._parentEdge&&i===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(s,i)}else return r.prototype.select.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(vc),Ba=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new tt};Ba.prototype.processIntersections=function(t,e,n,i){var s=this;if(t===n&&e===i)return null;var o=t.getCoordinates()[e],a=t.getCoordinates()[e+1],u=n.getCoordinates()[i],l=n.getCoordinates()[i+1];if(this._li.computeIntersection(o,a,u,l),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var h=0;h<this._li.getIntersectionNum();h++)s._interiorIntersections.add(s._li.getIntersection(h));t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1)}},Ba.prototype.isDone=function(){return!1},Ba.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Ba.prototype.interfaces_=function(){return[Yo]},Ba.prototype.getClass=function(){return Ba};var $i=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new Uo,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};$i.prototype.checkCorrectness=function(t){var e=Re.getNodedSubstrings(t),n=new yi(e);try{n.checkValid()}catch(i){if(i instanceof D1)i.printStackTrace();else throw i}finally{}},$i.prototype.getNodedSubstrings=function(){return Re.getNodedSubstrings(this._nodedSegStrings)},$i.prototype.snapRound=function(t,e){var n=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(n),this.computeVertexSnaps(t)},$i.prototype.findInteriorIntersections=function(t,e){var n=new Ba(e);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(t),n.getInteriorIntersections()},$i.prototype.computeVertexSnaps=function(){var t=this;if(Pt(arguments[0],Ue))for(var e=arguments[0],n=e.iterator();n.hasNext();){var i=n.next();t.computeVertexSnaps(i)}else if(arguments[0]instanceof Re)for(var s=arguments[0],o=s.getCoordinates(),a=0;a<o.length;a++){var u=new Gn(o[a],t._scaleFactor,t._li),l=t._pointSnapper.snap(u,s,a);l&&s.addIntersection(o[a],a)}},$i.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new tm,this._pointSnapper=new hl(this._noder.getIndex()),this.snapRound(t,this._li)},$i.prototype.computeIntersectionSnaps=function(t){for(var e=this,n=t.iterator();n.hasNext();){var i=n.next(),s=new Gn(i,e._scaleFactor,e._li);e._pointSnapper.snap(s)}},$i.prototype.interfaces_=function(){return[$o]},$i.prototype.getClass=function(){return $i};var an=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new re,this._resultGeometry=null,this._saveException=null,arguments.length===1){var t=arguments[0];this._argGeom=t}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this._argGeom=e,this._bufParams=n}},cl={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};an.prototype.bufferFixedPrecision=function(t){var e=new lo(new $i(new ne(1)),t.getScale()),n=new xn(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)},an.prototype.bufferReducedPrecision=function(){var t=this;if(arguments.length===0){for(var e=an.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(o){if(o instanceof xs)t._saveException=o;else throw o}finally{}if(t._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],i=an.precisionScaleFactor(this._argGeom,this._distance,n),s=new ne(i);this.bufferFixedPrecision(s)}},an.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===ne.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},an.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},an.prototype.bufferOriginalPrecision=function(){try{var t=new xn(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof ws)this._saveException=e;else throw e}finally{}},an.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},an.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},an.prototype.interfaces_=function(){return[]},an.prototype.getClass=function(){return an},an.bufferOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new an(t),i=n.getResultGeometry(e);return i}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof bt&&typeof arguments[1]=="number"){var s=arguments[0],o=arguments[1],a=arguments[2],u=new an(s);u.setQuadrantSegments(a);var l=u.getResultGeometry(o);return l}else if(arguments[2]instanceof re&&arguments[0]instanceof bt&&typeof arguments[1]=="number"){var h=arguments[0],c=arguments[1],d=arguments[2],p=new an(h,d),g=p.getResultGeometry(c);return g}}else if(arguments.length===4){var y=arguments[0],w=arguments[1],b=arguments[2],m=arguments[3],E=new an(y);E.setQuadrantSegments(b),E.setEndCapStyle(m);var _=E.getResultGeometry(w);return _}},an.precisionScaleFactor=function(t,e,n){var i=t.getEnvelopeInternal(),s=hr.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY())),o=e>0?e:0,a=s+2*o,u=Math.trunc(Math.log(a)/Math.log(10)+1),l=n-u,h=Math.pow(10,l);return h},cl.CAP_ROUND.get=function(){return re.CAP_ROUND},cl.CAP_BUTT.get=function(){return re.CAP_FLAT},cl.CAP_FLAT.get=function(){return re.CAP_FLAT},cl.CAP_SQUARE.get=function(){return re.CAP_SQUARE},cl.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(an,cl);var In=function(){this._pt=[new F,new F],this._distance=Tt.NaN,this._isNull=!0};In.prototype.getCoordinates=function(){return this._pt},In.prototype.getCoordinate=function(t){return this._pt[t]},In.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var i=e.distance(n);i<this._distance&&this.initialize(e,n,i)}},In.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=s,this._isNull=!1}},In.prototype.getDistance=function(){return this._distance},In.prototype.setMaximum=function(){if(arguments.length===1){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var i=e.distance(n);i>this._distance&&this.initialize(e,n,i)}},In.prototype.interfaces_=function(){return[]},In.prototype.getClass=function(){return In};var Xi=function(){};Xi.prototype.interfaces_=function(){return[]},Xi.prototype.getClass=function(){return Xi},Xi.computeDistance=function(){if(arguments[2]instanceof In&&arguments[0]instanceof Me&&arguments[1]instanceof F)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=t.getCoordinates(),s=new mt,o=0;o<i.length-1;o++){s.setCoordinates(i[o],i[o+1]);var a=s.closestPoint(e);n.setMinimum(a,e)}else if(arguments[2]instanceof In&&arguments[0]instanceof qe&&arguments[1]instanceof F){var u=arguments[0],l=arguments[1],h=arguments[2];Xi.computeDistance(u.getExteriorRing(),l,h);for(var c=0;c<u.getNumInteriorRing();c++)Xi.computeDistance(u.getInteriorRingN(c),l,h)}else if(arguments[2]instanceof In&&arguments[0]instanceof bt&&arguments[1]instanceof F){var d=arguments[0],p=arguments[1],g=arguments[2];if(d instanceof Me)Xi.computeDistance(d,p,g);else if(d instanceof qe)Xi.computeDistance(d,p,g);else if(d instanceof Cn)for(var y=d,w=0;w<y.getNumGeometries();w++){var b=y.getGeometryN(w);Xi.computeDistance(b,p,g)}else g.setMinimum(d.getCoordinate(),p)}else if(arguments[2]instanceof In&&arguments[0]instanceof mt&&arguments[1]instanceof F){var m=arguments[0],E=arguments[1],_=arguments[2],S=m.closestPoint(E);_.setMinimum(S,E)}};var Zo=function(t){this._maxPtDist=new In,this._inputGeom=t||null},em={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Zo.prototype.computeMaxMidpointDistance=function(t){var e=new ho(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Zo.prototype.computeMaxVertexDistance=function(t){var e=new za(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Zo.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},Zo.prototype.getDistancePoints=function(){return this._maxPtDist},Zo.prototype.interfaces_=function(){return[]},Zo.prototype.getClass=function(){return Zo},em.MaxPointDistanceFilter.get=function(){return za},em.MaxMidpointDistanceFilter.get=function(){return ho},Object.defineProperties(Zo,em);var za=function(t){this._maxPtDist=new In,this._minPtDist=new In,this._geom=t||null};za.prototype.filter=function(t){this._minPtDist.initialize(),Xi.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},za.prototype.getMaxPointDistance=function(){return this._maxPtDist},za.prototype.interfaces_=function(){return[Vi]},za.prototype.getClass=function(){return za};var ho=function(t){this._maxPtDist=new In,this._minPtDist=new In,this._geom=t||null};ho.prototype.filter=function(t,e){if(e===0)return null;var n=t.getCoordinate(e-1),i=t.getCoordinate(e),s=new F((n.x+i.x)/2,(n.y+i.y)/2);this._minPtDist.initialize(),Xi.computeDistance(this._geom,s,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},ho.prototype.isDone=function(){return!1},ho.prototype.isGeometryChanged=function(){return!1},ho.prototype.getMaxPointDistance=function(){return this._maxPtDist},ho.prototype.interfaces_=function(){return[Wr]},ho.prototype.getClass=function(){return ho};var Ns=function(t){this._comps=t||null};Ns.prototype.filter=function(t){t instanceof qe&&this._comps.add(t)},Ns.prototype.interfaces_=function(){return[ci]},Ns.prototype.getClass=function(){return Ns},Ns.getPolygons=function(){if(arguments.length===1){var t=arguments[0];return Ns.getPolygons(t,new tt)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof qe?n.add(e):e instanceof Cn&&e.apply(new Ns(n)),n}};var un=function(){if(this._lines=null,this._isForcedToLineString=!1,arguments.length===1){var t=arguments[0];this._lines=t}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this._lines=e,this._isForcedToLineString=n}};un.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof Bi){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof Me&&this._lines.add(t)},un.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},un.prototype.interfaces_=function(){return[Es]},un.prototype.getClass=function(){return un},un.getGeometry=function(){if(arguments.length===1){var t=arguments[0];return t.getFactory().buildGeometry(un.getLines(t))}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e.getFactory().buildGeometry(un.getLines(e,n))}},un.getLines=function(){if(arguments.length===1){var t=arguments[0];return un.getLines(t,!1)}else if(arguments.length===2){if(Pt(arguments[0],Ue)&&Pt(arguments[1],Ue)){for(var e=arguments[0],n=arguments[1],i=e.iterator();i.hasNext();){var s=i.next();un.getLines(s,n)}return n}else if(arguments[0]instanceof bt&&typeof arguments[1]=="boolean"){var o=arguments[0],a=arguments[1],u=new tt;return o.apply(new un(u,a)),u}else if(arguments[0]instanceof bt&&Pt(arguments[1],Ue)){var l=arguments[0],h=arguments[1];return l instanceof Me?h.add(l):l.apply(new un(h)),h}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&Pt(arguments[0],Ue)&&Pt(arguments[1],Ue)){for(var c=arguments[0],d=arguments[1],p=arguments[2],g=c.iterator();g.hasNext();){var y=g.next();un.getLines(y,d,p)}return d}else if(typeof arguments[2]=="boolean"&&arguments[0]instanceof bt&&Pt(arguments[1],Ue)){var w=arguments[0],b=arguments[1],m=arguments[2];return w.apply(new un(b,m)),b}}};var Yr=function(){if(this._boundaryRule=Ir.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];if(t===null)throw new Ce("Rule must be non-null");this._boundaryRule=t}}};Yr.prototype.locateInternal=function(){var t=this;if(arguments[0]instanceof F&&arguments[1]instanceof qe){var e=arguments[0],n=arguments[1];if(n.isEmpty())return V.EXTERIOR;var i=n.getExteriorRing(),s=this.locateInPolygonRing(e,i);if(s===V.EXTERIOR)return V.EXTERIOR;if(s===V.BOUNDARY)return V.BOUNDARY;for(var o=0;o<n.getNumInteriorRing();o++){var a=n.getInteriorRingN(o),u=t.locateInPolygonRing(e,a);if(u===V.INTERIOR)return V.EXTERIOR;if(u===V.BOUNDARY)return V.BOUNDARY}return V.INTERIOR}else if(arguments[0]instanceof F&&arguments[1]instanceof Me){var l=arguments[0],h=arguments[1];if(!h.getEnvelopeInternal().intersects(l))return V.EXTERIOR;var c=h.getCoordinates();return!h.isClosed()&&(l.equals(c[0])||l.equals(c[c.length-1]))?V.BOUNDARY:rt.isOnLine(l,c)?V.INTERIOR:V.EXTERIOR}else if(arguments[0]instanceof F&&arguments[1]instanceof Xn){var d=arguments[0],p=arguments[1],g=p.getCoordinate();return g.equals2D(d)?V.INTERIOR:V.EXTERIOR}},Yr.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?rt.locatePointInRing(t,e.getCoordinates()):V.EXTERIOR},Yr.prototype.intersects=function(t,e){return this.locate(t,e)!==V.EXTERIOR},Yr.prototype.updateLocationInfo=function(t){t===V.INTERIOR&&(this._isIn=!0),t===V.BOUNDARY&&this._numBoundaries++},Yr.prototype.computeLocation=function(t,e){var n=this;if(e instanceof Xn&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof Me)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof qe)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof Ho)for(var i=e,s=0;s<i.getNumGeometries();s++){var o=i.getGeometryN(s);n.updateLocationInfo(n.locateInternal(t,o))}else if(e instanceof zi)for(var a=e,u=0;u<a.getNumGeometries();u++){var l=a.getGeometryN(u);n.updateLocationInfo(n.locateInternal(t,l))}else if(e instanceof Cn)for(var h=new Wi(e);h.hasNext();){var c=h.next();c!==e&&n.computeLocation(t,c)}},Yr.prototype.locate=function(t,e){return e.isEmpty()?V.EXTERIOR:e instanceof Me?this.locateInternal(t,e):e instanceof qe?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?V.BOUNDARY:this._numBoundaries>0||this._isIn?V.INTERIOR:V.EXTERIOR)},Yr.prototype.interfaces_=function(){return[]},Yr.prototype.getClass=function(){return Yr};var Mn=function r(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var t=arguments[0],e=arguments[1];r.call(this,t,r.INSIDE_AREA,e)}else if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];this._component=n,this._segIndex=i,this._pt=s}},tw={INSIDE_AREA:{configurable:!0}};Mn.prototype.isInsideArea=function(){return this._segIndex===Mn.INSIDE_AREA},Mn.prototype.getCoordinate=function(){return this._pt},Mn.prototype.getGeometryComponent=function(){return this._component},Mn.prototype.getSegmentIndex=function(){return this._segIndex},Mn.prototype.interfaces_=function(){return[]},Mn.prototype.getClass=function(){return Mn},tw.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Mn,tw);var co=function(t){this._pts=t||null};co.prototype.filter=function(t){t instanceof Xn&&this._pts.add(t)},co.prototype.interfaces_=function(){return[ci]},co.prototype.getClass=function(){return co},co.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof Xn?$r.singletonList(t):co.getPoints(t,new tt)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof Xn?n.add(e):e instanceof Cn&&e.apply(new co(n)),n}};var Ua=function(){this._locations=null;var t=arguments[0];this._locations=t};Ua.prototype.filter=function(t){(t instanceof Xn||t instanceof Me||t instanceof qe)&&this._locations.add(new Mn(t,0,t.getCoordinate()))},Ua.prototype.interfaces_=function(){return[ci]},Ua.prototype.getClass=function(){return Ua},Ua.getLocations=function(t){var e=new tt;return t.apply(new Ua(e)),e};var ln=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Yr,this._minDistanceLocation=null,this._minDistance=Tt.MAX_VALUE,arguments.length===2){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i,this._terminateDistance=s}};ln.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(arguments.length===2){var n=arguments[0],i=arguments[1],s=1-n,o=Ns.getPolygons(this._geom[n]);if(o.size()>0){var a=Ua.getLocations(this._geom[s]);if(this.computeContainmentDistance(a,o,i),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[s]=i[0],this._minDistanceLocation[n]=i[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Pt(arguments[0],Ur)&&Pt(arguments[1],Ur)){for(var u=arguments[0],l=arguments[1],h=arguments[2],c=0;c<u.size();c++)for(var d=u.get(c),p=0;p<l.size();p++)if(t.computeContainmentDistance(d,l.get(p),h),t._minDistance<=t._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof Mn&&arguments[1]instanceof qe){var g=arguments[0],y=arguments[1],w=arguments[2],b=g.getCoordinate();if(V.EXTERIOR!==this._ptLocator.locate(b,y))return this._minDistance=0,w[0]=g,w[1]=new Mn(y,b),null}}},ln.prototype.computeMinDistanceLinesPoints=function(t,e,n){for(var i=this,s=0;s<t.size();s++)for(var o=t.get(s),a=0;a<e.size();a++){var u=e.get(a);if(i.computeMinDistance(o,u,n),i._minDistance<=i._terminateDistance)return null}},ln.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=un.getLines(this._geom[0]),n=un.getLines(this._geom[1]),i=co.getPoints(this._geom[0]),s=co.getPoints(this._geom[1]);if(this.computeMinDistanceLines(e,n,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance||(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,s,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance)||(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(n,i,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance))return null;t[0]=null,t[1]=null,this.computeMinDistancePoints(i,s,t),this.updateMinDistance(t,!1)},ln.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},ln.prototype.updateMinDistance=function(t,e){if(t[0]===null)return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},ln.prototype.nearestPoints=function(){this.computeMinDistance();var t=[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()];return t},ln.prototype.computeMinDistance=function(){var t=this;if(arguments.length===0){if(this._minDistanceLocation!==null||(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance))return null;this.computeFacetDistance()}else if(arguments.length===3){if(arguments[2]instanceof Array&&arguments[0]instanceof Me&&arguments[1]instanceof Xn){var e=arguments[0],n=arguments[1],i=arguments[2];if(e.getEnvelopeInternal().distance(n.getEnvelopeInternal())>this._minDistance)return null;for(var s=e.getCoordinates(),o=n.getCoordinate(),a=0;a<s.length-1;a++){var u=rt.distancePointLine(o,s[a],s[a+1]);if(u<t._minDistance){t._minDistance=u;var l=new mt(s[a],s[a+1]),h=l.closestPoint(o);i[0]=new Mn(e,a,h),i[1]=new Mn(n,0,o)}if(t._minDistance<=t._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof Me&&arguments[1]instanceof Me){var c=arguments[0],d=arguments[1],p=arguments[2];if(c.getEnvelopeInternal().distance(d.getEnvelopeInternal())>this._minDistance)return null;for(var g=c.getCoordinates(),y=d.getCoordinates(),w=0;w<g.length-1;w++)for(var b=0;b<y.length-1;b++){var m=rt.distanceLineLine(g[w],g[w+1],y[b],y[b+1]);if(m<t._minDistance){t._minDistance=m;var E=new mt(g[w],g[w+1]),_=new mt(y[b],y[b+1]),S=E.closestPoints(_);p[0]=new Mn(c,w,S[0]),p[1]=new Mn(d,b,S[1])}if(t._minDistance<=t._terminateDistance)return null}}}},ln.prototype.computeMinDistancePoints=function(t,e,n){for(var i=this,s=0;s<t.size();s++)for(var o=t.get(s),a=0;a<e.size();a++){var u=e.get(a),l=o.getCoordinate().distance(u.getCoordinate());if(l<i._minDistance&&(i._minDistance=l,n[0]=new Mn(o,0,o.getCoordinate()),n[1]=new Mn(u,0,u.getCoordinate())),i._minDistance<=i._terminateDistance)return null}},ln.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new Ce("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},ln.prototype.computeMinDistanceLines=function(t,e,n){for(var i=this,s=0;s<t.size();s++)for(var o=t.get(s),a=0;a<e.size();a++){var u=e.get(a);if(i.computeMinDistance(o,u,n),i._minDistance<=i._terminateDistance)return null}},ln.prototype.interfaces_=function(){return[]},ln.prototype.getClass=function(){return ln},ln.distance=function(t,e){var n=new ln(t,e);return n.distance()},ln.isWithinDistance=function(t,e,n){var i=new ln(t,e,n);return i.distance()<=n},ln.nearestPoints=function(t,e){var n=new ln(t,e);return n.nearestPoints()};var yn=function(){this._pt=[new F,new F],this._distance=Tt.NaN,this._isNull=!0};yn.prototype.getCoordinates=function(){return this._pt},yn.prototype.getCoordinate=function(t){return this._pt[t]},yn.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var i=e.distance(n);i<this._distance&&this.initialize(e,n,i)}},yn.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=s,this._isNull=!1}},yn.prototype.toString=function(){return zr.toLineString(this._pt[0],this._pt[1])},yn.prototype.getDistance=function(){return this._distance},yn.prototype.setMaximum=function(){if(arguments.length===1){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var i=e.distance(n);i>this._distance&&this.initialize(e,n,i)}},yn.prototype.interfaces_=function(){return[]},yn.prototype.getClass=function(){return yn};var wi=function(){};wi.prototype.interfaces_=function(){return[]},wi.prototype.getClass=function(){return wi},wi.computeDistance=function(){if(arguments[2]instanceof yn&&arguments[0]instanceof Me&&arguments[1]instanceof F)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=new mt,s=t.getCoordinates(),o=0;o<s.length-1;o++){i.setCoordinates(s[o],s[o+1]);var a=i.closestPoint(e);n.setMinimum(a,e)}else if(arguments[2]instanceof yn&&arguments[0]instanceof qe&&arguments[1]instanceof F){var u=arguments[0],l=arguments[1],h=arguments[2];wi.computeDistance(u.getExteriorRing(),l,h);for(var c=0;c<u.getNumInteriorRing();c++)wi.computeDistance(u.getInteriorRingN(c),l,h)}else if(arguments[2]instanceof yn&&arguments[0]instanceof bt&&arguments[1]instanceof F){var d=arguments[0],p=arguments[1],g=arguments[2];if(d instanceof Me)wi.computeDistance(d,p,g);else if(d instanceof qe)wi.computeDistance(d,p,g);else if(d instanceof Cn)for(var y=d,w=0;w<y.getNumGeometries();w++){var b=y.getGeometryN(w);wi.computeDistance(b,p,g)}else g.setMinimum(d.getCoordinate(),p)}else if(arguments[2]instanceof yn&&arguments[0]instanceof mt&&arguments[1]instanceof F){var m=arguments[0],E=arguments[1],_=arguments[2],S=m.closestPoint(E);_.setMinimum(S,E)}};var Dr=function(){this._g0=null,this._g1=null,this._ptDist=new yn,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},nm={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};Dr.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},Dr.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new Ce("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},Dr.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},Dr.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Dr.prototype.computeOrientedDistance=function(t,e,n){var i=new qa(e);if(t.apply(i),n.setMaximum(i.getMaxPointDistance()),this._densifyFrac>0){var s=new fo(e,this._densifyFrac);t.apply(s),n.setMaximum(s.getMaxPointDistance())}},Dr.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Dr.prototype.interfaces_=function(){return[]},Dr.prototype.getClass=function(){return Dr},Dr.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new Dr(t,e);return n.distance()}else if(arguments.length===3){var i=arguments[0],s=arguments[1],o=arguments[2],a=new Dr(i,s);return a.setDensifyFraction(o),a.distance()}},nm.MaxPointDistanceFilter.get=function(){return qa},nm.MaxDensifiedByFractionDistanceFilter.get=function(){return fo},Object.defineProperties(Dr,nm);var qa=function(){this._maxPtDist=new yn,this._minPtDist=new yn,this._euclideanDist=new wi,this._geom=null;var t=arguments[0];this._geom=t};qa.prototype.filter=function(t){this._minPtDist.initialize(),wi.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},qa.prototype.getMaxPointDistance=function(){return this._maxPtDist},qa.prototype.interfaces_=function(){return[Vi]},qa.prototype.getClass=function(){return qa};var fo=function(){this._maxPtDist=new yn,this._minPtDist=new yn,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};fo.prototype.filter=function(t,e){var n=this;if(e===0)return null;for(var i=t.getCoordinate(e-1),s=t.getCoordinate(e),o=(s.x-i.x)/this._numSubSegs,a=(s.y-i.y)/this._numSubSegs,u=0;u<this._numSubSegs;u++){var l=i.x+u*o,h=i.y+u*a,c=new F(l,h);n._minPtDist.initialize(),wi.computeDistance(n._geom,c,n._minPtDist),n._maxPtDist.setMaximum(n._minPtDist)}},fo.prototype.isDone=function(){return!1},fo.prototype.isGeometryChanged=function(){return!1},fo.prototype.getMaxPointDistance=function(){return this._maxPtDist},fo.prototype.interfaces_=function(){return[Wr]},fo.prototype.getClass=function(){return fo};var Zn=function(t,e,n){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._bufDistance=e||null,this._result=n||null},rm={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Zn.prototype.checkMaximumDistance=function(t,e,n){var i=new Dr(e,t);if(i.setDensifyFraction(.25),this._maxDistanceFound=i.orientedDistance(),this._maxDistanceFound>n){this._isValid=!1;var s=i.getCoordinates();this._errorLocation=s[1],this._errorIndicator=t.getFactory().createLineString(s),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+zr.toLineString(s[0],s[1])+")"}},Zn.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=Zn.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Zn.VERBOSE&&sn.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Zn.prototype.checkNegativeValid=function(){if(!(this._input instanceof qe||this._input instanceof zi||this._input instanceof Cn))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)},Zn.prototype.getErrorIndicator=function(){return this._errorIndicator},Zn.prototype.checkMinimumDistance=function(t,e,n){var i=new ln(t,e,n);if(this._minDistanceFound=i.distance(),this._minDistanceFound<n){this._isValid=!1;var s=i.nearestPoints();this._errorLocation=i.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(s),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+zr.toLineString(s[0],s[1])+" )"}},Zn.prototype.checkPositiveValid=function(){var t=this._result.getBoundary();if(this.checkMinimumDistance(this._input,t,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,t,this._maxValidDistance)},Zn.prototype.getErrorLocation=function(){return this._errorLocation},Zn.prototype.getPolygonLines=function(t){for(var e=new tt,n=new un(e),i=Ns.getPolygons(t),s=i.iterator();s.hasNext();){var o=s.next();o.apply(n)}return t.getFactory().buildGeometry(e)},Zn.prototype.getErrorMessage=function(){return this._errMsg},Zn.prototype.interfaces_=function(){return[]},Zn.prototype.getClass=function(){return Zn},rm.VERBOSE.get=function(){return!1},rm.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Zn,rm);var hn=function(t,e,n){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=n||null},im={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};hn.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},hn.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*hn.MAX_ENV_DIFF_FRAC;t===0&&(t=.001);var e=new gt(this._input.getEnvelopeInternal());e.expandBy(this._distance);var n=new gt(this._result.getEnvelopeInternal());n.expandBy(t),n.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(n)),this.report("Envelope")},hn.prototype.checkDistance=function(){var t=new Zn(this._input,this._distance,this._result);t.isValid()||(this._isValid=!1,this._errorMsg=t.getErrorMessage(),this._errorLocation=t.getErrorLocation(),this._errorIndicator=t.getErrorIndicator()),this.report("Distance")},hn.prototype.checkArea=function(){var t=this._input.getArea(),e=this._result.getArea();this._distance>0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t<e&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},hn.prototype.checkPolygonal=function(){this._result instanceof qe||this._result instanceof zi||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},hn.prototype.getErrorIndicator=function(){return this._errorIndicator},hn.prototype.getErrorLocation=function(){return this._errorLocation},hn.prototype.checkExpectedEmpty=function(){if(this._input.getDimension()>=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")},hn.prototype.report=function(t){if(!hn.VERBOSE)return null;sn.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},hn.prototype.getErrorMessage=function(){return this._errorMsg},hn.prototype.interfaces_=function(){return[]},hn.prototype.getClass=function(){return hn},hn.isValidMsg=function(t,e,n){var i=new hn(t,e,n);return i.isValid()?null:i.getErrorMessage()},hn.isValid=function(t,e,n){var i=new hn(t,e,n);return!!i.isValid()},im.VERBOSE.get=function(){return!1},im.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(hn,im);var Ei=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Ei.prototype.getCoordinates=function(){return this._pts},Ei.prototype.size=function(){return this._pts.length},Ei.prototype.getCoordinate=function(t){return this._pts[t]},Ei.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Ei.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Ga.octant(this.getCoordinate(t),this.getCoordinate(t+1))},Ei.prototype.setData=function(t){this._data=t},Ei.prototype.getData=function(){return this._data},Ei.prototype.toString=function(){return zr.toLineString(new Ae(this._pts))},Ei.prototype.interfaces_=function(){return[qi]},Ei.prototype.getClass=function(){return Ei};var Qe=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new tt,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};Qe.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Qe.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},Qe.prototype.getIntersectionSegments=function(){return this._intSegments},Qe.prototype.count=function(){return this._intersectionCount},Qe.prototype.getIntersections=function(){return this._intersections},Qe.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Qe.prototype.setKeepIntersections=function(t){this._keepIntersections=t},Qe.prototype.processIntersections=function(t,e,n,i){if(!this._findAllIntersections&&this.hasIntersection()||t===n&&e===i)return null;if(this._isCheckEndSegmentsOnly){var s=this.isEndSegment(t,e)||this.isEndSegment(n,i);if(!s)return null}var o=t.getCoordinates()[e],a=t.getCoordinates()[e+1],u=n.getCoordinates()[i],l=n.getCoordinates()[i+1];this._li.computeIntersection(o,a,u,l),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=o,this._intSegments[1]=a,this._intSegments[2]=u,this._intSegments[3]=l,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},Qe.prototype.isEndSegment=function(t,e){return e===0||e>=t.size()-2},Qe.prototype.hasIntersection=function(){return this._interiorIntersection!==null},Qe.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null},Qe.prototype.interfaces_=function(){return[Yo]},Qe.prototype.getClass=function(){return Qe},Qe.createAllIntersectionsFinder=function(t){var e=new Qe(t);return e.setFindAllIntersections(!0),e},Qe.createAnyIntersectionFinder=function(t){return new Qe(t)},Qe.createIntersectionCounter=function(t){var e=new Qe(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Jr=function(){this._li=new Uo,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Jr.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},Jr.prototype.getIntersections=function(){return this._segInt.getIntersections()},Jr.prototype.isValid=function(){return this.execute(),this._isValid},Jr.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Jr.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Qe(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new tm;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Jr.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new xs(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Jr.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+zr.toLineString(t[0],t[1])+" and "+zr.toLineString(t[2],t[3])},Jr.prototype.interfaces_=function(){return[]},Jr.prototype.getClass=function(){return Jr},Jr.computeIntersections=function(t){var e=new Jr(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var Ko=function r(){this._nv=null;var t=arguments[0];this._nv=new Jr(r.toSegmentStrings(t))};Ko.prototype.checkValid=function(){this._nv.checkValid()},Ko.prototype.interfaces_=function(){return[]},Ko.prototype.getClass=function(){return Ko},Ko.toSegmentStrings=function(t){for(var e=new tt,n=t.iterator();n.hasNext();){var i=n.next();e.add(new Ei(i.getCoordinates(),i))}return e},Ko.checkValid=function(t){var e=new Ko(t);e.checkValid()};var Wa=function(t){this._mapOp=t};Wa.prototype.map=function(t){for(var e=this,n=new tt,i=0;i<t.getNumGeometries();i++){var s=e._mapOp.map(t.getGeometryN(i));s.isEmpty()||n.add(s)}return t.getFactory().createGeometryCollection(Ut.toGeometryArray(n))},Wa.prototype.interfaces_=function(){return[]},Wa.prototype.getClass=function(){return Wa},Wa.map=function(t,e){var n=new Wa(e);return n.map(t)};var Si=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new tt,this._resultLineList=new tt;var t=arguments[0],e=arguments[1],n=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=n};Si.prototype.collectLines=function(t){for(var e=this,n=this._op.getGraph().getEdgeEnds().iterator();n.hasNext();){var i=n.next();e.collectLineEdge(i,t,e._lineEdgesList),e.collectBoundaryTouchEdge(i,t,e._lineEdgesList)}},Si.prototype.labelIsolatedLine=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,n)},Si.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},Si.prototype.collectLineEdge=function(t,e,n){var i=t.getLabel(),s=t.getEdge();t.isLineEdge()&&!t.isVisited()&&Rt.isResultOfOp(i,e)&&!s.isCovered()&&(n.add(s),t.setVisitedEdge(!0))},Si.prototype.findCoveredLineEdges=function(){for(var t=this,e=this._op.getGraph().getNodes().iterator();e.hasNext();){var n=e.next();n.getEdges().findCoveredLineEdges()}for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var s=i.next(),o=s.getEdge();if(s.isLineEdge()&&!o.isCoveredSet()){var a=t._op.isCoveredByA(s.getCoordinate());o.setCovered(a)}}},Si.prototype.labelIsolatedLines=function(t){for(var e=this,n=t.iterator();n.hasNext();){var i=n.next(),s=i.getLabel();i.isIsolated()&&(s.isNull(0)?e.labelIsolatedLine(i,0):e.labelIsolatedLine(i,1))}},Si.prototype.buildLines=function(t){for(var e=this,n=this._lineEdgesList.iterator();n.hasNext();){var i=n.next(),s=e._geometryFactory.createLineString(i.getCoordinates());e._resultLineList.add(s),i.setInResult(!0)}},Si.prototype.collectBoundaryTouchEdge=function(t,e,n){var i=t.getLabel();if(t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult())return null;Ft.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),Rt.isResultOfOp(i,e)&&e===Rt.INTERSECTION&&(n.add(t.getEdge()),t.setVisitedEdge(!0))},Si.prototype.interfaces_=function(){return[]},Si.prototype.getClass=function(){return Si};var Ha=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new tt;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};Ha.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var n=this._geometryFactory.createPoint(e);this._resultPointList.add(n)}},Ha.prototype.extractNonCoveredResultNodes=function(t){for(var e=this,n=this._op.getGraph().getNodes().iterator();n.hasNext();){var i=n.next();if(!i.isInResult()&&!i.isIncidentEdgeInResult()&&(i.getEdges().getDegree()===0||t===Rt.INTERSECTION)){var s=i.getLabel();Rt.isResultOfOp(s,t)&&e.filterCoveredNodeToPoint(i)}}},Ha.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},Ha.prototype.interfaces_=function(){return[]},Ha.prototype.getClass=function(){return Ha};var jn=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};jn.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},jn.prototype.transformPolygon=function(t,e){var n=this,i=!0,s=this.transformLinearRing(t.getExteriorRing(),t);(s===null||!(s instanceof Bi)||s.isEmpty())&&(i=!1);for(var o=new tt,a=0;a<t.getNumInteriorRing();a++){var u=n.transformLinearRing(t.getInteriorRingN(a),t);u===null||u.isEmpty()||(u instanceof Bi||(i=!1),o.add(u))}if(i)return this._factory.createPolygon(s,o.toArray([]));var l=new tt;return s!==null&&l.add(s),l.addAll(o),this._factory.buildGeometry(l)},jn.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},jn.prototype.getInputGeometry=function(){return this._inputGeom},jn.prototype.transformMultiLineString=function(t,e){for(var n=this,i=new tt,s=0;s<t.getNumGeometries();s++){var o=n.transformLineString(t.getGeometryN(s),t);o!==null&&(o.isEmpty()||i.add(o))}return this._factory.buildGeometry(i)},jn.prototype.transformCoordinates=function(t,e){return this.copy(t)},jn.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},jn.prototype.transformMultiPoint=function(t,e){for(var n=this,i=new tt,s=0;s<t.getNumGeometries();s++){var o=n.transformPoint(t.getGeometryN(s),t);o!==null&&(o.isEmpty()||i.add(o))}return this._factory.buildGeometry(i)},jn.prototype.transformMultiPolygon=function(t,e){for(var n=this,i=new tt,s=0;s<t.getNumGeometries();s++){var o=n.transformPolygon(t.getGeometryN(s),t);o!==null&&(o.isEmpty()||i.add(o))}return this._factory.buildGeometry(i)},jn.prototype.copy=function(t){return t.copy()},jn.prototype.transformGeometryCollection=function(t,e){for(var n=this,i=new tt,s=0;s<t.getNumGeometries();s++){var o=n.transform(t.getGeometryN(s));o!==null&&(n._pruneEmptyGeometry&&o.isEmpty()||i.add(o))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(Ut.toGeometryArray(i)):this._factory.buildGeometry(i)},jn.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof Xn)return this.transformPoint(t,null);if(t instanceof sl)return this.transformMultiPoint(t,null);if(t instanceof Bi)return this.transformLinearRing(t,null);if(t instanceof Me)return this.transformLineString(t,null);if(t instanceof Ho)return this.transformMultiLineString(t,null);if(t instanceof qe)return this.transformPolygon(t,null);if(t instanceof zi)return this.transformMultiPolygon(t,null);if(t instanceof Cn)return this.transformGeometryCollection(t,null);throw new Ce("Unknown Geometry subtype: "+t.getClass().getName())},jn.prototype.transformLinearRing=function(t,e){var n=this.transformCoordinates(t.getCoordinateSequence(),t);if(n===null)return this._factory.createLinearRing(null);var i=n.size();return i>0&&i<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)},jn.prototype.interfaces_=function(){return[]},jn.prototype.getClass=function(){return jn};var Yi=function r(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new mt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Me&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];r.call(this,t.getCoordinates(),e)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];this._srcPts=n,this._isClosed=r.isClosed(n),this._snapTolerance=i}};Yi.prototype.snapVertices=function(t,e){for(var n=this,i=this._isClosed?t.size()-1:t.size(),s=0;s<i;s++){var o=t.get(s),a=n.findSnapForVertex(o,e);a!==null&&(t.set(s,new F(a)),s===0&&n._isClosed&&t.set(t.size()-1,new F(a)))}},Yi.prototype.findSnapForVertex=function(t,e){for(var n=this,i=0;i<e.length;i++){if(t.equals2D(e[i]))return null;if(t.distance(e[i])<n._snapTolerance)return e[i]}return null},Yi.prototype.snapTo=function(t){var e=new rc(this._srcPts);this.snapVertices(e,t),this.snapSegments(e,t);var n=e.toCoordinateArray();return n},Yi.prototype.snapSegments=function(t,e){var n=this;if(e.length===0)return null;var i=e.length;e[0].equals2D(e[e.length-1])&&(i=e.length-1);for(var s=0;s<i;s++){var o=e[s],a=n.findSegmentIndexToSnap(o,t);a>=0&&t.add(a+1,new F(o),!1)}},Yi.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,i=Tt.MAX_VALUE,s=-1,o=0;o<e.size()-1;o++){if(n._seg.p0=e.get(o),n._seg.p1=e.get(o+1),n._seg.p0.equals2D(t)||n._seg.p1.equals2D(t)){if(n._allowSnappingToSourceVertices)continue;return-1}var a=n._seg.distance(t);a<n._snapTolerance&&a<i&&(i=a,s=o)}return s},Yi.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},Yi.prototype.interfaces_=function(){return[]},Yi.prototype.getClass=function(){return Yi},Yi.isClosed=function(t){return t.length<=1?!1:t[0].equals2D(t[t.length-1])};var Le=function(t){this._srcGeom=t||null},ew={SNAP_PRECISION_FACTOR:{configurable:!0}};Le.prototype.snapTo=function(t,e){var n=this.extractTargetCoordinates(t),i=new nw(e,n);return i.transform(this._srcGeom)},Le.prototype.snapToSelf=function(t,e){var n=this.extractTargetCoordinates(this._srcGeom),i=new nw(t,n,!0),s=i.transform(this._srcGeom),o=s;return e&&Pt(o,so)&&(o=s.buffer(0)),o},Le.prototype.computeSnapTolerance=function(t){var e=this.computeMinimumSegmentLength(t),n=e/10;return n},Le.prototype.extractTargetCoordinates=function(t){for(var e=new hi,n=t.getCoordinates(),i=0;i<n.length;i++)e.add(n[i]);return e.toArray(new Array(0).fill(null))},Le.prototype.computeMinimumSegmentLength=function(t){for(var e=Tt.MAX_VALUE,n=0;n<t.length-1;n++){var i=t[n].distance(t[n+1]);i<e&&(e=i)}return e},Le.prototype.interfaces_=function(){return[]},Le.prototype.getClass=function(){return Le},Le.snap=function(t,e,n){var i=new Array(2).fill(null),s=new Le(t);i[0]=s.snapTo(e,n);var o=new Le(e);return i[1]=o.snapTo(i[0],n),i},Le.computeOverlaySnapTolerance=function(){if(arguments.length===1){var t=arguments[0],e=Le.computeSizeBasedSnapTolerance(t),n=t.getPrecisionModel();if(n.getType()===ne.FIXED){var i=1/n.getScale()*2/1.415;i>e&&(e=i)}return e}else if(arguments.length===2){var s=arguments[0],o=arguments[1];return Math.min(Le.computeOverlaySnapTolerance(s),Le.computeOverlaySnapTolerance(o))}},Le.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),n=Math.min(e.getHeight(),e.getWidth()),i=n*Le.SNAP_PRECISION_FACTOR;return i},Le.snapToSelf=function(t,e,n){var i=new Le(t);return i.snapToSelf(e,n)},ew.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Le,ew);var nw=function(r){function t(e,n,i){r.call(this),this._snapTolerance=e||null,this._snapPts=n||null,this._isSelfSnap=i!==void 0?i:!1}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.snapLine=function(n,i){var s=new Yi(n,this._snapTolerance);return s.setAllowSnappingToSourceVertices(this._isSelfSnap),s.snapTo(i)},t.prototype.transformCoordinates=function(n,i){var s=n.toCoordinateArray(),o=this.snapLine(s,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(o)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(jn),Tn=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Tn.prototype.getCommon=function(){return Tt.longBitsToDouble(this._commonBits)},Tn.prototype.add=function(t){var e=Tt.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=Tn.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Tn.signExpBits(e);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Tn.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=Tn.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},Tn.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=Tt.longBitsToDouble(t),n=Tt.toBinaryString(t),i="0000000000000000000000000000000000000000000000000000000000000000"+n,s=i.substring(i.length-64),o=s.substring(0,1)+" "+s.substring(1,12)+"(exp) "+s.substring(12)+" [ "+e+" ]";return o}},Tn.prototype.interfaces_=function(){return[]},Tn.prototype.getClass=function(){return Tn},Tn.getBit=function(t,e){var n=1<<e;return(t&n)!==0?1:0},Tn.signExpBits=function(t){return t>>52},Tn.zeroLowerBits=function(t,e){var n=(1<<e)-1,i=~n,s=t&i;return s},Tn.numCommonMostSigMantissaBits=function(t,e){for(var n=0,i=52;i>=0;i--){if(Tn.getBit(t,i)!==Tn.getBit(e,i))return n;n++}return 52};var po=function(){this._commonCoord=null,this._ccFilter=new $a},sm={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};po.prototype.addCommonBits=function(t){var e=new go(this._commonCoord);t.apply(e),t.geometryChanged()},po.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new F(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new go(e);return t.apply(n),t.geometryChanged(),t},po.prototype.getCommonCoordinate=function(){return this._commonCoord},po.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},po.prototype.interfaces_=function(){return[]},po.prototype.getClass=function(){return po},sm.CommonCoordinateFilter.get=function(){return $a},sm.Translater.get=function(){return go},Object.defineProperties(po,sm);var $a=function(){this._commonBitsX=new Tn,this._commonBitsY=new Tn};$a.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},$a.prototype.getCommonCoordinate=function(){return new F(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},$a.prototype.interfaces_=function(){return[Vi]},$a.prototype.getClass=function(){return $a};var go=function(){this.trans=null;var t=arguments[0];this.trans=t};go.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,i=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,i)},go.prototype.isDone=function(){return!1},go.prototype.isGeometryChanged=function(){return!0},go.prototype.interfaces_=function(){return[Wr]},go.prototype.getClass=function(){return go};var tn=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};tn.prototype.selfSnap=function(t){var e=new Le(t),n=e.snapTo(t,this._snapTolerance);return n},tn.prototype.removeCommonBits=function(t){this._cbr=new po,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e},tn.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},tn.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=Rt.overlayOp(e[0],e[1],t);return this.prepareResult(n)},tn.prototype.checkValid=function(t){t.isValid()||sn.out.println("Snapped geometry is invalid")},tn.prototype.computeSnapTolerance=function(){this._snapTolerance=Le.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},tn.prototype.snap=function(t){var e=this.removeCommonBits(t),n=Le.snap(e[0],e[1],this._snapTolerance);return n},tn.prototype.interfaces_=function(){return[]},tn.prototype.getClass=function(){return tn},tn.overlayOp=function(t,e,n){var i=new tn(t,e);return i.getResultGeometry(n)},tn.union=function(t,e){return tn.overlayOp(t,e,Rt.UNION)},tn.intersection=function(t,e){return tn.overlayOp(t,e,Rt.INTERSECTION)},tn.symDifference=function(t,e){return tn.overlayOp(t,e,Rt.SYMDIFFERENCE)},tn.difference=function(t,e){return tn.overlayOp(t,e,Rt.DIFFERENCE)};var Nn=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};Nn.prototype.getResultGeometry=function(t){var e=null,n=!1,i=null;try{e=Rt.overlayOp(this._geom[0],this._geom[1],t);var s=!0;s&&(n=!0)}catch(o){if(o instanceof ws)i=o;else throw o}finally{}if(!n)try{e=tn.overlayOp(this._geom[0],this._geom[1],t)}catch(o){throw o instanceof ws?i:o}finally{}return e},Nn.prototype.interfaces_=function(){return[]},Nn.prototype.getClass=function(){return Nn},Nn.overlayOp=function(t,e,n){var i=new Nn(t,e);return i.getResultGeometry(n)},Nn.union=function(t,e){return Nn.overlayOp(t,e,Rt.UNION)},Nn.intersection=function(t,e){return Nn.overlayOp(t,e,Rt.INTERSECTION)},Nn.symDifference=function(t,e){return Nn.overlayOp(t,e,Rt.SYMDIFFERENCE)},Nn.difference=function(t,e){return Nn.overlayOp(t,e,Rt.DIFFERENCE)};var _c=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};_c.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},_c.prototype.interfaces_=function(){return[]},_c.prototype.getClass=function(){return _c};var Kn=function r(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var t=arguments[0],e=arguments[1];this._eventType=r.DELETE,this._xValue=t,this._insertEvent=e}else if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];this._eventType=r.INSERT,this._label=n,this._xValue=i,this._obj=s}},om={INSERT:{configurable:!0},DELETE:{configurable:!0}};Kn.prototype.isDelete=function(){return this._eventType===Kn.DELETE},Kn.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},Kn.prototype.getObject=function(){return this._obj},Kn.prototype.compareTo=function(t){var e=t;return this._xValue<e._xValue?-1:this._xValue>e._xValue?1:this._eventType<e._eventType?-1:this._eventType>e._eventType?1:0},Kn.prototype.getInsertEvent=function(){return this._insertEvent},Kn.prototype.isInsert=function(){return this._eventType===Kn.INSERT},Kn.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label},Kn.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Kn.prototype.interfaces_=function(){return[Pr]},Kn.prototype.getClass=function(){return Kn},om.INSERT.get=function(){return 1},om.DELETE.get=function(){return 2},Object.defineProperties(Kn,om);var lf=function(){};lf.prototype.interfaces_=function(){return[]},lf.prototype.getClass=function(){return lf};var cn=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};cn.prototype.isTrivialIntersection=function(t,e,n,i){if(t===n&&this._li.getIntersectionNum()===1){if(cn.isAdjacentSegments(e,i))return!0;if(t.isClosed()){var s=t.getNumPoints()-1;if(e===0&&i===s||i===0&&e===s)return!0}}return!1},cn.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},cn.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},cn.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},cn.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next(),s=i.getCoordinate();if(t.isIntersection(s))return!0}return!1},cn.prototype.hasProperIntersection=function(){return this._hasProper},cn.prototype.hasIntersection=function(){return this._hasIntersection},cn.prototype.isDone=function(){return this._isDone},cn.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))},cn.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},cn.prototype.addIntersections=function(t,e,n,i){if(t===n&&e===i)return null;this.numTests++;var s=t.getCoordinates()[e],o=t.getCoordinates()[e+1],a=n.getCoordinates()[i],u=n.getCoordinates()[i+1];this._li.computeIntersection(s,o,a,u),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,i)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},cn.prototype.interfaces_=function(){return[]},cn.prototype.getClass=function(){return cn},cn.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var zN=function(r){function t(){r.call(this),this.events=new tt,this.nOverlaps=null}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.prepareEvents=function(){var n=this;$r.sort(this.events);for(var i=0;i<this.events.size();i++){var s=n.events.get(i);s.isDelete()&&s.getInsertEvent().setDeleteEventIndex(i)}},t.prototype.computeIntersections=function(){var n=this;if(arguments.length===1){var i=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var s=0;s<this.events.size();s++){var o=n.events.get(s);if(o.isInsert()&&n.processOverlaps(s,o.getDeleteEventIndex(),o,i),i.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof cn&&Pt(arguments[0],Ur)&&Pt(arguments[1],Ur)){var a=arguments[0],u=arguments[1],l=arguments[2];this.addEdges(a,a),this.addEdges(u,u),this.computeIntersections(l)}else if(typeof arguments[2]=="boolean"&&Pt(arguments[0],Ur)&&arguments[1]instanceof cn){var h=arguments[0],c=arguments[1],d=arguments[2];d?this.addEdges(h,null):this.addEdges(h),this.computeIntersections(c)}}},t.prototype.addEdge=function(n,i){for(var s=this,o=n.getMonotoneChainEdge(),a=o.getStartIndexes(),u=0;u<a.length-1;u++){var l=new _c(o,u),h=new Kn(i,o.getMinX(u),l);s.events.add(h),s.events.add(new Kn(o.getMaxX(u),h))}},t.prototype.processOverlaps=function(n,i,s,o){for(var a=this,u=s.getObject(),l=n;l<i;l++){var h=a.events.get(l);if(h.isInsert()){var c=h.getObject();s.isSameLabel(h)||(u.computeIntersections(c,o),a.nOverlaps++)}}},t.prototype.addEdges=function(){var n=this;if(arguments.length===1)for(var i=arguments[0],s=i.iterator();s.hasNext();){var o=s.next();n.addEdge(o,o)}else if(arguments.length===2)for(var a=arguments[0],u=arguments[1],l=a.iterator();l.hasNext();){var h=l.next();n.addEdge(h,u)}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(lf),Ji=function(){this._min=Tt.POSITIVE_INFINITY,this._max=Tt.NEGATIVE_INFINITY},rw={NodeComparator:{configurable:!0}};Ji.prototype.getMin=function(){return this._min},Ji.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},Ji.prototype.getMax=function(){return this._max},Ji.prototype.toString=function(){return zr.toLineString(new F(this._min,0),new F(this._max,0))},Ji.prototype.interfaces_=function(){return[]},Ji.prototype.getClass=function(){return Ji},rw.NodeComparator.get=function(){return yc},Object.defineProperties(Ji,rw);var yc=function(){};yc.prototype.compare=function(t,e){var n=t,i=e,s=(n._min+n._max)/2,o=(i._min+i._max)/2;return s<o?-1:s>o?1:0},yc.prototype.interfaces_=function(){return[Xu]},yc.prototype.getClass=function(){return yc};var UN=function(r){function t(){r.call(this),this._item=null;var e=arguments[0],n=arguments[1],i=arguments[2];this._min=e,this._max=n,this._item=i}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.query=function(n,i,s){if(!this.intersects(n,i))return null;s.visitItem(this._item)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ji),qN=function(r){function t(){r.call(this),this._node1=null,this._node2=null;var e=arguments[0],n=arguments[1];this._node1=e,this._node2=n,this.buildExtent(this._node1,this._node2)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.buildExtent=function(n,i){this._min=Math.min(n._min,i._min),this._max=Math.max(n._max,i._max)},t.prototype.query=function(n,i,s){if(!this.intersects(n,i))return null;this._node1!==null&&this._node1.query(n,i,s),this._node2!==null&&this._node2.query(n,i,s)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ji),Zi=function(){this._leaves=new tt,this._root=null,this._level=0};Zi.prototype.buildTree=function(){var t=this;$r.sort(this._leaves,new Ji.NodeComparator);for(var e=this._leaves,n=null,i=new tt;;){if(t.buildLevel(e,i),i.size()===1)return i.get(0);n=e,e=i,i=n}},Zi.prototype.insert=function(t,e,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new UN(t,e,n))},Zi.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)},Zi.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},Zi.prototype.printNode=function(t){sn.out.println(zr.toLineString(new F(t._min,this._level),new F(t._max,this._level)))},Zi.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},Zi.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n<t.size();n+=2){var i=t.get(n),s=n+1<t.size()?t.get(n):null;if(s===null)e.add(i);else{var o=new qN(t.get(n),t.get(n+1));e.add(o)}}},Zi.prototype.interfaces_=function(){return[]},Zi.prototype.getClass=function(){return Zi};var dl=function(){this._items=new tt};dl.prototype.visitItem=function(t){this._items.add(t)},dl.prototype.getItems=function(){return this._items},dl.prototype.interfaces_=function(){return[oo]},dl.prototype.getClass=function(){return dl};var fl=function(){this._index=null;var t=arguments[0];if(!Pt(t,so))throw new Ce("Argument must be Polygonal");this._index=new Qo(t)},am={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};fl.prototype.locate=function(t){var e=new li(t),n=new pl(e);return this._index.query(t.y,t.y,n),e.getLocation()},fl.prototype.interfaces_=function(){return[ll]},fl.prototype.getClass=function(){return fl},am.SegmentVisitor.get=function(){return pl},am.IntervalIndexedGeometry.get=function(){return Qo},Object.defineProperties(fl,am);var pl=function(){this._counter=null;var t=arguments[0];this._counter=t};pl.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},pl.prototype.interfaces_=function(){return[oo]},pl.prototype.getClass=function(){return pl};var Qo=function(){this._index=new Zi;var t=arguments[0];this.init(t)};Qo.prototype.init=function(t){for(var e=this,n=un.getLines(t),i=n.iterator();i.hasNext();){var s=i.next(),o=s.getCoordinates();e.addLine(o)}},Qo.prototype.addLine=function(t){for(var e=this,n=1;n<t.length;n++){var i=new mt(t[n-1],t[n]),s=Math.min(i.p0.y,i.p1.y),o=Math.max(i.p0.y,i.p1.y);e._index.insert(s,o,i)}},Qo.prototype.query=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new dl;return this._index.query(t,e,n),n.getItems()}else if(arguments.length===3){var i=arguments[0],s=arguments[1],o=arguments[2];this._index.query(i,s,o)}},Qo.prototype.interfaces_=function(){return[]},Qo.prototype.getClass=function(){return Qo};var wc=function(r){function t(){if(r.call(this),this._parentGeom=null,this._lineEdgeMap=new G1,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Yr,arguments.length===2){var e=arguments[0],n=arguments[1],i=Ir.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=n,this._boundaryNodeRule=i,n!==null&&this.add(n)}else if(arguments.length===3){var s=arguments[0],o=arguments[1],a=arguments[2];this._argIndex=s,this._parentGeom=o,this._boundaryNodeRule=a,o!==null&&this.add(o)}}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.insertBoundaryPoint=function(n,i){var s=this._nodes.addNode(i),o=s.getLabel(),a=1,u=V.NONE;u=o.getLocation(n,Z.ON),u===V.BOUNDARY&&a++;var l=t.determineBoundary(this._boundaryNodeRule,a);o.setLocation(n,l)},t.prototype.computeSelfNodes=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.computeSelfNodes(n,i,!1)}else if(arguments.length===3){var s=arguments[0],o=arguments[1],a=arguments[2],u=new cn(s,!0,!1);u.setIsDoneIfProperInt(a);var l=this.createEdgeSetIntersector(),h=this._parentGeom instanceof Bi||this._parentGeom instanceof qe||this._parentGeom instanceof zi,c=o||!h;return l.computeIntersections(this._edges,u,c),this.addSelfIntersectionNodes(this._argIndex),u}},t.prototype.computeSplitEdges=function(n){for(var i=this._edges.iterator();i.hasNext();){var s=i.next();s.eiList.addSplitEdges(n)}},t.prototype.computeEdgeIntersections=function(n,i,s){var o=new cn(i,s,!0);o.setBoundaryNodes(this.getBoundaryNodes(),n.getBoundaryNodes());var a=this.createEdgeSetIntersector();return a.computeIntersections(this._edges,n._edges,o),o},t.prototype.getGeometry=function(){return this._parentGeom},t.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},t.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},t.prototype.addPoint=function(){if(arguments[0]instanceof Xn){var n=arguments[0],i=n.getCoordinate();this.insertPoint(this._argIndex,i,V.INTERIOR)}else if(arguments[0]instanceof F){var s=arguments[0];this.insertPoint(this._argIndex,s,V.INTERIOR)}},t.prototype.addPolygon=function(n){var i=this;this.addPolygonRing(n.getExteriorRing(),V.EXTERIOR,V.INTERIOR);for(var s=0;s<n.getNumInteriorRing();s++){var o=n.getInteriorRingN(s);i.addPolygonRing(o,V.INTERIOR,V.EXTERIOR)}},t.prototype.addEdge=function(n){this.insertEdge(n);var i=n.getCoordinates();this.insertPoint(this._argIndex,i[0],V.BOUNDARY),this.insertPoint(this._argIndex,i[i.length-1],V.BOUNDARY)},t.prototype.addLineString=function(n){var i=zt.removeRepeatedPoints(n.getCoordinates());if(i.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=i[0],null;var s=new uf(i,new oe(this._argIndex,V.INTERIOR));this._lineEdgeMap.put(n,s),this.insertEdge(s),Ft.isTrue(i.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,i[0]),this.insertBoundaryPoint(this._argIndex,i[i.length-1])},t.prototype.getInvalidPoint=function(){return this._invalidPoint},t.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),i=new Array(n.size()).fill(null),s=0,o=n.iterator();o.hasNext();){var a=o.next();i[s++]=a.getCoordinate().copy()}return i},t.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},t.prototype.addSelfIntersectionNode=function(n,i,s){if(this.isBoundaryNode(n,i))return null;s===V.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,i):this.insertPoint(n,i,s)},t.prototype.addPolygonRing=function(n,i,s){if(n.isEmpty())return null;var o=zt.removeRepeatedPoints(n.getCoordinates());if(o.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=o[0],null;var a=i,u=s;rt.isCCW(o)&&(a=s,u=i);var l=new uf(o,new oe(this._argIndex,V.BOUNDARY,a,u));this._lineEdgeMap.put(n,l),this.insertEdge(l),this.insertPoint(this._argIndex,o[0],V.BOUNDARY)},t.prototype.insertPoint=function(n,i,s){var o=this._nodes.addNode(i),a=o.getLabel();a===null?o._label=new oe(n,s):a.setLocation(n,s)},t.prototype.createEdgeSetIntersector=function(){return new zN},t.prototype.addSelfIntersectionNodes=function(n){for(var i=this,s=this._edges.iterator();s.hasNext();)for(var o=s.next(),a=o.getLabel().getLocation(n),u=o.eiList.iterator();u.hasNext();){var l=u.next();i.addSelfIntersectionNode(n,l.coord,a)}},t.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof zi&&(this._useBoundaryDeterminationRule=!1),n instanceof qe)this.addPolygon(n);else if(n instanceof Me)this.addLineString(n);else if(n instanceof Xn)this.addPoint(n);else if(n instanceof sl)this.addCollection(n);else if(n instanceof Ho)this.addCollection(n);else if(n instanceof zi)this.addCollection(n);else if(n instanceof Cn)this.addCollection(n);else throw new Error(n.getClass().getName())}else return r.prototype.add.apply(this,arguments)},t.prototype.addCollection=function(n){for(var i=this,s=0;s<n.getNumGeometries();s++){var o=n.getGeometryN(s);i.add(o)}},t.prototype.locate=function(n){return Pt(this._parentGeom,so)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new fl(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},t.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return r.prototype.findEdge.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.determineBoundary=function(n,i){return n.isInBoundary(i)?V.BOUNDARY:V.INTERIOR},t}(xe),gl=function(){if(this._li=new Uo,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new wc(0,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],i=Ir.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new wc(0,e,i),this._arg[1]=new wc(1,n,i)}else if(arguments.length===3){var s=arguments[0],o=arguments[1],a=arguments[2];s.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(s.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new wc(0,s,a),this._arg[1]=new wc(1,o,a)}};gl.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},gl.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},gl.prototype.interfaces_=function(){return[]},gl.prototype.getClass=function(){return gl};var ta=function(){};ta.prototype.interfaces_=function(){return[]},ta.prototype.getClass=function(){return ta},ta.map=function(){if(arguments[0]instanceof bt&&Pt(arguments[1],ta.MapOp)){for(var t=arguments[0],e=arguments[1],n=new tt,i=0;i<t.getNumGeometries();i++){var s=e.map(t.getGeometryN(i));s!==null&&n.add(s)}return t.getFactory().buildGeometry(n)}else if(Pt(arguments[0],Ue)&&Pt(arguments[1],ta.MapOp)){for(var o=arguments[0],a=arguments[1],u=new tt,l=o.iterator();l.hasNext();){var h=l.next(),c=a.map(h);c!==null&&u.add(c)}return u}},ta.MapOp=function(){};var Rt=function(r){function t(){var e=arguments[0],n=arguments[1];r.call(this,e,n),this._ptLocator=new Yr,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Xr,this._resultPolyList=new tt,this._resultLineList=new tt,this._resultPointList=new tt,this._graph=new xe(new X1),this._geomFact=e.getFactory()}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.insertUniqueEdge=function(n){var i=this._edgeList.findEqualEdge(n);if(i!==null){var s=i.getLabel(),o=n.getLabel();i.isPointwiseEqual(n)||(o=new oe(n.getLabel()),o.flip());var a=i.getDepth();a.isNull()&&a.add(s),a.add(o),s.merge(o)}else this._edgeList.add(n)},t.prototype.getGraph=function(){return this._graph},t.prototype.cancelDuplicateResultEdges=function(){for(var n=this._graph.getEdgeEnds().iterator();n.hasNext();){var i=n.next(),s=i.getSym();i.isInResult()&&s.isInResult()&&(i.setInResult(!1),s.setInResult(!1))}},t.prototype.isCoveredByLA=function(n){return!!(this.isCovered(n,this._resultLineList)||this.isCovered(n,this._resultPolyList))},t.prototype.computeGeometry=function(n,i,s,o){var a=new tt;return a.addAll(n),a.addAll(i),a.addAll(s),a.isEmpty()?t.createEmptyResult(o,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(a)},t.prototype.mergeSymLabels=function(){for(var n=this._graph.getNodes().iterator();n.hasNext();){var i=n.next();i.getEdges().mergeSymLabels()}},t.prototype.isCovered=function(n,i){for(var s=this,o=i.iterator();o.hasNext();){var a=o.next(),u=s._ptLocator.locate(n,a);if(u!==V.EXTERIOR)return!0}return!1},t.prototype.replaceCollapsedEdges=function(){for(var n=new tt,i=this._edgeList.iterator();i.hasNext();){var s=i.next();s.isCollapsed()&&(i.remove(),n.add(s.getCollapsedEdge()))}this._edgeList.addAll(n)},t.prototype.updateNodeLabelling=function(){for(var n=this._graph.getNodes().iterator();n.hasNext();){var i=n.next(),s=i.getEdges().getLabel();i.getLabel().merge(s)}},t.prototype.getResultGeometry=function(n){return this.computeOverlay(n),this._resultGeom},t.prototype.insertUniqueEdges=function(n){for(var i=this,s=n.iterator();s.hasNext();){var o=s.next();i.insertUniqueEdge(o)}},t.prototype.computeOverlay=function(n){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var i=new tt;this._arg[0].computeSplitEdges(i),this._arg[1].computeSplitEdges(i),this.insertUniqueEdges(i),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),Ko.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(n),this.cancelDuplicateResultEdges();var s=new Yn(this._geomFact);s.add(this._graph),this._resultPolyList=s.getPolygons();var o=new Si(this,this._geomFact,this._ptLocator);this._resultLineList=o.build(n);var a=new Ha(this,this._geomFact,this._ptLocator);this._resultPointList=a.build(n),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,n)},t.prototype.labelIncompleteNode=function(n,i){var s=this._ptLocator.locate(n.getCoordinate(),this._arg[i].getGeometry());n.getLabel().setLocation(i,s)},t.prototype.copyPoints=function(n){for(var i=this,s=this._arg[n].getNodeIterator();s.hasNext();){var o=s.next(),a=i._graph.addNode(o.getCoordinate());a.setLabel(n,o.getLabel().getLocation(n))}},t.prototype.findResultAreaEdges=function(n){for(var i=this._graph.getEdgeEnds().iterator();i.hasNext();){var s=i.next(),o=s.getLabel();o.isArea()&&!s.isInteriorAreaEdge()&&t.isResultOfOp(o.getLocation(0,Z.RIGHT),o.getLocation(1,Z.RIGHT),n)&&s.setInResult(!0)}},t.prototype.computeLabelsFromDepths=function(){for(var n=this._edgeList.iterator();n.hasNext();){var i=n.next(),s=i.getLabel(),o=i.getDepth();if(!o.isNull()){o.normalize();for(var a=0;a<2;a++)!s.isNull(a)&&s.isArea()&&!o.isNull(a)&&(o.getDelta(a)===0?s.toLine(a):(Ft.isTrue(!o.isNull(a,Z.LEFT),"depth of LEFT side has not been initialized"),s.setLocation(a,Z.LEFT,o.getLocation(a,Z.LEFT)),Ft.isTrue(!o.isNull(a,Z.RIGHT),"depth of RIGHT side has not been initialized"),s.setLocation(a,Z.RIGHT,o.getLocation(a,Z.RIGHT))))}}},t.prototype.computeLabelling=function(){for(var n=this,i=this._graph.getNodes().iterator();i.hasNext();){var s=i.next();s.getEdges().computeLabelling(n._arg)}this.mergeSymLabels(),this.updateNodeLabelling()},t.prototype.labelIncompleteNodes=function(){for(var n=this,i=this._graph.getNodes().iterator();i.hasNext();){var s=i.next(),o=s.getLabel();s.isIsolated()&&(o.isNull(0)?n.labelIncompleteNode(s,0):n.labelIncompleteNode(s,1)),s.getEdges().updateLabelling(o)}},t.prototype.isCoveredByA=function(n){return!!this.isCovered(n,this._resultPolyList)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(gl);Rt.overlayOp=function(r,t,e){var n=new Rt(r,t),i=n.getResultGeometry(e);return i},Rt.intersection=function(r,t){if(r.isEmpty()||t.isEmpty())return Rt.createEmptyResult(Rt.INTERSECTION,r,t,r.getFactory());if(r.isGeometryCollection()){var e=t;return Wa.map(r,{interfaces_:function(){return[ta.MapOp]},map:function(n){return n.intersection(e)}})}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(t),Nn.overlayOp(r,t,Rt.INTERSECTION)},Rt.symDifference=function(r,t){if(r.isEmpty()||t.isEmpty()){if(r.isEmpty()&&t.isEmpty())return Rt.createEmptyResult(Rt.SYMDIFFERENCE,r,t,r.getFactory());if(r.isEmpty())return t.copy();if(t.isEmpty())return r.copy()}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(t),Nn.overlayOp(r,t,Rt.SYMDIFFERENCE)},Rt.resultDimension=function(r,t,e){var n=t.getDimension(),i=e.getDimension(),s=-1;switch(r){case Rt.INTERSECTION:s=Math.min(n,i);break;case Rt.UNION:s=Math.max(n,i);break;case Rt.DIFFERENCE:s=n;break;case Rt.SYMDIFFERENCE:s=Math.max(n,i);break}return s},Rt.createEmptyResult=function(r,t,e,n){var i=null;switch(Rt.resultDimension(r,t,e)){case-1:i=n.createGeometryCollection(new Array(0).fill(null));break;case 0:i=n.createPoint();break;case 1:i=n.createLineString();break;case 2:i=n.createPolygon();break}return i},Rt.difference=function(r,t){return r.isEmpty()?Rt.createEmptyResult(Rt.DIFFERENCE,r,t,r.getFactory()):t.isEmpty()?r.copy():(r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(t),Nn.overlayOp(r,t,Rt.DIFFERENCE))},Rt.isResultOfOp=function(){if(arguments.length===2){var r=arguments[0],t=arguments[1],e=r.getLocation(0),n=r.getLocation(1);return Rt.isResultOfOp(e,n,t)}else if(arguments.length===3){var i=arguments[0],s=arguments[1],o=arguments[2];switch(i===V.BOUNDARY&&(i=V.INTERIOR),s===V.BOUNDARY&&(s=V.INTERIOR),o){case Rt.INTERSECTION:return i===V.INTERIOR&&s===V.INTERIOR;case Rt.UNION:return i===V.INTERIOR||s===V.INTERIOR;case Rt.DIFFERENCE:return i===V.INTERIOR&&s!==V.INTERIOR;case Rt.SYMDIFFERENCE:return i===V.INTERIOR&&s!==V.INTERIOR||i!==V.INTERIOR&&s===V.INTERIOR}return!1}},Rt.INTERSECTION=1,Rt.UNION=2,Rt.DIFFERENCE=3,Rt.SYMDIFFERENCE=4;var mo=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new Yr,this._seg=new mt;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};mo.prototype.isWithinToleranceOfBoundary=function(t){for(var e=this,n=0;n<this._linework.getNumGeometries();n++)for(var i=e._linework.getGeometryN(n),s=i.getCoordinateSequence(),o=0;o<s.size()-1;o++){s.getCoordinate(o,e._seg.p0),s.getCoordinate(o+1,e._seg.p1);var a=e._seg.distance(t);if(a<=e._boundaryDistanceTolerance)return!0}return!1},mo.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?V.BOUNDARY:this._ptLocator.locate(t,this._g)},mo.prototype.extractLinework=function(t){var e=new ml;t.apply(e);var n=e.getLinework(),i=Ut.toLineStringArray(n);return t.getFactory().createMultiLineString(i)},mo.prototype.interfaces_=function(){return[]},mo.prototype.getClass=function(){return mo};var ml=function(){this._linework=null,this._linework=new tt};ml.prototype.getLinework=function(){return this._linework},ml.prototype.filter=function(t){var e=this;if(t instanceof qe){var n=t;this._linework.add(n.getExteriorRing());for(var i=0;i<n.getNumInteriorRing();i++)e._linework.add(n.getInteriorRingN(i))}},ml.prototype.interfaces_=function(){return[ci]},ml.prototype.getClass=function(){return ml};var ea=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};ea.prototype.extractPoints=function(t,e,n){for(var i=this,s=t.getCoordinates(),o=0;o<s.length-1;o++)i.computeOffsetPoints(s[o],s[o+1],e,n)},ea.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},ea.prototype.getPoints=function(t){for(var e=this,n=new tt,i=un.getLines(this._g),s=i.iterator();s.hasNext();){var o=s.next();e.extractPoints(o,t,n)}return n},ea.prototype.computeOffsetPoints=function(t,e,n,i){var s=e.x-t.x,o=e.y-t.y,a=Math.sqrt(s*s+o*o),u=n*s/a,l=n*o/a,h=(e.x+t.x)/2,c=(e.y+t.y)/2;if(this._doLeft){var d=new F(h-l,c+u);i.add(d)}if(this._doRight){var p=new F(h+l,c-u);i.add(p)}},ea.prototype.interfaces_=function(){return[]},ea.prototype.getClass=function(){return ea};var gr=function r(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=r.TOLERANCE,this._testCoords=new tt;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundaryDistanceTolerance=r.computeBoundaryDistanceTolerance(t,e),this._geom=[t,e,n],this._locFinder=[new mo(this._geom[0],this._boundaryDistanceTolerance),new mo(this._geom[1],this._boundaryDistanceTolerance),new mo(this._geom[2],this._boundaryDistanceTolerance)]},iw={TOLERANCE:{configurable:!0}};gr.prototype.reportResult=function(t,e,n){sn.out.println("Overlay result invalid - A:"+V.toLocationSymbol(e[0])+" B:"+V.toLocationSymbol(e[1])+" expected:"+(n?"i":"e")+" actual:"+V.toLocationSymbol(e[2]))},gr.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var e=this.checkValid(t);return e},gr.prototype.checkValid=function(){var t=this;if(arguments.length===1){for(var e=arguments[0],n=0;n<this._testCoords.size();n++){var i=t._testCoords.get(n);if(!t.checkValid(e,i))return t._invalidLocation=i,!1}return!0}else if(arguments.length===2){var s=arguments[0],o=arguments[1];return this._location[0]=this._locFinder[0].getLocation(o),this._location[1]=this._locFinder[1].getLocation(o),this._location[2]=this._locFinder[2].getLocation(o),gr.hasLocation(this._location,V.BOUNDARY)?!0:this.isValidResult(s,this._location)}},gr.prototype.addTestPts=function(t){var e=new ea(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},gr.prototype.isValidResult=function(t,e){var n=Rt.isResultOfOp(e[0],e[1],t),i=e[2]===V.INTERIOR,s=!(n^i);return s||this.reportResult(t,e,n),s},gr.prototype.getInvalidLocation=function(){return this._invalidLocation},gr.prototype.interfaces_=function(){return[]},gr.prototype.getClass=function(){return gr},gr.hasLocation=function(t,e){for(var n=0;n<3;n++)if(t[n]===e)return!0;return!1},gr.computeBoundaryDistanceTolerance=function(t,e){return Math.min(Le.computeSizeBasedSnapTolerance(t),Le.computeSizeBasedSnapTolerance(e))},gr.isValid=function(t,e,n,i){var s=new gr(t,e,i);return s.isValid(n)},iw.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(gr,iw);var mr=function r(t){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=r.extractFactory(t),this._inputGeoms=t};mr.prototype.extractElements=function(t,e){var n=this;if(t===null)return null;for(var i=0;i<t.getNumGeometries();i++){var s=t.getGeometryN(i);n._skipEmpty&&s.isEmpty()||e.add(s)}},mr.prototype.combine=function(){for(var t=this,e=new tt,n=this._inputGeoms.iterator();n.hasNext();){var i=n.next();t.extractElements(i,e)}return e.size()===0?this._geomFactory!==null?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(e)},mr.prototype.interfaces_=function(){return[]},mr.prototype.getClass=function(){return mr},mr.combine=function(){if(arguments.length===1){var t=arguments[0],e=new mr(t);return e.combine()}else if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new mr(mr.createList(n,i));return s.combine()}else if(arguments.length===3){var o=arguments[0],a=arguments[1],u=arguments[2],l=new mr(mr.createList(o,a,u));return l.combine()}},mr.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},mr.createList=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new tt;return n.add(t),n.add(e),n}else if(arguments.length===3){var i=arguments[0],s=arguments[1],o=arguments[2],a=new tt;return a.add(i),a.add(s),a.add(o),a}};var Ve=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,this._inputPolys===null&&(this._inputPolys=new tt)},sw={STRTREE_NODE_CAPACITY:{configurable:!0}};Ve.prototype.reduceToGeometries=function(t){for(var e=this,n=new tt,i=t.iterator();i.hasNext();){var s=i.next(),o=null;Pt(s,Ur)?o=e.unionTree(s):s instanceof bt&&(o=s),n.add(o)}return n},Ve.prototype.extractByEnvelope=function(t,e,n){for(var i=new tt,s=0;s<e.getNumGeometries();s++){var o=e.getGeometryN(s);o.getEnvelopeInternal().intersects(t)?i.add(o):n.add(o)}return this._geomFactory.buildGeometry(i)},Ve.prototype.unionOptimized=function(t,e){var n=t.getEnvelopeInternal(),i=e.getEnvelopeInternal();if(!n.intersects(i)){var s=mr.combine(t,e);return s}if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var o=n.intersection(i);return this.unionUsingEnvelopeIntersection(t,e,o)},Ve.prototype.union=function(){if(this._inputPolys===null)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var t=new z1(Ve.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var n=e.next();t.insert(n.getEnvelopeInternal(),n)}this._inputPolys=null;var i=t.itemsTree(),s=this.unionTree(i);return s},Ve.prototype.binaryUnion=function(){if(arguments.length===1){var t=arguments[0];return this.binaryUnion(t,0,t.size())}else if(arguments.length===3){var e=arguments[0],n=arguments[1],i=arguments[2];if(i-n<=1){var s=Ve.getGeometry(e,n);return this.unionSafe(s,null)}else{if(i-n===2)return this.unionSafe(Ve.getGeometry(e,n),Ve.getGeometry(e,n+1));var o=Math.trunc((i+n)/2),a=this.binaryUnion(e,n,o),u=this.binaryUnion(e,o,i);return this.unionSafe(a,u)}}},Ve.prototype.repeatedUnion=function(t){for(var e=null,n=t.iterator();n.hasNext();){var i=n.next();e===null?e=i.copy():e=e.union(i)}return e},Ve.prototype.unionSafe=function(t,e){return t===null&&e===null?null:t===null?e.copy():e===null?t.copy():this.unionOptimized(t,e)},Ve.prototype.unionActual=function(t,e){return Ve.restrictToPolygons(t.union(e))},Ve.prototype.unionTree=function(t){var e=this.reduceToGeometries(t),n=this.binaryUnion(e);return n},Ve.prototype.unionUsingEnvelopeIntersection=function(t,e,n){var i=new tt,s=this.extractByEnvelope(n,t,i),o=this.extractByEnvelope(n,e,i),a=this.unionActual(s,o);i.add(a);var u=mr.combine(i);return u},Ve.prototype.bufferUnion=function(){if(arguments.length===1){var t=arguments[0],e=t.get(0).getFactory(),n=e.buildGeometry(t),i=n.buffer(0);return i}else if(arguments.length===2){var s=arguments[0],o=arguments[1],a=s.getFactory(),u=a.createGeometryCollection([s,o]),l=u.buffer(0);return l}},Ve.prototype.interfaces_=function(){return[]},Ve.prototype.getClass=function(){return Ve},Ve.restrictToPolygons=function(t){if(Pt(t,so))return t;var e=Ns.getPolygons(t);return e.size()===1?e.get(0):t.getFactory().createMultiPolygon(Ut.toPolygonArray(e))},Ve.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},Ve.union=function(t){var e=new Ve(t);return e.union()},sw.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Ve,sw);var hf=function(){};hf.prototype.interfaces_=function(){return[]},hf.prototype.getClass=function(){return hf},hf.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return Rt.createEmptyResult(Rt.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Nn.overlayOp(t,e,Rt.UNION)};function na(){return new cf}function cf(){this.reset()}cf.prototype={constructor:cf,reset:function(){this.s=this.t=0},add:function(r){ow(df,r,this.t),ow(this,df.s,this.s),this.s?this.t+=df.t:this.s=df.t},valueOf:function(){return this.s}};var df=new cf;function ow(r,t,e){var n=r.s=t+e,i=n-t,s=n-i;r.t=t-s+(e-i)}var Be=1e-6,le=Math.PI,Os=le/2,aw=le/4,Ds=le*2,ra=180/le,Ci=le/180,On=Math.abs,WN=Math.atan,vl=Math.atan2,He=Math.cos,$e=Math.sin,_l=Math.sqrt;function uw(r){return r>1?0:r<-1?le:Math.acos(r)}function Xa(r){return r>1?Os:r<-1?-Os:Math.asin(r)}function Ec(){}function ff(r,t){r&&hw.hasOwnProperty(r.type)&&hw[r.type](r,t)}var lw={Feature:function(r,t){ff(r.geometry,t)},FeatureCollection:function(r,t){for(var e=r.features,n=-1,i=e.length;++n<i;)ff(e[n].geometry,t)}},hw={Sphere:function(r,t){t.sphere()},Point:function(r,t){r=r.coordinates,t.point(r[0],r[1],r[2])},MultiPoint:function(r,t){for(var e=r.coordinates,n=-1,i=e.length;++n<i;)r=e[n],t.point(r[0],r[1],r[2])},LineString:function(r,t){um(r.coordinates,t,0)},MultiLineString:function(r,t){for(var e=r.coordinates,n=-1,i=e.length;++n<i;)um(e[n],t,0)},Polygon:function(r,t){cw(r.coordinates,t)},MultiPolygon:function(r,t){for(var e=r.coordinates,n=-1,i=e.length;++n<i;)cw(e[n],t)},GeometryCollection:function(r,t){for(var e=r.geometries,n=-1,i=e.length;++n<i;)ff(e[n],t)}};function um(r,t,e){var n=-1,i=r.length-e,s;for(t.lineStart();++n<i;)s=r[n],t.point(s[0],s[1],s[2]);t.lineEnd()}function cw(r,t){var e=-1,n=r.length;for(t.polygonStart();++e<n;)um(r[e],t,1);t.polygonEnd()}function HN(r,t){r&&lw.hasOwnProperty(r.type)?lw[r.type](r,t):ff(r,t)}na(),na();function lm(r){return[vl(r[1],r[0]),Xa(r[2])]}function yl(r){var t=r[0],e=r[1],n=He(e);return[n*He(t),n*$e(t),$e(e)]}function pf(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]}function gf(r,t){return[r[1]*t[2]-r[2]*t[1],r[2]*t[0]-r[0]*t[2],r[0]*t[1]-r[1]*t[0]]}function hm(r,t){r[0]+=t[0],r[1]+=t[1],r[2]+=t[2]}function mf(r,t){return[r[0]*t,r[1]*t,r[2]*t]}function cm(r){var t=_l(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=t,r[1]/=t,r[2]/=t}na();function dw(r,t){function e(n,i){return n=r(n,i),t(n[0],n[1])}return r.invert&&t.invert&&(e.invert=function(n,i){return n=t.invert(n,i),n&&r.invert(n[0],n[1])}),e}function dm(r,t){return[r>le?r-Ds:r<-le?r+Ds:r,t]}dm.invert=dm;function $N(r,t,e){return(r%=Ds)?t||e?dw(pw(r),gw(t,e)):pw(r):t||e?gw(t,e):dm}function fw(r){return function(t,e){return t+=r,[t>le?t-Ds:t<-le?t+Ds:t,e]}}function pw(r){var t=fw(r);return t.invert=fw(-r),t}function gw(r,t){var e=He(r),n=$e(r),i=He(t),s=$e(t);function o(a,u){var l=He(u),h=He(a)*l,c=$e(a)*l,d=$e(u),p=d*e+h*n;return[vl(c*i-p*s,h*e-d*n),Xa(p*i+c*s)]}return o.invert=function(a,u){var l=He(u),h=He(a)*l,c=$e(a)*l,d=$e(u),p=d*i-c*s;return[vl(c*i+d*s,h*e+p*n),Xa(p*e-h*n)]},o}function XN(r,t,e,n,i,s){if(e){var o=He(t),a=$e(t),u=n*e;i==null?(i=t+n*Ds,s=t-u/2):(i=mw(o,i),s=mw(o,s),(n>0?i<s:i>s)&&(i+=n*Ds));for(var l,h=i;n>0?h>s:h<s;h-=u)l=lm([o,-a*He(h),-a*$e(h)]),r.point(l[0],l[1])}}function mw(r,t){t=yl(t),t[0]-=r,cm(t);var e=uw(-t[1]);return((-t[2]<0?-e:e)+Ds-Be)%Ds}function vw(){var r=[],t;return{point:function(e,n){t.push([e,n])},lineStart:function(){r.push(t=[])},lineEnd:Ec,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var e=r;return r=[],t=null,e}}}function YN(r,t,e,n,i,s){var o=r[0],a=r[1],u=t[0],l=t[1],h=0,c=1,d=u-o,p=l-a,g;if(g=e-o,!(!d&&g>0)){if(g/=d,d<0){if(g<h)return;g<c&&(c=g)}else if(d>0){if(g>c)return;g>h&&(h=g)}if(g=i-o,!(!d&&g<0)){if(g/=d,d<0){if(g>c)return;g>h&&(h=g)}else if(d>0){if(g<h)return;g<c&&(c=g)}if(g=n-a,!(!p&&g>0)){if(g/=p,p<0){if(g<h)return;g<c&&(c=g)}else if(p>0){if(g>c)return;g>h&&(h=g)}if(g=s-a,!(!p&&g<0)){if(g/=p,p<0){if(g>c)return;g>h&&(h=g)}else if(p>0){if(g<h)return;g<c&&(c=g)}return h>0&&(r[0]=o+h*d,r[1]=a+h*p),c<1&&(t[0]=o+c*d,t[1]=a+c*p),!0}}}}}function vf(r,t){return On(r[0]-t[0])<Be&&On(r[1]-t[1])<Be}function _f(r,t,e,n){this.x=r,this.z=t,this.o=e,this.e=n,this.v=!1,this.n=this.p=null}function _w(r,t,e,n,i){var s=[],o=[],a,u;if(r.forEach(function(g){if(!((y=g.length-1)<=0)){var y,w=g[0],b=g[y],m;if(vf(w,b)){for(i.lineStart(),a=0;a<y;++a)i.point((w=g[a])[0],w[1]);i.lineEnd();return}s.push(m=new _f(w,g,null,!0)),o.push(m.o=new _f(w,null,m,!1)),s.push(m=new _f(b,g,null,!1)),o.push(m.o=new _f(b,null,m,!0))}}),!!s.length){for(o.sort(t),yw(s),yw(o),a=0,u=o.length;a<u;++a)o[a].e=e=!e;for(var l=s[0],h,c;;){for(var d=l,p=!0;d.v;)if((d=d.n)===l)return;h=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(p)for(a=0,u=h.length;a<u;++a)i.point((c=h[a])[0],c[1]);else n(d.x,d.n.x,1,i);d=d.n}else{if(p)for(h=d.p.z,a=h.length-1;a>=0;--a)i.point((c=h[a])[0],c[1]);else n(d.x,d.p.x,-1,i);d=d.p}d=d.o,h=d.z,p=!p}while(!d.v);i.lineEnd()}}}function yw(r){if(t=r.length){for(var t,e=0,n=r[0],i;++e<t;)n.n=i=r[e],i.p=n,n=i;n.n=i=r[0],i.p=n}}function ww(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function JN(r){return r.length===1&&(r=ZN(r)),{left:function(t,e,n,i){for(n==null&&(n=0),i==null&&(i=t.length);n<i;){var s=n+i>>>1;r(t[s],e)<0?n=s+1:i=s}return n},right:function(t,e,n,i){for(n==null&&(n=0),i==null&&(i=t.length);n<i;){var s=n+i>>>1;r(t[s],e)>0?i=s:n=s+1}return n}}}function ZN(r){return function(t,e){return ww(r(t),e)}}JN(ww);function Ew(r){for(var t=r.length,e,n=-1,i=0,s,o;++n<t;)i+=r[n].length;for(s=new Array(i);--t>=0;)for(o=r[t],e=o.length;--e>=0;)s[--i]=o[e];return s}var yf=1e9,wf=-1e9;function KN(r,t,e,n){function i(l,h){return r<=l&&l<=e&&t<=h&&h<=n}function s(l,h,c,d){var p=0,g=0;if(l==null||(p=o(l,c))!==(g=o(h,c))||u(l,h)<0^c>0)do d.point(p===0||p===3?r:e,p>1?n:t);while((p=(p+c+4)%4)!==g);else d.point(h[0],h[1])}function o(l,h){return On(l[0]-r)<Be?h>0?0:3:On(l[0]-e)<Be?h>0?2:1:On(l[1]-t)<Be?h>0?1:0:h>0?3:2}function a(l,h){return u(l.x,h.x)}function u(l,h){var c=o(l,1),d=o(h,1);return c!==d?c-d:c===0?h[1]-l[1]:c===1?l[0]-h[0]:c===2?l[1]-h[1]:h[0]-l[0]}return function(l){var h=l,c=vw(),d,p,g,y,w,b,m,E,_,S,C,P={point:x,lineStart:T,lineEnd:A,polygonStart:O,polygonEnd:I};function x(nt,J){i(nt,J)&&h.point(nt,J)}function M(){for(var nt=0,J=0,st=p.length;J<st;++J)for(var k=p[J],q=1,j=k.length,B=k[0],D,z,Y=B[0],ht=B[1];q<j;++q)D=Y,z=ht,B=k[q],Y=B[0],ht=B[1],z<=n?ht>n&&(Y-D)*(n-z)>(ht-z)*(r-D)&&++nt:ht<=n&&(Y-D)*(n-z)<(ht-z)*(r-D)&&--nt;return nt}function O(){h=c,d=[],p=[],C=!0}function I(){var nt=M(),J=C&&nt,st=(d=Ew(d)).length;(J||st)&&(l.polygonStart(),J&&(l.lineStart(),s(null,null,1,l),l.lineEnd()),st&&_w(d,a,nt,s,l),l.polygonEnd()),h=l,d=p=g=null}function T(){P.point=G,p&&p.push(g=[]),S=!0,_=!1,m=E=NaN}function A(){d&&(G(y,w),b&&_&&c.rejoin(),d.push(c.result())),P.point=x,_&&h.lineEnd()}function G(nt,J){var st=i(nt,J);if(p&&g.push([nt,J]),S)y=nt,w=J,b=st,S=!1,st&&(h.lineStart(),h.point(nt,J));else if(st&&_)h.point(nt,J);else{var k=[m=Math.max(wf,Math.min(yf,m)),E=Math.max(wf,Math.min(yf,E))],q=[nt=Math.max(wf,Math.min(yf,nt)),J=Math.max(wf,Math.min(yf,J))];YN(k,q,r,t,e,n)?(_||(h.lineStart(),h.point(k[0],k[1])),h.point(q[0],q[1]),st||h.lineEnd(),C=!1):st&&(h.lineStart(),h.point(nt,J),C=!1)}m=nt,E=J,_=st}return P}}var fm=na();function QN(r,t){var e=t[0],n=t[1],i=[$e(e),-He(e),0],s=0,o=0;fm.reset();for(var a=0,u=r.length;a<u;++a)if(h=(l=r[a]).length)for(var l,h,c=l[h-1],d=c[0],p=c[1]/2+aw,g=$e(p),y=He(p),w=0;w<h;++w,d=m,g=_,y=S,c=b){var b=l[w],m=b[0],E=b[1]/2+aw,_=$e(E),S=He(E),C=m-d,P=C>=0?1:-1,x=P*C,M=x>le,O=g*_;if(fm.add(vl(O*P*$e(x),y*S+O*He(x))),s+=M?C+P*Ds:C,M^d>=e^m>=e){var I=gf(yl(c),yl(b));cm(I);var T=gf(i,I);cm(T);var A=(M^C>=0?-1:1)*Xa(T[2]);(n>A||n===A&&(I[0]||I[1]))&&(o+=M^C>=0?1:-1)}}return(s<-1e-6||s<Be&&fm<-1e-6)^o&1}na();function Sw(r){return r}na(),na();var wl=1/0,Ef=wl,Sc=-wl,Sf=Sc,Cw={point:tO,lineStart:Ec,lineEnd:Ec,polygonStart:Ec,polygonEnd:Ec,result:function(){var r=[[wl,Ef],[Sc,Sf]];return Sc=Sf=-(Ef=wl=1/0),r}};function tO(r,t){r<wl&&(wl=r),r>Sc&&(Sc=r),t<Ef&&(Ef=t),t>Sf&&(Sf=t)}na();function bw(r,t,e,n){return function(i,s){var o=t(s),a=i.invert(n[0],n[1]),u=vw(),l=t(u),h=!1,c,d,p,g={point:y,lineStart:b,lineEnd:m,polygonStart:function(){g.point=E,g.lineStart=_,g.lineEnd=S,d=[],c=[]},polygonEnd:function(){g.point=y,g.lineStart=b,g.lineEnd=m,d=Ew(d);var C=QN(c,a);d.length?(h||(s.polygonStart(),h=!0),_w(d,nO,C,e,s)):C&&(h||(s.polygonStart(),h=!0),s.lineStart(),e(null,null,1,s),s.lineEnd()),h&&(s.polygonEnd(),h=!1),d=c=null},sphere:function(){s.polygonStart(),s.lineStart(),e(null,null,1,s),s.lineEnd(),s.polygonEnd()}};function y(C,P){var x=i(C,P);r(C=x[0],P=x[1])&&s.point(C,P)}function w(C,P){var x=i(C,P);o.point(x[0],x[1])}function b(){g.point=w,o.lineStart()}function m(){g.point=y,o.lineEnd()}function E(C,P){p.push([C,P]);var x=i(C,P);l.point(x[0],x[1])}function _(){l.lineStart(),p=[]}function S(){E(p[0][0],p[0][1]),l.lineEnd();var C=l.clean(),P=u.result(),x,M=P.length,O,I,T;if(p.pop(),c.push(p),p=null,!!M){if(C&1){if(I=P[0],(O=I.length-1)>0){for(h||(s.polygonStart(),h=!0),s.lineStart(),x=0;x<O;++x)s.point((T=I[x])[0],T[1]);s.lineEnd()}return}M>1&&C&2&&P.push(P.pop().concat(P.shift())),d.push(P.filter(eO))}}return g}}function eO(r){return r.length>1}function nO(r,t){return((r=r.x)[0]<0?r[1]-Os-Be:Os-r[1])-((t=t.x)[0]<0?t[1]-Os-Be:Os-t[1])}const Pw=bw(function(){return!0},rO,sO,[-le,-Os]);function rO(r){var t=NaN,e=NaN,n=NaN,i;return{lineStart:function(){r.lineStart(),i=1},point:function(s,o){var a=s>0?le:-le,u=On(s-t);On(u-le)<Be?(r.point(t,e=(e+o)/2>0?Os:-Os),r.point(n,e),r.lineEnd(),r.lineStart(),r.point(a,e),r.point(s,e),i=0):n!==a&&u>=le&&(On(t-n)<Be&&(t-=n*Be),On(s-a)<Be&&(s-=a*Be),e=iO(t,e,s,o),r.point(n,e),r.lineEnd(),r.lineStart(),r.point(a,e),i=0),r.point(t=s,e=o),n=a},lineEnd:function(){r.lineEnd(),t=e=NaN},clean:function(){return 2-i}}}function iO(r,t,e,n){var i,s,o=$e(r-e);return On(o)>Be?WN(($e(t)*(s=He(n))*$e(e)-$e(n)*(i=He(t))*$e(r))/(i*s*o)):(t+n)/2}function sO(r,t,e,n){var i;if(r==null)i=e*Os,n.point(-le,i),n.point(0,i),n.point(le,i),n.point(le,0),n.point(le,-i),n.point(0,-i),n.point(-le,-i),n.point(-le,0),n.point(-le,i);else if(On(r[0]-t[0])>Be){var s=r[0]<t[0]?le:-le;i=e*s/2,n.point(-s,i),n.point(0,i),n.point(s,i)}else n.point(t[0],t[1])}function oO(r,t){var e=He(r),n=e>0,i=On(e)>Be;function s(h,c,d,p){XN(p,r,t,d,h,c)}function o(h,c){return He(h)*He(c)>e}function a(h){var c,d,p,g,y;return{lineStart:function(){g=p=!1,y=1},point:function(w,b){var m=[w,b],E,_=o(w,b),S=n?_?0:l(w,b):_?l(w+(w<0?le:-le),b):0;if(!c&&(g=p=_)&&h.lineStart(),_!==p&&(E=u(c,m),(!E||vf(c,E)||vf(m,E))&&(m[0]+=Be,m[1]+=Be,_=o(m[0],m[1]))),_!==p)y=0,_?(h.lineStart(),E=u(m,c),h.point(E[0],E[1])):(E=u(c,m),h.point(E[0],E[1]),h.lineEnd()),c=E;else if(i&&c&&n^_){var C;!(S&d)&&(C=u(m,c,!0))&&(y=0,n?(h.lineStart(),h.point(C[0][0],C[0][1]),h.point(C[1][0],C[1][1]),h.lineEnd()):(h.point(C[1][0],C[1][1]),h.lineEnd(),h.lineStart(),h.point(C[0][0],C[0][1])))}_&&(!c||!vf(c,m))&&h.point(m[0],m[1]),c=m,p=_,d=S},lineEnd:function(){p&&h.lineEnd(),c=null},clean:function(){return y|(g&&p)<<1}}}function u(h,c,d){var p=yl(h),g=yl(c),y=[1,0,0],w=gf(p,g),b=pf(w,w),m=w[0],E=b-m*m;if(!E)return!d&&h;var _=e*b/E,S=-e*m/E,C=gf(y,w),P=mf(y,_),x=mf(w,S);hm(P,x);var M=C,O=pf(P,M),I=pf(M,M),T=O*O-I*(pf(P,P)-1);if(!(T<0)){var A=_l(T),G=mf(M,(-O-A)/I);if(hm(G,P),G=lm(G),!d)return G;var nt=h[0],J=c[0],st=h[1],k=c[1],q;J<nt&&(q=nt,nt=J,J=q);var j=J-nt,B=On(j-le)<Be,D=B||j<Be;if(!B&&k<st&&(q=st,st=k,k=q),D?B?st+k>0^G[1]<(On(G[0]-nt)<Be?st:k):st<=G[1]&&G[1]<=k:j>le^(nt<=G[0]&&G[0]<=J)){var z=mf(M,(-O+A)/I);return hm(z,P),[G,lm(z)]}}}function l(h,c){var d=n?r:le-r,p=0;return h<-d?p|=1:h>d&&(p|=2),c<-d?p|=4:c>d&&(p|=8),p}return bw(o,a,s,n?[0,-r]:[-le,r-le])}function xw(r){return function(t){var e=new pm;for(var n in r)e[n]=r[n];return e.stream=t,e}}function pm(){}pm.prototype={constructor:pm,point:function(r,t){this.stream.point(r,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function Iw(r,t,e){var n=t[1][0]-t[0][0],i=t[1][1]-t[0][1],s=r.clipExtent&&r.clipExtent();r.scale(150).translate([0,0]),s!=null&&r.clipExtent(null),HN(e,r.stream(Cw));var o=Cw.result(),a=Math.min(n/(o[1][0]-o[0][0]),i/(o[1][1]-o[0][1])),u=+t[0][0]+(n-a*(o[1][0]+o[0][0]))/2,l=+t[0][1]+(i-a*(o[1][1]+o[0][1]))/2;return s!=null&&r.clipExtent(s),r.scale(a*150).translate([u,l])}function aO(r,t,e){return Iw(r,[[0,0],t],e)}var Mw=16,uO=He(30*Ci);function Tw(r,t){return+t?hO(r,t):lO(r)}function lO(r){return xw({point:function(t,e){t=r(t,e),this.stream.point(t[0],t[1])}})}function hO(r,t){function e(n,i,s,o,a,u,l,h,c,d,p,g,y,w){var b=l-n,m=h-i,E=b*b+m*m;if(E>4*t&&y--){var _=o+d,S=a+p,C=u+g,P=_l(_*_+S*S+C*C),x=Xa(C/=P),M=On(On(C)-1)<Be||On(s-c)<Be?(s+c)/2:vl(S,_),O=r(M,x),I=O[0],T=O[1],A=I-n,G=T-i,nt=m*A-b*G;(nt*nt/E>t||On((b*A+m*G)/E-.5)>.3||o*d+a*p+u*g<uO)&&(e(n,i,s,o,a,u,I,T,M,_/=P,S/=P,C,y,w),w.point(I,T),e(I,T,M,_,S,C,l,h,c,d,p,g,y,w))}}return function(n){var i,s,o,a,u,l,h,c,d,p,g,y,w={point:b,lineStart:m,lineEnd:_,polygonStart:function(){n.polygonStart(),w.lineStart=S},polygonEnd:function(){n.polygonEnd(),w.lineStart=m}};function b(x,M){x=r(x,M),n.point(x[0],x[1])}function m(){c=NaN,w.point=E,n.lineStart()}function E(x,M){var O=yl([x,M]),I=r(x,M);e(c,d,h,p,g,y,c=I[0],d=I[1],h=x,p=O[0],g=O[1],y=O[2],Mw,n),n.point(c,d)}function _(){w.point=b,n.lineEnd()}function S(){m(),w.point=C,w.lineEnd=P}function C(x,M){E(i=x,M),s=c,o=d,a=p,u=g,l=y,w.point=E}function P(){e(c,d,h,p,g,y,s,o,i,a,u,l,Mw,n),w.lineEnd=_,_()}return w}}var cO=xw({point:function(r,t){this.stream.point(r*Ci,t*Ci)}});function dO(r){return fO(function(){return r})()}function fO(r){var t,e=150,n=480,i=250,s,o,a=0,u=0,l=0,h=0,c=0,d,p,g=null,y=Pw,w=null,b,m,E,_=Sw,S=.5,C=Tw(I,S),P,x;function M(G){return G=p(G[0]*Ci,G[1]*Ci),[G[0]*e+s,o-G[1]*e]}function O(G){return G=p.invert((G[0]-s)/e,(o-G[1])/e),G&&[G[0]*ra,G[1]*ra]}function I(G,nt){return G=t(G,nt),[G[0]*e+s,o-G[1]*e]}M.stream=function(G){return P&&x===G?P:P=cO(y(d,C(_(x=G))))},M.clipAngle=function(G){return arguments.length?(y=+G?oO(g=G*Ci,6*Ci):(g=null,Pw),A()):g*ra},M.clipExtent=function(G){return arguments.length?(_=G==null?(w=b=m=E=null,Sw):KN(w=+G[0][0],b=+G[0][1],m=+G[1][0],E=+G[1][1]),A()):w==null?null:[[w,b],[m,E]]},M.scale=function(G){return arguments.length?(e=+G,T()):e},M.translate=function(G){return arguments.length?(n=+G[0],i=+G[1],T()):[n,i]},M.center=function(G){return arguments.length?(a=G[0]%360*Ci,u=G[1]%360*Ci,T()):[a*ra,u*ra]},M.rotate=function(G){return arguments.length?(l=G[0]%360*Ci,h=G[1]%360*Ci,c=G.length>2?G[2]%360*Ci:0,T()):[l*ra,h*ra,c*ra]},M.precision=function(G){return arguments.length?(C=Tw(I,S=G*G),A()):_l(S)},M.fitExtent=function(G,nt){return Iw(M,G,nt)},M.fitSize=function(G,nt){return aO(M,G,nt)};function T(){p=dw(d=$N(l,h,c),t);var G=t(a,u);return s=n-G[0]*e,o=i+G[1]*e,A()}function A(){return P=x=null,M}return function(){return t=r.apply(this,arguments),M.invert=t.invert&&O,T()}}function Nw(r){return function(t,e){var n=He(t),i=He(e),s=r(n*i);return[s*i*$e(t),s*$e(e)]}}function Ow(r){return function(t,e){var n=_l(t*t+e*e),i=r(n),s=$e(i),o=He(i);return[vl(t*s,n*o),Xa(n&&e*s/n)]}}var pO=Nw(function(r){return _l(2/(1+r))});pO.invert=Ow(function(r){return 2*Xa(r/2)});var Dw=Nw(function(r){return(r=uw(r))&&r/$e(r)});Dw.invert=Ow(function(r){return r});function gO(){return dO(Dw).scale(79.4188).clipAngle(179.999)}function Aw(r,t){return[r,t]}Aw.invert=Aw;function mO(r,t,e){e=e||{};var n=e.units||"kilometers",i=e.steps||8;if(!r)throw new Error("geojson is required");if(typeof e!="object")throw new Error("options must be an object");if(typeof i!="number")throw new Error("steps must be an number");if(t===void 0)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var s=[];switch(r.type){case"GeometryCollection":return jd(r,function(o){var a=Cf(o,t,n,i);a&&s.push(a)}),jr(s);case"FeatureCollection":return Wu(r,function(o){var a=Cf(o,t,n,i);a&&Wu(a,function(u){u&&s.push(u)})}),jr(s)}return Cf(r,t,n,i)}function Cf(r,t,e,n){var i=r.properties||{},s=r.type==="Feature"?r.geometry:r;if(s.type==="GeometryCollection"){var o=[];return jd(r,function(y){var w=Cf(y,t,e,n);w&&o.push(w)}),jr(o)}var a=vO(s),u={type:s.type,coordinates:Lw(s.coordinates,a)},l=new Kg,h=l.read(u),c=Sg(Cg(t,e),"meters"),d=an.bufferOp(h,c,n),p=new V1;if(d=p.write(d),!Rw(d.coordinates)){var g={type:d.type,coordinates:Fw(d.coordinates,a)};return ri(g,i)}}function Rw(r){return Array.isArray(r[0])?Rw(r[0]):isNaN(r[0])}function Lw(r,t){return typeof r[0]!="object"?t(r):r.map(function(e){return Lw(e,t)})}function Fw(r,t){return typeof r[0]!="object"?t.invert(r):r.map(function(e){return Fw(e,t)})}function vO(r){var t=Wy(r).geometry.coordinates,e=[-t[0],-t[1]];return gO().rotate(e).scale(Rn)}function _O(r,t,e){e===void 0&&(e={});var n=Hn(r),i=Hn(t),s=Ug.union(n.coordinates,i.coordinates);return s.length===0?null:s.length===1?ye(s[0],e.properties):Eg(s,e.properties)}function Cc(r,t,e){e===void 0&&(e={});var n=Hn(r),i=Hn(t),s=Ug.intersection(n.coordinates,i.coordinates);return s.length===0?null:s.length===1?ye(s[0],e.properties):Eg(s,e.properties)}function yO(r,t,e){e===void 0&&(e={});var n=JSON.stringify(e.properties||{}),i=r[0],s=r[1],o=r[2],a=r[3],u=(s+a)/2,l=(i+o)/2,h=t*2/gn([i,u],[o,u],e),c=h*(o-i),d=t*2/gn([l,s],[l,a],e),p=d*(a-s),g=c/2,y=g*2,w=Math.sqrt(3)/2*p,b=o-i,m=a-s,E=3/4*y,_=w,S=(b-y)/(y-g/2),C=Math.floor(S),P=(C*E-g/2-b)/2-g/2+E/2,x=Math.floor((m-w)/w),M=(m-x*w)/2,O=x*w-m>w/2;O&&(M-=w/4);for(var I=[],T=[],A=0;A<6;A++){var G=2*Math.PI/6*A;I.push(Math.cos(G)),T.push(Math.sin(G))}for(var nt=[],J=0;J<=C;J++)for(var st=0;st<=x;st++){var k=J%2===1;if(!(st===0&&k)&&!(st===0&&O)){var q=J*E+i-P,j=st*_+s+M;if(k&&(j-=w/2),e.triangles===!0)EO([q,j],c/2,p/2,JSON.parse(n),I,T).forEach(function(D){e.mask?Cc(e.mask,D)&&nt.push(D):nt.push(D)});else{var B=wO([q,j],c/2,p/2,JSON.parse(n),I,T);e.mask?Cc(e.mask,B)&&nt.push(B):nt.push(B)}}}return jr(nt)}function wO(r,t,e,n,i,s){for(var o=[],a=0;a<6;a++){var u=r[0]+t*i[a],l=r[1]+e*s[a];o.push([u,l])}return o.push(o[0].slice()),ye([o],n)}function EO(r,t,e,n,i,s){for(var o=[],a=0;a<6;a++){var u=[];u.push(r),u.push([r[0]+t*i[a],r[1]+e*s[a]]),u.push([r[0]+t*i[(a+1)%6],r[1]+e*s[(a+1)%6]]),u.push(r),o.push(ye([u],n))}return o}function SO(r,t,e,n){n===void 0&&(n={});for(var i=[],s=r[0],o=r[1],a=r[2],u=r[3],l=t/gn([s,o],[a,o],n),h=l*(a-s),c=e/gn([s,o],[s,u],n),d=c*(u-o),p=a-s,g=u-o,y=Math.floor(p/h),w=Math.floor(g/d),b=(p-y*h)/2,m=(g-w*d)/2,E=s+b,_=0;_<y;_++){for(var S=o+m,C=0;C<w;C++){var P=ye([[[E,S],[E,S+d],[E+h,S+d],[E+h,S],[E,S]]],n.properties);n.mask?nN(n.mask,P)&&i.push(P):i.push(P),S+=d}E+=h}return jr(i)}function CO(r,t,e){return e===void 0&&(e={}),SO(r,t,t,e)}function bO(r,t,e){e===void 0&&(e={});for(var n=[],i=t/gn([r[0],r[1]],[r[2],r[1]],e),s=i*(r[2]-r[0]),o=t/gn([r[0],r[1]],[r[0],r[3]],e),a=o*(r[3]-r[1]),u=0,l=r[0];l<=r[2];){for(var h=0,c=r[1];c<=r[3];){var d=null,p=null;u%2===0&&h%2===0?(d=ye([[[l,c],[l,c+a],[l+s,c],[l,c]]],e.properties),p=ye([[[l,c+a],[l+s,c+a],[l+s,c],[l,c+a]]],e.properties)):u%2===0&&h%2===1?(d=ye([[[l,c],[l+s,c+a],[l+s,c],[l,c]]],e.properties),p=ye([[[l,c],[l,c+a],[l+s,c+a],[l,c]]],e.properties)):h%2===0&&u%2===1?(d=ye([[[l,c],[l,c+a],[l+s,c+a],[l,c]]],e.properties),p=ye([[[l,c],[l+s,c+a],[l+s,c],[l,c]]],e.properties)):h%2===1&&u%2===1&&(d=ye([[[l,c],[l,c+a],[l+s,c],[l,c]]],e.properties),p=ye([[[l,c+a],[l+s,c+a],[l+s,c],[l,c+a]]],e.properties)),e.mask?(Cc(e.mask,d)&&n.push(d),Cc(e.mask,p)&&n.push(p)):(n.push(d),n.push(p)),c+=a,h++}u++,l+=s}return jr(n)}function PO(r,t,e){if(e=e||{},typeof e!="object")throw new Error("options is invalid");var n=e.gridType,i=e.property,s=e.weight;if(!r)throw new Error("points is required");if(H2(r,"Point","input must contain Points"),!t)throw new Error("cellSize is required");if(s!==void 0&&typeof s!="number")throw new Error("weight must be a number");i=i||"elevation",n=n||"square",s=s||1;var o=ii(r),a;switch(n){case"point":case"points":a=LT(o,t,e);break;case"square":case"squares":a=CO(o,t,e);break;case"hex":case"hexes":a=yO(o,t,e);break;case"triangle":case"triangles":a=bO(o,t,e);break;default:throw new Error("invalid gridType")}var u=[];return Wu(a,function(l){var h=0,c=0;Wu(r,function(p){var g=n==="point"?l:Mg(l),y=gn(g,p,e),w;if(i!==void 0&&(w=p.properties[i]),w===void 0&&(w=p.geometry.coordinates[2]),w===void 0)throw new Error("zValue is missing");y===0&&(h=w);var b=1/Math.pow(y,s);c+=b,h+=b*w});var d=uT(l);d.properties[i]=h/c,u.push(d)}),jr(u)}function xO(r,t){(r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1])&&r.push(r[0]);const e=de(t),n=ye([r]);return Sn(e,n)}function IO(r,t){const e=br(r);return Dg(e,t,{units:"meters"}).geometry.coordinates}function gm(r){if((r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1]||r[0][2]!==r[r.length-1][2])&&r.push(r[0]),r.length<=3)return 0;const t=ye([r]);return bT(t)}function MO(r){(r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1]||r[0][2]!==r[r.length-1][2])&&r.push(r[0]);const t=ye([r]),n=Hy(t).geometry.coordinates;return[n[0],n[1],n[2]??r[0][2]??0]}function kw(r,t,e,n){const[i,s,o]=r,a=Hu(de([i,s]),t,e,{units:"meters"});if(!(!a||!a.geometry||!a.geometry.coordinates))return n=n||[0,0,0],n[0]=a.geometry.coordinates[0],n[1]=a.geometry.coordinates[1],n[2]=o,n}function bf(r,t){return gn(de(r),de(t),{units:"meters"})}function bc(r,t){return Yh(de(r),de(t))}function TO(r,t){return Jh(br(r),br(t))}function NO(r,t){const e=de(r),n=de(t),i=dT(e,n),s=(r[2]+t[2])/2;return[...i.geometry.coordinates,s]}function OO(r,t){const e=de(t),n=br(r);return wT(n,e,{units:"meters"})}function DO(r,t){const e=de(r),n=br(t);return ST(e,n,{units:"meters"})}function AO(r,t,e,n){const[i,s,o]=r,a=jT(de([i,s]),t,e,{units:"meters"});if(!(!a||!a.geometry||!a.geometry.coordinates))return n=n||[0,0,0],n[0]=a.geometry.coordinates[0],n[1]=a.geometry.coordinates[1],n[2]=o,n}function Gw(r,t){return e1(de(r),de(t),{units:"meters"})}function RO(r,t){return GT(de(r),de(t))}function jw(r,t){(r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1]||r[0][2]!==r[r.length-1][2])&&r.push(r[0]),(t[0][0]!==t[t.length-1][0]||t[0][1]!==t[t.length-1][1]||t[0][2]!==t[t.length-1][2])&&t.push(t[0]);const e=Cc(ye([r]),ye([t]));if(e)return e.geometry.coordinates}function Vw(r,t){(r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1]||r[0][2]!==r[r.length-1][2])&&r.push(r[0]),(t[0][0]!==t[t.length-1][0]||t[0][1]!==t[t.length-1][1]||t[0][2]!==t[t.length-1][2])&&t.push(t[0]);const e=_O(ye([r]),ye([t]));if(e)return e.geometry.coordinates}function Bw(r,t=500,e="meters"){const n=mO(br(r),t,{units:e});if(n)return n.geometry.coordinates}function zw(r,t){(r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1]||r[0][2]!==r[r.length-1][2])&&r.push(r[0]),(t[0][0]!==t[t.length-1][0]||t[0][1]!==t[t.length-1][1]||t[0][2]!==t[t.length-1][2])&&t.push(t[0]);const e=IN(ye([r]),ye([t]));if(e)return e.geometry.coordinates}function Uw(r,t,e=10,n="meters"){return hT(r,t,{steps:e,units:n}).geometry.coordinates}function mm(r,t){(r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1]||r[0][2]!==r[r.length-1][2])&&r.push(r[0]),(t[0][0]!==t[t.length-1][0]||t[0][1]!==t[t.length-1][1]||t[0][2]!==t[t.length-1][2])&&t.push(t[0]);const e=ye([r]),n=ye([t]);return $T(e,n)?"oneBig":a1(e,n)?"twoBig":!1}function qw(r){const t=No(wa(r,["0"])),e=No(wa(r,["1"])),n=No(wa(r,["2"])),i=Ks(wa(r,["0"])),s=Ks(wa(r,["1"])),o=Ks(wa(r,["2"]));return{minPos:[t,e,n],maxPos:[i,s,o],center:[(t+i)*.5,(e+s)*.5,(n+o)*.5]}}function Ww(r){const{minPos:t,maxPos:e,center:n}=qw(r);if(t.some(a=>!Number.isFinite(a)||e.some(u=>!Number.isFinite(u))||n.some(u=>!Number.isFinite(u)))){console.warn("geoCenterAndRadiusFromPositions error: minPos.some(e => !Number.isFinite(e) || maxPos.some(e => !Number.isFinite(e)) || center.some(e => !Number.isFinite(e))");return}const i=bf(t,e);let s=i*.5;const o=Math.abs(t[2]-e[2]);return o!=0&&(s=Math.sqrt(i*i+o*o)*.5),{center:n,radius:s}}function Hw(r,t){const e=ki(r),n=ki(t);return v.Vector.distance(e,n)}function Pc(r,t){const e=[],n=r.length;let i=0;for(let s=0;s<n-1;++s){if(t===void 0||t==="GEODESIC"){const o=bf(r[s],r[s+1]),a=Math.abs(r[s][2]-r[s+1][2]);if(a===0)i+=o;else{const u=Math.sqrt(o*o+a*a);i+=u}}else if(t==="RHUMB"){const o=Gw(r[s],r[s+1]),a=Math.abs(r[s][2]-r[s+1][2]);if(a===0)i+=o;else{const u=Math.sqrt(o*o+a*a);i+=u}}else if(t==="NONE"){const o=Hw(r[s],r[s+1]);i+=o}else console.warn(`未知的arcType: ${t},导致距离无法计算!`);e.push(i)}return e}function vm(r){const t="__getXyzFromPostion";let e=kr(r,t);return(!e||!v.Vector.equals(e[0],r))&&(e=[[...r],ki(r)],fs(r,t,e)),e[1]}class LO{constructor(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(let e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(let e=0;e<this.length-1;e++){const n=this.points[e],i=this.points[e+1];this.centers.push({x:(n.x+i.x)/2,y:(n.y+i.y)/2,z:(n.z+i.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(let e=0;e<this.centers.length-1;e++){const n=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,i=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,s=this.points[e+1].z-(this.centers[e].z+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+n),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+i),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+s)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+n),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+i),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+s)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}cacheSteps(t){const e=[];let n=this.pos(0);e.push(0);for(let i=0;i<this.duration;i+=10){const s=this.pos(i);Math.sqrt((s.x-n.x)*(s.x-n.x)+(s.y-n.y)*(s.y-n.y)+(s.z-n.z)*(s.z-n.z))>t&&(e.push(i),n=s)}return e}vector(t){const e=this.pos(t+10),n=this.pos(t-10);return{angle:180*Math.atan2(e.y-n.y,e.x-n.x)/3.14,speed:Math.sqrt((n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y)+(n.z-e.z)*(n.z-e.z))}}pos(t){let e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);const n=e/this.duration;if(n>=1)return this.points[this.length-1];const i=Math.floor((this.points.length-1)*n),s=(this.length-1)*n-i;return FO(s,this.points[i],this.controls[i][1],this.controls[i+1][0],this.points[i+1])}}function FO(r,t,e,n,i){const s=kO(r);return{x:i.x*s[0]+n.x*s[1]+e.x*s[2]+t.x*s[3],y:i.y*s[0]+n.y*s[1]+e.y*s[2]+t.y*s[3],z:i.z*s[0]+n.z*s[1]+e.z*s[2]+t.z*s[3]}}function kO(r){const t=r*r;return[t*r,3*t*(1-r),3*r*(1-r)*(1-r),(1-r)*(1-r)*(1-r)]}function GO(r,t){t===void 0&&(t={});var e=t.resolution||1e3,n=t.sharpness||.85;const i=[],s=r.map(l=>{const[h,c,d]=ki(l);return{x:h,y:c,z:d}});for(var o=new LO({duration:e,points:s,sharpness:n}),a=function(l){var h=o.pos(l);const c=wg([h.x,h.y,h.z]);i.push(c)},u=0;u<o.duration;u+=10)a(u);return a(o.duration),i}function $w(r,t,e){return GO(r,{resolution:t,sharpness:e})}class Xw extends Du{constructor(t){super(t)}get propUiTree(){return this.uiTree}}class _m extends Ou{constructor(t,e,n){super(t,e),this._property=n}get property(){return this._property}}class ym extends _m{constructor(t,e){super(t,!1,e)}}class wm extends _m{constructor(t,e){super(t,!0,e)}get groupChildren(){return this.children}}function Yw(r,t){const e=new Xw(t),n=r.getProperties("chinese"),i=[];for(let s of n)if(s instanceof xt){const o=new wm(e,s);o.d(()=>s.destroy()),e.children.push(o),i.push(o)}else{const o=new ym(e,s);e.children.push(o),o.d(()=>s.destroy())}for(;i.length>0;){const s=i.pop();if(!s)throw new Error("should not be here!");const o=s;if(!(o.property instanceof xt))throw new Error("!(treeItem.property instanceof GroupProperty)");for(let a of o.property.children)if(a instanceof xt){const u=new wm(e,a);u.d(()=>a.destroy()),o.groupChildren.push(u),i.push(u)}else{const u=new ym(e,a);o.groupChildren.push(u),u.d(()=>a.destroy())}}return e.d(()=>{e.itemChildrenChanged.reset(),e.itemChildrenToChange.reset();const s=[...e.getDescendants()];s.forEach(o=>{o.children&&(o.children.length=0),o.destroy()}),s.length=0}),e}class El extends H{constructor(e){super();f(this,"_propTreeReact",this.dv($(void 0)));this.d(()=>this._propTreeReact.value=void 0),this.dv(new Je(this.sceneObjectChanged,n=>{if(!n)return;const i=new H;return i.d(n.toDestroyEvent.don(()=>{this.sceneObject=void 0})),i})),this.d(this.sceneObjectChanged.don(n=>{this._propTreeReact.value=void 0,!(!n||!(n instanceof yt))&&(this._propTreeReact.value=Yw(n,e))}))}get propTree(){return this._propTreeReact.value}get propTreeChanged(){return this._propTreeReact.changed}}(r=>{r.createDefaultProps=()=>({sceneObject:void 0})})(El||(El={})),Zs(El.prototype,El.createDefaultProps);function Em(r){return To(r,(t,e)=>t[0]===e[0]&&t[1]===e[1],t=>[...t])}function Jw(r,t){const e=new Array;for(let n of r)e.push(t(n));return e}function Sm(r,t){return r===void 0&&t===void 0?!0:!r||!t?!1:r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]}function Zw(r,t,e){var i;((i=t.attachedViewers.values().toArray()[0])==null?void 0:i.getEngineObject(t))?e.call(r):requestAnimationFrame(()=>Zw(r,t,e))}function jO(r,t,e,n=!0){n&&e(),r.dispose(t.disposableOn(e))}function VO(r,t){const{type:e,id:n}=r;if(e){const i=yt.create(e,n);if(i)return i.json=r,i;console.warn(`cannot create sceneObject from type(${e})`)}else console.warn(`cannot create sceneObject from type(${e})`)}function Kw(r){const t=r.children&&Ep(r.children,n=>{if(!(n instanceof Qn))throw new Error("!(treeItem instanceof SceneTreeItem)");return!n.show})||!1,e=r.sceneTree.getSceneObjectShowFunc(r.sceneObject);return!t||e}class Qn extends Ou{constructor(e,n=!1,i,s,o=!0){super(e,n,i);f(this,"_dragDrop");f(this,"_showChangedNotAffectChildren",!1);f(this,"_showChangedNotAffectParent",!1);f(this,"_type",this.dv($("Unknown")));f(this,"_isExport",this.dv($(!0)));const a=()=>this.tree&&this.tree.itemsChanged.emit([this]);this.dispose(this.nameChanged.disposableOn(a)),this.name=`未命名条目(${this.id})`,this.extras=s,this._isExport.value=o;let u;const l=()=>{u&&(u(),u=void 0)};this.dispose(l),this.dispose(this.sceneObjectChanged.disposableOn(h=>{l(),h&&(u=_t([this,"name"],[h,"name"]))})),this.dispose(this.showChanged.disposableOn(h=>{if(e.setSceneObjectShowFunc(this.sceneObject,h),this.tree&&this.tree.forceRedraw(),this.children&&!this._showChangedNotAffectChildren)for(let c of this.children)c instanceof Qn&&(c._showChangedNotAffectParent=!0,c.show=h,c._showChangedNotAffectParent=!1);this.parent&&this.parent instanceof Qn&&!this._showChangedNotAffectParent&&(this.parent._showChangedNotAffectChildren=!0,this.parent.show=Kw(this.parent),this.parent._showChangedNotAffectChildren=!1)})),this.dv(new Je(this.sceneObjectChanged,()=>{if(!this.sceneObject)return;const h=new H;if("show"in this.sceneObject&&"showChanged"in this.sceneObject&&this.sceneObject.showChanged instanceof N){const c=()=>{this.show=e.getSceneObjectShowFunc(this.sceneObject)};c(),h.dispose(this.sceneObject.showChanged.disposableOn(c))}else if("enabled"in this.sceneObject&&"enabledChanged"in this.sceneObject&&this.sceneObject.enabledChanged instanceof N){const c=()=>{this.show=e.getSceneObjectShowFunc(this.sceneObject)};c(),h.dispose(this.sceneObject.enabledChanged.disposableOn(c))}return h})),this.childrenChangedEvent.disposableOn(()=>{const h=Kw(this);this._showChangedNotAffectChildren=!0,this.show=h,this._showChangedNotAffectChildren=!1});{const h=()=>{let c="Unknown";this.sceneObject?c=this.sceneObject.typeName:this.children&&(c="Folder"),this._type.value=c};this.dispose(this.sceneObjectChanged.disposableOn(h)),this.dispose(this.childrenResetedEvent.disposableOn(h)),h()}}get dragDrop(){return this._dragDrop||(this._dragDrop=this.dv(this.sceneTree.createTreeItemDragDropFunc(this))),this._dragDrop}get type(){return this._type.value}get typeChanged(){return this._type.changed}get isExport(){return this._isExport.value}get isExportChanged(){return this._isExport.changed}set isExport(e){this._isExport.value=e}get sceneTree(){return this.tree}get jsonStr(){return JSON.stringify(this.json,void 0," ")}set jsonStr(e){try{this.json=JSON.parse(e)}catch(n){console.error(`sceneTreeItem.jsonStr error ${n}`,n)}}get completeJson(){const e=this.children&&[...this.children].filter(n=>n.isExport).map(n=>n.completeJson);return{name:this.name,show:this.show?void 0:!1,collapsed:this.uiTreeObject.collapsed?!0:void 0,sceneObj:this.sceneObject&&this.sceneObject.completeJson,children:e,extras:this.extras}}get json(){const e=this.children&&[...this.children].filter(n=>n.isExport).map(n=>n.json);return{name:this.name,show:this.show?void 0:!1,collapsed:this.uiTreeObject.collapsed?!0:void 0,sceneObj:this.sceneObject&&this.sceneObject.json,children:e,extras:this.extras}}set json(e){if(e.name!==void 0&&(this.name=e.name),this.extras=e.extras,this._showChangedNotAffectChildren=!0,this._showChangedNotAffectParent=!0,this.show=e.show??!0,this._showChangedNotAffectChildren=!1,this._showChangedNotAffectParent=!1,this.uiTreeObject.collapsed=e.collapsed??!1,this.sceneObject=void 0,e.sceneObj&&(this.sceneObject=this.sceneTree.createSceneObjectFunc(e.sceneObj,this)),!!e.children){if(this.resetChildren(!0),!this.children)throw new Error("resetChildren(true) cannot get children!");for(let n of e.children){const i=new Qn(this.tree,!0);i.json=n,this.children.push(i)}}}clone(){try{const e=new Qn(this.sceneTree,!!this.children,void 0,this.extras,this.isExport);return e.json=this.json,e.name=this.sceneTree.getSceneTreeItemCloneNameFunc(this),e}catch(e){console.error(`SceneTreeItem.clone error: ${e}`,e)}}insertNewTreeItem(e,n){if(e==="FolderInnerOrAfter"||e==="FolderInnerOrBefore"||e==="FolderInner"){if(n&&n.tree!==this.tree)return console.warn("newTreeItem.tree !== this.tree"),!1;if(this.children&&!(e.includes("Or")&&this.sceneObject))return n&&this.children.push(n),!0;if(e==="FolderInner")return!1;if(e==="FolderInnerOrAfter")return super.insertNewTreeItem("After",n);if(e==="FolderInnerOrBefore")return super.insertNewTreeItem("Before",n);throw new Error("should not be here!")}else return super.insertNewTreeItem(e,n)}}(r=>{r.createDefaultProps=()=>({name:"未命名条目",nameEditing:!1,sceneObject:void 0,show:!0,extras:Ie(void 0)})})(Qn||(Qn={})),Zs(Qn.prototype,Qn.createDefaultProps);function Qw(r,t,e){let{offsetY:n}=t;if(!t.target||!("clientTop"in t.target))return"none";n+=2,n+=t.target.clientTop;let i="none";return r.children?n<=e*.3?i="before":n>=e*.7?!r.uiTreeObject.collapsed&&r.children.length>0?i="inner":i="after":i="inner":n<=e*.5?i="before":i="after",i}class tE extends T0{constructor(t){super(),this._treeItem=t;const{dragStartDataManager:e}=this._treeItem.sceneTree;let n="none";const i=this.disposeVar(T_(()=>{this._treeItem.uiTreeObject.moveToPositionMode=n,console.log(`uiTreeObject.moveToPositionMode = lastDragMode(${n});`)},200));function s(o){n!==o&&(n=o,i.restart())}this.dispose(this._dragStartEvent.disposableOn(o=>{e.data={type:"UITreeA",value:this._treeItem}})),this.dispose(this._dragOverEvent.disposableOn(o=>{if(!o.dataTransfer)return;o.preventDefault();const a=e;if(a.data&&a.data.type==="UITreeA"&&a.data.value!==void 0){const u=a.data.value,l=this._treeItem,{tree:h}=l;if(h){const c=[...h.selectedItems];~c.indexOf(u)||c.push(u);const d=Qw(l,o,h.itemDivHeight);if(d!=="none"&&Du.canMoveToTreeItems(c,l,d)){o.dataTransfer.dropEffect="move",s(d);return}}}o.dataTransfer.dropEffect="none",s("none")})),this.dispose(this._dropEvent.disposableOn(o=>{const a=e;if(!(a.data&&a.data.type==="UITreeA"&&a.data.value!==void 0))return;const u=a.data.value,l=this._treeItem,{tree:h}=l;if(!h)return;const c=[...h.selectedItems];~c.indexOf(u)||c.push(u);const d=Qw(l,o,h.itemDivHeight);d!=="none"&&Du.canMoveToTreeItems(c,l,d)&&(Du.moveToTreeItems(c,l,d),a.data=void 0,s("none"))})),this.dispose(this._dragLeaveEvent.disposableOn(()=>{n="none",i.restart()}))}}function BO(r){if(!(r instanceof Qn))throw new Error("defaultCreateTreeItemDragDrop !(treeItem instanceof SceneTreeItem)");return new tE(r)}function zO(r){let t=!1;return r&&("show"in r?t=r.show??!0:"enabled"in r&&(t=r.enabled??!0)),t}function UO(r,t){r&&("show"in r?r.show=t:"enabled"in r&&(r.enabled=t))}const qO=["EnvironmentVariables","ScriptsLoader","SceneScript","ScriptLoader"];function WO(r){const t=[],{root:e={}}=r,n=[e];for(;n.length>0;){const i=n.pop();if(!i)throw new Error("!todo");if(i.children){for(let s of i.children)if(s.children&&n.unshift(s),s.sceneObj){const{type:o=void 0}=s.sceneObj;o||(console.warn("sceneObjJson has no type! treeItem.sceneObj: "),console.warn(s.sceneObj)),o&&qO.includes(o)&&t.push(s.sceneObj)}}}return t}async function HO(r,t){const e=WO(r);let n=0;const i=e.length;for(let s of e)if(++n,t){const o=n/i;t(o,n,i)}}class eE extends H{constructor(e,n){super();f(this,"treeItemContexMenuCallback");this._sceneTree=e,this._projectManager=n}get sceneTree(){return this._sceneTree}}class $O extends H{constructor(e){super();f(this,"_jsonLoadingEvent",this.disposeVar(new N));f(this,"_setJsonProcessing",this.disposeVar(Gr(async(e,n)=>{this._jsonLoadingEvent.emit({type:"init"}),this._jsonLoadingEvent.emit({type:"loading"}),n&&await e.promise(this._sceneTree.preloadFunc(n)),this._setJson(n),this._jsonLoadingEvent.emit({type:"loaded"})})));this._sceneTree=e,this._setJsonProcessing.errorFunc=n=>{this._jsonLoadingEvent.emit({type:"error",error:n})}}get jsonLoadingEvent(){return this._jsonLoadingEvent}_setJson(e){try{this._sceneTree.setJson(e||{})}catch(n){console.error(`json数据装配时发生错误!error: ${n}`)}}get json(){return this._sceneTree.getJson()}set json(e){this._setJsonProcessing.restart(new Di("JSON重新赋值!"),e)}get jsonStr(){return JSON.stringify(this.json,void 0," ")}set jsonStr(e){this.json=JSON.parse(e)}}function XO(r){return r.name+"_clone"}function Cm(r,t,e){if(r instanceof Qn)return r.insertNewTreeItem(t,e);{const n={FolderInnerOrAfter:"InnerOrAfter",FolderInnerOrBefore:"InnerOrBefore",FolderInner:"Inner",InnerOrAfter:"InnerOrAfter",InnerOrBefore:"InnerOrBefore",Inner:"Inner",After:"After",Before:"Before"};return r.insertNewTreeItem(n[t],e)}}function YO(r){[r,...r.getDescendants()].forEach(t=>t.destroy())}const Rr=class Rr extends Du{constructor(e,n,i,s){super(i);f(this,"_jsonLoading",this.disposeVar(new $O(this)));f(this,"createSceneObjectFunc",Rr.defaultCreateSceneObjectFunc);f(this,"createTreeItemDragDropFunc",Rr.defaultCreateTreeItemDragDropFunc);f(this,"preloadFunc",Rr.defaultPreload);f(this,"getSceneObjectShowFunc",Rr.defaultGetSceneObjectShow);f(this,"setSceneObjectShowFunc",Rr.defaultSetSceneObjectShow);f(this,"getSceneTreeItemCloneNameFunc",Rr.defaultGetSceneTreeItemCloneNameFunc);f(this,"debug",!1);f(this,"_contextMenu",this.disposeVar(new eE(this,this.projectManager)));f(this,"_showPropUiOnSelecting",this.disposeVar($(!0)));this._name=e,this._dragStartDataManager=n,this._projectManager=s,this.dispose(this.selectedItems.changedEvent.disposableOn(()=>{var a,u;window.lssn=this.lastSelectedItem,window.lsso=(a=this.lastSelectedItem)==null?void 0:a.sceneObject,this.debug&&console.log(((u=this.lastSelectedItem)==null?void 0:u.sceneObject)??"select null")}));const{sceneObjectsManager:o}=this._projectManager;this.dispose(this.itemsDeleted.disposableOn(a=>{for(let u of a){const l=u,{sceneObject:h}=l;h&&o.deleteSceneObject(h)&&h.destroy()&&bd(h,void 0);for(let c of l.getDescendants()){const{sceneObject:d}=c;d&&o.deleteSceneObject(d)&&d.destroy()&&bd(d,void 0)}YO(u)}})),this.dispose(this.itemsAdded.disposableOn(a=>{for(let u of a){const l=u;l.sceneObject&&o.addSceneObject(l.sceneObject)&&bd(l.sceneObject,l)}})),this.dispose(this.selectedItems.changedEvent.disposableOn(()=>{if(!this.showPropUiOnSelecting)return;this._projectManager.propUiTreeManager.sceneObject=void 0;const{lastSelectedItem:a}=this;a&&(this._projectManager.propUiTreeManager.sceneObject=a.sceneObject)}))}get json(){return this._jsonLoading.json}set json(e){this._jsonLoading.json=e}get jsonStr(){return this._jsonLoading.jsonStr}set jsonStr(e){this._jsonLoading.jsonStr=e}get jsonLoadingEvent(){return this._jsonLoading.jsonLoadingEvent}get name(){return this._name}get projectManager(){return this._projectManager}get contextMenu(){return this._contextMenu}get showPropUiOnSelecting(){return this._showPropUiOnSelecting.value}set showPropUiOnSelecting(e){this._showPropUiOnSelecting.value=e}get showPropUiOnSelectingChanged(){return this._showPropUiOnSelecting.changed}get sceneUiTree(){return this.uiTree}getTreeItemFromSceneObjId(e){const n=this.getDescendants();let i;for(let s of n)if(s.sceneObject&&s.sceneObject.id===e){i=s;break}return i}getTreeItemsFromSceneObjType(e){const n=this.getDescendants(),i=[],s=Array.isArray(e)?e:[e];for(let o of n)o.sceneObject&&s.includes(o.sceneObject.typeName)&&i.push(o);return i}getTreeItemsFromSceneObjName(e){var s;const n=this.getDescendants(),i=[];for(let o of n)(s=o.sceneObject)!=null&&s.name.includes(e)&&i.push(o);return i}get dragStartDataManager(){return this._dragStartDataManager}get completeJson(){return{root:{children:[...this.children].filter(e=>e.isExport).map(e=>e.completeJson)}}}getJson(){return{root:{children:[...this.children].filter(e=>e.isExport).map(e=>e.json)}}}setJson(e){var i;e.root=e.root||{};const n=e.root.children??[];this.root.resetChildren(!0);for(let s of n){const o=new Qn(this,!0);o.json=s,(i=this.root.children)==null||i.push(o)}}testAddNewTreeItem(e,n){const i=e||this.lastSelectedItem||this.root;return i?Cm(i,n):!1}addNewTreeItem(e,n,i,s){const o=e||this.lastSelectedItem||this.root;if(o&&Cm(o,n)){const a=new Qn(this,i);if(a.sceneObject=s,!Cm(o,n,a))throw new Error("currentTreeItem.insertNewTreeItem return false!");return a}}createSceneObjectTreeItem(e,n,i,s){const o=s??"FolderInnerOrAfter";if(!this.testAddNewTreeItem(i,o)){console.warn(`cannot addNewTreeItem! currentTreeItem(${i?i.id:"root"})`);return}const a=yt.create(e,n);return a?this.addNewTreeItem(i,s??"FolderInnerOrAfter",!0,a):void 0}createGroupTreeItem(e,n,i,s){const o=s??"FolderInnerOrAfter";if(!this.testAddNewTreeItem(i,o)){console.warn(`cannot addNewTreeItem! currentTreeItem(${i?i.id:"root"})`);return}const a=this.addNewTreeItem(i,s??"FolderInnerOrAfter",!0);if(!a){console.warn("addNewTreeItem error!");return}return a.name=e??"未命名组节点",a}createSceneObjectTreeItemFromClass(e,n,i,s){const o=s??"FolderInnerOrAfter";if(!this.testAddNewTreeItem(i,o))return;const a=yt.createFromClass(e,n);return a?this.addNewTreeItem(i,o,!0,a):void 0}createSceneObjectTreeItemFromJson(e,n,i){const s=i??"FolderInnerOrAfter";if(!this.testAddNewTreeItem(n,s))return;const o=yt.createFromJson(e);return console.log(o),o?this.addNewTreeItem(n,i??"FolderInnerOrAfter",!0,o):void 0}destroySceneObjectTreeItem(e){if(e===this.root){console.warn("cannot destroy root! please use function destroyAllSceneObjectTreeItems!");return}e.detachFromParent()}destroyAllSceneObjectTreeItems(){if(!this.root.children)return;const e=[...this.root.children];for(let n of e)this.destroySceneObjectTreeItem(n)}};f(Rr,"defaultCreateSceneObjectFunc",VO),f(Rr,"defaultCreateTreeItemDragDropFunc",BO),f(Rr,"defaultPreload",HO),f(Rr,"defaultGetSceneObjectShow",zO),f(Rr,"defaultSetSceneObjectShow",UO),f(Rr,"defaultGetSceneTreeItemCloneNameFunc",XO);let xc=Rr;const bm={saturation:.35,brightness:1.4,gamma:.8,atmosphereScatteringIntensity:5,groundColor:[0,.09411764705882353,.3137254901960784,1]};class JO extends H{constructor(e){super();f(this,"_currentPosition",this.disposeVar(Oe(void 0)));f(this,"_currentRotation",this.disposeVar(Oe(void 0)));f(this,"_currentHeading",this.disposeVar($(void 0)));f(this,"_isRotating",this.disposeVar($(!1)));f(this,"_isGround",this.disposeVar($(!1)));f(this,"_startPosition",[0,0,0]);f(this,"_startRotation",[0,0,0]);f(this,"_processing",this.disposeVar(Gr(async(e,n,i,s)=>{const{currentPosition:o,currentRotation:a}=this;if(!o||s<=0||!a){this._currentPosition.value=n,this._currentRotation.value=i;return}const u=this._startPosition;u.splice(0,3,...o);const l=this._startRotation;l.splice(0,3,...a);let h=Date.now();const c=bc(u,n);this._currentHeading.value=c;const p=bf(u,n)/s,g=[i[0]-l[0],i[1]-l[1],i[2]-l[2]],y=n[2]-u[2];await e.promise(new Promise(w=>{e.disposer.dispose(cd(async()=>{let b=Date.now()-h;b=b<0?0:b,b=b>s?s:b;const m=b*p,E=kw(u,m,c);if(this.isGround&&E){const _=await this._esviewer.getTerrainHeight([E[0],E[1]]);this._currentPosition.value=[E[0],E[1],_??0]}else E&&(E[2]+=y*(b/s)),this._currentPosition.value=E;if(this.isRotating){const[_,S,C]=g,P=b/s;this._currentRotation.value=[l[0]+_*P,l[1]+S*P,l[2]+C*P]}b===s&&(this._currentPosition.value=n,this.isRotating&&(this._currentRotation.value=i),this.isRotating=!1,this.isGround=!1,w())}))}))})));this._esviewer=e}get currentPosition(){return this._currentPosition.value}get currentPositionChanged(){return this._currentPosition.changed}get currentRotation(){return this._currentRotation.value}get currentRotationChanged(){return this._currentRotation.changed}get currentHeading(){return this._currentHeading.value}get currentHeadingChanged(){return this._currentHeading.changed}get isRotating(){return this._isRotating.value}set isRotating(e){this._isRotating.value=e}get isRotatingChanged(){return this._isRotating.changed}get isGround(){return this._isGround.value}set isGround(e){this._isGround.value=e}get isGroundChanged(){return this._isGround.changed}get processing(){return this._processing}restart(e,n,i){this._processing.restart(void 0,e,n,i)}cancel(){this._processing.cancel()}}function nE(r){let t=0;function e(n,i){i++,t=Math.max(i,t),n.forEach(s=>{Array.isArray(s)&&e(s,i)})}return e(r,0),t}const ks=class ks extends ge{constructor(e){super(e);f(this,"editingBindMode","lineString");f(this,"_area",this.dv($(0)));f(this,"_perimeter",this.dv($(0)));this.d(Js(this.pointsChanged,()=>{this._updateArea(),this._updatePerimeter()},{immediate:!0}))}updateEditing(){var n;const e=[];this.editingBindMode=="doublePoints"?e.push(vt.DoublePointsAppend,vt.DoublePointsModify):this.editingBindMode=="lineString"?e.push(vt.LineStringAppend,vt.LineStringInsert,vt.Translation):this.editingBindMode=="circular"?(e.push(vt.CircularAppend,vt.CircularInsert,vt.Translation),this.supportEditingModes().includes(vt.HeightModify)&&e.push(vt.HeightModify)):this.editingBindMode=="visibility"?e.push(vt.VisibilityAppend,vt.VisibilityModify):this.editingBindMode=="scatter"&&e.push(vt.ScatterAppend,vt.ScatterModify),(n=this.activeViewer)==null||n.startEditing(this,e,{callSource:"inner"})}get area(){return this._area.value}get areaChanged(){return this._area.changed}get perimeter(){return this._perimeter.value}get perimeterChanged(){return this._perimeter.changed}_updateArea(){this._area.value=this.getArea()??0}_updatePerimeter(){this._perimeter.value=this.getPerimeter()??0}getArea(){if(this.points&&this.points.length>=3)return gm([...this.points])}getDistance(){if(this.points&&this.points.length>=2){const e=Pc(this.points,"GEODESIC");return e[e.length-1]}else return}getPerimeter(){if(this.points&&this.points.length>=3){const e=[...this.points,this.points[0]],n=Pc(e,"GEODESIC");return n[n.length-1]}else return}getIntersect(e){if(this.points&&this.points.length>=3&&e.length>=3){const n=jw(this.points,e);if(!n)return;const i=n[0][0][0];if(Array.isArray(i)){const s=[...n],o=[];return s.forEach(a=>{const u=a[0].map(l=>[...l,0]);o.push(u)}),o}else return[[...n][0].map(a=>[...a,0])]}else return}getUnion(e){if(this.points&&this.points.length>=3&&e.length>=3){const n=Vw(this.points,e);if(!n)return;const i=n[0][0][0];if(Array.isArray(i)){const s=[...n],o=[];return s.forEach(a=>{const u=a[0].map(l=>[...l,0]);o.push(u)}),o}else return[[...n][0].map(a=>[...a,0])]}else return}getDifference(e){if(this.points&&this.points.length>=3&&e.length>=3){let n=[...e];const i=e[0],s=e[e.length-1];i[0]===s[0]&&i[1]===s[1]&&i[2]===s[2]||n.push(i);const o=zw([...this.points,this.points[0]],[...n]);if(!o)return{status:"undefined",positions:void 0};const a=[...o];if(nE(a)===3){const u=a.map(d=>d.map(p=>[...p,0]));if(u.length<=1)return{status:"notIncluded",positions:u};const l=u[0],h=u[1];return mm([...l],[...h])==="oneBig"?{status:"included",positions:u}:{status:"notIncluded",positions:u}}else if(nE(a)===4){const l=[...a.map(c=>c.map(d=>d.map(p=>[...p,0])))],h=[];return l.forEach(c=>{h.push(c[0])}),{status:"notIncluded",positions:h}}else return{status:"undefined",positions:void 0}}else return{status:"undefined",positions:void 0}}getBuffer(e=500,n){if(this.points&&this.points.length>=2){const i=Bw(this.points,e,n);return i?[i[0].map(s=>[...s,0])]:void 0}else return}geoPolygonOverlap(e){if(this.points&&this.points.length>=3&&e.length>=3){const n=mm(this.points,e);return n==="oneBig"?!0:n==="twoBig"?!1:void 0}else return}getESProperties(){const e={...super.getESProperties()};return{...e,defaultMenu:"style",coordinate:[...e.coordinate,new ot([this,"editing"],"编辑",!1),new Et([this,"points"],"位置数组",ks.defaults.points,void 0,!0)],style:[...e.style,new xt([],"点样式"),new ot([this,"pointed"],"开启",!1),new L([this,"pointSize"],"点大小",1),new Wt([this,"pointSizeType"],[["screen","screen"],["world","world"]],"点类型","screen"),new Kt([this,"pointColor"],"点颜色",[1,1,1,1]),new Kt([this,"pointOutlineColor"],"轮廓颜色",ks.defaults.pointStyle.outlineColor),new L([this,"pointOutlineWidth"],"轮廓宽度",ks.defaults.pointStyle.outlineWidth),new xt([],"线样式"),new ot([this,"stroked"],"开启线样式",!0),new ot([this,"strokeGround"],"贴地",!1),new L([this,"strokeWidth"],"线宽",1),new Wt([this,"strokeWidthType"],[["screen","screen"],["world","world"]],"线类型","screen"),new Kt([this,"strokeColor"],"线颜色",[1,1,1,1]),new xt([],"面样式"),new ot([this,"filled"],"开启",!1),new ot([this,"fillGround"],"贴地",!1),new Kt([this,"fillColor"],"填充颜色",[1,1,1,1])],more:[...e.more,new xt([],"点样式集合"),new At([this,"pointMaterial"],"点材质"),new Et([this,"pointMaterialParams"],"点材质参数"),new xt([],"线样式集合"),new At([this,"strokeMaterial"],"线材质"),new Et([this,"strokeMaterialParams"],"线材质参数"),new xt([],"面样式集合"),new At([this,"fillMaterial"],"面材质"),new Et([this,"fillMaterialParams"],"面材质参数")]}}get pointSize(){return this.pointStyle.size}set pointSize(e){this.pointStyle={...this.pointStyle,size:e}}get pointSizeChanged(){return this.pointStyleChanged}get pointSizeType(){return this.pointStyle.sizeType}set pointSizeType(e){this.pointStyle={...this.pointStyle,sizeType:e}}get pointSizeTypeChanged(){return this.pointStyleChanged}get pointColor(){return this.pointStyle.color}set pointColor(e){this.pointStyle={...this.pointStyle,color:[...e]}}get pointColorChanged(){return this.pointStyleChanged}get pointOutlineColor(){return this.pointStyle.outlineColor}set pointOutlineColor(e){this.pointStyle={...this.pointStyle,outlineColor:[...e]}}get pointOutlineColorChanged(){return this.pointStyleChanged}get pointOutlineWidth(){return this.pointStyle.outlineWidth}set pointOutlineWidth(e){this.pointStyle={...this.pointStyle,outlineWidth:e}}get pointOutlineWidthChanged(){return this.pointStyleChanged}get pointMaterial(){return this.pointStyle.material}set pointMaterial(e){this.pointStyle={...this.pointStyle,material:e}}get pointMaterialChanged(){return this.pointStyleChanged}get pointMaterialParams(){return this.pointStyle.materialParams}set pointMaterialParams(e){this.pointStyle={...this.pointStyle,materialParams:e}}get pointMaterialParamsChanged(){return this.pointStyleChanged}get strokeWidth(){return this.strokeStyle.width}set strokeWidth(e){this.strokeStyle={...this.strokeStyle,width:e}}get strokeWidthChanged(){return this.strokeStyleChanged}get strokeWidthType(){return this.strokeStyle.widthType}set strokeWidthType(e){this.strokeStyle={...this.strokeStyle,widthType:e}}get strokeWidthTypeChanged(){return this.strokeStyleChanged}get strokeColor(){return this.strokeStyle.color}set strokeColor(e){this.strokeStyle={...this.strokeStyle,color:[...e]}}get strokeColorChanged(){return this.strokeStyleChanged}get strokeMaterial(){return this.strokeStyle.material}set strokeMaterial(e){this.strokeStyle={...this.strokeStyle,material:e}}get strokeMaterialChanged(){return this.strokeStyleChanged}get strokeMaterialParams(){return this.strokeStyle.materialParams}set strokeMaterialParams(e){this.strokeStyle={...this.strokeStyle,materialParams:e}}get strokeMaterialParamsChanged(){return this.strokeStyleChanged}get strokeGround(){return this.strokeStyle.ground}set strokeGround(e){this.strokeStyle={...this.strokeStyle,ground:e}}get strokeGroundChanged(){return this.strokeStyleChanged}get fillColor(){return this.fillStyle.color}set fillColor(e){this.fillStyle={...this.fillStyle,color:[...e]}}get fillColorChanged(){return this.fillStyleChanged}get fillMaterial(){return this.fillStyle.material}set fillMaterial(e){this.fillStyle={...this.fillStyle,material:e}}get fillMaterialChanged(){return this.fillStyleChanged}get fillMaterialParams(){return this.fillStyle.materialParams}set fillMaterialParams(e){this.fillStyle={...this.fillStyle,materialParams:e}}get fillMaterialParamsChanged(){return this.fillStyleChanged}get fillGround(){return this.fillStyle.ground}set fillGround(e){this.fillStyle={...this.fillStyle,ground:e}}get fillGroundChanged(){return this.fillStyleChanged}};f(ks,"createDefaultProps",()=>({...ge.createDefaultProps(),pointed:!1,pointStyle:Bt({size:10,sizeType:"screen",color:[1,1,1,1],material:"",materialParams:{},outlineColor:[1,0,0,1],outlineWidth:2}),stroked:!1,strokeStyle:Bt({width:1,widthType:"screen",color:[1,1,1,1],material:"",materialParams:{},ground:!1}),filled:!1,fillStyle:Bt({color:[1,1,1,1],material:"",materialParams:{},ground:!1}),points:ud([])})),f(ks,"type",ks.register("ESGeoVector",ks,{chsName:"地理矢量",tags:["ESObjects"],description:"地理矢量"})),f(ks,"supportEditingModes",[...ge.supportEditingModes,vt.Translation]);let Ht=ks;const nu=class nu extends ge{constructor(){super(...arguments);f(this,"_statusDis",this.dv($(!0)));f(this,"_smoothMoveEvent",this.dv(new N));f(this,"_smoothMoveWithRotationEvent",this.dv(new N));f(this,"_smoothMoveOnGroundEvent",this.dv(new N));f(this,"_smoothMoveWithRotationOnGroundEvent",this.dv(new N));f(this,"_automaticLandingEvent",this.dv(new N));f(this,"_smoothMoveKeepPitchEvent",this.dv(new N));f(this,"_smoothMoveRelativelyEvent",this.dv(new N));f(this,"_smoothMoveRelativelyWithRotationEvent",this.dv(new N));f(this,"useCalcFlyToParamInESObjectWithLocation",!0)}updateEditing(){var n;const e=[];this.editingBindMode=="singlePoint"?(e.push(vt.Place,vt.Translation),["ESLocationMeasurement"].includes(this.typeName)||e.push(vt.Rotation),["ESClippingPlane","ESLocationMeasurement","ESLocalRectangle","ESBoxClipping"].includes(this.typeName)||e.push(vt.Scale)):this.editingBindMode=="doublePoints"&&e.push(vt.DoublePointsAppend,vt.DoublePointsModify),(n=this.activeViewer)==null||n.startEditing(this,e,{callSource:"inner"})}get statusDis(){return this._statusDis.value}get statusDisChanged(){return this._statusDis.changed}get smoothMoveEvent(){return this._smoothMoveEvent}smoothMove(e,n){this._smoothMoveEvent.emit(e,n)}get smoothMoveWithRotationEvent(){return this._smoothMoveWithRotationEvent}smoothMoveWithRotation(e,n,i){this._smoothMoveWithRotationEvent.emit(e,n,i)}get smoothMoveOnGroundEvent(){return this._smoothMoveOnGroundEvent}smoothMoveOnGround(e,n,i,s){this._smoothMoveOnGroundEvent.emit(e,n,i,s)}get smoothMoveWithRotationOnGroundEvent(){return this._smoothMoveWithRotationOnGroundEvent}smoothMoveWithRotationOnGround(e,n,i,s,o){this._smoothMoveWithRotationOnGroundEvent.emit(e,n,i,s,o)}get automaticLandingEvent(){return this._automaticLandingEvent}automaticLanding(){const e=this.collision;this.collision=!1,setTimeout(()=>{this._automaticLandingEvent.emit(e)},100)}get smoothMoveKeepPitchEvent(){return this._smoothMoveKeepPitchEvent}smoothMoveKeepPitch(e,n){this._smoothMoveKeepPitchEvent.emit(e,n)}get smoothMoveRelativelyEvent(){return this._smoothMoveRelativelyEvent}smoothMoveRelatively(e,n){this._smoothMoveRelativelyEvent.emit(e,n)}get smoothMoveRelativelyWithRotationEvent(){return this._smoothMoveRelativelyWithRotationEvent}smoothMoveRelativelyWithRotation(e,n,i){this._smoothMoveRelativelyWithRotationEvent.emit(e,n,i)}getESProperties(){const e={...super.getESProperties()};return{...e,defaultMenu:"basic",location:[...e.location,new ot([this,"editing"],"是否编辑"),new It([],()=>this.automaticLanding(),[],"自动落地"),new Au([this,"position"],"位置数组",[0,0,0]),new Zp([this,"rotation"],"姿态数组",[0,0,0]),new Un([this,"scale"],"缩放",[1,1,1]),new L([this,"minVisibleDistance"],"最小可见距离",0),new L([this,"maxVisibleDistance"],"最大可见距离",0)],more:[...e.more,new It(["numbers","number"],(n,i)=>this.smoothMove(n,i),[[0,0,0],0],"平滑移动","smoothMove"),new It(["numbers","number"],(n,i)=>this.smoothMoveKeepPitch(n,i),[[0,0,0],0],"固定方向平滑移动","smoothMoveKeepPitch"),new It(["numbers","numbers","number"],(n,i,s)=>this.smoothMoveWithRotation(n,i,s),[[0,0,0],[0,0,0],0],"平滑偏移","smoothMoveWithRotation"),new It(["number","number","number","string"],(n,i,s,o)=>this.smoothMoveOnGround(n,i,s,o),[0,0,0,""],"贴地平滑移动","smoothMoveOnGround"),new It(["numbers","number","number","number","string"],(n,i,s,o,a)=>this.smoothMoveWithRotationOnGround(n,i,s,o,a),[[0,0,0],0,0,0,""],"贴地平滑偏移","smoothMoveWithRotationOnGround"),new It(["numbers","number"],(n,i)=>this.smoothMoveRelatively(n,i),[[0,0,0],0],"smoothMoveRelatively","smoothMoveRelatively"),new It(["numbers","numbers","number"],(n,i,s)=>this.smoothMoveRelativelyWithRotation(n,i,s),[[0,0,0],[0,0,0],0],"smoothMoveRelativelyWithRotation","smoothMoveRelativelyWithRotation"),new ot([this,"enableVisibleDistance"],"是否应用距离显隐")]}}get pointSize(){return this.pointStyle.size}set pointSize(e){this.pointStyle={...this.pointStyle,size:e}}get pointSizeChanged(){return this.pointStyleChanged}get pointSizeType(){return this.pointStyle.sizeType}set pointSizeType(e){this.pointStyle={...this.pointStyle,sizeType:e}}get pointSizeTypeChanged(){return this.pointStyleChanged}get pointColor(){return this.pointStyle.color}set pointColor(e){this.pointStyle={...this.pointStyle,color:[...e]}}get pointColorChanged(){return this.pointStyleChanged}get pointMaterial(){return this.pointStyle.material}set pointMaterial(e){this.pointStyle={...this.pointStyle,material:e}}get pointMaterialChanged(){return this.pointStyleChanged}get pointMaterialParams(){return this.pointStyle.materialParams}set pointMaterialParams(e){this.pointStyle={...this.pointStyle,materialParams:e}}get pointMaterialParamsChanged(){return this.pointStyleChanged}};f(nu,"createDefaultProps",()=>({...ge.createDefaultProps(),pointed:!1,pointStyle:Bt({size:1,sizeType:"screen",color:[1,1,1,1],material:"",materialParams:{},outlineColor:[1,0,0,1],outlineWidth:2}),position:Ot([0,0,0]),rotation:Ot([0,0,0]),scale:Ot([1,1,1]),minVisibleDistance:$(0),maxVisibleDistance:$(0)})),f(nu,"type",nu.register("ESObjectWithLocation",nu,{chsName:"对象位置",tags:["ESObjects"],description:"对象位置"})),f(nu,"supportEditingModes",[...ge.supportEditingModes,vt.Place,vt.Translation,vt.Rotation,vt.Scale,vt.DoublePointsAppend,vt.DoublePointsModify]);let Ct=nu;const Rl=class Rl extends Ct{getESProperties(){const t={...super.getESProperties()};return{...t,style:[...t.style,new xt([],"点样式集合"),new ot([this,"pointed"],"开启点样式",!1),new L([this,"pointSize"],"点大小",1),new Wt([this,"pointSizeType"],[["screen","screen"],["world","world"]],"点类型","screen"),new Kt([this,"pointColor"],"点颜色",[1,1,1,1]),new xt([],"线样式集合"),new ot([this,"stroked"],"开启线样式",!1),new ot([this,"strokeGround"],"是否贴地(线)",!1),new L([this,"strokeWidth"],"线宽",1),new Wt([this,"strokeWidthType"],[["screen","screen"],["world","world"]],"线类型","screen"),new Kt([this,"strokeColor"],"线颜色",[1,1,1,1]),new xt([],"面样式集合"),new ot([this,"filled"],"开启填充样式",!1),new ot([this,"fillGround"],"是否贴地",!1),new Kt([this,"fillColor"],"填充颜色",[1,1,1,1])],more:[...t.more,new xt([],"点样式"),new At([this,"pointMaterial"],"点材质",""),new Et([this,"pointMaterialParams"],"点材质参数",{}),new xt([],"线样式"),new At([this,"strokeMaterial"],"线材质",""),new Et([this,"strokeMaterialParams"],"线材质参数",{}),new xt([],"填充样式"),new At([this,"fillMaterial"],"面材质",""),new Et([this,"fillMaterialParams"],"面材质参数",{})]}}get strokeWidth(){return this.strokeStyle.width}set strokeWidth(t){this.strokeStyle={...this.strokeStyle,width:t}}get strokeWidthChanged(){return this.strokeStyleChanged}get strokeWidthType(){return this.strokeStyle.widthType}set strokeWidthType(t){this.strokeStyle={...this.strokeStyle,widthType:t}}get strokeWidthTypeChanged(){return this.strokeStyleChanged}get strokeColor(){return this.strokeStyle.color}set strokeColor(t){this.strokeStyle={...this.strokeStyle,color:[...t]}}get strokeColorChanged(){return this.strokeStyleChanged}get strokeMaterial(){return this.strokeStyle.material}set strokeMaterial(t){this.strokeStyle={...this.strokeStyle,material:t}}get strokeMaterialChanged(){return this.strokeStyleChanged}get strokeMaterialParams(){return this.strokeStyle.materialParams}set strokeMaterialParams(t){this.strokeStyle={...this.strokeStyle,materialParams:t}}get strokeMaterialParamsChanged(){return this.strokeStyleChanged}get strokeGround(){return this.strokeStyle.ground}set strokeGround(t){this.strokeStyle={...this.strokeStyle,ground:t}}get strokeGroundChanged(){return this.strokeStyleChanged}get fillColor(){return this.fillStyle.color}set fillColor(t){this.fillStyle={...this.fillStyle,color:[...t]}}get fillColorChanged(){return this.fillStyleChanged}get fillMaterial(){return this.fillStyle.material}set fillMaterial(t){this.fillStyle={...this.fillStyle,material:t}}get fillMaterialChanged(){return this.fillStyleChanged}get fillMaterialParams(){return this.fillStyle.materialParams}set fillMaterialParams(t){this.fillStyle={...this.fillStyle,materialParams:t}}get fillMaterialParamsChanged(){return this.fillStyleChanged}get fillGround(){return this.fillStyle.ground}set fillGround(t){this.fillStyle={...this.fillStyle,ground:t}}get fillGroundChanged(){return this.fillStyleChanged}};f(Rl,"createDefaultProps",()=>({...Ct.createDefaultProps(),pointed:!1,pointStyle:Bt({size:1,sizeType:"screen",color:[1,1,1,1],material:"",materialParams:{},outlineColor:[1,0,0,1],outlineWidth:1}),stroked:!1,strokeStyle:Bt({width:1,widthType:"screen",color:[1,1,1,1],material:"",materialParams:{},ground:!1}),filled:!1,fillStyle:Bt({color:[1,1,1,1],material:"",materialParams:{},ground:!1})})),f(Rl,"type",Rl.register("ESLocalVector",Rl,{chsName:"本地矢量",tags:["ESObjects"],description:"本地矢量对象"}));let Sl=Rl;const Yc=class Yc extends Sl{};f(Yc,"type",Yc.register("ESLocalVector2D",Yc,{chsName:"本地矢量2D",tags:["ESObjects"],description:"本地矢量2D对象"}));let vo=Yc;const ZO=[["固定朝向",0],["面向屏幕旋转",1],["绕自身Z轴旋转",2]],KO=[["单面不透明",0],["双面不透明",1],["单面遮罩",2],["双面遮罩",3],["单面透明",4],["双面透明",5],["单面未遮挡透明",6],["双面未遮挡透明",7]],Ll=class Ll extends Ct{constructor(){super(...arguments);f(this,"_widgetEvent",this.dv(new N))}get widgetEvent(){return this._widgetEvent}getESProperties(){const e={...super.getESProperties()};return{...e,basic:[...e.basic,new ot([this,"screenRender"],"屏幕渲染",!0),new ot([this,"sizeByContent"],"尺寸自适应",!0),new pn([this,"size"],"尺寸大小",[100,100]),new pn([this,"anchor"],"偏移比例",[.5,1]),new pn([this,"offset"],"像素偏移",[0,0]),new Wt([this,"renderMode"],KO,"渲染模式",0),new Wt([this,"rotationType"],ZO,"漫游旋转类型",1),new At([this,"actorTag"],"绑定对象"),new At([this,"socketName"],"插槽名称"),new Un([this,"positionOffset"],"位置偏移"),new Un([this,"rotationOffset"],"相对姿态")],more:[...e.more,new L([this,"zOrder"],"排序",0)]}}};f(Ll,"createDefaultProps",()=>({...Ct.createDefaultProps(),screenRender:!0,size:Ot([100,100]),anchor:Ot([.5,1]),offset:Ot([0,0]),sizeByContent:!0,renderMode:0,rotationType:1,zOrder:0,actorTag:"",socketName:"",positionOffset:Ot([0,0,0]),rotationOffset:Ot([0,0,0])})),f(Ll,"type",Ll.register("ESLabel",Ll,{chsName:"标签",tags:["ESObjects"],description:"标签对象"}));let Zr=Ll;const Fl=class Fl extends yt{constructor(t){super(t)}};f(Fl,"createDefaultProps",()=>({...yt.createDefaultProps(),show:!0,fillStyle:Bt({color:[1,1,1,1],material:"",materialParams:{},ground:!1})})),f(Fl,"type",Fl.register("ESTestObject",Fl,{chsName:"测试",tags:["ESObjects"],description:""}));let Pm=Fl;const Gs=class Gs extends ge{constructor(e){super(e);f(this,"_refreshTilesetEvent",this.dv(new N));f(this,"_tilesetReadyEvent",this.dv(new N));f(this,"_supportEdit",this.dv($(!0)));f(this,"_highlightFeatureEvent",this.dv(new N));f(this,"_highlightFeatureAndFlyToEvent",this.dv(new N));f(this,"_strokeFeatureEvent",this.disposeVar(new N));f(this,"_getFeatureTableEvent",this.dv(new N));f(this,"_featureTableResultEvent",this.dv(new N));f(this,"_getMaterialNameListEvent",this.disposeVar(new N));f(this,"_setFeatureStyleEvent",this.dv(new N));f(this,"_setFeatureColorEvent",this.dv(new N));f(this,"_setFeatureVisableEvent",this.dv(new N));f(this,"_resetFeatureStyleEvent",this.dv(new N));f(this,"setMaterialInfoEvent",this.ad(new N));f(this,"_setMaterialEvent",this.disposeVar(new N));f(this,"_clippingPlanesId",this.dv($("")));f(this,"_clippingPlaneIds",this.dv($([])));f(this,"_flattenedPlaneId",this.dv($("")));f(this,"_flattenedPlaneEnabled",this.dv($(!1)));f(this,"_clippingPlaneId",this.dv($("")));f(this,"_excavateId",this.dv(Ot([])))}updateEditing(){var e;(e=this.activeViewer)==null||e.startEditing(this,[vt.Translation,vt.Rotation],{callSource:"inner"})}get refreshTilesetEvent(){return this._refreshTilesetEvent}refreshTileset(){this._refreshTilesetEvent.emit()}get tilesetReady(){return this._tilesetReadyEvent}get supportEdit(){return this._supportEdit.value}set supportEdit(e){this._supportEdit.value=e}get supportEditChanged(){return this._supportEdit.changed}get highlightFeatureEvent(){return this._highlightFeatureEvent}highlightFeature(e,n){this._highlightFeatureEvent.emit(e,n)}get highlightFeatureAndFlyToEvent(){return this._highlightFeatureAndFlyToEvent}highlightFeatureAndFlyTo(e,n,i,s){this._highlightFeatureAndFlyToEvent.emit(e,n,i,s)}get strokeFeatureEvent(){return this._strokeFeatureEvent}strokeFeature(e,n=[1,0,0,1]){this._strokeFeatureEvent.emit(e,n)}get getFeatureTableEvent(){return this._getFeatureTableEvent}getFeatureTable(){return Promise.race([new Promise(e=>{const n=this.d(this._featureTableResultEvent.donce(e));this._getFeatureTableEvent.emit(),setTimeout(()=>{n(),e(void 0)},2e3)})])}get getMaterialNameListEvent(){return this._getMaterialNameListEvent}getMaterialNameList(){return new Promise(e=>{const n=new H;n.d(this.getMaterialNameListEvent.don(i=>{i!=="start"&&(n.destroy(),e(i))})),this.getMaterialNameListEvent.emit("start"),setTimeout(()=>{n.isDestroyed()||(n.destroy(),e(void 0))},2e3)})}get setFeatureStyleEvent(){return this._setFeatureStyleEvent}setFeatureStyle(e){this._setFeatureStyleEvent.emit(e)}get setFeatureColorEvent(){return this._setFeatureColorEvent}setFeatureColor(e,n){this._setFeatureColorEvent.emit(e,typeof n=="string"?JSON.parse(n):n)}get setFeatureVisableEvent(){return this._setFeatureVisableEvent}setFeatureVisable(e,n){this._setFeatureVisableEvent.emit(e,typeof n=="string"?JSON.parse(n):n)}get resetFeatureStyleEvent(){return this._resetFeatureStyleEvent}resetFeatureStyle(){this._resetFeatureStyleEvent.emit()}get setMaterialEvent(){return this._setMaterialEvent}setMaterial(e){return new Promise(n=>{const i=new H;i.ad(this.setMaterialInfoEvent.donce(s=>{i.destroy(),n(s)})),this._setMaterialEvent.emit(e)})}get clippingPlanesId(){return this._clippingPlanesId.value}set clippingPlanesId(e){this._clippingPlanesId.value=e}get clippingPlanesIdChanged(){return this._clippingPlanesId.changed}get clippingPlaneIds(){return this._clippingPlaneIds.value}set clippingPlaneIds(e){this._clippingPlaneIds.value=e}get clippingPlaneIdsChanged(){return this._clippingPlaneIds.changed}get flattenedPlaneId(){return this._flattenedPlaneId.value}set flattenedPlaneId(e){this._flattenedPlaneId.value=e}get flattenedPlaneIdChanged(){return this._flattenedPlaneId.changed}get flattenedPlaneEnabled(){return this._flattenedPlaneEnabled.value}set flattenedPlaneEnabled(e){this._flattenedPlaneEnabled.value=e}get flattenedPlaneEnabledChanged(){return this._flattenedPlaneEnabled.changed}get clippingPlaneId(){return this._clippingPlaneId.value}set clippingPlaneId(e){this._clippingPlaneId.value=e}get clippingPlaneIdChanged(){return this._clippingPlaneId.changed}get excavateId(){return this._excavateId.value}set excavateId(e){this._excavateId.value=e}get excavateIdChanged(){return this._excavateId.changed}setLight122(){this.czmEnvironmentMapManager={...bm}}getESProperties(){const e={...super.getESProperties()};return{...e,defaultMenu:"dataSource",basic:[...e.basic,new En([this,"maximumScreenSpaceError"],1,[0,256],"精度",16),new Wt([this,"materialMode"],[["常规","normal"],["科技感","technology"]],"材质模式","normal",!0),new Wt([this,"colorBlendMode"],[["默认","HIGHLIGHT"],["替换","REPLACE"],["混合","MIX"]],"颜色模式","HIGHLIGHT"),new Et([this,"materialOverrideMap"],"材质替换",Gs.defaults.materialOverrideMap)],dataSource:[...e.dataSource,new Et([this,"url"],"服务地址",Gs.defaults.url,void 0,!0)],coordinate:[...e.coordinate,new ot([this,"editing"],"编辑",!1,!0),new Un([this,"offset"],"偏移",[0,0,0],!0),new Zp([this,"rotation"],"旋转",[0,0,0])],more:[...e.more,new Et([this,"materialParams"],"materialParams",Gs.defaults.materialParams),new It(["string","string"],(n,i)=>this.highlightFeature(n,i),["","rgba(255,0,0,1)"],"highlightFeature"),new It(["string","string"],(n,i)=>this.setFeatureColor(n,i),["",""],"setFeatureColor"),new It(["string","string"],(n,i)=>this.setFeatureVisable(n,i),["",""],"setFeatureVisable"),new It([],()=>this.resetFeatureStyle(),[],"resetFeatureStyle"),new xt([],"ue"),new It([],()=>this.refreshTileset(),[],"refreshTileset"),new At([this,"actorTag"]),new ot([this,"highlight"],"是否高亮"),new Kt([this,"highlightColor"]),new L([this,"highlightID"]),new xt([],"czm"),new xt([],"可视化"),new pn([this,"czmImageBasedLightingFactor"],"反射强度"),new L([this,"czmAtmosphereScatteringIntensity"],"大气散射强度"),new Et([this,"czmEnvironmentMapManager"],"动态环境贴图管理器"),new L([this,"czmMaximumMemoryUsage"],"最大内存"),new xt([],"常用"),new Wt([this,"czmClassificationType"],[["NONE","NONE"],["TERRAIN","TERRAIN"],["CESIUM_3D_TILE","CESIUM_3D_TILE"],["BOTH","BOTH"]],"czmClassificationType","NONE",!0),new Et([this,"czmStyleJson"],"czmStyle"),new ot([this,"czmBackFaceCulling"]),new ot([this,"czmSkipLevelOfDetail"]),new L([this,"cacheBytes"],"最大缓存",536870912),new xt([],"调试信息"),new ot([this,"czmDebugShowBoundingVolume"]),new ot([this,"czmDebugShowContentBoundingVolume"]),new xt([],"clippingPlanes"),new ot([this,"clippingPlaneEnabled"]),new ot([this,"unionClippingRegions"]),new Kt([this,"clippingPlaneEdgeColor"]),new L([this,"clippingPlaneEdgeWidth"])]}}};f(Gs,"createDefaultProps",()=>({...ge.createDefaultProps(),url:"",actorTag:"",materialMode:"normal",highlight:!1,maximumScreenSpaceError:16,highlightID:0,highlightColor:Ot([1,0,0,1]),offset:Oe([0,0,0]),rotation:Ot([0,0,0]),czmImageBasedLightingFactor:Ot([1,1]),czmEnvironmentMapManager:Ie(void 0),czmLuminanceAtZenith:2,czmAtmosphereScatteringIntensity:2,czmMaximumMemoryUsage:512,czmClassificationType:"NONE",czmStyleJson:Bt({}),czmBackFaceCulling:!0,czmDebugShowBoundingVolume:!1,czmDebugShowContentBoundingVolume:!1,czmSkipLevelOfDetail:!1,cacheBytes:536870912,colorBlendMode:"HIGHLIGHT",clippingPlaneEnabled:!0,unionClippingRegions:!0,clippingPlaneEdgeColor:Ot([1,1,1,1]),clippingPlaneEdgeWidth:2,materialParams:{baseColor:[0,.5,1]},allowPicking:!0,materialOverrideMap:Ie({}),featureIdLabel:0,splitDirection:"NONE"})),f(Gs,"type",Gs.register("ES3DTileset",Gs,{chsName:"3DTileset",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"3DTileset"})),f(Gs,"supportEditingModes",[...ge.supportEditingModes,vt.Translation,vt.Rotation]);let bi=Gs;const kl=class kl extends Ct{constructor(e){super(e);f(this,"_isFlyInCreated",this.dv($(!1)));f(this,"_readyEvent",this.dv(new N));this.collision=!1,this.d(this.createdEvent.don(()=>{setTimeout(()=>{if((this.editing??!1)||!this.position)this.d(Js([this.positionChanged,this.editingChanged],()=>{this.editing||!this.position||this.isFlyInCreated&&this.flyTo()},{time:"donce"}));else{if(!this.isFlyInCreated)return;this.flyTo()}},1e3)}))}get isFlyInCreated(){return this._isFlyInCreated.value}set isFlyInCreated(e){this._isFlyInCreated.value=e}get isFlyInCreatedChanged(){return this._isFlyInCreated.changed}get readyEvent(){return this._readyEvent}getESProperties(){const e={...super.getESProperties()};return{...e,basic:[...e.basic,new Wt([this,"mode"],[["柱状警告","cylinder"],["圆形警告","circle"]],"模式","cylinder"),new L([this,"radius"],"半径",10)]}}};f(kl,"createDefaultProps",()=>({...Ct.createDefaultProps(),mode:"cylinder",radius:10})),f(kl,"type",kl.register("ESAlarm",kl,{chsName:"报警",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"警告类"}));let xm=kl;const QO=[["扫描","scan"],["扩散","diffuse"]],ha=class ha extends Ct{constructor(t){super(t)}getESProperties(){const t={...super.getESProperties()};return{...t,basic:[...t.basic,new L([this,"radius"],"半径",1),new Wt([this,"mode"],QO,"模式",ha.defaults.mode),new Kt([this,"color"],"颜色",ha.defaults.color)]}}};f(ha,"createDefaultProps",()=>({...Ct.createDefaultProps(),radius:1,mode:"scan",color:[0,.7,1,1],collision:!1})),f(ha,"type",ha.register("ESApertureEffect",ha,{chsName:"光圈特效",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"光圈特效"}));let Im=ha;const ru=class ru extends Ht{constructor(e){super(e);f(this,"editingBindMode","circular")}getESProperties(){const e={...super.getESProperties()};return{...e,coordinate:[...e.coordinate,new L([this,"area"],"面积",0,!1,!0),new L([this,"perimeter"],"周长",0,!1,!0)]}}};f(ru,"createDefaultProps",()=>({...Ht.createDefaultProps(),fillStyle:Bt({color:[1,1,1,.5],material:"",materialParams:{},ground:!1}),strokeStyle:Bt({width:1,widthType:"screen",color:[1,1,1,1],material:"",materialParams:{},ground:!1}),filled:!0,stroked:!1,collision:!1})),f(ru,"type",ru.register("ESGeoPolygon",ru,{chsName:"地理多边形",tags:["ESObjects"],description:"地理多边形"})),f(ru,"supportEditingModes",[...Ht.supportEditingModes,vt.CircularAppend,vt.CircularInsert]);let Ee=ru;const Eo=class Eo extends Ee{get fillMaterial(){return this.fillStyle.material}set fillMaterial(t){this.fillStyle={...this.fillStyle,material:t}}get fillMaterialParams(){return this.fillStyle?this.fillStyle.materialParams:Eo.defaults.fillStyle.materialParams}set fillMaterialParams(t){this.fillStyle={...this.fillStyle??Eo.defaults.fillStyle,materialParams:t??Eo.defaults.fillStyle.materialParams}}constructor(t){super(t)}};f(Eo,"createDefaultProps",()=>({...Ee.createDefaultProps(),stroked:!0,filled:!0,units:Ot(["SquareMeter_SquareKilometer","MU_Hectare","PerimeterMeter_PerimeterKilometer"]),fillStyle:Bt({color:[1,1,1,1],material:"Material'/EarthSDKForUE/M_ES_Material.M_ES_Material'",materialParams:{Opacity:.4},ground:!0}),strokeStyle:Bt({width:2,widthType:"screen",color:[1,1,1,1],material:"",materialParams:{},ground:!1})})),f(Eo,"type",Eo.register("ESAreaMeasurement",Eo,{chsName:"面积测量",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE","_ES_Impl_Ol"],description:"面积测量"}));let Mm=Eo;const Gl=class Gl extends Ct{constructor(t){super(t)}getESProperties(){const t={...super.getESProperties()};return{...t,defaultMenu:"general",more:[...t.more,new xt([],"czm"),new Ih([this,"image"],"图片"),new Un([this,"translation"],"偏移")]}}};f(Gl,"createDefaultProps",()=>({...Ct.createDefaultProps(),image:"${earthsdk3-assets-script-dir}/assets/img/smoke.png",translation:Ot([0,0,0])})),f(Gl,"type",Gl.register("ESBlastParticleSystem",Gl,{chsName:"粒子爆炸",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"粒子爆炸"}));let Tm=Gl;const os=class os extends Ct{constructor(t){super(t)}getESProperties(){const t={...super.getESProperties()};return{...t,basic:[...t.basic,new ot([this,"reverse"],"反转",os.defaults.reverse),new Un([this,"size"],"尺寸",os.defaults.size),new Kt([this,"edgeColor"],"边框颜色",os.defaults.edgeColor),new L([this,"edgeWidth"],"边框宽度",os.defaults.edgeWidth),new At([this,"targetID"],"瓦片图层",os.defaults.targetID)]}}};f(os,"createDefaultProps",()=>({...Ct.createDefaultProps(),reverse:!1,edgeColor:Ot([1,1,1,1]),edgeWidth:2,size:Ot([10,10,10]),targetID:""})),f(os,"type",os.register("ESBoxClipping",os,{chsName:"体剖切",tags:["ESObjects","_ES_Impl_Cesium"],description:"体剖切,体裁剪,体裁切,盒裁切"}));let Nm=os;const Jc=class Jc extends Ct{constructor(){super(...arguments);f(this,"_thumbnail",this.dv($("")));f(this,"_duration",this.dv($(1)));f(this,"_resetWithCurrentCameraEvent",this.dv(new N));f(this,"_captureEvent",this.dv(new N))}get thumbnail(){return this._thumbnail.value}set thumbnail(e){this._thumbnail.value=e}get thumbnailChanged(){return this._thumbnail.changed}get duration(){return this._duration.value}set duration(e){this._duration.value=e}get durationChanged(){return this._duration.changed}flyIn(e=1,n="default"){this.flyInEvent.emit(e,-1,n)}get resetWithCurrentCameraEvent(){return this._resetWithCurrentCameraEvent}resetWithCurrentCamera(){this._resetWithCurrentCameraEvent.emit()}get captureEvent(){return this._captureEvent}capture(e,n){this._captureEvent.emit(e,n)}execOnCreating(){this.resetWithCurrentCamera()}async initByCurrent(){this.resetWithCurrentCamera()}getESProperties(){const e={...super.getESProperties()};return{...e,more:[...e.more,new xt([],"ESCameraView"),new It([],()=>this.resetWithCurrentCamera(),[],"设置为当前视角"),new It(["number","number"],(n,i)=>this.capture(n,i),[64,64],"获取缩略图"),new At([this,"thumbnail"],"缩略图","",!0),new L([this,"duration"],"飞行时间",1,!0)]}}};f(Jc,"type",Jc.register("ESCameraView",Jc,{chsName:"视角",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"视角"}));let Pf=Jc;class xf extends H{constructor(e,n,i){super();f(this,"_view",this.dv(new Pf));if(this.d(e.components.disposableAdd(this._view)),this._view.name=(i==null?void 0:i.name)??`视角${e.views.length+1}`,n){const a=this._view,u=n;a.duration=u.duration??1,a.position=u.position,a.rotation=u.rotation??[0,0,0],a.thumbnail=u.thumbnail??"",a.name=u.name}else{const a=(i==null?void 0:i.size)??[64,64];this.d(Pu(()=>{this._view.resetWithCurrentCamera(),this._view.capture(a[0],a[1])}))}const s=this._view,o=this.dv(nn(s.durationChanged,s.positionChanged,s.rotationChanged,s.thumbnailChanged,s.nameChanged));this.d(o.don(()=>e.emitViewsWarpper()))}get view(){return this._view}get viewInfo(){const e=this._view;return{duration:e.duration,position:e.position,rotation:e.rotation,thumbnail:e.thumbnail,name:e.name}}}const Pi=class Pi extends yt{constructor(e){super(e);f(this,"_currentViewIndex",this.dv($(-1)));f(this,"_viewWrappers",this.dv(new yh));f(this,"_currentViewWrapper",this.dv($(void 0)));f(this,"_container",this.dv($(void 0)));this.initProcessing();{const n=()=>{if(!this._currentViewWrapper.value)return;this._viewWrappers.indexOf(this._currentViewWrapper.value)===-1&&(this._currentViewWrapper.value=void 0)};n(),this.d(this._viewWrappers.changedEvent.don(n))}{const n=()=>{const i=this._currentViewWrapper.value;this._currentViewIndex.value=i?this._getIndex(i):-1};n(),this.d(this._viewWrappers.changedEvent.don(n)),this.d(this._currentViewWrapper.changed.don(n))}this.d(()=>{this.clearAllViews()})}get json(){return{...this._innerGetJson(),views:this.views}}set json(e){this._innerSetJson(e),this.views=e.views}get currentViewIndex(){return this._currentViewIndex.value}get currentViewIndexChanged(){return this._currentViewIndex.changed}emitViewsWarpper(){this._viewWrappers.changedEvent.emit(this._viewWrappers)}get container(){return this._container.value}get containerChanged(){return this._container.changed}set container(e){this._container.value=e}get views(){return Jw(this._viewWrappers,e=>e.viewInfo)}get viewsChanged(){return this._viewWrappers.changedEvent}set views(e){if(e.length===this._viewWrappers.length){const n=this._viewWrappers;if(e.every((i,s)=>{const o=n.get(s).view;return i.duration===o.duration&&Sm(i.position,o.position)&&Sm(i.rotation,o.rotation)&&i.thumbnail===o.thumbnail&&i.name===o.name}))return}this.clearAllViews();for(let n of e)this._viewWrappers.push(new xf(this,n))}_getIndex(e){return this._viewWrappers.indexOf(e)}clearAllViews(){for(let e of this._viewWrappers)e.destroy();this._viewWrappers.length=0}add(e=`视角${this.views.length+1}`,n=[64,64]){this._viewWrappers.push(new xf(this,void 0,{name:e,size:n}))}update(e,n,i=[64,64]){if(e>=this._viewWrappers.length||e<0)return console.warn("index >= this._viewWrappers.length || index < 0"),!1;const s=this._viewWrappers.get(e);return n&&(s.view.name=n),s.view.resetWithCurrentCamera(),s.view.capture(i[0],i[1]),!0}addView(){this._viewWrappers.push(new xf(this))}insertView(e){if(this._viewWrappers.length+1<=e||e<0){console.error("this._views.length <= index || index < 0");return}this._viewWrappers.splice(e,0,new xf(this))}setCurrentView(e){if(e>=this._viewWrappers.length||e<0)return console.warn("index >= this._viewWrappers.length || index < 0"),!1;const n=this._viewWrappers.get(e);return this._currentViewWrapper.value=n,!0}resetView(e){if(e>=this._viewWrappers.length||e<0){console.warn("index >= this._viewWrappers.length || index < 0");return}const n=this._viewWrappers.get(e);n.view.resetWithCurrentCamera(),n.view.capture()}resetViewName(e,n){if(e>=this._viewWrappers.length||e<0){console.warn("index >= this._viewWrappers.length || index < 0");return}const i=this._viewWrappers.get(e);i.view.name=n}updateView(e,n){if(e>=this._viewWrappers.length||e<0)return console.warn("index >= this._viewWrappers.length || index < 0"),!1;const i=this._viewWrappers.get(e);return i.view.position=n.position,i.view.rotation=n.rotation??[0,0,0],i.view.duration=n.duration??1,i.view.thumbnail=n.thumbnail??"",i.view.name=n.name??"",!0}flyToView(e){if(this.setCurrentView(e)){if(!this._currentViewWrapper.value)throw new Error("this._currentViewWrapper.value");const n=this._currentViewWrapper.value.view.duration;this._currentViewWrapper.value.view.flyIn(n,this.flyMode??Pi.defaults.flyMode)}}flyToPrevView(){const e=this._currentViewWrapper.value;if(!e)return this.flyToView(0),!0;const n=this._getIndex(e);return this.loop??Pi.defaults.loop?(this.flyToView((this._viewWrappers.length+n-1)%this._viewWrappers.length),!0):n-1<0?!1:(this.flyToView(n-1),!0)}moveToPreView(){const e=this._currentViewWrapper.value;if(!e)return;const n=this._getIndex(e);if(n===0)return;const i=this._viewWrappers.splice(n-1,1,e)[0];this._viewWrappers.set(n,i)}moveToNextView(){const e=this._currentViewWrapper.value;if(!e)return;const n=this._getIndex(e);if(n===this._viewWrappers.length-1)return;const i=this._viewWrappers.splice(n+1,1,e)[0];this._viewWrappers.set(n,i)}flyToNextView(){const e=this._currentViewWrapper.value;if(!e)return this.flyToView(0),!0;const n=this._getIndex(e);return this.loop??Pi.defaults.loop?(this.flyToView((n+1)%this._viewWrappers.length),!0):n+1>this._viewWrappers.length-1?!1:(this.flyToView(n+1),!0)}stop(){this._currentViewWrapper.value=void 0,this.playing=!1}deleteView(e){if(e<0||e>=this._viewWrappers.length){console.warn("index < 0 || index >= this._viewWrappers.length");return}this._viewWrappers.get(e).destroy(),this._viewWrappers.splice(e,1)}deleteCurrentView(){const e=this._currentViewWrapper.value;if(!e){console.warn("!this._currentViewWrapper.value");return}const n=this._getIndex(e);if(n===-1){console.warn("index === -1");return}this.deleteView(n)}transitionImageUrl(e){return yt.context.getStrFromEnv(e)}_flyStep(e){var o;if(!this.flyToNextView())return this.playing=!1,Promise.resolve();const n=this.intervalTime??Pi.defaults.intervalTime,s=((((o=this._currentViewWrapper.value)==null?void 0:o.viewInfo.duration)??0)+n)*1e3;return e.promise(Sh(s)).then(()=>this._flyStep(e))}initProcessing(){const e=this.dv(Gr(async i=>this._flyStep(i))),n=()=>{this.playing?e.restart():e.cancel()};n(),this.d(this.playingChanged.don(n))}getESProperties(){const e={...super.getESProperties()};return{...e,more:[...e.more,new Wt([this,"flyMode"],[["默认","default"],["直线飞行","uniform"]],"飞行模式",Pi.defaults.flyMode),new It([],()=>this.addView(),[],"添加视角"),new It(["number"],n=>this.insertView(n),[0],"插入视角"),new It([],()=>this.clearAllViews(),[],"清空所有视角"),new It([],()=>this.insertView(this.currentViewIndex+1),[],"当前位置插入视角"),new It([],()=>this.flyToPrevView(),[],"上一个视角"),new It([],()=>this.flyToNextView(),[],"下一个视角"),new It([],()=>this.moveToPreView(),[],"当前视角移动到上一个视角"),new It([],()=>this.moveToNextView(),[],"当前视角移动到下一个视角"),new It(["number"],n=>this.flyToView(n),[0],"飞入指定视角"),new It(["number"],n=>this.setCurrentView(n),[0],"设置当前视角"),new It([],()=>this.deleteCurrentView(),[],"删除当前视角"),new It(["number"],n=>this.deleteView(n),[0],"删除指定视角"),new It(["number"],n=>this.resetView(n),[0],"重置视角"),new L([this,"currentViewIndex"],"当前序号",-1,!1,!0),new P0([this,"playing"],()=>this.stop(),[this,"loop"],"播放",Pi.defaults),new ot([this,"playing"],"是否播放"),new It([],()=>this.stop(),[],"停止"),new ot([this,"loop"],"是否循环"),new L([this,"intervalTime"],"间隔时间"),new Et([this,"views"],"视角集合",[],void 0,!0)]}}};f(Pi,"createDefaultProps",()=>({...yt.createDefaultProps(),playing:!1,loop:!0,intervalTime:5,flyMode:"default"})),f(Pi,"type",Pi.register("ESCameraViewCollection",Pi,{chsName:"视角集合",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"视角集合"}));let If=Pi;const jl=class jl extends Ct{constructor(e){super(e);f(this,"editingBindMode","doublePoints")}getESProperties(){const e={...super.getESProperties()};return{...e,basic:[...e.basic,new L([this,"aspectRatio"],"宽高比",1.77778),new L([this,"fov"],"横向夹角",90),new L([this,"far"],"视野长度",100),new L([this,"near"],"近面距离",5)]}}};f(jl,"createDefaultProps",()=>({...Ct.createDefaultProps(),fov:90,aspectRatio:1.77778,far:100,near:5,collision:!1})),f(jl,"type",jl.register("ESCameraVisibleRange",jl,{chsName:"摄像头可视域",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"摄像头可视域"}));let Om=jl;const Vl=class Vl extends Ct{constructor(t){super(t)}getESProperties(){const t={...super.getESProperties()};return{...t,basic:[...t.basic,new Wt([this,"mode"],[["警车","policeCar"]],"模式","policeCar")]}}};f(Vl,"createDefaultProps",()=>({...Ct.createDefaultProps(),mode:"policeCar",allowPicking:!0})),f(Vl,"type",Vl.register("ESCar",Vl,{chsName:"车辆",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"警车等基础车辆模型"}));let Mf=Vl;const iu=class iu extends Ht{constructor(e){super(e);f(this,"editingBindMode","circular")}getESProperties(){const e={...super.getESProperties()};return{...e,basic:[...e.basic,new L([this,"height"],"高度",10)],coordinate:[...e.coordinate,new L([this,"area"],"面积",0,!1,!0),new L([this,"perimeter"],"周长",0,!1,!0)]}}};f(iu,"createDefaultProps",()=>({...Ht.createDefaultProps(),height:10,filled:!0,fillStyle:Bt({material:"",materialParams:{},ground:!0,color:[1,1,1,1]})})),f(iu,"type",iu.register("ESClassification",iu,{chsName:"倾斜单体化",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"平尾箭头"})),f(iu,"supportEditingModes",[...Ht.supportEditingModes,vt.CircularAppend,vt.CircularInsert,vt.HeightModify]);let Tf=iu;const Bl=class Bl extends Ct{constructor(t){super(t)}getESProperties(){const t={...super.getESProperties()};return{...t,basic:[...t.basic,new ot([this,"showArrow"],"显示箭头",!0),new Kt([this,"edgeColor"],"线框颜色",[1,1,1,1]),new L([this,"edgetWidth"],"线框宽度",2),new L([this,"width"],"裁剪宽度",200),new L([this,"height"],"裁剪高度",200),new At([this,"targetID"],"瓦片图层","")]}}};f(Bl,"createDefaultProps",()=>({...Ct.createDefaultProps(),showArrow:!0,edgeColor:Ot([1,1,1,1]),edgetWidth:2,width:200,height:200,targetID:""})),f(Bl,"type",Bl.register("ESClippingPlane",Bl,{chsName:"裁切",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"ESClippingPlane"}));let Dm=Bl;class t4 extends H{constructor(t,e,n){super();const i=document.createElement("div");i.setAttribute("xe2-div",`ESCustomDiv(${e.id})(viewer: ${n.id}) container`);{const u=()=>{const h=` ${e.cssText}
|
|
68
|
+
`)}return t.toString()},_n.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.computeLabel(t)}},_n.prototype.computeLabelling=function(t){var e=this;this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var n=[!1,!1],i=this.iterator();i.hasNext();)for(var s=i.next(),o=s.getLabel(),a=0;a<2;a++)o.isLine(a)&&o.getLocation(a)===V.BOUNDARY&&(n[a]=!0);for(var u=this.iterator();u.hasNext();)for(var l=u.next(),h=l.getLabel(),c=0;c<2;c++)if(h.isAnyNull(c)){var d=V.NONE;if(n[c])d=V.EXTERIOR;else{var p=l.getCoordinate();d=e.getLocation(c,p,t)}h.setAllLocationsIfNull(c,d)}},_n.prototype.getDegree=function(){return this._edgeMap.size()},_n.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},_n.prototype.interfaces_=function(){return[]},_n.prototype.getClass=function(){return _n};var BN=function(r){function t(){r.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.linkResultDirectedEdges=function(){var n=this;this.getResultAreaEdges();for(var i=null,s=null,o=this._SCANNING_FOR_INCOMING,a=0;a<this._resultAreaEdgeList.size();a++){var u=n._resultAreaEdgeList.get(a),l=u.getSym();if(u.getLabel().isArea())switch(i===null&&u.isInResult()&&(i=u),o){case n._SCANNING_FOR_INCOMING:if(!l.isInResult())continue;s=l,o=n._LINKING_TO_OUTGOING;break;case n._LINKING_TO_OUTGOING:if(!u.isInResult())continue;s.setNext(u),o=n._SCANNING_FOR_INCOMING;break}}if(o===this._LINKING_TO_OUTGOING){if(i===null)throw new xs("no outgoing dirEdge found",this.getCoordinate());Ft.isTrue(i.isInResult(),"unable to link last incoming dirEdge"),s.setNext(i)}},t.prototype.insert=function(n){var i=n;this.insertEdgeEnd(i,i)},t.prototype.getRightmostEdge=function(){var n=this.getEdges(),i=n.size();if(i<1)return null;var s=n.get(0);if(i===1)return s;var o=n.get(i-1),a=s.getQuadrant(),u=o.getQuadrant();return ue.isNorthern(a)&&ue.isNorthern(u)?s:!ue.isNorthern(a)&&!ue.isNorthern(u)?o:s.getDy()!==0?s:o.getDy()!==0?o:(Ft.shouldNeverReachHere("found two horizontal edges incident on node"),null)},t.prototype.print=function(n){sn.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();){var s=i.next();n.print("out "),s.print(n),n.println(),n.print("in "),s.getSym().print(n),n.println()}},t.prototype.getResultAreaEdges=function(){var n=this;if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new tt;for(var i=this.iterator();i.hasNext();){var s=i.next();(s.isInResult()||s.getSym().isInResult())&&n._resultAreaEdgeList.add(s)}return this._resultAreaEdgeList},t.prototype.updateLabelling=function(n){for(var i=this.iterator();i.hasNext();){var s=i.next(),o=s.getLabel();o.setAllLocationsIfNull(0,n.getLocation(0)),o.setAllLocationsIfNull(1,n.getLocation(1))}},t.prototype.linkAllDirectedEdges=function(){var n=this;this.getEdges();for(var i=null,s=null,o=this._edgeList.size()-1;o>=0;o--){var a=n._edgeList.get(o),u=a.getSym();s===null&&(s=u),i!==null&&u.setNext(i),i=a}s.setNext(i)},t.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var i=arguments[0],s=this.findIndex(i),o=i.getDepth(Z.LEFT),a=i.getDepth(Z.RIGHT),u=this.computeDepths(s+1,this._edgeList.size(),o),l=this.computeDepths(0,s,u);if(l!==a)throw new xs("depth mismatch at "+i.getCoordinate())}else if(arguments.length===3){for(var h=arguments[0],c=arguments[1],d=arguments[2],p=d,g=h;g<c;g++){var y=n._edgeList.get(g);y.setEdgeDepths(Z.RIGHT,p),p=y.getDepth(Z.LEFT)}return p}},t.prototype.mergeSymLabels=function(){for(var n=this.iterator();n.hasNext();){var i=n.next(),s=i.getLabel();s.merge(i.getSym().getLabel())}},t.prototype.linkMinimalDirectedEdges=function(n){for(var i=this,s=null,o=null,a=this._SCANNING_FOR_INCOMING,u=this._resultAreaEdgeList.size()-1;u>=0;u--){var l=i._resultAreaEdgeList.get(u),h=l.getSym();switch(s===null&&l.getEdgeRing()===n&&(s=l),a){case i._SCANNING_FOR_INCOMING:if(h.getEdgeRing()!==n)continue;o=h,a=i._LINKING_TO_OUTGOING;break;case i._LINKING_TO_OUTGOING:if(l.getEdgeRing()!==n)continue;o.setNextMin(l),a=i._SCANNING_FOR_INCOMING;break}}a===this._LINKING_TO_OUTGOING&&(Ft.isTrue(s!==null,"found null for first outgoing dirEdge"),Ft.isTrue(s.getEdgeRing()===n,"unable to link last incoming dirEdge"),o.setNextMin(s))},t.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,i=this.iterator();i.hasNext();){var s=i.next();s.isInResult()&&n++}return n}else if(arguments.length===1){for(var o=arguments[0],a=0,u=this.iterator();u.hasNext();){var l=u.next();l.getEdgeRing()===o&&a++}return a}},t.prototype.getLabel=function(){return this._label},t.prototype.findCoveredLineEdges=function(){for(var n=V.NONE,i=this.iterator();i.hasNext();){var s=i.next(),o=s.getSym();if(!s.isLineEdge()){if(s.isInResult()){n=V.INTERIOR;break}if(o.isInResult()){n=V.EXTERIOR;break}}}if(n===V.NONE)return null;for(var a=n,u=this.iterator();u.hasNext();){var l=u.next(),h=l.getSym();l.isLineEdge()?l.getEdge().setCovered(a===V.INTERIOR):(l.isInResult()&&(a=V.EXTERIOR),h.isInResult()&&(a=V.INTERIOR))}},t.prototype.computeLabelling=function(n){var i=this;r.prototype.computeLabelling.call(this,n),this._label=new oe(V.NONE);for(var s=this.iterator();s.hasNext();)for(var o=s.next(),a=o.getEdge(),u=a.getLabel(),l=0;l<2;l++){var h=u.getLocation(l);(h===V.INTERIOR||h===V.BOUNDARY)&&i._label.setLocation(l,V.INTERIOR)}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(_n),X1=function(r){function t(){r.apply(this,arguments)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.createNode=function(n){return new of(n,new BN)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(ol),uo=function r(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=r.orientation(t)};uo.prototype.compareTo=function(t){var e=t,n=uo.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return n},uo.prototype.interfaces_=function(){return[Pr]},uo.prototype.getClass=function(){return uo},uo.orientation=function(t){return zt.increasingDirection(t)===1},uo.compareOriented=function(t,e,n,i){for(var s=e?1:-1,o=i?1:-1,a=e?t.length:-1,u=i?n.length:-1,l=e?0:t.length-1,h=i?0:n.length-1;;){var c=t[l].compareTo(n[h]);if(c!==0)return c;l+=s,h+=o;var d=l===a,p=h===u;if(d&&!p)return-1;if(!d&&p)return 1;if(d&&p)return 0}};var Xr=function(){this._edges=new tt,this._ocaMap=new mn};Xr.prototype.print=function(t){var e=this;t.print("MULTILINESTRING ( ");for(var n=0;n<this._edges.size();n++){var i=e._edges.get(n);n>0&&t.print(","),t.print("(");for(var s=i.getCoordinates(),o=0;o<s.length;o++)o>0&&t.print(","),t.print(s[o].x+" "+s[o].y);t.println(")")}t.print(") ")},Xr.prototype.addAll=function(t){for(var e=this,n=t.iterator();n.hasNext();)e.add(n.next())},Xr.prototype.findEdgeIndex=function(t){for(var e=this,n=0;n<this._edges.size();n++)if(e._edges.get(n).equals(t))return n;return-1},Xr.prototype.iterator=function(){return this._edges.iterator()},Xr.prototype.getEdges=function(){return this._edges},Xr.prototype.get=function(t){return this._edges.get(t)},Xr.prototype.findEqualEdge=function(t){var e=new uo(t.getCoordinates()),n=this._ocaMap.get(e);return n},Xr.prototype.add=function(t){this._edges.add(t);var e=new uo(t.getCoordinates());this._ocaMap.put(e,t)},Xr.prototype.interfaces_=function(){return[]},Xr.prototype.getClass=function(){return Xr};var Yo=function(){};Yo.prototype.processIntersections=function(t,e,n,i){},Yo.prototype.isDone=function(){},Yo.prototype.interfaces_=function(){return[]},Yo.prototype.getClass=function(){return Yo};var pr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t};pr.prototype.isTrivialIntersection=function(t,e,n,i){if(t===n&&this._li.getIntersectionNum()===1){if(pr.isAdjacentSegments(e,i))return!0;if(t.isClosed()){var s=t.size()-1;if(e===0&&i===s||i===0&&e===s)return!0}}return!1},pr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},pr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},pr.prototype.getLineIntersector=function(){return this._li},pr.prototype.hasProperIntersection=function(){return this._hasProper},pr.prototype.processIntersections=function(t,e,n,i){if(t===n&&e===i)return null;this.numTests++;var s=t.getCoordinates()[e],o=t.getCoordinates()[e+1],a=n.getCoordinates()[i],u=n.getCoordinates()[i+1];this._li.computeIntersection(s,o,a,u),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,n,i)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},pr.prototype.hasIntersection=function(){return this._hasIntersection},pr.prototype.isDone=function(){return!1},pr.prototype.hasInteriorIntersection=function(){return this._hasInterior},pr.prototype.interfaces_=function(){return[Yo]},pr.prototype.getClass=function(){return pr},pr.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var _i=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.coord=new F(t),this.segmentIndex=e,this.dist=n};_i.prototype.getSegmentIndex=function(){return this.segmentIndex},_i.prototype.getCoordinate=function(){return this.coord},_i.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},_i.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},_i.prototype.isEndPoint=function(t){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===t},_i.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},_i.prototype.getDistance=function(){return this.dist},_i.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},_i.prototype.interfaces_=function(){return[Pr]},_i.prototype.getClass=function(){return _i};var Hi=function(){this._nodeMap=new mn,this.edge=null;var t=arguments[0];this.edge=t};Hi.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}},Hi.prototype.iterator=function(){return this._nodeMap.values().iterator()},Hi.prototype.addSplitEdges=function(t){var e=this;this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var s=n.next(),o=e.createSplitEdge(i,s);t.add(o),i=s}},Hi.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},Hi.prototype.createSplitEdge=function(t,e){var n=this,i=e.segmentIndex-t.segmentIndex+2,s=this.edge.pts[e.segmentIndex],o=e.dist>0||!e.coord.equals2D(s);o||i--;var a=new Array(i).fill(null),u=0;a[u++]=new F(t.coord);for(var l=t.segmentIndex+1;l<=e.segmentIndex;l++)a[u++]=n.edge.pts[l];return o&&(a[u]=e.coord),new uf(a,new oe(this.edge._label))},Hi.prototype.add=function(t,e,n){var i=new _i(t,e,n),s=this._nodeMap.get(i);return s!==null?s:(this._nodeMap.put(i,i),i)},Hi.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();if(n.coord.equals(t))return!0}return!1},Hi.prototype.interfaces_=function(){return[]},Hi.prototype.getClass=function(){return Hi};var Jo=function(){};Jo.prototype.getChainStartIndices=function(t){var e=this,n=0,i=new tt;i.add(new ai(n));do{var s=e.findChainEnd(t,n);i.add(new ai(s)),n=s}while(n<t.length-1);var o=Jo.toIntArray(i);return o},Jo.prototype.findChainEnd=function(t,e){for(var n=ue.quadrant(t[e],t[e+1]),i=e+1;i<t.length;){var s=ue.quadrant(t[i-1],t[i]);if(s!==n)break;i++}return i-1},Jo.prototype.interfaces_=function(){return[]},Jo.prototype.getClass=function(){return Jo},Jo.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var Ts=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new gt,this.env2=new gt;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new Jo;this.startIndex=e.getChainStartIndices(this.pts)};Ts.prototype.getCoordinates=function(){return this.pts},Ts.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e>n?e:n},Ts.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e<n?e:n},Ts.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[n],e.startIndex[n+1],i)}else if(arguments.length===6){var s=arguments[0],o=arguments[1],a=arguments[2],u=arguments[3],l=arguments[4],h=arguments[5],c=this.pts[s],d=this.pts[o],p=a.pts[u],g=a.pts[l];if(o-s===1&&l-u===1)return h.addIntersections(this.e,s,a.e,u),null;if(this.env1.init(c,d),this.env2.init(p,g),!this.env1.intersects(this.env2))return null;var y=Math.trunc((s+o)/2),w=Math.trunc((u+l)/2);s<y&&(u<w&&this.computeIntersectsForChain(s,y,a,u,w,h),w<l&&this.computeIntersectsForChain(s,y,a,w,l,h)),y<o&&(u<w&&this.computeIntersectsForChain(y,o,a,u,w,h),w<l&&this.computeIntersectsForChain(y,o,a,w,l,h))}},Ts.prototype.getStartIndexes=function(){return this.startIndex},Ts.prototype.computeIntersects=function(t,e){for(var n=this,i=0;i<this.startIndex.length-1;i++)for(var s=0;s<t.startIndex.length-1;s++)n.computeIntersectsForChain(i,t,s,e)},Ts.prototype.interfaces_=function(){return[]},Ts.prototype.getClass=function(){return Ts};var on=function r(){var t=this;this._depth=Array(2).fill().map(function(){return Array(3)});for(var e=0;e<2;e++)for(var n=0;n<3;n++)t._depth[e][n]=r.NULL_VALUE},Y1={NULL_VALUE:{configurable:!0}};on.prototype.getDepth=function(t,e){return this._depth[t][e]},on.prototype.setDepth=function(t,e,n){this._depth[t][e]=n},on.prototype.isNull=function(){var t=this;if(arguments.length===0){for(var e=0;e<2;e++)for(var n=0;n<3;n++)if(t._depth[e][n]!==on.NULL_VALUE)return!1;return!0}else if(arguments.length===1){var i=arguments[0];return this._depth[i][1]===on.NULL_VALUE}else if(arguments.length===2){var s=arguments[0],o=arguments[1];return this._depth[s][o]===on.NULL_VALUE}},on.prototype.normalize=function(){for(var t=this,e=0;e<2;e++)if(!t.isNull(e)){var n=t._depth[e][1];t._depth[e][2]<n&&(n=t._depth[e][2]),n<0&&(n=0);for(var i=1;i<3;i++){var s=0;t._depth[e][i]>n&&(s=1),t._depth[e][i]=s}}},on.prototype.getDelta=function(t){return this._depth[t][Z.RIGHT]-this._depth[t][Z.LEFT]},on.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?V.EXTERIOR:V.INTERIOR},on.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},on.prototype.add=function(){var t=this;if(arguments.length===1)for(var e=arguments[0],n=0;n<2;n++)for(var i=1;i<3;i++){var s=e.getLocation(n,i);(s===V.EXTERIOR||s===V.INTERIOR)&&(t.isNull(n,i)?t._depth[n][i]=on.depthAtLocation(s):t._depth[n][i]+=on.depthAtLocation(s))}else if(arguments.length===3){var o=arguments[0],a=arguments[1],u=arguments[2];u===V.INTERIOR&&this._depth[o][a]++}},on.prototype.interfaces_=function(){return[]},on.prototype.getClass=function(){return on},on.depthAtLocation=function(t){return t===V.EXTERIOR?0:t===V.INTERIOR?1:on.NULL_VALUE},Y1.NULL_VALUE.get=function(){return-1},Object.defineProperties(on,Y1);var uf=function(r){function t(){if(r.call(this),this.pts=null,this._env=null,this.eiList=new Hi(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new on,this._depthDelta=0,arguments.length===1){var e=arguments[0];t.call(this,e,null)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.pts=n,this._label=i}}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.getDepth=function(){return this._depth},t.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var i=new t(n,oe.toLineLabel(this._label));return i},t.prototype.isIsolated=function(){return this._isIsolated},t.prototype.getCoordinates=function(){return this.pts},t.prototype.setIsolated=function(n){this._isIsolated=n},t.prototype.setName=function(n){this._name=n},t.prototype.equals=function(n){var i=this;if(!(n instanceof t))return!1;var s=n;if(this.pts.length!==s.pts.length)return!1;for(var o=!0,a=!0,u=this.pts.length,l=0;l<this.pts.length;l++)if(i.pts[l].equals2D(s.pts[l])||(o=!1),i.pts[l].equals2D(s.pts[--u])||(a=!1),!o&&!a)return!1;return!0},t.prototype.getCoordinate=function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},t.prototype.print=function(n){var i=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var s=0;s<this.pts.length;s++)s>0&&n.print(","),n.print(i.pts[s].x+" "+i.pts[s].y);n.print(") "+this._label+" "+this._depthDelta)},t.prototype.computeIM=function(n){t.updateIM(this._label,n)},t.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},t.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},t.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},t.prototype.getDepthDelta=function(){return this._depthDelta},t.prototype.getNumPoints=function(){return this.pts.length},t.prototype.printReverse=function(n){var i=this;n.print("edge "+this._name+": ");for(var s=this.pts.length-1;s>=0;s--)n.print(i.pts[s]+" ");n.println("")},t.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new Ts(this)),this._mce},t.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new gt;for(var i=0;i<this.pts.length;i++)n._env.expandToInclude(n.pts[i])}return this._env},t.prototype.addIntersection=function(n,i,s,o){var a=new F(n.getIntersection(o)),u=i,l=n.getEdgeDistance(s,o),h=u+1;if(h<this.pts.length){var c=this.pts[h];a.equals2D(c)&&(u=h,l=0)}this.eiList.add(a,u,l)},t.prototype.toString=function(){var n=this,i=new oi;i.append("edge "+this._name+": "),i.append("LINESTRING (");for(var s=0;s<this.pts.length;s++)s>0&&i.append(","),i.append(n.pts[s].x+" "+n.pts[s].y);return i.append(") "+this._label+" "+this._depthDelta),i.toString()},t.prototype.isPointwiseEqual=function(n){var i=this;if(this.pts.length!==n.pts.length)return!1;for(var s=0;s<this.pts.length;s++)if(!i.pts[s].equals2D(n.pts[s]))return!1;return!0},t.prototype.setDepthDelta=function(n){this._depthDelta=n},t.prototype.getEdgeIntersectionList=function(){return this.eiList},t.prototype.addIntersections=function(n,i,s){for(var o=this,a=0;a<n.getIntersectionNum();a++)o.addIntersection(n,i,s,a)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.updateIM=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];i.setAtLeastIfValid(n.getLocation(0,Z.ON),n.getLocation(1,Z.ON),1),n.isArea()&&(i.setAtLeastIfValid(n.getLocation(0,Z.LEFT),n.getLocation(1,Z.LEFT),2),i.setAtLeastIfValid(n.getLocation(0,Z.RIGHT),n.getLocation(1,Z.RIGHT),2))}else return r.prototype.updateIM.apply(this,arguments)},t}(cr),xn=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Xr,this._bufParams=t||null};xn.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},xn.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(e!==null){var n=e.getLabel(),i=t.getLabel();e.isPointwiseEqual(t)||(i=new oe(t.getLabel()),i.flip()),n.merge(i);var s=xn.depthDelta(i),o=e.getDepthDelta(),a=o+s;e.setDepthDelta(a)}else this._edgeList.add(t),t.setDepthDelta(xn.depthDelta(t.getLabel()))},xn.prototype.buildSubgraphs=function(t,e){for(var n=new tt,i=t.iterator();i.hasNext();){var s=i.next(),o=s.getRightmostCoordinate(),a=new Va(n),u=a.getDepth(o);s.computeDepth(u),s.findResultEdges(),n.add(s),e.add(s.getDirectedEdges(),s.getNodes())}},xn.prototype.createSubgraphs=function(t){for(var e=new tt,n=t.getNodes().iterator();n.hasNext();){var i=n.next();if(!i.isVisited()){var s=new bn;s.create(i),e.add(s)}}return $r.sort(e,$r.reverseOrder()),e},xn.prototype.createEmptyResultGeometry=function(){var t=this._geomFact.createPolygon();return t},xn.prototype.getNoder=function(t){if(this._workingNoder!==null)return this._workingNoder;var e=new tm,n=new Uo;return n.setPrecisionModel(t),e.setSegmentIntersector(new pr(n)),e},xn.prototype.buffer=function(t,e){var n=this._workingPrecisionModel;n===null&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var i=new kn(n,this._bufParams),s=new Or(t,e,i),o=s.getCurves();if(o.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(o,n),this._graph=new xe(new X1),this._graph.addEdges(this._edgeList.getEdges());var a=this.createSubgraphs(this._graph),u=new Yn(this._geomFact);this.buildSubgraphs(a,u);var l=u.getPolygons();if(l.size()<=0)return this.createEmptyResultGeometry();var h=this._geomFact.buildGeometry(l);return h},xn.prototype.computeNodedEdges=function(t,e){var n=this,i=this.getNoder(e);i.computeNodes(t);for(var s=i.getNodedSubstrings(),o=s.iterator();o.hasNext();){var a=o.next(),u=a.getCoordinates();if(!(u.length===2&&u[0].equals2D(u[1]))){var l=a.getData(),h=new uf(a.getCoordinates(),new oe(l));n.insertUniqueEdge(h)}}},xn.prototype.setNoder=function(t){this._workingNoder=t},xn.prototype.interfaces_=function(){return[]},xn.prototype.getClass=function(){return xn},xn.depthDelta=function(t){var e=t.getLocation(0,Z.LEFT),n=t.getLocation(0,Z.RIGHT);return e===V.INTERIOR&&n===V.EXTERIOR?1:e===V.EXTERIOR&&n===V.INTERIOR?-1:0},xn.convertSegStrings=function(t){for(var e=new Ut,n=new tt;t.hasNext();){var i=t.next(),s=e.createLineString(i.getCoordinates());n.add(s)}return e.buildGeometry(n)};var lo=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],o=arguments[3];this._noder=n,this._scaleFactor=i,this._offsetX=s,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};lo.prototype.rescale=function(){var t=this;if(Pt(arguments[0],Ue))for(var e=arguments[0],n=e.iterator();n.hasNext();){var i=n.next();t.rescale(i.getCoordinates())}else if(arguments[0]instanceof Array){for(var s=arguments[0],o=0;o<s.length;o++)s[o].x=s[o].x/t._scaleFactor+t._offsetX,s[o].y=s[o].y/t._scaleFactor+t._offsetY;s.length===2&&s[0].equals2D(s[1])&&sn.out.println(s)}},lo.prototype.scale=function(){var t=this;if(Pt(arguments[0],Ue)){for(var e=arguments[0],n=new tt,i=e.iterator();i.hasNext();){var s=i.next();n.add(new Re(t.scale(s.getCoordinates()),s.getData()))}return n}else if(arguments[0]instanceof Array){for(var o=arguments[0],a=new Array(o.length).fill(null),u=0;u<o.length;u++)a[u]=new F(Math.round((o[u].x-t._offsetX)*t._scaleFactor),Math.round((o[u].y-t._offsetY)*t._scaleFactor),o[u].z);var l=zt.removeRepeatedPoints(a);return l}},lo.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},lo.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},lo.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},lo.prototype.interfaces_=function(){return[$o]},lo.prototype.getClass=function(){return lo};var yi=function(){this._li=new Uo,this._segStrings=null;var t=arguments[0];this._segStrings=t},J1={fact:{configurable:!0}};yi.prototype.checkEndPtVertexIntersections=function(){var t=this;if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();){var n=e.next(),i=n.getCoordinates();t.checkEndPtVertexIntersections(i[0],t._segStrings),t.checkEndPtVertexIntersections(i[i.length-1],t._segStrings)}else if(arguments.length===2){for(var s=arguments[0],o=arguments[1],a=o.iterator();a.hasNext();)for(var u=a.next(),l=u.getCoordinates(),h=1;h<l.length-1;h++)if(l[h].equals(s))throw new ws("found endpt/interior pt intersection at index "+h+" :pt "+s)}},yi.prototype.checkInteriorIntersections=function(){var t=this;if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();)for(var n=e.next(),i=this._segStrings.iterator();i.hasNext();){var s=i.next();t.checkInteriorIntersections(n,s)}else if(arguments.length===2)for(var o=arguments[0],a=arguments[1],u=o.getCoordinates(),l=a.getCoordinates(),h=0;h<u.length-1;h++)for(var c=0;c<l.length-1;c++)t.checkInteriorIntersections(o,h,a,c);else if(arguments.length===4){var d=arguments[0],p=arguments[1],g=arguments[2],y=arguments[3];if(d===g&&p===y)return null;var w=d.getCoordinates()[p],b=d.getCoordinates()[p+1],m=g.getCoordinates()[y],E=g.getCoordinates()[y+1];if(this._li.computeIntersection(w,b,m,E),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,w,b)||this.hasInteriorIntersection(this._li,m,E)))throw new ws("found non-noded intersection at "+w+"-"+b+" and "+m+"-"+E)}},yi.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},yi.prototype.checkCollapses=function(){var t=this;if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();){var n=e.next();t.checkCollapses(n)}else if(arguments.length===1)for(var i=arguments[0],s=i.getCoordinates(),o=0;o<s.length-2;o++)t.checkCollapse(s[o],s[o+1],s[o+2])},yi.prototype.hasInteriorIntersection=function(t,e,n){for(var i=0;i<t.getIntersectionNum();i++){var s=t.getIntersection(i);if(!(s.equals(e)||s.equals(n)))return!0}return!1},yi.prototype.checkCollapse=function(t,e,n){if(t.equals(n))throw new ws("found non-noded collapse at "+yi.fact.createLineString([t,e,n]))},yi.prototype.interfaces_=function(){return[]},yi.prototype.getClass=function(){return yi},J1.fact.get=function(){return new Ut},Object.defineProperties(yi,J1);var Gn=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],n=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=n,e<=0)throw new Ce("Scale factor must be non-zero");e!==1&&(this._pt=new F(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new F,this._p1Scaled=new F),this.initCorners(this._pt)},Z1={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Gn.prototype.intersectsScaled=function(t,e){var n=Math.min(t.x,e.x),i=Math.max(t.x,e.x),s=Math.min(t.y,e.y),o=Math.max(t.y,e.y),a=this._maxx<n||this._minx>i||this._maxy<s||this._miny>o;if(a)return!1;var u=this.intersectsToleranceSquare(t,e);return Ft.isTrue(!(a&&u),"Found bad envelope test"),u},Gn.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new F(this._maxx,this._maxy),this._corner[1]=new F(this._minx,this._maxy),this._corner[2]=new F(this._minx,this._miny),this._corner[3]=new F(this._maxx,this._miny)},Gn.prototype.intersects=function(t,e){return this._scaleFactor===1?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},Gn.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},Gn.prototype.getCoordinate=function(){return this._originalPt},Gn.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},Gn.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=Gn.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new gt(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},Gn.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))},Gn.prototype.intersectsToleranceSquare=function(t,e){var n=!1,i=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper())||n&&i||t.equals(this._pt)||e.equals(this._pt))},Gn.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),i=t.getCoordinate(e+1);return this.intersects(n,i)?(t.addIntersection(this.getCoordinate(),e),!0):!1},Gn.prototype.interfaces_=function(){return[]},Gn.prototype.getClass=function(){return Gn},Z1.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(Gn,Z1);var vc=function(){this.tempEnv1=new gt,this.selectedSegment=new mt};vc.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}}},vc.prototype.interfaces_=function(){return[]},vc.prototype.getClass=function(){return vc};var hl=function(){this._index=null;var t=arguments[0];this._index=t},K1={HotPixelSnapAction:{configurable:!0}};hl.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}else if(arguments.length===3){var e=arguments[0],n=arguments[1],i=arguments[2],s=e.getSafeEnvelope(),o=new Q1(e,n,i);return this._index.query(s,{interfaces_:function(){return[oo]},visitItem:function(a){var u=a;u.select(s,o)}}),o.isNodeAdded()}},hl.prototype.interfaces_=function(){return[]},hl.prototype.getClass=function(){return hl},K1.HotPixelSnapAction.get=function(){return Q1},Object.defineProperties(hl,K1);var Q1=function(r){function t(){r.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],n=arguments[1],i=arguments[2];this._hotPixel=e,this._parentEdge=n,this._hotPixelVertexIndex=i}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.isNodeAdded=function(){return this._isNodeAdded},t.prototype.select=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=n.getContext();if(this._parentEdge!==null&&s===this._parentEdge&&i===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(s,i)}else return r.prototype.select.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(vc),Ba=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new tt};Ba.prototype.processIntersections=function(t,e,n,i){var s=this;if(t===n&&e===i)return null;var o=t.getCoordinates()[e],a=t.getCoordinates()[e+1],u=n.getCoordinates()[i],l=n.getCoordinates()[i+1];if(this._li.computeIntersection(o,a,u,l),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var h=0;h<this._li.getIntersectionNum();h++)s._interiorIntersections.add(s._li.getIntersection(h));t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1)}},Ba.prototype.isDone=function(){return!1},Ba.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Ba.prototype.interfaces_=function(){return[Yo]},Ba.prototype.getClass=function(){return Ba};var $i=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new Uo,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};$i.prototype.checkCorrectness=function(t){var e=Re.getNodedSubstrings(t),n=new yi(e);try{n.checkValid()}catch(i){if(i instanceof D1)i.printStackTrace();else throw i}finally{}},$i.prototype.getNodedSubstrings=function(){return Re.getNodedSubstrings(this._nodedSegStrings)},$i.prototype.snapRound=function(t,e){var n=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(n),this.computeVertexSnaps(t)},$i.prototype.findInteriorIntersections=function(t,e){var n=new Ba(e);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(t),n.getInteriorIntersections()},$i.prototype.computeVertexSnaps=function(){var t=this;if(Pt(arguments[0],Ue))for(var e=arguments[0],n=e.iterator();n.hasNext();){var i=n.next();t.computeVertexSnaps(i)}else if(arguments[0]instanceof Re)for(var s=arguments[0],o=s.getCoordinates(),a=0;a<o.length;a++){var u=new Gn(o[a],t._scaleFactor,t._li),l=t._pointSnapper.snap(u,s,a);l&&s.addIntersection(o[a],a)}},$i.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new tm,this._pointSnapper=new hl(this._noder.getIndex()),this.snapRound(t,this._li)},$i.prototype.computeIntersectionSnaps=function(t){for(var e=this,n=t.iterator();n.hasNext();){var i=n.next(),s=new Gn(i,e._scaleFactor,e._li);e._pointSnapper.snap(s)}},$i.prototype.interfaces_=function(){return[$o]},$i.prototype.getClass=function(){return $i};var an=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new re,this._resultGeometry=null,this._saveException=null,arguments.length===1){var t=arguments[0];this._argGeom=t}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this._argGeom=e,this._bufParams=n}},cl={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};an.prototype.bufferFixedPrecision=function(t){var e=new lo(new $i(new ne(1)),t.getScale()),n=new xn(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)},an.prototype.bufferReducedPrecision=function(){var t=this;if(arguments.length===0){for(var e=an.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(o){if(o instanceof xs)t._saveException=o;else throw o}finally{}if(t._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],i=an.precisionScaleFactor(this._argGeom,this._distance,n),s=new ne(i);this.bufferFixedPrecision(s)}},an.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===ne.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},an.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},an.prototype.bufferOriginalPrecision=function(){try{var t=new xn(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof ws)this._saveException=e;else throw e}finally{}},an.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},an.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},an.prototype.interfaces_=function(){return[]},an.prototype.getClass=function(){return an},an.bufferOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new an(t),i=n.getResultGeometry(e);return i}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof bt&&typeof arguments[1]=="number"){var s=arguments[0],o=arguments[1],a=arguments[2],u=new an(s);u.setQuadrantSegments(a);var l=u.getResultGeometry(o);return l}else if(arguments[2]instanceof re&&arguments[0]instanceof bt&&typeof arguments[1]=="number"){var h=arguments[0],c=arguments[1],d=arguments[2],p=new an(h,d),g=p.getResultGeometry(c);return g}}else if(arguments.length===4){var y=arguments[0],w=arguments[1],b=arguments[2],m=arguments[3],E=new an(y);E.setQuadrantSegments(b),E.setEndCapStyle(m);var _=E.getResultGeometry(w);return _}},an.precisionScaleFactor=function(t,e,n){var i=t.getEnvelopeInternal(),s=hr.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY())),o=e>0?e:0,a=s+2*o,u=Math.trunc(Math.log(a)/Math.log(10)+1),l=n-u,h=Math.pow(10,l);return h},cl.CAP_ROUND.get=function(){return re.CAP_ROUND},cl.CAP_BUTT.get=function(){return re.CAP_FLAT},cl.CAP_FLAT.get=function(){return re.CAP_FLAT},cl.CAP_SQUARE.get=function(){return re.CAP_SQUARE},cl.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(an,cl);var In=function(){this._pt=[new F,new F],this._distance=Tt.NaN,this._isNull=!0};In.prototype.getCoordinates=function(){return this._pt},In.prototype.getCoordinate=function(t){return this._pt[t]},In.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var i=e.distance(n);i<this._distance&&this.initialize(e,n,i)}},In.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=s,this._isNull=!1}},In.prototype.getDistance=function(){return this._distance},In.prototype.setMaximum=function(){if(arguments.length===1){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var i=e.distance(n);i>this._distance&&this.initialize(e,n,i)}},In.prototype.interfaces_=function(){return[]},In.prototype.getClass=function(){return In};var Xi=function(){};Xi.prototype.interfaces_=function(){return[]},Xi.prototype.getClass=function(){return Xi},Xi.computeDistance=function(){if(arguments[2]instanceof In&&arguments[0]instanceof Me&&arguments[1]instanceof F)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=t.getCoordinates(),s=new mt,o=0;o<i.length-1;o++){s.setCoordinates(i[o],i[o+1]);var a=s.closestPoint(e);n.setMinimum(a,e)}else if(arguments[2]instanceof In&&arguments[0]instanceof qe&&arguments[1]instanceof F){var u=arguments[0],l=arguments[1],h=arguments[2];Xi.computeDistance(u.getExteriorRing(),l,h);for(var c=0;c<u.getNumInteriorRing();c++)Xi.computeDistance(u.getInteriorRingN(c),l,h)}else if(arguments[2]instanceof In&&arguments[0]instanceof bt&&arguments[1]instanceof F){var d=arguments[0],p=arguments[1],g=arguments[2];if(d instanceof Me)Xi.computeDistance(d,p,g);else if(d instanceof qe)Xi.computeDistance(d,p,g);else if(d instanceof Cn)for(var y=d,w=0;w<y.getNumGeometries();w++){var b=y.getGeometryN(w);Xi.computeDistance(b,p,g)}else g.setMinimum(d.getCoordinate(),p)}else if(arguments[2]instanceof In&&arguments[0]instanceof mt&&arguments[1]instanceof F){var m=arguments[0],E=arguments[1],_=arguments[2],S=m.closestPoint(E);_.setMinimum(S,E)}};var Zo=function(t){this._maxPtDist=new In,this._inputGeom=t||null},em={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Zo.prototype.computeMaxMidpointDistance=function(t){var e=new ho(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Zo.prototype.computeMaxVertexDistance=function(t){var e=new za(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Zo.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},Zo.prototype.getDistancePoints=function(){return this._maxPtDist},Zo.prototype.interfaces_=function(){return[]},Zo.prototype.getClass=function(){return Zo},em.MaxPointDistanceFilter.get=function(){return za},em.MaxMidpointDistanceFilter.get=function(){return ho},Object.defineProperties(Zo,em);var za=function(t){this._maxPtDist=new In,this._minPtDist=new In,this._geom=t||null};za.prototype.filter=function(t){this._minPtDist.initialize(),Xi.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},za.prototype.getMaxPointDistance=function(){return this._maxPtDist},za.prototype.interfaces_=function(){return[Vi]},za.prototype.getClass=function(){return za};var ho=function(t){this._maxPtDist=new In,this._minPtDist=new In,this._geom=t||null};ho.prototype.filter=function(t,e){if(e===0)return null;var n=t.getCoordinate(e-1),i=t.getCoordinate(e),s=new F((n.x+i.x)/2,(n.y+i.y)/2);this._minPtDist.initialize(),Xi.computeDistance(this._geom,s,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},ho.prototype.isDone=function(){return!1},ho.prototype.isGeometryChanged=function(){return!1},ho.prototype.getMaxPointDistance=function(){return this._maxPtDist},ho.prototype.interfaces_=function(){return[Wr]},ho.prototype.getClass=function(){return ho};var Ns=function(t){this._comps=t||null};Ns.prototype.filter=function(t){t instanceof qe&&this._comps.add(t)},Ns.prototype.interfaces_=function(){return[ci]},Ns.prototype.getClass=function(){return Ns},Ns.getPolygons=function(){if(arguments.length===1){var t=arguments[0];return Ns.getPolygons(t,new tt)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof qe?n.add(e):e instanceof Cn&&e.apply(new Ns(n)),n}};var un=function(){if(this._lines=null,this._isForcedToLineString=!1,arguments.length===1){var t=arguments[0];this._lines=t}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this._lines=e,this._isForcedToLineString=n}};un.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof Bi){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof Me&&this._lines.add(t)},un.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},un.prototype.interfaces_=function(){return[Es]},un.prototype.getClass=function(){return un},un.getGeometry=function(){if(arguments.length===1){var t=arguments[0];return t.getFactory().buildGeometry(un.getLines(t))}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e.getFactory().buildGeometry(un.getLines(e,n))}},un.getLines=function(){if(arguments.length===1){var t=arguments[0];return un.getLines(t,!1)}else if(arguments.length===2){if(Pt(arguments[0],Ue)&&Pt(arguments[1],Ue)){for(var e=arguments[0],n=arguments[1],i=e.iterator();i.hasNext();){var s=i.next();un.getLines(s,n)}return n}else if(arguments[0]instanceof bt&&typeof arguments[1]=="boolean"){var o=arguments[0],a=arguments[1],u=new tt;return o.apply(new un(u,a)),u}else if(arguments[0]instanceof bt&&Pt(arguments[1],Ue)){var l=arguments[0],h=arguments[1];return l instanceof Me?h.add(l):l.apply(new un(h)),h}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&Pt(arguments[0],Ue)&&Pt(arguments[1],Ue)){for(var c=arguments[0],d=arguments[1],p=arguments[2],g=c.iterator();g.hasNext();){var y=g.next();un.getLines(y,d,p)}return d}else if(typeof arguments[2]=="boolean"&&arguments[0]instanceof bt&&Pt(arguments[1],Ue)){var w=arguments[0],b=arguments[1],m=arguments[2];return w.apply(new un(b,m)),b}}};var Yr=function(){if(this._boundaryRule=Ir.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];if(t===null)throw new Ce("Rule must be non-null");this._boundaryRule=t}}};Yr.prototype.locateInternal=function(){var t=this;if(arguments[0]instanceof F&&arguments[1]instanceof qe){var e=arguments[0],n=arguments[1];if(n.isEmpty())return V.EXTERIOR;var i=n.getExteriorRing(),s=this.locateInPolygonRing(e,i);if(s===V.EXTERIOR)return V.EXTERIOR;if(s===V.BOUNDARY)return V.BOUNDARY;for(var o=0;o<n.getNumInteriorRing();o++){var a=n.getInteriorRingN(o),u=t.locateInPolygonRing(e,a);if(u===V.INTERIOR)return V.EXTERIOR;if(u===V.BOUNDARY)return V.BOUNDARY}return V.INTERIOR}else if(arguments[0]instanceof F&&arguments[1]instanceof Me){var l=arguments[0],h=arguments[1];if(!h.getEnvelopeInternal().intersects(l))return V.EXTERIOR;var c=h.getCoordinates();return!h.isClosed()&&(l.equals(c[0])||l.equals(c[c.length-1]))?V.BOUNDARY:rt.isOnLine(l,c)?V.INTERIOR:V.EXTERIOR}else if(arguments[0]instanceof F&&arguments[1]instanceof Xn){var d=arguments[0],p=arguments[1],g=p.getCoordinate();return g.equals2D(d)?V.INTERIOR:V.EXTERIOR}},Yr.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?rt.locatePointInRing(t,e.getCoordinates()):V.EXTERIOR},Yr.prototype.intersects=function(t,e){return this.locate(t,e)!==V.EXTERIOR},Yr.prototype.updateLocationInfo=function(t){t===V.INTERIOR&&(this._isIn=!0),t===V.BOUNDARY&&this._numBoundaries++},Yr.prototype.computeLocation=function(t,e){var n=this;if(e instanceof Xn&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof Me)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof qe)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof Ho)for(var i=e,s=0;s<i.getNumGeometries();s++){var o=i.getGeometryN(s);n.updateLocationInfo(n.locateInternal(t,o))}else if(e instanceof zi)for(var a=e,u=0;u<a.getNumGeometries();u++){var l=a.getGeometryN(u);n.updateLocationInfo(n.locateInternal(t,l))}else if(e instanceof Cn)for(var h=new Wi(e);h.hasNext();){var c=h.next();c!==e&&n.computeLocation(t,c)}},Yr.prototype.locate=function(t,e){return e.isEmpty()?V.EXTERIOR:e instanceof Me?this.locateInternal(t,e):e instanceof qe?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?V.BOUNDARY:this._numBoundaries>0||this._isIn?V.INTERIOR:V.EXTERIOR)},Yr.prototype.interfaces_=function(){return[]},Yr.prototype.getClass=function(){return Yr};var Mn=function r(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var t=arguments[0],e=arguments[1];r.call(this,t,r.INSIDE_AREA,e)}else if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];this._component=n,this._segIndex=i,this._pt=s}},tw={INSIDE_AREA:{configurable:!0}};Mn.prototype.isInsideArea=function(){return this._segIndex===Mn.INSIDE_AREA},Mn.prototype.getCoordinate=function(){return this._pt},Mn.prototype.getGeometryComponent=function(){return this._component},Mn.prototype.getSegmentIndex=function(){return this._segIndex},Mn.prototype.interfaces_=function(){return[]},Mn.prototype.getClass=function(){return Mn},tw.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Mn,tw);var co=function(t){this._pts=t||null};co.prototype.filter=function(t){t instanceof Xn&&this._pts.add(t)},co.prototype.interfaces_=function(){return[ci]},co.prototype.getClass=function(){return co},co.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof Xn?$r.singletonList(t):co.getPoints(t,new tt)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof Xn?n.add(e):e instanceof Cn&&e.apply(new co(n)),n}};var Ua=function(){this._locations=null;var t=arguments[0];this._locations=t};Ua.prototype.filter=function(t){(t instanceof Xn||t instanceof Me||t instanceof qe)&&this._locations.add(new Mn(t,0,t.getCoordinate()))},Ua.prototype.interfaces_=function(){return[ci]},Ua.prototype.getClass=function(){return Ua},Ua.getLocations=function(t){var e=new tt;return t.apply(new Ua(e)),e};var ln=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Yr,this._minDistanceLocation=null,this._minDistance=Tt.MAX_VALUE,arguments.length===2){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i,this._terminateDistance=s}};ln.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(arguments.length===2){var n=arguments[0],i=arguments[1],s=1-n,o=Ns.getPolygons(this._geom[n]);if(o.size()>0){var a=Ua.getLocations(this._geom[s]);if(this.computeContainmentDistance(a,o,i),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[s]=i[0],this._minDistanceLocation[n]=i[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Pt(arguments[0],Ur)&&Pt(arguments[1],Ur)){for(var u=arguments[0],l=arguments[1],h=arguments[2],c=0;c<u.size();c++)for(var d=u.get(c),p=0;p<l.size();p++)if(t.computeContainmentDistance(d,l.get(p),h),t._minDistance<=t._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof Mn&&arguments[1]instanceof qe){var g=arguments[0],y=arguments[1],w=arguments[2],b=g.getCoordinate();if(V.EXTERIOR!==this._ptLocator.locate(b,y))return this._minDistance=0,w[0]=g,w[1]=new Mn(y,b),null}}},ln.prototype.computeMinDistanceLinesPoints=function(t,e,n){for(var i=this,s=0;s<t.size();s++)for(var o=t.get(s),a=0;a<e.size();a++){var u=e.get(a);if(i.computeMinDistance(o,u,n),i._minDistance<=i._terminateDistance)return null}},ln.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=un.getLines(this._geom[0]),n=un.getLines(this._geom[1]),i=co.getPoints(this._geom[0]),s=co.getPoints(this._geom[1]);if(this.computeMinDistanceLines(e,n,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance||(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,s,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance)||(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(n,i,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance))return null;t[0]=null,t[1]=null,this.computeMinDistancePoints(i,s,t),this.updateMinDistance(t,!1)},ln.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},ln.prototype.updateMinDistance=function(t,e){if(t[0]===null)return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},ln.prototype.nearestPoints=function(){this.computeMinDistance();var t=[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()];return t},ln.prototype.computeMinDistance=function(){var t=this;if(arguments.length===0){if(this._minDistanceLocation!==null||(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance))return null;this.computeFacetDistance()}else if(arguments.length===3){if(arguments[2]instanceof Array&&arguments[0]instanceof Me&&arguments[1]instanceof Xn){var e=arguments[0],n=arguments[1],i=arguments[2];if(e.getEnvelopeInternal().distance(n.getEnvelopeInternal())>this._minDistance)return null;for(var s=e.getCoordinates(),o=n.getCoordinate(),a=0;a<s.length-1;a++){var u=rt.distancePointLine(o,s[a],s[a+1]);if(u<t._minDistance){t._minDistance=u;var l=new mt(s[a],s[a+1]),h=l.closestPoint(o);i[0]=new Mn(e,a,h),i[1]=new Mn(n,0,o)}if(t._minDistance<=t._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof Me&&arguments[1]instanceof Me){var c=arguments[0],d=arguments[1],p=arguments[2];if(c.getEnvelopeInternal().distance(d.getEnvelopeInternal())>this._minDistance)return null;for(var g=c.getCoordinates(),y=d.getCoordinates(),w=0;w<g.length-1;w++)for(var b=0;b<y.length-1;b++){var m=rt.distanceLineLine(g[w],g[w+1],y[b],y[b+1]);if(m<t._minDistance){t._minDistance=m;var E=new mt(g[w],g[w+1]),_=new mt(y[b],y[b+1]),S=E.closestPoints(_);p[0]=new Mn(c,w,S[0]),p[1]=new Mn(d,b,S[1])}if(t._minDistance<=t._terminateDistance)return null}}}},ln.prototype.computeMinDistancePoints=function(t,e,n){for(var i=this,s=0;s<t.size();s++)for(var o=t.get(s),a=0;a<e.size();a++){var u=e.get(a),l=o.getCoordinate().distance(u.getCoordinate());if(l<i._minDistance&&(i._minDistance=l,n[0]=new Mn(o,0,o.getCoordinate()),n[1]=new Mn(u,0,u.getCoordinate())),i._minDistance<=i._terminateDistance)return null}},ln.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new Ce("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},ln.prototype.computeMinDistanceLines=function(t,e,n){for(var i=this,s=0;s<t.size();s++)for(var o=t.get(s),a=0;a<e.size();a++){var u=e.get(a);if(i.computeMinDistance(o,u,n),i._minDistance<=i._terminateDistance)return null}},ln.prototype.interfaces_=function(){return[]},ln.prototype.getClass=function(){return ln},ln.distance=function(t,e){var n=new ln(t,e);return n.distance()},ln.isWithinDistance=function(t,e,n){var i=new ln(t,e,n);return i.distance()<=n},ln.nearestPoints=function(t,e){var n=new ln(t,e);return n.nearestPoints()};var yn=function(){this._pt=[new F,new F],this._distance=Tt.NaN,this._isNull=!0};yn.prototype.getCoordinates=function(){return this._pt},yn.prototype.getCoordinate=function(t){return this._pt[t]},yn.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var i=e.distance(n);i<this._distance&&this.initialize(e,n,i)}},yn.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=s,this._isNull=!1}},yn.prototype.toString=function(){return zr.toLineString(this._pt[0],this._pt[1])},yn.prototype.getDistance=function(){return this._distance},yn.prototype.setMaximum=function(){if(arguments.length===1){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var i=e.distance(n);i>this._distance&&this.initialize(e,n,i)}},yn.prototype.interfaces_=function(){return[]},yn.prototype.getClass=function(){return yn};var wi=function(){};wi.prototype.interfaces_=function(){return[]},wi.prototype.getClass=function(){return wi},wi.computeDistance=function(){if(arguments[2]instanceof yn&&arguments[0]instanceof Me&&arguments[1]instanceof F)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=new mt,s=t.getCoordinates(),o=0;o<s.length-1;o++){i.setCoordinates(s[o],s[o+1]);var a=i.closestPoint(e);n.setMinimum(a,e)}else if(arguments[2]instanceof yn&&arguments[0]instanceof qe&&arguments[1]instanceof F){var u=arguments[0],l=arguments[1],h=arguments[2];wi.computeDistance(u.getExteriorRing(),l,h);for(var c=0;c<u.getNumInteriorRing();c++)wi.computeDistance(u.getInteriorRingN(c),l,h)}else if(arguments[2]instanceof yn&&arguments[0]instanceof bt&&arguments[1]instanceof F){var d=arguments[0],p=arguments[1],g=arguments[2];if(d instanceof Me)wi.computeDistance(d,p,g);else if(d instanceof qe)wi.computeDistance(d,p,g);else if(d instanceof Cn)for(var y=d,w=0;w<y.getNumGeometries();w++){var b=y.getGeometryN(w);wi.computeDistance(b,p,g)}else g.setMinimum(d.getCoordinate(),p)}else if(arguments[2]instanceof yn&&arguments[0]instanceof mt&&arguments[1]instanceof F){var m=arguments[0],E=arguments[1],_=arguments[2],S=m.closestPoint(E);_.setMinimum(S,E)}};var Dr=function(){this._g0=null,this._g1=null,this._ptDist=new yn,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},nm={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};Dr.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},Dr.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new Ce("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},Dr.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},Dr.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Dr.prototype.computeOrientedDistance=function(t,e,n){var i=new qa(e);if(t.apply(i),n.setMaximum(i.getMaxPointDistance()),this._densifyFrac>0){var s=new fo(e,this._densifyFrac);t.apply(s),n.setMaximum(s.getMaxPointDistance())}},Dr.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Dr.prototype.interfaces_=function(){return[]},Dr.prototype.getClass=function(){return Dr},Dr.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new Dr(t,e);return n.distance()}else if(arguments.length===3){var i=arguments[0],s=arguments[1],o=arguments[2],a=new Dr(i,s);return a.setDensifyFraction(o),a.distance()}},nm.MaxPointDistanceFilter.get=function(){return qa},nm.MaxDensifiedByFractionDistanceFilter.get=function(){return fo},Object.defineProperties(Dr,nm);var qa=function(){this._maxPtDist=new yn,this._minPtDist=new yn,this._euclideanDist=new wi,this._geom=null;var t=arguments[0];this._geom=t};qa.prototype.filter=function(t){this._minPtDist.initialize(),wi.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},qa.prototype.getMaxPointDistance=function(){return this._maxPtDist},qa.prototype.interfaces_=function(){return[Vi]},qa.prototype.getClass=function(){return qa};var fo=function(){this._maxPtDist=new yn,this._minPtDist=new yn,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};fo.prototype.filter=function(t,e){var n=this;if(e===0)return null;for(var i=t.getCoordinate(e-1),s=t.getCoordinate(e),o=(s.x-i.x)/this._numSubSegs,a=(s.y-i.y)/this._numSubSegs,u=0;u<this._numSubSegs;u++){var l=i.x+u*o,h=i.y+u*a,c=new F(l,h);n._minPtDist.initialize(),wi.computeDistance(n._geom,c,n._minPtDist),n._maxPtDist.setMaximum(n._minPtDist)}},fo.prototype.isDone=function(){return!1},fo.prototype.isGeometryChanged=function(){return!1},fo.prototype.getMaxPointDistance=function(){return this._maxPtDist},fo.prototype.interfaces_=function(){return[Wr]},fo.prototype.getClass=function(){return fo};var Zn=function(t,e,n){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._bufDistance=e||null,this._result=n||null},rm={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Zn.prototype.checkMaximumDistance=function(t,e,n){var i=new Dr(e,t);if(i.setDensifyFraction(.25),this._maxDistanceFound=i.orientedDistance(),this._maxDistanceFound>n){this._isValid=!1;var s=i.getCoordinates();this._errorLocation=s[1],this._errorIndicator=t.getFactory().createLineString(s),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+zr.toLineString(s[0],s[1])+")"}},Zn.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=Zn.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Zn.VERBOSE&&sn.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Zn.prototype.checkNegativeValid=function(){if(!(this._input instanceof qe||this._input instanceof zi||this._input instanceof Cn))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)},Zn.prototype.getErrorIndicator=function(){return this._errorIndicator},Zn.prototype.checkMinimumDistance=function(t,e,n){var i=new ln(t,e,n);if(this._minDistanceFound=i.distance(),this._minDistanceFound<n){this._isValid=!1;var s=i.nearestPoints();this._errorLocation=i.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(s),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+zr.toLineString(s[0],s[1])+" )"}},Zn.prototype.checkPositiveValid=function(){var t=this._result.getBoundary();if(this.checkMinimumDistance(this._input,t,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,t,this._maxValidDistance)},Zn.prototype.getErrorLocation=function(){return this._errorLocation},Zn.prototype.getPolygonLines=function(t){for(var e=new tt,n=new un(e),i=Ns.getPolygons(t),s=i.iterator();s.hasNext();){var o=s.next();o.apply(n)}return t.getFactory().buildGeometry(e)},Zn.prototype.getErrorMessage=function(){return this._errMsg},Zn.prototype.interfaces_=function(){return[]},Zn.prototype.getClass=function(){return Zn},rm.VERBOSE.get=function(){return!1},rm.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Zn,rm);var hn=function(t,e,n){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=n||null},im={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};hn.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},hn.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*hn.MAX_ENV_DIFF_FRAC;t===0&&(t=.001);var e=new gt(this._input.getEnvelopeInternal());e.expandBy(this._distance);var n=new gt(this._result.getEnvelopeInternal());n.expandBy(t),n.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(n)),this.report("Envelope")},hn.prototype.checkDistance=function(){var t=new Zn(this._input,this._distance,this._result);t.isValid()||(this._isValid=!1,this._errorMsg=t.getErrorMessage(),this._errorLocation=t.getErrorLocation(),this._errorIndicator=t.getErrorIndicator()),this.report("Distance")},hn.prototype.checkArea=function(){var t=this._input.getArea(),e=this._result.getArea();this._distance>0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t<e&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},hn.prototype.checkPolygonal=function(){this._result instanceof qe||this._result instanceof zi||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},hn.prototype.getErrorIndicator=function(){return this._errorIndicator},hn.prototype.getErrorLocation=function(){return this._errorLocation},hn.prototype.checkExpectedEmpty=function(){if(this._input.getDimension()>=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")},hn.prototype.report=function(t){if(!hn.VERBOSE)return null;sn.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},hn.prototype.getErrorMessage=function(){return this._errorMsg},hn.prototype.interfaces_=function(){return[]},hn.prototype.getClass=function(){return hn},hn.isValidMsg=function(t,e,n){var i=new hn(t,e,n);return i.isValid()?null:i.getErrorMessage()},hn.isValid=function(t,e,n){var i=new hn(t,e,n);return!!i.isValid()},im.VERBOSE.get=function(){return!1},im.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(hn,im);var Ei=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Ei.prototype.getCoordinates=function(){return this._pts},Ei.prototype.size=function(){return this._pts.length},Ei.prototype.getCoordinate=function(t){return this._pts[t]},Ei.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Ei.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Ga.octant(this.getCoordinate(t),this.getCoordinate(t+1))},Ei.prototype.setData=function(t){this._data=t},Ei.prototype.getData=function(){return this._data},Ei.prototype.toString=function(){return zr.toLineString(new Ae(this._pts))},Ei.prototype.interfaces_=function(){return[qi]},Ei.prototype.getClass=function(){return Ei};var Qe=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new tt,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};Qe.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Qe.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},Qe.prototype.getIntersectionSegments=function(){return this._intSegments},Qe.prototype.count=function(){return this._intersectionCount},Qe.prototype.getIntersections=function(){return this._intersections},Qe.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Qe.prototype.setKeepIntersections=function(t){this._keepIntersections=t},Qe.prototype.processIntersections=function(t,e,n,i){if(!this._findAllIntersections&&this.hasIntersection()||t===n&&e===i)return null;if(this._isCheckEndSegmentsOnly){var s=this.isEndSegment(t,e)||this.isEndSegment(n,i);if(!s)return null}var o=t.getCoordinates()[e],a=t.getCoordinates()[e+1],u=n.getCoordinates()[i],l=n.getCoordinates()[i+1];this._li.computeIntersection(o,a,u,l),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=o,this._intSegments[1]=a,this._intSegments[2]=u,this._intSegments[3]=l,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},Qe.prototype.isEndSegment=function(t,e){return e===0||e>=t.size()-2},Qe.prototype.hasIntersection=function(){return this._interiorIntersection!==null},Qe.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null},Qe.prototype.interfaces_=function(){return[Yo]},Qe.prototype.getClass=function(){return Qe},Qe.createAllIntersectionsFinder=function(t){var e=new Qe(t);return e.setFindAllIntersections(!0),e},Qe.createAnyIntersectionFinder=function(t){return new Qe(t)},Qe.createIntersectionCounter=function(t){var e=new Qe(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Jr=function(){this._li=new Uo,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Jr.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},Jr.prototype.getIntersections=function(){return this._segInt.getIntersections()},Jr.prototype.isValid=function(){return this.execute(),this._isValid},Jr.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Jr.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Qe(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new tm;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Jr.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new xs(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Jr.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+zr.toLineString(t[0],t[1])+" and "+zr.toLineString(t[2],t[3])},Jr.prototype.interfaces_=function(){return[]},Jr.prototype.getClass=function(){return Jr},Jr.computeIntersections=function(t){var e=new Jr(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var Ko=function r(){this._nv=null;var t=arguments[0];this._nv=new Jr(r.toSegmentStrings(t))};Ko.prototype.checkValid=function(){this._nv.checkValid()},Ko.prototype.interfaces_=function(){return[]},Ko.prototype.getClass=function(){return Ko},Ko.toSegmentStrings=function(t){for(var e=new tt,n=t.iterator();n.hasNext();){var i=n.next();e.add(new Ei(i.getCoordinates(),i))}return e},Ko.checkValid=function(t){var e=new Ko(t);e.checkValid()};var Wa=function(t){this._mapOp=t};Wa.prototype.map=function(t){for(var e=this,n=new tt,i=0;i<t.getNumGeometries();i++){var s=e._mapOp.map(t.getGeometryN(i));s.isEmpty()||n.add(s)}return t.getFactory().createGeometryCollection(Ut.toGeometryArray(n))},Wa.prototype.interfaces_=function(){return[]},Wa.prototype.getClass=function(){return Wa},Wa.map=function(t,e){var n=new Wa(e);return n.map(t)};var Si=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new tt,this._resultLineList=new tt;var t=arguments[0],e=arguments[1],n=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=n};Si.prototype.collectLines=function(t){for(var e=this,n=this._op.getGraph().getEdgeEnds().iterator();n.hasNext();){var i=n.next();e.collectLineEdge(i,t,e._lineEdgesList),e.collectBoundaryTouchEdge(i,t,e._lineEdgesList)}},Si.prototype.labelIsolatedLine=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,n)},Si.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},Si.prototype.collectLineEdge=function(t,e,n){var i=t.getLabel(),s=t.getEdge();t.isLineEdge()&&!t.isVisited()&&Rt.isResultOfOp(i,e)&&!s.isCovered()&&(n.add(s),t.setVisitedEdge(!0))},Si.prototype.findCoveredLineEdges=function(){for(var t=this,e=this._op.getGraph().getNodes().iterator();e.hasNext();){var n=e.next();n.getEdges().findCoveredLineEdges()}for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var s=i.next(),o=s.getEdge();if(s.isLineEdge()&&!o.isCoveredSet()){var a=t._op.isCoveredByA(s.getCoordinate());o.setCovered(a)}}},Si.prototype.labelIsolatedLines=function(t){for(var e=this,n=t.iterator();n.hasNext();){var i=n.next(),s=i.getLabel();i.isIsolated()&&(s.isNull(0)?e.labelIsolatedLine(i,0):e.labelIsolatedLine(i,1))}},Si.prototype.buildLines=function(t){for(var e=this,n=this._lineEdgesList.iterator();n.hasNext();){var i=n.next(),s=e._geometryFactory.createLineString(i.getCoordinates());e._resultLineList.add(s),i.setInResult(!0)}},Si.prototype.collectBoundaryTouchEdge=function(t,e,n){var i=t.getLabel();if(t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult())return null;Ft.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),Rt.isResultOfOp(i,e)&&e===Rt.INTERSECTION&&(n.add(t.getEdge()),t.setVisitedEdge(!0))},Si.prototype.interfaces_=function(){return[]},Si.prototype.getClass=function(){return Si};var Ha=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new tt;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};Ha.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var n=this._geometryFactory.createPoint(e);this._resultPointList.add(n)}},Ha.prototype.extractNonCoveredResultNodes=function(t){for(var e=this,n=this._op.getGraph().getNodes().iterator();n.hasNext();){var i=n.next();if(!i.isInResult()&&!i.isIncidentEdgeInResult()&&(i.getEdges().getDegree()===0||t===Rt.INTERSECTION)){var s=i.getLabel();Rt.isResultOfOp(s,t)&&e.filterCoveredNodeToPoint(i)}}},Ha.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},Ha.prototype.interfaces_=function(){return[]},Ha.prototype.getClass=function(){return Ha};var jn=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};jn.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},jn.prototype.transformPolygon=function(t,e){var n=this,i=!0,s=this.transformLinearRing(t.getExteriorRing(),t);(s===null||!(s instanceof Bi)||s.isEmpty())&&(i=!1);for(var o=new tt,a=0;a<t.getNumInteriorRing();a++){var u=n.transformLinearRing(t.getInteriorRingN(a),t);u===null||u.isEmpty()||(u instanceof Bi||(i=!1),o.add(u))}if(i)return this._factory.createPolygon(s,o.toArray([]));var l=new tt;return s!==null&&l.add(s),l.addAll(o),this._factory.buildGeometry(l)},jn.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},jn.prototype.getInputGeometry=function(){return this._inputGeom},jn.prototype.transformMultiLineString=function(t,e){for(var n=this,i=new tt,s=0;s<t.getNumGeometries();s++){var o=n.transformLineString(t.getGeometryN(s),t);o!==null&&(o.isEmpty()||i.add(o))}return this._factory.buildGeometry(i)},jn.prototype.transformCoordinates=function(t,e){return this.copy(t)},jn.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},jn.prototype.transformMultiPoint=function(t,e){for(var n=this,i=new tt,s=0;s<t.getNumGeometries();s++){var o=n.transformPoint(t.getGeometryN(s),t);o!==null&&(o.isEmpty()||i.add(o))}return this._factory.buildGeometry(i)},jn.prototype.transformMultiPolygon=function(t,e){for(var n=this,i=new tt,s=0;s<t.getNumGeometries();s++){var o=n.transformPolygon(t.getGeometryN(s),t);o!==null&&(o.isEmpty()||i.add(o))}return this._factory.buildGeometry(i)},jn.prototype.copy=function(t){return t.copy()},jn.prototype.transformGeometryCollection=function(t,e){for(var n=this,i=new tt,s=0;s<t.getNumGeometries();s++){var o=n.transform(t.getGeometryN(s));o!==null&&(n._pruneEmptyGeometry&&o.isEmpty()||i.add(o))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(Ut.toGeometryArray(i)):this._factory.buildGeometry(i)},jn.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof Xn)return this.transformPoint(t,null);if(t instanceof sl)return this.transformMultiPoint(t,null);if(t instanceof Bi)return this.transformLinearRing(t,null);if(t instanceof Me)return this.transformLineString(t,null);if(t instanceof Ho)return this.transformMultiLineString(t,null);if(t instanceof qe)return this.transformPolygon(t,null);if(t instanceof zi)return this.transformMultiPolygon(t,null);if(t instanceof Cn)return this.transformGeometryCollection(t,null);throw new Ce("Unknown Geometry subtype: "+t.getClass().getName())},jn.prototype.transformLinearRing=function(t,e){var n=this.transformCoordinates(t.getCoordinateSequence(),t);if(n===null)return this._factory.createLinearRing(null);var i=n.size();return i>0&&i<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)},jn.prototype.interfaces_=function(){return[]},jn.prototype.getClass=function(){return jn};var Yi=function r(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new mt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Me&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];r.call(this,t.getCoordinates(),e)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];this._srcPts=n,this._isClosed=r.isClosed(n),this._snapTolerance=i}};Yi.prototype.snapVertices=function(t,e){for(var n=this,i=this._isClosed?t.size()-1:t.size(),s=0;s<i;s++){var o=t.get(s),a=n.findSnapForVertex(o,e);a!==null&&(t.set(s,new F(a)),s===0&&n._isClosed&&t.set(t.size()-1,new F(a)))}},Yi.prototype.findSnapForVertex=function(t,e){for(var n=this,i=0;i<e.length;i++){if(t.equals2D(e[i]))return null;if(t.distance(e[i])<n._snapTolerance)return e[i]}return null},Yi.prototype.snapTo=function(t){var e=new rc(this._srcPts);this.snapVertices(e,t),this.snapSegments(e,t);var n=e.toCoordinateArray();return n},Yi.prototype.snapSegments=function(t,e){var n=this;if(e.length===0)return null;var i=e.length;e[0].equals2D(e[e.length-1])&&(i=e.length-1);for(var s=0;s<i;s++){var o=e[s],a=n.findSegmentIndexToSnap(o,t);a>=0&&t.add(a+1,new F(o),!1)}},Yi.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,i=Tt.MAX_VALUE,s=-1,o=0;o<e.size()-1;o++){if(n._seg.p0=e.get(o),n._seg.p1=e.get(o+1),n._seg.p0.equals2D(t)||n._seg.p1.equals2D(t)){if(n._allowSnappingToSourceVertices)continue;return-1}var a=n._seg.distance(t);a<n._snapTolerance&&a<i&&(i=a,s=o)}return s},Yi.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},Yi.prototype.interfaces_=function(){return[]},Yi.prototype.getClass=function(){return Yi},Yi.isClosed=function(t){return t.length<=1?!1:t[0].equals2D(t[t.length-1])};var Le=function(t){this._srcGeom=t||null},ew={SNAP_PRECISION_FACTOR:{configurable:!0}};Le.prototype.snapTo=function(t,e){var n=this.extractTargetCoordinates(t),i=new nw(e,n);return i.transform(this._srcGeom)},Le.prototype.snapToSelf=function(t,e){var n=this.extractTargetCoordinates(this._srcGeom),i=new nw(t,n,!0),s=i.transform(this._srcGeom),o=s;return e&&Pt(o,so)&&(o=s.buffer(0)),o},Le.prototype.computeSnapTolerance=function(t){var e=this.computeMinimumSegmentLength(t),n=e/10;return n},Le.prototype.extractTargetCoordinates=function(t){for(var e=new hi,n=t.getCoordinates(),i=0;i<n.length;i++)e.add(n[i]);return e.toArray(new Array(0).fill(null))},Le.prototype.computeMinimumSegmentLength=function(t){for(var e=Tt.MAX_VALUE,n=0;n<t.length-1;n++){var i=t[n].distance(t[n+1]);i<e&&(e=i)}return e},Le.prototype.interfaces_=function(){return[]},Le.prototype.getClass=function(){return Le},Le.snap=function(t,e,n){var i=new Array(2).fill(null),s=new Le(t);i[0]=s.snapTo(e,n);var o=new Le(e);return i[1]=o.snapTo(i[0],n),i},Le.computeOverlaySnapTolerance=function(){if(arguments.length===1){var t=arguments[0],e=Le.computeSizeBasedSnapTolerance(t),n=t.getPrecisionModel();if(n.getType()===ne.FIXED){var i=1/n.getScale()*2/1.415;i>e&&(e=i)}return e}else if(arguments.length===2){var s=arguments[0],o=arguments[1];return Math.min(Le.computeOverlaySnapTolerance(s),Le.computeOverlaySnapTolerance(o))}},Le.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),n=Math.min(e.getHeight(),e.getWidth()),i=n*Le.SNAP_PRECISION_FACTOR;return i},Le.snapToSelf=function(t,e,n){var i=new Le(t);return i.snapToSelf(e,n)},ew.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Le,ew);var nw=function(r){function t(e,n,i){r.call(this),this._snapTolerance=e||null,this._snapPts=n||null,this._isSelfSnap=i!==void 0?i:!1}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.snapLine=function(n,i){var s=new Yi(n,this._snapTolerance);return s.setAllowSnappingToSourceVertices(this._isSelfSnap),s.snapTo(i)},t.prototype.transformCoordinates=function(n,i){var s=n.toCoordinateArray(),o=this.snapLine(s,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(o)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(jn),Tn=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Tn.prototype.getCommon=function(){return Tt.longBitsToDouble(this._commonBits)},Tn.prototype.add=function(t){var e=Tt.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=Tn.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Tn.signExpBits(e);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Tn.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=Tn.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},Tn.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=Tt.longBitsToDouble(t),n=Tt.toBinaryString(t),i="0000000000000000000000000000000000000000000000000000000000000000"+n,s=i.substring(i.length-64),o=s.substring(0,1)+" "+s.substring(1,12)+"(exp) "+s.substring(12)+" [ "+e+" ]";return o}},Tn.prototype.interfaces_=function(){return[]},Tn.prototype.getClass=function(){return Tn},Tn.getBit=function(t,e){var n=1<<e;return(t&n)!==0?1:0},Tn.signExpBits=function(t){return t>>52},Tn.zeroLowerBits=function(t,e){var n=(1<<e)-1,i=~n,s=t&i;return s},Tn.numCommonMostSigMantissaBits=function(t,e){for(var n=0,i=52;i>=0;i--){if(Tn.getBit(t,i)!==Tn.getBit(e,i))return n;n++}return 52};var po=function(){this._commonCoord=null,this._ccFilter=new $a},sm={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};po.prototype.addCommonBits=function(t){var e=new go(this._commonCoord);t.apply(e),t.geometryChanged()},po.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new F(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new go(e);return t.apply(n),t.geometryChanged(),t},po.prototype.getCommonCoordinate=function(){return this._commonCoord},po.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},po.prototype.interfaces_=function(){return[]},po.prototype.getClass=function(){return po},sm.CommonCoordinateFilter.get=function(){return $a},sm.Translater.get=function(){return go},Object.defineProperties(po,sm);var $a=function(){this._commonBitsX=new Tn,this._commonBitsY=new Tn};$a.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},$a.prototype.getCommonCoordinate=function(){return new F(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},$a.prototype.interfaces_=function(){return[Vi]},$a.prototype.getClass=function(){return $a};var go=function(){this.trans=null;var t=arguments[0];this.trans=t};go.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,i=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,i)},go.prototype.isDone=function(){return!1},go.prototype.isGeometryChanged=function(){return!0},go.prototype.interfaces_=function(){return[Wr]},go.prototype.getClass=function(){return go};var tn=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};tn.prototype.selfSnap=function(t){var e=new Le(t),n=e.snapTo(t,this._snapTolerance);return n},tn.prototype.removeCommonBits=function(t){this._cbr=new po,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e},tn.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},tn.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=Rt.overlayOp(e[0],e[1],t);return this.prepareResult(n)},tn.prototype.checkValid=function(t){t.isValid()||sn.out.println("Snapped geometry is invalid")},tn.prototype.computeSnapTolerance=function(){this._snapTolerance=Le.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},tn.prototype.snap=function(t){var e=this.removeCommonBits(t),n=Le.snap(e[0],e[1],this._snapTolerance);return n},tn.prototype.interfaces_=function(){return[]},tn.prototype.getClass=function(){return tn},tn.overlayOp=function(t,e,n){var i=new tn(t,e);return i.getResultGeometry(n)},tn.union=function(t,e){return tn.overlayOp(t,e,Rt.UNION)},tn.intersection=function(t,e){return tn.overlayOp(t,e,Rt.INTERSECTION)},tn.symDifference=function(t,e){return tn.overlayOp(t,e,Rt.SYMDIFFERENCE)},tn.difference=function(t,e){return tn.overlayOp(t,e,Rt.DIFFERENCE)};var Nn=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};Nn.prototype.getResultGeometry=function(t){var e=null,n=!1,i=null;try{e=Rt.overlayOp(this._geom[0],this._geom[1],t);var s=!0;s&&(n=!0)}catch(o){if(o instanceof ws)i=o;else throw o}finally{}if(!n)try{e=tn.overlayOp(this._geom[0],this._geom[1],t)}catch(o){throw o instanceof ws?i:o}finally{}return e},Nn.prototype.interfaces_=function(){return[]},Nn.prototype.getClass=function(){return Nn},Nn.overlayOp=function(t,e,n){var i=new Nn(t,e);return i.getResultGeometry(n)},Nn.union=function(t,e){return Nn.overlayOp(t,e,Rt.UNION)},Nn.intersection=function(t,e){return Nn.overlayOp(t,e,Rt.INTERSECTION)},Nn.symDifference=function(t,e){return Nn.overlayOp(t,e,Rt.SYMDIFFERENCE)},Nn.difference=function(t,e){return Nn.overlayOp(t,e,Rt.DIFFERENCE)};var _c=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};_c.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},_c.prototype.interfaces_=function(){return[]},_c.prototype.getClass=function(){return _c};var Kn=function r(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var t=arguments[0],e=arguments[1];this._eventType=r.DELETE,this._xValue=t,this._insertEvent=e}else if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];this._eventType=r.INSERT,this._label=n,this._xValue=i,this._obj=s}},om={INSERT:{configurable:!0},DELETE:{configurable:!0}};Kn.prototype.isDelete=function(){return this._eventType===Kn.DELETE},Kn.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},Kn.prototype.getObject=function(){return this._obj},Kn.prototype.compareTo=function(t){var e=t;return this._xValue<e._xValue?-1:this._xValue>e._xValue?1:this._eventType<e._eventType?-1:this._eventType>e._eventType?1:0},Kn.prototype.getInsertEvent=function(){return this._insertEvent},Kn.prototype.isInsert=function(){return this._eventType===Kn.INSERT},Kn.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label},Kn.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Kn.prototype.interfaces_=function(){return[Pr]},Kn.prototype.getClass=function(){return Kn},om.INSERT.get=function(){return 1},om.DELETE.get=function(){return 2},Object.defineProperties(Kn,om);var lf=function(){};lf.prototype.interfaces_=function(){return[]},lf.prototype.getClass=function(){return lf};var cn=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};cn.prototype.isTrivialIntersection=function(t,e,n,i){if(t===n&&this._li.getIntersectionNum()===1){if(cn.isAdjacentSegments(e,i))return!0;if(t.isClosed()){var s=t.getNumPoints()-1;if(e===0&&i===s||i===0&&e===s)return!0}}return!1},cn.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},cn.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},cn.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},cn.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next(),s=i.getCoordinate();if(t.isIntersection(s))return!0}return!1},cn.prototype.hasProperIntersection=function(){return this._hasProper},cn.prototype.hasIntersection=function(){return this._hasIntersection},cn.prototype.isDone=function(){return this._isDone},cn.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))},cn.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},cn.prototype.addIntersections=function(t,e,n,i){if(t===n&&e===i)return null;this.numTests++;var s=t.getCoordinates()[e],o=t.getCoordinates()[e+1],a=n.getCoordinates()[i],u=n.getCoordinates()[i+1];this._li.computeIntersection(s,o,a,u),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,i)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},cn.prototype.interfaces_=function(){return[]},cn.prototype.getClass=function(){return cn},cn.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var zN=function(r){function t(){r.call(this),this.events=new tt,this.nOverlaps=null}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.prepareEvents=function(){var n=this;$r.sort(this.events);for(var i=0;i<this.events.size();i++){var s=n.events.get(i);s.isDelete()&&s.getInsertEvent().setDeleteEventIndex(i)}},t.prototype.computeIntersections=function(){var n=this;if(arguments.length===1){var i=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var s=0;s<this.events.size();s++){var o=n.events.get(s);if(o.isInsert()&&n.processOverlaps(s,o.getDeleteEventIndex(),o,i),i.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof cn&&Pt(arguments[0],Ur)&&Pt(arguments[1],Ur)){var a=arguments[0],u=arguments[1],l=arguments[2];this.addEdges(a,a),this.addEdges(u,u),this.computeIntersections(l)}else if(typeof arguments[2]=="boolean"&&Pt(arguments[0],Ur)&&arguments[1]instanceof cn){var h=arguments[0],c=arguments[1],d=arguments[2];d?this.addEdges(h,null):this.addEdges(h),this.computeIntersections(c)}}},t.prototype.addEdge=function(n,i){for(var s=this,o=n.getMonotoneChainEdge(),a=o.getStartIndexes(),u=0;u<a.length-1;u++){var l=new _c(o,u),h=new Kn(i,o.getMinX(u),l);s.events.add(h),s.events.add(new Kn(o.getMaxX(u),h))}},t.prototype.processOverlaps=function(n,i,s,o){for(var a=this,u=s.getObject(),l=n;l<i;l++){var h=a.events.get(l);if(h.isInsert()){var c=h.getObject();s.isSameLabel(h)||(u.computeIntersections(c,o),a.nOverlaps++)}}},t.prototype.addEdges=function(){var n=this;if(arguments.length===1)for(var i=arguments[0],s=i.iterator();s.hasNext();){var o=s.next();n.addEdge(o,o)}else if(arguments.length===2)for(var a=arguments[0],u=arguments[1],l=a.iterator();l.hasNext();){var h=l.next();n.addEdge(h,u)}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(lf),Ji=function(){this._min=Tt.POSITIVE_INFINITY,this._max=Tt.NEGATIVE_INFINITY},rw={NodeComparator:{configurable:!0}};Ji.prototype.getMin=function(){return this._min},Ji.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},Ji.prototype.getMax=function(){return this._max},Ji.prototype.toString=function(){return zr.toLineString(new F(this._min,0),new F(this._max,0))},Ji.prototype.interfaces_=function(){return[]},Ji.prototype.getClass=function(){return Ji},rw.NodeComparator.get=function(){return yc},Object.defineProperties(Ji,rw);var yc=function(){};yc.prototype.compare=function(t,e){var n=t,i=e,s=(n._min+n._max)/2,o=(i._min+i._max)/2;return s<o?-1:s>o?1:0},yc.prototype.interfaces_=function(){return[Xu]},yc.prototype.getClass=function(){return yc};var UN=function(r){function t(){r.call(this),this._item=null;var e=arguments[0],n=arguments[1],i=arguments[2];this._min=e,this._max=n,this._item=i}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.query=function(n,i,s){if(!this.intersects(n,i))return null;s.visitItem(this._item)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ji),qN=function(r){function t(){r.call(this),this._node1=null,this._node2=null;var e=arguments[0],n=arguments[1];this._node1=e,this._node2=n,this.buildExtent(this._node1,this._node2)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.buildExtent=function(n,i){this._min=Math.min(n._min,i._min),this._max=Math.max(n._max,i._max)},t.prototype.query=function(n,i,s){if(!this.intersects(n,i))return null;this._node1!==null&&this._node1.query(n,i,s),this._node2!==null&&this._node2.query(n,i,s)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ji),Zi=function(){this._leaves=new tt,this._root=null,this._level=0};Zi.prototype.buildTree=function(){var t=this;$r.sort(this._leaves,new Ji.NodeComparator);for(var e=this._leaves,n=null,i=new tt;;){if(t.buildLevel(e,i),i.size()===1)return i.get(0);n=e,e=i,i=n}},Zi.prototype.insert=function(t,e,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new UN(t,e,n))},Zi.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)},Zi.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},Zi.prototype.printNode=function(t){sn.out.println(zr.toLineString(new F(t._min,this._level),new F(t._max,this._level)))},Zi.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},Zi.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n<t.size();n+=2){var i=t.get(n),s=n+1<t.size()?t.get(n):null;if(s===null)e.add(i);else{var o=new qN(t.get(n),t.get(n+1));e.add(o)}}},Zi.prototype.interfaces_=function(){return[]},Zi.prototype.getClass=function(){return Zi};var dl=function(){this._items=new tt};dl.prototype.visitItem=function(t){this._items.add(t)},dl.prototype.getItems=function(){return this._items},dl.prototype.interfaces_=function(){return[oo]},dl.prototype.getClass=function(){return dl};var fl=function(){this._index=null;var t=arguments[0];if(!Pt(t,so))throw new Ce("Argument must be Polygonal");this._index=new Qo(t)},am={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};fl.prototype.locate=function(t){var e=new li(t),n=new pl(e);return this._index.query(t.y,t.y,n),e.getLocation()},fl.prototype.interfaces_=function(){return[ll]},fl.prototype.getClass=function(){return fl},am.SegmentVisitor.get=function(){return pl},am.IntervalIndexedGeometry.get=function(){return Qo},Object.defineProperties(fl,am);var pl=function(){this._counter=null;var t=arguments[0];this._counter=t};pl.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},pl.prototype.interfaces_=function(){return[oo]},pl.prototype.getClass=function(){return pl};var Qo=function(){this._index=new Zi;var t=arguments[0];this.init(t)};Qo.prototype.init=function(t){for(var e=this,n=un.getLines(t),i=n.iterator();i.hasNext();){var s=i.next(),o=s.getCoordinates();e.addLine(o)}},Qo.prototype.addLine=function(t){for(var e=this,n=1;n<t.length;n++){var i=new mt(t[n-1],t[n]),s=Math.min(i.p0.y,i.p1.y),o=Math.max(i.p0.y,i.p1.y);e._index.insert(s,o,i)}},Qo.prototype.query=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new dl;return this._index.query(t,e,n),n.getItems()}else if(arguments.length===3){var i=arguments[0],s=arguments[1],o=arguments[2];this._index.query(i,s,o)}},Qo.prototype.interfaces_=function(){return[]},Qo.prototype.getClass=function(){return Qo};var wc=function(r){function t(){if(r.call(this),this._parentGeom=null,this._lineEdgeMap=new G1,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Yr,arguments.length===2){var e=arguments[0],n=arguments[1],i=Ir.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=n,this._boundaryNodeRule=i,n!==null&&this.add(n)}else if(arguments.length===3){var s=arguments[0],o=arguments[1],a=arguments[2];this._argIndex=s,this._parentGeom=o,this._boundaryNodeRule=a,o!==null&&this.add(o)}}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.insertBoundaryPoint=function(n,i){var s=this._nodes.addNode(i),o=s.getLabel(),a=1,u=V.NONE;u=o.getLocation(n,Z.ON),u===V.BOUNDARY&&a++;var l=t.determineBoundary(this._boundaryNodeRule,a);o.setLocation(n,l)},t.prototype.computeSelfNodes=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.computeSelfNodes(n,i,!1)}else if(arguments.length===3){var s=arguments[0],o=arguments[1],a=arguments[2],u=new cn(s,!0,!1);u.setIsDoneIfProperInt(a);var l=this.createEdgeSetIntersector(),h=this._parentGeom instanceof Bi||this._parentGeom instanceof qe||this._parentGeom instanceof zi,c=o||!h;return l.computeIntersections(this._edges,u,c),this.addSelfIntersectionNodes(this._argIndex),u}},t.prototype.computeSplitEdges=function(n){for(var i=this._edges.iterator();i.hasNext();){var s=i.next();s.eiList.addSplitEdges(n)}},t.prototype.computeEdgeIntersections=function(n,i,s){var o=new cn(i,s,!0);o.setBoundaryNodes(this.getBoundaryNodes(),n.getBoundaryNodes());var a=this.createEdgeSetIntersector();return a.computeIntersections(this._edges,n._edges,o),o},t.prototype.getGeometry=function(){return this._parentGeom},t.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},t.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},t.prototype.addPoint=function(){if(arguments[0]instanceof Xn){var n=arguments[0],i=n.getCoordinate();this.insertPoint(this._argIndex,i,V.INTERIOR)}else if(arguments[0]instanceof F){var s=arguments[0];this.insertPoint(this._argIndex,s,V.INTERIOR)}},t.prototype.addPolygon=function(n){var i=this;this.addPolygonRing(n.getExteriorRing(),V.EXTERIOR,V.INTERIOR);for(var s=0;s<n.getNumInteriorRing();s++){var o=n.getInteriorRingN(s);i.addPolygonRing(o,V.INTERIOR,V.EXTERIOR)}},t.prototype.addEdge=function(n){this.insertEdge(n);var i=n.getCoordinates();this.insertPoint(this._argIndex,i[0],V.BOUNDARY),this.insertPoint(this._argIndex,i[i.length-1],V.BOUNDARY)},t.prototype.addLineString=function(n){var i=zt.removeRepeatedPoints(n.getCoordinates());if(i.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=i[0],null;var s=new uf(i,new oe(this._argIndex,V.INTERIOR));this._lineEdgeMap.put(n,s),this.insertEdge(s),Ft.isTrue(i.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,i[0]),this.insertBoundaryPoint(this._argIndex,i[i.length-1])},t.prototype.getInvalidPoint=function(){return this._invalidPoint},t.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),i=new Array(n.size()).fill(null),s=0,o=n.iterator();o.hasNext();){var a=o.next();i[s++]=a.getCoordinate().copy()}return i},t.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},t.prototype.addSelfIntersectionNode=function(n,i,s){if(this.isBoundaryNode(n,i))return null;s===V.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,i):this.insertPoint(n,i,s)},t.prototype.addPolygonRing=function(n,i,s){if(n.isEmpty())return null;var o=zt.removeRepeatedPoints(n.getCoordinates());if(o.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=o[0],null;var a=i,u=s;rt.isCCW(o)&&(a=s,u=i);var l=new uf(o,new oe(this._argIndex,V.BOUNDARY,a,u));this._lineEdgeMap.put(n,l),this.insertEdge(l),this.insertPoint(this._argIndex,o[0],V.BOUNDARY)},t.prototype.insertPoint=function(n,i,s){var o=this._nodes.addNode(i),a=o.getLabel();a===null?o._label=new oe(n,s):a.setLocation(n,s)},t.prototype.createEdgeSetIntersector=function(){return new zN},t.prototype.addSelfIntersectionNodes=function(n){for(var i=this,s=this._edges.iterator();s.hasNext();)for(var o=s.next(),a=o.getLabel().getLocation(n),u=o.eiList.iterator();u.hasNext();){var l=u.next();i.addSelfIntersectionNode(n,l.coord,a)}},t.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof zi&&(this._useBoundaryDeterminationRule=!1),n instanceof qe)this.addPolygon(n);else if(n instanceof Me)this.addLineString(n);else if(n instanceof Xn)this.addPoint(n);else if(n instanceof sl)this.addCollection(n);else if(n instanceof Ho)this.addCollection(n);else if(n instanceof zi)this.addCollection(n);else if(n instanceof Cn)this.addCollection(n);else throw new Error(n.getClass().getName())}else return r.prototype.add.apply(this,arguments)},t.prototype.addCollection=function(n){for(var i=this,s=0;s<n.getNumGeometries();s++){var o=n.getGeometryN(s);i.add(o)}},t.prototype.locate=function(n){return Pt(this._parentGeom,so)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new fl(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},t.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return r.prototype.findEdge.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.determineBoundary=function(n,i){return n.isInBoundary(i)?V.BOUNDARY:V.INTERIOR},t}(xe),gl=function(){if(this._li=new Uo,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new wc(0,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],i=Ir.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new wc(0,e,i),this._arg[1]=new wc(1,n,i)}else if(arguments.length===3){var s=arguments[0],o=arguments[1],a=arguments[2];s.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(s.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new wc(0,s,a),this._arg[1]=new wc(1,o,a)}};gl.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},gl.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},gl.prototype.interfaces_=function(){return[]},gl.prototype.getClass=function(){return gl};var ta=function(){};ta.prototype.interfaces_=function(){return[]},ta.prototype.getClass=function(){return ta},ta.map=function(){if(arguments[0]instanceof bt&&Pt(arguments[1],ta.MapOp)){for(var t=arguments[0],e=arguments[1],n=new tt,i=0;i<t.getNumGeometries();i++){var s=e.map(t.getGeometryN(i));s!==null&&n.add(s)}return t.getFactory().buildGeometry(n)}else if(Pt(arguments[0],Ue)&&Pt(arguments[1],ta.MapOp)){for(var o=arguments[0],a=arguments[1],u=new tt,l=o.iterator();l.hasNext();){var h=l.next(),c=a.map(h);c!==null&&u.add(c)}return u}},ta.MapOp=function(){};var Rt=function(r){function t(){var e=arguments[0],n=arguments[1];r.call(this,e,n),this._ptLocator=new Yr,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Xr,this._resultPolyList=new tt,this._resultLineList=new tt,this._resultPointList=new tt,this._graph=new xe(new X1),this._geomFact=e.getFactory()}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.insertUniqueEdge=function(n){var i=this._edgeList.findEqualEdge(n);if(i!==null){var s=i.getLabel(),o=n.getLabel();i.isPointwiseEqual(n)||(o=new oe(n.getLabel()),o.flip());var a=i.getDepth();a.isNull()&&a.add(s),a.add(o),s.merge(o)}else this._edgeList.add(n)},t.prototype.getGraph=function(){return this._graph},t.prototype.cancelDuplicateResultEdges=function(){for(var n=this._graph.getEdgeEnds().iterator();n.hasNext();){var i=n.next(),s=i.getSym();i.isInResult()&&s.isInResult()&&(i.setInResult(!1),s.setInResult(!1))}},t.prototype.isCoveredByLA=function(n){return!!(this.isCovered(n,this._resultLineList)||this.isCovered(n,this._resultPolyList))},t.prototype.computeGeometry=function(n,i,s,o){var a=new tt;return a.addAll(n),a.addAll(i),a.addAll(s),a.isEmpty()?t.createEmptyResult(o,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(a)},t.prototype.mergeSymLabels=function(){for(var n=this._graph.getNodes().iterator();n.hasNext();){var i=n.next();i.getEdges().mergeSymLabels()}},t.prototype.isCovered=function(n,i){for(var s=this,o=i.iterator();o.hasNext();){var a=o.next(),u=s._ptLocator.locate(n,a);if(u!==V.EXTERIOR)return!0}return!1},t.prototype.replaceCollapsedEdges=function(){for(var n=new tt,i=this._edgeList.iterator();i.hasNext();){var s=i.next();s.isCollapsed()&&(i.remove(),n.add(s.getCollapsedEdge()))}this._edgeList.addAll(n)},t.prototype.updateNodeLabelling=function(){for(var n=this._graph.getNodes().iterator();n.hasNext();){var i=n.next(),s=i.getEdges().getLabel();i.getLabel().merge(s)}},t.prototype.getResultGeometry=function(n){return this.computeOverlay(n),this._resultGeom},t.prototype.insertUniqueEdges=function(n){for(var i=this,s=n.iterator();s.hasNext();){var o=s.next();i.insertUniqueEdge(o)}},t.prototype.computeOverlay=function(n){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var i=new tt;this._arg[0].computeSplitEdges(i),this._arg[1].computeSplitEdges(i),this.insertUniqueEdges(i),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),Ko.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(n),this.cancelDuplicateResultEdges();var s=new Yn(this._geomFact);s.add(this._graph),this._resultPolyList=s.getPolygons();var o=new Si(this,this._geomFact,this._ptLocator);this._resultLineList=o.build(n);var a=new Ha(this,this._geomFact,this._ptLocator);this._resultPointList=a.build(n),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,n)},t.prototype.labelIncompleteNode=function(n,i){var s=this._ptLocator.locate(n.getCoordinate(),this._arg[i].getGeometry());n.getLabel().setLocation(i,s)},t.prototype.copyPoints=function(n){for(var i=this,s=this._arg[n].getNodeIterator();s.hasNext();){var o=s.next(),a=i._graph.addNode(o.getCoordinate());a.setLabel(n,o.getLabel().getLocation(n))}},t.prototype.findResultAreaEdges=function(n){for(var i=this._graph.getEdgeEnds().iterator();i.hasNext();){var s=i.next(),o=s.getLabel();o.isArea()&&!s.isInteriorAreaEdge()&&t.isResultOfOp(o.getLocation(0,Z.RIGHT),o.getLocation(1,Z.RIGHT),n)&&s.setInResult(!0)}},t.prototype.computeLabelsFromDepths=function(){for(var n=this._edgeList.iterator();n.hasNext();){var i=n.next(),s=i.getLabel(),o=i.getDepth();if(!o.isNull()){o.normalize();for(var a=0;a<2;a++)!s.isNull(a)&&s.isArea()&&!o.isNull(a)&&(o.getDelta(a)===0?s.toLine(a):(Ft.isTrue(!o.isNull(a,Z.LEFT),"depth of LEFT side has not been initialized"),s.setLocation(a,Z.LEFT,o.getLocation(a,Z.LEFT)),Ft.isTrue(!o.isNull(a,Z.RIGHT),"depth of RIGHT side has not been initialized"),s.setLocation(a,Z.RIGHT,o.getLocation(a,Z.RIGHT))))}}},t.prototype.computeLabelling=function(){for(var n=this,i=this._graph.getNodes().iterator();i.hasNext();){var s=i.next();s.getEdges().computeLabelling(n._arg)}this.mergeSymLabels(),this.updateNodeLabelling()},t.prototype.labelIncompleteNodes=function(){for(var n=this,i=this._graph.getNodes().iterator();i.hasNext();){var s=i.next(),o=s.getLabel();s.isIsolated()&&(o.isNull(0)?n.labelIncompleteNode(s,0):n.labelIncompleteNode(s,1)),s.getEdges().updateLabelling(o)}},t.prototype.isCoveredByA=function(n){return!!this.isCovered(n,this._resultPolyList)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(gl);Rt.overlayOp=function(r,t,e){var n=new Rt(r,t),i=n.getResultGeometry(e);return i},Rt.intersection=function(r,t){if(r.isEmpty()||t.isEmpty())return Rt.createEmptyResult(Rt.INTERSECTION,r,t,r.getFactory());if(r.isGeometryCollection()){var e=t;return Wa.map(r,{interfaces_:function(){return[ta.MapOp]},map:function(n){return n.intersection(e)}})}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(t),Nn.overlayOp(r,t,Rt.INTERSECTION)},Rt.symDifference=function(r,t){if(r.isEmpty()||t.isEmpty()){if(r.isEmpty()&&t.isEmpty())return Rt.createEmptyResult(Rt.SYMDIFFERENCE,r,t,r.getFactory());if(r.isEmpty())return t.copy();if(t.isEmpty())return r.copy()}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(t),Nn.overlayOp(r,t,Rt.SYMDIFFERENCE)},Rt.resultDimension=function(r,t,e){var n=t.getDimension(),i=e.getDimension(),s=-1;switch(r){case Rt.INTERSECTION:s=Math.min(n,i);break;case Rt.UNION:s=Math.max(n,i);break;case Rt.DIFFERENCE:s=n;break;case Rt.SYMDIFFERENCE:s=Math.max(n,i);break}return s},Rt.createEmptyResult=function(r,t,e,n){var i=null;switch(Rt.resultDimension(r,t,e)){case-1:i=n.createGeometryCollection(new Array(0).fill(null));break;case 0:i=n.createPoint();break;case 1:i=n.createLineString();break;case 2:i=n.createPolygon();break}return i},Rt.difference=function(r,t){return r.isEmpty()?Rt.createEmptyResult(Rt.DIFFERENCE,r,t,r.getFactory()):t.isEmpty()?r.copy():(r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(t),Nn.overlayOp(r,t,Rt.DIFFERENCE))},Rt.isResultOfOp=function(){if(arguments.length===2){var r=arguments[0],t=arguments[1],e=r.getLocation(0),n=r.getLocation(1);return Rt.isResultOfOp(e,n,t)}else if(arguments.length===3){var i=arguments[0],s=arguments[1],o=arguments[2];switch(i===V.BOUNDARY&&(i=V.INTERIOR),s===V.BOUNDARY&&(s=V.INTERIOR),o){case Rt.INTERSECTION:return i===V.INTERIOR&&s===V.INTERIOR;case Rt.UNION:return i===V.INTERIOR||s===V.INTERIOR;case Rt.DIFFERENCE:return i===V.INTERIOR&&s!==V.INTERIOR;case Rt.SYMDIFFERENCE:return i===V.INTERIOR&&s!==V.INTERIOR||i!==V.INTERIOR&&s===V.INTERIOR}return!1}},Rt.INTERSECTION=1,Rt.UNION=2,Rt.DIFFERENCE=3,Rt.SYMDIFFERENCE=4;var mo=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new Yr,this._seg=new mt;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};mo.prototype.isWithinToleranceOfBoundary=function(t){for(var e=this,n=0;n<this._linework.getNumGeometries();n++)for(var i=e._linework.getGeometryN(n),s=i.getCoordinateSequence(),o=0;o<s.size()-1;o++){s.getCoordinate(o,e._seg.p0),s.getCoordinate(o+1,e._seg.p1);var a=e._seg.distance(t);if(a<=e._boundaryDistanceTolerance)return!0}return!1},mo.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?V.BOUNDARY:this._ptLocator.locate(t,this._g)},mo.prototype.extractLinework=function(t){var e=new ml;t.apply(e);var n=e.getLinework(),i=Ut.toLineStringArray(n);return t.getFactory().createMultiLineString(i)},mo.prototype.interfaces_=function(){return[]},mo.prototype.getClass=function(){return mo};var ml=function(){this._linework=null,this._linework=new tt};ml.prototype.getLinework=function(){return this._linework},ml.prototype.filter=function(t){var e=this;if(t instanceof qe){var n=t;this._linework.add(n.getExteriorRing());for(var i=0;i<n.getNumInteriorRing();i++)e._linework.add(n.getInteriorRingN(i))}},ml.prototype.interfaces_=function(){return[ci]},ml.prototype.getClass=function(){return ml};var ea=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};ea.prototype.extractPoints=function(t,e,n){for(var i=this,s=t.getCoordinates(),o=0;o<s.length-1;o++)i.computeOffsetPoints(s[o],s[o+1],e,n)},ea.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},ea.prototype.getPoints=function(t){for(var e=this,n=new tt,i=un.getLines(this._g),s=i.iterator();s.hasNext();){var o=s.next();e.extractPoints(o,t,n)}return n},ea.prototype.computeOffsetPoints=function(t,e,n,i){var s=e.x-t.x,o=e.y-t.y,a=Math.sqrt(s*s+o*o),u=n*s/a,l=n*o/a,h=(e.x+t.x)/2,c=(e.y+t.y)/2;if(this._doLeft){var d=new F(h-l,c+u);i.add(d)}if(this._doRight){var p=new F(h+l,c-u);i.add(p)}},ea.prototype.interfaces_=function(){return[]},ea.prototype.getClass=function(){return ea};var gr=function r(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=r.TOLERANCE,this._testCoords=new tt;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundaryDistanceTolerance=r.computeBoundaryDistanceTolerance(t,e),this._geom=[t,e,n],this._locFinder=[new mo(this._geom[0],this._boundaryDistanceTolerance),new mo(this._geom[1],this._boundaryDistanceTolerance),new mo(this._geom[2],this._boundaryDistanceTolerance)]},iw={TOLERANCE:{configurable:!0}};gr.prototype.reportResult=function(t,e,n){sn.out.println("Overlay result invalid - A:"+V.toLocationSymbol(e[0])+" B:"+V.toLocationSymbol(e[1])+" expected:"+(n?"i":"e")+" actual:"+V.toLocationSymbol(e[2]))},gr.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var e=this.checkValid(t);return e},gr.prototype.checkValid=function(){var t=this;if(arguments.length===1){for(var e=arguments[0],n=0;n<this._testCoords.size();n++){var i=t._testCoords.get(n);if(!t.checkValid(e,i))return t._invalidLocation=i,!1}return!0}else if(arguments.length===2){var s=arguments[0],o=arguments[1];return this._location[0]=this._locFinder[0].getLocation(o),this._location[1]=this._locFinder[1].getLocation(o),this._location[2]=this._locFinder[2].getLocation(o),gr.hasLocation(this._location,V.BOUNDARY)?!0:this.isValidResult(s,this._location)}},gr.prototype.addTestPts=function(t){var e=new ea(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},gr.prototype.isValidResult=function(t,e){var n=Rt.isResultOfOp(e[0],e[1],t),i=e[2]===V.INTERIOR,s=!(n^i);return s||this.reportResult(t,e,n),s},gr.prototype.getInvalidLocation=function(){return this._invalidLocation},gr.prototype.interfaces_=function(){return[]},gr.prototype.getClass=function(){return gr},gr.hasLocation=function(t,e){for(var n=0;n<3;n++)if(t[n]===e)return!0;return!1},gr.computeBoundaryDistanceTolerance=function(t,e){return Math.min(Le.computeSizeBasedSnapTolerance(t),Le.computeSizeBasedSnapTolerance(e))},gr.isValid=function(t,e,n,i){var s=new gr(t,e,i);return s.isValid(n)},iw.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(gr,iw);var mr=function r(t){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=r.extractFactory(t),this._inputGeoms=t};mr.prototype.extractElements=function(t,e){var n=this;if(t===null)return null;for(var i=0;i<t.getNumGeometries();i++){var s=t.getGeometryN(i);n._skipEmpty&&s.isEmpty()||e.add(s)}},mr.prototype.combine=function(){for(var t=this,e=new tt,n=this._inputGeoms.iterator();n.hasNext();){var i=n.next();t.extractElements(i,e)}return e.size()===0?this._geomFactory!==null?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(e)},mr.prototype.interfaces_=function(){return[]},mr.prototype.getClass=function(){return mr},mr.combine=function(){if(arguments.length===1){var t=arguments[0],e=new mr(t);return e.combine()}else if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new mr(mr.createList(n,i));return s.combine()}else if(arguments.length===3){var o=arguments[0],a=arguments[1],u=arguments[2],l=new mr(mr.createList(o,a,u));return l.combine()}},mr.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},mr.createList=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new tt;return n.add(t),n.add(e),n}else if(arguments.length===3){var i=arguments[0],s=arguments[1],o=arguments[2],a=new tt;return a.add(i),a.add(s),a.add(o),a}};var Ve=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,this._inputPolys===null&&(this._inputPolys=new tt)},sw={STRTREE_NODE_CAPACITY:{configurable:!0}};Ve.prototype.reduceToGeometries=function(t){for(var e=this,n=new tt,i=t.iterator();i.hasNext();){var s=i.next(),o=null;Pt(s,Ur)?o=e.unionTree(s):s instanceof bt&&(o=s),n.add(o)}return n},Ve.prototype.extractByEnvelope=function(t,e,n){for(var i=new tt,s=0;s<e.getNumGeometries();s++){var o=e.getGeometryN(s);o.getEnvelopeInternal().intersects(t)?i.add(o):n.add(o)}return this._geomFactory.buildGeometry(i)},Ve.prototype.unionOptimized=function(t,e){var n=t.getEnvelopeInternal(),i=e.getEnvelopeInternal();if(!n.intersects(i)){var s=mr.combine(t,e);return s}if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var o=n.intersection(i);return this.unionUsingEnvelopeIntersection(t,e,o)},Ve.prototype.union=function(){if(this._inputPolys===null)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var t=new z1(Ve.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var n=e.next();t.insert(n.getEnvelopeInternal(),n)}this._inputPolys=null;var i=t.itemsTree(),s=this.unionTree(i);return s},Ve.prototype.binaryUnion=function(){if(arguments.length===1){var t=arguments[0];return this.binaryUnion(t,0,t.size())}else if(arguments.length===3){var e=arguments[0],n=arguments[1],i=arguments[2];if(i-n<=1){var s=Ve.getGeometry(e,n);return this.unionSafe(s,null)}else{if(i-n===2)return this.unionSafe(Ve.getGeometry(e,n),Ve.getGeometry(e,n+1));var o=Math.trunc((i+n)/2),a=this.binaryUnion(e,n,o),u=this.binaryUnion(e,o,i);return this.unionSafe(a,u)}}},Ve.prototype.repeatedUnion=function(t){for(var e=null,n=t.iterator();n.hasNext();){var i=n.next();e===null?e=i.copy():e=e.union(i)}return e},Ve.prototype.unionSafe=function(t,e){return t===null&&e===null?null:t===null?e.copy():e===null?t.copy():this.unionOptimized(t,e)},Ve.prototype.unionActual=function(t,e){return Ve.restrictToPolygons(t.union(e))},Ve.prototype.unionTree=function(t){var e=this.reduceToGeometries(t),n=this.binaryUnion(e);return n},Ve.prototype.unionUsingEnvelopeIntersection=function(t,e,n){var i=new tt,s=this.extractByEnvelope(n,t,i),o=this.extractByEnvelope(n,e,i),a=this.unionActual(s,o);i.add(a);var u=mr.combine(i);return u},Ve.prototype.bufferUnion=function(){if(arguments.length===1){var t=arguments[0],e=t.get(0).getFactory(),n=e.buildGeometry(t),i=n.buffer(0);return i}else if(arguments.length===2){var s=arguments[0],o=arguments[1],a=s.getFactory(),u=a.createGeometryCollection([s,o]),l=u.buffer(0);return l}},Ve.prototype.interfaces_=function(){return[]},Ve.prototype.getClass=function(){return Ve},Ve.restrictToPolygons=function(t){if(Pt(t,so))return t;var e=Ns.getPolygons(t);return e.size()===1?e.get(0):t.getFactory().createMultiPolygon(Ut.toPolygonArray(e))},Ve.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},Ve.union=function(t){var e=new Ve(t);return e.union()},sw.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Ve,sw);var hf=function(){};hf.prototype.interfaces_=function(){return[]},hf.prototype.getClass=function(){return hf},hf.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return Rt.createEmptyResult(Rt.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Nn.overlayOp(t,e,Rt.UNION)};function na(){return new cf}function cf(){this.reset()}cf.prototype={constructor:cf,reset:function(){this.s=this.t=0},add:function(r){ow(df,r,this.t),ow(this,df.s,this.s),this.s?this.t+=df.t:this.s=df.t},valueOf:function(){return this.s}};var df=new cf;function ow(r,t,e){var n=r.s=t+e,i=n-t,s=n-i;r.t=t-s+(e-i)}var Be=1e-6,le=Math.PI,Os=le/2,aw=le/4,Ds=le*2,ra=180/le,Ci=le/180,On=Math.abs,WN=Math.atan,vl=Math.atan2,He=Math.cos,$e=Math.sin,_l=Math.sqrt;function uw(r){return r>1?0:r<-1?le:Math.acos(r)}function Xa(r){return r>1?Os:r<-1?-Os:Math.asin(r)}function Ec(){}function ff(r,t){r&&hw.hasOwnProperty(r.type)&&hw[r.type](r,t)}var lw={Feature:function(r,t){ff(r.geometry,t)},FeatureCollection:function(r,t){for(var e=r.features,n=-1,i=e.length;++n<i;)ff(e[n].geometry,t)}},hw={Sphere:function(r,t){t.sphere()},Point:function(r,t){r=r.coordinates,t.point(r[0],r[1],r[2])},MultiPoint:function(r,t){for(var e=r.coordinates,n=-1,i=e.length;++n<i;)r=e[n],t.point(r[0],r[1],r[2])},LineString:function(r,t){um(r.coordinates,t,0)},MultiLineString:function(r,t){for(var e=r.coordinates,n=-1,i=e.length;++n<i;)um(e[n],t,0)},Polygon:function(r,t){cw(r.coordinates,t)},MultiPolygon:function(r,t){for(var e=r.coordinates,n=-1,i=e.length;++n<i;)cw(e[n],t)},GeometryCollection:function(r,t){for(var e=r.geometries,n=-1,i=e.length;++n<i;)ff(e[n],t)}};function um(r,t,e){var n=-1,i=r.length-e,s;for(t.lineStart();++n<i;)s=r[n],t.point(s[0],s[1],s[2]);t.lineEnd()}function cw(r,t){var e=-1,n=r.length;for(t.polygonStart();++e<n;)um(r[e],t,1);t.polygonEnd()}function HN(r,t){r&&lw.hasOwnProperty(r.type)?lw[r.type](r,t):ff(r,t)}na(),na();function lm(r){return[vl(r[1],r[0]),Xa(r[2])]}function yl(r){var t=r[0],e=r[1],n=He(e);return[n*He(t),n*$e(t),$e(e)]}function pf(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]}function gf(r,t){return[r[1]*t[2]-r[2]*t[1],r[2]*t[0]-r[0]*t[2],r[0]*t[1]-r[1]*t[0]]}function hm(r,t){r[0]+=t[0],r[1]+=t[1],r[2]+=t[2]}function mf(r,t){return[r[0]*t,r[1]*t,r[2]*t]}function cm(r){var t=_l(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=t,r[1]/=t,r[2]/=t}na();function dw(r,t){function e(n,i){return n=r(n,i),t(n[0],n[1])}return r.invert&&t.invert&&(e.invert=function(n,i){return n=t.invert(n,i),n&&r.invert(n[0],n[1])}),e}function dm(r,t){return[r>le?r-Ds:r<-le?r+Ds:r,t]}dm.invert=dm;function $N(r,t,e){return(r%=Ds)?t||e?dw(pw(r),gw(t,e)):pw(r):t||e?gw(t,e):dm}function fw(r){return function(t,e){return t+=r,[t>le?t-Ds:t<-le?t+Ds:t,e]}}function pw(r){var t=fw(r);return t.invert=fw(-r),t}function gw(r,t){var e=He(r),n=$e(r),i=He(t),s=$e(t);function o(a,u){var l=He(u),h=He(a)*l,c=$e(a)*l,d=$e(u),p=d*e+h*n;return[vl(c*i-p*s,h*e-d*n),Xa(p*i+c*s)]}return o.invert=function(a,u){var l=He(u),h=He(a)*l,c=$e(a)*l,d=$e(u),p=d*i-c*s;return[vl(c*i+d*s,h*e+p*n),Xa(p*e-h*n)]},o}function XN(r,t,e,n,i,s){if(e){var o=He(t),a=$e(t),u=n*e;i==null?(i=t+n*Ds,s=t-u/2):(i=mw(o,i),s=mw(o,s),(n>0?i<s:i>s)&&(i+=n*Ds));for(var l,h=i;n>0?h>s:h<s;h-=u)l=lm([o,-a*He(h),-a*$e(h)]),r.point(l[0],l[1])}}function mw(r,t){t=yl(t),t[0]-=r,cm(t);var e=uw(-t[1]);return((-t[2]<0?-e:e)+Ds-Be)%Ds}function vw(){var r=[],t;return{point:function(e,n){t.push([e,n])},lineStart:function(){r.push(t=[])},lineEnd:Ec,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var e=r;return r=[],t=null,e}}}function YN(r,t,e,n,i,s){var o=r[0],a=r[1],u=t[0],l=t[1],h=0,c=1,d=u-o,p=l-a,g;if(g=e-o,!(!d&&g>0)){if(g/=d,d<0){if(g<h)return;g<c&&(c=g)}else if(d>0){if(g>c)return;g>h&&(h=g)}if(g=i-o,!(!d&&g<0)){if(g/=d,d<0){if(g>c)return;g>h&&(h=g)}else if(d>0){if(g<h)return;g<c&&(c=g)}if(g=n-a,!(!p&&g>0)){if(g/=p,p<0){if(g<h)return;g<c&&(c=g)}else if(p>0){if(g>c)return;g>h&&(h=g)}if(g=s-a,!(!p&&g<0)){if(g/=p,p<0){if(g>c)return;g>h&&(h=g)}else if(p>0){if(g<h)return;g<c&&(c=g)}return h>0&&(r[0]=o+h*d,r[1]=a+h*p),c<1&&(t[0]=o+c*d,t[1]=a+c*p),!0}}}}}function vf(r,t){return On(r[0]-t[0])<Be&&On(r[1]-t[1])<Be}function _f(r,t,e,n){this.x=r,this.z=t,this.o=e,this.e=n,this.v=!1,this.n=this.p=null}function _w(r,t,e,n,i){var s=[],o=[],a,u;if(r.forEach(function(g){if(!((y=g.length-1)<=0)){var y,w=g[0],b=g[y],m;if(vf(w,b)){for(i.lineStart(),a=0;a<y;++a)i.point((w=g[a])[0],w[1]);i.lineEnd();return}s.push(m=new _f(w,g,null,!0)),o.push(m.o=new _f(w,null,m,!1)),s.push(m=new _f(b,g,null,!1)),o.push(m.o=new _f(b,null,m,!0))}}),!!s.length){for(o.sort(t),yw(s),yw(o),a=0,u=o.length;a<u;++a)o[a].e=e=!e;for(var l=s[0],h,c;;){for(var d=l,p=!0;d.v;)if((d=d.n)===l)return;h=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(p)for(a=0,u=h.length;a<u;++a)i.point((c=h[a])[0],c[1]);else n(d.x,d.n.x,1,i);d=d.n}else{if(p)for(h=d.p.z,a=h.length-1;a>=0;--a)i.point((c=h[a])[0],c[1]);else n(d.x,d.p.x,-1,i);d=d.p}d=d.o,h=d.z,p=!p}while(!d.v);i.lineEnd()}}}function yw(r){if(t=r.length){for(var t,e=0,n=r[0],i;++e<t;)n.n=i=r[e],i.p=n,n=i;n.n=i=r[0],i.p=n}}function ww(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function JN(r){return r.length===1&&(r=ZN(r)),{left:function(t,e,n,i){for(n==null&&(n=0),i==null&&(i=t.length);n<i;){var s=n+i>>>1;r(t[s],e)<0?n=s+1:i=s}return n},right:function(t,e,n,i){for(n==null&&(n=0),i==null&&(i=t.length);n<i;){var s=n+i>>>1;r(t[s],e)>0?i=s:n=s+1}return n}}}function ZN(r){return function(t,e){return ww(r(t),e)}}JN(ww);function Ew(r){for(var t=r.length,e,n=-1,i=0,s,o;++n<t;)i+=r[n].length;for(s=new Array(i);--t>=0;)for(o=r[t],e=o.length;--e>=0;)s[--i]=o[e];return s}var yf=1e9,wf=-1e9;function KN(r,t,e,n){function i(l,h){return r<=l&&l<=e&&t<=h&&h<=n}function s(l,h,c,d){var p=0,g=0;if(l==null||(p=o(l,c))!==(g=o(h,c))||u(l,h)<0^c>0)do d.point(p===0||p===3?r:e,p>1?n:t);while((p=(p+c+4)%4)!==g);else d.point(h[0],h[1])}function o(l,h){return On(l[0]-r)<Be?h>0?0:3:On(l[0]-e)<Be?h>0?2:1:On(l[1]-t)<Be?h>0?1:0:h>0?3:2}function a(l,h){return u(l.x,h.x)}function u(l,h){var c=o(l,1),d=o(h,1);return c!==d?c-d:c===0?h[1]-l[1]:c===1?l[0]-h[0]:c===2?l[1]-h[1]:h[0]-l[0]}return function(l){var h=l,c=vw(),d,p,g,y,w,b,m,E,_,S,C,P={point:x,lineStart:T,lineEnd:A,polygonStart:O,polygonEnd:I};function x(nt,J){i(nt,J)&&h.point(nt,J)}function M(){for(var nt=0,J=0,st=p.length;J<st;++J)for(var k=p[J],q=1,j=k.length,B=k[0],D,z,Y=B[0],ht=B[1];q<j;++q)D=Y,z=ht,B=k[q],Y=B[0],ht=B[1],z<=n?ht>n&&(Y-D)*(n-z)>(ht-z)*(r-D)&&++nt:ht<=n&&(Y-D)*(n-z)<(ht-z)*(r-D)&&--nt;return nt}function O(){h=c,d=[],p=[],C=!0}function I(){var nt=M(),J=C&&nt,st=(d=Ew(d)).length;(J||st)&&(l.polygonStart(),J&&(l.lineStart(),s(null,null,1,l),l.lineEnd()),st&&_w(d,a,nt,s,l),l.polygonEnd()),h=l,d=p=g=null}function T(){P.point=G,p&&p.push(g=[]),S=!0,_=!1,m=E=NaN}function A(){d&&(G(y,w),b&&_&&c.rejoin(),d.push(c.result())),P.point=x,_&&h.lineEnd()}function G(nt,J){var st=i(nt,J);if(p&&g.push([nt,J]),S)y=nt,w=J,b=st,S=!1,st&&(h.lineStart(),h.point(nt,J));else if(st&&_)h.point(nt,J);else{var k=[m=Math.max(wf,Math.min(yf,m)),E=Math.max(wf,Math.min(yf,E))],q=[nt=Math.max(wf,Math.min(yf,nt)),J=Math.max(wf,Math.min(yf,J))];YN(k,q,r,t,e,n)?(_||(h.lineStart(),h.point(k[0],k[1])),h.point(q[0],q[1]),st||h.lineEnd(),C=!1):st&&(h.lineStart(),h.point(nt,J),C=!1)}m=nt,E=J,_=st}return P}}var fm=na();function QN(r,t){var e=t[0],n=t[1],i=[$e(e),-He(e),0],s=0,o=0;fm.reset();for(var a=0,u=r.length;a<u;++a)if(h=(l=r[a]).length)for(var l,h,c=l[h-1],d=c[0],p=c[1]/2+aw,g=$e(p),y=He(p),w=0;w<h;++w,d=m,g=_,y=S,c=b){var b=l[w],m=b[0],E=b[1]/2+aw,_=$e(E),S=He(E),C=m-d,P=C>=0?1:-1,x=P*C,M=x>le,O=g*_;if(fm.add(vl(O*P*$e(x),y*S+O*He(x))),s+=M?C+P*Ds:C,M^d>=e^m>=e){var I=gf(yl(c),yl(b));cm(I);var T=gf(i,I);cm(T);var A=(M^C>=0?-1:1)*Xa(T[2]);(n>A||n===A&&(I[0]||I[1]))&&(o+=M^C>=0?1:-1)}}return(s<-1e-6||s<Be&&fm<-1e-6)^o&1}na();function Sw(r){return r}na(),na();var wl=1/0,Ef=wl,Sc=-wl,Sf=Sc,Cw={point:tO,lineStart:Ec,lineEnd:Ec,polygonStart:Ec,polygonEnd:Ec,result:function(){var r=[[wl,Ef],[Sc,Sf]];return Sc=Sf=-(Ef=wl=1/0),r}};function tO(r,t){r<wl&&(wl=r),r>Sc&&(Sc=r),t<Ef&&(Ef=t),t>Sf&&(Sf=t)}na();function bw(r,t,e,n){return function(i,s){var o=t(s),a=i.invert(n[0],n[1]),u=vw(),l=t(u),h=!1,c,d,p,g={point:y,lineStart:b,lineEnd:m,polygonStart:function(){g.point=E,g.lineStart=_,g.lineEnd=S,d=[],c=[]},polygonEnd:function(){g.point=y,g.lineStart=b,g.lineEnd=m,d=Ew(d);var C=QN(c,a);d.length?(h||(s.polygonStart(),h=!0),_w(d,nO,C,e,s)):C&&(h||(s.polygonStart(),h=!0),s.lineStart(),e(null,null,1,s),s.lineEnd()),h&&(s.polygonEnd(),h=!1),d=c=null},sphere:function(){s.polygonStart(),s.lineStart(),e(null,null,1,s),s.lineEnd(),s.polygonEnd()}};function y(C,P){var x=i(C,P);r(C=x[0],P=x[1])&&s.point(C,P)}function w(C,P){var x=i(C,P);o.point(x[0],x[1])}function b(){g.point=w,o.lineStart()}function m(){g.point=y,o.lineEnd()}function E(C,P){p.push([C,P]);var x=i(C,P);l.point(x[0],x[1])}function _(){l.lineStart(),p=[]}function S(){E(p[0][0],p[0][1]),l.lineEnd();var C=l.clean(),P=u.result(),x,M=P.length,O,I,T;if(p.pop(),c.push(p),p=null,!!M){if(C&1){if(I=P[0],(O=I.length-1)>0){for(h||(s.polygonStart(),h=!0),s.lineStart(),x=0;x<O;++x)s.point((T=I[x])[0],T[1]);s.lineEnd()}return}M>1&&C&2&&P.push(P.pop().concat(P.shift())),d.push(P.filter(eO))}}return g}}function eO(r){return r.length>1}function nO(r,t){return((r=r.x)[0]<0?r[1]-Os-Be:Os-r[1])-((t=t.x)[0]<0?t[1]-Os-Be:Os-t[1])}const Pw=bw(function(){return!0},rO,sO,[-le,-Os]);function rO(r){var t=NaN,e=NaN,n=NaN,i;return{lineStart:function(){r.lineStart(),i=1},point:function(s,o){var a=s>0?le:-le,u=On(s-t);On(u-le)<Be?(r.point(t,e=(e+o)/2>0?Os:-Os),r.point(n,e),r.lineEnd(),r.lineStart(),r.point(a,e),r.point(s,e),i=0):n!==a&&u>=le&&(On(t-n)<Be&&(t-=n*Be),On(s-a)<Be&&(s-=a*Be),e=iO(t,e,s,o),r.point(n,e),r.lineEnd(),r.lineStart(),r.point(a,e),i=0),r.point(t=s,e=o),n=a},lineEnd:function(){r.lineEnd(),t=e=NaN},clean:function(){return 2-i}}}function iO(r,t,e,n){var i,s,o=$e(r-e);return On(o)>Be?WN(($e(t)*(s=He(n))*$e(e)-$e(n)*(i=He(t))*$e(r))/(i*s*o)):(t+n)/2}function sO(r,t,e,n){var i;if(r==null)i=e*Os,n.point(-le,i),n.point(0,i),n.point(le,i),n.point(le,0),n.point(le,-i),n.point(0,-i),n.point(-le,-i),n.point(-le,0),n.point(-le,i);else if(On(r[0]-t[0])>Be){var s=r[0]<t[0]?le:-le;i=e*s/2,n.point(-s,i),n.point(0,i),n.point(s,i)}else n.point(t[0],t[1])}function oO(r,t){var e=He(r),n=e>0,i=On(e)>Be;function s(h,c,d,p){XN(p,r,t,d,h,c)}function o(h,c){return He(h)*He(c)>e}function a(h){var c,d,p,g,y;return{lineStart:function(){g=p=!1,y=1},point:function(w,b){var m=[w,b],E,_=o(w,b),S=n?_?0:l(w,b):_?l(w+(w<0?le:-le),b):0;if(!c&&(g=p=_)&&h.lineStart(),_!==p&&(E=u(c,m),(!E||vf(c,E)||vf(m,E))&&(m[0]+=Be,m[1]+=Be,_=o(m[0],m[1]))),_!==p)y=0,_?(h.lineStart(),E=u(m,c),h.point(E[0],E[1])):(E=u(c,m),h.point(E[0],E[1]),h.lineEnd()),c=E;else if(i&&c&&n^_){var C;!(S&d)&&(C=u(m,c,!0))&&(y=0,n?(h.lineStart(),h.point(C[0][0],C[0][1]),h.point(C[1][0],C[1][1]),h.lineEnd()):(h.point(C[1][0],C[1][1]),h.lineEnd(),h.lineStart(),h.point(C[0][0],C[0][1])))}_&&(!c||!vf(c,m))&&h.point(m[0],m[1]),c=m,p=_,d=S},lineEnd:function(){p&&h.lineEnd(),c=null},clean:function(){return y|(g&&p)<<1}}}function u(h,c,d){var p=yl(h),g=yl(c),y=[1,0,0],w=gf(p,g),b=pf(w,w),m=w[0],E=b-m*m;if(!E)return!d&&h;var _=e*b/E,S=-e*m/E,C=gf(y,w),P=mf(y,_),x=mf(w,S);hm(P,x);var M=C,O=pf(P,M),I=pf(M,M),T=O*O-I*(pf(P,P)-1);if(!(T<0)){var A=_l(T),G=mf(M,(-O-A)/I);if(hm(G,P),G=lm(G),!d)return G;var nt=h[0],J=c[0],st=h[1],k=c[1],q;J<nt&&(q=nt,nt=J,J=q);var j=J-nt,B=On(j-le)<Be,D=B||j<Be;if(!B&&k<st&&(q=st,st=k,k=q),D?B?st+k>0^G[1]<(On(G[0]-nt)<Be?st:k):st<=G[1]&&G[1]<=k:j>le^(nt<=G[0]&&G[0]<=J)){var z=mf(M,(-O+A)/I);return hm(z,P),[G,lm(z)]}}}function l(h,c){var d=n?r:le-r,p=0;return h<-d?p|=1:h>d&&(p|=2),c<-d?p|=4:c>d&&(p|=8),p}return bw(o,a,s,n?[0,-r]:[-le,r-le])}function xw(r){return function(t){var e=new pm;for(var n in r)e[n]=r[n];return e.stream=t,e}}function pm(){}pm.prototype={constructor:pm,point:function(r,t){this.stream.point(r,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function Iw(r,t,e){var n=t[1][0]-t[0][0],i=t[1][1]-t[0][1],s=r.clipExtent&&r.clipExtent();r.scale(150).translate([0,0]),s!=null&&r.clipExtent(null),HN(e,r.stream(Cw));var o=Cw.result(),a=Math.min(n/(o[1][0]-o[0][0]),i/(o[1][1]-o[0][1])),u=+t[0][0]+(n-a*(o[1][0]+o[0][0]))/2,l=+t[0][1]+(i-a*(o[1][1]+o[0][1]))/2;return s!=null&&r.clipExtent(s),r.scale(a*150).translate([u,l])}function aO(r,t,e){return Iw(r,[[0,0],t],e)}var Mw=16,uO=He(30*Ci);function Tw(r,t){return+t?hO(r,t):lO(r)}function lO(r){return xw({point:function(t,e){t=r(t,e),this.stream.point(t[0],t[1])}})}function hO(r,t){function e(n,i,s,o,a,u,l,h,c,d,p,g,y,w){var b=l-n,m=h-i,E=b*b+m*m;if(E>4*t&&y--){var _=o+d,S=a+p,C=u+g,P=_l(_*_+S*S+C*C),x=Xa(C/=P),M=On(On(C)-1)<Be||On(s-c)<Be?(s+c)/2:vl(S,_),O=r(M,x),I=O[0],T=O[1],A=I-n,G=T-i,nt=m*A-b*G;(nt*nt/E>t||On((b*A+m*G)/E-.5)>.3||o*d+a*p+u*g<uO)&&(e(n,i,s,o,a,u,I,T,M,_/=P,S/=P,C,y,w),w.point(I,T),e(I,T,M,_,S,C,l,h,c,d,p,g,y,w))}}return function(n){var i,s,o,a,u,l,h,c,d,p,g,y,w={point:b,lineStart:m,lineEnd:_,polygonStart:function(){n.polygonStart(),w.lineStart=S},polygonEnd:function(){n.polygonEnd(),w.lineStart=m}};function b(x,M){x=r(x,M),n.point(x[0],x[1])}function m(){c=NaN,w.point=E,n.lineStart()}function E(x,M){var O=yl([x,M]),I=r(x,M);e(c,d,h,p,g,y,c=I[0],d=I[1],h=x,p=O[0],g=O[1],y=O[2],Mw,n),n.point(c,d)}function _(){w.point=b,n.lineEnd()}function S(){m(),w.point=C,w.lineEnd=P}function C(x,M){E(i=x,M),s=c,o=d,a=p,u=g,l=y,w.point=E}function P(){e(c,d,h,p,g,y,s,o,i,a,u,l,Mw,n),w.lineEnd=_,_()}return w}}var cO=xw({point:function(r,t){this.stream.point(r*Ci,t*Ci)}});function dO(r){return fO(function(){return r})()}function fO(r){var t,e=150,n=480,i=250,s,o,a=0,u=0,l=0,h=0,c=0,d,p,g=null,y=Pw,w=null,b,m,E,_=Sw,S=.5,C=Tw(I,S),P,x;function M(G){return G=p(G[0]*Ci,G[1]*Ci),[G[0]*e+s,o-G[1]*e]}function O(G){return G=p.invert((G[0]-s)/e,(o-G[1])/e),G&&[G[0]*ra,G[1]*ra]}function I(G,nt){return G=t(G,nt),[G[0]*e+s,o-G[1]*e]}M.stream=function(G){return P&&x===G?P:P=cO(y(d,C(_(x=G))))},M.clipAngle=function(G){return arguments.length?(y=+G?oO(g=G*Ci,6*Ci):(g=null,Pw),A()):g*ra},M.clipExtent=function(G){return arguments.length?(_=G==null?(w=b=m=E=null,Sw):KN(w=+G[0][0],b=+G[0][1],m=+G[1][0],E=+G[1][1]),A()):w==null?null:[[w,b],[m,E]]},M.scale=function(G){return arguments.length?(e=+G,T()):e},M.translate=function(G){return arguments.length?(n=+G[0],i=+G[1],T()):[n,i]},M.center=function(G){return arguments.length?(a=G[0]%360*Ci,u=G[1]%360*Ci,T()):[a*ra,u*ra]},M.rotate=function(G){return arguments.length?(l=G[0]%360*Ci,h=G[1]%360*Ci,c=G.length>2?G[2]%360*Ci:0,T()):[l*ra,h*ra,c*ra]},M.precision=function(G){return arguments.length?(C=Tw(I,S=G*G),A()):_l(S)},M.fitExtent=function(G,nt){return Iw(M,G,nt)},M.fitSize=function(G,nt){return aO(M,G,nt)};function T(){p=dw(d=$N(l,h,c),t);var G=t(a,u);return s=n-G[0]*e,o=i+G[1]*e,A()}function A(){return P=x=null,M}return function(){return t=r.apply(this,arguments),M.invert=t.invert&&O,T()}}function Nw(r){return function(t,e){var n=He(t),i=He(e),s=r(n*i);return[s*i*$e(t),s*$e(e)]}}function Ow(r){return function(t,e){var n=_l(t*t+e*e),i=r(n),s=$e(i),o=He(i);return[vl(t*s,n*o),Xa(n&&e*s/n)]}}var pO=Nw(function(r){return _l(2/(1+r))});pO.invert=Ow(function(r){return 2*Xa(r/2)});var Dw=Nw(function(r){return(r=uw(r))&&r/$e(r)});Dw.invert=Ow(function(r){return r});function gO(){return dO(Dw).scale(79.4188).clipAngle(179.999)}function Aw(r,t){return[r,t]}Aw.invert=Aw;function mO(r,t,e){e=e||{};var n=e.units||"kilometers",i=e.steps||8;if(!r)throw new Error("geojson is required");if(typeof e!="object")throw new Error("options must be an object");if(typeof i!="number")throw new Error("steps must be an number");if(t===void 0)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var s=[];switch(r.type){case"GeometryCollection":return jd(r,function(o){var a=Cf(o,t,n,i);a&&s.push(a)}),jr(s);case"FeatureCollection":return Wu(r,function(o){var a=Cf(o,t,n,i);a&&Wu(a,function(u){u&&s.push(u)})}),jr(s)}return Cf(r,t,n,i)}function Cf(r,t,e,n){var i=r.properties||{},s=r.type==="Feature"?r.geometry:r;if(s.type==="GeometryCollection"){var o=[];return jd(r,function(y){var w=Cf(y,t,e,n);w&&o.push(w)}),jr(o)}var a=vO(s),u={type:s.type,coordinates:Lw(s.coordinates,a)},l=new Kg,h=l.read(u),c=Sg(Cg(t,e),"meters"),d=an.bufferOp(h,c,n),p=new V1;if(d=p.write(d),!Rw(d.coordinates)){var g={type:d.type,coordinates:Fw(d.coordinates,a)};return ri(g,i)}}function Rw(r){return Array.isArray(r[0])?Rw(r[0]):isNaN(r[0])}function Lw(r,t){return typeof r[0]!="object"?t(r):r.map(function(e){return Lw(e,t)})}function Fw(r,t){return typeof r[0]!="object"?t.invert(r):r.map(function(e){return Fw(e,t)})}function vO(r){var t=Wy(r).geometry.coordinates,e=[-t[0],-t[1]];return gO().rotate(e).scale(Rn)}function _O(r,t,e){e===void 0&&(e={});var n=Hn(r),i=Hn(t),s=Ug.union(n.coordinates,i.coordinates);return s.length===0?null:s.length===1?ye(s[0],e.properties):Eg(s,e.properties)}function Cc(r,t,e){e===void 0&&(e={});var n=Hn(r),i=Hn(t),s=Ug.intersection(n.coordinates,i.coordinates);return s.length===0?null:s.length===1?ye(s[0],e.properties):Eg(s,e.properties)}function yO(r,t,e){e===void 0&&(e={});var n=JSON.stringify(e.properties||{}),i=r[0],s=r[1],o=r[2],a=r[3],u=(s+a)/2,l=(i+o)/2,h=t*2/gn([i,u],[o,u],e),c=h*(o-i),d=t*2/gn([l,s],[l,a],e),p=d*(a-s),g=c/2,y=g*2,w=Math.sqrt(3)/2*p,b=o-i,m=a-s,E=3/4*y,_=w,S=(b-y)/(y-g/2),C=Math.floor(S),P=(C*E-g/2-b)/2-g/2+E/2,x=Math.floor((m-w)/w),M=(m-x*w)/2,O=x*w-m>w/2;O&&(M-=w/4);for(var I=[],T=[],A=0;A<6;A++){var G=2*Math.PI/6*A;I.push(Math.cos(G)),T.push(Math.sin(G))}for(var nt=[],J=0;J<=C;J++)for(var st=0;st<=x;st++){var k=J%2===1;if(!(st===0&&k)&&!(st===0&&O)){var q=J*E+i-P,j=st*_+s+M;if(k&&(j-=w/2),e.triangles===!0)EO([q,j],c/2,p/2,JSON.parse(n),I,T).forEach(function(D){e.mask?Cc(e.mask,D)&&nt.push(D):nt.push(D)});else{var B=wO([q,j],c/2,p/2,JSON.parse(n),I,T);e.mask?Cc(e.mask,B)&&nt.push(B):nt.push(B)}}}return jr(nt)}function wO(r,t,e,n,i,s){for(var o=[],a=0;a<6;a++){var u=r[0]+t*i[a],l=r[1]+e*s[a];o.push([u,l])}return o.push(o[0].slice()),ye([o],n)}function EO(r,t,e,n,i,s){for(var o=[],a=0;a<6;a++){var u=[];u.push(r),u.push([r[0]+t*i[a],r[1]+e*s[a]]),u.push([r[0]+t*i[(a+1)%6],r[1]+e*s[(a+1)%6]]),u.push(r),o.push(ye([u],n))}return o}function SO(r,t,e,n){n===void 0&&(n={});for(var i=[],s=r[0],o=r[1],a=r[2],u=r[3],l=t/gn([s,o],[a,o],n),h=l*(a-s),c=e/gn([s,o],[s,u],n),d=c*(u-o),p=a-s,g=u-o,y=Math.floor(p/h),w=Math.floor(g/d),b=(p-y*h)/2,m=(g-w*d)/2,E=s+b,_=0;_<y;_++){for(var S=o+m,C=0;C<w;C++){var P=ye([[[E,S],[E,S+d],[E+h,S+d],[E+h,S],[E,S]]],n.properties);n.mask?nN(n.mask,P)&&i.push(P):i.push(P),S+=d}E+=h}return jr(i)}function CO(r,t,e){return e===void 0&&(e={}),SO(r,t,t,e)}function bO(r,t,e){e===void 0&&(e={});for(var n=[],i=t/gn([r[0],r[1]],[r[2],r[1]],e),s=i*(r[2]-r[0]),o=t/gn([r[0],r[1]],[r[0],r[3]],e),a=o*(r[3]-r[1]),u=0,l=r[0];l<=r[2];){for(var h=0,c=r[1];c<=r[3];){var d=null,p=null;u%2===0&&h%2===0?(d=ye([[[l,c],[l,c+a],[l+s,c],[l,c]]],e.properties),p=ye([[[l,c+a],[l+s,c+a],[l+s,c],[l,c+a]]],e.properties)):u%2===0&&h%2===1?(d=ye([[[l,c],[l+s,c+a],[l+s,c],[l,c]]],e.properties),p=ye([[[l,c],[l,c+a],[l+s,c+a],[l,c]]],e.properties)):h%2===0&&u%2===1?(d=ye([[[l,c],[l,c+a],[l+s,c+a],[l,c]]],e.properties),p=ye([[[l,c],[l+s,c+a],[l+s,c],[l,c]]],e.properties)):h%2===1&&u%2===1&&(d=ye([[[l,c],[l,c+a],[l+s,c],[l,c]]],e.properties),p=ye([[[l,c+a],[l+s,c+a],[l+s,c],[l,c+a]]],e.properties)),e.mask?(Cc(e.mask,d)&&n.push(d),Cc(e.mask,p)&&n.push(p)):(n.push(d),n.push(p)),c+=a,h++}u++,l+=s}return jr(n)}function PO(r,t,e){if(e=e||{},typeof e!="object")throw new Error("options is invalid");var n=e.gridType,i=e.property,s=e.weight;if(!r)throw new Error("points is required");if(H2(r,"Point","input must contain Points"),!t)throw new Error("cellSize is required");if(s!==void 0&&typeof s!="number")throw new Error("weight must be a number");i=i||"elevation",n=n||"square",s=s||1;var o=ii(r),a;switch(n){case"point":case"points":a=LT(o,t,e);break;case"square":case"squares":a=CO(o,t,e);break;case"hex":case"hexes":a=yO(o,t,e);break;case"triangle":case"triangles":a=bO(o,t,e);break;default:throw new Error("invalid gridType")}var u=[];return Wu(a,function(l){var h=0,c=0;Wu(r,function(p){var g=n==="point"?l:Mg(l),y=gn(g,p,e),w;if(i!==void 0&&(w=p.properties[i]),w===void 0&&(w=p.geometry.coordinates[2]),w===void 0)throw new Error("zValue is missing");y===0&&(h=w);var b=1/Math.pow(y,s);c+=b,h+=b*w});var d=uT(l);d.properties[i]=h/c,u.push(d)}),jr(u)}function xO(r,t){(r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1])&&r.push(r[0]);const e=de(t),n=ye([r]);return Sn(e,n)}function IO(r,t){const e=br(r);return Dg(e,t,{units:"meters"}).geometry.coordinates}function gm(r){if((r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1]||r[0][2]!==r[r.length-1][2])&&r.push(r[0]),r.length<=3)return 0;const t=ye([r]);return bT(t)}function MO(r){(r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1]||r[0][2]!==r[r.length-1][2])&&r.push(r[0]);const t=ye([r]),n=Hy(t).geometry.coordinates;return[n[0],n[1],n[2]??r[0][2]??0]}function kw(r,t,e,n){const[i,s,o]=r,a=Hu(de([i,s]),t,e,{units:"meters"});if(!(!a||!a.geometry||!a.geometry.coordinates))return n=n||[0,0,0],n[0]=a.geometry.coordinates[0],n[1]=a.geometry.coordinates[1],n[2]=o,n}function bf(r,t){return gn(de(r),de(t),{units:"meters"})}function bc(r,t){return Yh(de(r),de(t))}function TO(r,t){return Jh(br(r),br(t))}function NO(r,t){const e=de(r),n=de(t),i=dT(e,n),s=(r[2]+t[2])/2;return[...i.geometry.coordinates,s]}function OO(r,t){const e=de(t),n=br(r);return wT(n,e,{units:"meters"})}function DO(r,t){const e=de(r),n=br(t);return ST(e,n,{units:"meters"})}function AO(r,t,e,n){const[i,s,o]=r,a=jT(de([i,s]),t,e,{units:"meters"});if(!(!a||!a.geometry||!a.geometry.coordinates))return n=n||[0,0,0],n[0]=a.geometry.coordinates[0],n[1]=a.geometry.coordinates[1],n[2]=o,n}function Gw(r,t){return e1(de(r),de(t),{units:"meters"})}function RO(r,t){return GT(de(r),de(t))}function jw(r,t){(r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1]||r[0][2]!==r[r.length-1][2])&&r.push(r[0]),(t[0][0]!==t[t.length-1][0]||t[0][1]!==t[t.length-1][1]||t[0][2]!==t[t.length-1][2])&&t.push(t[0]);const e=Cc(ye([r]),ye([t]));if(e)return e.geometry.coordinates}function Vw(r,t){(r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1]||r[0][2]!==r[r.length-1][2])&&r.push(r[0]),(t[0][0]!==t[t.length-1][0]||t[0][1]!==t[t.length-1][1]||t[0][2]!==t[t.length-1][2])&&t.push(t[0]);const e=_O(ye([r]),ye([t]));if(e)return e.geometry.coordinates}function Bw(r,t=500,e="meters"){const n=mO(br(r),t,{units:e});if(n)return n.geometry.coordinates}function zw(r,t){(r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1]||r[0][2]!==r[r.length-1][2])&&r.push(r[0]),(t[0][0]!==t[t.length-1][0]||t[0][1]!==t[t.length-1][1]||t[0][2]!==t[t.length-1][2])&&t.push(t[0]);const e=IN(ye([r]),ye([t]));if(e)return e.geometry.coordinates}function Uw(r,t,e=10,n="meters"){return hT(r,t,{steps:e,units:n}).geometry.coordinates}function mm(r,t){(r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1]||r[0][2]!==r[r.length-1][2])&&r.push(r[0]),(t[0][0]!==t[t.length-1][0]||t[0][1]!==t[t.length-1][1]||t[0][2]!==t[t.length-1][2])&&t.push(t[0]);const e=ye([r]),n=ye([t]);return $T(e,n)?"oneBig":a1(e,n)?"twoBig":!1}function qw(r){const t=No(wa(r,["0"])),e=No(wa(r,["1"])),n=No(wa(r,["2"])),i=Ks(wa(r,["0"])),s=Ks(wa(r,["1"])),o=Ks(wa(r,["2"]));return{minPos:[t,e,n],maxPos:[i,s,o],center:[(t+i)*.5,(e+s)*.5,(n+o)*.5]}}function Ww(r){const{minPos:t,maxPos:e,center:n}=qw(r);if(t.some(a=>!Number.isFinite(a)||e.some(u=>!Number.isFinite(u))||n.some(u=>!Number.isFinite(u)))){console.warn("geoCenterAndRadiusFromPositions error: minPos.some(e => !Number.isFinite(e) || maxPos.some(e => !Number.isFinite(e)) || center.some(e => !Number.isFinite(e))");return}const i=bf(t,e);let s=i*.5;const o=Math.abs(t[2]-e[2]);return o!=0&&(s=Math.sqrt(i*i+o*o)*.5),{center:n,radius:s}}function Hw(r,t){const e=ki(r),n=ki(t);return v.Vector.distance(e,n)}function Pc(r,t){const e=[],n=r.length;let i=0;for(let s=0;s<n-1;++s){if(t===void 0||t==="GEODESIC"){const o=bf(r[s],r[s+1]),a=Math.abs(r[s][2]-r[s+1][2]);if(a===0)i+=o;else{const u=Math.sqrt(o*o+a*a);i+=u}}else if(t==="RHUMB"){const o=Gw(r[s],r[s+1]),a=Math.abs(r[s][2]-r[s+1][2]);if(a===0)i+=o;else{const u=Math.sqrt(o*o+a*a);i+=u}}else if(t==="NONE"){const o=Hw(r[s],r[s+1]);i+=o}else console.warn(`未知的arcType: ${t},导致距离无法计算!`);e.push(i)}return e}function vm(r){const t="__getXyzFromPostion";let e=kr(r,t);return(!e||!v.Vector.equals(e[0],r))&&(e=[[...r],ki(r)],fs(r,t,e)),e[1]}class LO{constructor(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(let e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(let e=0;e<this.length-1;e++){const n=this.points[e],i=this.points[e+1];this.centers.push({x:(n.x+i.x)/2,y:(n.y+i.y)/2,z:(n.z+i.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(let e=0;e<this.centers.length-1;e++){const n=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,i=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,s=this.points[e+1].z-(this.centers[e].z+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+n),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+i),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+s)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+n),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+i),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+s)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}cacheSteps(t){const e=[];let n=this.pos(0);e.push(0);for(let i=0;i<this.duration;i+=10){const s=this.pos(i);Math.sqrt((s.x-n.x)*(s.x-n.x)+(s.y-n.y)*(s.y-n.y)+(s.z-n.z)*(s.z-n.z))>t&&(e.push(i),n=s)}return e}vector(t){const e=this.pos(t+10),n=this.pos(t-10);return{angle:180*Math.atan2(e.y-n.y,e.x-n.x)/3.14,speed:Math.sqrt((n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y)+(n.z-e.z)*(n.z-e.z))}}pos(t){let e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);const n=e/this.duration;if(n>=1)return this.points[this.length-1];const i=Math.floor((this.points.length-1)*n),s=(this.length-1)*n-i;return FO(s,this.points[i],this.controls[i][1],this.controls[i+1][0],this.points[i+1])}}function FO(r,t,e,n,i){const s=kO(r);return{x:i.x*s[0]+n.x*s[1]+e.x*s[2]+t.x*s[3],y:i.y*s[0]+n.y*s[1]+e.y*s[2]+t.y*s[3],z:i.z*s[0]+n.z*s[1]+e.z*s[2]+t.z*s[3]}}function kO(r){const t=r*r;return[t*r,3*t*(1-r),3*r*(1-r)*(1-r),(1-r)*(1-r)*(1-r)]}function GO(r,t){t===void 0&&(t={});var e=t.resolution||1e3,n=t.sharpness||.85;const i=[],s=r.map(l=>{const[h,c,d]=ki(l);return{x:h,y:c,z:d}});for(var o=new LO({duration:e,points:s,sharpness:n}),a=function(l){var h=o.pos(l);const c=wg([h.x,h.y,h.z]);i.push(c)},u=0;u<o.duration;u+=10)a(u);return a(o.duration),i}function $w(r,t,e){return GO(r,{resolution:t,sharpness:e})}class Xw extends Du{constructor(t){super(t)}get propUiTree(){return this.uiTree}}class _m extends Ou{constructor(t,e,n){super(t,e),this._property=n}get property(){return this._property}}class ym extends _m{constructor(t,e){super(t,!1,e)}}class wm extends _m{constructor(t,e){super(t,!0,e)}get groupChildren(){return this.children}}function Yw(r,t){const e=new Xw(t),n=r.getProperties("chinese"),i=[];for(let s of n)if(s instanceof xt){const o=new wm(e,s);o.d(()=>s.destroy()),e.children.push(o),i.push(o)}else{const o=new ym(e,s);e.children.push(o),o.d(()=>s.destroy())}for(;i.length>0;){const s=i.pop();if(!s)throw new Error("should not be here!");const o=s;if(!(o.property instanceof xt))throw new Error("!(treeItem.property instanceof GroupProperty)");for(let a of o.property.children)if(a instanceof xt){const u=new wm(e,a);u.d(()=>a.destroy()),o.groupChildren.push(u),i.push(u)}else{const u=new ym(e,a);o.groupChildren.push(u),u.d(()=>a.destroy())}}return e.d(()=>{e.itemChildrenChanged.reset(),e.itemChildrenToChange.reset();const s=[...e.getDescendants()];s.forEach(o=>{o.children&&(o.children.length=0),o.destroy()}),s.length=0}),e}class El extends H{constructor(e){super();f(this,"_propTreeReact",this.dv($(void 0)));this.d(()=>this._propTreeReact.value=void 0),this.dv(new Je(this.sceneObjectChanged,n=>{if(!n)return;const i=new H;return i.d(n.toDestroyEvent.don(()=>{this.sceneObject=void 0})),i})),this.d(this.sceneObjectChanged.don(n=>{this._propTreeReact.value=void 0,!(!n||!(n instanceof yt))&&(this._propTreeReact.value=Yw(n,e))}))}get propTree(){return this._propTreeReact.value}get propTreeChanged(){return this._propTreeReact.changed}}(r=>{r.createDefaultProps=()=>({sceneObject:void 0})})(El||(El={})),Zs(El.prototype,El.createDefaultProps);function Em(r){return To(r,(t,e)=>t[0]===e[0]&&t[1]===e[1],t=>[...t])}function Jw(r,t){const e=new Array;for(let n of r)e.push(t(n));return e}function Sm(r,t){return r===void 0&&t===void 0?!0:!r||!t?!1:r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]}function Zw(r,t,e){var i;((i=t.attachedViewers.values().toArray()[0])==null?void 0:i.getEngineObject(t))?e.call(r):requestAnimationFrame(()=>Zw(r,t,e))}function jO(r,t,e,n=!0){n&&e(),r.dispose(t.disposableOn(e))}function VO(r,t){const{type:e,id:n}=r;if(e){const i=yt.create(e,n);if(i)return i.json=r,i;console.warn(`cannot create sceneObject from type(${e})`)}else console.warn(`cannot create sceneObject from type(${e})`)}function Kw(r){const t=r.children&&Ep(r.children,n=>{if(!(n instanceof Qn))throw new Error("!(treeItem instanceof SceneTreeItem)");return!n.show})||!1,e=r.sceneTree.getSceneObjectShowFunc(r.sceneObject);return!t||e}class Qn extends Ou{constructor(e,n=!1,i,s,o=!0){super(e,n,i);f(this,"_dragDrop");f(this,"_showChangedNotAffectChildren",!1);f(this,"_showChangedNotAffectParent",!1);f(this,"_type",this.dv($("Unknown")));f(this,"_isExport",this.dv($(!0)));const a=()=>this.tree&&this.tree.itemsChanged.emit([this]);this.dispose(this.nameChanged.disposableOn(a)),this.name=`未命名条目(${this.id})`,this.extras=s,this._isExport.value=o;let u;const l=()=>{u&&(u(),u=void 0)};this.dispose(l),this.dispose(this.sceneObjectChanged.disposableOn(h=>{l(),h&&(u=_t([this,"name"],[h,"name"]))})),this.dispose(this.showChanged.disposableOn(h=>{if(e.setSceneObjectShowFunc(this.sceneObject,h),this.tree&&this.tree.forceRedraw(),this.children&&!this._showChangedNotAffectChildren)for(let c of this.children)c instanceof Qn&&(c._showChangedNotAffectParent=!0,c.show=h,c._showChangedNotAffectParent=!1);this.parent&&this.parent instanceof Qn&&!this._showChangedNotAffectParent&&(this.parent._showChangedNotAffectChildren=!0,this.parent.show=Kw(this.parent),this.parent._showChangedNotAffectChildren=!1)})),this.dv(new Je(this.sceneObjectChanged,()=>{if(!this.sceneObject)return;const h=new H;if("show"in this.sceneObject&&"showChanged"in this.sceneObject&&this.sceneObject.showChanged instanceof N){const c=()=>{this.show=e.getSceneObjectShowFunc(this.sceneObject)};c(),h.dispose(this.sceneObject.showChanged.disposableOn(c))}else if("enabled"in this.sceneObject&&"enabledChanged"in this.sceneObject&&this.sceneObject.enabledChanged instanceof N){const c=()=>{this.show=e.getSceneObjectShowFunc(this.sceneObject)};c(),h.dispose(this.sceneObject.enabledChanged.disposableOn(c))}return h})),this.childrenChangedEvent.disposableOn(()=>{const h=Kw(this);this._showChangedNotAffectChildren=!0,this.show=h,this._showChangedNotAffectChildren=!1});{const h=()=>{let c="Unknown";this.sceneObject?c=this.sceneObject.typeName:this.children&&(c="Folder"),this._type.value=c};this.dispose(this.sceneObjectChanged.disposableOn(h)),this.dispose(this.childrenResetedEvent.disposableOn(h)),h()}}get dragDrop(){return this._dragDrop||(this._dragDrop=this.dv(this.sceneTree.createTreeItemDragDropFunc(this))),this._dragDrop}get type(){return this._type.value}get typeChanged(){return this._type.changed}get isExport(){return this._isExport.value}get isExportChanged(){return this._isExport.changed}set isExport(e){this._isExport.value=e}get sceneTree(){return this.tree}get jsonStr(){return JSON.stringify(this.json,void 0," ")}set jsonStr(e){try{this.json=JSON.parse(e)}catch(n){console.error(`sceneTreeItem.jsonStr error ${n}`,n)}}get completeJson(){const e=this.children&&[...this.children].filter(n=>n.isExport).map(n=>n.completeJson);return{name:this.name,show:this.show?void 0:!1,collapsed:this.uiTreeObject.collapsed?!0:void 0,sceneObj:this.sceneObject&&this.sceneObject.completeJson,children:e,extras:this.extras}}get json(){const e=this.children&&[...this.children].filter(n=>n.isExport).map(n=>n.json);return{name:this.name,show:this.show?void 0:!1,collapsed:this.uiTreeObject.collapsed?!0:void 0,sceneObj:this.sceneObject&&this.sceneObject.json,children:e,extras:this.extras}}set json(e){if(e.name!==void 0&&(this.name=e.name),this.extras=e.extras,this._showChangedNotAffectChildren=!0,this._showChangedNotAffectParent=!0,this.show=e.show??!0,this._showChangedNotAffectChildren=!1,this._showChangedNotAffectParent=!1,this.uiTreeObject.collapsed=e.collapsed??!1,this.sceneObject=void 0,e.sceneObj&&(this.sceneObject=this.sceneTree.createSceneObjectFunc(e.sceneObj,this)),!!e.children){if(this.resetChildren(!0),!this.children)throw new Error("resetChildren(true) cannot get children!");for(let n of e.children){const i=new Qn(this.tree,!0);i.json=n,this.children.push(i)}}}clone(){try{const e=new Qn(this.sceneTree,!!this.children,void 0,this.extras,this.isExport);return e.json=this.json,e.name=this.sceneTree.getSceneTreeItemCloneNameFunc(this),e}catch(e){console.error(`SceneTreeItem.clone error: ${e}`,e)}}insertNewTreeItem(e,n){if(e==="FolderInnerOrAfter"||e==="FolderInnerOrBefore"||e==="FolderInner"){if(n&&n.tree!==this.tree)return console.warn("newTreeItem.tree !== this.tree"),!1;if(this.children&&!(e.includes("Or")&&this.sceneObject))return n&&this.children.push(n),!0;if(e==="FolderInner")return!1;if(e==="FolderInnerOrAfter")return super.insertNewTreeItem("After",n);if(e==="FolderInnerOrBefore")return super.insertNewTreeItem("Before",n);throw new Error("should not be here!")}else return super.insertNewTreeItem(e,n)}}(r=>{r.createDefaultProps=()=>({name:"未命名条目",nameEditing:!1,sceneObject:void 0,show:!0,extras:Ie(void 0)})})(Qn||(Qn={})),Zs(Qn.prototype,Qn.createDefaultProps);function Qw(r,t,e){let{offsetY:n}=t;if(!t.target||!("clientTop"in t.target))return"none";n+=2,n+=t.target.clientTop;let i="none";return r.children?n<=e*.3?i="before":n>=e*.7?!r.uiTreeObject.collapsed&&r.children.length>0?i="inner":i="after":i="inner":n<=e*.5?i="before":i="after",i}class tE extends T0{constructor(t){super(),this._treeItem=t;const{dragStartDataManager:e}=this._treeItem.sceneTree;let n="none";const i=this.disposeVar(T_(()=>{this._treeItem.uiTreeObject.moveToPositionMode=n,console.log(`uiTreeObject.moveToPositionMode = lastDragMode(${n});`)},200));function s(o){n!==o&&(n=o,i.restart())}this.dispose(this._dragStartEvent.disposableOn(o=>{e.data={type:"UITreeA",value:this._treeItem}})),this.dispose(this._dragOverEvent.disposableOn(o=>{if(!o.dataTransfer)return;o.preventDefault();const a=e;if(a.data&&a.data.type==="UITreeA"&&a.data.value!==void 0){const u=a.data.value,l=this._treeItem,{tree:h}=l;if(h){const c=[...h.selectedItems];~c.indexOf(u)||c.push(u);const d=Qw(l,o,h.itemDivHeight);if(d!=="none"&&Du.canMoveToTreeItems(c,l,d)){o.dataTransfer.dropEffect="move",s(d);return}}}o.dataTransfer.dropEffect="none",s("none")})),this.dispose(this._dropEvent.disposableOn(o=>{const a=e;if(!(a.data&&a.data.type==="UITreeA"&&a.data.value!==void 0))return;const u=a.data.value,l=this._treeItem,{tree:h}=l;if(!h)return;const c=[...h.selectedItems];~c.indexOf(u)||c.push(u);const d=Qw(l,o,h.itemDivHeight);d!=="none"&&Du.canMoveToTreeItems(c,l,d)&&(Du.moveToTreeItems(c,l,d),a.data=void 0,s("none"))})),this.dispose(this._dragLeaveEvent.disposableOn(()=>{n="none",i.restart()}))}}function BO(r){if(!(r instanceof Qn))throw new Error("defaultCreateTreeItemDragDrop !(treeItem instanceof SceneTreeItem)");return new tE(r)}function zO(r){let t=!1;return r&&("show"in r?t=r.show??!0:"enabled"in r&&(t=r.enabled??!0)),t}function UO(r,t){r&&("show"in r?r.show=t:"enabled"in r&&(r.enabled=t))}const qO=["EnvironmentVariables","ScriptsLoader","SceneScript","ScriptLoader"];function WO(r){const t=[],{root:e={}}=r,n=[e];for(;n.length>0;){const i=n.pop();if(!i)throw new Error("!todo");if(i.children){for(let s of i.children)if(s.children&&n.unshift(s),s.sceneObj){const{type:o=void 0}=s.sceneObj;o||(console.warn("sceneObjJson has no type! treeItem.sceneObj: "),console.warn(s.sceneObj)),o&&qO.includes(o)&&t.push(s.sceneObj)}}}return t}async function HO(r,t){const e=WO(r);let n=0;const i=e.length;for(let s of e)if(++n,t){const o=n/i;t(o,n,i)}}class eE extends H{constructor(e,n){super();f(this,"treeItemContexMenuCallback");this._sceneTree=e,this._projectManager=n}get sceneTree(){return this._sceneTree}}class $O extends H{constructor(e){super();f(this,"_jsonLoadingEvent",this.disposeVar(new N));f(this,"_setJsonProcessing",this.disposeVar(Gr(async(e,n)=>{this._jsonLoadingEvent.emit({type:"init"}),this._jsonLoadingEvent.emit({type:"loading"}),n&&await e.promise(this._sceneTree.preloadFunc(n)),this._setJson(n),this._jsonLoadingEvent.emit({type:"loaded"})})));this._sceneTree=e,this._setJsonProcessing.errorFunc=n=>{this._jsonLoadingEvent.emit({type:"error",error:n})}}get jsonLoadingEvent(){return this._jsonLoadingEvent}_setJson(e){try{this._sceneTree.setJson(e||{})}catch(n){console.error(`json数据装配时发生错误!error: ${n}`)}}get json(){return this._sceneTree.getJson()}set json(e){this._setJsonProcessing.restart(new Di("JSON重新赋值!"),e)}get jsonStr(){return JSON.stringify(this.json,void 0," ")}set jsonStr(e){this.json=JSON.parse(e)}}function XO(r){return r.name+"_clone"}function Cm(r,t,e){if(r instanceof Qn)return r.insertNewTreeItem(t,e);{const n={FolderInnerOrAfter:"InnerOrAfter",FolderInnerOrBefore:"InnerOrBefore",FolderInner:"Inner",InnerOrAfter:"InnerOrAfter",InnerOrBefore:"InnerOrBefore",Inner:"Inner",After:"After",Before:"Before"};return r.insertNewTreeItem(n[t],e)}}function YO(r){[r,...r.getDescendants()].forEach(t=>t.destroy())}const Rr=class Rr extends Du{constructor(e,n,i,s){super(i);f(this,"_jsonLoading",this.disposeVar(new $O(this)));f(this,"createSceneObjectFunc",Rr.defaultCreateSceneObjectFunc);f(this,"createTreeItemDragDropFunc",Rr.defaultCreateTreeItemDragDropFunc);f(this,"preloadFunc",Rr.defaultPreload);f(this,"getSceneObjectShowFunc",Rr.defaultGetSceneObjectShow);f(this,"setSceneObjectShowFunc",Rr.defaultSetSceneObjectShow);f(this,"getSceneTreeItemCloneNameFunc",Rr.defaultGetSceneTreeItemCloneNameFunc);f(this,"debug",!1);f(this,"_contextMenu",this.disposeVar(new eE(this,this.projectManager)));f(this,"_showPropUiOnSelecting",this.disposeVar($(!0)));this._name=e,this._dragStartDataManager=n,this._projectManager=s,this.dispose(this.selectedItems.changedEvent.disposableOn(()=>{var a,u;window.lssn=this.lastSelectedItem,window.lsso=(a=this.lastSelectedItem)==null?void 0:a.sceneObject,this.debug&&console.log(((u=this.lastSelectedItem)==null?void 0:u.sceneObject)??"select null")}));const{sceneObjectsManager:o}=this._projectManager;this.dispose(this.itemsDeleted.disposableOn(a=>{for(let u of a){const l=u,{sceneObject:h}=l;h&&o.deleteSceneObject(h)&&h.destroy()&&bd(h,void 0);for(let c of l.getDescendants()){const{sceneObject:d}=c;d&&o.deleteSceneObject(d)&&d.destroy()&&bd(d,void 0)}YO(u)}})),this.dispose(this.itemsAdded.disposableOn(a=>{for(let u of a){const l=u;l.sceneObject&&o.addSceneObject(l.sceneObject)&&bd(l.sceneObject,l)}})),this.dispose(this.selectedItems.changedEvent.disposableOn(()=>{if(!this.showPropUiOnSelecting)return;this._projectManager.propUiTreeManager.sceneObject=void 0;const{lastSelectedItem:a}=this;a&&(this._projectManager.propUiTreeManager.sceneObject=a.sceneObject)}))}get json(){return this._jsonLoading.json}set json(e){this._jsonLoading.json=e}get jsonStr(){return this._jsonLoading.jsonStr}set jsonStr(e){this._jsonLoading.jsonStr=e}get jsonLoadingEvent(){return this._jsonLoading.jsonLoadingEvent}get name(){return this._name}get projectManager(){return this._projectManager}get contextMenu(){return this._contextMenu}get showPropUiOnSelecting(){return this._showPropUiOnSelecting.value}set showPropUiOnSelecting(e){this._showPropUiOnSelecting.value=e}get showPropUiOnSelectingChanged(){return this._showPropUiOnSelecting.changed}get sceneUiTree(){return this.uiTree}getTreeItemFromSceneObjId(e){const n=this.getDescendants();let i;for(let s of n)if(s.sceneObject&&s.sceneObject.id===e){i=s;break}return i}getTreeItemsFromSceneObjType(e){const n=this.getDescendants(),i=[],s=Array.isArray(e)?e:[e];for(let o of n)o.sceneObject&&s.includes(o.sceneObject.typeName)&&i.push(o);return i}getTreeItemsFromSceneObjName(e){var s;const n=this.getDescendants(),i=[];for(let o of n)(s=o.sceneObject)!=null&&s.name.includes(e)&&i.push(o);return i}get dragStartDataManager(){return this._dragStartDataManager}get completeJson(){return{root:{children:[...this.children].filter(e=>e.isExport).map(e=>e.completeJson)}}}getJson(){return{root:{children:[...this.children].filter(e=>e.isExport).map(e=>e.json)}}}setJson(e){var i;e.root=e.root||{};const n=e.root.children??[];this.root.resetChildren(!0);for(let s of n){const o=new Qn(this,!0);o.json=s,(i=this.root.children)==null||i.push(o)}}testAddNewTreeItem(e,n){const i=e||this.lastSelectedItem||this.root;return i?Cm(i,n):!1}addNewTreeItem(e,n,i,s){const o=e||this.lastSelectedItem||this.root;if(o&&Cm(o,n)){const a=new Qn(this,i);if(a.sceneObject=s,!Cm(o,n,a))throw new Error("currentTreeItem.insertNewTreeItem return false!");return a}}createSceneObjectTreeItem(e,n,i,s){const o=s??"FolderInnerOrAfter";if(!this.testAddNewTreeItem(i,o)){console.warn(`cannot addNewTreeItem! currentTreeItem(${i?i.id:"root"})`);return}const a=yt.create(e,n);return a?this.addNewTreeItem(i,s??"FolderInnerOrAfter",!0,a):void 0}createGroupTreeItem(e,n,i,s){const o=s??"FolderInnerOrAfter";if(!this.testAddNewTreeItem(i,o)){console.warn(`cannot addNewTreeItem! currentTreeItem(${i?i.id:"root"})`);return}const a=this.addNewTreeItem(i,s??"FolderInnerOrAfter",!0);if(!a){console.warn("addNewTreeItem error!");return}return a.name=e??"未命名组节点",a}createSceneObjectTreeItemFromClass(e,n,i,s){const o=s??"FolderInnerOrAfter";if(!this.testAddNewTreeItem(i,o))return;const a=yt.createFromClass(e,n);return a?this.addNewTreeItem(i,o,!0,a):void 0}createSceneObjectTreeItemFromJson(e,n,i){const s=i??"FolderInnerOrAfter";if(!this.testAddNewTreeItem(n,s))return;const o=yt.createFromJson(e);return console.log(o),o?this.addNewTreeItem(n,i??"FolderInnerOrAfter",!0,o):void 0}destroySceneObjectTreeItem(e){if(e===this.root){console.warn("cannot destroy root! please use function destroyAllSceneObjectTreeItems!");return}e.detachFromParent()}destroyAllSceneObjectTreeItems(){if(!this.root.children)return;const e=[...this.root.children];for(let n of e)this.destroySceneObjectTreeItem(n)}};f(Rr,"defaultCreateSceneObjectFunc",VO),f(Rr,"defaultCreateTreeItemDragDropFunc",BO),f(Rr,"defaultPreload",HO),f(Rr,"defaultGetSceneObjectShow",zO),f(Rr,"defaultSetSceneObjectShow",UO),f(Rr,"defaultGetSceneTreeItemCloneNameFunc",XO);let xc=Rr;const bm={saturation:.35,brightness:1.4,gamma:.8,atmosphereScatteringIntensity:5,groundColor:[0,.09411764705882353,.3137254901960784,1]};class JO extends H{constructor(e){super();f(this,"_currentPosition",this.disposeVar(Oe(void 0)));f(this,"_currentRotation",this.disposeVar(Oe(void 0)));f(this,"_currentHeading",this.disposeVar($(void 0)));f(this,"_isRotating",this.disposeVar($(!1)));f(this,"_isGround",this.disposeVar($(!1)));f(this,"_startPosition",[0,0,0]);f(this,"_startRotation",[0,0,0]);f(this,"_processing",this.disposeVar(Gr(async(e,n,i,s)=>{const{currentPosition:o,currentRotation:a}=this;if(!o||s<=0||!a){this._currentPosition.value=n,this._currentRotation.value=i;return}const u=this._startPosition;u.splice(0,3,...o);const l=this._startRotation;l.splice(0,3,...a);let h=Date.now();const c=bc(u,n);this._currentHeading.value=c;const p=bf(u,n)/s,g=[i[0]-l[0],i[1]-l[1],i[2]-l[2]],y=n[2]-u[2];await e.promise(new Promise(w=>{e.disposer.dispose(cd(async()=>{let b=Date.now()-h;b=b<0?0:b,b=b>s?s:b;const m=b*p,E=kw(u,m,c);if(this.isGround&&E){const _=await this._esviewer.getTerrainHeight([E[0],E[1]]);this._currentPosition.value=[E[0],E[1],_??0]}else E&&(E[2]+=y*(b/s)),this._currentPosition.value=E;if(this.isRotating){const[_,S,C]=g,P=b/s;this._currentRotation.value=[l[0]+_*P,l[1]+S*P,l[2]+C*P]}b===s&&(this._currentPosition.value=n,this.isRotating&&(this._currentRotation.value=i),this.isRotating=!1,this.isGround=!1,w())}))}))})));this._esviewer=e}get currentPosition(){return this._currentPosition.value}get currentPositionChanged(){return this._currentPosition.changed}get currentRotation(){return this._currentRotation.value}get currentRotationChanged(){return this._currentRotation.changed}get currentHeading(){return this._currentHeading.value}get currentHeadingChanged(){return this._currentHeading.changed}get isRotating(){return this._isRotating.value}set isRotating(e){this._isRotating.value=e}get isRotatingChanged(){return this._isRotating.changed}get isGround(){return this._isGround.value}set isGround(e){this._isGround.value=e}get isGroundChanged(){return this._isGround.changed}get processing(){return this._processing}restart(e,n,i){this._processing.restart(void 0,e,n,i)}cancel(){this._processing.cancel()}}function nE(r){let t=0;function e(n,i){i++,t=Math.max(i,t),n.forEach(s=>{Array.isArray(s)&&e(s,i)})}return e(r,0),t}const ks=class ks extends ge{constructor(e){super(e);f(this,"editingBindMode","lineString");f(this,"_area",this.dv($(0)));f(this,"_perimeter",this.dv($(0)));this.d(Js(this.pointsChanged,()=>{this._updateArea(),this._updatePerimeter()},{immediate:!0}))}updateEditing(){var n;const e=[];this.editingBindMode=="doublePoints"?e.push(vt.DoublePointsAppend,vt.DoublePointsModify):this.editingBindMode=="lineString"?e.push(vt.LineStringAppend,vt.LineStringInsert,vt.Translation):this.editingBindMode=="circular"?(e.push(vt.CircularAppend,vt.CircularInsert,vt.Translation),this.supportEditingModes().includes(vt.HeightModify)&&e.push(vt.HeightModify)):this.editingBindMode=="visibility"?e.push(vt.VisibilityAppend,vt.VisibilityModify):this.editingBindMode=="scatter"&&e.push(vt.ScatterAppend,vt.ScatterModify),(n=this.activeViewer)==null||n.startEditing(this,e,{callSource:"inner"})}get area(){return this._area.value}get areaChanged(){return this._area.changed}get perimeter(){return this._perimeter.value}get perimeterChanged(){return this._perimeter.changed}_updateArea(){this._area.value=this.getArea()??0}_updatePerimeter(){this._perimeter.value=this.getPerimeter()??0}getArea(){if(this.points&&this.points.length>=3)return gm([...this.points])}getDistance(){if(this.points&&this.points.length>=2){const e=Pc(this.points,"GEODESIC");return e[e.length-1]}else return}getPerimeter(){if(this.points&&this.points.length>=3){const e=[...this.points,this.points[0]],n=Pc(e,"GEODESIC");return n[n.length-1]}else return}getIntersect(e){if(this.points&&this.points.length>=3&&e.length>=3){const n=jw(this.points,e);if(!n)return;const i=n[0][0][0];if(Array.isArray(i)){const s=[...n],o=[];return s.forEach(a=>{const u=a[0].map(l=>[...l,0]);o.push(u)}),o}else return[[...n][0].map(a=>[...a,0])]}else return}getUnion(e){if(this.points&&this.points.length>=3&&e.length>=3){const n=Vw(this.points,e);if(!n)return;const i=n[0][0][0];if(Array.isArray(i)){const s=[...n],o=[];return s.forEach(a=>{const u=a[0].map(l=>[...l,0]);o.push(u)}),o}else return[[...n][0].map(a=>[...a,0])]}else return}getDifference(e){if(this.points&&this.points.length>=3&&e.length>=3){let n=[...e];const i=e[0],s=e[e.length-1];i[0]===s[0]&&i[1]===s[1]&&i[2]===s[2]||n.push(i);const o=zw([...this.points,this.points[0]],[...n]);if(!o)return{status:"undefined",positions:void 0};const a=[...o];if(nE(a)===3){const u=a.map(d=>d.map(p=>[...p,0]));if(u.length<=1)return{status:"notIncluded",positions:u};const l=u[0],h=u[1];return mm([...l],[...h])==="oneBig"?{status:"included",positions:u}:{status:"notIncluded",positions:u}}else if(nE(a)===4){const l=[...a.map(c=>c.map(d=>d.map(p=>[...p,0])))],h=[];return l.forEach(c=>{h.push(c[0])}),{status:"notIncluded",positions:h}}else return{status:"undefined",positions:void 0}}else return{status:"undefined",positions:void 0}}getBuffer(e=500,n){if(this.points&&this.points.length>=2){const i=Bw(this.points,e,n);return i?[i[0].map(s=>[...s,0])]:void 0}else return}geoPolygonOverlap(e){if(this.points&&this.points.length>=3&&e.length>=3){const n=mm(this.points,e);return n==="oneBig"?!0:n==="twoBig"?!1:void 0}else return}getESProperties(){const e={...super.getESProperties()};return{...e,defaultMenu:"style",coordinate:[...e.coordinate,new ot([this,"editing"],"编辑",!1),new Et([this,"points"],"位置数组",ks.defaults.points,void 0,!0)],style:[...e.style,new xt([],"点样式"),new ot([this,"pointed"],"开启",!1),new L([this,"pointSize"],"点大小",1),new Wt([this,"pointSizeType"],[["screen","screen"],["world","world"]],"点类型","screen"),new Kt([this,"pointColor"],"点颜色",[1,1,1,1]),new Kt([this,"pointOutlineColor"],"轮廓颜色",ks.defaults.pointStyle.outlineColor),new L([this,"pointOutlineWidth"],"轮廓宽度",ks.defaults.pointStyle.outlineWidth),new xt([],"线样式"),new ot([this,"stroked"],"开启线样式",!0),new ot([this,"strokeGround"],"贴地",!1),new L([this,"strokeWidth"],"线宽",1),new Wt([this,"strokeWidthType"],[["screen","screen"],["world","world"]],"线类型","screen"),new Kt([this,"strokeColor"],"线颜色",[1,1,1,1]),new xt([],"面样式"),new ot([this,"filled"],"开启",!1),new ot([this,"fillGround"],"贴地",!1),new Kt([this,"fillColor"],"填充颜色",[1,1,1,1])],more:[...e.more,new xt([],"点样式集合"),new At([this,"pointMaterial"],"点材质"),new Et([this,"pointMaterialParams"],"点材质参数"),new xt([],"线样式集合"),new At([this,"strokeMaterial"],"线材质"),new Et([this,"strokeMaterialParams"],"线材质参数"),new xt([],"面样式集合"),new At([this,"fillMaterial"],"面材质"),new Et([this,"fillMaterialParams"],"面材质参数")]}}get pointSize(){return this.pointStyle.size}set pointSize(e){this.pointStyle={...this.pointStyle,size:e}}get pointSizeChanged(){return this.pointStyleChanged}get pointSizeType(){return this.pointStyle.sizeType}set pointSizeType(e){this.pointStyle={...this.pointStyle,sizeType:e}}get pointSizeTypeChanged(){return this.pointStyleChanged}get pointColor(){return this.pointStyle.color}set pointColor(e){this.pointStyle={...this.pointStyle,color:[...e]}}get pointColorChanged(){return this.pointStyleChanged}get pointOutlineColor(){return this.pointStyle.outlineColor}set pointOutlineColor(e){this.pointStyle={...this.pointStyle,outlineColor:[...e]}}get pointOutlineColorChanged(){return this.pointStyleChanged}get pointOutlineWidth(){return this.pointStyle.outlineWidth}set pointOutlineWidth(e){this.pointStyle={...this.pointStyle,outlineWidth:e}}get pointOutlineWidthChanged(){return this.pointStyleChanged}get pointMaterial(){return this.pointStyle.material}set pointMaterial(e){this.pointStyle={...this.pointStyle,material:e}}get pointMaterialChanged(){return this.pointStyleChanged}get pointMaterialParams(){return this.pointStyle.materialParams}set pointMaterialParams(e){this.pointStyle={...this.pointStyle,materialParams:e}}get pointMaterialParamsChanged(){return this.pointStyleChanged}get strokeWidth(){return this.strokeStyle.width}set strokeWidth(e){this.strokeStyle={...this.strokeStyle,width:e}}get strokeWidthChanged(){return this.strokeStyleChanged}get strokeWidthType(){return this.strokeStyle.widthType}set strokeWidthType(e){this.strokeStyle={...this.strokeStyle,widthType:e}}get strokeWidthTypeChanged(){return this.strokeStyleChanged}get strokeColor(){return this.strokeStyle.color}set strokeColor(e){this.strokeStyle={...this.strokeStyle,color:[...e]}}get strokeColorChanged(){return this.strokeStyleChanged}get strokeMaterial(){return this.strokeStyle.material}set strokeMaterial(e){this.strokeStyle={...this.strokeStyle,material:e}}get strokeMaterialChanged(){return this.strokeStyleChanged}get strokeMaterialParams(){return this.strokeStyle.materialParams}set strokeMaterialParams(e){this.strokeStyle={...this.strokeStyle,materialParams:e}}get strokeMaterialParamsChanged(){return this.strokeStyleChanged}get strokeGround(){return this.strokeStyle.ground}set strokeGround(e){this.strokeStyle={...this.strokeStyle,ground:e}}get strokeGroundChanged(){return this.strokeStyleChanged}get fillColor(){return this.fillStyle.color}set fillColor(e){this.fillStyle={...this.fillStyle,color:[...e]}}get fillColorChanged(){return this.fillStyleChanged}get fillMaterial(){return this.fillStyle.material}set fillMaterial(e){this.fillStyle={...this.fillStyle,material:e}}get fillMaterialChanged(){return this.fillStyleChanged}get fillMaterialParams(){return this.fillStyle.materialParams}set fillMaterialParams(e){this.fillStyle={...this.fillStyle,materialParams:e}}get fillMaterialParamsChanged(){return this.fillStyleChanged}get fillGround(){return this.fillStyle.ground}set fillGround(e){this.fillStyle={...this.fillStyle,ground:e}}get fillGroundChanged(){return this.fillStyleChanged}};f(ks,"createDefaultProps",()=>({...ge.createDefaultProps(),pointed:!1,pointStyle:Bt({size:10,sizeType:"screen",color:[1,1,1,1],material:"",materialParams:{},outlineColor:[1,0,0,1],outlineWidth:2}),stroked:!1,strokeStyle:Bt({width:1,widthType:"screen",color:[1,1,1,1],material:"",materialParams:{},ground:!1}),filled:!1,fillStyle:Bt({color:[1,1,1,1],material:"",materialParams:{},ground:!1}),points:ud([])})),f(ks,"type",ks.register("ESGeoVector",ks,{chsName:"地理矢量",tags:["ESObjects"],description:"地理矢量"})),f(ks,"supportEditingModes",[...ge.supportEditingModes,vt.Translation]);let Ht=ks;const nu=class nu extends ge{constructor(){super(...arguments);f(this,"_statusDis",this.dv($(!0)));f(this,"_smoothMoveEvent",this.dv(new N));f(this,"_smoothMoveWithRotationEvent",this.dv(new N));f(this,"_smoothMoveOnGroundEvent",this.dv(new N));f(this,"_smoothMoveWithRotationOnGroundEvent",this.dv(new N));f(this,"_automaticLandingEvent",this.dv(new N));f(this,"_smoothMoveKeepPitchEvent",this.dv(new N));f(this,"_smoothMoveRelativelyEvent",this.dv(new N));f(this,"_smoothMoveRelativelyWithRotationEvent",this.dv(new N));f(this,"useCalcFlyToParamInESObjectWithLocation",!0)}updateEditing(){var n;const e=[];this.editingBindMode=="singlePoint"?(e.push(vt.Place,vt.Translation),["ESLocationMeasurement"].includes(this.typeName)||e.push(vt.Rotation),["ESClippingPlane","ESLocationMeasurement","ESLocalRectangle","ESBoxClipping"].includes(this.typeName)||e.push(vt.Scale)):this.editingBindMode=="doublePoints"&&e.push(vt.DoublePointsAppend,vt.DoublePointsModify),(n=this.activeViewer)==null||n.startEditing(this,e,{callSource:"inner"})}get statusDis(){return this._statusDis.value}get statusDisChanged(){return this._statusDis.changed}get smoothMoveEvent(){return this._smoothMoveEvent}smoothMove(e,n){this._smoothMoveEvent.emit(e,n)}get smoothMoveWithRotationEvent(){return this._smoothMoveWithRotationEvent}smoothMoveWithRotation(e,n,i){this._smoothMoveWithRotationEvent.emit(e,n,i)}get smoothMoveOnGroundEvent(){return this._smoothMoveOnGroundEvent}smoothMoveOnGround(e,n,i,s){this._smoothMoveOnGroundEvent.emit(e,n,i,s)}get smoothMoveWithRotationOnGroundEvent(){return this._smoothMoveWithRotationOnGroundEvent}smoothMoveWithRotationOnGround(e,n,i,s,o){this._smoothMoveWithRotationOnGroundEvent.emit(e,n,i,s,o)}get automaticLandingEvent(){return this._automaticLandingEvent}automaticLanding(){const e=this.collision;this.collision=!1,setTimeout(()=>{this._automaticLandingEvent.emit(e)},100)}get smoothMoveKeepPitchEvent(){return this._smoothMoveKeepPitchEvent}smoothMoveKeepPitch(e,n){this._smoothMoveKeepPitchEvent.emit(e,n)}get smoothMoveRelativelyEvent(){return this._smoothMoveRelativelyEvent}smoothMoveRelatively(e,n){this._smoothMoveRelativelyEvent.emit(e,n)}get smoothMoveRelativelyWithRotationEvent(){return this._smoothMoveRelativelyWithRotationEvent}smoothMoveRelativelyWithRotation(e,n,i){this._smoothMoveRelativelyWithRotationEvent.emit(e,n,i)}getESProperties(){const e={...super.getESProperties()};return{...e,defaultMenu:"basic",location:[...e.location,new ot([this,"editing"],"是否编辑"),new It([],()=>this.automaticLanding(),[],"自动落地"),new Au([this,"position"],"位置数组",[0,0,0]),new Zp([this,"rotation"],"姿态数组",[0,0,0]),new Un([this,"scale"],"缩放",[1,1,1]),new L([this,"minVisibleDistance"],"最小可见距离",0),new L([this,"maxVisibleDistance"],"最大可见距离",0)],more:[...e.more,new It(["numbers","number"],(n,i)=>this.smoothMove(n,i),[[0,0,0],0],"平滑移动","smoothMove"),new It(["numbers","number"],(n,i)=>this.smoothMoveKeepPitch(n,i),[[0,0,0],0],"固定方向平滑移动","smoothMoveKeepPitch"),new It(["numbers","numbers","number"],(n,i,s)=>this.smoothMoveWithRotation(n,i,s),[[0,0,0],[0,0,0],0],"平滑偏移","smoothMoveWithRotation"),new It(["number","number","number","string"],(n,i,s,o)=>this.smoothMoveOnGround(n,i,s,o),[0,0,0,""],"贴地平滑移动","smoothMoveOnGround"),new It(["numbers","number","number","number","string"],(n,i,s,o,a)=>this.smoothMoveWithRotationOnGround(n,i,s,o,a),[[0,0,0],0,0,0,""],"贴地平滑偏移","smoothMoveWithRotationOnGround"),new It(["numbers","number"],(n,i)=>this.smoothMoveRelatively(n,i),[[0,0,0],0],"smoothMoveRelatively","smoothMoveRelatively"),new It(["numbers","numbers","number"],(n,i,s)=>this.smoothMoveRelativelyWithRotation(n,i,s),[[0,0,0],[0,0,0],0],"smoothMoveRelativelyWithRotation","smoothMoveRelativelyWithRotation"),new ot([this,"enableVisibleDistance"],"是否应用距离显隐")]}}get pointSize(){return this.pointStyle.size}set pointSize(e){this.pointStyle={...this.pointStyle,size:e}}get pointSizeChanged(){return this.pointStyleChanged}get pointSizeType(){return this.pointStyle.sizeType}set pointSizeType(e){this.pointStyle={...this.pointStyle,sizeType:e}}get pointSizeTypeChanged(){return this.pointStyleChanged}get pointColor(){return this.pointStyle.color}set pointColor(e){this.pointStyle={...this.pointStyle,color:[...e]}}get pointColorChanged(){return this.pointStyleChanged}get pointMaterial(){return this.pointStyle.material}set pointMaterial(e){this.pointStyle={...this.pointStyle,material:e}}get pointMaterialChanged(){return this.pointStyleChanged}get pointMaterialParams(){return this.pointStyle.materialParams}set pointMaterialParams(e){this.pointStyle={...this.pointStyle,materialParams:e}}get pointMaterialParamsChanged(){return this.pointStyleChanged}};f(nu,"createDefaultProps",()=>({...ge.createDefaultProps(),pointed:!1,pointStyle:Bt({size:1,sizeType:"screen",color:[1,1,1,1],material:"",materialParams:{},outlineColor:[1,0,0,1],outlineWidth:2}),position:Ot([0,0,0]),rotation:Ot([0,0,0]),scale:Ot([1,1,1]),minVisibleDistance:$(0),maxVisibleDistance:$(0)})),f(nu,"type",nu.register("ESObjectWithLocation",nu,{chsName:"对象位置",tags:["ESObjects"],description:"对象位置"})),f(nu,"supportEditingModes",[...ge.supportEditingModes,vt.Place,vt.Translation,vt.Rotation,vt.Scale,vt.DoublePointsAppend,vt.DoublePointsModify]);let Ct=nu;const Rl=class Rl extends Ct{getESProperties(){const t={...super.getESProperties()};return{...t,style:[...t.style,new xt([],"点样式集合"),new ot([this,"pointed"],"开启点样式",!1),new L([this,"pointSize"],"点大小",1),new Wt([this,"pointSizeType"],[["screen","screen"],["world","world"]],"点类型","screen"),new Kt([this,"pointColor"],"点颜色",[1,1,1,1]),new xt([],"线样式集合"),new ot([this,"stroked"],"开启线样式",!1),new ot([this,"strokeGround"],"是否贴地(线)",!1),new L([this,"strokeWidth"],"线宽",1),new Wt([this,"strokeWidthType"],[["screen","screen"],["world","world"]],"线类型","screen"),new Kt([this,"strokeColor"],"线颜色",[1,1,1,1]),new xt([],"面样式集合"),new ot([this,"filled"],"开启填充样式",!1),new ot([this,"fillGround"],"是否贴地",!1),new Kt([this,"fillColor"],"填充颜色",[1,1,1,1])],more:[...t.more,new xt([],"点样式"),new At([this,"pointMaterial"],"点材质",""),new Et([this,"pointMaterialParams"],"点材质参数",{}),new xt([],"线样式"),new At([this,"strokeMaterial"],"线材质",""),new Et([this,"strokeMaterialParams"],"线材质参数",{}),new xt([],"填充样式"),new At([this,"fillMaterial"],"面材质",""),new Et([this,"fillMaterialParams"],"面材质参数",{})]}}get strokeWidth(){return this.strokeStyle.width}set strokeWidth(t){this.strokeStyle={...this.strokeStyle,width:t}}get strokeWidthChanged(){return this.strokeStyleChanged}get strokeWidthType(){return this.strokeStyle.widthType}set strokeWidthType(t){this.strokeStyle={...this.strokeStyle,widthType:t}}get strokeWidthTypeChanged(){return this.strokeStyleChanged}get strokeColor(){return this.strokeStyle.color}set strokeColor(t){this.strokeStyle={...this.strokeStyle,color:[...t]}}get strokeColorChanged(){return this.strokeStyleChanged}get strokeMaterial(){return this.strokeStyle.material}set strokeMaterial(t){this.strokeStyle={...this.strokeStyle,material:t}}get strokeMaterialChanged(){return this.strokeStyleChanged}get strokeMaterialParams(){return this.strokeStyle.materialParams}set strokeMaterialParams(t){this.strokeStyle={...this.strokeStyle,materialParams:t}}get strokeMaterialParamsChanged(){return this.strokeStyleChanged}get strokeGround(){return this.strokeStyle.ground}set strokeGround(t){this.strokeStyle={...this.strokeStyle,ground:t}}get strokeGroundChanged(){return this.strokeStyleChanged}get fillColor(){return this.fillStyle.color}set fillColor(t){this.fillStyle={...this.fillStyle,color:[...t]}}get fillColorChanged(){return this.fillStyleChanged}get fillMaterial(){return this.fillStyle.material}set fillMaterial(t){this.fillStyle={...this.fillStyle,material:t}}get fillMaterialChanged(){return this.fillStyleChanged}get fillMaterialParams(){return this.fillStyle.materialParams}set fillMaterialParams(t){this.fillStyle={...this.fillStyle,materialParams:t}}get fillMaterialParamsChanged(){return this.fillStyleChanged}get fillGround(){return this.fillStyle.ground}set fillGround(t){this.fillStyle={...this.fillStyle,ground:t}}get fillGroundChanged(){return this.fillStyleChanged}};f(Rl,"createDefaultProps",()=>({...Ct.createDefaultProps(),pointed:!1,pointStyle:Bt({size:1,sizeType:"screen",color:[1,1,1,1],material:"",materialParams:{},outlineColor:[1,0,0,1],outlineWidth:1}),stroked:!1,strokeStyle:Bt({width:1,widthType:"screen",color:[1,1,1,1],material:"",materialParams:{},ground:!1}),filled:!1,fillStyle:Bt({color:[1,1,1,1],material:"",materialParams:{},ground:!1})})),f(Rl,"type",Rl.register("ESLocalVector",Rl,{chsName:"本地矢量",tags:["ESObjects"],description:"本地矢量对象"}));let Sl=Rl;const Yc=class Yc extends Sl{};f(Yc,"type",Yc.register("ESLocalVector2D",Yc,{chsName:"本地矢量2D",tags:["ESObjects"],description:"本地矢量2D对象"}));let vo=Yc;const ZO=[["固定朝向",0],["面向屏幕旋转",1],["绕自身Z轴旋转",2]],KO=[["单面不透明",0],["双面不透明",1],["单面遮罩",2],["双面遮罩",3],["单面透明",4],["双面透明",5],["单面未遮挡透明",6],["双面未遮挡透明",7]],Ll=class Ll extends Ct{constructor(){super(...arguments);f(this,"_widgetEvent",this.dv(new N))}get widgetEvent(){return this._widgetEvent}getESProperties(){const e={...super.getESProperties()};return{...e,basic:[...e.basic,new ot([this,"screenRender"],"屏幕渲染",!0),new ot([this,"sizeByContent"],"尺寸自适应",!0),new pn([this,"size"],"尺寸大小",[100,100]),new pn([this,"anchor"],"偏移比例",[.5,1]),new pn([this,"offset"],"像素偏移",[0,0]),new Wt([this,"renderMode"],KO,"渲染模式",0),new Wt([this,"rotationType"],ZO,"漫游旋转类型",1),new At([this,"actorTag"],"绑定对象"),new At([this,"socketName"],"插槽名称"),new Un([this,"positionOffset"],"位置偏移"),new Un([this,"rotationOffset"],"相对姿态")],more:[...e.more,new L([this,"zOrder"],"排序",0)]}}};f(Ll,"createDefaultProps",()=>({...Ct.createDefaultProps(),screenRender:!0,size:Ot([100,100]),anchor:Ot([.5,1]),offset:Ot([0,0]),sizeByContent:!0,renderMode:0,rotationType:1,zOrder:0,actorTag:"",socketName:"",positionOffset:Ot([0,0,0]),rotationOffset:Ot([0,0,0])})),f(Ll,"type",Ll.register("ESLabel",Ll,{chsName:"标签",tags:["ESObjects"],description:"标签对象"}));let Zr=Ll;const Fl=class Fl extends yt{constructor(t){super(t)}};f(Fl,"createDefaultProps",()=>({...yt.createDefaultProps(),show:!0,fillStyle:Bt({color:[1,1,1,1],material:"",materialParams:{},ground:!1})})),f(Fl,"type",Fl.register("ESTestObject",Fl,{chsName:"测试",tags:["ESObjects"],description:""}));let Pm=Fl;const Gs=class Gs extends ge{constructor(e){super(e);f(this,"_refreshTilesetEvent",this.dv(new N));f(this,"_tilesetReadyEvent",this.dv(new N));f(this,"_supportEdit",this.dv($(!0)));f(this,"_highlightFeatureEvent",this.dv(new N));f(this,"_highlightFeatureAndFlyToEvent",this.dv(new N));f(this,"_strokeFeatureEvent",this.disposeVar(new N));f(this,"_getFeatureTableEvent",this.dv(new N));f(this,"_featureTableResultEvent",this.dv(new N));f(this,"_getMaterialNameListEvent",this.disposeVar(new N));f(this,"_setFeatureStyleEvent",this.dv(new N));f(this,"_setFeatureColorEvent",this.dv(new N));f(this,"_setFeatureVisableEvent",this.dv(new N));f(this,"_resetFeatureStyleEvent",this.dv(new N));f(this,"setMaterialInfoEvent",this.ad(new N));f(this,"_setMaterialEvent",this.disposeVar(new N));f(this,"_clippingPlanesId",this.dv($("")));f(this,"_clippingPlaneIds",this.dv($([])));f(this,"_flattenedPlaneId",this.dv($("")));f(this,"_flattenedPlaneEnabled",this.dv($(!1)));f(this,"_clippingPlaneId",this.dv($("")));f(this,"_excavateId",this.dv(Ot([])))}updateEditing(){var e;(e=this.activeViewer)==null||e.startEditing(this,[vt.Translation,vt.Rotation],{callSource:"inner"})}get refreshTilesetEvent(){return this._refreshTilesetEvent}refreshTileset(){this._refreshTilesetEvent.emit()}get tilesetReady(){return this._tilesetReadyEvent}get supportEdit(){return this._supportEdit.value}set supportEdit(e){this._supportEdit.value=e}get supportEditChanged(){return this._supportEdit.changed}get highlightFeatureEvent(){return this._highlightFeatureEvent}highlightFeature(e,n){this._highlightFeatureEvent.emit(e,n)}get highlightFeatureAndFlyToEvent(){return this._highlightFeatureAndFlyToEvent}highlightFeatureAndFlyTo(e,n,i,s){this._highlightFeatureAndFlyToEvent.emit(e,n,i,s)}get strokeFeatureEvent(){return this._strokeFeatureEvent}strokeFeature(e,n=[1,0,0,1]){this._strokeFeatureEvent.emit(e,n)}get getFeatureTableEvent(){return this._getFeatureTableEvent}getFeatureTable(){return Promise.race([new Promise(e=>{const n=this.d(this._featureTableResultEvent.donce(e));this._getFeatureTableEvent.emit(),setTimeout(()=>{n(),e(void 0)},2e3)})])}get getMaterialNameListEvent(){return this._getMaterialNameListEvent}getMaterialNameList(){return new Promise(e=>{const n=new H;n.d(this.getMaterialNameListEvent.don(i=>{i!=="start"&&(n.destroy(),e(i))})),this.getMaterialNameListEvent.emit("start"),setTimeout(()=>{n.isDestroyed()||(n.destroy(),e(void 0))},2e3)})}get setFeatureStyleEvent(){return this._setFeatureStyleEvent}setFeatureStyle(e){this._setFeatureStyleEvent.emit(e)}get setFeatureColorEvent(){return this._setFeatureColorEvent}setFeatureColor(e,n){this._setFeatureColorEvent.emit(e,typeof n=="string"?JSON.parse(n):n)}get setFeatureVisableEvent(){return this._setFeatureVisableEvent}setFeatureVisable(e,n){this._setFeatureVisableEvent.emit(e,typeof n=="string"?JSON.parse(n):n)}get resetFeatureStyleEvent(){return this._resetFeatureStyleEvent}resetFeatureStyle(){this._resetFeatureStyleEvent.emit()}get setMaterialEvent(){return this._setMaterialEvent}setMaterial(e){return new Promise(n=>{const i=new H;i.ad(this.setMaterialInfoEvent.donce(s=>{i.destroy(),n(s)})),this._setMaterialEvent.emit(e)})}get clippingPlanesId(){return this._clippingPlanesId.value}set clippingPlanesId(e){this._clippingPlanesId.value=e}get clippingPlanesIdChanged(){return this._clippingPlanesId.changed}get clippingPlaneIds(){return this._clippingPlaneIds.value}set clippingPlaneIds(e){this._clippingPlaneIds.value=e}get clippingPlaneIdsChanged(){return this._clippingPlaneIds.changed}get flattenedPlaneId(){return this._flattenedPlaneId.value}set flattenedPlaneId(e){this._flattenedPlaneId.value=e}get flattenedPlaneIdChanged(){return this._flattenedPlaneId.changed}get flattenedPlaneEnabled(){return this._flattenedPlaneEnabled.value}set flattenedPlaneEnabled(e){this._flattenedPlaneEnabled.value=e}get flattenedPlaneEnabledChanged(){return this._flattenedPlaneEnabled.changed}get clippingPlaneId(){return this._clippingPlaneId.value}set clippingPlaneId(e){this._clippingPlaneId.value=e}get clippingPlaneIdChanged(){return this._clippingPlaneId.changed}get excavateId(){return this._excavateId.value}set excavateId(e){this._excavateId.value=e}get excavateIdChanged(){return this._excavateId.changed}setLight122(){this.czmEnvironmentMapManager={...bm}}getESProperties(){const e={...super.getESProperties()};return{...e,defaultMenu:"dataSource",basic:[...e.basic,new En([this,"maximumScreenSpaceError"],1,[0,256],"精度",16),new Wt([this,"materialMode"],[["常规","normal"],["科技感","technology"]],"材质模式","normal",!0),new Wt([this,"colorBlendMode"],[["默认","HIGHLIGHT"],["替换","REPLACE"],["混合","MIX"]],"颜色模式","HIGHLIGHT"),new Et([this,"materialOverrideMap"],"材质替换",Gs.defaults.materialOverrideMap)],dataSource:[...e.dataSource,new Et([this,"url"],"服务地址",Gs.defaults.url,void 0,!0)],coordinate:[...e.coordinate,new ot([this,"editing"],"编辑",!1,!0),new Un([this,"offset"],"偏移",[0,0,0],!0),new Zp([this,"rotation"],"旋转",[0,0,0])],more:[...e.more,new Et([this,"materialParams"],"materialParams",Gs.defaults.materialParams),new It(["string","string"],(n,i)=>this.highlightFeature(n,i),["","rgba(255,0,0,1)"],"highlightFeature"),new It(["string","string"],(n,i)=>this.setFeatureColor(n,i),["",""],"setFeatureColor"),new It(["string","string"],(n,i)=>this.setFeatureVisable(n,i),["",""],"setFeatureVisable"),new It([],()=>this.resetFeatureStyle(),[],"resetFeatureStyle"),new xt([],"ue"),new It([],()=>this.refreshTileset(),[],"refreshTileset"),new At([this,"actorTag"]),new ot([this,"highlight"],"是否高亮"),new Kt([this,"highlightColor"]),new L([this,"highlightID"]),new xt([],"czm"),new xt([],"可视化"),new pn([this,"czmImageBasedLightingFactor"],"反射强度"),new L([this,"czmAtmosphereScatteringIntensity"],"大气散射强度"),new Et([this,"czmEnvironmentMapManager"],"动态环境贴图管理器"),new L([this,"czmMaximumMemoryUsage"],"最大内存"),new xt([],"常用"),new Wt([this,"czmClassificationType"],[["NONE","NONE"],["TERRAIN","TERRAIN"],["CESIUM_3D_TILE","CESIUM_3D_TILE"],["BOTH","BOTH"]],"czmClassificationType","NONE",!0),new Et([this,"czmStyleJson"],"czmStyle"),new ot([this,"czmBackFaceCulling"]),new ot([this,"czmSkipLevelOfDetail"]),new ot([this,"czmDebugWireframe"]),new L([this,"cacheBytes"],"最大缓存",536870912),new xt([],"调试信息"),new ot([this,"czmDebugShowBoundingVolume"]),new ot([this,"czmDebugShowContentBoundingVolume"]),new xt([],"clippingPlanes"),new ot([this,"clippingPlaneEnabled"]),new ot([this,"unionClippingRegions"]),new Kt([this,"clippingPlaneEdgeColor"]),new L([this,"clippingPlaneEdgeWidth"])]}}};f(Gs,"createDefaultProps",()=>({...ge.createDefaultProps(),url:"",actorTag:"",materialMode:"normal",highlight:!1,maximumScreenSpaceError:16,highlightID:0,highlightColor:Ot([1,0,0,1]),offset:Oe([0,0,0]),rotation:Ot([0,0,0]),czmImageBasedLightingFactor:Ot([1,1]),czmEnvironmentMapManager:Ie(void 0),czmLuminanceAtZenith:2,czmAtmosphereScatteringIntensity:2,czmMaximumMemoryUsage:512,czmClassificationType:"NONE",czmStyleJson:Bt({}),czmBackFaceCulling:!0,czmDebugShowBoundingVolume:!1,czmDebugShowContentBoundingVolume:!1,czmSkipLevelOfDetail:!1,cacheBytes:536870912,colorBlendMode:"HIGHLIGHT",clippingPlaneEnabled:!0,unionClippingRegions:!0,clippingPlaneEdgeColor:Ot([1,1,1,1]),clippingPlaneEdgeWidth:2,materialParams:{baseColor:[0,.5,1]},allowPicking:!0,materialOverrideMap:Ie({}),featureIdLabel:0,splitDirection:"NONE",czmDebugWireframe:!1})),f(Gs,"type",Gs.register("ES3DTileset",Gs,{chsName:"3DTileset",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"3DTileset"})),f(Gs,"supportEditingModes",[...ge.supportEditingModes,vt.Translation,vt.Rotation]);let bi=Gs;const kl=class kl extends Ct{constructor(e){super(e);f(this,"_isFlyInCreated",this.dv($(!1)));f(this,"_readyEvent",this.dv(new N));this.collision=!1,this.d(this.createdEvent.don(()=>{setTimeout(()=>{if((this.editing??!1)||!this.position)this.d(Js([this.positionChanged,this.editingChanged],()=>{this.editing||!this.position||this.isFlyInCreated&&this.flyTo()},{time:"donce"}));else{if(!this.isFlyInCreated)return;this.flyTo()}},1e3)}))}get isFlyInCreated(){return this._isFlyInCreated.value}set isFlyInCreated(e){this._isFlyInCreated.value=e}get isFlyInCreatedChanged(){return this._isFlyInCreated.changed}get readyEvent(){return this._readyEvent}getESProperties(){const e={...super.getESProperties()};return{...e,basic:[...e.basic,new Wt([this,"mode"],[["柱状警告","cylinder"],["圆形警告","circle"]],"模式","cylinder"),new L([this,"radius"],"半径",10)]}}};f(kl,"createDefaultProps",()=>({...Ct.createDefaultProps(),mode:"cylinder",radius:10})),f(kl,"type",kl.register("ESAlarm",kl,{chsName:"报警",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"警告类"}));let xm=kl;const QO=[["扫描","scan"],["扩散","diffuse"]],ha=class ha extends Ct{constructor(t){super(t)}getESProperties(){const t={...super.getESProperties()};return{...t,basic:[...t.basic,new L([this,"radius"],"半径",1),new Wt([this,"mode"],QO,"模式",ha.defaults.mode),new Kt([this,"color"],"颜色",ha.defaults.color)]}}};f(ha,"createDefaultProps",()=>({...Ct.createDefaultProps(),radius:1,mode:"scan",color:[0,.7,1,1],collision:!1})),f(ha,"type",ha.register("ESApertureEffect",ha,{chsName:"光圈特效",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"光圈特效"}));let Im=ha;const ru=class ru extends Ht{constructor(e){super(e);f(this,"editingBindMode","circular")}getESProperties(){const e={...super.getESProperties()};return{...e,coordinate:[...e.coordinate,new L([this,"area"],"面积",0,!1,!0),new L([this,"perimeter"],"周长",0,!1,!0)]}}};f(ru,"createDefaultProps",()=>({...Ht.createDefaultProps(),fillStyle:Bt({color:[1,1,1,.5],material:"",materialParams:{},ground:!1}),strokeStyle:Bt({width:1,widthType:"screen",color:[1,1,1,1],material:"",materialParams:{},ground:!1}),filled:!0,stroked:!1,collision:!1})),f(ru,"type",ru.register("ESGeoPolygon",ru,{chsName:"地理多边形",tags:["ESObjects"],description:"地理多边形"})),f(ru,"supportEditingModes",[...Ht.supportEditingModes,vt.CircularAppend,vt.CircularInsert]);let Ee=ru;const Eo=class Eo extends Ee{get fillMaterial(){return this.fillStyle.material}set fillMaterial(t){this.fillStyle={...this.fillStyle,material:t}}get fillMaterialParams(){return this.fillStyle?this.fillStyle.materialParams:Eo.defaults.fillStyle.materialParams}set fillMaterialParams(t){this.fillStyle={...this.fillStyle??Eo.defaults.fillStyle,materialParams:t??Eo.defaults.fillStyle.materialParams}}constructor(t){super(t)}};f(Eo,"createDefaultProps",()=>({...Ee.createDefaultProps(),stroked:!0,filled:!0,units:Ot(["SquareMeter_SquareKilometer","MU_Hectare","PerimeterMeter_PerimeterKilometer"]),fillStyle:Bt({color:[1,1,1,1],material:"Material'/EarthSDKForUE/M_ES_Material.M_ES_Material'",materialParams:{Opacity:.4},ground:!0}),strokeStyle:Bt({width:2,widthType:"screen",color:[1,1,1,1],material:"",materialParams:{},ground:!1})})),f(Eo,"type",Eo.register("ESAreaMeasurement",Eo,{chsName:"面积测量",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE","_ES_Impl_Ol"],description:"面积测量"}));let Mm=Eo;const Gl=class Gl extends Ct{constructor(t){super(t)}getESProperties(){const t={...super.getESProperties()};return{...t,defaultMenu:"general",more:[...t.more,new xt([],"czm"),new Ih([this,"image"],"图片"),new Un([this,"translation"],"偏移")]}}};f(Gl,"createDefaultProps",()=>({...Ct.createDefaultProps(),image:"${earthsdk3-assets-script-dir}/assets/img/smoke.png",translation:Ot([0,0,0])})),f(Gl,"type",Gl.register("ESBlastParticleSystem",Gl,{chsName:"粒子爆炸",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"粒子爆炸"}));let Tm=Gl;const os=class os extends Ct{constructor(t){super(t)}getESProperties(){const t={...super.getESProperties()};return{...t,basic:[...t.basic,new ot([this,"reverse"],"反转",os.defaults.reverse),new Un([this,"size"],"尺寸",os.defaults.size),new Kt([this,"edgeColor"],"边框颜色",os.defaults.edgeColor),new L([this,"edgeWidth"],"边框宽度",os.defaults.edgeWidth),new At([this,"targetID"],"瓦片图层",os.defaults.targetID)]}}};f(os,"createDefaultProps",()=>({...Ct.createDefaultProps(),reverse:!1,edgeColor:Ot([1,1,1,1]),edgeWidth:2,size:Ot([10,10,10]),targetID:""})),f(os,"type",os.register("ESBoxClipping",os,{chsName:"体剖切",tags:["ESObjects","_ES_Impl_Cesium"],description:"体剖切,体裁剪,体裁切,盒裁切"}));let Nm=os;const Jc=class Jc extends Ct{constructor(){super(...arguments);f(this,"_thumbnail",this.dv($("")));f(this,"_duration",this.dv($(1)));f(this,"_resetWithCurrentCameraEvent",this.dv(new N));f(this,"_captureEvent",this.dv(new N))}get thumbnail(){return this._thumbnail.value}set thumbnail(e){this._thumbnail.value=e}get thumbnailChanged(){return this._thumbnail.changed}get duration(){return this._duration.value}set duration(e){this._duration.value=e}get durationChanged(){return this._duration.changed}flyIn(e=1,n="default"){this.flyInEvent.emit(e,-1,n)}get resetWithCurrentCameraEvent(){return this._resetWithCurrentCameraEvent}resetWithCurrentCamera(){this._resetWithCurrentCameraEvent.emit()}get captureEvent(){return this._captureEvent}capture(e,n){this._captureEvent.emit(e,n)}execOnCreating(){this.resetWithCurrentCamera()}async initByCurrent(){this.resetWithCurrentCamera()}getESProperties(){const e={...super.getESProperties()};return{...e,more:[...e.more,new xt([],"ESCameraView"),new It([],()=>this.resetWithCurrentCamera(),[],"设置为当前视角"),new It(["number","number"],(n,i)=>this.capture(n,i),[64,64],"获取缩略图"),new At([this,"thumbnail"],"缩略图","",!0),new L([this,"duration"],"飞行时间",1,!0)]}}};f(Jc,"type",Jc.register("ESCameraView",Jc,{chsName:"视角",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"视角"}));let Pf=Jc;class xf extends H{constructor(e,n,i){super();f(this,"_view",this.dv(new Pf));if(this.d(e.components.disposableAdd(this._view)),this._view.name=(i==null?void 0:i.name)??`视角${e.views.length+1}`,n){const a=this._view,u=n;a.duration=u.duration??1,a.position=u.position,a.rotation=u.rotation??[0,0,0],a.thumbnail=u.thumbnail??"",a.name=u.name}else{const a=(i==null?void 0:i.size)??[64,64];this.d(Pu(()=>{this._view.resetWithCurrentCamera(),this._view.capture(a[0],a[1])}))}const s=this._view,o=this.dv(nn(s.durationChanged,s.positionChanged,s.rotationChanged,s.thumbnailChanged,s.nameChanged));this.d(o.don(()=>e.emitViewsWarpper()))}get view(){return this._view}get viewInfo(){const e=this._view;return{duration:e.duration,position:e.position,rotation:e.rotation,thumbnail:e.thumbnail,name:e.name}}}const Pi=class Pi extends yt{constructor(e){super(e);f(this,"_currentViewIndex",this.dv($(-1)));f(this,"_viewWrappers",this.dv(new yh));f(this,"_currentViewWrapper",this.dv($(void 0)));f(this,"_container",this.dv($(void 0)));this.initProcessing();{const n=()=>{if(!this._currentViewWrapper.value)return;this._viewWrappers.indexOf(this._currentViewWrapper.value)===-1&&(this._currentViewWrapper.value=void 0)};n(),this.d(this._viewWrappers.changedEvent.don(n))}{const n=()=>{const i=this._currentViewWrapper.value;this._currentViewIndex.value=i?this._getIndex(i):-1};n(),this.d(this._viewWrappers.changedEvent.don(n)),this.d(this._currentViewWrapper.changed.don(n))}this.d(()=>{this.clearAllViews()})}get json(){return{...this._innerGetJson(),views:this.views}}set json(e){this._innerSetJson(e),this.views=e.views}get currentViewIndex(){return this._currentViewIndex.value}get currentViewIndexChanged(){return this._currentViewIndex.changed}emitViewsWarpper(){this._viewWrappers.changedEvent.emit(this._viewWrappers)}get container(){return this._container.value}get containerChanged(){return this._container.changed}set container(e){this._container.value=e}get views(){return Jw(this._viewWrappers,e=>e.viewInfo)}get viewsChanged(){return this._viewWrappers.changedEvent}set views(e){if(e.length===this._viewWrappers.length){const n=this._viewWrappers;if(e.every((i,s)=>{const o=n.get(s).view;return i.duration===o.duration&&Sm(i.position,o.position)&&Sm(i.rotation,o.rotation)&&i.thumbnail===o.thumbnail&&i.name===o.name}))return}this.clearAllViews();for(let n of e)this._viewWrappers.push(new xf(this,n))}_getIndex(e){return this._viewWrappers.indexOf(e)}clearAllViews(){for(let e of this._viewWrappers)e.destroy();this._viewWrappers.length=0}add(e=`视角${this.views.length+1}`,n=[64,64]){this._viewWrappers.push(new xf(this,void 0,{name:e,size:n}))}update(e,n,i=[64,64]){if(e>=this._viewWrappers.length||e<0)return console.warn("index >= this._viewWrappers.length || index < 0"),!1;const s=this._viewWrappers.get(e);return n&&(s.view.name=n),s.view.resetWithCurrentCamera(),s.view.capture(i[0],i[1]),!0}addView(){this._viewWrappers.push(new xf(this))}insertView(e){if(this._viewWrappers.length+1<=e||e<0){console.error("this._views.length <= index || index < 0");return}this._viewWrappers.splice(e,0,new xf(this))}setCurrentView(e){if(e>=this._viewWrappers.length||e<0)return console.warn("index >= this._viewWrappers.length || index < 0"),!1;const n=this._viewWrappers.get(e);return this._currentViewWrapper.value=n,!0}resetView(e){if(e>=this._viewWrappers.length||e<0){console.warn("index >= this._viewWrappers.length || index < 0");return}const n=this._viewWrappers.get(e);n.view.resetWithCurrentCamera(),n.view.capture()}resetViewName(e,n){if(e>=this._viewWrappers.length||e<0){console.warn("index >= this._viewWrappers.length || index < 0");return}const i=this._viewWrappers.get(e);i.view.name=n}updateView(e,n){if(e>=this._viewWrappers.length||e<0)return console.warn("index >= this._viewWrappers.length || index < 0"),!1;const i=this._viewWrappers.get(e);return i.view.position=n.position,i.view.rotation=n.rotation??[0,0,0],i.view.duration=n.duration??1,i.view.thumbnail=n.thumbnail??"",i.view.name=n.name??"",!0}flyToView(e){if(this.setCurrentView(e)){if(!this._currentViewWrapper.value)throw new Error("this._currentViewWrapper.value");const n=this._currentViewWrapper.value.view.duration;this._currentViewWrapper.value.view.flyIn(n,this.flyMode??Pi.defaults.flyMode)}}flyToPrevView(){const e=this._currentViewWrapper.value;if(!e)return this.flyToView(0),!0;const n=this._getIndex(e);return this.loop??Pi.defaults.loop?(this.flyToView((this._viewWrappers.length+n-1)%this._viewWrappers.length),!0):n-1<0?!1:(this.flyToView(n-1),!0)}moveToPreView(){const e=this._currentViewWrapper.value;if(!e)return;const n=this._getIndex(e);if(n===0)return;const i=this._viewWrappers.splice(n-1,1,e)[0];this._viewWrappers.set(n,i)}moveToNextView(){const e=this._currentViewWrapper.value;if(!e)return;const n=this._getIndex(e);if(n===this._viewWrappers.length-1)return;const i=this._viewWrappers.splice(n+1,1,e)[0];this._viewWrappers.set(n,i)}flyToNextView(){const e=this._currentViewWrapper.value;if(!e)return this.flyToView(0),!0;const n=this._getIndex(e);return this.loop??Pi.defaults.loop?(this.flyToView((n+1)%this._viewWrappers.length),!0):n+1>this._viewWrappers.length-1?!1:(this.flyToView(n+1),!0)}stop(){this._currentViewWrapper.value=void 0,this.playing=!1}deleteView(e){if(e<0||e>=this._viewWrappers.length){console.warn("index < 0 || index >= this._viewWrappers.length");return}this._viewWrappers.get(e).destroy(),this._viewWrappers.splice(e,1)}deleteCurrentView(){const e=this._currentViewWrapper.value;if(!e){console.warn("!this._currentViewWrapper.value");return}const n=this._getIndex(e);if(n===-1){console.warn("index === -1");return}this.deleteView(n)}transitionImageUrl(e){return yt.context.getStrFromEnv(e)}_flyStep(e){var o;if(!this.flyToNextView())return this.playing=!1,Promise.resolve();const n=this.intervalTime??Pi.defaults.intervalTime,s=((((o=this._currentViewWrapper.value)==null?void 0:o.viewInfo.duration)??0)+n)*1e3;return e.promise(Sh(s)).then(()=>this._flyStep(e))}initProcessing(){const e=this.dv(Gr(async i=>this._flyStep(i))),n=()=>{this.playing?e.restart():e.cancel()};n(),this.d(this.playingChanged.don(n))}getESProperties(){const e={...super.getESProperties()};return{...e,more:[...e.more,new Wt([this,"flyMode"],[["默认","default"],["直线飞行","uniform"]],"飞行模式",Pi.defaults.flyMode),new It([],()=>this.addView(),[],"添加视角"),new It(["number"],n=>this.insertView(n),[0],"插入视角"),new It([],()=>this.clearAllViews(),[],"清空所有视角"),new It([],()=>this.insertView(this.currentViewIndex+1),[],"当前位置插入视角"),new It([],()=>this.flyToPrevView(),[],"上一个视角"),new It([],()=>this.flyToNextView(),[],"下一个视角"),new It([],()=>this.moveToPreView(),[],"当前视角移动到上一个视角"),new It([],()=>this.moveToNextView(),[],"当前视角移动到下一个视角"),new It(["number"],n=>this.flyToView(n),[0],"飞入指定视角"),new It(["number"],n=>this.setCurrentView(n),[0],"设置当前视角"),new It([],()=>this.deleteCurrentView(),[],"删除当前视角"),new It(["number"],n=>this.deleteView(n),[0],"删除指定视角"),new It(["number"],n=>this.resetView(n),[0],"重置视角"),new L([this,"currentViewIndex"],"当前序号",-1,!1,!0),new P0([this,"playing"],()=>this.stop(),[this,"loop"],"播放",Pi.defaults),new ot([this,"playing"],"是否播放"),new It([],()=>this.stop(),[],"停止"),new ot([this,"loop"],"是否循环"),new L([this,"intervalTime"],"间隔时间"),new Et([this,"views"],"视角集合",[],void 0,!0)]}}};f(Pi,"createDefaultProps",()=>({...yt.createDefaultProps(),playing:!1,loop:!0,intervalTime:5,flyMode:"default"})),f(Pi,"type",Pi.register("ESCameraViewCollection",Pi,{chsName:"视角集合",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"视角集合"}));let If=Pi;const jl=class jl extends Ct{constructor(e){super(e);f(this,"editingBindMode","doublePoints")}getESProperties(){const e={...super.getESProperties()};return{...e,basic:[...e.basic,new L([this,"aspectRatio"],"宽高比",1.77778),new L([this,"fov"],"横向夹角",90),new L([this,"far"],"视野长度",100),new L([this,"near"],"近面距离",5)]}}};f(jl,"createDefaultProps",()=>({...Ct.createDefaultProps(),fov:90,aspectRatio:1.77778,far:100,near:5,collision:!1})),f(jl,"type",jl.register("ESCameraVisibleRange",jl,{chsName:"摄像头可视域",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"摄像头可视域"}));let Om=jl;const Vl=class Vl extends Ct{constructor(t){super(t)}getESProperties(){const t={...super.getESProperties()};return{...t,basic:[...t.basic,new Wt([this,"mode"],[["警车","policeCar"]],"模式","policeCar")]}}};f(Vl,"createDefaultProps",()=>({...Ct.createDefaultProps(),mode:"policeCar",allowPicking:!0})),f(Vl,"type",Vl.register("ESCar",Vl,{chsName:"车辆",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"警车等基础车辆模型"}));let Mf=Vl;const iu=class iu extends Ht{constructor(e){super(e);f(this,"editingBindMode","circular")}getESProperties(){const e={...super.getESProperties()};return{...e,basic:[...e.basic,new L([this,"height"],"高度",10)],coordinate:[...e.coordinate,new L([this,"area"],"面积",0,!1,!0),new L([this,"perimeter"],"周长",0,!1,!0)]}}};f(iu,"createDefaultProps",()=>({...Ht.createDefaultProps(),height:10,filled:!0,fillStyle:Bt({material:"",materialParams:{},ground:!0,color:[1,1,1,1]})})),f(iu,"type",iu.register("ESClassification",iu,{chsName:"倾斜单体化",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"平尾箭头"})),f(iu,"supportEditingModes",[...Ht.supportEditingModes,vt.CircularAppend,vt.CircularInsert,vt.HeightModify]);let Tf=iu;const Bl=class Bl extends Ct{constructor(t){super(t)}getESProperties(){const t={...super.getESProperties()};return{...t,basic:[...t.basic,new ot([this,"showArrow"],"显示箭头",!0),new Kt([this,"edgeColor"],"线框颜色",[1,1,1,1]),new L([this,"edgetWidth"],"线框宽度",2),new L([this,"width"],"裁剪宽度",200),new L([this,"height"],"裁剪高度",200),new At([this,"targetID"],"瓦片图层","")]}}};f(Bl,"createDefaultProps",()=>({...Ct.createDefaultProps(),showArrow:!0,edgeColor:Ot([1,1,1,1]),edgetWidth:2,width:200,height:200,targetID:""})),f(Bl,"type",Bl.register("ESClippingPlane",Bl,{chsName:"裁切",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"ESClippingPlane"}));let Dm=Bl;class t4 extends H{constructor(t,e,n){super();const i=document.createElement("div");i.setAttribute("xe2-div",`ESCustomDiv(${e.id})(viewer: ${n.id}) container`);{const u=()=>{const h=` ${e.cssText}
|
|
69
69
|
${e.cssAllInitial?"all: initial;":""}
|
|
70
70
|
${e.show?"":"display: none"}
|
|
71
71
|
`;i.style.cssText=h};u();const l=this.dv(nn(e.cssAllInitialChanged,e.cssTextChanged,e.showChanged));this.d(l.don(u))}t.appendChild(i),this.d(()=>t.removeChild(i));const s=this.dv(nn(e.instanceClassChanged,e.containerChanged,e.shadowDomChanged)),o=this.dv(new Je(s,()=>{const{instanceClass:u,container:l}=e;if(!u||l)return;let h=i;if(i.firstElementChild&&i.removeChild(i.firstElementChild),e.shadowDom){const c=i.appendChild(document.createElement("div"));c.setAttribute("xe2-div",`ESCustomDiv(${e.id})(viewer: ${n.id}) container shadowDiv`),h=c.attachShadow({mode:"open"}).appendChild(document.createElement("div")),h.setAttribute("xe2-div",`ESCustomDiv(${e.id})(viewer: ${n.id}) container shadowDiv div`)}return new u(h,e,n)})),{_updateEvent:a}=e;this.d(a.don(u=>{if(o.obj)try{u(o.obj,e,n)}catch(l){console.error(`ESCustomDiv update error! ${l}`)}}))}}const rE=`class MyDiv {
|