mirage2d 1.1.90 → 1.1.91

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.
@@ -82,7 +82,7 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
82
82
 
83
83
  See the Apache Version 2.0 License for specific language governing permissions
84
84
  and limitations under the License.
85
- ***************************************************************************** */var AS=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function fS(t,e){return t>e?1:t<e?-1:0}function pS(t,e,r){for(var n=new AS(null,null),i=n,o=n;;){var s=r(t,e.key);if(s<0){if(null===e.left)break;if(r(t,e.left.key)<0){var a=e.left;if(e.left=a.right,a.right=e,null===(e=a).left)break}o.left=e,o=e,e=e.left}else{if(!(s>0))break;if(null===e.right)break;if(r(t,e.right.key)>0&&(a=e.right,e.right=a.left,a.left=e,null===(e=a).right))break;i.right=e,i=e,e=e.right}}return i.right=e.left,o.left=e.right,e.left=n.right,e.right=n.left,e}function dS(t,e,r,n){var i=new AS(t,e);if(null===r)return i.left=i.right=null,i;var o=n(t,(r=pS(t,r,n)).key);return o<0?(i.left=r.left,i.right=r,r.left=null):o>=0&&(i.right=r.right,i.left=r,r.right=null),i}function gS(t,e,r){var n=null,i=null;if(e){var o=r((e=pS(t,e,r)).key,t);0===o?(n=e.left,i=e.right):o<0?(i=e.right,e.right=null,n=e):(n=e.left,e.left=null,i=e)}return{left:n,right:i}}function yS(t,e,r,n,i){if(t){n(e+(r?"└── ":"├── ")+i(t)+"\n");var o=e+(r?" ":"│ ");t.left&&yS(t.left,o,!1,n,i),t.right&&yS(t.right,o,!0,n,i)}}var mS=function(){function t(t){void 0===t&&(t=fS),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=dS(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var r=new AS(t,e);null===this._root&&(r.left=r.right=null,this._size++,this._root=r);var n=this._comparator,i=pS(t,this._root,n),o=n(t,i.key);return 0===o?this._root=i:(o<0?(r.left=i.left,r.right=i,i.left=null):o>0&&(r.right=i.right,r.left=i,i.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,r){var n;return null===e?null:0===r(t,(e=pS(t,e,r)).key)?(null===e.left?n=e.right:(n=pS(t,e.left,r)).right=e.right,this._size--,n):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=pS(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.prototype.findStatic=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return e;e=n<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=pS(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.prototype.contains=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return!0;e=n<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){for(var r=this._root,n=[],i=!1;!i;)null!==r?(n.push(r),r=r.left):0!==n.length?(r=n.pop(),t.call(e,r),r=r.right):i=!0;return this},t.prototype.range=function(t,e,r,n){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&r.call(n,s))return this;s=s.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var r=e.key;return t.push(r)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var r=e.data;return t.push(r)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},t.prototype.at=function(t){for(var e=this._root,r=!1,n=0,i=[];!r;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),n===t)return e;n++,e=e.right}else r=!0;return null},t.prototype.next=function(t){var e=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?(r=e,e=e.left):e=e.right}return r},t.prototype.prev=function(t){var e=this._root,r=null;if(null!==t.left){for(r=t.left;r.right;)r=r.right;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?e=e.left:(r=e,e=e.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){for(var e=t,r=[],n=!1,i=new AS(null,null),o=i;!n;)e?(r.push(e),e=e.left):r.length>0?e=(e=o=o.next=r.pop()).right:n=!0;return o.next=null,i.next}(this._root)},t.prototype.load=function(t,e,r){void 0===e&&(e=[]),void 0===r&&(r=!1);var n=t.length,i=this._comparator;if(r&&wS(t,e,0,n-1,i),null===this._root)this._root=vS(t,e,0,n),this._size=n;else{var o=function(t,e,r){for(var n=new AS(null,null),i=n,o=t,s=e;null!==o&&null!==s;)r(o.key,s.key)<0?(i.next=o,o=o.next):(i.next=s,s=s.next),i=i.next;return null!==o?i.next=o:null!==s&&(i.next=s),n.next}(this.toList(),function(t,e){for(var r=new AS(null,null),n=r,i=0;i<t.length;i++)n=n.next=new AS(t[i],e[i]);return n.next=null,r.next}(t,e),i);n=this._size+n,this._root=_S({head:o},0,n)}return this},t.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return yS(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},t.prototype.update=function(t,e,r){var n=this._comparator,i=gS(t,this._root,n),o=i.left,s=i.right;n(t,e)<0?s=dS(e,r,s,n):o=dS(e,r,o,n),this._root=function(t,e,r){return null===e?t:(null===t||((e=pS(t.key,e,r)).left=t),e)}(o,s,n)},t.prototype.split=function(t){return gS(t,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var t;return function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(dX){o=[6,dX],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}(this,(function(e){switch(e.label){case 0:t=this.minNode(),e.label=1;case 1:return t?[4,t]:[3,3];case 2:return e.sent(),t=this.next(t),[3,1];case 3:return[2]}}))},t}();function vS(t,e,r,n){var i=n-r;if(i>0){var o=r+Math.floor(i/2),s=t[o],a=e[o],l=new AS(s,a);return l.left=vS(t,e,r,o),l.right=vS(t,e,o+1,n),l}return null}function _S(t,e,r){var n=r-e;if(n>0){var i=e+Math.floor(n/2),o=_S(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=_S(t,i+1,r),s}return null}function wS(t,e,r,n,i){if(!(r>=n)){for(var o=t[r+n>>1],s=r-1,a=n+1;;){do{s++}while(i(t[s],o)<0);do{a--}while(i(t[a],o)>0);if(s>=a)break;var l=t[s];t[s]=t[a],t[a]=l,l=e[s],e[s]=e[a],e[a]=l}wS(t,e,r,a,i),wS(t,e,a+1,n,i)}}function bS(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xS(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ES(t,e,r){return e&&xS(t.prototype,e),r&&xS(t,r),t}var CS=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},SS=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var r=t.ll.x<e.ll.x?e.ll.x:t.ll.x,n=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:r,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:n,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},BS=Number.EPSILON;void 0===BS&&(BS=Math.pow(2,-52));var IS=BS*BS,PS=function(t,e){if(-BS<t&&t<BS&&-BS<e&&e<BS)return 0;var r=t-e;return r*r<IS*t*e?0:t<e?-1:1},TS=function(){function t(){bS(this,t),this.reset()}return ES(t,[{key:"reset",value:function(){this.xRounder=new FS,this.yRounder=new FS}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),t}(),FS=function(){function t(){bS(this,t),this.tree=new mS,this.round(0)}return ES(t,[{key:"round",value:function(t){var e=this.tree.add(t),r=this.tree.prev(e);if(null!==r&&0===PS(e.key,r.key))return this.tree.remove(t),r.key;var n=this.tree.next(e);return null!==n&&0===PS(e.key,n.key)?(this.tree.remove(t),n.key):t}}]),t}(),MS=new TS,LS=function(t,e){return t.x*e.y-t.y*e.x},OS=function(t,e){return t.x*e.x+t.y*e.y},NS=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y},o=LS(n,i);return PS(o,0)},RS=function(t){return Math.sqrt(OS(t,t))},kS=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y};return OS(i,n)/RS(i)/RS(n)},US=function(t,e,r){return 0===e.y?null:{x:t.x+e.x/e.y*(r-t.y),y:r}},DS=function(t,e,r){return 0===e.x?null:{x:r,y:t.y+e.y/e.x*(r-t.x)}},GS=function(){function t(e,r){bS(this,t),void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return ES(t,null,[{key:"compare",value:function(e,r){var n=t.comparePoints(e.point,r.point);return 0!==n?n:(e.point!==r.point&&e.link(r),e.isLeft!==r.isLeft?e.isLeft?1:-1:jS.compare(e.segment,r.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),ES(t,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,r=0,n=e.length;r<n;r++){var i=e[r];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var r=this.point.events[e];if(void 0===r.segment.consumedBy)for(var n=e+1;n<t;n++){var i=this.point.events[n];void 0===i.consumedBy&&r.otherSE.point.events===i.otherSE.point.events&&r.segment.consume(i.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,r=this.point.events.length;e<r;e++){var n=this.point.events[e];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&t.push(n)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,r=new Map,n=function(n){var i,o,s,a,l,u=n.otherSE;r.set(n,{sine:(i=e.point,o=t.point,s=u.point,a={x:o.x-i.x,y:o.y-i.y},l={x:s.x-i.x,y:s.y-i.y},LS(l,a)/RS(l)/RS(a)),cosine:kS(e.point,t.point,u.point)})};return function(t,e){r.has(t)||n(t),r.has(e)||n(e);var i=r.get(t),o=i.sine,s=i.cosine,a=r.get(e),l=a.sine,u=a.cosine;return o>=0&&l>=0?s<u?1:s>u?-1:0:o<0&&l<0?s<u?-1:s>u?1:0:l<o?-1:l>o?1:0}}}]),t}(),QS=0,jS=function(){function t(e,r,n,i){bS(this,t),this.id=++QS,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=n,this.windings=i}return ES(t,null,[{key:"compare",value:function(t,e){var r=t.leftSE.point.x,n=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<r)return 1;if(i<n)return-1;var s=t.leftSE.point.y,a=e.leftSE.point.y,l=t.rightSE.point.y,u=e.rightSE.point.y;if(r<n){if(a<s&&a<l)return 1;if(a>s&&a>l)return-1;var h=t.comparePoint(e.leftSE.point);if(h<0)return 1;if(h>0)return-1;var c=e.comparePoint(t.rightSE.point);return 0!==c?c:-1}if(r>n){if(s<a&&s<u)return-1;if(s>a&&s>u)return 1;var A=e.comparePoint(t.leftSE.point);if(0!==A)return A;var f=t.comparePoint(e.rightSE.point);return f<0?1:f>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){var p=e.comparePoint(t.rightSE.point);if(0!==p)return p}if(i>o){var d=t.comparePoint(e.rightSE.point);if(d<0)return 1;if(d>0)return-1}if(i!==o){var g=l-s,y=i-r,m=u-a,v=o-n;if(g>y&&m<v)return 1;if(g<y&&m>v)return-1}return i>o?1:i<o||l<u?-1:l>u?1:t.id<e.id?-1:t.id>e.id?1:0}}]),ES(t,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var 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}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(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}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,r=this.rightSE.point,n=this.vector();if(e.x===r.x)return t.x===e.x?0:t.x<e.x?1:-1;var i=(t.y-e.y)/n.y,o=e.x+i*n.x;if(t.x===o)return 0;var s=(t.x-e.x)/n.x,a=e.y+s*n.y;return t.y===a?0:t.y<a?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),r=t.bbox(),n=SS(e,r);if(null===n)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,l=CS(e,s)&&0===this.comparePoint(s),u=CS(r,i)&&0===t.comparePoint(i),h=CS(e,a)&&0===this.comparePoint(a),c=CS(r,o)&&0===t.comparePoint(o);if(u&&l)return c&&!h?o:!c&&h?a:null;if(u)return h&&i.x===a.x&&i.y===a.y?null:i;if(l)return c&&o.x===s.x&&o.y===s.y?null:s;if(c&&h)return null;if(c)return o;if(h)return a;var A=function(t,e,r,n){if(0===e.x)return DS(r,n,t.x);if(0===n.x)return DS(t,e,r.x);if(0===e.y)return US(r,n,t.y);if(0===n.y)return US(t,e,r.y);var i=LS(e,n);if(0==i)return null;var o={x:r.x-t.x,y:r.y-t.y},s=LS(o,e)/i,a=LS(o,n)/i;return{x:(t.x+a*e.x+(r.x+s*n.x))/2,y:(t.y+a*e.y+(r.y+s*n.y))/2}}(i,this.vector(),s,t.vector());return null===A?null:CS(n,A)?MS.round(A.x,A.y):null}},{key:"split",value:function(e){var r=[],n=void 0!==e.events,i=new GS(e,!0),o=new GS(e,!1),s=this.rightSE;this.replaceRightSE(o),r.push(o),r.push(i);var a=new t(i,s,this.rings.slice(),this.windings.slice());return GS.comparePoints(a.leftSE.point,a.rightSE.point)>0&&a.swapEvents(),GS.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),r}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,r=this.windings.length;e<r;e++)this.windings[e]*=-1}},{key:"consume",value:function(e){for(var r=this,n=e;r.consumedBy;)r=r.consumedBy;for(;n.consumedBy;)n=n.consumedBy;var i=t.compare(r,n);if(0!==i){if(i>0){var o=r;r=n,n=o}if(r.prev===n){var s=r;r=n,n=s}for(var a=0,l=n.rings.length;a<l;a++){var u=n.rings[a],h=n.windings[a],c=r.rings.indexOf(u);-1===c?(r.rings.push(u),r.windings.push(h)):r.windings[c]+=h}n.rings=null,n.windings=null,n.consumedBy=r,n.leftSE.consumedBy=r.leftSE,n.rightSE.consumedBy=r.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,r=this._afterState.windings,n=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],a=this.windings[i],l=e.indexOf(s);-1===l?(e.push(s),r.push(a)):r[l]+=a}for(var u=[],h=[],c=0,A=e.length;c<A;c++)if(0!==r[c]){var f=e[c],p=f.poly;if(-1===h.indexOf(p))if(f.isExterior)u.push(p);else{-1===h.indexOf(p)&&h.push(p);var d=u.indexOf(f.poly);-1!==d&&u.splice(d,1)}}for(var g=0,y=u.length;g<y;g++){var m=u[g].multiPoly;-1===n.indexOf(m)&&n.push(m)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch($S.type){case"union":var r=0===t.length,n=0===e.length;this._isInResult=r!==n;break;case"intersection":var i,o;t.length<e.length?(i=t.length,o=e.length):(i=e.length,o=t.length),this._isInResult=o===$S.numMultiPolys&&i<o;break;case"xor":var s=Math.abs(t.length-e.length);this._isInResult=s%2==1;break;case"difference":var a=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=a(t)!==a(e);break;default:throw new Error("Unrecognized operation type found ".concat($S.type))}return this._isInResult}}],[{key:"fromRing",value:function(e,r,n){var i,o,s,a=GS.comparePoints(e,r);if(a<0)i=e,o=r,s=1;else{if(!(a>0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));i=r,o=e,s=-1}return new t(new GS(i,!0),new GS(o,!1),[n],[s])}}]),t}(),HS=function(){function t(e,r,n){if(bS(this,t),!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=n,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=MS.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,s=1,a=e.length;s<a;s++){if("number"!=typeof e[s][0]||"number"!=typeof e[s][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var l=MS.round(e[s][0],e[s][1]);l.x===o.x&&l.y===o.y||(this.segments.push(jS.fromRing(o,l,this)),l.x<this.bbox.ll.x&&(this.bbox.ll.x=l.x),l.y<this.bbox.ll.y&&(this.bbox.ll.y=l.y),l.x>this.bbox.ur.x&&(this.bbox.ur.x=l.x),l.y>this.bbox.ur.y&&(this.bbox.ur.y=l.y),o=l)}i.x===o.x&&i.y===o.y||this.segments.push(jS.fromRing(o,i,this))}return ES(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.segments.length;e<r;e++){var n=this.segments[e];t.push(n.leftSE),t.push(n.rightSE)}return t}}]),t}(),zS=function(){function t(e,r){if(bS(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new HS(e[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(var n=1,i=e.length;n<i;n++){var o=new HS(e[n],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=r}return ES(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,r=this.interiorRings.length;e<r;e++)for(var n=this.interiorRings[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),VS=function(){function t(e,r){if(bS(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof e[0][0][0]&&(e=[e])}catch(s){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var n=0,i=e.length;n<i;n++){var o=new zS(e[n],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=r}return ES(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++)for(var n=this.polys[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),KS=function(){function t(e){bS(this,t),this.events=e;for(var r=0,n=e.length;r<n;r++)e[r].segment.ringOut=this;this.poly=null}return ES(t,null,[{key:"factory",value:function(e){for(var r=[],n=0,i=e.length;n<i;n++){var o=e[n];if(o.isInResult()&&!o.ringOut){for(var s=null,a=o.leftSE,l=o.rightSE,u=[a],h=a.point,c=[];s=a,a=l,u.push(a),a.point!==h;)for(;;){var A=a.getAvailableLinkedEvents();if(0===A.length){var f=u[0].point,p=u[u.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(f.x,",")+" ".concat(f.y,"]. Last matching segment found ends at")+" [".concat(p.x,", ").concat(p.y,"]."))}if(1===A.length){l=A[0].otherSE;break}for(var d=null,g=0,y=c.length;g<y;g++)if(c[g].point===a.point){d=g;break}if(null===d){c.push({index:u.length,point:a.point});var m=a.getLeftmostComparator(s);l=A.sort(m)[0].otherSE;break}var v=c.splice(d)[0],_=u.splice(v.index);_.unshift(_[0].otherSE),r.push(new t(_.reverse()))}r.push(new t(u))}}return r}}]),ES(t,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],r=1,n=this.events.length-1;r<n;r++){var i=this.events[r].point,o=this.events[r+1].point;0!==NS(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],a=e[1];0===NS(s,t,a)&&e.shift(),e.push(e[0]);for(var l=this.isExteriorRing()?1:-1,u=this.isExteriorRing()?0:e.length-1,h=this.isExteriorRing()?e.length:-1,c=[],A=u;A!=h;A+=l)c.push([e[A].x,e[A].y]);return c}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,r=this.events.length;e<r;e++){var n=this.events[e];GS.compare(t,n)>0&&(t=n)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),t}(),qS=function(){function t(e){bS(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return ES(t,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,r=this.interiorRings.length;e<r;e++){var n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}}]),t}(),WS=function(){function t(e){bS(this,t),this.rings=e,this.polys=this._composePolys(e)}return ES(t,[{key:"getGeom",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++){var n=this.polys[e].getGeom();null!==n&&t.push(n)}return t}},{key:"_composePolys",value:function(t){for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r];if(!i.poly)if(i.isExteriorRing())e.push(new qS(i));else{var o=i.enclosingRing();o.poly||e.push(new qS(o)),o.poly.addInterior(i)}}return e}}]),t}(),XS=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jS.compare;bS(this,t),this.queue=e,this.tree=new mS(r),this.segments=[]}return ES(t,[{key:"process",value:function(t){var e=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),r;var n=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!n)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=n,o=n,s=void 0,a=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===a;)null===(o=this.tree.next(o))?a=null:void 0===o.key.consumedBy&&(a=o.key);if(t.isLeft){var l=null;if(s){var u=s.getIntersection(e);if(null!==u&&(e.isAnEndpoint(u)||(l=u),!s.isAnEndpoint(u)))for(var h=this._splitSafely(s,u),c=0,A=h.length;c<A;c++)r.push(h[c])}var f=null;if(a){var p=a.getIntersection(e);if(null!==p&&(e.isAnEndpoint(p)||(f=p),!a.isAnEndpoint(p)))for(var d=this._splitSafely(a,p),g=0,y=d.length;g<y;g++)r.push(d[g])}if(null!==l||null!==f){var m;m=null===l?f:null===f||GS.comparePoints(l,f)<=0?l:f,this.queue.remove(e.rightSE),r.push(e.rightSE);for(var v=e.split(m),_=0,w=v.length;_<w;_++)r.push(v[_])}r.length>0?(this.tree.remove(e),r.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&a){var b=s.getIntersection(a);if(null!==b){if(!s.isAnEndpoint(b))for(var x=this._splitSafely(s,b),E=0,C=x.length;E<C;E++)r.push(x[E]);if(!a.isAnEndpoint(b))for(var S=this._splitSafely(a,b),B=0,I=S.length;B<I;B++)r.push(S[B])}}this.tree.remove(e)}return r}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var r=t.rightSE;this.queue.remove(r);var n=t.split(e);return n.push(r),void 0===t.consumedBy&&this.tree.insert(t),n}}]),t}(),YS="undefined"!=typeof process&&{}.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,ZS="undefined"!=typeof process&&{}.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,JS=function(){function t(){bS(this,t)}return ES(t,[{key:"run",value:function(t,e,r){$S.type=t,MS.reset();for(var n=[new VS(e,!0)],i=0,o=r.length;i<o;i++)n.push(new VS(r[i],!1));if($S.numMultiPolys=n.length,"difference"===$S.type)for(var s=n[0],a=1;a<n.length;)null!==SS(n[a].bbox,s.bbox)?a++:n.splice(a,1);if("intersection"===$S.type)for(var l=0,u=n.length;l<u;l++)for(var h=n[l],c=l+1,A=n.length;c<A;c++)if(null===SS(h.bbox,n[c].bbox))return[];for(var f=new mS(GS.compare),p=0,d=n.length;p<d;p++)for(var g=n[p].getSweepEvents(),y=0,m=g.length;y<m;y++)if(f.insert(g[y]),f.size>YS)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var v=new XS(f),_=f.size,w=f.pop();w;){var b=w.key;if(f.size===_){var x=b.segment;throw new Error("Unable to pop() ".concat(b.isLeft?"left":"right"," SweepEvent ")+"[".concat(b.point.x,", ").concat(b.point.y,"] from segment #").concat(x.id," ")+"[".concat(x.leftSE.point.x,", ").concat(x.leftSE.point.y,"] -> ")+"[".concat(x.rightSE.point.x,", ").concat(x.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(f.size>YS)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(v.segments.length>ZS)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var E=v.process(b),C=0,S=E.length;C<S;C++){var B=E[C];void 0===B.consumedBy&&f.insert(B)}_=f.size,w=f.pop()}MS.reset();var I=KS.factory(v.segments);return new WS(I).getGeom()}}]),t}(),$S=new JS;const tB={union:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return $S.run("union",t,r)},intersection:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return $S.run("intersection",t,r)},xor:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return $S.run("xor",t,r)},difference:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return $S.run("difference",t,r)}};"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(null==this)throw new TypeError(this+" is not an object");var e=Object(this),r=Math.max(Math.min(e.length,9007199254740991),0)||0,n=1 in arguments&&parseInt(Number(arguments[1]),10)||0;n=n<0?Math.max(r+n,0):Math.min(n,r);var i=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:r;for(i=i<0?Math.max(r+arguments[2],0):Math.min(i,r);n<i;)e[n]=t,++n;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};var eB=function(){};eB.prototype.interfaces_=function(){return[]},eB.prototype.getClass=function(){return eB},eB.prototype.equalsWithTolerance=function(t,e,r){return Math.abs(t-e)<=r};var rB=function(t){function e(e){t.call(this,e),this.name="IllegalArgumentException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),nB=function(){},iB={MAX_VALUE:{configurable:!0}};nB.isNaN=function(t){return Number.isNaN(t)},nB.doubleToLongBits=function(t){return t},nB.longBitsToDouble=function(t){return t},nB.isInfinite=function(t){return!Number.isFinite(t)},iB.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(nB,iB);var oB=function(){},sB=function(){},aB=function(){};function lB(){}var uB=function t(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)this.x=0,this.y=0,this.z=t.NULL_ORDINATE;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.z=e.z}else 2===arguments.length?(this.x=arguments[0],this.y=arguments[1],this.z=t.NULL_ORDINATE):3===arguments.length&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},hB={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};uB.prototype.setOrdinate=function(t,e){switch(t){case uB.X:this.x=e;break;case uB.Y:this.y=e;break;case uB.Z:this.z=e;break;default:throw new rB("Invalid ordinate index: "+t)}},uB.prototype.equals2D=function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!eB.equalsWithTolerance(this.x,e.x,r)&&!!eB.equalsWithTolerance(this.y,e.y,r)}},uB.prototype.getOrdinate=function(t){switch(t){case uB.X:return this.x;case uB.Y:return this.y;case uB.Z:return this.z}throw new rB("Invalid ordinate index: "+t)},uB.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||nB.isNaN(this.z))&&nB.isNaN(t.z)},uB.prototype.equals=function(t){return t instanceof uB&&this.equals2D(t)},uB.prototype.equalInZ=function(t,e){return eB.equalsWithTolerance(this.z,t.z,e)},uB.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},uB.prototype.clone=function(){},uB.prototype.copy=function(){return new uB(this)},uB.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},uB.prototype.distance3D=function(t){var e=this.x-t.x,r=this.y-t.y,n=this.z-t.z;return Math.sqrt(e*e+r*r+n*n)},uB.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},uB.prototype.hashCode=function(){var t=17;return 37*(t=37*t+uB.hashCode(this.x))+uB.hashCode(this.y)},uB.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},uB.prototype.interfaces_=function(){return[oB,sB,lB]},uB.prototype.getClass=function(){return uB},uB.hashCode=function(){if(1===arguments.length){var t=arguments[0],e=nB.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}},hB.DimensionalComparator.get=function(){return cB},hB.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},hB.NULL_ORDINATE.get=function(){return nB.NaN},hB.X.get=function(){return 0},hB.Y.get=function(){return 1},hB.Z.get=function(){return 2},Object.defineProperties(uB,hB);var cB=function(t){if(this._dimensionsToTest=2,0===arguments.length);else if(1===arguments.length){var e=arguments[0];if(2!==e&&3!==e)throw new rB("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};cB.prototype.compare=function(t,e){var r=t,n=e,i=cB.compare(r.x,n.x);if(0!==i)return i;var o=cB.compare(r.y,n.y);return 0!==o?o:this._dimensionsToTest<=2?0:cB.compare(r.z,n.z)},cB.prototype.interfaces_=function(){return[aB]},cB.prototype.getClass=function(){return cB},cB.compare=function(t,e){return t<e?-1:t>e?1:nB.isNaN(t)?nB.isNaN(e)?0:-1:nB.isNaN(e)?1:0};var AB=function(){};AB.prototype.create=function(){},AB.prototype.interfaces_=function(){return[]},AB.prototype.getClass=function(){return AB};var fB=function(){},pB={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};fB.prototype.interfaces_=function(){return[]},fB.prototype.getClass=function(){return fB},fB.toLocationSymbol=function(t){switch(t){case fB.EXTERIOR:return"e";case fB.BOUNDARY:return"b";case fB.INTERIOR:return"i";case fB.NONE:return"-"}throw new rB("Unknown location value: "+t)},pB.INTERIOR.get=function(){return 0},pB.BOUNDARY.get=function(){return 1},pB.EXTERIOR.get=function(){return 2},pB.NONE.get=function(){return-1},Object.defineProperties(fB,pB);var dB=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},gB=function(){},yB={LOG_10:{configurable:!0}};gB.prototype.interfaces_=function(){return[]},gB.prototype.getClass=function(){return gB},gB.log10=function(t){var e=Math.log(t);return nB.isInfinite(e)||nB.isNaN(e)?e:e/gB.LOG_10},gB.min=function(t,e,r,n){var i=t;return e<i&&(i=e),r<i&&(i=r),n<i&&(i=n),i},gB.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],r=arguments[2];return t<e?e:t>r?r:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var n=arguments[0],i=arguments[1],o=arguments[2];return n<i?i:n>o?o:n}},gB.wrap=function(t,e){return t<0?e- -t%e:t%e},gB.max=function(){if(3===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[0];return t>r&&(r=t),e>r&&(r=e),r}if(4===arguments.length){var n=arguments[1],i=arguments[2],o=arguments[3],s=arguments[0];return n>s&&(s=n),i>s&&(s=i),o>s&&(s=o),s}},gB.average=function(t,e){return(t+e)/2},yB.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(gB,yB);var mB=function(t){this.str=t};mB.prototype.append=function(t){this.str+=t},mB.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},mB.prototype.toString=function(t){return this.str};var vB=function(t){this.value=t};vB.prototype.intValue=function(){return this.value},vB.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},vB.isNaN=function(t){return Number.isNaN(t)};var _B=function(){};_B.isWhitespace=function(t){return t<=32&&t>=0||127===t},_B.toUpperCase=function(t){return t.toUpperCase()};var wB=function t(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length)if("number"==typeof arguments[0]){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}else"string"==typeof arguments[0]&&t.call(this,t.parse(arguments[0]));else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n,i)}},bB={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}};wB.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},wB.prototype.extractSignificantDigits=function(t,e){var r=this.abs(),n=wB.magnitude(r._hi),i=wB.TEN.pow(n);(r=r.divide(i)).gt(wB.TEN)?(r=r.divide(wB.TEN),n+=1):r.lt(wB.ONE)&&(r=r.multiply(wB.TEN),n-=1);for(var o=n+1,s=new mB,a=wB.MAX_PRINT_DIGITS-1,l=0;l<=a;l++){t&&l===o&&s.append(".");var u=Math.trunc(r._hi);if(u<0)break;var h=!1,c=0;u>9?(h=!0,c="9"):c="0"+u,s.append(c),r=r.subtract(wB.valueOf(u)).multiply(wB.TEN),h&&r.selfAdd(wB.TEN);var A=!0,f=wB.magnitude(r._hi);if(f<0&&Math.abs(f)>=a-l&&(A=!1),!A)break}return e[0]=n,s.toString()},wB.prototype.sqr=function(){return this.multiply(this)},wB.prototype.doubleValue=function(){return this._hi+this._lo},wB.prototype.subtract=function(){if(arguments[0]instanceof wB){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},wB.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},wB.prototype.isZero=function(){return 0===this._hi&&0===this._lo},wB.prototype.selfSubtract=function(){if(arguments[0]instanceof wB){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},wB.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},wB.prototype.min=function(t){return this.le(t)?this:t},wB.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof wB){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var r,n,i,o,s=arguments[0],a=arguments[1],l=null,u=null,h=null,c=null;return i=this._hi/s,c=(l=(h=wB.SPLIT*i)-(l=h-i))*(u=(c=wB.SPLIT*s)-(u=c-s))-(o=i*s)+l*(n=s-u)+(r=i-l)*u+r*n,c=i+(h=(this._hi-o-c+this._lo-i*a)/s),this._hi=c,this._lo=i-c+h,this}},wB.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},wB.prototype.divide=function(){if(arguments[0]instanceof wB){var t,e,r,n,i=arguments[0],o=null,s=null,a=null,l=null;return t=(r=this._hi/i._hi)-(o=(a=wB.SPLIT*r)-(o=a-r)),l=o*(s=(l=wB.SPLIT*i._hi)-(s=l-i._hi))-(n=r*i._hi)+o*(e=i._hi-s)+t*s+t*e,a=(this._hi-n-l+this._lo-r*i._lo)/i._hi,new wB(l=r+a,r-l+a)}if("number"==typeof arguments[0]){var u=arguments[0];return nB.isNaN(u)?wB.createNaN():wB.copy(this).selfDivide(u,0)}},wB.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},wB.prototype.pow=function(t){if(0===t)return wB.valueOf(1);var e=new wB(this),r=wB.valueOf(1),n=Math.abs(t);if(n>1)for(;n>0;)n%2==1&&r.selfMultiply(e),(n/=2)>0&&(e=e.sqr());else r=e;return t<0?r.reciprocal():r},wB.prototype.ceil=function(){if(this.isNaN())return wB.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new wB(t,e)},wB.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},wB.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},wB.prototype.setValue=function(){if(arguments[0]instanceof wB){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},wB.prototype.max=function(t){return this.ge(t)?this:t},wB.prototype.sqrt=function(){if(this.isZero())return wB.valueOf(0);if(this.isNegative())return wB.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,r=wB.valueOf(e),n=this.subtract(r.sqr())._hi*(.5*t);return r.add(n)},wB.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof wB){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e,r,n,i,o,s=arguments[0],a=null;return a=(n=this._hi+s)-(i=n-this._hi),r=(o=(a=s-i+(this._hi-a))+this._lo)+(n-(e=n+o)),this._hi=e+r,this._lo=r+(e-this._hi),this}}else if(2===arguments.length){var l,u,h,c,A=arguments[0],f=arguments[1],p=null,d=null,g=null;h=this._hi+A,u=this._lo+f,d=h-(g=h-this._hi),p=u-(c=u-this._lo);var y=(l=h+(g=(d=A-g+(this._hi-d))+u))+(g=(p=f-c+(this._lo-p))+(g+(h-l))),m=g+(l-y);return this._hi=y,this._lo=m,this}},wB.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof wB){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var r,n,i=arguments[0],o=arguments[1],s=null,a=null,l=null,u=null;s=(l=wB.SPLIT*this._hi)-this._hi,u=wB.SPLIT*i,s=l-s,r=this._hi-s,a=u-i;var h=(l=this._hi*i)+(u=s*(a=u-a)-l+s*(n=i-a)+r*a+r*n+(this._hi*o+this._lo*i)),c=u+(s=l-h);return this._hi=h,this._lo=c,this}},wB.prototype.selfSqr=function(){return this.selfMultiply(this)},wB.prototype.floor=function(){if(this.isNaN())return wB.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new wB(t,e)},wB.prototype.negate=function(){return this.isNaN()?this:new wB(-this._hi,-this._lo)},wB.prototype.clone=function(){},wB.prototype.multiply=function(){if(arguments[0]instanceof wB){var t=arguments[0];return t.isNaN()?wB.createNaN():wB.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return nB.isNaN(e)?wB.createNaN():wB.copy(this).selfMultiply(e,0)}},wB.prototype.isNaN=function(){return nB.isNaN(this._hi)},wB.prototype.intValue=function(){return Math.trunc(this._hi)},wB.prototype.toString=function(){var t=wB.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},wB.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!0,e),n=e[0]+1,i=r;if("."===r.charAt(0))i="0"+r;else if(n<0)i="0."+wB.stringOfChar("0",-n)+r;else if(-1===r.indexOf(".")){var o=n-r.length;i=r+wB.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},wB.prototype.reciprocal=function(){var t,e,r,n,i=null,o=null,s=null,a=null;t=(r=1/this._hi)-(i=(s=wB.SPLIT*r)-(i=s-r)),o=(a=wB.SPLIT*this._hi)-this._hi;var l=r+(s=(1-(n=r*this._hi)-(a=i*(o=a-o)-n+i*(e=this._hi-o)+t*o+t*e)-r*this._lo)/this._hi);return new wB(l,r-l+s)},wB.prototype.toSciNotation=function(){if(this.isZero())return wB.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!1,e),n=wB.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===r.charAt(0))throw new Error("Found leading zero: "+r);var i="";r.length>1&&(i=r.substring(1));var o=r.charAt(0)+"."+i;return this.isNegative()?"-"+o+n:o+n},wB.prototype.abs=function(){return this.isNaN()?wB.NaN:this.isNegative()?this.negate():new wB(this)},wB.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},wB.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},wB.prototype.add=function(){if(arguments[0]instanceof wB){var t=arguments[0];return wB.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return wB.copy(this).selfAdd(e)}},wB.prototype.init=function(){if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof wB){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._hi=r,this._lo=n}},wB.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},wB.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},wB.prototype.trunc=function(){return this.isNaN()?wB.NaN:this.isPositive()?this.floor():this.ceil()},wB.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},wB.prototype.interfaces_=function(){return[lB,oB,sB]},wB.prototype.getClass=function(){return wB},wB.sqr=function(t){return wB.valueOf(t).selfMultiply(t)},wB.valueOf=function(){if("string"==typeof arguments[0]){var t=arguments[0];return wB.parse(t)}if("number"==typeof arguments[0])return new wB(arguments[0])},wB.sqrt=function(t){return wB.valueOf(t).sqrt()},wB.parse=function(t){for(var e=0,r=t.length;_B.isWhitespace(t.charAt(e));)e++;var n=!1;if(e<r){var i=t.charAt(e);"-"!==i&&"+"!==i||(e++,"-"===i&&(n=!0))}for(var o=new wB,s=0,a=0,l=0;!(e>=r);){var u=t.charAt(e);if(e++,_B.isDigit(u)){var h=u-"0";o.selfMultiply(wB.TEN),o.selfAdd(h),s++}else{if("."!==u){if("e"===u||"E"===u){var c=t.substring(e);try{l=vB.parseInt(c)}catch(g){throw g instanceof Error?new Error("Invalid exponent "+c+" in string "+t):g}break}throw new Error("Unexpected character '"+u+"' at position "+e+" in string "+t)}a=s}}var A=o,f=s-a-l;if(0===f)A=o;else if(f>0){var p=wB.TEN.pow(f);A=o.divide(p)}else if(f<0){var d=wB.TEN.pow(-f);A=o.multiply(d)}return n?A.negate():A},wB.createNaN=function(){return new wB(nB.NaN,nB.NaN)},wB.copy=function(t){return new wB(t)},wB.magnitude=function(t){var e=Math.abs(t),r=Math.log(e)/Math.log(10),n=Math.trunc(Math.floor(r));return 10*Math.pow(10,n)<=e&&(n+=1),n},wB.stringOfChar=function(t,e){for(var r=new mB,n=0;n<e;n++)r.append(t);return r.toString()},bB.PI.get=function(){return new wB(3.141592653589793,12246467991473532e-32)},bB.TWO_PI.get=function(){return new wB(6.283185307179586,24492935982947064e-32)},bB.PI_2.get=function(){return new wB(1.5707963267948966,6123233995736766e-32)},bB.E.get=function(){return new wB(2.718281828459045,14456468917292502e-32)},bB.NaN.get=function(){return new wB(nB.NaN,nB.NaN)},bB.EPS.get=function(){return 123259516440783e-46},bB.SPLIT.get=function(){return 134217729},bB.MAX_PRINT_DIGITS.get=function(){return 32},bB.TEN.get=function(){return wB.valueOf(10)},bB.ONE.get=function(){return wB.valueOf(1)},bB.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},bB.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(wB,bB);var xB=function(){},EB={DP_SAFE_EPSILON:{configurable:!0}};xB.prototype.interfaces_=function(){return[]},xB.prototype.getClass=function(){return xB},xB.orientationIndex=function(t,e,r){var n=xB.orientationIndexFilter(t,e,r);if(n<=1)return n;var i=wB.valueOf(e.x).selfAdd(-t.x),o=wB.valueOf(e.y).selfAdd(-t.y),s=wB.valueOf(r.x).selfAdd(-e.x),a=wB.valueOf(r.y).selfAdd(-e.y);return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},xB.signOfDet2x2=function(t,e,r,n){return t.multiply(n).selfSubtract(e.multiply(r)).signum()},xB.intersection=function(t,e,r,n){var i=wB.valueOf(n.y).selfSubtract(r.y).selfMultiply(wB.valueOf(e.x).selfSubtract(t.x)),o=wB.valueOf(n.x).selfSubtract(r.x).selfMultiply(wB.valueOf(e.y).selfSubtract(t.y)),s=i.subtract(o),a=wB.valueOf(n.x).selfSubtract(r.x).selfMultiply(wB.valueOf(t.y).selfSubtract(r.y)),l=wB.valueOf(n.y).selfSubtract(r.y).selfMultiply(wB.valueOf(t.x).selfSubtract(r.x)),u=a.subtract(l).selfDivide(s).doubleValue(),h=wB.valueOf(t.x).selfAdd(wB.valueOf(e.x).selfSubtract(t.x).selfMultiply(u)).doubleValue(),c=wB.valueOf(e.x).selfSubtract(t.x).selfMultiply(wB.valueOf(t.y).selfSubtract(r.y)),A=wB.valueOf(e.y).selfSubtract(t.y).selfMultiply(wB.valueOf(t.x).selfSubtract(r.x)),f=c.subtract(A).selfDivide(s).doubleValue(),p=wB.valueOf(r.y).selfAdd(wB.valueOf(n.y).selfSubtract(r.y).selfMultiply(f)).doubleValue();return new uB(h,p)},xB.orientationIndexFilter=function(t,e,r){var n=null,i=(t.x-r.x)*(e.y-r.y),o=(t.y-r.y)*(e.x-r.x),s=i-o;if(i>0){if(o<=0)return xB.signum(s);n=i+o}else{if(!(i<0))return xB.signum(s);if(o>=0)return xB.signum(s);n=-i-o}var a=xB.DP_SAFE_EPSILON*n;return s>=a||-s>=a?xB.signum(s):2},xB.signum=function(t){return t>0?1:t<0?-1:0},EB.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(xB,EB);var CB=function(){},SB={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};SB.X.get=function(){return 0},SB.Y.get=function(){return 1},SB.Z.get=function(){return 2},SB.M.get=function(){return 3},CB.prototype.setOrdinate=function(t,e,r){},CB.prototype.size=function(){},CB.prototype.getOrdinate=function(t,e){},CB.prototype.getCoordinate=function(){},CB.prototype.getCoordinateCopy=function(t){},CB.prototype.getDimension=function(){},CB.prototype.getX=function(t){},CB.prototype.clone=function(){},CB.prototype.expandEnvelope=function(t){},CB.prototype.copy=function(){},CB.prototype.getY=function(t){},CB.prototype.toCoordinateArray=function(){},CB.prototype.interfaces_=function(){return[sB]},CB.prototype.getClass=function(){return CB},Object.defineProperties(CB,SB);var BB=function(){},IB=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(BB),PB=function(){};PB.arraycopy=function(t,e,r,n,i){for(var o=0,s=e;s<e+i;s++)r[n+o]=t[s],o++},PB.getProperty=function(t){return{"line.separator":"\n"}[t]};var TB=function t(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this.x=r,this.y=n,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var i=arguments[0],o=arguments[1];this.x=i.y*o.w-o.y*i.w,this.y=o.x*i.w-i.x*o.w,this.w=i.x*o.y-o.x*i.y}else if(arguments[0]instanceof uB&&arguments[1]instanceof uB){var s=arguments[0],a=arguments[1];this.x=s.y-a.y,this.y=a.x-s.x,this.w=s.x*a.y-a.x*s.y}}else if(3===arguments.length){var l=arguments[0],u=arguments[1],h=arguments[2];this.x=l,this.y=u,this.w=h}else if(4===arguments.length){var c=arguments[0],A=arguments[1],f=arguments[2],p=arguments[3],d=c.y-A.y,g=A.x-c.x,y=c.x*A.y-A.x*c.y,m=f.y-p.y,v=p.x-f.x,_=f.x*p.y-p.x*f.y;this.x=g*_-v*y,this.y=m*y-d*_,this.w=d*v-m*g}};TB.prototype.getY=function(){var t=this.y/this.w;if(nB.isNaN(t)||nB.isInfinite(t))throw new IB;return t},TB.prototype.getX=function(){var t=this.x/this.w;if(nB.isNaN(t)||nB.isInfinite(t))throw new IB;return t},TB.prototype.getCoordinate=function(){var t=new uB;return t.x=this.getX(),t.y=this.getY(),t},TB.prototype.interfaces_=function(){return[]},TB.prototype.getClass=function(){return TB},TB.intersection=function(t,e,r,n){var i=t.y-e.y,o=e.x-t.x,s=t.x*e.y-e.x*t.y,a=r.y-n.y,l=n.x-r.x,u=r.x*n.y-n.x*r.y,h=i*l-a*o,c=(o*u-l*s)/h,A=(a*s-i*u)/h;if(nB.isNaN(c)||nB.isInfinite(c)||nB.isNaN(A)||nB.isInfinite(A))throw new IB;return new uB(c,A)};var FB=function t(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof uB){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(4===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2],l=arguments[3];this.init(o,s,a,l)}},MB={serialVersionUID:{configurable:!0}};FB.prototype.getArea=function(){return this.getWidth()*this.getHeight()},FB.prototype.equals=function(t){if(!(t instanceof FB))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()},FB.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new FB;var e=this._minx>t._minx?this._minx:t._minx,r=this._miny>t._miny?this._miny:t._miny,n=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new FB(e,n,r,i)},FB.prototype.isNull=function(){return this._maxx<this._minx},FB.prototype.getMaxX=function(){return this._maxx},FB.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof uB){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof FB){var e=arguments[0];return!this.isNull()&&!e.isNull()&&e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&r>=this._minx&&r<=this._maxx&&n>=this._miny&&n<=this._maxy}},FB.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof FB){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof uB){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&!(r>this._maxx||r<this._minx||n>this._maxy||n<this._miny)}},FB.prototype.getMinY=function(){return this._miny},FB.prototype.getMinX=function(){return this._minx},FB.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof uB){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof FB){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(2===arguments.length){var r=arguments[0],n=arguments[1];this.isNull()?(this._minx=r,this._maxx=r,this._miny=n,this._maxy=n):(r<this._minx&&(this._minx=r),r>this._maxx&&(this._maxx=r),n<this._miny&&(this._miny=n),n>this._maxy&&(this._maxy=n))}},FB.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},FB.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},FB.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},FB.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},FB.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},FB.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},FB.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},FB.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},FB.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=r,this._maxy+=r,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},FB.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof FB){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof uB){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.covers(r,n)}},FB.prototype.centre=function(){return this.isNull()?null:new uB((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},FB.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof uB){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof FB){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.init(r.x,n.x,r.y,n.y)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];i<o?(this._minx=i,this._maxx=o):(this._minx=o,this._maxx=i),s<a?(this._miny=s,this._maxy=a):(this._miny=a,this._maxy=s)}},FB.prototype.getMaxY=function(){return this._maxy},FB.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 r=0;return this._maxy<t._miny?r=t._miny-this._maxy:this._miny>t._maxy&&(r=this._miny-t._maxy),0===e?r:0===r?e:Math.sqrt(e*e+r*r)},FB.prototype.hashCode=function(){var t=17;return 37*(t=37*(t=37*(t=37*t+uB.hashCode(this._minx))+uB.hashCode(this._maxx))+uB.hashCode(this._miny))+uB.hashCode(this._maxy)},FB.prototype.interfaces_=function(){return[oB,lB]},FB.prototype.getClass=function(){return FB},FB.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2];return r.x>=(t.x<e.x?t.x:e.x)&&r.x<=(t.x>e.x?t.x:e.x)&&r.y>=(t.y<e.y?t.y:e.y)&&r.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),l=Math.max(o.x,s.x),u=Math.min(n.x,i.x),h=Math.max(n.x,i.x);return!(u>l||h<a||(a=Math.min(o.y,s.y),l=Math.max(o.y,s.y),u=Math.min(n.y,i.y),h=Math.max(n.y,i.y),u>l||h<a))}},MB.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(FB,MB);var LB={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*$/},OB=function(t){this.geometryFactory=t||new _P};OB.prototype.read=function(t){var e,r,n;t=t.replace(/[\n\r]/g," ");var i=LB.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((i=LB.emptyTypeStr.exec(t))[2]=void 0),i&&(r=i[1].toLowerCase(),n=i[2],RB[r]&&(e=RB[r].apply(this,[n]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},OB.prototype.write=function(t){return this.extractGeometry(t)},OB.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!NB[e])return null;var r=e.toUpperCase();return t.isEmpty()?r+" EMPTY":r+"("+NB[e].apply(this,[t])+")"};var NB={coordinate:function(t){return t.x+" "+t.y},point:function(t){return NB.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+NB.point.apply(this,[t._geometries[r]])+")");return e.join(",")},linestring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(NB.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},linearring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(NB.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},multilinestring:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+NB.linestring.apply(this,[t._geometries[r]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+NB.linestring.apply(this,[t._shell])+")");for(var r=0,n=t._holes.length;r<n;++r)e.push("("+NB.linestring.apply(this,[t._holes[r]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+NB.polygon.apply(this,[t._geometries[r]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push(this.extractGeometry(t._geometries[r]));return e.join(",")}},RB={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(LB.spaces);return this.geometryFactory.createPoint(new uB(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPoint();for(var r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(LB.trimParens,"$1"),n.push(RB.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(n)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(LB.spaces),n.push(new uB(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(n)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(LB.spaces),n.push(new uB(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(n)},multilinestring:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiLineString();for(var r=t.trim().split(LB.parenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(LB.trimParens,"$1"),n.push(RB.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(n)},polygon:function(t){var e,r,n;if(void 0===t)return this.geometryFactory.createPolygon();for(var i,o=t.trim().split(LB.parenComma),s=[],a=0,l=o.length;a<l;++a)e=o[a].replace(LB.trimParens,"$1"),r=RB.linestring.apply(this,[e]),n=this.geometryFactory.createLinearRing(r._points),0===a?i=n:s.push(n);return this.geometryFactory.createPolygon(i,s)},multipolygon:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var r=t.trim().split(LB.doubleParenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(LB.trimParens,"$1"),n.push(RB.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(n)},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection();for(var e=(t=t.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),r=[],n=0,i=e.length;n<i;++n)r.push(this.read(e[n]));return this.geometryFactory.createGeometryCollection(r)}},kB=function(t){this.parser=new OB(t)};kB.prototype.write=function(t){return this.parser.write(t)},kB.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var UB=function(t){function e(e){t.call(this,e),this.name="RuntimeException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),DB=function(t){function e(){if(t.call(this),0===arguments.length)t.call(this);else if(1===arguments.length){var e=arguments[0];t.call(this,e)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(UB),GB=function(){};GB.prototype.interfaces_=function(){return[]},GB.prototype.getClass=function(){return GB},GB.shouldNeverReachHere=function(){if(0===arguments.length)GB.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new DB("Should never reach here"+(null!==t?": "+t:""))}},GB.isTrue=function(){var t,e;if(1===arguments.length)t=arguments[0],GB.isTrue(t,null);else if(2===arguments.length&&(e=arguments[1],!(t=arguments[0])))throw null===e?new DB:new DB(e)},GB.equals=function(){var t,e,r;if(2===arguments.length)t=arguments[0],e=arguments[1],GB.equals(t,e,null);else if(3===arguments.length&&(t=arguments[0],r=arguments[2],!(e=arguments[1]).equals(t)))throw new DB("Expected "+t+" but encountered "+e+(null!==r?": "+r:""))};var QB=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 uB,this._intPt[1]=new uB,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},jB={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};QB.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},QB.prototype.getTopologySummary=function(){var t=new mB;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},QB.prototype.computeIntersection=function(t,e,r,n){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=r,this._inputLines[1][1]=n,this._result=this.computeIntersect(t,e,r,n)},QB.prototype.getIntersectionNum=function(){return this._result},QB.prototype.computeIntLineIndex=function(){if(0===arguments.length)null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){var t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},QB.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},QB.prototype.setPrecisionModel=function(t){this._precisionModel=t},QB.prototype.isInteriorIntersection=function(){var t=this;if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var e=arguments[0],r=0;r<this._result;r++)if(!t._intPt[r].equals2D(t._inputLines[e][0])&&!t._intPt[r].equals2D(t._inputLines[e][1]))return!0;return!1}},QB.prototype.getIntersection=function(t){return this._intPt[t]},QB.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},QB.prototype.hasIntersection=function(){return this._result!==QB.NO_INTERSECTION},QB.prototype.getEdgeDistance=function(t,e){return QB.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},QB.prototype.isCollinear=function(){return this._result===QB.COLLINEAR_INTERSECTION},QB.prototype.toString=function(){return kB.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+kB.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},QB.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},QB.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},QB.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},QB.prototype.interfaces_=function(){return[]},QB.prototype.getClass=function(){return QB},QB.computeEdgeDistance=function(t,e,r){var n=Math.abs(r.x-e.x),i=Math.abs(r.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(r))o=n>i?n:i;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=n>i?s:a)||t.equals(e)||(o=Math.max(s,a))}return GB.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},QB.nonRobustComputeEdgeDistance=function(t,e,r){var n=t.x-e.x,i=t.y-e.y,o=Math.sqrt(n*n+i*i);return GB.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},jB.DONT_INTERSECT.get=function(){return 0},jB.DO_INTERSECT.get=function(){return 1},jB.COLLINEAR.get=function(){return 2},jB.NO_INTERSECTION.get=function(){return 0},jB.POINT_INTERSECTION.get=function(){return 1},jB.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(QB,jB);var HB=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(t){var e=new FB(this._inputLines[0][0],this._inputLines[0][1]),r=new FB(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&r.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],r=arguments[1],n=arguments[2];if(this._isProper=!1,FB.intersects(r,n,e)&&0===KB.orientationIndex(r,n,e)&&0===KB.orientationIndex(n,r,e))return this._isProper=!0,(e.equals(r)||e.equals(n))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(t,e,r,n,i){i.x=this.smallestInAbsValue(t.x,e.x,r.x,n.x),i.y=this.smallestInAbsValue(t.y,e.y,r.y,n.y),t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.safeHCoordinateIntersection=function(t,r,n,i){var o=null;try{o=TB.intersection(t,r,n,i)}catch(dX){if(!(dX instanceof IB))throw dX;o=e.nearestEndpoint(t,r,n,i)}return o},e.prototype.intersection=function(t,r,n,i){var o=this.intersectionWithNormalization(t,r,n,i);return this.isInSegmentEnvelopes(o)||(o=new uB(e.nearestEndpoint(t,r,n,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,r,n){var i=t,o=Math.abs(i);return Math.abs(e)<o&&(i=e,o=Math.abs(e)),Math.abs(r)<o&&(i=r,o=Math.abs(r)),Math.abs(n)<o&&(i=n),i},e.prototype.checkDD=function(t,e,r,n,i){var o=xB.intersection(t,e,r,n),s=this.isInSegmentEnvelopes(o);PB.out.println("DD in env = "+s+" --------------------- "+o),i.distance(o)>1e-4&&PB.out.println("Distance = "+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,r,n){var i=new uB(t),o=new uB(e),s=new uB(r),a=new uB(n),l=new uB;this.normalizeToEnvCentre(i,o,s,a,l);var u=this.safeHCoordinateIntersection(i,o,s,a);return u.x+=l.x,u.y+=l.y,u},e.prototype.computeCollinearIntersection=function(e,r,n,i){var o=FB.intersects(e,r,n),s=FB.intersects(e,r,i),a=FB.intersects(n,i,e),l=FB.intersects(n,i,r);return o&&s?(this._intPt[0]=n,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):a&&l?(this._intPt[0]=e,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||s||l?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&l?(this._intPt[0]=n,this._intPt[1]=r,!n.equals(r)||s||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||o||l?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&l?(this._intPt[0]=i,this._intPt[1]=r,!i.equals(r)||o||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,r,n,i){var o=t.x<e.x?t.x:e.x,s=t.y<e.y?t.y:e.y,a=t.x>e.x?t.x:e.x,l=t.y>e.y?t.y:e.y,u=r.x<n.x?r.x:n.x,h=r.y<n.y?r.y:n.y,c=r.x>n.x?r.x:n.x,A=r.y>n.y?r.y:n.y,f=((o>u?o:u)+(a<c?a:c))/2,p=((s>h?s:h)+(l<A?l:A))/2;i.x=f,i.y=p,t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.computeIntersect=function(e,r,n,i){if(this._isProper=!1,!FB.intersects(e,r,n,i))return t.NO_INTERSECTION;var o=KB.orientationIndex(e,r,n),s=KB.orientationIndex(e,r,i);if(o>0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=KB.orientationIndex(n,i,e),l=KB.orientationIndex(n,i,r);return a>0&&l>0||a<0&&l<0?t.NO_INTERSECTION:0===o&&0===s&&0===a&&0===l?this.computeCollinearIntersection(e,r,n,i):(0===o||0===s||0===a||0===l?(this._isProper=!1,e.equals2D(n)||e.equals2D(i)?this._intPt[0]=e:r.equals2D(n)||r.equals2D(i)?this._intPt[0]=r:0===o?this._intPt[0]=new uB(n):0===s?this._intPt[0]=new uB(i):0===a?this._intPt[0]=new uB(e):0===l&&(this._intPt[0]=new uB(r))):(this._isProper=!0,this._intPt[0]=this.intersection(e,r,n,i)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,r,n){var i=t,o=KB.distancePointLine(t,r,n),s=KB.distancePointLine(e,r,n);return s<o&&(o=s,i=e),(s=KB.distancePointLine(r,t,e))<o&&(o=s,i=r),(s=KB.distancePointLine(n,t,e))<o&&(o=s,i=n),i},e}(QB),zB=function(){};zB.prototype.interfaces_=function(){return[]},zB.prototype.getClass=function(){return zB},zB.orientationIndex=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=r.x-e.x,s=r.y-e.y;return zB.signOfDet2x2(n,i,o,s)},zB.signOfDet2x2=function(t,e,r,n){var i=null,o=null,s=null;if(i=1,0===t||0===n)return 0===e||0===r?0:e>0?r>0?-i:i:r>0?i:-i;if(0===e||0===r)return n>0?t>0?i:-i:t>0?-i:i;if(e>0?n>0?e<=n||(i=-i,o=t,t=r,r=o,o=e,e=n,n=o):e<=-n?(i=-i,r=-r,n=-n):(o=t,t=-r,r=o,o=e,e=-n,n=o):n>0?-e<=n?(i=-i,t=-t,e=-e):(o=-t,t=r,r=o,o=-e,e=n,n=o):e>=n?(t=-t,e=-e,r=-r,n=-n):(i=-i,o=-t,t=-r,r=o,o=-e,e=-n,n=o),t>0){if(!(r>0))return i;if(!(t<=r))return i}else{if(r>0)return-i;if(!(t>=r))return-i;i=-i,t=-t,r=-r}for(;;){if((n-=(s=Math.floor(r/t))*e)<0)return-i;if(n>e)return i;if(t>(r-=s*t)+r){if(e<n+n)return i}else{if(e>n+n)return-i;r=t-r,n=e-n,i=-i}if(0===n)return 0===r?0:-i;if(0===r)return i;if((e-=(s=Math.floor(t/r))*n)<0)return i;if(e>n)return-i;if(r>(t-=s*r)+t){if(n<e+e)return-i}else{if(n>e+e)return i;t=r-t,e=n-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var VB=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};VB.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 r=t.x,n=e.x;return r>n&&(r=e.x,n=t.x),this._p.x>=r&&this._p.x<=n&&(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 i=t.x-this._p.x,o=t.y-this._p.y,s=e.x-this._p.x,a=e.y-this._p.y,l=zB.signOfDet2x2(i,o,s,a);if(0===l)return this._isPointOnSegment=!0,null;a<o&&(l=-l),l>0&&this._crossingCount++}},VB.prototype.isPointInPolygon=function(){return this.getLocation()!==fB.EXTERIOR},VB.prototype.getLocation=function(){return this._isPointOnSegment?fB.BOUNDARY:this._crossingCount%2==1?fB.INTERIOR:fB.EXTERIOR},VB.prototype.isOnSegment=function(){return this._isPointOnSegment},VB.prototype.interfaces_=function(){return[]},VB.prototype.getClass=function(){return VB},VB.locatePointInRing=function(){if(arguments[0]instanceof uB&&dB(arguments[1],CB)){for(var t=arguments[1],e=new VB(arguments[0]),r=new uB,n=new uB,i=1;i<t.size();i++)if(t.getCoordinate(i,r),t.getCoordinate(i-1,n),e.countSegment(r,n),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof uB&&arguments[1]instanceof Array){for(var o=arguments[1],s=new VB(arguments[0]),a=1;a<o.length;a++){var l=o[a],u=o[a-1];if(s.countSegment(l,u),s.isOnSegment())return s.getLocation()}return s.getLocation()}};var KB=function(){},qB={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};KB.prototype.interfaces_=function(){return[]},KB.prototype.getClass=function(){return KB},KB.orientationIndex=function(t,e,r){return xB.orientationIndex(t,e,r)},KB.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,r=t[0].x,n=1;n<t.length-1;n++){var i=t[n].x-r,o=t[n+1].y;e+=i*(t[n-1].y-o)}return e/2}if(dB(arguments[0],CB)){var s=arguments[0],a=s.size();if(a<3)return 0;var l=new uB,u=new uB,h=new uB;s.getCoordinate(0,u),s.getCoordinate(1,h);var c=u.x;h.x-=c;for(var A=0,f=1;f<a-1;f++)l.y=u.y,u.x=h.x,u.y=h.y,s.getCoordinate(f+1,h),h.x-=c,A+=u.x*(l.y-h.y);return A/2}},KB.distanceLineLine=function(t,e,r,n){if(t.equals(e))return KB.distancePointLine(t,r,n);if(r.equals(n))return KB.distancePointLine(n,t,e);var i=!1;if(FB.intersects(t,e,r,n)){var o=(e.x-t.x)*(n.y-r.y)-(e.y-t.y)*(n.x-r.x);if(0===o)i=!0;else{var s=(t.y-r.y)*(n.x-r.x)-(t.x-r.x)*(n.y-r.y),a=((t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y))/o,l=s/o;(l<0||l>1||a<0||a>1)&&(i=!0)}}else i=!0;return i?gB.min(KB.distancePointLine(t,r,n),KB.distancePointLine(e,r,n),KB.distancePointLine(r,t,e),KB.distancePointLine(n,t,e)):0},KB.isPointInRing=function(t,e){return KB.locatePointInRing(t,e)!==fB.EXTERIOR},KB.computeLength=function(t){var e=t.size();if(e<=1)return 0;var r=0,n=new uB;t.getCoordinate(0,n);for(var i=n.x,o=n.y,s=1;s<e;s++){t.getCoordinate(s,n);var a=n.x,l=n.y,u=a-i,h=l-o;r+=Math.sqrt(u*u+h*h),i=a,o=l}return r},KB.isCCW=function(t){var e=t.length-1;if(e<3)throw new rB("Ring has fewer than 4 points, so orientation cannot be determined");for(var r=t[0],n=0,i=1;i<=e;i++){var o=t[i];o.y>r.y&&(r=o,n=i)}var s=n;do{(s-=1)<0&&(s=e)}while(t[s].equals2D(r)&&s!==n);var a=n;do{a=(a+1)%e}while(t[a].equals2D(r)&&a!==n);var l=t[s],u=t[a];if(l.equals2D(r)||u.equals2D(r)||l.equals2D(u))return!1;var h=KB.computeOrientation(l,r,u);return 0===h?l.x>u.x:h>0},KB.locatePointInRing=function(t,e){return VB.locatePointInRing(t,e)},KB.distancePointLinePerpendicular=function(t,e,r){var n=(r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y),i=((e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y))/n;return Math.abs(i)*Math.sqrt(n)},KB.computeOrientation=function(t,e,r){return KB.orientationIndex(t,e,r)},KB.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new rB("Line array must contain at least one vertex");for(var r=t.distance(e[0]),n=0;n<e.length-1;n++){var i=KB.distancePointLine(t,e[n],e[n+1]);i<r&&(r=i)}return r}if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];if(s.x===a.x&&s.y===a.y)return o.distance(s);var l=(a.x-s.x)*(a.x-s.x)+(a.y-s.y)*(a.y-s.y),u=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/l;if(u<=0)return o.distance(s);if(u>=1)return o.distance(a);var h=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/l;return Math.abs(h)*Math.sqrt(l)}},KB.isOnLine=function(t,e){for(var r=new HB,n=1;n<e.length;n++){var i=e[n-1],o=e[n];if(r.computeIntersection(t,i,o),r.hasIntersection())return!0}return!1},qB.CLOCKWISE.get=function(){return-1},qB.RIGHT.get=function(){return KB.CLOCKWISE},qB.COUNTERCLOCKWISE.get=function(){return 1},qB.LEFT.get=function(){return KB.COUNTERCLOCKWISE},qB.COLLINEAR.get=function(){return 0},qB.STRAIGHT.get=function(){return KB.COLLINEAR},Object.defineProperties(KB,qB);var WB=function(){};WB.prototype.filter=function(t){},WB.prototype.interfaces_=function(){return[]},WB.prototype.getClass=function(){return WB};var XB=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},YB={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}};XB.prototype.isGeometryCollection=function(){return this.getSortIndex()===XB.SORTINDEX_GEOMETRYCOLLECTION},XB.prototype.getFactory=function(){return this._factory},XB.prototype.getGeometryN=function(t){return this},XB.prototype.getArea=function(){return 0},XB.prototype.isRectangle=function(){return!1},XB.prototype.equals=function(){if(arguments[0]instanceof XB){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof XB))return!1;var r=e;return this.equalsExact(r)}},XB.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},XB.prototype.geometryChanged=function(){this.apply(XB.geometryChangedFilter)},XB.prototype.geometryChangedAction=function(){this._envelope=null},XB.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},XB.prototype.getLength=function(){return 0},XB.prototype.getNumGeometries=function(){return 1},XB.prototype.compareTo=function(){if(1===arguments.length){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)}if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.getSortIndex()!==r.getSortIndex()?this.getSortIndex()-r.getSortIndex():this.isEmpty()&&r.isEmpty()?0:this.isEmpty()?-1:r.isEmpty()?1:this.compareToSameClass(r,n)}},XB.prototype.getUserData=function(){return this._userData},XB.prototype.getSRID=function(){return this._SRID},XB.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},XB.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===XB.SORTINDEX_GEOMETRYCOLLECTION)throw new rB("This method does not support GeometryCollection arguments")},XB.prototype.equal=function(t,e,r){return 0===r?t.equals(e):t.distance(e)<=r},XB.prototype.norm=function(){var t=this.copy();return t.normalize(),t},XB.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},XB.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new FB(this._envelope)},XB.prototype.setSRID=function(t){this._SRID=t},XB.prototype.setUserData=function(t){this._userData=t},XB.prototype.compare=function(t,e){for(var r=t.iterator(),n=e.iterator();r.hasNext()&&n.hasNext();){var i=r.next(),o=n.next(),s=i.compareTo(o);if(0!==s)return s}return r.hasNext()?1:n.hasNext()?-1:0},XB.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},XB.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===XB.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===XB.SORTINDEX_MULTIPOINT||this.getSortIndex()===XB.SORTINDEX_MULTILINESTRING||this.getSortIndex()===XB.SORTINDEX_MULTIPOLYGON},XB.prototype.interfaces_=function(){return[sB,oB,lB]},XB.prototype.getClass=function(){return XB},XB.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},XB.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},YB.serialVersionUID.get=function(){return 0x799ea46522854c00},YB.SORTINDEX_POINT.get=function(){return 0},YB.SORTINDEX_MULTIPOINT.get=function(){return 1},YB.SORTINDEX_LINESTRING.get=function(){return 2},YB.SORTINDEX_LINEARRING.get=function(){return 3},YB.SORTINDEX_MULTILINESTRING.get=function(){return 4},YB.SORTINDEX_POLYGON.get=function(){return 5},YB.SORTINDEX_MULTIPOLYGON.get=function(){return 6},YB.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},YB.geometryChangedFilter.get=function(){return ZB},Object.defineProperties(XB,YB);var ZB=function(){};ZB.interfaces_=function(){return[WB]},ZB.filter=function(t){t.geometryChangedAction()};var JB=function(){};JB.prototype.filter=function(t){},JB.prototype.interfaces_=function(){return[]},JB.prototype.getClass=function(){return JB};var $B=function(){},tI={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}};$B.prototype.isInBoundary=function(t){},$B.prototype.interfaces_=function(){return[]},$B.prototype.getClass=function(){return $B},tI.Mod2BoundaryNodeRule.get=function(){return eI},tI.EndPointBoundaryNodeRule.get=function(){return rI},tI.MultiValentEndPointBoundaryNodeRule.get=function(){return nI},tI.MonoValentEndPointBoundaryNodeRule.get=function(){return iI},tI.MOD2_BOUNDARY_RULE.get=function(){return new eI},tI.ENDPOINT_BOUNDARY_RULE.get=function(){return new rI},tI.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new nI},tI.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new iI},tI.OGC_SFS_BOUNDARY_RULE.get=function(){return $B.MOD2_BOUNDARY_RULE},Object.defineProperties($B,tI);var eI=function(){};eI.prototype.isInBoundary=function(t){return t%2==1},eI.prototype.interfaces_=function(){return[$B]},eI.prototype.getClass=function(){return eI};var rI=function(){};rI.prototype.isInBoundary=function(t){return t>0},rI.prototype.interfaces_=function(){return[$B]},rI.prototype.getClass=function(){return rI};var nI=function(){};nI.prototype.isInBoundary=function(t){return t>1},nI.prototype.interfaces_=function(){return[$B]},nI.prototype.getClass=function(){return nI};var iI=function(){};iI.prototype.isInBoundary=function(t){return 1===t},iI.prototype.interfaces_=function(){return[$B]},iI.prototype.getClass=function(){return iI};var oI=function(){};function sI(t){this.message=t||""}oI.prototype.add=function(){},oI.prototype.addAll=function(){},oI.prototype.isEmpty=function(){},oI.prototype.iterator=function(){},oI.prototype.size=function(){},oI.prototype.toArray=function(){},oI.prototype.remove=function(){},sI.prototype=new Error,sI.prototype.name="IndexOutOfBoundsException";var aI=function(){};aI.prototype.hasNext=function(){},aI.prototype.next=function(){},aI.prototype.remove=function(){};var lI=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(oI);function uI(t){this.message=t||""}uI.prototype=new Error,uI.prototype.name="NoSuchElementException";var hI=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof oI&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,oI]},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.set=function(t,e){var r=this.array_[t];return this.array_[t]=e,r},e.prototype.iterator=function(){return new cI(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new sI;return this.array_[t]},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.remove=function(t){for(var e=!1,r=0,n=this.array_.length;r<n;r++)if(this.array_[r]===t){this.array_.splice(r,1),e=!0;break}return e},e}(lI),cI=function(t){function e(e){t.call(this),this.arrayList_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new uI;return this.arrayList_.get(this.position_++)},e.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},e.prototype.set=function(t){return this.arrayList_.set(this.position_-1,t)},e.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},e}(aI),AI=function(t){function e(){if(t.call(this),0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.ensureCapacity(r.length),this.add(r,n)}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={coordArrayType:{configurable:!0}};return r.coordArrayType.get=function(){return new Array(0).fill(null)},e.prototype.getCoordinate=function(t){return this.get(t)},e.prototype.addAll=function(){if(2===arguments.length){for(var e=arguments[1],r=!1,n=arguments[0].iterator();n.hasNext();)this.add(n.next(),e),r=!0;return r}return t.prototype.addAll.apply(this,arguments)},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),r=0;r<this.size();r++)e.add(r,this.get(r).copy());return e},e.prototype.toCoordinateArray=function(){return this.toArray(e.coordArrayType)},e.prototype.add=function(){var e=this;if(1===arguments.length){var r=arguments[0];t.prototype.add.call(this,r)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var n=arguments[0],i=arguments[1];return this.add(n,i,!0),!0}if(arguments[0]instanceof uB&&"boolean"==typeof arguments[1]){var o=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(o))return null;t.prototype.add.call(this,o)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var s=arguments[0],a=arguments[1];return this.add(s,a),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var l=arguments[0],u=arguments[1];if(arguments[2])for(var h=0;h<l.length;h++)e.add(l[h],u);else for(var c=l.length-1;c>=0;c--)e.add(l[c],u);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof uB){var A=arguments[0],f=arguments[1];if(!arguments[2]){var p=this.size();if(p>0){if(A>0&&this.get(A-1).equals2D(f))return null;if(A<p&&this.get(A).equals2D(f))return null}}t.prototype.add.call(this,A,f)}}else if(4===arguments.length){var d=arguments[0],g=arguments[1],y=arguments[2],m=arguments[3],v=1;y>m&&(v=-1);for(var _=y;_!==m;_+=v)e.add(d[_],g);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new uB(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,r),e}(hI),fI=function(){},pI={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};pI.ForwardComparator.get=function(){return dI},pI.BidirectionalComparator.get=function(){return gI},pI.coordArrayType.get=function(){return new Array(0).fill(null)},fI.prototype.interfaces_=function(){return[]},fI.prototype.getClass=function(){return fI},fI.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))},fI.ptNotInList=function(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(fI.indexOf(n,e)<0)return n}return null},fI.scroll=function(t,e){var r=fI.indexOf(e,t);if(r<0)return null;var n=new Array(t.length).fill(null);PB.arraycopy(t,r,n,0,t.length-r),PB.arraycopy(t,0,n,t.length-r,r),PB.arraycopy(n,0,t,0,t.length)},fI.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(!t[r].equals(e[r]))return!1;return!0}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];if(n===i)return!0;if(null===n||null===i)return!1;if(n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(0!==o.compare(n[s],i[s]))return!1;return!0}},fI.intersection=function(t,e){for(var r=new AI,n=0;n<t.length;n++)e.intersects(t[n])&&r.add(t[n],!0);return r.toCoordinateArray()},fI.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},fI.removeRepeatedPoints=function(t){return fI.hasRepeatedPoints(t)?new AI(t,!1).toCoordinateArray():t},fI.reverse=function(t){for(var e=t.length-1,r=Math.trunc(e/2),n=0;n<=r;n++){var i=t[n];t[n]=t[e-n],t[e-n]=i}},fI.removeNull=function(t){for(var e=0,r=0;r<t.length;r++)null!==t[r]&&e++;var n=new Array(e).fill(null);if(0===e)return n;for(var i=0,o=0;o<t.length;o++)null!==t[o]&&(n[i++]=t[o]);return n},fI.copyDeep=function(){if(1===arguments.length){for(var t=arguments[0],e=new Array(t.length).fill(null),r=0;r<t.length;r++)e[r]=new uB(t[r]);return e}if(5===arguments.length)for(var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4],l=0;l<a;l++)o[s+l]=new uB(n[i+l])},fI.isEqualReversed=function(t,e){for(var r=0;r<t.length;r++){var n=t[r],i=e[t.length-r-1];if(0!==n.compareTo(i))return!1}return!0},fI.envelope=function(t){for(var e=new FB,r=0;r<t.length;r++)e.expandToInclude(t[r]);return e},fI.toCoordinateArray=function(t){return t.toArray(fI.coordArrayType)},fI.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},fI.indexOf=function(t,e){for(var r=0;r<e.length;r++)if(t.equals(e[r]))return r;return-1},fI.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var r=t.length-1-e,n=t[e].compareTo(t[r]);if(0!==n)return n}return 1},fI.compare=function(t,e){for(var r=0;r<t.length&&r<e.length;){var n=t[r].compareTo(e[r]);if(0!==n)return n;r++}return r<e.length?-1:r<t.length?1:0},fI.minCoordinate=function(t){for(var e=null,r=0;r<t.length;r++)(null===e||e.compareTo(t[r])>0)&&(e=t[r]);return e},fI.extract=function(t,e,r){e=gB.clamp(e,0,t.length);var n=(r=gB.clamp(r,-1,t.length))-e+1;r<0&&(n=0),e>=t.length&&(n=0),r<e&&(n=0);var i=new Array(n).fill(null);if(0===n)return i;for(var o=0,s=e;s<=r;s++)i[o++]=t[s];return i},Object.defineProperties(fI,pI);var dI=function(){};dI.prototype.compare=function(t,e){var r=t,n=e;return fI.compare(r,n)},dI.prototype.interfaces_=function(){return[aB]},dI.prototype.getClass=function(){return dI};var gI=function(){};gI.prototype.compare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;var i=fI.compare(r,n);return fI.isEqualReversed(r,n)?0:i},gI.prototype.OLDcompare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;for(var i=fI.increasingDirection(r),o=fI.increasingDirection(n),s=i>0?0:r.length-1,a=o>0?0:r.length-1,l=0;l<r.length;l++){var u=r[s].compareTo(n[a]);if(0!==u)return u;s+=i,a+=o}return 0},gI.prototype.interfaces_=function(){return[aB]},gI.prototype.getClass=function(){return gI};var yI=function(){};yI.prototype.get=function(){},yI.prototype.put=function(){},yI.prototype.size=function(){},yI.prototype.values=function(){},yI.prototype.entrySet=function(){};var mI=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(yI);function vI(t){this.message=t||""}function _I(){}vI.prototype=new Error,vI.prototype.name="OperationNotSupported",_I.prototype=new oI,_I.prototype.contains=function(){};var wI=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof oI&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++)if(this.array_[e]===t)return!0;return!1},e.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.remove=function(t){throw new Error},e.prototype.size=function(){return this.array_.length},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.iterator=function(){return new bI(this)},e}(_I),bI=function(t){function e(e){t.call(this),this.hashSet_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new uI;return this.hashSet_.array_[this.position_++]},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new vI},e}(aI),xI=0;function EI(t){return null===t?xI:t.color}function CI(t){return null===t?null:t.parent}function SI(t,e){null!==t&&(t.color=e)}function BI(t){return null===t?null:t.left}function II(t){return null===t?null:t.right}function PI(){this.root_=null,this.size_=0}PI.prototype=new mI,PI.prototype.get=function(t){for(var e=this.root_;null!==e;){var r=t.compareTo(e.key);if(r<0)e=e.left;else{if(!(r>0))return e.value;e=e.right}}return null},PI.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:xI,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var r,n,i=this.root_;do{if(r=i,(n=t.compareTo(i.key))<0)i=i.left;else{if(!(n>0)){var o=i.value;return i.value=e,o}i=i.right}}while(null!==i);var s={key:t,left:null,right:null,value:e,parent:r,color:xI,getValue:function(){return this.value},getKey:function(){return this.key}};return n<0?r.left=s:r.right=s,this.fixAfterInsertion(s),this.size_++,null},PI.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(CI(t)===BI(CI(CI(t)))){var r=II(CI(CI(t)));1===EI(r)?(SI(CI(t),xI),SI(r,xI),SI(CI(CI(t)),1),t=CI(CI(t))):(t===II(CI(t))&&(t=CI(t),e.rotateLeft(t)),SI(CI(t),xI),SI(CI(CI(t)),1),e.rotateRight(CI(CI(t))))}else{var n=BI(CI(CI(t)));1===EI(n)?(SI(CI(t),xI),SI(n,xI),SI(CI(CI(t)),1),t=CI(CI(t))):(t===BI(CI(t))&&(t=CI(t),e.rotateRight(t)),SI(CI(t),xI),SI(CI(CI(t)),1),e.rotateLeft(CI(CI(t))))}this.root_.color=xI},PI.prototype.values=function(){var t=new hI,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=PI.successor(e));)t.add(e.value);return t},PI.prototype.entrySet=function(){var t=new wI,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=PI.successor(e));)t.add(e);return t},PI.prototype.rotateLeft=function(t){if(null!=t){var e=t.right;t.right=e.left,null!=e.left&&(e.left.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}},PI.prototype.rotateRight=function(t){if(null!=t){var e=t.left;t.left=e.right,null!=e.right&&(e.right.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}},PI.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},PI.successor=function(t){if(null===t)return null;if(null!==t.right){for(var e=t.right;null!==e.left;)e=e.left;return e}for(var r=t.parent,n=t;null!==r&&n===r.right;)n=r,r=r.parent;return r},PI.prototype.size=function(){return this.size_};var TI=function(){};function FI(){}function MI(){this.array_=[],arguments[0]instanceof oI&&this.addAll(arguments[0])}TI.prototype.interfaces_=function(){return[]},TI.prototype.getClass=function(){return TI},FI.prototype=new _I,MI.prototype=new FI,MI.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++)if(0===this.array_[e].compareTo(t))return!0;return!1},MI.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,r=this.array_.length;e<r;e++)if(1===this.array_[e].compareTo(t))return this.array_.splice(e,0,t),!0;return this.array_.push(t),!0},MI.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},MI.prototype.remove=function(t){throw new vI},MI.prototype.size=function(){return this.array_.length},MI.prototype.isEmpty=function(){return 0===this.array_.length},MI.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},MI.prototype.iterator=function(){return new LI(this)};var LI=function(t){this.treeSet_=t,this.position_=0};LI.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new uI;return this.treeSet_.array_[this.position_++]},LI.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},LI.prototype.remove=function(){throw new vI};var OI=function(){};OI.sort=function(){var t,e,r,n,i=arguments[0];if(1===arguments.length)n=function(t,e){return t.compareTo(e)},i.sort(n);else if(2===arguments.length)r=arguments[1],n=function(t,e){return r.compare(t,e)},i.sort(n);else if(3===arguments.length){(e=i.slice(arguments[1],arguments[2])).sort();var o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length));for(i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])}else if(4===arguments.length)for(e=i.slice(arguments[1],arguments[2]),r=arguments[3],n=function(t,e){return r.compare(t,e)},e.sort(n),o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length)),i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])},OI.asList=function(t){for(var e=new hI,r=0,n=t.length;r<n;r++)e.add(t[r]);return e};var NI=function(){},RI={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}};RI.P.get=function(){return 0},RI.L.get=function(){return 1},RI.A.get=function(){return 2},RI.FALSE.get=function(){return-1},RI.TRUE.get=function(){return-2},RI.DONTCARE.get=function(){return-3},RI.SYM_FALSE.get=function(){return"F"},RI.SYM_TRUE.get=function(){return"T"},RI.SYM_DONTCARE.get=function(){return"*"},RI.SYM_P.get=function(){return"0"},RI.SYM_L.get=function(){return"1"},RI.SYM_A.get=function(){return"2"},NI.prototype.interfaces_=function(){return[]},NI.prototype.getClass=function(){return NI},NI.toDimensionSymbol=function(t){switch(t){case NI.FALSE:return NI.SYM_FALSE;case NI.TRUE:return NI.SYM_TRUE;case NI.DONTCARE:return NI.SYM_DONTCARE;case NI.P:return NI.SYM_P;case NI.L:return NI.SYM_L;case NI.A:return NI.SYM_A}throw new rB("Unknown dimension value: "+t)},NI.toDimensionValue=function(t){switch(_B.toUpperCase(t)){case NI.SYM_FALSE:return NI.FALSE;case NI.SYM_TRUE:return NI.TRUE;case NI.SYM_DONTCARE:return NI.DONTCARE;case NI.SYM_P:return NI.P;case NI.SYM_L:return NI.L;case NI.SYM_A:return NI.A}throw new rB("Unknown dimension symbol: "+t)},Object.defineProperties(NI,RI);var kI=function(){};kI.prototype.filter=function(t){},kI.prototype.interfaces_=function(){return[]},kI.prototype.getClass=function(){return kI};var UI=function(){};UI.prototype.filter=function(t,e){},UI.prototype.isDone=function(){},UI.prototype.isGeometryChanged=function(){},UI.prototype.interfaces_=function(){return[]},UI.prototype.getClass=function(){return UI};var DI=function(t){function e(e,r){if(t.call(this,r),this._geometries=e||[],t.hasNullElements(this._geometries))throw new rB("geometries must not contain null elements")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var t=new FB,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},e.prototype.getGeometryN=function(t){return this._geometries[t]},e.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},e.prototype.getCoordinates=function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,r=0;r<this._geometries.length;r++)for(var n=this._geometries[r].getCoordinates(),i=0;i<n.length;i++)t[++e]=n[i];return t},e.prototype.getArea=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._geometries.length!==n._geometries.length)return!1;for(var i=0;i<this._geometries.length;i++)if(!this._geometries[i].equalsExact(n._geometries[i],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();OI.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var t=NI.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t},e.prototype.getDimension=function(){for(var t=NI.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},e.prototype.getLength=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},e.prototype.getNumGeometries=function(){return this._geometries.length},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createGeometryCollection(e)},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=new MI(OI.asList(this._geometries)),r=new MI(OI.asList(t._geometries));return this.compare(e,r)}if(2===arguments.length){for(var n=arguments[1],i=arguments[0],o=this.getNumGeometries(),s=i.getNumGeometries(),a=0;a<o&&a<s;){var l=this.getGeometryN(a),u=i.getGeometryN(a),h=l.compareToSameClass(u,n);if(0!==h)return h;a++}return a<o?1:a<s?-1:0}},e.prototype.apply=function(){var t=this;if(dB(arguments[0],JB))for(var e=arguments[0],r=0;r<this._geometries.length;r++)t._geometries[r].apply(e);else if(dB(arguments[0],UI)){var n=arguments[0];if(0===this._geometries.length)return null;for(var i=0;i<this._geometries.length&&(t._geometries[i].apply(n),!n.isDone());i++);n.isGeometryChanged()&&this.geometryChanged()}else if(dB(arguments[0],kI)){var o=arguments[0];o.filter(this);for(var s=0;s<this._geometries.length;s++)t._geometries[s].apply(o)}else if(dB(arguments[0],WB)){var a=arguments[0];a.filter(this);for(var l=0;l<this._geometries.length;l++)t._geometries[l].apply(a)}},e.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),GB.shouldNeverReachHere(),null},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._geometries=new Array(this._geometries.length).fill(null);for(var r=0;r<this._geometries.length;r++)e._geometries[r]=this._geometries[r].clone();return e},e.prototype.getGeometryType=function(){return"GeometryCollection"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.isEmpty=function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(e,r),e}(XB),GI=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return XB.SORTINDEX_MULTILINESTRING},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?NI.FALSE:0},e.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0},e.prototype.getDimension=function(){return 1},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[t-1-r]=this._geometries[r].reverse();return this.getFactory().createMultiLineString(e)},e.prototype.getBoundary=function(){return new QI(this).getBoundary()},e.prototype.getGeometryType=function(){return"MultiLineString"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[TI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(e,r),e}(DI),QI=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0],e=$B.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._geom=r,this._geomFact=r.getFactory(),this._bnRule=n}};QI.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return 1===e.length?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)},QI.prototype.getBoundary=function(){return this._geom instanceof JI?this.boundaryLineString(this._geom):this._geom instanceof GI?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},QI.prototype.boundaryLineString=function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():t.isClosed()?this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},QI.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},QI.prototype.computeBoundaryCoordinates=function(t){var e=this,r=new hI;this._endpointMap=new PI;for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);0!==i.getNumPoints()&&(e.addEndpoint(i.getCoordinateN(0)),e.addEndpoint(i.getCoordinateN(i.getNumPoints()-1)))}for(var o=this._endpointMap.entrySet().iterator();o.hasNext();){var s=o.next(),a=s.getValue().count;e._bnRule.isInBoundary(a)&&r.add(s.getKey())}return fI.toCoordinateArray(r)},QI.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new jI,this._endpointMap.put(t,e)),e.count++},QI.prototype.interfaces_=function(){return[]},QI.prototype.getClass=function(){return QI},QI.getBoundary=function(){return 1===arguments.length?new QI(arguments[0]).getBoundary():2===arguments.length?new QI(arguments[0],arguments[1]).getBoundary():void 0};var jI=function(){this.count=null};function HI(){}function zI(){}jI.prototype.interfaces_=function(){return[]},jI.prototype.getClass=function(){return jI};var VI=function(){};function KI(){}function qI(){}function WI(){}var XI=function(){},YI={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};XI.prototype.interfaces_=function(){return[]},XI.prototype.getClass=function(){return XI},XI.chars=function(t,e){for(var r=new Array(e).fill(null),n=0;n<e;n++)r[n]=t;return String(r)},XI.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new KI,r=new HI;return t.printStackTrace(r),e.toString()}if(2===arguments.length){var n=arguments[0],i=arguments[1],o="";new zI(XI.getStackTrace(n));for(var s=new WI,a=0;a<i;a++)try{o+=s.readLine()+XI.NEWLINE}catch(dX){if(!(dX instanceof qI))throw dX;GB.shouldNeverReachHere()}return o}},XI.split=function(t,e){for(var r=e.length,n=new hI,i=""+t,o=i.indexOf(e);o>=0;){var s=i.substring(0,o);n.add(s),o=(i=i.substring(o+r)).indexOf(e)}i.length>0&&n.add(i);for(var a=new Array(n.size()).fill(null),l=0;l<a.length;l++)a[l]=n.get(l);return a},XI.toString=function(){if(1===arguments.length){var t=arguments[0];return XI.SIMPLE_ORDINATE_FORMAT.format(t)}},XI.spaces=function(t){return XI.chars(" ",t)},YI.NEWLINE.get=function(){return PB.getProperty("line.separator")},YI.SIMPLE_ORDINATE_FORMAT.get=function(){return new VI},Object.defineProperties(XI,YI);var ZI=function(){};ZI.prototype.interfaces_=function(){return[]},ZI.prototype.getClass=function(){return ZI},ZI.copyCoord=function(t,e,r,n){for(var i=Math.min(t.getDimension(),r.getDimension()),o=0;o<i;o++)r.setOrdinate(n,o,t.getOrdinate(e,o))},ZI.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&t.getOrdinate(0,CB.X)===t.getOrdinate(e-1,CB.X)&&t.getOrdinate(0,CB.Y)===t.getOrdinate(e-1,CB.Y)},ZI.isEqual=function(t,e){var r=t.size();if(r!==e.size())return!1;for(var n=Math.min(t.getDimension(),e.getDimension()),i=0;i<r;i++)for(var o=0;o<n;o++){var s=t.getOrdinate(i,o),a=e.getOrdinate(i,o);if(!(t.getOrdinate(i,o)===e.getOrdinate(i,o)||nB.isNaN(s)&&nB.isNaN(a)))return!1}return!0},ZI.extend=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();if(ZI.copy(e,0,n,0,i),i>0)for(var o=i;o<r;o++)ZI.copy(e,i-1,n,o,1);return n},ZI.reverse=function(t){for(var e=t.size()-1,r=Math.trunc(e/2),n=0;n<=r;n++)ZI.swap(t,n,e-n)},ZI.swap=function(t,e,r){if(e===r)return null;for(var n=0;n<t.getDimension();n++){var i=t.getOrdinate(e,n);t.setOrdinate(e,n,t.getOrdinate(r,n)),t.setOrdinate(r,n,i)}},ZI.copy=function(t,e,r,n,i){for(var o=0;o<i;o++)ZI.copyCoord(t,e+o,r,n+o)},ZI.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var r=t.getDimension(),n=new mB;n.append("(");for(var i=0;i<e;i++){i>0&&n.append(" ");for(var o=0;o<r;o++)o>0&&n.append(","),n.append(XI.toString(t.getOrdinate(i,o)))}return n.append(")"),n.toString()}},ZI.ensureValidRing=function(t,e){var r=e.size();return 0===r?e:r<=3?ZI.createClosedRing(t,e,4):e.getOrdinate(0,CB.X)===e.getOrdinate(r-1,CB.X)&&e.getOrdinate(0,CB.Y)===e.getOrdinate(r-1,CB.Y)?e:ZI.createClosedRing(t,e,r+1)},ZI.createClosedRing=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();ZI.copy(e,0,n,0,i);for(var o=i;o<r;o++)ZI.copy(e,0,n,o,1);return n};var JI=function(t){function e(e,r){t.call(this,r),this._points=null,this.init(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new FB:this._points.expandEnvelope(new FB)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._points.size()!==n._points.size())return!1;for(var i=0;i<this._points.size();i++)if(!this.equal(this._points.getCoordinate(i),n._points.getCoordinate(i),r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=this,e=0;e<Math.trunc(this._points.size()/2);e++){var r=t._points.size()-1-e;if(!t._points.getCoordinate(e).equals(t._points.getCoordinate(r)))return t._points.getCoordinate(e).compareTo(t._points.getCoordinate(r))>0&&ZI.reverse(t._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?NI.FALSE:0},e.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return KB.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return ZI.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,r=0;e<this._points.size()&&r<t._points.size();){var n=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(r));if(0!==n)return n;e++,r++}return e<this._points.size()?1:r<t._points.size()?-1:0}if(2===arguments.length){var i=arguments[0];return arguments[1].compare(this._points,i._points)}},e.prototype.apply=function(){if(dB(arguments[0],JB))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(dB(arguments[0],UI)){var r=arguments[0];if(0===this._points.size())return null;for(var n=0;n<this._points.size()&&(r.filter(this._points,n),!r.isDone());n++);r.isGeometryChanged()&&this.geometryChanged()}else(dB(arguments[0],kI)||dB(arguments[0],WB))&&arguments[0].filter(this)},e.prototype.getBoundary=function(){return new QI(this).getBoundary()},e.prototype.isEquivalentClass=function(t){return t instanceof e},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._points=this._points.clone(),e},e.prototype.getCoordinateN=function(t){return this._points.getCoordinate(t)},e.prototype.getGeometryType=function(){return"LineString"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._points},e.prototype.isEmpty=function(){return 0===this._points.size()},e.prototype.init=function(t){if(null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),1===t.size())throw new rB("Invalid number of points in LineString (found "+t.size()+" - must be 0 or >= 2)");this._points=t},e.prototype.isCoordinate=function(t){for(var e=0;e<this._points.size();e++)if(this._points.getCoordinate(e).equals(t))return!0;return!1},e.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},e.prototype.getPointN=function(t){return this.getFactory().createPoint(this._points.getCoordinate(t))},e.prototype.interfaces_=function(){return[TI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,r),e}(XB),$I=function(){};$I.prototype.interfaces_=function(){return[]},$I.prototype.getClass=function(){return $I};var tP=function(t){function e(e,r){t.call(this,r),this._coordinates=e||null,this.init(this._coordinates)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new FB;var t=new FB;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},e.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},e.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),r))}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){},e.prototype.getCoordinate=function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},e.prototype.getBoundaryDimension=function(){return NI.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getNumPoints=function(){return this.isEmpty()?0:1},e.prototype.reverse=function(){return this.copy()},e.prototype.getX=function(){if(null===this.getCoordinate())throw new Error("getX called on empty Point");return this.getCoordinate().x},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0];return this.getCoordinate().compareTo(t.getCoordinate())}if(2===arguments.length){var e=arguments[0];return arguments[1].compare(this._coordinates,e._coordinates)}},e.prototype.apply=function(){if(dB(arguments[0],JB)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(dB(arguments[0],UI)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else(dB(arguments[0],kI)||dB(arguments[0],WB))&&arguments[0].filter(this)},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._coordinates=this._coordinates.clone(),e},e.prototype.getGeometryType=function(){return"Point"},e.prototype.copy=function(){return new e(this._coordinates.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._coordinates},e.prototype.getY=function(){if(null===this.getCoordinate())throw new Error("getY called on empty Point");return this.getCoordinate().y},e.prototype.isEmpty=function(){return 0===this._coordinates.size()},e.prototype.init=function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),GB.isTrue(t.size()<=1),this._coordinates=t},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return[$I]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(e,r),e}(XB),eP=function(){};eP.prototype.interfaces_=function(){return[]},eP.prototype.getClass=function(){return eP};var rP=function(t){function e(e,r,n){if(t.call(this,n),this._shell=null,this._holes=null,null===e&&(e=this.getFactory().createLinearRing()),null===r&&(r=[]),t.hasNullElements(r))throw new rB("holes must not contain null elements");if(e.isEmpty()&&t.hasNonEmptyElements(r))throw new rB("shell is empty but holes are not");this._shell=e,this._holes=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},e.prototype.getSortIndex=function(){return t.SORTINDEX_POLYGON},e.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var t=new Array(this.getNumPoints()).fill(null),e=-1,r=this._shell.getCoordinates(),n=0;n<r.length;n++)t[++e]=r[n];for(var i=0;i<this._holes.length;i++)for(var o=this._holes[i].getCoordinates(),s=0;s<o.length;s++)t[++e]=o[s];return t},e.prototype.getArea=function(){var t=0;t+=Math.abs(KB.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(KB.signedArea(this._holes[e].getCoordinateSequence()));return t},e.prototype.isRectangle=function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),r=0;r<5;r++){var n=t.getX(r);if(n!==e.getMinX()&&n!==e.getMaxX())return!1;var i=t.getY(r);if(i!==e.getMinY()&&i!==e.getMaxY())return!1}for(var o=t.getX(0),s=t.getY(0),a=1;a<=4;a++){var l=t.getX(a),u=t.getY(a);if(l!==o==(u!==s))return!1;o=l,s=u}return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e,i=this._shell,o=n._shell;if(!i.equalsExact(o,r))return!1;if(this._holes.length!==n._holes.length)return!1;for(var s=0;s<this._holes.length;s++)if(!this._holes[s].equalsExact(n._holes[s],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var t=0;t<this._holes.length;t++)this.normalize(this._holes[t],!1);OI.sort(this._holes)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(e.isEmpty())return null;var n=new Array(e.getCoordinates().length-1).fill(null);PB.arraycopy(e.getCoordinates(),0,n,0,n.length);var i=fI.minCoordinate(e.getCoordinates());fI.scroll(n,i),PB.arraycopy(n,0,e.getCoordinates(),0,n.length),e.getCoordinates()[n.length]=n[0],KB.isCCW(e.getCoordinates())===r&&fI.reverse(e.getCoordinates())}},e.prototype.getCoordinate=function(){return this._shell.getCoordinate()},e.prototype.getNumInteriorRing=function(){return this._holes.length},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.getLength=function(){var t=0;t+=this._shell.getLength();for(var e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},e.prototype.reverse=function(){var t=this.copy();t._shell=this._shell.copy().reverse(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].copy().reverse();return t},e.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=this._shell,r=t._shell;return e.compareToSameClass(r)}if(2===arguments.length){var n=arguments[1],i=arguments[0],o=this._shell,s=i._shell,a=o.compareToSameClass(s,n);if(0!==a)return a;for(var l=this.getNumInteriorRing(),u=i.getNumInteriorRing(),h=0;h<l&&h<u;){var c=this.getInteriorRingN(h),A=i.getInteriorRingN(h),f=c.compareToSameClass(A,n);if(0!==f)return f;h++}return h<l?1:h<u?-1:0}},e.prototype.apply=function(t){var e=this;if(dB(t,JB)){this._shell.apply(t);for(var r=0;r<this._holes.length;r++)e._holes[r].apply(t)}else if(dB(t,UI)){if(this._shell.apply(t),!t.isDone())for(var n=0;n<this._holes.length&&(e._holes[n].apply(t),!t.isDone());n++);t.isGeometryChanged()&&this.geometryChanged()}else if(dB(t,kI))t.filter(this);else if(dB(t,WB)){t.filter(this),this._shell.apply(t);for(var i=0;i<this._holes.length;i++)e._holes[i].apply(t)}},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this._holes.length+1).fill(null);t[0]=this._shell;for(var e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._shell=this._shell.clone(),e._holes=new Array(this._holes.length).fill(null);for(var r=0;r<this._holes.length;r++)e._holes[r]=this._holes[r].clone();return e},e.prototype.getGeometryType=function(){return"Polygon"},e.prototype.copy=function(){for(var t=this._shell.copy(),r=new Array(this._holes.length).fill(null),n=0;n<r.length;n++)r[n]=this._holes[n].copy();return new e(t,r,this._factory)},e.prototype.getExteriorRing=function(){return this._shell},e.prototype.isEmpty=function(){return this._shell.isEmpty()},e.prototype.getInteriorRingN=function(t){return this._holes[t]},e.prototype.interfaces_=function(){return[eP]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,r),e}(XB),nP=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return XB.SORTINDEX_MULTIPOINT},e.prototype.isValid=function(){return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getCoordinate=function(){if(1===arguments.length){var e=arguments[0];return this._geometries[e].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return NI.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.getGeometryType=function(){return"MultiPoint"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[$I]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(e,r),e}(DI),iP=function(t){function e(e,r){e instanceof uB&&r instanceof _P&&(e=r.getCoordinateSequenceFactory().create(e)),t.call(this,e,r),this.validateConstruction()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return XB.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return NI.FALSE},e.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},e.prototype.reverse=function(){var t=this._points.copy();return ZI.reverse(t),this.getFactory().createLinearRing(t)},e.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new rB("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new rB("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.MINIMUM_VALID_SIZE.get=function(){return 4},r.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,r),e}(JI),oP=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return XB.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createMultiPolygon(e)},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new hI,e=0;e<this._geometries.length;e++)for(var r=this._geometries[e].getBoundary(),n=0;n<r.getNumGeometries();n++)t.add(r.getGeometryN(n));var i=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(i))},e.prototype.getGeometryType=function(){return"MultiPolygon"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[eP]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,r),e}(DI),sP=function(t){this._factory=t||null,this._isUserDataCopied=!1},aP={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};sP.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},sP.prototype.edit=function(t,e){if(null===t)return null;var r=this.editInternal(t,e);return this._isUserDataCopied&&r.setUserData(t.getUserData()),r},sP.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof DI?this.editGeometryCollection(t,e):t instanceof rP?this.editPolygon(t,e):t instanceof tP||t instanceof JI?e.edit(t,this._factory):(GB.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},sP.prototype.editGeometryCollection=function(t,e){for(var r=e.edit(t,this._factory),n=new hI,i=0;i<r.getNumGeometries();i++){var o=this.edit(r.getGeometryN(i),e);null===o||o.isEmpty()||n.add(o)}return r.getClass()===nP?this._factory.createMultiPoint(n.toArray([])):r.getClass()===GI?this._factory.createMultiLineString(n.toArray([])):r.getClass()===oP?this._factory.createMultiPolygon(n.toArray([])):this._factory.createGeometryCollection(n.toArray([]))},sP.prototype.editPolygon=function(t,e){var r=e.edit(t,this._factory);if(null===r&&(r=this._factory.createPolygon(null)),r.isEmpty())return r;var n=this.edit(r.getExteriorRing(),e);if(null===n||n.isEmpty())return this._factory.createPolygon();for(var i=new hI,o=0;o<r.getNumInteriorRing();o++){var s=this.edit(r.getInteriorRingN(o),e);null===s||s.isEmpty()||i.add(s)}return this._factory.createPolygon(n,i.toArray([]))},sP.prototype.interfaces_=function(){return[]},sP.prototype.getClass=function(){return sP},sP.GeometryEditorOperation=function(){},aP.NoOpGeometryOperation.get=function(){return lP},aP.CoordinateOperation.get=function(){return uP},aP.CoordinateSequenceOperation.get=function(){return hP},Object.defineProperties(sP,aP);var lP=function(){};lP.prototype.edit=function(t,e){return t},lP.prototype.interfaces_=function(){return[sP.GeometryEditorOperation]},lP.prototype.getClass=function(){return lP};var uP=function(){};uP.prototype.edit=function(t,e){var r=this.editCoordinates(t.getCoordinates(),t);return null===r?t:t instanceof iP?e.createLinearRing(r):t instanceof JI?e.createLineString(r):t instanceof tP?r.length>0?e.createPoint(r[0]):e.createPoint():t},uP.prototype.interfaces_=function(){return[sP.GeometryEditorOperation]},uP.prototype.getClass=function(){return uP};var hP=function(){};hP.prototype.edit=function(t,e){return t instanceof iP?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof JI?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof tP?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},hP.prototype.interfaces_=function(){return[sP.GeometryEditorOperation]},hP.prototype.getClass=function(){return hP};var cP=function(){var t=this;if(this._dimension=3,this._coordinates=null,1===arguments.length){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 r=0;r<e;r++)t._coordinates[r]=new uB}else if(dB(arguments[0],CB)){var n=arguments[0];if(null===n)return this._coordinates=new Array(0).fill(null),null;this._dimension=n.getDimension(),this._coordinates=new Array(n.size()).fill(null);for(var i=0;i<this._coordinates.length;i++)t._coordinates[i]=n.getCoordinateCopy(i)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var o=arguments[0],s=arguments[1];this._coordinates=o,this._dimension=s,null===o&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var a=arguments[0],l=arguments[1];this._coordinates=new Array(a).fill(null),this._dimension=l;for(var u=0;u<a;u++)t._coordinates[u]=new uB}},AP={serialVersionUID:{configurable:!0}};cP.prototype.setOrdinate=function(t,e,r){switch(e){case CB.X:this._coordinates[t].x=r;break;case CB.Y:this._coordinates[t].y=r;break;case CB.Z:this._coordinates[t].z=r;break;default:throw new rB("invalid ordinateIndex")}},cP.prototype.size=function(){return this._coordinates.length},cP.prototype.getOrdinate=function(t,e){switch(e){case CB.X:return this._coordinates[t].x;case CB.Y:return this._coordinates[t].y;case CB.Z:return this._coordinates[t].z}return nB.NaN},cP.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}if(2===arguments.length){var e=arguments[0],r=arguments[1];r.x=this._coordinates[e].x,r.y=this._coordinates[e].y,r.z=this._coordinates[e].z}},cP.prototype.getCoordinateCopy=function(t){return new uB(this._coordinates[t])},cP.prototype.getDimension=function(){return this._dimension},cP.prototype.getX=function(t){return this._coordinates[t].x},cP.prototype.clone=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].clone();return new cP(t,this._dimension)},cP.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},cP.prototype.copy=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].copy();return new cP(t,this._dimension)},cP.prototype.toString=function(){if(this._coordinates.length>0){var t=new mB(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"},cP.prototype.getY=function(t){return this._coordinates[t].y},cP.prototype.toCoordinateArray=function(){return this._coordinates},cP.prototype.interfaces_=function(){return[CB,lB]},cP.prototype.getClass=function(){return cP},AP.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(cP,AP);var fP=function(){},pP={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};fP.prototype.readResolve=function(){return fP.instance()},fP.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array)return new cP(arguments[0]);if(dB(arguments[0],CB))return new cP(arguments[0])}else if(2===arguments.length){var t=arguments[0],e=arguments[1];return e>3&&(e=3),e<2?new cP(t):new cP(t,e)}},fP.prototype.interfaces_=function(){return[AB,lB]},fP.prototype.getClass=function(){return fP},fP.instance=function(){return fP.instanceObject},pP.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},pP.instanceObject.get=function(){return new fP},Object.defineProperties(fP,pP);var dP=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return this.map_.get(t)||null},e.prototype.put=function(t,e){return this.map_.set(t,e),e},e.prototype.values=function(){for(var t=new hI,e=this.map_.values(),r=e.next();!r.done;)t.add(r.value),r=e.next();return t},e.prototype.entrySet=function(){var t=new wI;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(yI),gP=function t(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=t.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof mP){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var r=arguments[0];this._modelType=t.FIXED,this.setScale(r)}else if(arguments[0]instanceof t){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}},yP={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};gP.prototype.equals=function(t){if(!(t instanceof gP))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},gP.prototype.compareTo=function(t){var e=t,r=this.getMaximumSignificantDigits(),n=e.getMaximumSignificantDigits();return new vB(r).compareTo(new vB(n))},gP.prototype.getScale=function(){return this._scale},gP.prototype.isFloating=function(){return this._modelType===gP.FLOATING||this._modelType===gP.FLOATING_SINGLE},gP.prototype.getType=function(){return this._modelType},gP.prototype.toString=function(){var t="UNKNOWN";return this._modelType===gP.FLOATING?t="Floating":this._modelType===gP.FLOATING_SINGLE?t="Floating-Single":this._modelType===gP.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},gP.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return nB.isNaN(t)||this._modelType===gP.FLOATING_SINGLE?t:this._modelType===gP.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof uB){var e=arguments[0];if(this._modelType===gP.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},gP.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===gP.FLOATING?t=16:this._modelType===gP.FLOATING_SINGLE?t=6:this._modelType===gP.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},gP.prototype.setScale=function(t){this._scale=Math.abs(t)},gP.prototype.interfaces_=function(){return[lB,oB]},gP.prototype.getClass=function(){return gP},gP.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},yP.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},yP.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(gP,yP);var mP=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},vP={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};mP.prototype.readResolve=function(){return mP.nameToTypeMap.get(this._name)},mP.prototype.toString=function(){return this._name},mP.prototype.interfaces_=function(){return[lB]},mP.prototype.getClass=function(){return mP},vP.serialVersionUID.get=function(){return-552860263173159e4},vP.nameToTypeMap.get=function(){return new dP},Object.defineProperties(mP,vP),gP.Type=mP,gP.FIXED=new mP("FIXED"),gP.FLOATING=new mP("FLOATING"),gP.FLOATING_SINGLE=new mP("FLOATING SINGLE");var _P=function t(){this._precisionModel=new gP,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?dB(arguments[0],AB)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof gP&&(this._precisionModel=arguments[0]):2===arguments.length?(this._precisionModel=arguments[0],this._SRID=arguments[1]):3===arguments.length&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},wP={serialVersionUID:{configurable:!0}};_P.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new uB(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new uB(t.getMinX(),t.getMinY()),new uB(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new uB(t.getMinX(),t.getMinY()),new uB(t.getMinX(),t.getMaxY()),new uB(t.getMaxX(),t.getMaxY()),new uB(t.getMaxX(),t.getMinY()),new uB(t.getMinX(),t.getMinY())]),null)},_P.prototype.createLineString=function(t){return t?t instanceof Array?new JI(this.getCoordinateSequenceFactory().create(t),this):dB(t,CB)?new JI(t,this):void 0:new JI(this.getCoordinateSequenceFactory().create([]),this)},_P.prototype.createMultiLineString=function(){return 0===arguments.length?new GI(null,this):1===arguments.length?new GI(arguments[0],this):void 0},_P.prototype.buildGeometry=function(t){for(var e=null,r=!1,n=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();null===e&&(e=s),s!==e&&(r=!0),o.isGeometryCollectionOrDerived()&&(n=!0)}if(null===e)return this.createGeometryCollection();if(r||n)return this.createGeometryCollection(_P.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof rP)return this.createMultiPolygon(_P.toPolygonArray(t));if(a instanceof JI)return this.createMultiLineString(_P.toLineStringArray(t));if(a instanceof tP)return this.createMultiPoint(_P.toPointArray(t));GB.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},_P.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},_P.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof uB){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(dB(arguments[0],CB))return new tP(arguments[0],this)}},_P.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},_P.prototype.createPolygon=function(){if(0===arguments.length)return new rP(null,null,this);if(1===arguments.length){if(dB(arguments[0],CB)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof iP){var r=arguments[0];return this.createPolygon(r,null)}}else if(2===arguments.length)return new rP(arguments[0],arguments[1],this)},_P.prototype.getSRID=function(){return this._SRID},_P.prototype.createGeometryCollection=function(){return 0===arguments.length?new DI(null,this):1===arguments.length?new DI(arguments[0],this):void 0},_P.prototype.createGeometry=function(t){return new sP(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},_P.prototype.getPrecisionModel=function(){return this._precisionModel},_P.prototype.createLinearRing=function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(dB(arguments[0],CB))return new iP(arguments[0],this)}},_P.prototype.createMultiPolygon=function(){return 0===arguments.length?new oP(null,this):1===arguments.length?new oP(arguments[0],this):void 0},_P.prototype.createMultiPoint=function(){if(0===arguments.length)return new nP(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new nP(arguments[0],this);if(arguments[0]instanceof Array){var t=arguments[0];return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(dB(arguments[0],CB)){var e=arguments[0];if(null===e)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(e.size()).fill(null),n=0;n<e.size();n++){var i=this.getCoordinateSequenceFactory().create(1,e.getDimension());ZI.copy(e,n,i,0,1),r[n]=this.createPoint(i)}return this.createMultiPoint(r)}}},_P.prototype.interfaces_=function(){return[lB]},_P.prototype.getClass=function(){return _P},_P.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_P.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},_P.getDefaultCoordinateSequenceFactory=function(){return fP.instance()},_P.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_P.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_P.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_P.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_P.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_P.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_P.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},wP.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(_P,wP);var bP=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],xP=function(t){this.geometryFactory=t||new _P};xP.prototype.read=function(t){var e,r=(e="string"==typeof t?JSON.parse(t):t).type;if(!EP[r])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==bP.indexOf(r)?EP[r].apply(this,[e.coordinates]):"GeometryCollection"===r?EP[r].apply(this,[e.geometries]):EP[r].apply(this,[e])},xP.prototype.write=function(t){var e=t.getGeometryType();if(!CP[e])throw new Error("Geometry is not supported");return CP[e].apply(this,[t])};var EP={Feature:function(t){var e={};for(var r in t)e[r]=t[r];if(t.geometry){var n=t.geometry.type;if(!EP[n])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=EP.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var r=0;r<t.features.length;++r)e.features.push(this.read(t.features[r]))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},coordinates:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(new uB(n[0],n[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new uB(t[0],t[1]),new uB(t[2],t[1]),new uB(t[2],t[3]),new uB(t[0],t[3]),new uB(t[0],t[1])])},Point:function(t){var e=new uB(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],r=0;r<t.length;++r)e.push(EP.Point.apply(this,[t[r]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=EP.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],r=0;r<t.length;++r)e.push(EP.LineString.apply(this,[t[r]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=EP.coordinates.apply(this,[t[0]]),r=this.geometryFactory.createLinearRing(e),n=[],i=1;i<t.length;++i){var o=t[i],s=EP.coordinates.apply(this,[o]),a=this.geometryFactory.createLinearRing(s);n.push(a)}return this.geometryFactory.createPolygon(r,n)},MultiPolygon:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(EP.Polygon.apply(this,[n]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(this.read(n))}return this.geometryFactory.createGeometryCollection(e)}},CP={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:CP.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=CP.Point.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],r=t.getCoordinates(),n=0;n<r.length;++n){var i=r[n];e.push(CP.coordinate.apply(this,[i]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=CP.LineString.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],r=CP.LineString.apply(this,[t._shell]);e.push(r.coordinates);for(var n=0;n<t._holes.length;++n){var i=t._holes[n],o=CP.LineString.apply(this,[i]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=CP.Polygon.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=n.getGeometryType();e.push(CP[i].apply(this,[n]))}return{type:"GeometryCollection",geometries:e}}},SP=function(t){this.geometryFactory=t||new _P,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new xP(this.geometryFactory)};SP.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===gP.FIXED&&this.reducePrecision(e),e},SP.prototype.reducePrecision=function(t){var e,r;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(e=0,r=t.points.length;e<r;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,r=t.geometries.length;e<r;e++)this.reducePrecision(t.geometries[e])};var BP=function(){this.parser=new xP(this.geometryFactory)};BP.prototype.write=function(t){return this.parser.write(t)};var IP=function(){},PP={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};function TP(t){this.message=t||""}function FP(){this.array_=[]}IP.prototype.interfaces_=function(){return[]},IP.prototype.getClass=function(){return IP},IP.opposite=function(t){return t===IP.LEFT?IP.RIGHT:t===IP.RIGHT?IP.LEFT:t},PP.ON.get=function(){return 0},PP.LEFT.get=function(){return 1},PP.RIGHT.get=function(){return 2},Object.defineProperties(IP,PP),TP.prototype=new Error,TP.prototype.name="EmptyStackException",FP.prototype=new lI,FP.prototype.add=function(t){return this.array_.push(t),!0},FP.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},FP.prototype.push=function(t){return this.array_.push(t),t},FP.prototype.pop=function(t){if(0===this.array_.length)throw new TP;return this.array_.pop()},FP.prototype.peek=function(){if(0===this.array_.length)throw new TP;return this.array_[this.array_.length-1]},FP.prototype.empty=function(){return 0===this.array_.length},FP.prototype.isEmpty=function(){return this.empty()},FP.prototype.search=function(t){return this.array_.indexOf(t)},FP.prototype.size=function(){return this.array_.length},FP.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t};var MP=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};MP.prototype.getCoordinate=function(){return this._minCoord},MP.prototype.getRightmostSide=function(t,e){var r=this.getRightmostSideOfSegment(t,e);return r<0&&(r=this.getRightmostSideOfSegment(t,e-1)),r<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),r},MP.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();GB.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],r=t[this._minIndex+1],n=KB.computeOrientation(this._minCoord,r,e),i=!1;(e.y<this._minCoord.y&&r.y<this._minCoord.y&&n===KB.COUNTERCLOCKWISE||e.y>this._minCoord.y&&r.y>this._minCoord.y&&n===KB.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},MP.prototype.getRightmostSideOfSegment=function(t,e){var r=t.getEdge().getCoordinates();if(e<0||e+1>=r.length)return-1;if(r[e].y===r[e+1].y)return-1;var n=IP.LEFT;return r[e].y<r[e+1].y&&(n=IP.RIGHT),n},MP.prototype.getEdge=function(){return this._orientedDe},MP.prototype.checkForRightmostCoordinate=function(t){for(var e=this,r=t.getEdge().getCoordinates(),n=0;n<r.length-1;n++)(null===e._minCoord||r[n].x>e._minCoord.x)&&(e._minDe=t,e._minIndex=n,e._minCoord=r[n])},MP.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},MP.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();r.isForward()&&this.checkForRightmostCoordinate(r)}GB.isTrue(0!==this._minIndex||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),0===this._minIndex?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===IP.LEFT&&(this._orientedDe=this._minDe.getSym())},MP.prototype.interfaces_=function(){return[]},MP.prototype.getClass=function(){return MP};var LP=function(t){function e(r,n){t.call(this,e.msgWithCoord(r,n)),this.pt=n?new uB(n):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(t,e){return e?t:t+" [ "+e+" ]"},e}(UB),OP=function(){this.array_=[]};OP.prototype.addLast=function(t){this.array_.push(t)},OP.prototype.removeFirst=function(){return this.array_.shift()},OP.prototype.isEmpty=function(){return 0===this.array_.length};var NP=function(){this._finder=null,this._dirEdgeList=new hI,this._nodes=new hI,this._rightMostCoord=null,this._env=null,this._finder=new MP};NP.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},NP.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},NP.prototype.computeNodeDepth=function(t){for(var e=null,r=t.getEdges().iterator();r.hasNext();){var n=r.next();if(n.isVisited()||n.getSym().isVisited()){e=n;break}}if(null===e)throw new LP("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var i=t.getEdges().iterator();i.hasNext();){var o=i.next();o.setVisited(!0),this.copySymDepths(o)}},NP.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(IP.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},NP.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},NP.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(IP.RIGHT)>=1&&e.getDepth(IP.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},NP.prototype.computeDepths=function(t){var e=new wI,r=new OP,n=t.getNode();for(r.addLast(n),e.add(n),t.setVisited(!0);!r.isEmpty();){var i=r.removeFirst();e.add(i),this.computeNodeDepth(i);for(var o=i.getEdges().iterator();o.hasNext();){var s=o.next().getSym();if(!s.isVisited()){var a=s.getNode();e.contains(a)||(r.addLast(a),e.add(a))}}}},NP.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},NP.prototype.getEnvelope=function(){if(null===this._env){for(var t=new FB,e=this._dirEdgeList.iterator();e.hasNext();)for(var r=e.next().getEdge().getCoordinates(),n=0;n<r.length-1;n++)t.expandToInclude(r[n]);this._env=t}return this._env},NP.prototype.addReachable=function(t){var e=new FP;for(e.add(t);!e.empty();){var r=e.pop();this.add(r,e)}},NP.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(IP.LEFT,t.getDepth(IP.RIGHT)),e.setDepth(IP.RIGHT,t.getDepth(IP.LEFT))},NP.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var r=t.getEdges().iterator();r.hasNext();){var n=r.next();this._dirEdgeList.add(n);var i=n.getSym().getNode();i.isVisited()||e.push(i)}},NP.prototype.getNodes=function(){return this._nodes},NP.prototype.getDirectedEdges=function(){return this._dirEdgeList},NP.prototype.interfaces_=function(){return[oB]},NP.prototype.getClass=function(){return NP};var RP=function t(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var r=arguments[0];this.init(1),this.location[IP.ON]=r}else if(arguments[0]instanceof t){var n=arguments[0];if(this.init(n.location.length),null!==n)for(var i=0;i<this.location.length;i++)this.location[i]=n.location[i]}}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.init(3),this.location[IP.ON]=o,this.location[IP.LEFT]=s,this.location[IP.RIGHT]=a}};RP.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},RP.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==fB.NONE)return!1;return!0},RP.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===fB.NONE&&(this.location[e]=t)},RP.prototype.isLine=function(){return 1===this.location.length},RP.prototype.merge=function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[IP.ON]=this.location[IP.ON],e[IP.LEFT]=fB.NONE,e[IP.RIGHT]=fB.NONE,this.location=e}for(var r=0;r<this.location.length;r++)this.location[r]===fB.NONE&&r<t.location.length&&(this.location[r]=t.location[r])},RP.prototype.getLocations=function(){return this.location},RP.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[IP.LEFT];this.location[IP.LEFT]=this.location[IP.RIGHT],this.location[IP.RIGHT]=t},RP.prototype.toString=function(){var t=new mB;return this.location.length>1&&t.append(fB.toLocationSymbol(this.location[IP.LEFT])),t.append(fB.toLocationSymbol(this.location[IP.ON])),this.location.length>1&&t.append(fB.toLocationSymbol(this.location[IP.RIGHT])),t.toString()},RP.prototype.setLocations=function(t,e,r){this.location[IP.ON]=t,this.location[IP.LEFT]=e,this.location[IP.RIGHT]=r},RP.prototype.get=function(t){return t<this.location.length?this.location[t]:fB.NONE},RP.prototype.isArea=function(){return this.location.length>1},RP.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===fB.NONE)return!0;return!1},RP.prototype.setLocation=function(){if(1===arguments.length){var t=arguments[0];this.setLocation(IP.ON,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.location[e]=r}},RP.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(fB.NONE)},RP.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},RP.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},RP.prototype.interfaces_=function(){return[]},RP.prototype.getClass=function(){return RP};var kP=function t(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments[0])){var e=arguments[0];this.elt[0]=new RP(e),this.elt[1]=new RP(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.elt[0]=new RP(r.elt[0]),this.elt[1]=new RP(r.elt[1])}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.elt[0]=new RP(fB.NONE),this.elt[1]=new RP(fB.NONE),this.elt[n].setLocation(i)}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.elt[0]=new RP(o,s,a),this.elt[1]=new RP(o,s,a)}else if(4===arguments.length){var l=arguments[0],u=arguments[1],h=arguments[2],c=arguments[3];this.elt[0]=new RP(fB.NONE,fB.NONE,fB.NONE),this.elt[1]=new RP(fB.NONE,fB.NONE,fB.NONE),this.elt[l].setLocations(u,h,c)}};kP.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},kP.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},kP.prototype.isNull=function(t){return this.elt[t].isNull()},kP.prototype.setAllLocationsIfNull=function(){if(1===arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.elt[e].setAllLocationsIfNull(r)}},kP.prototype.isLine=function(t){return this.elt[t].isLine()},kP.prototype.merge=function(t){for(var e=this,r=0;r<2;r++)null===e.elt[r]&&null!==t.elt[r]?e.elt[r]=new RP(t.elt[r]):e.elt[r].merge(t.elt[r])},kP.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},kP.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(IP.ON)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return this.elt[e].get(r)}},kP.prototype.toString=function(){var t=new mB;return null!==this.elt[0]&&(t.append("A:"),t.append(this.elt[0].toString())),null!==this.elt[1]&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},kP.prototype.isArea=function(){if(0===arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1===arguments.length){var t=arguments[0];return this.elt[t].isArea()}},kP.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},kP.prototype.setLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(IP.ON,e)}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this.elt[r].setLocation(n,i)}},kP.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},kP.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},kP.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new RP(this.elt[t].location[0]))},kP.prototype.interfaces_=function(){return[]},kP.prototype.getClass=function(){return kP},kP.toLineLabel=function(t){for(var e=new kP(fB.NONE),r=0;r<2;r++)e.setLocation(r,t.getLocation(r));return e};var UP=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new hI,this._pts=new hI,this._label=new kP(fB.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new hI,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};UP.prototype.computeRing=function(){if(null!==this._ring)return null;for(var t=new Array(this._pts.size()).fill(null),e=0;e<this._pts.size();e++)t[e]=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=KB.isCCW(this._ring.getCoordinates())},UP.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},UP.prototype.computePoints=function(t){var e=this;this._startDe=t;var r=t,n=!0;do{if(null===r)throw new LP("Found null DirectedEdge");if(r.getEdgeRing()===e)throw new LP("Directed Edge visited twice during ring-building at "+r.getCoordinate());e._edges.add(r);var i=r.getLabel();GB.isTrue(i.isArea()),e.mergeLabel(i),e.addPoints(r.getEdge(),r.isForward(),n),n=!1,e.setEdgeRing(r,e),r=e.getNext(r)}while(r!==this._startDe)},UP.prototype.getLinearRing=function(){return this._ring},UP.prototype.getCoordinate=function(t){return this._pts.get(t)},UP.prototype.computeMaxNodeDegree=function(){var t=this;this._maxNodeDegree=0;var e=this._startDe;do{var r=e.getNode().getEdges().getOutgoingDegree(t);r>t._maxNodeDegree&&(t._maxNodeDegree=r),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},UP.prototype.addPoints=function(t,e,r){var n=t.getCoordinates();if(e){var i=1;r&&(i=0);for(var o=i;o<n.length;o++)this._pts.add(n[o])}else{var s=n.length-2;r&&(s=n.length-1);for(var a=s;a>=0;a--)this._pts.add(n[a])}},UP.prototype.isHole=function(){return this._isHole},UP.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},UP.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!KB.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();)if(r.next().containsPoint(t))return!1;return!0},UP.prototype.addHole=function(t){this._holes.add(t)},UP.prototype.isShell=function(){return null===this._shell},UP.prototype.getLabel=function(){return this._label},UP.prototype.getEdges=function(){return this._edges},UP.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},UP.prototype.getShell=function(){return this._shell},UP.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[1],r=arguments[0].getLocation(e,IP.RIGHT);if(r===fB.NONE)return null;if(this._label.getLocation(e)===fB.NONE)return this._label.setLocation(e,r),null}},UP.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},UP.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),r=0;r<this._holes.size();r++)e[r]=this._holes.get(r).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},UP.prototype.interfaces_=function(){return[]},UP.prototype.getClass=function(){return UP};var DP=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setEdgeRing=function(t,e){t.setMinEdgeRing(e)},e.prototype.getNext=function(t){return t.getNextMin()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(UP),GP=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildMinimalRings=function(){var t=new hI,e=this._startDe;do{if(null===e.getMinEdgeRing()){var r=new DP(e,this._geometryFactory);t.add(r)}e=e.getNext()}while(e!==this._startDe);return t},e.prototype.setEdgeRing=function(t,e){t.setEdgeRing(e)},e.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var t=this._startDe;do{t.getNode().getEdges().linkMinimalDirectedEdges(this),t=t.getNext()}while(t!==this._startDe)},e.prototype.getNext=function(t){return t.getNext()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(UP),QP=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._label=t}};QP.prototype.setVisited=function(t){this._isVisited=t},QP.prototype.setInResult=function(t){this._isInResult=t},QP.prototype.isCovered=function(){return this._isCovered},QP.prototype.isCoveredSet=function(){return this._isCoveredSet},QP.prototype.setLabel=function(t){this._label=t},QP.prototype.getLabel=function(){return this._label},QP.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},QP.prototype.updateIM=function(t){GB.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},QP.prototype.isInResult=function(){return this._isInResult},QP.prototype.isVisited=function(){return this._isVisited},QP.prototype.interfaces_=function(){return[]},QP.prototype.getClass=function(){return QP};var jP=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],r=arguments[1];this._coord=e,this._edges=r,this._label=new kP(0,fB.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();)if(t.next().getEdge().isInResult())return!0;return!1},e.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(t){t.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(t){},e.prototype.computeMergedLocation=function(t,e){var r=fB.NONE;if(r=this._label.getLocation(e),!t.isNull(e)){var n=t.getLocation(e);r!==fB.BOUNDARY&&(r=n)}return r},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],r=arguments[1];null===this._label?this._label=new kP(e,r):this._label.setLocation(e,r)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var t=this;if(arguments[0]instanceof e){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof kP)for(var n=arguments[0],i=0;i<2;i++){var o=t.computeMergedLocation(n,i);t._label.getLocation(i)===fB.NONE&&t._label.setLocation(i,o)}},e.prototype.add=function(t){this._edges.insert(t),t.setNode(this)},e.prototype.setLabelBoundary=function(t){if(null===this._label)return null;var e=fB.NONE;null!==this._label&&(e=this._label.getLocation(t));var r=null;switch(e){case fB.BOUNDARY:r=fB.INTERIOR;break;case fB.INTERIOR:default:r=fB.BOUNDARY}this._label.setLocation(t,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(QP),HP=function(){this.nodeMap=new PI,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};HP.prototype.find=function(t){return this.nodeMap.get(t)},HP.prototype.addNode=function(){if(arguments[0]instanceof uB){var t=arguments[0],e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof jP){var r=arguments[0],n=this.nodeMap.get(r.getCoordinate());return null===n?(this.nodeMap.put(r.getCoordinate(),r),r):(n.mergeLabel(r),n)}},HP.prototype.print=function(t){for(var e=this.iterator();e.hasNext();)e.next().print(t)},HP.prototype.iterator=function(){return this.nodeMap.values().iterator()},HP.prototype.values=function(){return this.nodeMap.values()},HP.prototype.getBoundaryNodes=function(t){for(var e=new hI,r=this.iterator();r.hasNext();){var n=r.next();n.getLabel().getLocation(t)===fB.BOUNDARY&&e.add(n)}return e},HP.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},HP.prototype.interfaces_=function(){return[]},HP.prototype.getClass=function(){return HP};var zP=function(){},VP={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};zP.prototype.interfaces_=function(){return[]},zP.prototype.getClass=function(){return zP},zP.isNorthern=function(t){return t===zP.NE||t===zP.NW},zP.isOpposite=function(t,e){return t!==e&&2==(t-e+4)%4},zP.commonHalfPlane=function(t,e){if(t===e)return t;if(2==(t-e+4)%4)return-1;var r=t<e?t:e;return 0===r&&3===(t>e?t:e)?3:r},zP.isInHalfPlane=function(t,e){return e===zP.SE?t===zP.SE||t===zP.SW:t===e||t===e+1},zP.quadrant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new rB("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?zP.NE:zP.SE:e>=0?zP.NW:zP.SW}if(arguments[0]instanceof uB&&arguments[1]instanceof uB){var r=arguments[0],n=arguments[1];if(n.x===r.x&&n.y===r.y)throw new rB("Cannot compute the quadrant for two identical points "+r);return n.x>=r.x?n.y>=r.y?zP.NE:zP.SE:n.y>=r.y?zP.NW:zP.SW}},VP.NE.get=function(){return 0},VP.NW.get=function(){return 1},VP.SW.get=function(){return 2},VP.SE.get=function(){return 3},Object.defineProperties(zP,VP);var KP=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,1===arguments.length){var t=arguments[0];this._edge=t}else if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];this._edge=e,this.init(r,n),this._label=null}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._edge=i,this.init(o,s),this._label=a}};KP.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:KB.computeOrientation(t._p0,t._p1,this._p1)},KP.prototype.getDy=function(){return this._dy},KP.prototype.getCoordinate=function(){return this._p0},KP.prototype.setNode=function(t){this._node=t},KP.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),r=this.getClass().getName(),n=r.lastIndexOf("."),i=r.substring(n+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},KP.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},KP.prototype.getDirectedCoordinate=function(){return this._p1},KP.prototype.getDx=function(){return this._dx},KP.prototype.getLabel=function(){return this._label},KP.prototype.getEdge=function(){return this._edge},KP.prototype.getQuadrant=function(){return this._quadrant},KP.prototype.getNode=function(){return this._node},KP.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),r=e.lastIndexOf(".");return" "+e.substring(r+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},KP.prototype.computeLabel=function(t){},KP.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=zP.quadrant(this._dx,this._dy),GB.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},KP.prototype.interfaces_=function(){return[oB]},KP.prototype.getClass=function(){return KP};var qP=function(t){function e(){var e=arguments[0],r=arguments[1];if(t.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=r,r)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var n=e.getNumPoints()-1;this.init(e.getCoordinate(n),e.getCoordinate(n-1))}this.computeDirectedLabel()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getNextMin=function(){return this._nextMin},e.prototype.getDepth=function(t){return this._depth[t]},e.prototype.setVisited=function(t){this._isVisited=t},e.prototype.computeDirectedLabel=function(){this._label=new kP(this._edge.getLabel()),this._isForward||this._label.flip()},e.prototype.getNext=function(){return this._next},e.prototype.setDepth=function(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new LP("assigned depths do not match",this.getCoordinate());this._depth[t]=e},e.prototype.isInteriorAreaEdge=function(){for(var t=this,e=!0,r=0;r<2;r++)t._label.isArea(r)&&t._label.getLocation(r,IP.LEFT)===fB.INTERIOR&&t._label.getLocation(r,IP.RIGHT)===fB.INTERIOR||(e=!1);return e},e.prototype.setNextMin=function(t){this._nextMin=t},e.prototype.print=function(e){t.prototype.print.call(this,e),e.print(" "+this._depth[IP.LEFT]+"/"+this._depth[IP.RIGHT]),e.print(" ("+this.getDepthDelta()+")"),this._isInResult&&e.print(" inResult")},e.prototype.setMinEdgeRing=function(t){this._minEdgeRing=t},e.prototype.isLineEdge=function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,fB.EXTERIOR),r=!this._label.isArea(1)||this._label.allPositionsEqual(1,fB.EXTERIOR);return t&&e&&r},e.prototype.setEdgeRing=function(t){this._edgeRing=t},e.prototype.getMinEdgeRing=function(){return this._minEdgeRing},e.prototype.getDepthDelta=function(){var t=this._edge.getDepthDelta();return this._isForward||(t=-t),t},e.prototype.setInResult=function(t){this._isInResult=t},e.prototype.getSym=function(){return this._sym},e.prototype.isForward=function(){return this._isForward},e.prototype.getEdge=function(){return this._edge},e.prototype.printEdge=function(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)},e.prototype.setSym=function(t){this._sym=t},e.prototype.setVisitedEdge=function(t){this.setVisited(t),this._sym.setVisited(t)},e.prototype.setEdgeDepths=function(t,e){var r=this.getEdge().getDepthDelta();this._isForward||(r=-r);var n=1;t===IP.LEFT&&(n=-1);var i=IP.opposite(t),o=e+r*n;this.setDepth(t,e),this.setDepth(i,o)},e.prototype.getEdgeRing=function(){return this._edgeRing},e.prototype.isInResult=function(){return this._isInResult},e.prototype.setNext=function(t){this._next=t},e.prototype.isVisited=function(){return this._isVisited},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.depthFactor=function(t,e){return t===fB.EXTERIOR&&e===fB.INTERIOR?1:t===fB.INTERIOR&&e===fB.EXTERIOR?-1:0},e}(KP),WP=function(){};WP.prototype.createNode=function(t){return new jP(t,null)},WP.prototype.interfaces_=function(){return[]},WP.prototype.getClass=function(){return WP};var XP=function(){if(this._edges=new hI,this._nodes=null,this._edgeEndList=new hI,0===arguments.length)this._nodes=new HP(new WP);else if(1===arguments.length){var t=arguments[0];this._nodes=new HP(t)}};XP.prototype.printEdges=function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var r=this._edges.get(e);r.print(t),r.eiList.print(t)}},XP.prototype.find=function(t){return this._nodes.find(t)},XP.prototype.addNode=function(){if(arguments[0]instanceof jP){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof uB){var e=arguments[0];return this._nodes.addNode(e)}},XP.prototype.getNodeIterator=function(){return this._nodes.iterator()},XP.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()},XP.prototype.debugPrintln=function(t){PB.out.println(t)},XP.prototype.isBoundaryNode=function(t,e){var r=this._nodes.find(e);if(null===r)return!1;var n=r.getLabel();return null!==n&&n.getLocation(t)===fB.BOUNDARY},XP.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()},XP.prototype.matchInSameDirection=function(t,e,r,n){return!!t.equals(r)&&KB.computeOrientation(t,e,n)===KB.COLLINEAR&&zP.quadrant(t,e)===zP.quadrant(r,n)},XP.prototype.getEdgeEnds=function(){return this._edgeEndList},XP.prototype.debugPrint=function(t){PB.out.print(t)},XP.prototype.getEdgeIterator=function(){return this._edges.iterator()},XP.prototype.findEdgeInSameDirection=function(t,e){for(var r=this,n=0;n<this._edges.size();n++){var i=r._edges.get(n),o=i.getCoordinates();if(r.matchInSameDirection(t,e,o[0],o[1]))return i;if(r.matchInSameDirection(t,e,o[o.length-1],o[o.length-2]))return i}return null},XP.prototype.insertEdge=function(t){this._edges.add(t)},XP.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var r=e.next();if(r.getEdge()===t)return r}return null},XP.prototype.addEdges=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next();e._edges.add(n);var i=new qP(n,!0),o=new qP(n,!1);i.setSym(o),o.setSym(i),e.add(i),e.add(o)}},XP.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},XP.prototype.getNodes=function(){return this._nodes.values()},XP.prototype.findEdge=function(t,e){for(var r=0;r<this._edges.size();r++){var n=this._edges.get(r),i=n.getCoordinates();if(t.equals(i[0])&&e.equals(i[1]))return n}return null},XP.prototype.interfaces_=function(){return[]},XP.prototype.getClass=function(){return XP},XP.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()};var YP=function(){this._geometryFactory=null,this._shellList=new hI;var t=arguments[0];this._geometryFactory=t};YP.prototype.sortShellsAndHoles=function(t,e,r){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isHole()?r.add(i):e.add(i)}},YP.prototype.computePolygons=function(t){for(var e=new hI,r=t.iterator();r.hasNext();){var n=r.next().toPolygon(this._geometryFactory);e.add(n)}return e},YP.prototype.placeFreeHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(null===n.getShell()){var i=this.findEdgeRingContaining(n,t);if(null===i)throw new LP("unable to assign hole to a shell",n.getCoordinate(0));n.setShell(i)}}},YP.prototype.buildMinimalEdgeRings=function(t,e,r){for(var n=new hI,i=t.iterator();i.hasNext();){var o=i.next();if(o.getMaxNodeDegree()>2){o.linkDirectedEdgesForMinimalEdgeRings();var s=o.buildMinimalRings(),a=this.findShell(s);null!==a?(this.placePolygonHoles(a,s),e.add(a)):r.addAll(s)}else n.add(o)}return n},YP.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();)if(e.next().containsPoint(t))return!0;return!1},YP.prototype.buildMaximalEdgeRings=function(t){for(var e=new hI,r=t.iterator();r.hasNext();){var n=r.next();if(n.isInResult()&&n.getLabel().isArea()&&null===n.getEdgeRing()){var i=new GP(n,this._geometryFactory);e.add(i),i.setInResult()}}return e},YP.prototype.placePolygonHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();n.isHole()&&n.setShell(t)}},YP.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},YP.prototype.findEdgeRingContaining=function(t,e){for(var r=t.getLinearRing(),n=r.getEnvelopeInternal(),i=r.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var l=a.next(),u=l.getLinearRing(),h=u.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var c=!1;h.contains(n)&&KB.isPointInRing(i,u.getCoordinates())&&(c=!0),c&&(null===o||s.contains(h))&&(o=l)}return o},YP.prototype.findShell=function(t){for(var e=0,r=null,n=t.iterator();n.hasNext();){var i=n.next();i.isHole()||(r=i,e++)}return GB.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),r},YP.prototype.add=function(){if(1===arguments.length){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){var e=arguments[0],r=arguments[1];XP.linkResultDirectedEdges(r);var n=this.buildMaximalEdgeRings(e),i=new hI,o=this.buildMinimalEdgeRings(n,this._shellList,i);this.sortShellsAndHoles(o,this._shellList,i),this.placeFreeHoles(this._shellList,i)}},YP.prototype.interfaces_=function(){return[]},YP.prototype.getClass=function(){return YP};var ZP=function(){};ZP.prototype.getBounds=function(){},ZP.prototype.interfaces_=function(){return[]},ZP.prototype.getClass=function(){return ZP};var JP=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};JP.prototype.getItem=function(){return this._item},JP.prototype.getBounds=function(){return this._bounds},JP.prototype.interfaces_=function(){return[ZP,lB]},JP.prototype.getClass=function(){return JP};var $P=function(){this._size=null,this._items=null,this._size=0,this._items=new hI,this._items.add(null)};$P.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},$P.prototype.size=function(){return this._size},$P.prototype.reorder=function(t){for(var e=this,r=null,n=this._items.get(t);2*t<=this._size&&((r=2*t)!==e._size&&e._items.get(r+1).compareTo(e._items.get(r))<0&&r++,e._items.get(r).compareTo(n)<0);t=r)e._items.set(t,e._items.get(r));this._items.set(t,n)},$P.prototype.clear=function(){this._size=0,this._items.clear()},$P.prototype.isEmpty=function(){return 0===this._size},$P.prototype.add=function(t){this._items.add(null),this._size+=1;var e=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(e/2)))<0;e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)},$P.prototype.interfaces_=function(){return[]},$P.prototype.getClass=function(){return $P};var tT=function(){};tT.prototype.visitItem=function(t){},tT.prototype.interfaces_=function(){return[]},tT.prototype.getClass=function(){return tT};var eT=function(){};eT.prototype.insert=function(t,e){},eT.prototype.remove=function(t,e){},eT.prototype.query=function(){},eT.prototype.interfaces_=function(){return[]},eT.prototype.getClass=function(){return eT};var rT=function(){if(this._childBoundables=new hI,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},nT={serialVersionUID:{configurable:!0}};rT.prototype.getLevel=function(){return this._level},rT.prototype.size=function(){return this._childBoundables.size()},rT.prototype.getChildBoundables=function(){return this._childBoundables},rT.prototype.addChildBoundable=function(t){GB.isTrue(null===this._bounds),this._childBoundables.add(t)},rT.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},rT.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},rT.prototype.interfaces_=function(){return[ZP,lB]},rT.prototype.getClass=function(){return rT},nT.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(rT,nT);var iT=function(){};iT.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},iT.min=function(t){return iT.sort(t),t.get(0)},iT.sort=function(t,e){var r=t.toArray();e?OI.sort(r,e):OI.sort(r);for(var n=t.iterator(),i=0,o=r.length;i<o;i++)n.next(),n.set(r[i])},iT.singletonList=function(t){var e=new hI;return e.add(t),e};var oT=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],r=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=r,this._distance=this.distance()};oT.prototype.expandToQueue=function(t,e){var r=oT.isComposite(this._boundable1),n=oT.isComposite(this._boundable2);if(r&&n)return oT.area(this._boundable1)>oT.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(r)return this.expand(this._boundable1,this._boundable2,t,e),null;if(n)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new rB("neither boundable is composite")},oT.prototype.isLeaves=function(){return!(oT.isComposite(this._boundable1)||oT.isComposite(this._boundable2))},oT.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},oT.prototype.expand=function(t,e,r,n){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new oT(o,e,this._itemDistance);s.getDistance()<n&&r.add(s)}},oT.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},oT.prototype.getDistance=function(){return this._distance},oT.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},oT.prototype.interfaces_=function(){return[oB]},oT.prototype.getClass=function(){return oT},oT.area=function(t){return t.getBounds().getArea()},oT.isComposite=function(t){return t instanceof rT};var sT=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new hI,this._nodeCapacity=null,0===arguments.length){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(1===arguments.length){var r=arguments[0];GB.isTrue(r>1,"Node capacity must be greater than 1"),this._nodeCapacity=r}},aT={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};sT.prototype.getNodeCapacity=function(){return this._nodeCapacity},sT.prototype.lastNode=function(t){return t.get(t.size()-1)},sT.prototype.size=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();r instanceof rT?t+=this.size(r):r instanceof JP&&(t+=1)}return t}},sT.prototype.removeItem=function(t,e){for(var r=null,n=t.getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof JP&&i.getItem()===e&&(r=i)}return null!==r&&(t.getChildBoundables().remove(r),!0)},sT.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new hI:t}if(1===arguments.length){for(var e=arguments[0],r=new hI,n=e.getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof rT){var o=this.itemsTree(i);null!==o&&r.add(o)}else i instanceof JP?r.add(i.getItem()):GB.shouldNeverReachHere()}return r.size()<=0?null:r}},sT.prototype.insert=function(t,e){GB.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new JP(t,e))},sT.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new hI;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];if(GB.isTrue(r>-2),n.getLevel()===r)return i.add(n),null;for(var o=n.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof rT?this.boundablesAtLevel(r,s,i):(GB.isTrue(s instanceof JP),-1===r&&i.add(s))}return null}},sT.prototype.query=function(){var t=this;if(1===arguments.length){var e=arguments[0];this.build();var r=new hI;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,r),r}if(2===arguments.length){var n=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i)}else if(3===arguments.length)if(dB(arguments[2],tT)&&arguments[0]instanceof Object&&arguments[1]instanceof rT)for(var o=arguments[0],s=arguments[2],a=arguments[1].getChildBoundables(),l=0;l<a.size();l++){var u=a.get(l);t.getIntersectsOp().intersects(u.getBounds(),o)&&(u instanceof rT?t.query(o,u,s):u instanceof JP?s.visitItem(u.getItem()):GB.shouldNeverReachHere())}else if(dB(arguments[2],lI)&&arguments[0]instanceof Object&&arguments[1]instanceof rT)for(var h=arguments[0],c=arguments[2],A=arguments[1].getChildBoundables(),f=0;f<A.size();f++){var p=A.get(f);t.getIntersectsOp().intersects(p.getBounds(),h)&&(p instanceof rT?t.query(h,p,c):p instanceof JP?c.add(p.getItem()):GB.shouldNeverReachHere())}},sT.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},sT.prototype.getRoot=function(){return this.build(),this._root},sT.prototype.remove=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=this.removeItem(n,i);if(o)return!0;for(var s=null,a=n.getChildBoundables().iterator();a.hasNext();){var l=a.next();if(this.getIntersectsOp().intersects(l.getBounds(),r)&&l instanceof rT&&(o=this.remove(r,l,i))){s=l;break}}return null!==s&&s.getChildBoundables().isEmpty()&&n.getChildBoundables().remove(s),o}},sT.prototype.createHigherLevels=function(t,e){GB.isTrue(!t.isEmpty());var r=this.createParentBoundables(t,e+1);return 1===r.size()?r.get(0):this.createHigherLevels(r,e+1)},sT.prototype.depth=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();if(r instanceof rT){var n=this.depth(r);n>t&&(t=n)}}return t+1}},sT.prototype.createParentBoundables=function(t,e){var r=this;GB.isTrue(!t.isEmpty());var n=new hI;n.add(this.createNode(e));var i=new hI(t);iT.sort(i,this.getComparator());for(var o=i.iterator();o.hasNext();){var s=o.next();r.lastNode(n).getChildBoundables().size()===r.getNodeCapacity()&&n.add(r.createNode(e)),r.lastNode(n).addChildBoundable(s)}return n},sT.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},sT.prototype.interfaces_=function(){return[lB]},sT.prototype.getClass=function(){return sT},sT.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},aT.IntersectsOp.get=function(){return lT},aT.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},aT.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(sT,aT);var lT=function(){},uT=function(){};uT.prototype.distance=function(t,e){},uT.prototype.interfaces_=function(){return[]},uT.prototype.getClass=function(){return uT};var hT=function(t){function e(r){r=r||e.DEFAULT_NODE_CAPACITY,t.call(this,r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return e.prototype.createParentBoundablesFromVerticalSlices=function(t,e){GB.isTrue(t.length>0);for(var r=new hI,n=0;n<t.length;n++)r.addAll(this.createParentBoundablesFromVerticalSlice(t[n],e));return r},e.prototype.createNode=function(t){return new cT(t)},e.prototype.size=function(){return 0===arguments.length?t.prototype.size.call(this):t.prototype.size.apply(this,arguments)},e.prototype.insert=function(){if(2!==arguments.length)return t.prototype.insert.apply(this,arguments);var e=arguments[0],r=arguments[1];if(e.isNull())return null;t.prototype.insert.call(this,e,r)},e.prototype.getIntersectsOp=function(){return e.intersectsOp},e.prototype.verticalSlices=function(t,e){for(var r=Math.trunc(Math.ceil(t.size()/e)),n=new Array(e).fill(null),i=t.iterator(),o=0;o<e;o++){n[o]=new hI;for(var s=0;i.hasNext()&&s<r;){var a=i.next();n[o].add(a),s++}}return n},e.prototype.query=function(){if(1===arguments.length){var e=arguments[0];return t.prototype.query.call(this,e)}if(2===arguments.length){var r=arguments[0],n=arguments[1];t.prototype.query.call(this,r,n)}else if(3===arguments.length)if(dB(arguments[2],tT)&&arguments[0]instanceof Object&&arguments[1]instanceof rT){var i=arguments[0],o=arguments[1],s=arguments[2];t.prototype.query.call(this,i,o,s)}else if(dB(arguments[2],lI)&&arguments[0]instanceof Object&&arguments[1]instanceof rT){var a=arguments[0],l=arguments[1],u=arguments[2];t.prototype.query.call(this,a,l,u)}},e.prototype.getComparator=function(){return e.yComparator},e.prototype.createParentBoundablesFromVerticalSlice=function(e,r){return t.prototype.createParentBoundables.call(this,e,r)},e.prototype.remove=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return t.prototype.remove.call(this,e,r)}return t.prototype.remove.apply(this,arguments)},e.prototype.depth=function(){return 0===arguments.length?t.prototype.depth.call(this):t.prototype.depth.apply(this,arguments)},e.prototype.createParentBoundables=function(t,r){GB.isTrue(!t.isEmpty());var n=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new hI(t);iT.sort(i,e.xComparator);var o=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt(n))));return this.createParentBoundablesFromVerticalSlices(o,r)},e.prototype.nearestNeighbour=function(){if(1===arguments.length){if(dB(arguments[0],uT)){var t=arguments[0],r=new oT(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(r)}if(arguments[0]instanceof oT){var n=arguments[0];return this.nearestNeighbour(n,nB.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof e&&dB(arguments[1],uT)){var i=arguments[0],o=arguments[1],s=new oT(this.getRoot(),i.getRoot(),o);return this.nearestNeighbour(s)}if(arguments[0]instanceof oT&&"number"==typeof arguments[1]){var a=arguments[0],l=arguments[1],u=null,h=new $P;for(h.add(a);!h.isEmpty()&&l>0;){var c=h.poll(),A=c.getDistance();if(A>=l)break;c.isLeaves()?(l=A,u=c):c.expandToQueue(h,l)}return[u.getBoundable(0).getItem(),u.getBoundable(1).getItem()]}}else if(3===arguments.length){var f=arguments[2],p=new JP(arguments[0],arguments[1]),d=new oT(this.getRoot(),p,f);return this.nearestNeighbour(d)[0]}},e.prototype.interfaces_=function(){return[eT,lB]},e.prototype.getClass=function(){return e},e.centreX=function(t){return e.avg(t.getMinX(),t.getMaxX())},e.avg=function(t,e){return(t+e)/2},e.centreY=function(t){return e.avg(t.getMinY(),t.getMaxY())},r.STRtreeNode.get=function(){return cT},r.serialVersionUID.get=function(){return 0x39920f7d5f261e0},r.xComparator.get=function(){return{interfaces_:function(){return[aB]},compare:function(r,n){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(n.getBounds()))}}},r.yComparator.get=function(){return{interfaces_:function(){return[aB]},compare:function(r,n){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(n.getBounds()))}}},r.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},r.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,r),e}(sT),cT=function(t){function e(){var e=arguments[0];t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var r=e.next();null===t?t=new FB(r.getBounds()):t.expandToInclude(r.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(rT),AT=function(){};AT.prototype.interfaces_=function(){return[]},AT.prototype.getClass=function(){return AT},AT.relativeSign=function(t,e){return t<e?-1:t>e?1:0},AT.compare=function(t,e,r){if(e.equals2D(r))return 0;var n=AT.relativeSign(e.x,r.x),i=AT.relativeSign(e.y,r.y);switch(t){case 0:return AT.compareValue(n,i);case 1:return AT.compareValue(i,n);case 2:return AT.compareValue(i,-n);case 3:return AT.compareValue(-n,i);case 4:return AT.compareValue(-n,-i);case 5:return AT.compareValue(-i,-n);case 6:return AT.compareValue(-i,n);case 7:return AT.compareValue(n,-i)}return GB.shouldNeverReachHere("invalid octant value"),0},AT.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var fT=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this._segString=t,this.coord=new uB(e),this.segmentIndex=r,this._segmentOctant=n,this._isInterior=!e.equals2D(t.getCoordinate(r))};fT.prototype.getCoordinate=function(){return this.coord},fT.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},fT.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:AT.compare(this._segmentOctant,this.coord,e.coord)},fT.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},fT.prototype.isInterior=function(){return this._isInterior},fT.prototype.interfaces_=function(){return[oB]},fT.prototype.getClass=function(){return fT};var pT=function(){this._nodeMap=new PI,this._edge=null;var t=arguments[0];this._edge=t};pT.prototype.getSplitCoordinates=function(){var t=new AI;this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next();this.addEdgeCoordinates(r,n,t),r=n}return t.toCoordinateArray()},pT.prototype.addCollapsedNodes=function(){var t=new hI;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var r=e.next().intValue();this.add(this._edge.getCoordinate(r),r)}},pT.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},pT.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e<this._edge.size()-2;e++){var r=this._edge.getCoordinate(e),n=this._edge.getCoordinate(e+2);r.equals2D(n)&&t.add(new vB(e+1))}},pT.prototype.addEdgeCoordinates=function(t,e,r){var n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);r.add(new uB(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)r.add(this._edge.getCoordinate(o));i&&r.add(new uB(e.coord))},pT.prototype.iterator=function(){return this._nodeMap.values().iterator()},pT.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},pT.prototype.findCollapseIndex=function(t,e,r){if(!t.coord.equals2D(e.coord))return!1;var n=e.segmentIndex-t.segmentIndex;return e.isInterior()||n--,1===n&&(r[0]=t.segmentIndex+1,!0)},pT.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=new Array(1).fill(null),r=this.iterator(),n=r.next();r.hasNext();){var i=r.next();this.findCollapseIndex(n,i,e)&&t.add(new vB(e[0])),n=i}},pT.prototype.getEdge=function(){return this._edge},pT.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},pT.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),s=0;o[s++]=new uB(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this._edge.getCoordinate(a);return i&&(o[s]=new uB(e.coord)),new mT(o,this._edge.getData())},pT.prototype.add=function(t,e){var r=new fT(this._edge,t,e,this._edge.getSegmentOctant(e)),n=this._nodeMap.get(r);return null!==n?(GB.isTrue(n.coord.equals2D(t),"Found equal nodes with different coordinates"),n):(this._nodeMap.put(r,r),r)},pT.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),r=t.get(0).getCoordinate(0);if(!r.equals2D(e[0]))throw new UB("bad split edge start point at "+r);var n=t.get(t.size()-1).getCoordinates(),i=n[n.length-1];if(!i.equals2D(e[e.length-1]))throw new UB("bad split edge end point at "+i)},pT.prototype.interfaces_=function(){return[]},pT.prototype.getClass=function(){return pT};var dT=function(){};dT.prototype.interfaces_=function(){return[]},dT.prototype.getClass=function(){return dT},dT.octant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new rB("Cannot compute the octant for point ( "+t+", "+e+" )");var r=Math.abs(t),n=Math.abs(e);return t>=0?e>=0?r>=n?0:1:r>=n?7:6:e>=0?r>=n?3:2:r>=n?4:5}if(arguments[0]instanceof uB&&arguments[1]instanceof uB){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(0===s&&0===a)throw new rB("Cannot compute the octant for two identical points "+i);return dT.octant(s,a)}};var gT=function(){};gT.prototype.getCoordinates=function(){},gT.prototype.size=function(){},gT.prototype.getCoordinate=function(t){},gT.prototype.isClosed=function(){},gT.prototype.setData=function(t){},gT.prototype.getData=function(){},gT.prototype.interfaces_=function(){return[]},gT.prototype.getClass=function(){return gT};var yT=function(){};yT.prototype.addIntersection=function(t,e){},yT.prototype.interfaces_=function(){return[gT]},yT.prototype.getClass=function(){return yT};var mT=function(){this._nodeList=new pT(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};mT.prototype.getCoordinates=function(){return this._pts},mT.prototype.size=function(){return this._pts.length},mT.prototype.getCoordinate=function(t){return this._pts[t]},mT.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},mT.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},mT.prototype.setData=function(t){this._data=t},mT.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:dT.octant(t,e)},mT.prototype.getData=function(){return this._data},mT.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var r=arguments[1],n=arguments[3],i=new uB(arguments[0].getIntersection(n));this.addIntersection(i,r)}},mT.prototype.toString=function(){return kB.toLineString(new cP(this._pts))},mT.prototype.getNodeList=function(){return this._nodeList},mT.prototype.addIntersectionNode=function(t,e){var r=e,n=r+1;if(n<this._pts.length){var i=this._pts[n];t.equals2D(i)&&(r=n)}return this._nodeList.add(t,r)},mT.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},mT.prototype.interfaces_=function(){return[yT]},mT.prototype.getClass=function(){return mT},mT.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new hI;return mT.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();)n.next().getNodeList().addSplitEdges(r)};var vT=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new uB,this.p1=new uB;else if(1===arguments.length){var t=arguments[0];this.p0=new uB(t.p0),this.p1=new uB(t.p1)}else if(2===arguments.length)this.p0=arguments[0],this.p1=arguments[1];else if(4===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=arguments[3];this.p0=new uB(e,r),this.p1=new uB(n,i)}},_T={serialVersionUID:{configurable:!0}};vT.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},vT.prototype.orientationIndex=function(){if(arguments[0]instanceof vT){var t=arguments[0],e=KB.orientationIndex(this.p0,this.p1,t.p0),r=KB.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&r>=0||e<=0&&r<=0?Math.max(e,r):0}if(arguments[0]instanceof uB){var n=arguments[0];return KB.orientationIndex(this.p0,this.p1,n)}},vT.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},vT.prototype.isVertical=function(){return this.p0.x===this.p1.x},vT.prototype.equals=function(t){if(!(t instanceof vT))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},vT.prototype.intersection=function(t){var e=new HB;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},vT.prototype.project=function(){if(arguments[0]instanceof uB){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new uB(t);var e=this.projectionFactor(t),r=new uB;return r.x=this.p0.x+e*(this.p1.x-this.p0.x),r.y=this.p0.y+e*(this.p1.y-this.p0.y),r}if(arguments[0]instanceof vT){var n=arguments[0],i=this.projectionFactor(n.p0),o=this.projectionFactor(n.p1);if(i>=1&&o>=1)return null;if(i<=0&&o<=0)return null;var s=this.project(n.p0);i<0&&(s=this.p0),i>1&&(s=this.p1);var a=this.project(n.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new vT(s,a)}},vT.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},vT.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},vT.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},vT.prototype.distancePerpendicular=function(t){return KB.distancePointLinePerpendicular(t,this.p0,this.p1)},vT.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},vT.prototype.midPoint=function(){return vT.midPoint(this.p0,this.p1)},vT.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,r=this.p1.y-this.p0.y,n=e*e+r*r;return n<=0?nB.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*r)/n},vT.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var r=new Array(2).fill(null),n=nB.MAX_VALUE,i=null,o=this.closestPoint(t.p0);n=o.distance(t.p0),r[0]=o,r[1]=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))<n&&(n=i,r[0]=s,r[1]=t.p1);var a=t.closestPoint(this.p0);(i=a.distance(this.p0))<n&&(n=i,r[0]=this.p0,r[1]=a);var l=t.closestPoint(this.p1);return(i=l.distance(this.p1))<n&&(n=i,r[0]=this.p1,r[1]=l),r},vT.prototype.closestPoint=function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1},vT.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},vT.prototype.getLength=function(){return this.p0.distance(this.p1)},vT.prototype.compareTo=function(t){var e=t,r=this.p0.compareTo(e.p0);return 0!==r?r:this.p1.compareTo(e.p1)},vT.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},vT.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)},vT.prototype.lineIntersection=function(t){try{return TB.intersection(this.p0,this.p1,t.p0,t.p1)}catch(e){if(!(e instanceof IB))throw e}return null},vT.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},vT.prototype.pointAlongOffset=function(t,e){var r=this.p0.x+t*(this.p1.x-this.p0.x),n=this.p0.y+t*(this.p1.y-this.p0.y),i=this.p1.x-this.p0.x,o=this.p1.y-this.p0.y,s=Math.sqrt(i*i+o*o),a=0,l=0;if(0!==e){if(s<=0)throw new Error("Cannot compute offset from zero-length line segment");a=e*i/s,l=e*o/s}return new uB(r-l,n+a)},vT.prototype.setCoordinates=function(){if(1===arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=r.x,this.p1.y=r.y}},vT.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||nB.isNaN(e))&&(e=1),e},vT.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},vT.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},vT.prototype.distance=function(){if(arguments[0]instanceof vT){var t=arguments[0];return KB.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof uB){var e=arguments[0];return KB.distancePointLine(e,this.p0,this.p1)}},vT.prototype.pointAlong=function(t){var e=new uB;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},vT.prototype.hashCode=function(){var t=nB.doubleToLongBits(this.p0.x);t^=31*nB.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),r=nB.doubleToLongBits(this.p1.x);return r^=31*nB.doubleToLongBits(this.p1.y),e^Math.trunc(r)^Math.trunc(r>>32)},vT.prototype.interfaces_=function(){return[oB,lB]},vT.prototype.getClass=function(){return vT},vT.midPoint=function(t,e){return new uB((t.x+e.x)/2,(t.y+e.y)/2)},_T.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(vT,_T);var wT=function(){this.tempEnv1=new FB,this.tempEnv2=new FB,this._overlapSeg1=new vT,this._overlapSeg2=new vT};wT.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[3];arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},wT.prototype.interfaces_=function(){return[]},wT.prototype.getClass=function(){return wT};var bT=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],r=arguments[2],n=arguments[3];this._pts=t,this._start=e,this._end=r,this._context=n};bT.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},bT.prototype.computeSelect=function(t,e,r,n){var i=this._pts[e],o=this._pts[r];if(n.tempEnv1.init(i,o),r-e==1)return n.select(this,e),null;if(!t.intersects(n.tempEnv1))return null;var s=Math.trunc((e+r)/2);e<s&&this.computeSelect(t,e,s,n),s<r&&this.computeSelect(t,s,r,n)},bT.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,r=this._start;r<=this._end;r++)t[e++]=this._pts[r];return t},bT.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},bT.prototype.setId=function(t){this._id=t},bT.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},bT.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new FB(t,e)}return this._env},bT.prototype.getEndIndex=function(){return this._end},bT.prototype.getStartIndex=function(){return this._start},bT.prototype.getContext=function(){return this._context},bT.prototype.getId=function(){return this._id},bT.prototype.computeOverlapsInternal=function(t,e,r,n,i,o){var s=this._pts[t],a=this._pts[e],l=r._pts[n],u=r._pts[i];if(e-t==1&&i-n==1)return o.overlap(this,t,r,n),null;if(o.tempEnv1.init(s,a),o.tempEnv2.init(l,u),!o.tempEnv1.intersects(o.tempEnv2))return null;var h=Math.trunc((t+e)/2),c=Math.trunc((n+i)/2);t<h&&(n<c&&this.computeOverlapsInternal(t,h,r,n,c,o),c<i&&this.computeOverlapsInternal(t,h,r,c,i,o)),h<e&&(n<c&&this.computeOverlapsInternal(h,e,r,n,c,o),c<i&&this.computeOverlapsInternal(h,e,r,c,i,o))},bT.prototype.interfaces_=function(){return[]},bT.prototype.getClass=function(){return bT};var xT=function(){};xT.prototype.interfaces_=function(){return[]},xT.prototype.getClass=function(){return xT},xT.getChainStartIndices=function(t){var e=0,r=new hI;r.add(new vB(e));do{var n=xT.findChainEnd(t,e);r.add(new vB(n)),e=n}while(e<t.length-1);return xT.toIntArray(r)},xT.findChainEnd=function(t,e){for(var r=e;r<t.length-1&&t[r].equals2D(t[r+1]);)r++;if(r>=t.length-1)return t.length-1;for(var n=zP.quadrant(t[r],t[r+1]),i=e+1;i<t.length&&(t[i-1].equals2D(t[i])||zP.quadrant(t[i-1],t[i])===n);)i++;return i-1},xT.getChains=function(){if(1===arguments.length){var t=arguments[0];return xT.getChains(t,null)}if(2===arguments.length){for(var e=arguments[0],r=arguments[1],n=new hI,i=xT.getChainStartIndices(e),o=0;o<i.length-1;o++){var s=new bT(e,i[o],i[o+1],r);n.add(s)}return n}},xT.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var ET=function(){};ET.prototype.computeNodes=function(t){},ET.prototype.getNodedSubstrings=function(){},ET.prototype.interfaces_=function(){return[]},ET.prototype.getClass=function(){return ET};var CT=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}};CT.prototype.setSegmentIntersector=function(t){this._segInt=t},CT.prototype.interfaces_=function(){return[ET]},CT.prototype.getClass=function(){return CT};var ST=function(t){function e(e){e?t.call(this,e):t.call(this),this._monoChains=new hI,this._index=new hT,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return mT.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(t){for(var e=this,r=xT.getChains(t.getCoordinates(),t).iterator();r.hasNext();){var n=r.next();n.setId(e._idCounter++),e._index.insert(n.getEnvelope(),n),e._monoChains.add(n)}},e.prototype.computeNodes=function(t){this._nodedSegStrings=t;for(var e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()},e.prototype.intersectChains=function(){for(var t=this,e=new BT(this._segInt),r=this._monoChains.iterator();r.hasNext();)for(var n=r.next(),i=t._index.query(n.getEnvelope()).iterator();i.hasNext();){var o=i.next();if(o.getId()>n.getId()&&(n.computeOverlaps(o,e),t._nOverlaps++),t._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.SegmentOverlapAction.get=function(){return BT},Object.defineProperties(e,r),e}(CT),BT=function(t){function e(){t.call(this),this._si=null;var e=arguments[0];this._si=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(4!==arguments.length)return t.prototype.overlap.apply(this,arguments);var e=arguments[1],r=arguments[2],n=arguments[3],i=arguments[0].getContext(),o=r.getContext();this._si.processIntersections(i,e,o,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(wT),IT=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.setQuadrantSegments(e)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.setQuadrantSegments(r),this.setEndCapStyle(n)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}},PT={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}};IT.prototype.getEndCapStyle=function(){return this._endCapStyle},IT.prototype.isSingleSided=function(){return this._isSingleSided},IT.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=IT.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=IT.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==IT.JOIN_ROUND&&(this._quadrantSegments=IT.DEFAULT_QUADRANT_SEGMENTS)},IT.prototype.getJoinStyle=function(){return this._joinStyle},IT.prototype.setJoinStyle=function(t){this._joinStyle=t},IT.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},IT.prototype.getSimplifyFactor=function(){return this._simplifyFactor},IT.prototype.getQuadrantSegments=function(){return this._quadrantSegments},IT.prototype.setEndCapStyle=function(t){this._endCapStyle=t},IT.prototype.getMitreLimit=function(){return this._mitreLimit},IT.prototype.setMitreLimit=function(t){this._mitreLimit=t},IT.prototype.setSingleSided=function(t){this._isSingleSided=t},IT.prototype.interfaces_=function(){return[]},IT.prototype.getClass=function(){return IT},IT.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},PT.CAP_ROUND.get=function(){return 1},PT.CAP_FLAT.get=function(){return 2},PT.CAP_SQUARE.get=function(){return 3},PT.JOIN_ROUND.get=function(){return 1},PT.JOIN_MITRE.get=function(){return 2},PT.JOIN_BEVEL.get=function(){return 3},PT.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},PT.DEFAULT_MITRE_LIMIT.get=function(){return 5},PT.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(IT,PT);var TT=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=KB.COUNTERCLOCKWISE,this._inputLine=t||null},FT={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};TT.prototype.isDeletable=function(t,e,r,n){var i=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[r];return!!this.isConcave(i,o,s)&&!!this.isShallow(i,o,s,n)&&this.isShallowSampled(i,o,t,r,n)},TT.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,r=this.findNextNonDeletedIndex(e),n=this.findNextNonDeletedIndex(r),i=!1;n<this._inputLine.length;){var o=!1;t.isDeletable(e,r,n,t._distanceTol)&&(t._isDeleted[r]=TT.DELETE,o=!0,i=!0),e=o?n:r,r=t.findNextNonDeletedIndex(e),n=t.findNextNonDeletedIndex(r)}return i},TT.prototype.isShallowConcavity=function(t,e,r,n){return KB.computeOrientation(t,e,r)===this._angleOrientation&&KB.distancePointLine(e,t,r)<n},TT.prototype.isShallowSampled=function(t,e,r,n,i){var o=Math.trunc((n-r)/TT.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var s=r;s<n;s+=o)if(!this.isShallow(t,e,this._inputLine[s],i))return!1;return!0},TT.prototype.isConcave=function(t,e,r){return KB.computeOrientation(t,e,r)===this._angleOrientation},TT.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=KB.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},TT.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===TT.DELETE;)e++;return e},TT.prototype.isShallow=function(t,e,r,n){return KB.distancePointLine(e,t,r)<n},TT.prototype.collapseLine=function(){for(var t=new AI,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==TT.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},TT.prototype.interfaces_=function(){return[]},TT.prototype.getClass=function(){return TT},TT.simplify=function(t,e){return new TT(t).simplify(e)},FT.INIT.get=function(){return 0},FT.DELETE.get=function(){return 1},FT.KEEP.get=function(){return 1},FT.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(TT,FT);var MT=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new hI},LT={COORDINATE_ARRAY_TYPE:{configurable:!0}};MT.prototype.getCoordinates=function(){return this._ptList.toArray(MT.COORDINATE_ARRAY_TYPE)},MT.prototype.setPrecisionModel=function(t){this._precisionModel=t},MT.prototype.addPt=function(t){var e=new uB(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},MT.prototype.revere=function(){},MT.prototype.addPts=function(t,e){if(e)for(var r=0;r<t.length;r++)this.addPt(t[r]);else for(var n=t.length-1;n>=0;n--)this.addPt(t[n])},MT.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance},MT.prototype.toString=function(){return(new _P).createLineString(this.getCoordinates()).toString()},MT.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new uB(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},MT.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},MT.prototype.interfaces_=function(){return[]},MT.prototype.getClass=function(){return MT},LT.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(MT,LT);var OT=function(){},NT={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};OT.prototype.interfaces_=function(){return[]},OT.prototype.getClass=function(){return OT},OT.toDegrees=function(t){return 180*t/Math.PI},OT.normalize=function(t){for(;t>Math.PI;)t-=OT.PI_TIMES_2;for(;t<=-Math.PI;)t+=OT.PI_TIMES_2;return t},OT.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],r=arguments[1],n=r.x-e.x,i=r.y-e.y;return Math.atan2(i,n)}},OT.isAcute=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)>0},OT.isObtuse=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)<0},OT.interiorAngle=function(t,e,r){var n=OT.angle(e,t),i=OT.angle(e,r);return Math.abs(i-n)},OT.normalizePositive=function(t){if(t<0){for(;t<0;)t+=OT.PI_TIMES_2;t>=OT.PI_TIMES_2&&(t=0)}else{for(;t>=OT.PI_TIMES_2;)t-=OT.PI_TIMES_2;t<0&&(t=0)}return t},OT.angleBetween=function(t,e,r){var n=OT.angle(e,t),i=OT.angle(e,r);return OT.diff(n,i)},OT.diff=function(t,e){var r=null;return(r=t<e?e-t:t-e)>Math.PI&&(r=2*Math.PI-r),r},OT.toRadians=function(t){return t*Math.PI/180},OT.getTurn=function(t,e){var r=Math.sin(e-t);return r>0?OT.COUNTERCLOCKWISE:r<0?OT.CLOCKWISE:OT.NONE},OT.angleBetweenOriented=function(t,e,r){var n=OT.angle(e,t),i=OT.angle(e,r)-n;return i<=-Math.PI?i+OT.PI_TIMES_2:i>Math.PI?i-OT.PI_TIMES_2:i},NT.PI_TIMES_2.get=function(){return 2*Math.PI},NT.PI_OVER_2.get=function(){return Math.PI/2},NT.PI_OVER_4.get=function(){return Math.PI/4},NT.COUNTERCLOCKWISE.get=function(){return KB.COUNTERCLOCKWISE},NT.CLOCKWISE.get=function(){return KB.CLOCKWISE},NT.NONE.get=function(){return KB.COLLINEAR},Object.defineProperties(OT,NT);var RT=function t(){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 vT,this._seg1=new vT,this._offset0=new vT,this._offset1=new vT,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._precisionModel=e,this._bufParams=r,this._li=new HB,this._filletAngleQuantum=Math.PI/2/r.getQuadrantSegments(),r.getQuadrantSegments()>=8&&r.getJoinStyle()===IT.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)},kT={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}};RT.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 r=KB.computeOrientation(this._s0,this._s1,this._s2),n=r===KB.CLOCKWISE&&this._side===IP.LEFT||r===KB.COUNTERCLOCKWISE&&this._side===IP.RIGHT;0===r?this.addCollinear(e):n?this.addOutsideTurn(r,e):this.addInsideTurn(r,e)},RT.prototype.addLineEndCap=function(t,e){var r=new vT(t,e),n=new vT;this.computeOffsetSegment(r,IP.LEFT,this._distance,n);var i=new vT;this.computeOffsetSegment(r,IP.RIGHT,this._distance,i);var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o);switch(this._bufParams.getEndCapStyle()){case IT.CAP_ROUND:this._segList.addPt(n.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,KB.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case IT.CAP_FLAT:this._segList.addPt(n.p1),this._segList.addPt(i.p1);break;case IT.CAP_SQUARE:var l=new uB;l.x=Math.abs(this._distance)*Math.cos(a),l.y=Math.abs(this._distance)*Math.sin(a);var u=new uB(n.p1.x+l.x,n.p1.y+l.y),h=new uB(i.p1.x+l.x,i.p1.y+l.y);this._segList.addPt(u),this._segList.addPt(h)}},RT.prototype.getCoordinates=function(){return this._segList.getCoordinates()},RT.prototype.addMitreJoin=function(t,e,r,n){var i=!0,o=null;try{o=TB.intersection(e.p0,e.p1,r.p0,r.p1),(n<=0?1:o.distance(t)/Math.abs(n))>this._bufParams.getMitreLimit()&&(i=!1)}catch(s){if(!(s instanceof IB))throw s;o=new uB(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,r,n,this._bufParams.getMitreLimit())},RT.prototype.addFilletCorner=function(t,e,r,n,i){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),l=r.x-t.x,u=r.y-t.y,h=Math.atan2(u,l);n===KB.CLOCKWISE?a<=h&&(a+=2*Math.PI):a>=h&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,h,n,i),this._segList.addPt(r)},RT.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*RT.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===IT.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===IT.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))},RT.prototype.createSquare=function(t){this._segList.addPt(new uB(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new uB(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new uB(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new uB(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},RT.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},RT.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},RT.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},RT.prototype.initSideSegments=function(t,e,r){this._s1=t,this._s2=e,this._side=r,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,r,this._distance,this._offset1)},RT.prototype.addLimitedMitreJoin=function(t,e,r,n){var i=this._seg0.p1,o=OT.angle(i,this._seg0.p0),s=OT.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=OT.normalize(o+s),l=OT.normalize(a+Math.PI),u=n*r,h=r-u*Math.abs(Math.sin(s)),c=i.x+u*Math.cos(l),A=i.y+u*Math.sin(l),f=new uB(c,A),p=new vT(i,f),d=p.pointAlongOffset(1,h),g=p.pointAlongOffset(1,-h);this._side===IP.LEFT?(this._segList.addPt(d),this._segList.addPt(g)):(this._segList.addPt(g),this._segList.addPt(d))},RT.prototype.computeOffsetSegment=function(t,e,r,n){var i=e===IP.LEFT?1:-1,o=t.p1.x-t.p0.x,s=t.p1.y-t.p0.y,a=Math.sqrt(o*o+s*s),l=i*r*o/a,u=i*r*s/a;n.p0.x=t.p0.x-u,n.p0.y=t.p0.y+l,n.p1.x=t.p1.x-u,n.p1.y=t.p1.y+l},RT.prototype.addFilletArc=function(t,e,r,n,i){var o=n===KB.CLOCKWISE?-1:1,s=Math.abs(e-r),a=Math.trunc(s/this._filletAngleQuantum+.5);if(a<1)return null;for(var l=s/a,u=0,h=new uB;u<s;){var c=e+o*u;h.x=t.x+i*Math.cos(c),h.y=t.y+i*Math.sin(c),this._segList.addPt(h),u+=l}},RT.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*RT.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var r=new uB((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(r);var n=new uB((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(n)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},RT.prototype.createCircle=function(t){var e=new uB(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},RT.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},RT.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new MT,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*RT.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},RT.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===IT.JOIN_BEVEL||this._bufParams.getJoinStyle()===IT.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,KB.CLOCKWISE,this._distance))},RT.prototype.closeRing=function(){this._segList.closeRing()},RT.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},RT.prototype.interfaces_=function(){return[]},RT.prototype.getClass=function(){return RT},kT.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},kT.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},kT.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},kT.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(RT,kT);var UT=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};UT.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var r=e<0,n=Math.abs(e),i=this.getSegGen(n);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,r,i);var o=i.getCoordinates();return r&&fI.reverse(o),o},UT.prototype.computeSingleSidedBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){r.addSegments(t,!0);var i=TT.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],IP.LEFT),r.addFirstSegment();for(var s=o-2;s>=0;s--)r.addNextSegment(i[s],!0)}else{r.addSegments(t,!1);var a=TT.simplify(t,n),l=a.length-1;r.initSideSegments(a[0],a[1],IP.LEFT),r.addFirstSegment();for(var u=2;u<=l;u++)r.addNextSegment(a[u],!0)}r.addLastSegment(),r.closeRing()},UT.prototype.computeRingBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);e===IP.RIGHT&&(n=-n);var i=TT.simplify(t,n),o=i.length-1;r.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++){var a=1!==s;r.addNextSegment(i[s],a)}r.closeRing()},UT.prototype.computeLineBufferCurve=function(t,e){var r=this.simplifyTolerance(this._distance),n=TT.simplify(t,r),i=n.length-1;e.initSideSegments(n[0],n[1],IP.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(n[o],!0);e.addLastSegment(),e.addLineEndCap(n[i-1],n[i]);var s=TT.simplify(t,-r),a=s.length-1;e.initSideSegments(s[a],s[a-1],IP.LEFT);for(var l=a-2;l>=0;l--)e.addNextSegment(s[l],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},UT.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case IT.CAP_ROUND:e.createCircle(t);break;case IT.CAP_SQUARE:e.createSquare(t)}},UT.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var r=Math.abs(e),n=this.getSegGen(r);if(t.length<=1)this.computePointCurve(t[0],n);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,n)}else this.computeLineBufferCurve(t,n);return n.getCoordinates()},UT.prototype.getBufferParameters=function(){return this._bufParams},UT.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},UT.prototype.getRingCurve=function(t,e,r){if(this._distance=r,t.length<=2)return this.getLineCurve(t,r);if(0===r)return UT.copyCoordinates(t);var n=this.getSegGen(r);return this.computeRingBufferCurve(t,e,n),n.getCoordinates()},UT.prototype.computeOffsetCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){var i=TT.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],IP.LEFT),r.addFirstSegment();for(var s=o-2;s>=0;s--)r.addNextSegment(i[s],!0)}else{var a=TT.simplify(t,n),l=a.length-1;r.initSideSegments(a[0],a[1],IP.LEFT),r.addFirstSegment();for(var u=2;u<=l;u++)r.addNextSegment(a[u],!0)}r.addLastSegment()},UT.prototype.getSegGen=function(t){return new RT(this._precisionModel,this._bufParams,t)},UT.prototype.interfaces_=function(){return[]},UT.prototype.getClass=function(){return UT},UT.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),r=0;r<e.length;r++)e[r]=new uB(t[r]);return e};var DT=function(){this._subgraphs=null,this._seg=new vT,this._cga=new KB;var t=arguments[0];this._subgraphs=t},GT={DepthSegment:{configurable:!0}};DT.prototype.findStabbedSegments=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=new hI,n=this._subgraphs.iterator();n.hasNext();){var i=n.next(),o=i.getEnvelope();e.y<o.getMinY()||e.y>o.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),r)}return r}if(3===arguments.length)if(dB(arguments[2],lI)&&arguments[0]instanceof uB&&arguments[1]instanceof qP){for(var s=arguments[0],a=arguments[1],l=arguments[2],u=a.getEdge().getCoordinates(),h=0;h<u.length-1;h++)if(t._seg.p0=u[h],t._seg.p1=u[h+1],t._seg.p0.y>t._seg.p1.y&&t._seg.reverse(),!(Math.max(t._seg.p0.x,t._seg.p1.x)<s.x||t._seg.isHorizontal()||s.y<t._seg.p0.y||s.y>t._seg.p1.y||KB.computeOrientation(t._seg.p0,t._seg.p1,s)===KB.RIGHT)){var c=a.getDepth(IP.LEFT);t._seg.p0.equals(u[h])||(c=a.getDepth(IP.RIGHT));var A=new QT(t._seg,c);l.add(A)}}else if(dB(arguments[2],lI)&&arguments[0]instanceof uB&&dB(arguments[1],lI))for(var f=arguments[0],p=arguments[2],d=arguments[1].iterator();d.hasNext();){var g=d.next();g.isForward()&&t.findStabbedSegments(f,g,p)}},DT.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:iT.min(e)._leftDepth},DT.prototype.interfaces_=function(){return[]},DT.prototype.getClass=function(){return DT},GT.DepthSegment.get=function(){return QT},Object.defineProperties(DT,GT);var QT=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new vT(t),this._leftDepth=e};QT.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 r=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==r||0!=(r=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?r:this._upwardSeg.compareTo(e._upwardSeg)},QT.prototype.compareX=function(t,e){var r=t.p0.compareTo(e.p0);return 0!==r?r:t.p1.compareTo(e.p1)},QT.prototype.toString=function(){return this._upwardSeg.toString()},QT.prototype.interfaces_=function(){return[oB]},QT.prototype.getClass=function(){return QT};var jT=function(t,e,r){this.p0=t||null,this.p1=e||null,this.p2=r||null};jT.prototype.area=function(){return jT.area(this.p0,this.p1,this.p2)},jT.prototype.signedArea=function(){return jT.signedArea(this.p0,this.p1,this.p2)},jT.prototype.interpolateZ=function(t){if(null===t)throw new rB("Supplied point is null.");return jT.interpolateZ(t,this.p0,this.p1,this.p2)},jT.prototype.longestSideLength=function(){return jT.longestSideLength(this.p0,this.p1,this.p2)},jT.prototype.isAcute=function(){return jT.isAcute(this.p0,this.p1,this.p2)},jT.prototype.circumcentre=function(){return jT.circumcentre(this.p0,this.p1,this.p2)},jT.prototype.area3D=function(){return jT.area3D(this.p0,this.p1,this.p2)},jT.prototype.centroid=function(){return jT.centroid(this.p0,this.p1,this.p2)},jT.prototype.inCentre=function(){return jT.inCentre(this.p0,this.p1,this.p2)},jT.prototype.interfaces_=function(){return[]},jT.prototype.getClass=function(){return jT},jT.area=function(t,e,r){return Math.abs(((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2)},jT.signedArea=function(t,e,r){return((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2},jT.det=function(t,e,r,n){return t*n-e*r},jT.interpolateZ=function(t,e,r,n){var i=e.x,o=e.y,s=r.x-i,a=n.x-i,l=r.y-o,u=n.y-o,h=s*u-a*l,c=t.x-i,A=t.y-o,f=(u*c-a*A)/h,p=(-l*c+s*A)/h;return e.z+f*(r.z-e.z)+p*(n.z-e.z)},jT.longestSideLength=function(t,e,r){var n=t.distance(e),i=e.distance(r),o=r.distance(t),s=n;return i>s&&(s=i),o>s&&(s=o),s},jT.isAcute=function(t,e,r){return!!OT.isAcute(t,e,r)&&!!OT.isAcute(e,r,t)&&!!OT.isAcute(r,t,e)},jT.circumcentre=function(t,e,r){var n=r.x,i=r.y,o=t.x-n,s=t.y-i,a=e.x-n,l=e.y-i,u=2*jT.det(o,s,a,l),h=jT.det(s,o*o+s*s,l,a*a+l*l),c=jT.det(o,o*o+s*s,a,a*a+l*l);return new uB(n-h/u,i+c/u)},jT.perpendicularBisector=function(t,e){var r=e.x-t.x,n=e.y-t.y,i=new TB(t.x+r/2,t.y+n/2,1),o=new TB(t.x-n+r/2,t.y+r+n/2,1);return new TB(i,o)},jT.angleBisector=function(t,e,r){var n=e.distance(t),i=n/(n+e.distance(r)),o=r.x-t.x,s=r.y-t.y;return new uB(t.x+i*o,t.y+i*s)},jT.area3D=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=e.z-t.z,s=r.x-t.x,a=r.y-t.y,l=r.z-t.z,u=i*l-o*a,h=o*s-n*l,c=n*a-i*s,A=u*u+h*h+c*c;return Math.sqrt(A)/2},jT.centroid=function(t,e,r){var n=(t.x+e.x+r.x)/3,i=(t.y+e.y+r.y)/3;return new uB(n,i)},jT.inCentre=function(t,e,r){var n=e.distance(r),i=t.distance(r),o=t.distance(e),s=n+i+o,a=(n*t.x+i*e.x+o*r.x)/s,l=(n*t.y+i*e.y+o*r.y)/s;return new uB(a,l)};var HT=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new hI;var t=arguments[0],e=arguments[1],r=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=r};HT.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,fB.EXTERIOR,fB.INTERIOR)},HT.prototype.addPolygon=function(t){var e=this,r=this._distance,n=IP.LEFT;this._distance<0&&(r=-this._distance,n=IP.RIGHT);var i=t.getExteriorRing(),o=fI.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance))return null;if(this._distance<=0&&o.length<3)return null;this.addPolygonRing(o,r,n,fB.EXTERIOR,fB.INTERIOR);for(var s=0;s<t.getNumInteriorRing();s++){var a=t.getInteriorRingN(s),l=fI.removeRepeatedPoints(a.getCoordinates());e._distance>0&&e.isErodedCompletely(a,-e._distance)||e.addPolygonRing(l,r,IP.opposite(n),fB.INTERIOR,fB.EXTERIOR)}},HT.prototype.isTriangleErodedCompletely=function(t,e){var r=new jT(t[0],t[1],t[2]),n=r.inCentre();return KB.distancePointLine(n,r.p0,r.p1)<Math.abs(e)},HT.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=fI.removeRepeatedPoints(t.getCoordinates()),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,fB.EXTERIOR,fB.INTERIOR)},HT.prototype.addCurve=function(t,e,r){if(null===t||t.length<2)return null;var n=new mT(t,new kP(0,fB.BOUNDARY,e,r));this._curveList.add(n)},HT.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},HT.prototype.addPolygonRing=function(t,e,r,n,i){if(0===e&&t.length<iP.MINIMUM_VALID_SIZE)return null;var o=n,s=i;t.length>=iP.MINIMUM_VALID_SIZE&&KB.isCCW(t)&&(o=i,s=n,r=IP.opposite(r));var a=this._curveBuilder.getRingCurve(t,r,e);this.addCurve(a,o,s)},HT.prototype.add=function(t){if(t.isEmpty())return null;t instanceof rP?this.addPolygon(t):t instanceof JI?this.addLineString(t):t instanceof tP?this.addPoint(t):(t instanceof nP||t instanceof GI||t instanceof oP||t instanceof DI)&&this.addCollection(t)},HT.prototype.isErodedCompletely=function(t,e){var r=t.getCoordinates();if(r.length<4)return e<0;if(4===r.length)return this.isTriangleErodedCompletely(r,e);var n=t.getEnvelopeInternal(),i=Math.min(n.getHeight(),n.getWidth());return e<0&&2*Math.abs(e)>i},HT.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},HT.prototype.interfaces_=function(){return[]},HT.prototype.getClass=function(){return HT};var zT=function(){};zT.prototype.locate=function(t){},zT.prototype.interfaces_=function(){return[]},zT.prototype.getClass=function(){return zT};var VT=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()};VT.prototype.next=function(){if(this._atStart)return this._atStart=!1,VT.isAtomic(this._parent)&&this._index++,this._parent;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new uI;var t=this._parent.getGeometryN(this._index++);return t instanceof DI?(this._subcollectionIterator=new VT(t),this._subcollectionIterator.next()):t},VT.prototype.remove=function(){throw new Error(this.getClass().getName())},VT.prototype.hasNext=function(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},VT.prototype.interfaces_=function(){return[aI]},VT.prototype.getClass=function(){return VT},VT.isAtomic=function(t){return!(t instanceof DI)};var KT=function(){this._geom=null;var t=arguments[0];this._geom=t};KT.prototype.locate=function(t){return KT.locate(t,this._geom)},KT.prototype.interfaces_=function(){return[zT]},KT.prototype.getClass=function(){return KT},KT.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&KB.isPointInRing(t,e.getCoordinates())},KT.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var r=e.getExteriorRing();if(!KT.isPointInRing(t,r))return!1;for(var n=0;n<e.getNumInteriorRing();n++){var i=e.getInteriorRingN(n);if(KT.isPointInRing(t,i))return!1}return!0},KT.containsPoint=function(t,e){if(e instanceof rP)return KT.containsPointInPolygon(t,e);if(e instanceof DI)for(var r=new VT(e);r.hasNext();){var n=r.next();if(n!==e&&KT.containsPoint(t,n))return!0}return!1},KT.locate=function(t,e){return e.isEmpty()?fB.EXTERIOR:KT.containsPoint(t,e)?fB.INTERIOR:fB.EXTERIOR};var qT=function(){this._edgeMap=new PI,this._edgeList=null,this._ptInAreaLocation=[fB.NONE,fB.NONE]};qT.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),r=e-1;return 0===e&&(r=this._edgeList.size()-1),this._edgeList.get(r)},qT.prototype.propagateSideLabels=function(t){for(var e=fB.NONE,r=this.iterator();r.hasNext();){var n=r.next().getLabel();n.isArea(t)&&n.getLocation(t,IP.LEFT)!==fB.NONE&&(e=n.getLocation(t,IP.LEFT))}if(e===fB.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,IP.ON)===fB.NONE&&a.setLocation(t,IP.ON,i),a.isArea(t)){var l=a.getLocation(t,IP.LEFT),u=a.getLocation(t,IP.RIGHT);if(u!==fB.NONE){if(u!==i)throw new LP("side location conflict",s.getCoordinate());l===fB.NONE&&GB.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=l}else GB.isTrue(a.getLocation(t,IP.LEFT)===fB.NONE,"found single null side"),a.setLocation(t,IP.RIGHT,i),a.setLocation(t,IP.LEFT,i)}}},qT.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},qT.prototype.print=function(t){PB.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();)e.next().print(t)},qT.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},qT.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var r=e.size()-1,n=e.get(r).getLabel().getLocation(t,IP.LEFT);GB.isTrue(n!==fB.NONE,"Found unlabelled area edge");for(var i=n,o=this.iterator();o.hasNext();){var s=o.next().getLabel();GB.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,IP.LEFT),l=s.getLocation(t,IP.RIGHT);if(a===l)return!1;if(l!==i)return!1;i=a}return!0},qT.prototype.findIndex=function(t){this.iterator();for(var e=0;e<this._edgeList.size();e++)if(this._edgeList.get(e)===t)return e;return-1},qT.prototype.iterator=function(){return this.getEdges().iterator()},qT.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new hI(this._edgeMap.values())),this._edgeList},qT.prototype.getLocation=function(t,e,r){return this._ptInAreaLocation[t]===fB.NONE&&(this._ptInAreaLocation[t]=KT.locate(e,r[t].getGeometry())),this._ptInAreaLocation[t]},qT.prototype.toString=function(){var t=new mB;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var r=e.next();t.append(r),t.append("\n")}return t.toString()},qT.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();)e.next().computeLabel(t)},qT.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],r=this.iterator();r.hasNext();)for(var n=r.next().getLabel(),i=0;i<2;i++)n.isLine(i)&&n.getLocation(i)===fB.BOUNDARY&&(e[i]=!0);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel(),l=0;l<2;l++)if(a.isAnyNull(l)){var u=fB.NONE;if(e[l])u=fB.EXTERIOR;else{var h=s.getCoordinate();u=this.getLocation(l,h,t)}a.setAllLocationsIfNull(l,u)}},qT.prototype.getDegree=function(){return this._edgeMap.size()},qT.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},qT.prototype.interfaces_=function(){return[]},qT.prototype.getClass=function(){return qT};var WT=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){var t=this;this.getResultAreaEdges();for(var e=null,r=null,n=this._SCANNING_FOR_INCOMING,i=0;i<this._resultAreaEdgeList.size();i++){var o=t._resultAreaEdgeList.get(i),s=o.getSym();if(o.getLabel().isArea())switch(null===e&&o.isInResult()&&(e=o),n){case t._SCANNING_FOR_INCOMING:if(!s.isInResult())continue;r=s,n=t._LINKING_TO_OUTGOING;break;case t._LINKING_TO_OUTGOING:if(!o.isInResult())continue;r.setNext(o),n=t._SCANNING_FOR_INCOMING}}if(n===this._LINKING_TO_OUTGOING){if(null===e)throw new LP("no outgoing dirEdge found",this.getCoordinate());GB.isTrue(e.isInResult(),"unable to link last incoming dirEdge"),r.setNext(e)}},e.prototype.insert=function(t){var e=t;this.insertEdgeEnd(e,e)},e.prototype.getRightmostEdge=function(){var t=this.getEdges(),e=t.size();if(e<1)return null;var r=t.get(0);if(1===e)return r;var n=t.get(e-1),i=r.getQuadrant(),o=n.getQuadrant();return zP.isNorthern(i)&&zP.isNorthern(o)?r:zP.isNorthern(i)||zP.isNorthern(o)?0!==r.getDy()?r:0!==n.getDy()?n:(GB.shouldNeverReachHere("found two horizontal edges incident on node"),null):n},e.prototype.print=function(t){PB.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var r=e.next();t.print("out "),r.print(t),t.println(),t.print("in "),r.getSym().print(t),t.println()}},e.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new hI;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList},e.prototype.updateLabelling=function(t){for(var e=this.iterator();e.hasNext();){var r=e.next().getLabel();r.setAllLocationsIfNull(0,t.getLocation(0)),r.setAllLocationsIfNull(1,t.getLocation(1))}},e.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,r=this._edgeList.size()-1;r>=0;r--){var n=this._edgeList.get(r),i=n.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=n}e.setNext(t)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),r=t.getDepth(IP.LEFT),n=t.getDepth(IP.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),r);if(this.computeDepths(0,e,i)!==n)throw new LP("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[1],s=arguments[2],a=arguments[0];a<o;a++){var l=this._edgeList.get(a);l.setEdgeDepths(IP.RIGHT,s),s=l.getDepth(IP.LEFT)}return s}},e.prototype.mergeSymLabels=function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},e.prototype.linkMinimalDirectedEdges=function(t){for(var e=this,r=null,n=null,i=this._SCANNING_FOR_INCOMING,o=this._resultAreaEdgeList.size()-1;o>=0;o--){var s=e._resultAreaEdgeList.get(o),a=s.getSym();switch(null===r&&s.getEdgeRing()===t&&(r=s),i){case e._SCANNING_FOR_INCOMING:if(a.getEdgeRing()!==t)continue;n=a,i=e._LINKING_TO_OUTGOING;break;case e._LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;n.setNextMin(s),i=e._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(GB.isTrue(null!==r,"found null for first outgoing dirEdge"),GB.isTrue(r.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(r))},e.prototype.getOutgoingDegree=function(){if(0===arguments.length){for(var t=0,e=this.iterator();e.hasNext();)e.next().isInResult()&&t++;return t}if(1===arguments.length){for(var r=arguments[0],n=0,i=this.iterator();i.hasNext();)i.next().getEdgeRing()===r&&n++;return n}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=fB.NONE,e=this.iterator();e.hasNext();){var r=e.next(),n=r.getSym();if(!r.isLineEdge()){if(r.isInResult()){t=fB.INTERIOR;break}if(n.isInResult()){t=fB.EXTERIOR;break}}}if(t===fB.NONE)return null;for(var i=t,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getSym();s.isLineEdge()?s.getEdge().setCovered(i===fB.INTERIOR):(s.isInResult()&&(i=fB.EXTERIOR),a.isInResult()&&(i=fB.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new kP(fB.NONE);for(var r=this.iterator();r.hasNext();)for(var n=r.next().getEdge().getLabel(),i=0;i<2;i++){var o=n.getLocation(i);o!==fB.INTERIOR&&o!==fB.BOUNDARY||this._label.setLocation(i,fB.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(qT),XT=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(t){return new jP(t,new WT)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(WP),YT=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};YT.prototype.compareTo=function(t){var e=t;return YT.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},YT.prototype.interfaces_=function(){return[oB]},YT.prototype.getClass=function(){return YT},YT.orientation=function(t){return 1===fI.increasingDirection(t)},YT.compareOriented=function(t,e,r,n){for(var i=e?1:-1,o=n?1:-1,s=e?t.length:-1,a=n?r.length:-1,l=e?0:t.length-1,u=n?0:r.length-1;;){var h=t[l].compareTo(r[u]);if(0!==h)return h;var c=(l+=i)===s,A=(u+=o)===a;if(c&&!A)return-1;if(!c&&A)return 1;if(c&&A)return 0}};var ZT=function(){this._edges=new hI,this._ocaMap=new PI};ZT.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var r=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var n=r.getCoordinates(),i=0;i<n.length;i++)i>0&&t.print(","),t.print(n[i].x+" "+n[i].y);t.println(")")}t.print(") ")},ZT.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},ZT.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},ZT.prototype.iterator=function(){return this._edges.iterator()},ZT.prototype.getEdges=function(){return this._edges},ZT.prototype.get=function(t){return this._edges.get(t)},ZT.prototype.findEqualEdge=function(t){var e=new YT(t.getCoordinates());return this._ocaMap.get(e)},ZT.prototype.add=function(t){this._edges.add(t);var e=new YT(t.getCoordinates());this._ocaMap.put(e,t)},ZT.prototype.interfaces_=function(){return[]},ZT.prototype.getClass=function(){return ZT};var JT=function(){};JT.prototype.processIntersections=function(t,e,r,n){},JT.prototype.isDone=function(){},JT.prototype.interfaces_=function(){return[]},JT.prototype.getClass=function(){return JT};var $T=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};$T.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if($T.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.size()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},$T.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},$T.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},$T.prototype.getLineIntersector=function(){return this._li},$T.prototype.hasProperIntersection=function(){return this._hasProper},$T.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},$T.prototype.hasIntersection=function(){return this._hasIntersection},$T.prototype.isDone=function(){return!1},$T.prototype.hasInteriorIntersection=function(){return this._hasInterior},$T.prototype.interfaces_=function(){return[JT]},$T.prototype.getClass=function(){return $T},$T.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var tF=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],r=arguments[2];this.coord=new uB(t),this.segmentIndex=e,this.dist=r};tF.prototype.getSegmentIndex=function(){return this.segmentIndex},tF.prototype.getCoordinate=function(){return this.coord},tF.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},tF.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},tF.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},tF.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},tF.prototype.getDistance=function(){return this.dist},tF.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},tF.prototype.interfaces_=function(){return[oB]},tF.prototype.getClass=function(){return tF};var eF=function(){this._nodeMap=new PI,this.edge=null;var t=arguments[0];this.edge=t};eF.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},eF.prototype.iterator=function(){return this._nodeMap.values().iterator()},eF.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},eF.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)},eF.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this.edge.pts[e.segmentIndex],i=e.dist>0||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),s=0;o[s++]=new uB(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this.edge.pts[a];return i&&(o[s]=e.coord),new sF(o,new kP(this.edge._label))},eF.prototype.add=function(t,e,r){var n=new tF(t,e,r),i=this._nodeMap.get(n);return null!==i?i:(this._nodeMap.put(n,n),n)},eF.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1},eF.prototype.interfaces_=function(){return[]},eF.prototype.getClass=function(){return eF};var rF=function(){};rF.prototype.getChainStartIndices=function(t){var e=0,r=new hI;r.add(new vB(e));do{var n=this.findChainEnd(t,e);r.add(new vB(n)),e=n}while(e<t.length-1);return rF.toIntArray(r)},rF.prototype.findChainEnd=function(t,e){for(var r=zP.quadrant(t[e],t[e+1]),n=e+1;n<t.length&&zP.quadrant(t[n-1],t[n])===r;)n++;return n-1},rF.prototype.interfaces_=function(){return[]},rF.prototype.getClass=function(){return rF},rF.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var nF=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new FB,this.env2=new FB;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new rF;this.startIndex=e.getChainStartIndices(this.pts)};nF.prototype.getCoordinates=function(){return this.pts},nF.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e>r?e:r},nF.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e<r?e:r},nF.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[r],e.startIndex[r+1],n)}else if(6===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],l=arguments[4],u=arguments[5],h=this.pts[i],c=this.pts[o],A=s.pts[a],f=s.pts[l];if(o-i==1&&l-a==1)return u.addIntersections(this.e,i,s.e,a),null;if(this.env1.init(h,c),this.env2.init(A,f),!this.env1.intersects(this.env2))return null;var p=Math.trunc((i+o)/2),d=Math.trunc((a+l)/2);i<p&&(a<d&&this.computeIntersectsForChain(i,p,s,a,d,u),d<l&&this.computeIntersectsForChain(i,p,s,d,l,u)),p<o&&(a<d&&this.computeIntersectsForChain(p,o,s,a,d,u),d<l&&this.computeIntersectsForChain(p,o,s,d,l,u))}},nF.prototype.getStartIndexes=function(){return this.startIndex},nF.prototype.computeIntersects=function(t,e){for(var r=0;r<this.startIndex.length-1;r++)for(var n=0;n<t.startIndex.length-1;n++)this.computeIntersectsForChain(r,t,n,e)},nF.prototype.interfaces_=function(){return[]},nF.prototype.getClass=function(){return nF};var iF=function t(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var e=0;e<2;e++)for(var r=0;r<3;r++)this._depth[e][r]=t.NULL_VALUE},oF={NULL_VALUE:{configurable:!0}};iF.prototype.getDepth=function(t,e){return this._depth[t][e]},iF.prototype.setDepth=function(t,e,r){this._depth[t][e]=r},iF.prototype.isNull=function(){if(0===arguments.length){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==iF.NULL_VALUE)return!1;return!0}if(1===arguments.length){var r=arguments[0];return this._depth[r][1]===iF.NULL_VALUE}if(2===arguments.length){var n=arguments[0],i=arguments[1];return this._depth[n][i]===iF.NULL_VALUE}},iF.prototype.normalize=function(){for(var t=this,e=0;e<2;e++)if(!t.isNull(e)){var r=t._depth[e][1];t._depth[e][2]<r&&(r=t._depth[e][2]),r<0&&(r=0);for(var n=1;n<3;n++){var i=0;t._depth[e][n]>r&&(i=1),t._depth[e][n]=i}}},iF.prototype.getDelta=function(t){return this._depth[t][IP.RIGHT]-this._depth[t][IP.LEFT]},iF.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?fB.EXTERIOR:fB.INTERIOR},iF.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},iF.prototype.add=function(){var t=this;if(1===arguments.length)for(var e=arguments[0],r=0;r<2;r++)for(var n=1;n<3;n++){var i=e.getLocation(r,n);i!==fB.EXTERIOR&&i!==fB.INTERIOR||(t.isNull(r,n)?t._depth[r][n]=iF.depthAtLocation(i):t._depth[r][n]+=iF.depthAtLocation(i))}else if(3===arguments.length){var o=arguments[0],s=arguments[1];arguments[2]===fB.INTERIOR&&this._depth[o][s]++}},iF.prototype.interfaces_=function(){return[]},iF.prototype.getClass=function(){return iF},iF.depthAtLocation=function(t){return t===fB.EXTERIOR?0:t===fB.INTERIOR?1:iF.NULL_VALUE},oF.NULL_VALUE.get=function(){return-1},Object.defineProperties(iF,oF);var sF=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new eF(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new iF,this._depthDelta=0,1===arguments.length){var r=arguments[0];e.call(this,r,null)}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.pts=n,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new e(t,kP.toLineLabel(this._label))},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(t){this._isIsolated=t},e.prototype.setName=function(t){this._name=t},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var r=t;if(this.pts.length!==r.pts.length)return!1;for(var n=!0,i=!0,o=this.pts.length,s=0;s<this.pts.length;s++)if(this.pts[s].equals2D(r.pts[s])||(n=!1),this.pts[s].equals2D(r.pts[--o])||(i=!1),!n&&!i)return!1;return!0},e.prototype.getCoordinate=function(){if(0===arguments.length)return this.pts.length>0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},e.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(t){e.updateIM(this._label,t)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&3===this.pts.length&&!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")},e.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new nF(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new FB;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},e.prototype.addIntersection=function(t,e,r,n){var i=new uB(t.getIntersection(n)),o=e,s=t.getEdgeDistance(r,n),a=o+1;if(a<this.pts.length){var l=this.pts[a];i.equals2D(l)&&(o=a,s=0)}this.eiList.add(i,o,s)},e.prototype.toString=function(){var t=new mB;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0},e.prototype.setDepthDelta=function(t){this._depthDelta=t},e.prototype.getEdgeIntersectionList=function(){return this.eiList},e.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.updateIM=function(){if(2!==arguments.length)return t.prototype.updateIM.apply(this,arguments);var e=arguments[0],r=arguments[1];r.setAtLeastIfValid(e.getLocation(0,IP.ON),e.getLocation(1,IP.ON),1),e.isArea()&&(r.setAtLeastIfValid(e.getLocation(0,IP.LEFT),e.getLocation(1,IP.LEFT),2),r.setAtLeastIfValid(e.getLocation(0,IP.RIGHT),e.getLocation(1,IP.RIGHT),2))},e}(QP),aF=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new ZT,this._bufParams=t||null};aF.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},aF.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new kP(t.getLabel())).flip(),r.merge(n);var i=aF.depthDelta(n),o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(aF.depthDelta(t.getLabel()))},aF.prototype.buildSubgraphs=function(t,e){for(var r=new hI,n=t.iterator();n.hasNext();){var i=n.next(),o=i.getRightmostCoordinate(),s=new DT(r).getDepth(o);i.computeDepth(s),i.findResultEdges(),r.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},aF.prototype.createSubgraphs=function(t){for(var e=new hI,r=t.getNodes().iterator();r.hasNext();){var n=r.next();if(!n.isVisited()){var i=new NP;i.create(n),e.add(i)}}return iT.sort(e,iT.reverseOrder()),e},aF.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},aF.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new ST,r=new HB;return r.setPrecisionModel(t),e.setSegmentIntersector(new $T(r)),e},aF.prototype.buffer=function(t,e){var r=this._workingPrecisionModel;null===r&&(r=t.getPrecisionModel()),this._geomFact=t.getFactory();var n=new UT(r,this._bufParams),i=new HT(t,e,n).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,r),this._graph=new XP(new XT),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new YP(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},aF.prototype.computeNodedEdges=function(t,e){var r=this.getNoder(e);r.computeNodes(t);for(var n=r.getNodedSubstrings().iterator();n.hasNext();){var i=n.next(),o=i.getCoordinates();if(2!==o.length||!o[0].equals2D(o[1])){var s=i.getData(),a=new sF(i.getCoordinates(),new kP(s));this.insertUniqueEdge(a)}}},aF.prototype.setNoder=function(t){this._workingNoder=t},aF.prototype.interfaces_=function(){return[]},aF.prototype.getClass=function(){return aF},aF.depthDelta=function(t){var e=t.getLocation(0,IP.LEFT),r=t.getLocation(0,IP.RIGHT);return e===fB.INTERIOR&&r===fB.EXTERIOR?1:e===fB.EXTERIOR&&r===fB.INTERIOR?-1:0},aF.convertSegStrings=function(t){for(var e=new _P,r=new hI;t.hasNext();){var n=t.next(),i=e.createLineString(n.getCoordinates());r.add(i)}return e.buildGeometry(r)};var lF=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){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(4===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=arguments[3];this._noder=r,this._scaleFactor=n,this._offsetX=i,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};lF.prototype.rescale=function(){var t=this;if(dB(arguments[0],oI))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.rescale(r.getCoordinates())}else if(arguments[0]instanceof Array){for(var n=arguments[0],i=0;i<n.length;i++)n[i].x=n[i].x/t._scaleFactor+t._offsetX,n[i].y=n[i].y/t._scaleFactor+t._offsetY;2===n.length&&n[0].equals2D(n[1])&&PB.out.println(n)}},lF.prototype.scale=function(){var t=this;if(dB(arguments[0],oI)){for(var e=arguments[0],r=new hI,n=e.iterator();n.hasNext();){var i=n.next();r.add(new mT(t.scale(i.getCoordinates()),i.getData()))}return r}if(arguments[0]instanceof Array){for(var o=arguments[0],s=new Array(o.length).fill(null),a=0;a<o.length;a++)s[a]=new uB(Math.round((o[a].x-t._offsetX)*t._scaleFactor),Math.round((o[a].y-t._offsetY)*t._scaleFactor),o[a].z);return fI.removeRepeatedPoints(s)}},lF.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},lF.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},lF.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},lF.prototype.interfaces_=function(){return[ET]},lF.prototype.getClass=function(){return lF};var uF=function(){this._li=new HB,this._segStrings=null;var t=arguments[0];this._segStrings=t},hF={fact:{configurable:!0}};uF.prototype.checkEndPtVertexIntersections=function(){var t=this;if(0===arguments.length)for(var e=this._segStrings.iterator();e.hasNext();){var r=e.next().getCoordinates();t.checkEndPtVertexIntersections(r[0],t._segStrings),t.checkEndPtVertexIntersections(r[r.length-1],t._segStrings)}else if(2===arguments.length)for(var n=arguments[0],i=arguments[1].iterator();i.hasNext();)for(var o=i.next().getCoordinates(),s=1;s<o.length-1;s++)if(o[s].equals(n))throw new UB("found endpt/interior pt intersection at index "+s+" :pt "+n)},uF.prototype.checkInteriorIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),r=this._segStrings.iterator();r.hasNext();){var n=r.next();this.checkInteriorIntersections(e,n)}else if(2===arguments.length)for(var i=arguments[0],o=arguments[1],s=i.getCoordinates(),a=o.getCoordinates(),l=0;l<s.length-1;l++)for(var u=0;u<a.length-1;u++)this.checkInteriorIntersections(i,l,o,u);else if(4===arguments.length){var h=arguments[0],c=arguments[1],A=arguments[2],f=arguments[3];if(h===A&&c===f)return null;var p=h.getCoordinates()[c],d=h.getCoordinates()[c+1],g=A.getCoordinates()[f],y=A.getCoordinates()[f+1];if(this._li.computeIntersection(p,d,g,y),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,p,d)||this.hasInteriorIntersection(this._li,g,y)))throw new UB("found non-noded intersection at "+p+"-"+d+" and "+g+"-"+y)}},uF.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},uF.prototype.checkCollapses=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(1===arguments.length)for(var r=arguments[0].getCoordinates(),n=0;n<r.length-2;n++)this.checkCollapse(r[n],r[n+1],r[n+2])},uF.prototype.hasInteriorIntersection=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++){var i=t.getIntersection(n);if(!i.equals(e)&&!i.equals(r))return!0}return!1},uF.prototype.checkCollapse=function(t,e,r){if(t.equals(r))throw new UB("found non-noded collapse at "+uF.fact.createLineString([t,e,r]))},uF.prototype.interfaces_=function(){return[]},uF.prototype.getClass=function(){return uF},hF.fact.get=function(){return new _P},Object.defineProperties(uF,hF);var cF=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],r=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=r,e<=0)throw new rB("Scale factor must be non-zero");1!==e&&(this._pt=new uB(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new uB,this._p1Scaled=new uB),this.initCorners(this._pt)},AF={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};cF.prototype.intersectsScaled=function(t,e){var r=Math.min(t.x,e.x),n=Math.max(t.x,e.x),i=Math.min(t.y,e.y),o=Math.max(t.y,e.y),s=this._maxx<r||this._minx>n||this._maxy<i||this._miny>o;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return GB.isTrue(!(s&&a),"Found bad envelope test"),a},cF.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 uB(this._maxx,this._maxy),this._corner[1]=new uB(this._minx,this._maxy),this._corner[2]=new uB(this._minx,this._miny),this._corner[3]=new uB(this._maxx,this._miny)},cF.prototype.intersects=function(t,e){return 1===this._scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},cF.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},cF.prototype.getCoordinate=function(){return this._originalPt},cF.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},cF.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=cF.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new FB(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},cF.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()))))},cF.prototype.intersectsToleranceSquare=function(t,e){var r=!1,n=!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()&&(r=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper()||r&&n||t.equals(this._pt)||e.equals(this._pt)))))},cF.prototype.addSnappedNode=function(t,e){var r=t.getCoordinate(e),n=t.getCoordinate(e+1);return!!this.intersects(r,n)&&(t.addIntersection(this.getCoordinate(),e),!0)},cF.prototype.interfaces_=function(){return[]},cF.prototype.getClass=function(){return cF},AF.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(cF,AF);var fF=function(){this.tempEnv1=new FB,this.selectedSegment=new vT};fF.prototype.select=function(){if(1===arguments.length);else if(2===arguments.length){var t=arguments[1];arguments[0].getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}},fF.prototype.interfaces_=function(){return[]},fF.prototype.getClass=function(){return fF};var pF=function(){this._index=null;var t=arguments[0];this._index=t},dF={HotPixelSnapAction:{configurable:!0}};pF.prototype.snap=function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=e.getSafeEnvelope(),o=new gF(e,r,n);return this._index.query(i,{interfaces_:function(){return[tT]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},pF.prototype.interfaces_=function(){return[]},pF.prototype.getClass=function(){return pF},dF.HotPixelSnapAction.get=function(){return gF},Object.defineProperties(pF,dF);var gF=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._hotPixel=e,this._parentEdge=r,this._hotPixelVertexIndex=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(2!==arguments.length)return t.prototype.select.apply(this,arguments);var e=arguments[1],r=arguments[0].getContext();if(null!==this._parentEdge&&r===this._parentEdge&&e===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(r,e)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(fF),yF=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new hI};yF.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];if(this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var l=0;l<this._li.getIntersectionNum();l++)this._interiorIntersections.add(this._li.getIntersection(l));t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1)}},yF.prototype.isDone=function(){return!1},yF.prototype.getInteriorIntersections=function(){return this._interiorIntersections},yF.prototype.interfaces_=function(){return[JT]},yF.prototype.getClass=function(){return yF};var mF=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 HB,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};mF.prototype.checkCorrectness=function(t){var e=mT.getNodedSubstrings(t),r=new uF(e);try{r.checkValid()}catch(n){if(!(n instanceof BB))throw n;n.printStackTrace()}},mF.prototype.getNodedSubstrings=function(){return mT.getNodedSubstrings(this._nodedSegStrings)},mF.prototype.snapRound=function(t,e){var r=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(r),this.computeVertexSnaps(t)},mF.prototype.findInteriorIntersections=function(t,e){var r=new yF(e);return this._noder.setSegmentIntersector(r),this._noder.computeNodes(t),r.getInteriorIntersections()},mF.prototype.computeVertexSnaps=function(){var t=this;if(dB(arguments[0],oI))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.computeVertexSnaps(r)}else if(arguments[0]instanceof mT)for(var n=arguments[0],i=n.getCoordinates(),o=0;o<i.length;o++){var s=new cF(i[o],t._scaleFactor,t._li);t._pointSnapper.snap(s,n,o)&&n.addIntersection(i[o],o)}},mF.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new ST,this._pointSnapper=new pF(this._noder.getIndex()),this.snapRound(t,this._li)},mF.prototype.computeIntersectionSnaps=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next(),i=new cF(n,e._scaleFactor,e._li);e._pointSnapper.snap(i)}},mF.prototype.interfaces_=function(){return[ET]},mF.prototype.getClass=function(){return mF};var vF=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new IT,this._resultGeometry=null,this._saveException=null,1===arguments.length){var t=arguments[0];this._argGeom=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._argGeom=e,this._bufParams=r}},_F={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};vF.prototype.bufferFixedPrecision=function(t){var e=new lF(new mF(new gP(1)),t.getScale()),r=new aF(this._bufParams);r.setWorkingPrecisionModel(t),r.setNoder(e),this._resultGeometry=r.buffer(this._argGeom,this._distance)},vF.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=vF.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(o){if(!(o instanceof LP))throw o;t._saveException=o}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var r=arguments[0],n=vF.precisionScaleFactor(this._argGeom,this._distance,r),i=new gP(n);this.bufferFixedPrecision(i)}},vF.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===gP.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},vF.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},vF.prototype.bufferOriginalPrecision=function(){try{var t=new aF(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(!(e instanceof UB))throw e;this._saveException=e}},vF.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},vF.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},vF.prototype.interfaces_=function(){return[]},vF.prototype.getClass=function(){return vF},vF.bufferOp=function(){if(2===arguments.length){var t=arguments[1];return new vF(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof XB&&"number"==typeof arguments[1]){var e=arguments[1],r=arguments[2],n=new vF(arguments[0]);return n.setQuadrantSegments(r),n.getResultGeometry(e)}if(arguments[2]instanceof IT&&arguments[0]instanceof XB&&"number"==typeof arguments[1]){var i=arguments[1];return new vF(arguments[0],arguments[2]).getResultGeometry(i)}}else if(4===arguments.length){var o=arguments[1],s=arguments[2],a=arguments[3],l=new vF(arguments[0]);return l.setQuadrantSegments(s),l.setEndCapStyle(a),l.getResultGeometry(o)}},vF.precisionScaleFactor=function(t,e,r){var n=t.getEnvelopeInternal(),i=gB.max(Math.abs(n.getMaxX()),Math.abs(n.getMaxY()),Math.abs(n.getMinX()),Math.abs(n.getMinY()))+2*(e>0?e:0),o=r-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},_F.CAP_ROUND.get=function(){return IT.CAP_ROUND},_F.CAP_BUTT.get=function(){return IT.CAP_FLAT},_F.CAP_FLAT.get=function(){return IT.CAP_FLAT},_F.CAP_SQUARE.get=function(){return IT.CAP_SQUARE},_F.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(vF,_F);var wF=function(){this._pt=[new uB,new uB],this._distance=nB.NaN,this._isNull=!0};wF.prototype.getCoordinates=function(){return this._pt},wF.prototype.getCoordinate=function(t){return this._pt[t]},wF.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},wF.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){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(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},wF.prototype.getDistance=function(){return this._distance},wF.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},wF.prototype.interfaces_=function(){return[]},wF.prototype.getClass=function(){return wF};var bF=function(){};bF.prototype.interfaces_=function(){return[]},bF.prototype.getClass=function(){return bF},bF.computeDistance=function(){if(arguments[2]instanceof wF&&arguments[0]instanceof JI&&arguments[1]instanceof uB)for(var t=arguments[1],e=arguments[2],r=arguments[0].getCoordinates(),n=new vT,i=0;i<r.length-1;i++){n.setCoordinates(r[i],r[i+1]);var o=n.closestPoint(t);e.setMinimum(o,t)}else if(arguments[2]instanceof wF&&arguments[0]instanceof rP&&arguments[1]instanceof uB){var s=arguments[0],a=arguments[1],l=arguments[2];bF.computeDistance(s.getExteriorRing(),a,l);for(var u=0;u<s.getNumInteriorRing();u++)bF.computeDistance(s.getInteriorRingN(u),a,l)}else if(arguments[2]instanceof wF&&arguments[0]instanceof XB&&arguments[1]instanceof uB){var h=arguments[0],c=arguments[1],A=arguments[2];if(h instanceof JI)bF.computeDistance(h,c,A);else if(h instanceof rP)bF.computeDistance(h,c,A);else if(h instanceof DI)for(var f=h,p=0;p<f.getNumGeometries();p++){var d=f.getGeometryN(p);bF.computeDistance(d,c,A)}else A.setMinimum(h.getCoordinate(),c)}else if(arguments[2]instanceof wF&&arguments[0]instanceof vT&&arguments[1]instanceof uB){var g=arguments[1],y=arguments[2],m=arguments[0].closestPoint(g);y.setMinimum(m,g)}};var xF=function(t){this._maxPtDist=new wF,this._inputGeom=t||null},EF={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};xF.prototype.computeMaxMidpointDistance=function(t){var e=new SF(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},xF.prototype.computeMaxVertexDistance=function(t){var e=new CF(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},xF.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},xF.prototype.getDistancePoints=function(){return this._maxPtDist},xF.prototype.interfaces_=function(){return[]},xF.prototype.getClass=function(){return xF},EF.MaxPointDistanceFilter.get=function(){return CF},EF.MaxMidpointDistanceFilter.get=function(){return SF},Object.defineProperties(xF,EF);var CF=function(t){this._maxPtDist=new wF,this._minPtDist=new wF,this._geom=t||null};CF.prototype.filter=function(t){this._minPtDist.initialize(),bF.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},CF.prototype.getMaxPointDistance=function(){return this._maxPtDist},CF.prototype.interfaces_=function(){return[JB]},CF.prototype.getClass=function(){return CF};var SF=function(t){this._maxPtDist=new wF,this._minPtDist=new wF,this._geom=t||null};SF.prototype.filter=function(t,e){if(0===e)return null;var r=t.getCoordinate(e-1),n=t.getCoordinate(e),i=new uB((r.x+n.x)/2,(r.y+n.y)/2);this._minPtDist.initialize(),bF.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},SF.prototype.isDone=function(){return!1},SF.prototype.isGeometryChanged=function(){return!1},SF.prototype.getMaxPointDistance=function(){return this._maxPtDist},SF.prototype.interfaces_=function(){return[UI]},SF.prototype.getClass=function(){return SF};var BF=function(t){this._comps=t||null};BF.prototype.filter=function(t){t instanceof rP&&this._comps.add(t)},BF.prototype.interfaces_=function(){return[kI]},BF.prototype.getClass=function(){return BF},BF.getPolygons=function(){if(1===arguments.length){var t=arguments[0];return BF.getPolygons(t,new hI)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e instanceof rP?r.add(e):e instanceof DI&&e.apply(new BF(r)),r}};var IF=function(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var t=arguments[0];this._lines=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._lines=e,this._isForcedToLineString=r}};IF.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof iP){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof JI&&this._lines.add(t)},IF.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},IF.prototype.interfaces_=function(){return[WB]},IF.prototype.getClass=function(){return IF},IF.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(IF.getLines(t))}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().buildGeometry(IF.getLines(e,r))}},IF.getLines=function(){if(1===arguments.length){var t=arguments[0];return IF.getLines(t,!1)}if(2===arguments.length){if(dB(arguments[0],oI)&&dB(arguments[1],oI)){for(var e=arguments[1],r=arguments[0].iterator();r.hasNext();){var n=r.next();IF.getLines(n,e)}return e}if(arguments[0]instanceof XB&&"boolean"==typeof arguments[1]){var i=arguments[0],o=arguments[1],s=new hI;return i.apply(new IF(s,o)),s}if(arguments[0]instanceof XB&&dB(arguments[1],oI)){var a=arguments[0],l=arguments[1];return a instanceof JI?l.add(a):a.apply(new IF(l)),l}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&dB(arguments[0],oI)&&dB(arguments[1],oI)){for(var u=arguments[1],h=arguments[2],c=arguments[0].iterator();c.hasNext();){var A=c.next();IF.getLines(A,u,h)}return u}if("boolean"==typeof arguments[2]&&arguments[0]instanceof XB&&dB(arguments[1],oI)){var f=arguments[1],p=arguments[2];return arguments[0].apply(new IF(f,p)),f}}};var PF=function(){if(this._boundaryRule=$B.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];if(null===t)throw new rB("Rule must be non-null");this._boundaryRule=t}};PF.prototype.locateInternal=function(){if(arguments[0]instanceof uB&&arguments[1]instanceof rP){var t=arguments[0],e=arguments[1];if(e.isEmpty())return fB.EXTERIOR;var r=e.getExteriorRing(),n=this.locateInPolygonRing(t,r);if(n===fB.EXTERIOR)return fB.EXTERIOR;if(n===fB.BOUNDARY)return fB.BOUNDARY;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i),s=this.locateInPolygonRing(t,o);if(s===fB.INTERIOR)return fB.EXTERIOR;if(s===fB.BOUNDARY)return fB.BOUNDARY}return fB.INTERIOR}if(arguments[0]instanceof uB&&arguments[1]instanceof JI){var a=arguments[0],l=arguments[1];if(!l.getEnvelopeInternal().intersects(a))return fB.EXTERIOR;var u=l.getCoordinates();return l.isClosed()||!a.equals(u[0])&&!a.equals(u[u.length-1])?KB.isOnLine(a,u)?fB.INTERIOR:fB.EXTERIOR:fB.BOUNDARY}if(arguments[0]instanceof uB&&arguments[1]instanceof tP){var h=arguments[0];return arguments[1].getCoordinate().equals2D(h)?fB.INTERIOR:fB.EXTERIOR}},PF.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?KB.locatePointInRing(t,e.getCoordinates()):fB.EXTERIOR},PF.prototype.intersects=function(t,e){return this.locate(t,e)!==fB.EXTERIOR},PF.prototype.updateLocationInfo=function(t){t===fB.INTERIOR&&(this._isIn=!0),t===fB.BOUNDARY&&this._numBoundaries++},PF.prototype.computeLocation=function(t,e){var r=this;if(e instanceof tP&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof JI)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof rP)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof GI)for(var n=e,i=0;i<n.getNumGeometries();i++){var o=n.getGeometryN(i);r.updateLocationInfo(r.locateInternal(t,o))}else if(e instanceof oP)for(var s=e,a=0;a<s.getNumGeometries();a++){var l=s.getGeometryN(a);r.updateLocationInfo(r.locateInternal(t,l))}else if(e instanceof DI)for(var u=new VT(e);u.hasNext();){var h=u.next();h!==e&&r.computeLocation(t,h)}},PF.prototype.locate=function(t,e){return e.isEmpty()?fB.EXTERIOR:e instanceof JI||e instanceof rP?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?fB.BOUNDARY:this._numBoundaries>0||this._isIn?fB.INTERIOR:fB.EXTERIOR)},PF.prototype.interfaces_=function(){return[]},PF.prototype.getClass=function(){return PF};var TF=function t(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length)t.call(this,arguments[0],t.INSIDE_AREA,arguments[1]);else if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];this._component=e,this._segIndex=r,this._pt=n}},FF={INSIDE_AREA:{configurable:!0}};TF.prototype.isInsideArea=function(){return this._segIndex===TF.INSIDE_AREA},TF.prototype.getCoordinate=function(){return this._pt},TF.prototype.getGeometryComponent=function(){return this._component},TF.prototype.getSegmentIndex=function(){return this._segIndex},TF.prototype.interfaces_=function(){return[]},TF.prototype.getClass=function(){return TF},FF.INSIDE_AREA.get=function(){return-1},Object.defineProperties(TF,FF);var MF=function(t){this._pts=t||null};MF.prototype.filter=function(t){t instanceof tP&&this._pts.add(t)},MF.prototype.interfaces_=function(){return[kI]},MF.prototype.getClass=function(){return MF},MF.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof tP?iT.singletonList(t):MF.getPoints(t,new hI)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e instanceof tP?r.add(e):e instanceof DI&&e.apply(new MF(r)),r}};var LF=function(){this._locations=null;var t=arguments[0];this._locations=t};LF.prototype.filter=function(t){(t instanceof tP||t instanceof JI||t instanceof rP)&&this._locations.add(new TF(t,0,t.getCoordinate()))},LF.prototype.interfaces_=function(){return[kI]},LF.prototype.getClass=function(){return LF},LF.getLocations=function(t){var e=new hI;return t.apply(new LF(e)),e};var OF=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new PF,this._minDistanceLocation=null,this._minDistance=nB.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=n,this._terminateDistance=i}};OF.prototype.computeContainmentDistance=function(){var t=this;if(0===arguments.length){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(2===arguments.length){var r=arguments[0],n=arguments[1],i=1-r,o=BF.getPolygons(this._geom[r]);if(o.size()>0){var s=LF.getLocations(this._geom[i]);if(this.computeContainmentDistance(s,o,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=n[0],this._minDistanceLocation[r]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&dB(arguments[0],lI)&&dB(arguments[1],lI)){for(var a=arguments[0],l=arguments[1],u=arguments[2],h=0;h<a.size();h++)for(var c=a.get(h),A=0;A<l.size();A++)if(t.computeContainmentDistance(c,l.get(A),u),t._minDistance<=t._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof TF&&arguments[1]instanceof rP){var f=arguments[0],p=arguments[1],d=arguments[2],g=f.getCoordinate();if(fB.EXTERIOR!==this._ptLocator.locate(g,p))return this._minDistance=0,d[0]=f,d[1]=new TF(p,g),null}},OF.prototype.computeMinDistanceLinesPoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(n.computeMinDistance(o,a,r),n._minDistance<=n._terminateDistance)return null}},OF.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=IF.getLines(this._geom[0]),r=IF.getLines(this._geom[1]),n=MF.getPoints(this._geom[0]),i=MF.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,r,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(r,n,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(n,i,t),void this.updateMinDistance(t,!1))))},OF.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},OF.prototype.updateMinDistance=function(t,e){if(null===t[0])return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},OF.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},OF.prototype.computeMinDistance=function(){var t=this;if(0===arguments.length){if(null!==this._minDistanceLocation)return null;if(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance)return null;this.computeFacetDistance()}else if(3===arguments.length)if(arguments[2]instanceof Array&&arguments[0]instanceof JI&&arguments[1]instanceof tP){var e=arguments[0],r=arguments[1],n=arguments[2];if(e.getEnvelopeInternal().distance(r.getEnvelopeInternal())>this._minDistance)return null;for(var i=e.getCoordinates(),o=r.getCoordinate(),s=0;s<i.length-1;s++){var a=KB.distancePointLine(o,i[s],i[s+1]);if(a<t._minDistance){t._minDistance=a;var l=new vT(i[s],i[s+1]).closestPoint(o);n[0]=new TF(e,s,l),n[1]=new TF(r,0,o)}if(t._minDistance<=t._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof JI&&arguments[1]instanceof JI){var u=arguments[0],h=arguments[1],c=arguments[2];if(u.getEnvelopeInternal().distance(h.getEnvelopeInternal())>this._minDistance)return null;for(var A=u.getCoordinates(),f=h.getCoordinates(),p=0;p<A.length-1;p++)for(var d=0;d<f.length-1;d++){var g=KB.distanceLineLine(A[p],A[p+1],f[d],f[d+1]);if(g<t._minDistance){t._minDistance=g;var y=new vT(A[p],A[p+1]),m=new vT(f[d],f[d+1]),v=y.closestPoints(m);c[0]=new TF(u,p,v[0]),c[1]=new TF(h,d,v[1])}if(t._minDistance<=t._terminateDistance)return null}}},OF.prototype.computeMinDistancePoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s),l=o.getCoordinate().distance(a.getCoordinate());if(l<n._minDistance&&(n._minDistance=l,r[0]=new TF(o,0,o.getCoordinate()),r[1]=new TF(a,0,a.getCoordinate())),n._minDistance<=n._terminateDistance)return null}},OF.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new rB("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},OF.prototype.computeMinDistanceLines=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(n.computeMinDistance(o,a,r),n._minDistance<=n._terminateDistance)return null}},OF.prototype.interfaces_=function(){return[]},OF.prototype.getClass=function(){return OF},OF.distance=function(t,e){return new OF(t,e).distance()},OF.isWithinDistance=function(t,e,r){return new OF(t,e,r).distance()<=r},OF.nearestPoints=function(t,e){return new OF(t,e).nearestPoints()};var NF=function(){this._pt=[new uB,new uB],this._distance=nB.NaN,this._isNull=!0};NF.prototype.getCoordinates=function(){return this._pt},NF.prototype.getCoordinate=function(t){return this._pt[t]},NF.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},NF.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){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(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},NF.prototype.toString=function(){return kB.toLineString(this._pt[0],this._pt[1])},NF.prototype.getDistance=function(){return this._distance},NF.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},NF.prototype.interfaces_=function(){return[]},NF.prototype.getClass=function(){return NF};var RF=function(){};RF.prototype.interfaces_=function(){return[]},RF.prototype.getClass=function(){return RF},RF.computeDistance=function(){if(arguments[2]instanceof NF&&arguments[0]instanceof JI&&arguments[1]instanceof uB)for(var t=arguments[0],e=arguments[1],r=arguments[2],n=new vT,i=t.getCoordinates(),o=0;o<i.length-1;o++){n.setCoordinates(i[o],i[o+1]);var s=n.closestPoint(e);r.setMinimum(s,e)}else if(arguments[2]instanceof NF&&arguments[0]instanceof rP&&arguments[1]instanceof uB){var a=arguments[0],l=arguments[1],u=arguments[2];RF.computeDistance(a.getExteriorRing(),l,u);for(var h=0;h<a.getNumInteriorRing();h++)RF.computeDistance(a.getInteriorRingN(h),l,u)}else if(arguments[2]instanceof NF&&arguments[0]instanceof XB&&arguments[1]instanceof uB){var c=arguments[0],A=arguments[1],f=arguments[2];if(c instanceof JI)RF.computeDistance(c,A,f);else if(c instanceof rP)RF.computeDistance(c,A,f);else if(c instanceof DI)for(var p=c,d=0;d<p.getNumGeometries();d++){var g=p.getGeometryN(d);RF.computeDistance(g,A,f)}else f.setMinimum(c.getCoordinate(),A)}else if(arguments[2]instanceof NF&&arguments[0]instanceof vT&&arguments[1]instanceof uB){var y=arguments[1],m=arguments[2],v=arguments[0].closestPoint(y);m.setMinimum(v,y)}};var kF=function(){this._g0=null,this._g1=null,this._ptDist=new NF,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},UF={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};kF.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},kF.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new rB("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},kF.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},kF.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},kF.prototype.computeOrientedDistance=function(t,e,r){var n=new DF(e);if(t.apply(n),r.setMaximum(n.getMaxPointDistance()),this._densifyFrac>0){var i=new GF(e,this._densifyFrac);t.apply(i),r.setMaximum(i.getMaxPointDistance())}},kF.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},kF.prototype.interfaces_=function(){return[]},kF.prototype.getClass=function(){return kF},kF.distance=function(){if(2===arguments.length)return new kF(arguments[0],arguments[1]).distance();if(3===arguments.length){var t=arguments[2],e=new kF(arguments[0],arguments[1]);return e.setDensifyFraction(t),e.distance()}},UF.MaxPointDistanceFilter.get=function(){return DF},UF.MaxDensifiedByFractionDistanceFilter.get=function(){return GF},Object.defineProperties(kF,UF);var DF=function(){this._maxPtDist=new NF,this._minPtDist=new NF,this._euclideanDist=new RF,this._geom=null;var t=arguments[0];this._geom=t};DF.prototype.filter=function(t){this._minPtDist.initialize(),RF.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},DF.prototype.getMaxPointDistance=function(){return this._maxPtDist},DF.prototype.interfaces_=function(){return[JB]},DF.prototype.getClass=function(){return DF};var GF=function(){this._maxPtDist=new NF,this._minPtDist=new NF,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};GF.prototype.filter=function(t,e){var r=this;if(0===e)return null;for(var n=t.getCoordinate(e-1),i=t.getCoordinate(e),o=(i.x-n.x)/this._numSubSegs,s=(i.y-n.y)/this._numSubSegs,a=0;a<this._numSubSegs;a++){var l=n.x+a*o,u=n.y+a*s,h=new uB(l,u);r._minPtDist.initialize(),RF.computeDistance(r._geom,h,r._minPtDist),r._maxPtDist.setMaximum(r._minPtDist)}},GF.prototype.isDone=function(){return!1},GF.prototype.isGeometryChanged=function(){return!1},GF.prototype.getMaxPointDistance=function(){return this._maxPtDist},GF.prototype.interfaces_=function(){return[UI]},GF.prototype.getClass=function(){return GF};var QF=function(t,e,r){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=r||null},jF={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};QF.prototype.checkMaximumDistance=function(t,e,r){var n=new kF(e,t);if(n.setDensifyFraction(.25),this._maxDistanceFound=n.orientedDistance(),this._maxDistanceFound>r){this._isValid=!1;var i=n.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+kB.toLineString(i[0],i[1])+")"}},QF.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=QF.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),QF.VERBOSE&&PB.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},QF.prototype.checkNegativeValid=function(){if(!(this._input instanceof rP||this._input instanceof oP||this._input instanceof DI))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)},QF.prototype.getErrorIndicator=function(){return this._errorIndicator},QF.prototype.checkMinimumDistance=function(t,e,r){var n=new OF(t,e,r);if(this._minDistanceFound=n.distance(),this._minDistanceFound<r){this._isValid=!1;var i=n.nearestPoints();this._errorLocation=n.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+kB.toLineString(i[0],i[1])+" )"}},QF.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)},QF.prototype.getErrorLocation=function(){return this._errorLocation},QF.prototype.getPolygonLines=function(t){for(var e=new hI,r=new IF(e),n=BF.getPolygons(t).iterator();n.hasNext();)n.next().apply(r);return t.getFactory().buildGeometry(e)},QF.prototype.getErrorMessage=function(){return this._errMsg},QF.prototype.interfaces_=function(){return[]},QF.prototype.getClass=function(){return QF},jF.VERBOSE.get=function(){return!1},jF.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(QF,jF);var HF=function(t,e,r){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=r||null},zF={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};HF.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},HF.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*HF.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new FB(this._input.getEnvelopeInternal());e.expandBy(this._distance);var r=new FB(this._result.getEnvelopeInternal());r.expandBy(t),r.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(r)),this.report("Envelope")},HF.prototype.checkDistance=function(){var t=new QF(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")},HF.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")},HF.prototype.checkPolygonal=function(){this._result instanceof rP||this._result instanceof oP||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},HF.prototype.getErrorIndicator=function(){return this._errorIndicator},HF.prototype.getErrorLocation=function(){return this._errorLocation},HF.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},HF.prototype.report=function(t){if(!HF.VERBOSE)return null;PB.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},HF.prototype.getErrorMessage=function(){return this._errorMsg},HF.prototype.interfaces_=function(){return[]},HF.prototype.getClass=function(){return HF},HF.isValidMsg=function(t,e,r){var n=new HF(t,e,r);return n.isValid()?null:n.getErrorMessage()},HF.isValid=function(t,e,r){return!!new HF(t,e,r).isValid()},zF.VERBOSE.get=function(){return!1},zF.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(HF,zF);var VF=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};VF.prototype.getCoordinates=function(){return this._pts},VF.prototype.size=function(){return this._pts.length},VF.prototype.getCoordinate=function(t){return this._pts[t]},VF.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},VF.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:dT.octant(this.getCoordinate(t),this.getCoordinate(t+1))},VF.prototype.setData=function(t){this._data=t},VF.prototype.getData=function(){return this._data},VF.prototype.toString=function(){return kB.toLineString(new cP(this._pts))},VF.prototype.interfaces_=function(){return[gT]},VF.prototype.getClass=function(){return VF};var KF=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new hI,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};KF.prototype.getInteriorIntersection=function(){return this._interiorIntersection},KF.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},KF.prototype.getIntersectionSegments=function(){return this._intSegments},KF.prototype.count=function(){return this._intersectionCount},KF.prototype.getIntersections=function(){return this._intersections},KF.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},KF.prototype.setKeepIntersections=function(t){this._keepIntersections=t},KF.prototype.processIntersections=function(t,e,r,n){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===r&&e===n)return null;if(this._isCheckEndSegmentsOnly&&!this.isEndSegment(t,e)&&!this.isEndSegment(r,n))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,this._intSegments[1]=o,this._intSegments[2]=s,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},KF.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},KF.prototype.hasIntersection=function(){return null!==this._interiorIntersection},KF.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},KF.prototype.interfaces_=function(){return[JT]},KF.prototype.getClass=function(){return KF},KF.createAllIntersectionsFinder=function(t){var e=new KF(t);return e.setFindAllIntersections(!0),e},KF.createAnyIntersectionFinder=function(t){return new KF(t)},KF.createIntersectionCounter=function(t){var e=new KF(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var qF=function(){this._li=new HB,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};qF.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},qF.prototype.getIntersections=function(){return this._segInt.getIntersections()},qF.prototype.isValid=function(){return this.execute(),this._isValid},qF.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},qF.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new KF(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new ST;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},qF.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new LP(this.getErrorMessage(),this._segInt.getInteriorIntersection())},qF.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+kB.toLineString(t[0],t[1])+" and "+kB.toLineString(t[2],t[3])},qF.prototype.interfaces_=function(){return[]},qF.prototype.getClass=function(){return qF},qF.computeIntersections=function(t){var e=new qF(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var WF=function t(){this._nv=null;var e=arguments[0];this._nv=new qF(t.toSegmentStrings(e))};WF.prototype.checkValid=function(){this._nv.checkValid()},WF.prototype.interfaces_=function(){return[]},WF.prototype.getClass=function(){return WF},WF.toSegmentStrings=function(t){for(var e=new hI,r=t.iterator();r.hasNext();){var n=r.next();e.add(new VF(n.getCoordinates(),n))}return e},WF.checkValid=function(t){new WF(t).checkValid()};var XF=function(t){this._mapOp=t};XF.prototype.map=function(t){for(var e=new hI,r=0;r<t.getNumGeometries();r++){var n=this._mapOp.map(t.getGeometryN(r));n.isEmpty()||e.add(n)}return t.getFactory().createGeometryCollection(_P.toGeometryArray(e))},XF.prototype.interfaces_=function(){return[]},XF.prototype.getClass=function(){return XF},XF.map=function(t,e){return new XF(e).map(t)};var YF=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new hI,this._resultLineList=new hI;var t=arguments[0],e=arguments[1],r=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=r};YF.prototype.collectLines=function(t){for(var e=this,r=this._op.getGraph().getEdgeEnds().iterator();r.hasNext();){var n=r.next();e.collectLineEdge(n,t,e._lineEdgesList),e.collectBoundaryTouchEdge(n,t,e._lineEdgesList)}},YF.prototype.labelIsolatedLine=function(t,e){var r=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,r)},YF.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},YF.prototype.collectLineEdge=function(t,e,r){var n=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!TM.isResultOfOp(n,e)||i.isCovered()||(r.add(i),t.setVisitedEdge(!0)))},YF.prototype.findCoveredLineEdges=function(){for(var t=this._op.getGraph().getNodes().iterator();t.hasNext();)t.next().getEdges().findCoveredLineEdges();for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var r=e.next(),n=r.getEdge();if(r.isLineEdge()&&!n.isCoveredSet()){var i=this._op.isCoveredByA(r.getCoordinate());n.setCovered(i)}}},YF.prototype.labelIsolatedLines=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next(),n=r.getLabel();r.isIsolated()&&(n.isNull(0)?this.labelIsolatedLine(r,0):this.labelIsolatedLine(r,1))}},YF.prototype.buildLines=function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var r=e.next(),n=this._geometryFactory.createLineString(r.getCoordinates());this._resultLineList.add(n),r.setInResult(!0)}},YF.prototype.collectBoundaryTouchEdge=function(t,e,r){var n=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(GB.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(TM.isResultOfOp(n,e)&&e===TM.INTERSECTION&&(r.add(t.getEdge()),t.setVisitedEdge(!0))))},YF.prototype.interfaces_=function(){return[]},YF.prototype.getClass=function(){return YF};var ZF=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new hI;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};ZF.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var r=this._geometryFactory.createPoint(e);this._resultPointList.add(r)}},ZF.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var r=e.next();if(!(r.isInResult()||r.isIncidentEdgeInResult()||0!==r.getEdges().getDegree()&&t!==TM.INTERSECTION)){var n=r.getLabel();TM.isResultOfOp(n,t)&&this.filterCoveredNodeToPoint(r)}}},ZF.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},ZF.prototype.interfaces_=function(){return[]},ZF.prototype.getClass=function(){return ZF};var JF=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};JF.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},JF.prototype.transformPolygon=function(t,e){var r=!0,n=this.transformLinearRing(t.getExteriorRing(),t);null!==n&&n instanceof iP&&!n.isEmpty()||(r=!1);for(var i=new hI,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof iP||(r=!1),i.add(s))}if(r)return this._factory.createPolygon(n,i.toArray([]));var a=new hI;return null!==n&&a.add(n),a.addAll(i),this._factory.buildGeometry(a)},JF.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},JF.prototype.getInputGeometry=function(){return this._inputGeom},JF.prototype.transformMultiLineString=function(t,e){for(var r=new hI,n=0;n<t.getNumGeometries();n++){var i=this.transformLineString(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},JF.prototype.transformCoordinates=function(t,e){return this.copy(t)},JF.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},JF.prototype.transformMultiPoint=function(t,e){for(var r=new hI,n=0;n<t.getNumGeometries();n++){var i=this.transformPoint(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},JF.prototype.transformMultiPolygon=function(t,e){for(var r=new hI,n=0;n<t.getNumGeometries();n++){var i=this.transformPolygon(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},JF.prototype.copy=function(t){return t.copy()},JF.prototype.transformGeometryCollection=function(t,e){for(var r=new hI,n=0;n<t.getNumGeometries();n++){var i=this.transform(t.getGeometryN(n));null!==i&&(this._pruneEmptyGeometry&&i.isEmpty()||r.add(i))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(_P.toGeometryArray(r)):this._factory.buildGeometry(r)},JF.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof tP)return this.transformPoint(t,null);if(t instanceof nP)return this.transformMultiPoint(t,null);if(t instanceof iP)return this.transformLinearRing(t,null);if(t instanceof JI)return this.transformLineString(t,null);if(t instanceof GI)return this.transformMultiLineString(t,null);if(t instanceof rP)return this.transformPolygon(t,null);if(t instanceof oP)return this.transformMultiPolygon(t,null);if(t instanceof DI)return this.transformGeometryCollection(t,null);throw new rB("Unknown Geometry subtype: "+t.getClass().getName())},JF.prototype.transformLinearRing=function(t,e){var r=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===r)return this._factory.createLinearRing(null);var n=r.size();return n>0&&n<4&&!this._preserveType?this._factory.createLineString(r):this._factory.createLinearRing(r)},JF.prototype.interfaces_=function(){return[]},JF.prototype.getClass=function(){return JF};var $F=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new vT,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof JI&&"number"==typeof arguments[1]){var e=arguments[1];t.call(this,arguments[0].getCoordinates(),e)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=n}};$F.prototype.snapVertices=function(t,e){for(var r=this._isClosed?t.size()-1:t.size(),n=0;n<r;n++){var i=t.get(n),o=this.findSnapForVertex(i,e);null!==o&&(t.set(n,new uB(o)),0===n&&this._isClosed&&t.set(t.size()-1,new uB(o)))}},$F.prototype.findSnapForVertex=function(t,e){for(var r=0;r<e.length;r++){if(t.equals2D(e[r]))return null;if(t.distance(e[r])<this._snapTolerance)return e[r]}return null},$F.prototype.snapTo=function(t){var e=new AI(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},$F.prototype.snapSegments=function(t,e){if(0===e.length)return null;var r=e.length;e[0].equals2D(e[e.length-1])&&(r=e.length-1);for(var n=0;n<r;n++){var i=e[n],o=this.findSegmentIndexToSnap(i,t);o>=0&&t.add(o+1,new uB(i),!1)}},$F.prototype.findSegmentIndexToSnap=function(t,e){for(var r=this,n=nB.MAX_VALUE,i=-1,o=0;o<e.size()-1;o++){if(r._seg.p0=e.get(o),r._seg.p1=e.get(o+1),r._seg.p0.equals2D(t)||r._seg.p1.equals2D(t)){if(r._allowSnappingToSourceVertices)continue;return-1}var s=r._seg.distance(t);s<r._snapTolerance&&s<n&&(n=s,i=o)}return i},$F.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},$F.prototype.interfaces_=function(){return[]},$F.prototype.getClass=function(){return $F},$F.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var tM=function(t){this._srcGeom=t||null},eM={SNAP_PRECISION_FACTOR:{configurable:!0}};tM.prototype.snapTo=function(t,e){var r=this.extractTargetCoordinates(t);return new rM(e,r).transform(this._srcGeom)},tM.prototype.snapToSelf=function(t,e){var r=this.extractTargetCoordinates(this._srcGeom),n=new rM(t,r,!0).transform(this._srcGeom),i=n;return e&&dB(i,eP)&&(i=n.buffer(0)),i},tM.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},tM.prototype.extractTargetCoordinates=function(t){for(var e=new MI,r=t.getCoordinates(),n=0;n<r.length;n++)e.add(r[n]);return e.toArray(new Array(0).fill(null))},tM.prototype.computeMinimumSegmentLength=function(t){for(var e=nB.MAX_VALUE,r=0;r<t.length-1;r++){var n=t[r].distance(t[r+1]);n<e&&(e=n)}return e},tM.prototype.interfaces_=function(){return[]},tM.prototype.getClass=function(){return tM},tM.snap=function(t,e,r){var n=new Array(2).fill(null),i=new tM(t);n[0]=i.snapTo(e,r);var o=new tM(e);return n[1]=o.snapTo(n[0],r),n},tM.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=tM.computeSizeBasedSnapTolerance(t),r=t.getPrecisionModel();if(r.getType()===gP.FIXED){var n=1/r.getScale()*2/1.415;n>e&&(e=n)}return e}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min(tM.computeOverlaySnapTolerance(i),tM.computeOverlaySnapTolerance(o))}},tM.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*tM.SNAP_PRECISION_FACTOR},tM.snapToSelf=function(t,e,r){return new tM(t).snapToSelf(e,r)},eM.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(tM,eM);var rM=function(t){function e(e,r,n){t.call(this),this._snapTolerance=e||null,this._snapPts=r||null,this._isSelfSnap=void 0!==n&&n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var r=new $F(t,this._snapTolerance);return r.setAllowSnappingToSourceVertices(this._isSelfSnap),r.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var r=t.toCoordinateArray(),n=this.snapLine(r,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(JF),nM=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};nM.prototype.getCommon=function(){return nB.longBitsToDouble(this._commonBits)},nM.prototype.add=function(t){var e=nB.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=nM.signExpBits(this._commonBits),this._isFirst=!1,null):nM.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=nM.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=nM.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},nM.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=nB.longBitsToDouble(t),r="0000000000000000000000000000000000000000000000000000000000000000"+nB.toBinaryString(t),n=r.substring(r.length-64);return n.substring(0,1)+" "+n.substring(1,12)+"(exp) "+n.substring(12)+" [ "+e+" ]"}},nM.prototype.interfaces_=function(){return[]},nM.prototype.getClass=function(){return nM},nM.getBit=function(t,e){return 0!=(t&1<<e)?1:0},nM.signExpBits=function(t){return t>>52},nM.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},nM.numCommonMostSigMantissaBits=function(t,e){for(var r=0,n=52;n>=0;n--){if(nM.getBit(t,n)!==nM.getBit(e,n))return r;r++}return 52};var iM=function(){this._commonCoord=null,this._ccFilter=new sM},oM={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};iM.prototype.addCommonBits=function(t){var e=new aM(this._commonCoord);t.apply(e),t.geometryChanged()},iM.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new uB(this._commonCoord);e.x=-e.x,e.y=-e.y;var r=new aM(e);return t.apply(r),t.geometryChanged(),t},iM.prototype.getCommonCoordinate=function(){return this._commonCoord},iM.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},iM.prototype.interfaces_=function(){return[]},iM.prototype.getClass=function(){return iM},oM.CommonCoordinateFilter.get=function(){return sM},oM.Translater.get=function(){return aM},Object.defineProperties(iM,oM);var sM=function(){this._commonBitsX=new nM,this._commonBitsY=new nM};sM.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},sM.prototype.getCommonCoordinate=function(){return new uB(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},sM.prototype.interfaces_=function(){return[JB]},sM.prototype.getClass=function(){return sM};var aM=function(){this.trans=null;var t=arguments[0];this.trans=t};aM.prototype.filter=function(t,e){var r=t.getOrdinate(e,0)+this.trans.x,n=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,r),t.setOrdinate(e,1,n)},aM.prototype.isDone=function(){return!1},aM.prototype.isGeometryChanged=function(){return!0},aM.prototype.interfaces_=function(){return[UI]},aM.prototype.getClass=function(){return aM};var lM=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()};lM.prototype.selfSnap=function(t){return new tM(t).snapTo(t,this._snapTolerance)},lM.prototype.removeCommonBits=function(t){this._cbr=new iM,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},lM.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},lM.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),r=TM.overlayOp(e[0],e[1],t);return this.prepareResult(r)},lM.prototype.checkValid=function(t){t.isValid()||PB.out.println("Snapped geometry is invalid")},lM.prototype.computeSnapTolerance=function(){this._snapTolerance=tM.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},lM.prototype.snap=function(t){var e=this.removeCommonBits(t);return tM.snap(e[0],e[1],this._snapTolerance)},lM.prototype.interfaces_=function(){return[]},lM.prototype.getClass=function(){return lM},lM.overlayOp=function(t,e,r){return new lM(t,e).getResultGeometry(r)},lM.union=function(t,e){return lM.overlayOp(t,e,TM.UNION)},lM.intersection=function(t,e){return lM.overlayOp(t,e,TM.INTERSECTION)},lM.symDifference=function(t,e){return lM.overlayOp(t,e,TM.SYMDIFFERENCE)},lM.difference=function(t,e){return lM.overlayOp(t,e,TM.DIFFERENCE)};var uM=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};uM.prototype.getResultGeometry=function(t){var e=null,r=!1,n=null;try{e=TM.overlayOp(this._geom[0],this._geom[1],t),r=!0}catch(i){if(!(i instanceof UB))throw i;n=i}if(!r)try{e=lM.overlayOp(this._geom[0],this._geom[1],t)}catch(i){throw i instanceof UB?n:i}return e},uM.prototype.interfaces_=function(){return[]},uM.prototype.getClass=function(){return uM},uM.overlayOp=function(t,e,r){return new uM(t,e).getResultGeometry(r)},uM.union=function(t,e){return uM.overlayOp(t,e,TM.UNION)},uM.intersection=function(t,e){return uM.overlayOp(t,e,TM.INTERSECTION)},uM.symDifference=function(t,e){return uM.overlayOp(t,e,TM.SYMDIFFERENCE)},uM.difference=function(t,e){return uM.overlayOp(t,e,TM.DIFFERENCE)};var hM=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};hM.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},hM.prototype.interfaces_=function(){return[]},hM.prototype.getClass=function(){return hM};var cM=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var e=arguments[0],r=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=r}else if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=n,this._xValue=i,this._obj=o}},AM={INSERT:{configurable:!0},DELETE:{configurable:!0}};cM.prototype.isDelete=function(){return this._eventType===cM.DELETE},cM.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},cM.prototype.getObject=function(){return this._obj},cM.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},cM.prototype.getInsertEvent=function(){return this._insertEvent},cM.prototype.isInsert=function(){return this._eventType===cM.INSERT},cM.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},cM.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},cM.prototype.interfaces_=function(){return[oB]},cM.prototype.getClass=function(){return cM},AM.INSERT.get=function(){return 1},AM.DELETE.get=function(){return 2},Object.defineProperties(cM,AM);var fM=function(){};fM.prototype.interfaces_=function(){return[]},fM.prototype.getClass=function(){return fM};var pM=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],r=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=r};pM.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(pM.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},pM.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},pM.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},pM.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},pM.prototype.isBoundaryPointInternal=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next().getCoordinate();if(t.isIntersection(n))return!0}return!1},pM.prototype.hasProperIntersection=function(){return this._hasProper},pM.prototype.hasIntersection=function(){return this._hasIntersection},pM.prototype.isDone=function(){return this._isDone},pM.prototype.isBoundaryPoint=function(t,e){return!(null===e||!this.isBoundaryPointInternal(t,e[0])&&!this.isBoundaryPointInternal(t,e[1]))},pM.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},pM.prototype.addIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),r.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,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))))},pM.prototype.interfaces_=function(){return[]},pM.prototype.getClass=function(){return pM},pM.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var dM=function(t){function e(){t.call(this),this.events=new hI,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){iT.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},e.prototype.computeIntersections=function(){if(1===arguments.length){var t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var e=0;e<this.events.size();e++){var r=this.events.get(e);if(r.isInsert()&&this.processOverlaps(e,r.getDeleteEventIndex(),r,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof pM&&dB(arguments[0],lI)&&dB(arguments[1],lI)){var n=arguments[0],i=arguments[1],o=arguments[2];this.addEdges(n,n),this.addEdges(i,i),this.computeIntersections(o)}else if("boolean"==typeof arguments[2]&&dB(arguments[0],lI)&&arguments[1]instanceof pM){var s=arguments[0],a=arguments[1];arguments[2]?this.addEdges(s,null):this.addEdges(s),this.computeIntersections(a)}},e.prototype.addEdge=function(t,e){for(var r=t.getMonotoneChainEdge(),n=r.getStartIndexes(),i=0;i<n.length-1;i++){var o=new hM(r,i),s=new cM(e,r.getMinX(i),o);this.events.add(s),this.events.add(new cM(r.getMaxX(i),s))}},e.prototype.processOverlaps=function(t,e,r,n){for(var i=r.getObject(),o=t;o<e;o++){var s=this.events.get(o);if(s.isInsert()){var a=s.getObject();r.isSameLabel(s)||(i.computeIntersections(a,n),this.nOverlaps++)}}},e.prototype.addEdges=function(){if(1===arguments.length)for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();){var i=n.next();this.addEdge(i,r)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(fM),gM=function(){this._min=nB.POSITIVE_INFINITY,this._max=nB.NEGATIVE_INFINITY},yM={NodeComparator:{configurable:!0}};gM.prototype.getMin=function(){return this._min},gM.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},gM.prototype.getMax=function(){return this._max},gM.prototype.toString=function(){return kB.toLineString(new uB(this._min,0),new uB(this._max,0))},gM.prototype.interfaces_=function(){return[]},gM.prototype.getClass=function(){return gM},yM.NodeComparator.get=function(){return mM},Object.defineProperties(gM,yM);var mM=function(){};mM.prototype.compare=function(t,e){var r=t,n=e,i=(r._min+r._max)/2,o=(n._min+n._max)/2;return i<o?-1:i>o?1:0},mM.prototype.interfaces_=function(){return[aB]},mM.prototype.getClass=function(){return mM};var vM=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],r=arguments[1],n=arguments[2];this._min=e,this._max=r,this._item=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,r){if(!this.intersects(t,e))return null;r.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(gM),_M=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],r=arguments[1];this._node1=e,this._node2=r,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},e.prototype.query=function(t,e,r){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,r),null!==this._node2&&this._node2.query(t,e,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(gM),wM=function(){this._leaves=new hI,this._root=null,this._level=0};wM.prototype.buildTree=function(){iT.sort(this._leaves,new gM.NodeComparator);for(var t=this._leaves,e=null,r=new hI;;){if(this.buildLevel(t,r),1===r.size())return r.get(0);e=t,t=r,r=e}},wM.prototype.insert=function(t,e,r){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new vM(t,e,r))},wM.prototype.query=function(t,e,r){this.init(),this._root.query(t,e,r)},wM.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},wM.prototype.printNode=function(t){PB.out.println(kB.toLineString(new uB(t._min,this._level),new uB(t._max,this._level)))},wM.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},wM.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var r=0;r<t.size();r+=2){var n=t.get(r);if(null===(r+1<t.size()?t.get(r):null))e.add(n);else{var i=new _M(t.get(r),t.get(r+1));e.add(i)}}},wM.prototype.interfaces_=function(){return[]},wM.prototype.getClass=function(){return wM};var bM=function(){this._items=new hI};bM.prototype.visitItem=function(t){this._items.add(t)},bM.prototype.getItems=function(){return this._items},bM.prototype.interfaces_=function(){return[tT]},bM.prototype.getClass=function(){return bM};var xM=function(){this._index=null;var t=arguments[0];if(!dB(t,eP))throw new rB("Argument must be Polygonal");this._index=new SM(t)},EM={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};xM.prototype.locate=function(t){var e=new VB(t),r=new CM(e);return this._index.query(t.y,t.y,r),e.getLocation()},xM.prototype.interfaces_=function(){return[zT]},xM.prototype.getClass=function(){return xM},EM.SegmentVisitor.get=function(){return CM},EM.IntervalIndexedGeometry.get=function(){return SM},Object.defineProperties(xM,EM);var CM=function(){this._counter=null;var t=arguments[0];this._counter=t};CM.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},CM.prototype.interfaces_=function(){return[tT]},CM.prototype.getClass=function(){return CM};var SM=function(){this._index=new wM;var t=arguments[0];this.init(t)};SM.prototype.init=function(t){for(var e=IF.getLines(t).iterator();e.hasNext();){var r=e.next().getCoordinates();this.addLine(r)}},SM.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var r=new vT(t[e-1],t[e]),n=Math.min(r.p0.y,r.p1.y),i=Math.max(r.p0.y,r.p1.y);this._index.insert(n,i,r)}},SM.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new bM;return this._index.query(t,e,r),r.getItems()}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._index.query(n,i,o)}},SM.prototype.interfaces_=function(){return[]},SM.prototype.getClass=function(){return SM};var BM=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new dP,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new PF,2===arguments.length){var e=arguments[0],r=arguments[1],n=$B.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=r,this._boundaryNodeRule=n,null!==r&&this.add(r)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];this._argIndex=i,this._parentGeom=o,this._boundaryNodeRule=s,null!==o&&this.add(o)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertBoundaryPoint=function(t,r){var n=this._nodes.addNode(r).getLabel(),i=1;fB.NONE,n.getLocation(t,IP.ON)===fB.BOUNDARY&&i++;var o=e.determineBoundary(this._boundaryNodeRule,i);n.setLocation(t,o)},e.prototype.computeSelfNodes=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var r=arguments[1],n=arguments[2],i=new pM(arguments[0],!0,!1);i.setIsDoneIfProperInt(n);var o=this.createEdgeSetIntersector(),s=this._parentGeom instanceof iP||this._parentGeom instanceof rP||this._parentGeom instanceof oP,a=r||!s;return o.computeIntersections(this._edges,i,a),this.addSelfIntersectionNodes(this._argIndex),i}},e.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();)e.next().eiList.addSplitEdges(t)},e.prototype.computeEdgeIntersections=function(t,e,r){var n=new pM(e,r,!0);return n.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,n),n},e.prototype.getGeometry=function(){return this._parentGeom},e.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},e.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},e.prototype.addPoint=function(){if(arguments[0]instanceof tP){var t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,fB.INTERIOR)}else if(arguments[0]instanceof uB){var e=arguments[0];this.insertPoint(this._argIndex,e,fB.INTERIOR)}},e.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),fB.EXTERIOR,fB.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var r=t.getInteriorRingN(e);this.addPolygonRing(r,fB.INTERIOR,fB.EXTERIOR)}},e.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],fB.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],fB.BOUNDARY)},e.prototype.addLineString=function(t){var e=fI.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var r=new sF(e,new kP(this._argIndex,fB.INTERIOR));this._lineEdgeMap.put(t,r),this.insertEdge(r),GB.isTrue(e.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),r=0,n=t.iterator();n.hasNext();){var i=n.next();e[r++]=i.getCoordinate().copy()}return e},e.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(t,e,r){if(this.isBoundaryNode(t,e))return null;r===fB.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,r)},e.prototype.addPolygonRing=function(t,e,r){if(t.isEmpty())return null;var n=fI.removeRepeatedPoints(t.getCoordinates());if(n.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=n[0],null;var i=e,o=r;KB.isCCW(n)&&(i=r,o=e);var s=new sF(n,new kP(this._argIndex,fB.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,n[0],fB.BOUNDARY)},e.prototype.insertPoint=function(t,e,r){var n=this._nodes.addNode(e),i=n.getLabel();null===i?n._label=new kP(t,r):i.setLocation(t,r)},e.prototype.createEdgeSetIntersector=function(){return new dM},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var r=e.next(),n=r.getLabel().getLocation(t),i=r.eiList.iterator();i.hasNext();){var o=i.next();this.addSelfIntersectionNode(t,o.coord,n)}},e.prototype.add=function(){if(1!==arguments.length)return t.prototype.add.apply(this,arguments);var e=arguments[0];if(e.isEmpty())return null;if(e instanceof oP&&(this._useBoundaryDeterminationRule=!1),e instanceof rP)this.addPolygon(e);else if(e instanceof JI)this.addLineString(e);else if(e instanceof tP)this.addPoint(e);else if(e instanceof nP)this.addCollection(e);else if(e instanceof GI)this.addCollection(e);else if(e instanceof oP)this.addCollection(e);else{if(!(e instanceof DI))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},e.prototype.locate=function(t){return dB(this._parentGeom,eP)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new xM(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},e.prototype.findEdge=function(){if(1===arguments.length){var e=arguments[0];return this._lineEdgeMap.get(e)}return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(t,e){return t.isInBoundary(e)?fB.BOUNDARY:fB.INTERIOR},e}(XP),IM=function(){if(this._li=new HB,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new BM(0,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1],n=$B.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new BM(0,e,n),this._arg[1]=new BM(1,r,n)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];i.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new BM(0,i,s),this._arg[1]=new BM(1,o,s)}};IM.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},IM.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},IM.prototype.interfaces_=function(){return[]},IM.prototype.getClass=function(){return IM};var PM=function(){};PM.prototype.interfaces_=function(){return[]},PM.prototype.getClass=function(){return PM},PM.map=function(){if(arguments[0]instanceof XB&&dB(arguments[1],PM.MapOp)){for(var t=arguments[0],e=arguments[1],r=new hI,n=0;n<t.getNumGeometries();n++){var i=e.map(t.getGeometryN(n));null!==i&&r.add(i)}return t.getFactory().buildGeometry(r)}if(dB(arguments[0],oI)&&dB(arguments[1],PM.MapOp)){for(var o=arguments[0],s=arguments[1],a=new hI,l=o.iterator();l.hasNext();){var u=l.next(),h=s.map(u);null!==h&&a.add(h)}return a}},PM.MapOp=function(){};var TM=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r),this._ptLocator=new PF,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new ZT,this._resultPolyList=new hI,this._resultLineList=new hI,this._resultPointList=new hI,this._graph=new XP(new XT),this._geomFact=e.getFactory()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new kP(t.getLabel())).flip();var i=e.getDepth();i.isNull()&&i.add(r),i.add(n),r.merge(n)}else this._edgeList.add(t)},e.prototype.getGraph=function(){return this._graph},e.prototype.cancelDuplicateResultEdges=function(){for(var t=this._graph.getEdgeEnds().iterator();t.hasNext();){var e=t.next(),r=e.getSym();e.isInResult()&&r.isInResult()&&(e.setInResult(!1),r.setInResult(!1))}},e.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},e.prototype.computeGeometry=function(t,r,n,i){var o=new hI;return o.addAll(t),o.addAll(r),o.addAll(n),o.isEmpty()?e.createEmptyResult(i,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(o)},e.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().mergeSymLabels()},e.prototype.isCovered=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(this._ptLocator.locate(t,n)!==fB.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var t=new hI,e=this._edgeList.iterator();e.hasNext();){var r=e.next();r.isCollapsed()&&(e.remove(),t.add(r.getCollapsedEdge()))}this._edgeList.addAll(t)},e.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),r=e.getEdges().getLabel();e.getLabel().merge(r)}},e.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},e.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();this.insertUniqueEdge(r)}},e.prototype.computeOverlay=function(t){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 e=new hI;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),WF.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var r=new YP(this._geomFact);r.add(this._graph),this._resultPolyList=r.getPolygons();var n=new YF(this,this._geomFact,this._ptLocator);this._resultLineList=n.build(t);var i=new ZF(this,this._geomFact,this._ptLocator);this._resultPointList=i.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)},e.prototype.labelIncompleteNode=function(t,e){var r=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,r)},e.prototype.copyPoints=function(t){for(var e=this._arg[t].getNodeIterator();e.hasNext();){var r=e.next();this._graph.addNode(r.getCoordinate()).setLabel(t,r.getLabel().getLocation(t))}},e.prototype.findResultAreaEdges=function(t){for(var r=this._graph.getEdgeEnds().iterator();r.hasNext();){var n=r.next(),i=n.getLabel();i.isArea()&&!n.isInteriorAreaEdge()&&e.isResultOfOp(i.getLocation(0,IP.RIGHT),i.getLocation(1,IP.RIGHT),t)&&n.setInResult(!0)}},e.prototype.computeLabelsFromDepths=function(){for(var t=this._edgeList.iterator();t.hasNext();){var e=t.next(),r=e.getLabel(),n=e.getDepth();if(!n.isNull()){n.normalize();for(var i=0;i<2;i++)r.isNull(i)||!r.isArea()||n.isNull(i)||(0===n.getDelta(i)?r.toLine(i):(GB.isTrue(!n.isNull(i,IP.LEFT),"depth of LEFT side has not been initialized"),r.setLocation(i,IP.LEFT,n.getLocation(i,IP.LEFT)),GB.isTrue(!n.isNull(i,IP.RIGHT),"depth of RIGHT side has not been initialized"),r.setLocation(i,IP.RIGHT,n.getLocation(i,IP.RIGHT))))}}},e.prototype.computeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},e.prototype.labelIncompleteNodes=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),r=e.getLabel();e.isIsolated()&&(r.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(r)}},e.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(IM);TM.overlayOp=function(t,e,r){return new TM(t,e).getResultGeometry(r)},TM.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return TM.createEmptyResult(TM.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var r=e;return XF.map(t,{interfaces_:function(){return[PM.MapOp]},map:function(t){return t.intersection(r)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),uM.overlayOp(t,e,TM.INTERSECTION)},TM.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return TM.createEmptyResult(TM.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),uM.overlayOp(t,e,TM.SYMDIFFERENCE)},TM.resultDimension=function(t,e,r){var n=e.getDimension(),i=r.getDimension(),o=-1;switch(t){case TM.INTERSECTION:o=Math.min(n,i);break;case TM.UNION:o=Math.max(n,i);break;case TM.DIFFERENCE:o=n;break;case TM.SYMDIFFERENCE:o=Math.max(n,i)}return o},TM.createEmptyResult=function(t,e,r,n){var i=null;switch(TM.resultDimension(t,e,r)){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()}return i},TM.difference=function(t,e){return t.isEmpty()?TM.createEmptyResult(TM.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),uM.overlayOp(t,e,TM.DIFFERENCE))},TM.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=t.getLocation(0),n=t.getLocation(1);return TM.isResultOfOp(r,n,e)}if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];switch(i===fB.BOUNDARY&&(i=fB.INTERIOR),o===fB.BOUNDARY&&(o=fB.INTERIOR),s){case TM.INTERSECTION:return i===fB.INTERIOR&&o===fB.INTERIOR;case TM.UNION:return i===fB.INTERIOR||o===fB.INTERIOR;case TM.DIFFERENCE:return i===fB.INTERIOR&&o!==fB.INTERIOR;case TM.SYMDIFFERENCE:return i===fB.INTERIOR&&o!==fB.INTERIOR||i!==fB.INTERIOR&&o===fB.INTERIOR}return!1}},TM.INTERSECTION=1,TM.UNION=2,TM.DIFFERENCE=3,TM.SYMDIFFERENCE=4;var FM=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new PF,this._seg=new vT;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};FM.prototype.isWithinToleranceOfBoundary=function(t){for(var e=this,r=0;r<this._linework.getNumGeometries();r++)for(var n=e._linework.getGeometryN(r).getCoordinateSequence(),i=0;i<n.size()-1;i++)if(n.getCoordinate(i,e._seg.p0),n.getCoordinate(i+1,e._seg.p1),e._seg.distance(t)<=e._boundaryDistanceTolerance)return!0;return!1},FM.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?fB.BOUNDARY:this._ptLocator.locate(t,this._g)},FM.prototype.extractLinework=function(t){var e=new MM;t.apply(e);var r=e.getLinework(),n=_P.toLineStringArray(r);return t.getFactory().createMultiLineString(n)},FM.prototype.interfaces_=function(){return[]},FM.prototype.getClass=function(){return FM};var MM=function(){this._linework=null,this._linework=new hI};MM.prototype.getLinework=function(){return this._linework},MM.prototype.filter=function(t){if(t instanceof rP){var e=t;this._linework.add(e.getExteriorRing());for(var r=0;r<e.getNumInteriorRing();r++)this._linework.add(e.getInteriorRingN(r))}},MM.prototype.interfaces_=function(){return[kI]},MM.prototype.getClass=function(){return MM};var LM=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};LM.prototype.extractPoints=function(t,e,r){for(var n=t.getCoordinates(),i=0;i<n.length-1;i++)this.computeOffsetPoints(n[i],n[i+1],e,r)},LM.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},LM.prototype.getPoints=function(t){for(var e=new hI,r=IF.getLines(this._g).iterator();r.hasNext();){var n=r.next();this.extractPoints(n,t,e)}return e},LM.prototype.computeOffsetPoints=function(t,e,r,n){var i=e.x-t.x,o=e.y-t.y,s=Math.sqrt(i*i+o*o),a=r*i/s,l=r*o/s,u=(e.x+t.x)/2,h=(e.y+t.y)/2;if(this._doLeft){var c=new uB(u-l,h+a);n.add(c)}if(this._doRight){var A=new uB(u+l,h-a);n.add(A)}},LM.prototype.interfaces_=function(){return[]},LM.prototype.getClass=function(){return LM};var OM=function t(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=t.TOLERANCE,this._testCoords=new hI;var e=arguments[0],r=arguments[1],n=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,r),this._geom=[e,r,n],this._locFinder=[new FM(this._geom[0],this._boundaryDistanceTolerance),new FM(this._geom[1],this._boundaryDistanceTolerance),new FM(this._geom[2],this._boundaryDistanceTolerance)]},NM={TOLERANCE:{configurable:!0}};OM.prototype.reportResult=function(t,e,r){PB.out.println("Overlay result invalid - A:"+fB.toLocationSymbol(e[0])+" B:"+fB.toLocationSymbol(e[1])+" expected:"+(r?"i":"e")+" actual:"+fB.toLocationSymbol(e[2]))},OM.prototype.isValid=function(t){return this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]),this.checkValid(t)},OM.prototype.checkValid=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=0;r<this._testCoords.size();r++){var n=t._testCoords.get(r);if(!t.checkValid(e,n))return t._invalidLocation=n,!1}return!0}if(2===arguments.length){var i=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),!!OM.hasLocation(this._location,fB.BOUNDARY)||this.isValidResult(i,this._location)}},OM.prototype.addTestPts=function(t){var e=new LM(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},OM.prototype.isValidResult=function(t,e){var r=TM.isResultOfOp(e[0],e[1],t),n=!(r^e[2]===fB.INTERIOR);return n||this.reportResult(t,e,r),n},OM.prototype.getInvalidLocation=function(){return this._invalidLocation},OM.prototype.interfaces_=function(){return[]},OM.prototype.getClass=function(){return OM},OM.hasLocation=function(t,e){for(var r=0;r<3;r++)if(t[r]===e)return!0;return!1},OM.computeBoundaryDistanceTolerance=function(t,e){return Math.min(tM.computeSizeBasedSnapTolerance(t),tM.computeSizeBasedSnapTolerance(e))},OM.isValid=function(t,e,r,n){return new OM(t,e,n).isValid(r)},NM.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(OM,NM);var RM=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};RM.prototype.extractElements=function(t,e){if(null===t)return null;for(var r=0;r<t.getNumGeometries();r++){var n=t.getGeometryN(r);this._skipEmpty&&n.isEmpty()||e.add(n)}},RM.prototype.combine=function(){for(var t=new hI,e=this._inputGeoms.iterator();e.hasNext();){var r=e.next();this.extractElements(r,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},RM.prototype.interfaces_=function(){return[]},RM.prototype.getClass=function(){return RM},RM.combine=function(){if(1===arguments.length)return new RM(arguments[0]).combine();if(2===arguments.length){var t=arguments[0],e=arguments[1];return new RM(RM.createList(t,e)).combine()}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];return new RM(RM.createList(r,n,i)).combine()}},RM.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},RM.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new hI;return r.add(t),r.add(e),r}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],s=new hI;return s.add(n),s.add(i),s.add(o),s}};var kM=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new hI)},UM={STRTREE_NODE_CAPACITY:{configurable:!0}};kM.prototype.reduceToGeometries=function(t){for(var e=new hI,r=t.iterator();r.hasNext();){var n=r.next(),i=null;dB(n,lI)?i=this.unionTree(n):n instanceof XB&&(i=n),e.add(i)}return e},kM.prototype.extractByEnvelope=function(t,e,r){for(var n=new hI,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);o.getEnvelopeInternal().intersects(t)?n.add(o):r.add(o)}return this._geomFactory.buildGeometry(n)},kM.prototype.unionOptimized=function(t,e){var r=t.getEnvelopeInternal(),n=e.getEnvelopeInternal();if(!r.intersects(n))return RM.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=r.intersection(n);return this.unionUsingEnvelopeIntersection(t,e,i)},kM.prototype.union=function(){if(null===this._inputPolys)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 hT(kM.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var r=e.next();t.insert(r.getEnvelopeInternal(),r)}this._inputPolys=null;var n=t.itemsTree();return this.unionTree(n)},kM.prototype.binaryUnion=function(){if(1===arguments.length){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];if(n-r<=1){var i=kM.getGeometry(e,r);return this.unionSafe(i,null)}if(n-r==2)return this.unionSafe(kM.getGeometry(e,r),kM.getGeometry(e,r+1));var o=Math.trunc((n+r)/2),s=this.binaryUnion(e,r,o),a=this.binaryUnion(e,o,n);return this.unionSafe(s,a)}},kM.prototype.repeatedUnion=function(t){for(var e=null,r=t.iterator();r.hasNext();){var n=r.next();e=null===e?n.copy():e.union(n)}return e},kM.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},kM.prototype.unionActual=function(t,e){return kM.restrictToPolygons(t.union(e))},kM.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},kM.prototype.unionUsingEnvelopeIntersection=function(t,e,r){var n=new hI,i=this.extractByEnvelope(r,t,n),o=this.extractByEnvelope(r,e,n),s=this.unionActual(i,o);return n.add(s),RM.combine(n)},kM.prototype.bufferUnion=function(){if(1===arguments.length){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().createGeometryCollection([e,r]).buffer(0)}},kM.prototype.interfaces_=function(){return[]},kM.prototype.getClass=function(){return kM},kM.restrictToPolygons=function(t){if(dB(t,eP))return t;var e=BF.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(_P.toPolygonArray(e))},kM.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},kM.union=function(t){return new kM(t).union()},UM.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(kM,UM);var DM=function(){};function GM(){return new QM}function QM(){this.reset()}DM.prototype.interfaces_=function(){return[]},DM.prototype.getClass=function(){return DM},DM.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return TM.createEmptyResult(TM.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),uM.overlayOp(t,e,TM.UNION)},QM.prototype={constructor:QM,reset:function(){this.s=this.t=0},add:function(t){HM(jM,t,this.t),HM(this,jM.s,this.s),this.s?this.t+=jM.t:this.s=jM.t},valueOf:function(){return this.s}};var jM=new QM;function HM(t,e,r){var n=t.s=e+r,i=n-e,o=n-i;t.t=e-o+(r-i)}var zM=1e-6,VM=Math.PI,KM=VM/2,qM=VM/4,WM=2*VM,XM=180/VM,YM=VM/180,ZM=Math.abs,JM=Math.atan,$M=Math.atan2,tL=Math.cos,eL=Math.sin,rL=Math.sqrt;function nL(t){return t>1?0:t<-1?VM:Math.acos(t)}function iL(t){return t>1?KM:t<-1?-KM:Math.asin(t)}function oL(){}function sL(t,e){t&&hL.hasOwnProperty(t.type)&&hL[t.type](t,e)}var aL,lL,uL={Feature:function(t,e){sL(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)sL(r[n].geometry,e)}},hL={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){cL(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)cL(r[n],e,0)},Polygon:function(t,e){AL(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)AL(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)sL(r[n],e)}};function cL(t,e,r){var n,i=-1,o=t.length-r;for(e.lineStart();++i<o;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function AL(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)cL(t[r],e,1);e.polygonEnd()}function fL(t){return[$M(t[1],t[0]),iL(t[2])]}function pL(t){var e=t[0],r=t[1],n=tL(r);return[n*tL(e),n*eL(e),eL(r)]}function dL(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function gL(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function yL(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function mL(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function vL(t){var e=rL(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function _L(t,e){function r(r,n){return r=t(r,n),e(r[0],r[1])}return t.invert&&e.invert&&(r.invert=function(r,n){return(r=e.invert(r,n))&&t.invert(r[0],r[1])}),r}function wL(t,e){return[t>VM?t-WM:t<-VM?t+WM:t,e]}function bL(t){return function(e,r){return[(e+=t)>VM?e-WM:e<-VM?e+WM:e,r]}}function xL(t){var e=bL(t);return e.invert=bL(-t),e}function EL(t,e){var r=tL(t),n=eL(t),i=tL(e),o=eL(e);function s(t,e){var s=tL(e),a=tL(t)*s,l=eL(t)*s,u=eL(e),h=u*r+a*n;return[$M(l*i-h*o,a*r-u*n),iL(h*i+l*o)]}return s.invert=function(t,e){var s=tL(e),a=tL(t)*s,l=eL(t)*s,u=eL(e),h=u*i-l*o;return[$M(l*i+u*o,a*r+h*n),iL(h*r-a*n)]},s}function CL(t,e){(e=pL(e))[0]-=t,vL(e);var r=nL(-e[1]);return((-e[2]<0?-r:r)+WM-zM)%WM}function SL(){var t,e=[];return{point:function(e,r){t.push([e,r])},lineStart:function(){e.push(t=[])},lineEnd:oL,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function BL(t,e){return ZM(t[0]-e[0])<zM&&ZM(t[1]-e[1])<zM}function IL(t,e,r,n){this.x=t,this.z=e,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function PL(t,e,r,n,i){var o,s,a=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,r,n=t[0],s=t[e];if(BL(n,s)){for(i.lineStart(),o=0;o<e;++o)i.point((n=t[o])[0],n[1]);i.lineEnd()}else a.push(r=new IL(n,t,null,!0)),l.push(r.o=new IL(n,null,r,!1)),a.push(r=new IL(s,t,null,!1)),l.push(r.o=new IL(s,null,r,!0))}})),a.length){for(l.sort(e),TL(a),TL(l),o=0,s=l.length;o<s;++o)l[o].e=r=!r;for(var u,h,c=a[0];;){for(var A=c,f=!0;A.v;)if((A=A.n)===c)return;u=A.z,i.lineStart();do{if(A.v=A.o.v=!0,A.e){if(f)for(o=0,s=u.length;o<s;++o)i.point((h=u[o])[0],h[1]);else n(A.x,A.n.x,1,i);A=A.n}else{if(f)for(u=A.p.z,o=u.length-1;o>=0;--o)i.point((h=u[o])[0],h[1]);else n(A.x,A.p.x,-1,i);A=A.p}u=(A=A.o).z,f=!f}while(!A.v);i.lineEnd()}}}function TL(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n<e;)i.n=r=t[n],r.p=i,i=r;i.n=r=t[0],r.p=i}}function FL(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ML(t){for(var e,r,n,i=t.length,o=-1,s=0;++o<i;)s+=t[o].length;for(r=new Array(s);--i>=0;)for(e=(n=t[i]).length;--e>=0;)r[--s]=n[e];return r}GM(),GM(),GM(),wL.invert=wL,1===(aL=FL).length&&(lL=aL,aL=function(t,e){return FL(lL(t),e)});var LL=1e9,OL=-LL,NL=GM();function RL(t){return t}GM(),GM(),GM();var kL=1/0,UL=kL,DL=-kL,GL=DL,QL={point:function(t,e){t<kL&&(kL=t),t>DL&&(DL=t),e<UL&&(UL=e),e>GL&&(GL=e)},lineStart:oL,lineEnd:oL,polygonStart:oL,polygonEnd:oL,result:function(){var t=[[kL,UL],[DL,GL]];return DL=GL=-(UL=kL=1/0),t}};function jL(t,e,r,n){return function(i,o){var s,a,l,u=e(o),h=i.invert(n[0],n[1]),c=SL(),A=e(c),f=!1,p={point:d,lineStart:y,lineEnd:m,polygonStart:function(){p.point=v,p.lineStart=_,p.lineEnd=w,a=[],s=[]},polygonEnd:function(){p.point=d,p.lineStart=y,p.lineEnd=m,a=ML(a);var t=function(t,e){var r=e[0],n=e[1],i=[eL(r),-tL(r),0],o=0,s=0;NL.reset();for(var a=0,l=t.length;a<l;++a)if(h=(u=t[a]).length)for(var u,h,c=u[h-1],A=c[0],f=c[1]/2+qM,p=eL(f),d=tL(f),g=0;g<h;++g,A=m,p=_,d=w,c=y){var y=u[g],m=y[0],v=y[1]/2+qM,_=eL(v),w=tL(v),b=m-A,x=b>=0?1:-1,E=x*b,C=E>VM,S=p*_;if(NL.add($M(S*x*eL(E),d*w+S*tL(E))),o+=C?b+x*WM:b,C^A>=r^m>=r){var B=gL(pL(c),pL(y));vL(B);var I=gL(i,B);vL(I);var P=(C^b>=0?-1:1)*iL(I[2]);(n>P||n===P&&(B[0]||B[1]))&&(s+=C^b>=0?1:-1)}}return(o<-zM||o<zM&&NL<-zM)^1&s}(s,h);a.length?(f||(o.polygonStart(),f=!0),PL(a,zL,t,r,o)):t&&(f||(o.polygonStart(),f=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),f&&(o.polygonEnd(),f=!1),a=s=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function d(e,r){var n=i(e,r);t(e=n[0],r=n[1])&&o.point(e,r)}function g(t,e){var r=i(t,e);u.point(r[0],r[1])}function y(){p.point=g,u.lineStart()}function m(){p.point=d,u.lineEnd()}function v(t,e){l.push([t,e]);var r=i(t,e);A.point(r[0],r[1])}function _(){A.lineStart(),l=[]}function w(){v(l[0][0],l[0][1]),A.lineEnd();var t,e,r,n,i=A.clean(),u=c.result(),h=u.length;if(l.pop(),s.push(l),l=null,h)if(1&i){if((e=(r=u[0]).length-1)>0){for(f||(o.polygonStart(),f=!0),o.lineStart(),t=0;t<e;++t)o.point((n=r[t])[0],n[1]);o.lineEnd()}}else h>1&&2&i&&u.push(u.pop().concat(u.shift())),a.push(u.filter(HL))}return p}}function HL(t){return t.length>1}function zL(t,e){return((t=t.x)[0]<0?t[1]-KM-zM:KM-t[1])-((e=e.x)[0]<0?e[1]-KM-zM:KM-e[1])}GM();const VL=jL((function(){return!0}),(function(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?VM:-VM,l=ZM(o-r);ZM(l-VM)<zM?(t.point(r,n=(n+s)/2>0?KM:-KM),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(o,n),e=0):i!==a&&l>=VM&&(ZM(r-i)<zM&&(r-=i*zM),ZM(o-a)<zM&&(o-=a*zM),n=function(t,e,r,n){var i,o,s=eL(t-r);return ZM(s)>zM?JM((eL(e)*(o=tL(n))*eL(r)-eL(n)*(i=tL(e))*eL(t))/(i*o*s)):(e+n)/2}(r,n,o,s),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),e=0),t.point(r=o,n=s),i=a},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var i;if(null==t)i=r*KM,n.point(-VM,i),n.point(0,i),n.point(VM,i),n.point(VM,0),n.point(VM,-i),n.point(0,-i),n.point(-VM,-i),n.point(-VM,0),n.point(-VM,i);else if(ZM(t[0]-e[0])>zM){var o=t[0]<e[0]?VM:-VM;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(e[0],e[1])}),[-VM,-KM]);function KL(t){return function(e){var r=new qL;for(var n in t)r[n]=t[n];return r.stream=e,r}}function qL(){}function WL(t,e,r){var n=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),null!=o&&t.clipExtent(null),function(t,e){t&&uL.hasOwnProperty(t.type)?uL[t.type](t,e):sL(t,e)}(r,t.stream(QL));var s=QL.result(),a=Math.min(n/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),l=+e[0][0]+(n-a*(s[1][0]+s[0][0]))/2,u=+e[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*a).translate([l,u])}qL.prototype={constructor:qL,point:function(t,e){this.stream.point(t,e)},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()}};var XL=16,YL=tL(30*YM);function ZL(t,e){return+e?function(t,e){function r(n,i,o,s,a,l,u,h,c,A,f,p,d,g){var y=u-n,m=h-i,v=y*y+m*m;if(v>4*e&&d--){var _=s+A,w=a+f,b=l+p,x=rL(_*_+w*w+b*b),E=iL(b/=x),C=ZM(ZM(b)-1)<zM||ZM(o-c)<zM?(o+c)/2:$M(w,_),S=t(C,E),B=S[0],I=S[1],P=B-n,T=I-i,F=m*P-y*T;(F*F/v>e||ZM((y*P+m*T)/v-.5)>.3||s*A+a*f+l*p<YL)&&(r(n,i,o,s,a,l,B,I,C,_/=x,w/=x,b,d,g),g.point(B,I),r(B,I,C,_,w,b,u,h,c,A,f,p,d,g))}}return function(e){var n,i,o,s,a,l,u,h,c,A,f,p,d={point:g,lineStart:y,lineEnd:v,polygonStart:function(){e.polygonStart(),d.lineStart=_},polygonEnd:function(){e.polygonEnd(),d.lineStart=y}};function g(r,n){r=t(r,n),e.point(r[0],r[1])}function y(){h=NaN,d.point=m,e.lineStart()}function m(n,i){var o=pL([n,i]),s=t(n,i);r(h,c,u,A,f,p,h=s[0],c=s[1],u=n,A=o[0],f=o[1],p=o[2],XL,e),e.point(h,c)}function v(){d.point=g,e.lineEnd()}function _(){y(),d.point=w,d.lineEnd=b}function w(t,e){m(n=t,e),i=h,o=c,s=A,a=f,l=p,d.point=m}function b(){r(h,c,u,A,f,p,i,o,n,s,a,l,XL,e),d.lineEnd=v,v()}return d}}(t,e):function(t){return KL({point:function(e,r){e=t(e,r),this.stream.point(e[0],e[1])}})}(t)}var JL=KL({point:function(t,e){this.stream.point(t*YM,e*YM)}});function $L(t){return function(e,r){var n=tL(e),i=tL(r),o=t(n*i);return[o*i*eL(e),o*eL(r)]}}function tO(t){return function(e,r){var n=rL(e*e+r*r),i=t(n),o=eL(i),s=tL(i);return[$M(e*o,n*s),iL(n&&r*o/n)]}}$L((function(t){return rL(2/(1+t))})).invert=tO((function(t){return 2*iL(t/2)}));var eO=$L((function(t){return(t=nL(t))&&t/eL(t)}));function rO(t,e){return[t,e]}function nO(t,e,r){var n=(r=r||{}).units||"kilometers",i=r.steps||8;if(!t)throw new Error("geojson is required");if("object"!=typeof r)throw new Error("options must be an object");if("number"!=typeof i)throw new Error("steps must be an number");if(void 0===e)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var o=[];switch(t.type){case"GeometryCollection":return xv(t,(function(t){var r=iO(t,e,n,i);r&&o.push(r)})),iv(o);case"FeatureCollection":return _v(t,(function(t){var r=iO(t,e,n,i);r&&_v(r,(function(t){t&&o.push(t)}))})),iv(o)}return iO(t,e,n,i)}function iO(t,e,r,n){var i=t.properties||{},o="Feature"===t.type?t.geometry:t;if("GeometryCollection"===o.type){var s=[];return xv(t,(function(t){var i=iO(t,e,r,n);i&&s.push(i)})),iv(s)}var a=function(t){var e,r=L_(t).geometry.coordinates,n=[-r[0],-r[1]];return(e=eO,function(t){var e,r,n,i,o,s,a,l,u,h,c=150,A=480,f=250,p=0,d=0,g=0,y=0,m=0,v=null,_=VL,w=null,b=RL,x=.5,E=ZL(B,x);function C(t){return[(t=o(t[0]*YM,t[1]*YM))[0]*c+r,n-t[1]*c]}function S(t){return(t=o.invert((t[0]-r)/c,(n-t[1])/c))&&[t[0]*XM,t[1]*XM]}function B(t,i){return[(t=e(t,i))[0]*c+r,n-t[1]*c]}function I(){o=_L(i=function(t,e,r){return(t%=WM)?e||r?_L(xL(t),EL(e,r)):xL(t):e||r?EL(e,r):wL}(g,y,m),e);var t=e(p,d);return r=A-t[0]*c,n=f+t[1]*c,P()}function P(){return u=h=null,C}return C.stream=function(t){return u&&h===t?u:u=JL(_(i,E(b(h=t))))},C.clipAngle=function(t){return arguments.length?(_=+t?function(t,e){var r=tL(t),n=r>0,i=ZM(r)>zM;function o(t,e){return tL(t)*tL(e)>r}function s(t,e,n){var i=[1,0,0],o=gL(pL(t),pL(e)),s=dL(o,o),a=o[0],l=s-a*a;if(!l)return!n&&t;var u=r*s/l,h=-r*a/l,c=gL(i,o),A=mL(i,u);yL(A,mL(o,h));var f=c,p=dL(A,f),d=dL(f,f),g=p*p-d*(dL(A,A)-1);if(!(g<0)){var y=rL(g),m=mL(f,(-p-y)/d);if(yL(m,A),m=fL(m),!n)return m;var v,_=t[0],w=e[0],b=t[1],x=e[1];w<_&&(v=_,_=w,w=v);var E=w-_,C=ZM(E-VM)<zM;if(!C&&x<b&&(v=b,b=x,x=v),C||E<zM?C?b+x>0^m[1]<(ZM(m[0]-_)<zM?b:x):b<=m[1]&&m[1]<=x:E>VM^(_<=m[0]&&m[0]<=w)){var S=mL(f,(-p+y)/d);return yL(S,A),[m,fL(S)]}}}function a(e,r){var i=n?t:VM-t,o=0;return e<-i?o|=1:e>i&&(o|=2),r<-i?o|=4:r>i&&(o|=8),o}return jL(o,(function(t){var e,r,l,u,h;return{lineStart:function(){u=l=!1,h=1},point:function(c,A){var f,p=[c,A],d=o(c,A),g=n?d?0:a(c,A):d?a(c+(c<0?VM:-VM),A):0;if(!e&&(u=l=d)&&t.lineStart(),d!==l&&(!(f=s(e,p))||BL(e,f)||BL(p,f))&&(p[0]+=zM,p[1]+=zM,d=o(p[0],p[1])),d!==l)h=0,d?(t.lineStart(),f=s(p,e),t.point(f[0],f[1])):(f=s(e,p),t.point(f[0],f[1]),t.lineEnd()),e=f;else if(i&&e&&n^d){var y;g&r||!(y=s(p,e,!0))||(h=0,n?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!d||e&&BL(e,p)||t.point(p[0],p[1]),e=p,l=d,r=g},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return h|(u&&l)<<1}}}),(function(r,n,i,o){!function(t,e,r,n,i,o){if(r){var s=tL(e),a=eL(e),l=n*r;null==i?(i=e+n*WM,o=e-l/2):(i=CL(s,i),o=CL(s,o),(n>0?i<o:i>o)&&(i+=n*WM));for(var u,h=i;n>0?h>o:h<o;h-=l)u=fL([s,-a*tL(h),-a*eL(h)]),t.point(u[0],u[1])}}(o,t,e,i,r,n)}),n?[0,-t]:[-VM,t-VM])}(v=t*YM,6*YM):(v=null,VL),P()):v*XM},C.clipExtent=function(t){return arguments.length?(b=null==t?(w=s=a=l=null,RL):function(t,e,r,n){function i(i,o){return t<=i&&i<=r&&e<=o&&o<=n}function o(i,o,a,u){var h=0,c=0;if(null==i||(h=s(i,a))!==(c=s(o,a))||l(i,o)<0^a>0)do{u.point(0===h||3===h?t:r,h>1?n:e)}while((h=(h+a+4)%4)!==c);else u.point(o[0],o[1])}function s(n,i){return ZM(n[0]-t)<zM?i>0?0:3:ZM(n[0]-r)<zM?i>0?2:1:ZM(n[1]-e)<zM?i>0?1:0:i>0?3:2}function a(t,e){return l(t.x,e.x)}function l(t,e){var r=s(t,1),n=s(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){var l,u,h,c,A,f,p,d,g,y,m,v=s,_=SL(),w={point:b,lineStart:function(){w.point=x,u&&u.push(h=[]),y=!0,g=!1,p=d=NaN},lineEnd:function(){l&&(x(c,A),f&&g&&_.rejoin(),l.push(_.result())),w.point=b,g&&v.lineEnd()},polygonStart:function(){v=_,l=[],u=[],m=!0},polygonEnd:function(){var e=function(){for(var e=0,r=0,i=u.length;r<i;++r)for(var o,s,a=u[r],l=1,h=a.length,c=a[0],A=c[0],f=c[1];l<h;++l)o=A,s=f,A=(c=a[l])[0],f=c[1],s<=n?f>n&&(A-o)*(n-s)>(f-s)*(t-o)&&++e:f<=n&&(A-o)*(n-s)<(f-s)*(t-o)&&--e;return e}(),r=m&&e,i=(l=ML(l)).length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&PL(l,a,e,o,s),s.polygonEnd()),v=s,l=u=h=null}};function b(t,e){i(t,e)&&v.point(t,e)}function x(o,s){var a=i(o,s);if(u&&h.push([o,s]),y)c=o,A=s,f=a,y=!1,a&&(v.lineStart(),v.point(o,s));else if(a&&g)v.point(o,s);else{var l=[p=Math.max(OL,Math.min(LL,p)),d=Math.max(OL,Math.min(LL,d))],_=[o=Math.max(OL,Math.min(LL,o)),s=Math.max(OL,Math.min(LL,s))];!function(t,e,r,n,i,o){var s,a=t[0],l=t[1],u=0,h=1,c=e[0]-a,A=e[1]-l;if(s=r-a,c||!(s>0)){if(s/=c,c<0){if(s<u)return;s<h&&(h=s)}else if(c>0){if(s>h)return;s>u&&(u=s)}if(s=i-a,c||!(s<0)){if(s/=c,c<0){if(s>h)return;s>u&&(u=s)}else if(c>0){if(s<u)return;s<h&&(h=s)}if(s=n-l,A||!(s>0)){if(s/=A,A<0){if(s<u)return;s<h&&(h=s)}else if(A>0){if(s>h)return;s>u&&(u=s)}if(s=o-l,A||!(s<0)){if(s/=A,A<0){if(s>h)return;s>u&&(u=s)}else if(A>0){if(s<u)return;s<h&&(h=s)}return u>0&&(t[0]=a+u*c,t[1]=l+u*A),h<1&&(e[0]=a+h*c,e[1]=l+h*A),!0}}}}}(l,_,t,e,r,n)?a&&(v.lineStart(),v.point(o,s),m=!1):(g||(v.lineStart(),v.point(l[0],l[1])),v.point(_[0],_[1]),a||v.lineEnd(),m=!1)}p=o,d=s,g=a}return w}}(w=+t[0][0],s=+t[0][1],a=+t[1][0],l=+t[1][1]),P()):null==w?null:[[w,s],[a,l]]},C.scale=function(t){return arguments.length?(c=+t,I()):c},C.translate=function(t){return arguments.length?(A=+t[0],f=+t[1],I()):[A,f]},C.center=function(t){return arguments.length?(p=t[0]%360*YM,d=t[1]%360*YM,I()):[p*XM,d*XM]},C.rotate=function(t){return arguments.length?(g=t[0]%360*YM,y=t[1]%360*YM,m=t.length>2?t[2]%360*YM:0,I()):[g*XM,y*XM,m*XM]},C.precision=function(t){return arguments.length?(E=ZL(B,x=t*t),P()):rL(x)},C.fitExtent=function(t,e){return WL(C,t,e)},C.fitSize=function(t,e){return function(t,e,r){return WL(t,[[0,0],e],r)}(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&S,I()}}((function(){return e}))()).scale(79.4188).clipAngle(179.999).rotate(n).scale(Ym)}(o),l={type:o.type,coordinates:sO(o.coordinates,a)},u=(new SP).read(l),h=uv(hv(e,r),"meters"),c=vF.bufferOp(u,h,n);if(!oO((c=(new BP).write(c)).coordinates))return tv({type:c.type,coordinates:aO(c.coordinates,a)},i)}function oO(t){return Array.isArray(t[0])?oO(t[0]):isNaN(t[0])}function sO(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return sO(t,e)}))}function aO(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return aO(t,e)}))}function lO(t,e,r){void 0===r&&(r={});var n=Rv(t),i=Rv(e),o=tB.intersection(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?rv(o[0],r.properties):av(o,r.properties)}function uO(t,e,r,n,i,o){for(var s=[],a=0;a<6;a++){var l=t[0]+e*i[a],u=t[1]+r*o[a];s.push([l,u])}return s.push(s[0].slice()),rv([s],n)}function hO(t,e,r,n,i,o){for(var s=[],a=0;a<6;a++){var l=[];l.push(t),l.push([t[0]+e*i[a],t[1]+r*o[a]]),l.push([t[0]+e*i[(a+1)%6],t[1]+r*o[(a+1)%6]]),l.push(t),s.push(rv([l],n))}return s}eO.invert=tO((function(t){return t})),rO.invert=rO;class cO{static sector(t,e,r,n){var i=function(t,e,r,n,i){if(!gv(i=i||{}))throw new Error("options is invalid");var o=i.properties;if(!t)throw new Error("center is required");if(null==r)throw new Error("bearing1 is required");if(null==n)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if("object"!=typeof i)throw new Error("options must be an object");if(Hx(r)===Hx(n))return F_(t,e,i);var s=Ov(t),a=function(t,e,r,n,i){void 0===i&&(i={});var o=i.steps||64,s=pw(r),a=pw(n),l=Array.isArray(t)||"Feature"!==t.type?{}:t.properties;if(s===a)return nv(F_(t,e,i).geometry.coordinates[0],l);for(var u=s,h=s<a?a:a+360,c=u,A=[],f=0;c<h;)A.push(T_(t,e,c,i).geometry.coordinates),c=u+360*++f/o;return c>h&&A.push(T_(t,e,h,i).geometry.coordinates),nv(A,l)}(t,e,r,n,i),l=[[s]];return mv(a,(function(t){l[0].push(t)})),l[0].push(s),rv(l,o)}(t,e/1e3,r,n);return cO.to3857(i)}static nearestPoint(t,e){var r=function(t,e){if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");var r,n=1/0,i=0;return _v(e,(function(e,r){var o=Wv(t,e);o<n&&(i=r,n=o)})),(r=t_(e.features[i])).properties.featureIndex=i,r.properties.distanceToPoint=n,r}(cO.featureTo4326(t),cO.featuresTo4326(e));return cO.to3857(r)}static bezierSpline(t,e){let r;r=t instanceof X?cO.featureTo4326(t):t;var n=function(t,e){void 0===e&&(e={});for(var r=e.resolution||1e4,n=e.sharpness||.85,i=[],o=Rv(t).coordinates.map((function(t){return{x:t[0],y:t[1]}})),s=new P_({duration:r,points:o,sharpness:n}),a=function(t){var e=s.pos(t);Math.floor(t/100)%2==0&&i.push([e.x,e.y])},l=0;l<s.duration;l+=10)a(l);return a(s.duration),nv(i,e.properties)}(r,e);return cO.to3857(n)}static pointsWithinPolygon(t,e){let r,n=cO.featuresTo4326(t);"Circle"==e.getGeometry().getType()?(e.setGeometry(En(e.getGeometry(),128)),r=cO.featureTo4326(e)):r=cO.featureTo4326(e);var i,o,s=(i=r,o=[],_v(n,(function(t){var e=!1;if("Point"===t.geometry.type)xv(i,(function(r){Kv(t,r)&&(e=!0)})),e&&o.push(t);else{if("MultiPoint"!==t.geometry.type)throw new Error("Input geometry must be a Point or MultiPoint");var r=[];xv(i,(function(n){mv(t,(function(t){Kv(t,n)&&(e=!0,r.push(t))}))})),e&&o.push(sv(r))}})),iv(o));return cO.to3857_featureList(s)}static lineOffset(t,e=1){var r=function(t,e,r){if(!gv(r=r||{}))throw new Error("options is invalid");var n=r.units;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");var i=kv(t),o=t.properties;switch(i){case"LineString":return JE(t,e,n);case"MultiLineString":var s=[];return Cv(t,(function(t){s.push(JE(t,e,n).geometry.coordinates)})),ov(s,o);default:throw new Error("geometry "+i+" is not supported")}}(cO.featureTo4326(t),e/=1e3,{units:"kilometers"});return cO.to3857(r)}static nearestPointOnLine(t,e){let r=cO.featureTo4326(t),n=X_(cO.featureTo4326(e),r,{units:"kilometers"});return cO.to3857(n)}static booleanOverlap(t,e){return gC(cO.featureTo4326(t),cO.featureTo4326(e))}static booleanPointInPolygon(t,e){return Kv(cO.featureTo4326(t),cO.featureTo4326(e))}static nearestPointOnLines(t,e){let r=cO.featureTo4326(t),n=X_(cO.featuresTo4326(e),r,{units:"kilometers"});return cO.to3857(n)}static buffer(t,e=5){e/=1e3;var r=nO(cO.featureTo4326(t),e,{units:"kilometers"});return cO.to3857(r)}static difference(t,e){new kf;let r=cO.featureTo4326(t);var n,i,o,s,a,l,u=(i=cO.featureTo4326(e),o=Rv(n=r),s=Rv(i),a=n.properties||{},0===(l=tB.difference(o.coordinates,s.coordinates)).length?null:1===l.length?rv(l[0],a):av(l,a));return cO.to3857(u)}static intersect(t,e){var r=lO(cO.featureTo4326(t),cO.featureTo4326(e));return cO.to3857(r)}static booleanContains(t,e){try{let r,n,i,o=[],s=new kf;n="Circle"==t.getGeometry().getType()?En(t.getGeometry(),128):t.getGeometry();let a=s.writeGeometryObject(n);return e.forEach((e=>{if(t!=e){i="Circle"==e.getGeometry().getType()?En(e.getGeometry(),128):e.getGeometry();let t=s.writeGeometryObject(i);if(nC(a,t))r=s.readFeature(t),o.push(r);else if("Point"!=i.getType()&&"LineString"!=i.getType()&&gC(a,t)){var n=lO(a,t);r=s.readFeature(n),r.setProperties({name:e.get("name")+"重叠区域","重叠对象":e.get("name"),"重叠面积":this.formatArea(i)}),o.push(r)}}})),o}catch(dX){}}static createPolygon(t,e,r,n){let i,o=[],s=cO.featuresTo4326(e),a=function(t,e){void 0===e&&(e={});var r=e.maxEdge||1/0,n=function(t){var e=[],r={};return _v(t,(function(t){if(t.geometry){var n=t.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(r,n)||(e.push(t),r[n]=!0)}})),iv(e)}(t),i=Yv(n);if(i.features=i.features.filter((function(t){var n=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],s=Wv(n,i,e),a=Wv(i,o,e),l=Wv(n,o,e);return s<=r&&a<=r&&l<=r})),i.features.length<1)return null;var o=E_(i);return 1===o.coordinates.length&&(o.coordinates=o.coordinates[0],o.type="Polygon"),tv(o)}(s),l={bbox:Fv(a)};switch(t){case Zp.voronoi:i=function(t,e){if(!gv(e=e||{}))throw new Error("options is invalid");var r=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(!Array.isArray(r))throw new Error("bbox is invalid");return Nv(t,"Point","points"),iv(function(){var t=CC,e=SC,r=null;function n(n){return new sS(n.map((function(r,i){var o=[Math.round(t(r,i,n)/nS)*nS,Math.round(e(r,i,n)/nS)*nS];return o.index=i,o.data=r,o})),r)}return n.polygons=function(t){return n(t).polygons()},n.links=function(t){return n(t).links()},n.triangles=function(t){return n(t).triangles()},n.x=function(e){return arguments.length?(t="function"==typeof e?e:EC(+e),n):t},n.y=function(t){return arguments.length?(e="function"==typeof t?t:EC(+t),n):e},n.extent=function(t){return arguments.length?(r=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],n):r&&[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},n.size=function(t){return arguments.length?(r=null==t?null:[[0,0],[+t[0],+t[1]]],n):r&&[r[1][0]-r[0][0],r[1][1]-r[0][1]]},n}().x((function(t){return t.geometry.coordinates[0]})).y((function(t){return t.geometry.coordinates[1]})).extent([[r[0],r[1]],[r[2],r[3]]]).polygons(t.features).map(aS))}(s,l);break;case Zp.tin:i=Yv(s,"z");break;case Zp.convex:return cO.to3857(a)}return i.features.forEach(((t,e)=>{let i=cO.to3857(t);i.setStyle(new ji({stroke:new Rn({color:r||Xm.getRandomColor(),width:5}),fill:new Tn({color:n||Xm.getRandomColor()})})),i.setProperties({uuid:qm.uuid15(),name:"第"+e+"个"}),o.push(i)})),o}static createGrid(t,e={box:[0,0,0,0],cellSide:50}){let r=[];e.cellSide=e.cellSide/1e3;let n,i={units:"kilometers"};switch(t){case Yp.point:n=function(t,e,r){void 0===r&&(r={}),r.mask&&!r.units&&(r.units="kilometers");for(var n=[],i=t[0],o=t[1],s=t[2],a=t[3],l=e/Wv([i,o],[s,o],r)*(s-i),u=e/Wv([i,o],[i,a],r)*(a-o),h=s-i,c=a-o,A=Math.floor(h/l),f=(c-Math.floor(c/u)*u)/2,p=i+(h-A*l)/2;p<=s;){for(var d=o+f;d<=a;){var g=ev([p,d],r.properties);r.mask?sw(g,r.mask)&&n.push(g):n.push(g),d+=u}p+=l}return iv(n)}(e.box,e.cellSide,i);break;case Yp.hex:n=function(t,e,r){void 0===r&&(r={});var n=JSON.stringify(r.properties||{}),i=t[0],o=t[1],s=t[2],a=t[3],l=(o+a)/2,u=(i+s)/2,h=2*e/Wv([i,l],[s,l],r)*(s-i),c=2*e/Wv([u,o],[u,a],r)*(a-o),A=h/2,f=2*A,p=Math.sqrt(3)/2*c,d=s-i,g=a-o,y=3/4*f,m=p,v=(d-f)/(f-A/2),_=Math.floor(v),w=(_*y-A/2-d)/2-A/2+y/2,b=Math.floor((g-p)/p),x=(g-b*p)/2,E=b*p-g>p/2;E&&(x-=p/4);for(var C=[],S=[],B=0;B<6;B++){var I=2*Math.PI/6*B;C.push(Math.cos(I)),S.push(Math.sin(I))}for(var P=[],T=0;T<=_;T++)for(var F=0;F<=b;F++){var M=T%2==1;if(!(0===F&&M||0===F&&E)){var L=T*y+i-w,O=F*m+o+x;if(M&&(O-=p/2),!0===r.triangles)hO([L,O],h/2,c/2,JSON.parse(n),C,S).forEach((function(t){r.mask?lO(r.mask,t)&&P.push(t):P.push(t)}));else{var N=uO([L,O],h/2,c/2,JSON.parse(n),C,S);r.mask?lO(r.mask,N)&&P.push(N):P.push(N)}}}return iv(P)}(e.box,e.cellSide,i);break;case Yp.square:void 0===(s=i)&&(s={}),n=function(t,e,r,n){void 0===n&&(n={});for(var i=[],o=t[0],s=t[1],a=t[2],l=t[3],u=e/Wv([o,s],[a,s],n)*(a-o),h=r/Wv([o,s],[o,l],n)*(l-s),c=a-o,A=l-s,f=Math.floor(c/u),p=Math.floor(A/h),d=(A-p*h)/2,g=o+(c-f*u)/2,y=0;y<f;y++){for(var m=s+d,v=0;v<p;v++){var _=rv([[[g,m],[g,m+h],[g+u,m+h],[g+u,m],[g,m]]],n.properties);n.mask?yC(n.mask,_)&&i.push(_):i.push(_),m+=h}g+=u}return iv(i)}(e.box,o=e.cellSide,o,s);break;case Yp.triangle:n=function(t,e,r){void 0===r&&(r={});for(var n=[],i=e/Wv([t[0],t[1]],[t[2],t[1]],r)*(t[2]-t[0]),o=e/Wv([t[0],t[1]],[t[0],t[3]],r)*(t[3]-t[1]),s=0,a=t[0];a<=t[2];){for(var l=0,u=t[1];u<=t[3];){var h=null,c=null;s%2==0&&l%2==0?(h=rv([[[a,u],[a,u+o],[a+i,u],[a,u]]],r.properties),c=rv([[[a,u+o],[a+i,u+o],[a+i,u],[a,u+o]]],r.properties)):s%2==0&&l%2==1?(h=rv([[[a,u],[a+i,u+o],[a+i,u],[a,u]]],r.properties),c=rv([[[a,u],[a,u+o],[a+i,u+o],[a,u]]],r.properties)):l%2==0&&s%2==1?(h=rv([[[a,u],[a,u+o],[a+i,u+o],[a,u]]],r.properties),c=rv([[[a,u],[a+i,u+o],[a+i,u],[a,u]]],r.properties)):l%2==1&&s%2==1&&(h=rv([[[a,u],[a,u+o],[a+i,u],[a,u]]],r.properties),c=rv([[[a,u+o],[a+i,u+o],[a+i,u],[a,u+o]]],r.properties)),r.mask?(lO(r.mask,h)&&n.push(h),lO(r.mask,c)&&n.push(c)):(n.push(h),n.push(c)),u+=o,l++}s++,a+=i}return iv(n)}(e.box,e.cellSide,i)}var o,s;return n.features.forEach(((t,e)=>{let n=cO.to3857(t);n.setProperties({uuid:qm.uuid15(),name:"第"+e+"个"}),r.push(n)})),r}static isobands(t,e,r){const n=zE(t,e,{zProperty:r});return cO.to3857_featureList(n)}static isolines(t,e,r){const n=zE(t,e,{zProperty:r});return cO.to3857_featureList(n)}static randomPolygons(t,e=.0111,r=100){let n=[],i=Math.round(10*Math.random());return i=i<3?3:i,function(t,e){void 0===e&&(e={}),null==t&&(t=1),dv(e.num_vertices)&&void 0!==e.num_vertices||(e.num_vertices=10),dv(e.max_radial_length)&&void 0!==e.max_radial_length||(e.max_radial_length=10);for(var r=[],n=function(t){var n,i=[],o=lS(Array(e.num_vertices+1)).map(Math.random);o.forEach((function(t,e,r){r[e]=e>0?t+r[e-1]:t})),o.forEach((function(t){t=2*t*Math.PI/o[o.length-1];var r=Math.random();i.push([r*(e.max_radial_length||10)*Math.sin(t),r*(e.max_radial_length||10)*Math.cos(t)])})),i[i.length-1]=i[0],i=i.map((n=uS(e.bbox),function(t){return[t[0]+n[0],t[1]+n[1]]})),r.push(rv([i]))},i=0;i<t;i++)n();return iv(r)}(r,{bbox:dr(t,"EPSG:3857","EPSG:4326"),num_vertices:i,max_radial_length:e}).features.forEach(((t,e)=>{let r=cO.to3857(t);r.setProperties({style:{fillcolor:Xm.getRandomColor(),strokecolor:Xm.getRandomColor(),strokewidth:2},uuid:qm.uuid15(),name:"第"+e+"个"}),n.push(r)})),n}static randomPolylines(t,e=.0111,r=100){let n=[],i=Math.round(10*Math.random());i=i<3?3:i;var o=function(t,e){if(void 0===e&&(e={}),!gv(e=e||{}))throw new Error("options is invalid");var r=e.bbox,n=e.num_vertices,i=e.max_length,o=e.max_rotation;null==t&&(t=1),(!dv(n)||void 0===n||n<2)&&(n=10),dv(i)&&void 0!==i||(i=1e-4),dv(o)&&void 0!==o||(o=Math.PI/8);for(var s=[],a=0;a<t;a++){for(var l=[uS(r)],u=0;u<n-1;u++){var h=(0===u?2*Math.random()*Math.PI:Math.tan((l[u][1]-l[u-1][1])/(l[u][0]-l[u-1][0])))+(Math.random()-.5)*o*2,c=Math.random()*i;l.push([l[u][0]+c*Math.cos(h),l[u][1]+c*Math.sin(h)])}s.push(nv(l))}return iv(s)}(r,{bbox:dr(t,"EPSG:3857","EPSG:4326"),num_vertices:i,max_length:e});return o.features.forEach(((t,e)=>{let r=cO.to3857(t);r.setProperties({style:{fillcolor:Xm.getRandomColor(),strokecolor:Xm.getRandomColor(),strokewidth:2},uuid:qm.uuid15(),name:"第"+e+"个"}),n.push(r)})),n}static randomPoints(t,e=100){let r=[];return function(t,e){void 0===e&&(e={}),null==t&&(t=1);for(var r=[],n=0;n<t;n++)r.push(ev(uS(e.bbox)));return iv(r)}(e,{bbox:dr(t,"EPSG:3857","EPSG:4326")}).features.forEach(((t,e)=>{let n=cO.to3857(t);n.setProperties({style:{fillcolor:Xm.getRandomColor(),strokecolor:Xm.getRandomColor(),strokewidth:2,radius:8},uuid:qm.uuid15(),name:"第"+e+"个"}),r.push(n)})),r}static formatArea(t){const e=Ze(t);let r;return r=e>1e5?Math.round(e/1e6*100)/100+" km²":Math.round(100*e)/100+" m²",r}static transTo3857(t){return dr(t,"EPSG:4326","EPSG:3857")}static randomLatLng(t){function e(t,e){return Math.floor(Math.random()*(e-t+1)+t)}let r=tv({type:"Polygon",coordinates:[[[114.02709960937501,22.59372606392931],[113.59313964843751,23.03929774776974],[113.48327636718751,22.253512814974744],[110.24230957031251,21.401933838235188],[107.88574218750001,22.522705703482472],[105.27099609375,23.664650731631625],[104.0625,22.998851594142923],[99.93164062500001,22.471954507739227],[98.85498046875001,25.025884063244828],[99.84375,29.065772888415406],[92.57080078125001,28.65203063036226],[85.53955078125001,29.219302076779456],[80.61767578125001,31.690781806136822],[79.69482421875,34.903952965590065],[75.49804687500001,37.26530995561875],[74.95971679687501,39.45316112807394],[81.82617187500001,42.74701217318067],[81.5185546875,44.25306865928177],[84.04541015625001,46.042735653846506],[87.72583007812501,48.026672195436014],[90.5712890625,45.10454630976873],[96.45996093750001,42.32606244456202],[105.71044921875001,41.19518982948959],[112.0166015625,42.84375132629023],[117.02636718750001,45.73685954736049],[120.60791015625,46.55886030311719],[117.83935546875001,48.922499263758255],[122.65136718750001,53.10721669189343],[127.13378906250001,49.53946900793534],[130.97900390625003,47.368594345213374],[134.45068359375003,48.019324184801185],[131.11083984375003,45.521743896993634],[130.51757812500003,43.197167282501276],[126.46362304687501,41.89409955811395],[121.94824218750001,39.26628442213066],[122.54150390625001,40.55554790286314],[121.70654296875001,41.19518982948959],[119.46533203125001,39.985538414809746],[118.64135742187501,39.206718844918505],[117.52075195312501,39.342794408952386],[117.43286132812501,38.41055825094609],[118.56445312500001,37.59682400108367],[119.080810546875,36.96744946416934],[120.81665039062501,37.326488613342086],[122.40966796875001,37.22158045838649],[120.05859375000001,36.35052700542766],[118.88305664062501,35.10193405724608],[120.47607421875001,33.422272258866045],[120.66284179687501,31.784216884487385],[121.81640625000001,30.996445897426373],[120.36621093750001,30.477082932837682],[121.28906250000001,29.19053283229458],[120.30029296875001,27.31321389856826],[119.102783203125,26.52956523826758],[118.45458984375001,24.9163314045991],[116.71875000000001,23.805449612314625],[115.04882812500001,22.84707068783908],[114.02709960937501,22.59372606392931]]]});t&&(r=t);let n=Fv(r),i=0,o=0,s=!0;try{do{i=e(1e6*n[0],1e6*n[2])/1e6,o=e(1e6*n[1],1e6*n[3])/1e6,s=Kv(ev([i,o]),r)}while(!s);return{lnglat:[i,o],box:this.transTo3857(n)}}catch(dX){}}static shortestPath(t,e,r){let n,i=cO.featureTo4326(t),o=cO.featureTo4326(e);r&&(n={obstacles:cO.featuresTo4326(r.obstacles)});let s=function(t,e,r){if(!gv(r=r||{}))throw new Error("options is invalid");var n=r.resolution,i=r.minDistance,o=r.obstacles||iv([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(n&&!dv(n)||n<=0)throw new Error("options.resolution must be a number, greater than 0");if(i)throw new Error("options.minDistance is not yet implemented");var s=Lv(t),a=Lv(e);switch(t=ev(s),e=ev(a),kv(o)){case"FeatureCollection":if(0===o.features.length)return nv([s,a]);break;case"Polygon":o=iv([tv(Rv(o))]);break;default:throw new Error("invalid obstacles")}var l=o;l.features.push(t),l.features.push(e);var u=Fv(function(t,e,r){if(!gv(r=r||{}))throw new Error("options is invalid");var n=r.origin,i=r.mutate;if(!t)throw new Error("geojson required");var o=Array.isArray(n)||"object"==typeof n;return!0!==i&&(t=t_(t)),"FeatureCollection"!==t.type||o?XE(t,1.15,n):(_v(t,(function(e,r){t.features[r]=XE(e,1.15,n)})),t)}(function(t,e){void 0===e&&(e={});var r=Number(t[0]),n=Number(t[1]),i=Number(t[2]),o=Number(t[3]);if(6===t.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var s=[r,n];return rv([[s,[i,n],[i,o],[r,o],s]],e.properties,{bbox:t,id:e.id})}(Fv(l))));n||(n=Wv([u[0],u[1]],[u[2],u[1]],r)/100),l.features.pop(),l.features.pop();for(var h=u[0],c=u[1],A=u[2],f=u[3],p=n/Wv([h,c],[A,c],r)*(A-h),d=n/Wv([h,c],[h,f],r)*(f-c),g=A-h,y=f-c,m=Math.floor(g/p),v=Math.floor(y/d),_=(g-m*p)/2,w=[],b=[],x=[],E=[],C=1/0,S=1/0,B=f-(y-v*d)/2,I=0;B>=c;){for(var P=[],T=[],F=h+_,M=0;F<=A;){var L=ev([F,B]),O=xC(L,o);P.push(O?0:1),T.push(F+"|"+B);var N=Wv(L,t);!O&&N<C&&(C=N,x={x:M,y:I});var R=Wv(L,e);!O&&R<S&&(S=R,E={x:M,y:I}),F+=p,M++}b.push(P),w.push(T),B-=d,I++}var k=new _C(b,{diagonal:!0}),U=k.grid[x.y][x.x],D=k.grid[E.y][E.x],G=vC.search(k,U,D),Q=[s];return G.forEach((function(t){var e=w[t.x][t.y].split("|");Q.push([+e[0],+e[1]])})),Q.push(a),function(t,e){void 0===e&&(e={});var r="object"==typeof e?e.mutate:e;if(!t)throw new Error("geojson is required");var n=kv(t),i=[];switch(n){case"LineString":i=C_(t);break;case"MultiLineString":case"Polygon":Ov(t).forEach((function(t){i.push(C_(t))}));break;case"MultiPolygon":Ov(t).forEach((function(t){var e=[];t.forEach((function(t){e.push(C_(t))})),i.push(e)}));break;case"Point":return t;case"MultiPoint":var o={};Ov(t).forEach((function(t){var e=t.join("-");Object.prototype.hasOwnProperty.call(o,e)||(i.push(t),o[e]=!0)}));break;default:throw new Error(n+" geometry not supported")}return t.coordinates?!0===r?(t.coordinates=i,t):{type:n,coordinates:i}:!0===r?(t.geometry.coordinates=i,t):tv({type:n,coordinates:i},t.properties,{bbox:t.bbox,id:t.id})}(nv(Q))}(i,o,n);return cO.to3857(s)}static lineMerger(t,e=1){let r=cO.featuresTo4326(t),n=[];r.features.forEach((t=>{let e=Ov(t);if(nv(e),n.length>0)e[e.length-1][0]===n[n.length-1][0]&&e[e.length-1][1]===n[n.length-1][1]&&(e=e.reverse()),n[n.length-1][0]===e[0][0]&&n[n.length-1][1]===e[0][1]&&e.splice(0,1);else if(r.features.length>1){let t=Ov(r.features[1]);var i=q_(nv([e[0],e[e.length-1]]),nv([t[0],t[t.length-1]]));i.features[0].geometry.coordinates[0]==e[0][0]&&i.features[0].geometry.coordinates[1]==e[0][1]&&(e=e.reverse())}e.forEach((t=>{n.push(t)}))}));let i=nv(n);return{line:cO.to3857(i),nodeData:cO.lineAttr(n),coordinates:cO.along(n,e)}}static along(t,e){let r=nv(t);e/=1e3;let n=[];n.push(r.geometry.coordinates[0]);const i=rw(r,{units:"kilometers"});for(let o=1;o<=i/e;o++){const t=ew(r,o*e,{units:"kilometers"});n.push(t.geometry.coordinates)}return n.push(r.geometry.coordinates[r.geometry.coordinates.length-1]),n}static lineAttr(t){let e=[];for(var r=0;r<t.length;r++){let n={coordIndex:0,distance:0,bearing:0,coords:[]};n.coordIndex=r,r+1<t.length?n.distance=1e3*Wv(t[r],t[r+1],{units:"kilometers"}):n.distance=0,n.coords=t[r],e.push(n)}return e}static movePointContain(t,e){let r=new kf,n=En(t.getGeometry(),128),i=r.writeGeometryObject(n,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"}),o={coordIndex:-1,distance:0,bearing:0,coords:[]};for(let s=0;s<e.length-1;s++)Kv(ev(e[s].coords),i)&&(o=e[s]);return o}static arrayDup(t){let e=new Map;return t.forEach((t=>{e.set(JSON.stringify(t),t)})),Array.from(e.values())}static decoratePath(t,e){let r=function(t,e,r){if(!gv(r=r||{}))throw new Error("options is invalid");var n=r.units,i=r.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var o=[];return Cv(t,(function(t){i&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,r,n){var i=rw(t,{units:r});if(i<=e)return n(t);var o=i/e;Number.isInteger(o)||(o=Math.floor(o)+1);for(var s=0;s<o;s++)n(nw(t,e*s,e*(s+1),{units:r}))}(t,e,n,(function(t){o.push(t)}))})),iv(o)}(nv(cO.arrayDup(t)),e,{units:"meters"});return cO.arrayDup(r.features.filter((t=>"Feature"===t.type)).map((t=>t.geometry.coordinates)).flat())}static lineSlice(t,e,r){var n=function(t,e,r){var n=Ov(r);if("LineString"!==kv(r))throw new Error("line must be a LineString");for(var i,o=X_(r,t),s=X_(r,e),a=[(i=o.properties.index<=s.properties.index?[o,s]:[s,o])[0].geometry.coordinates],l=i[0].properties.index+1;l<i[1].properties.index+1;l++)a.push(n[l]);return a.push(i[1].geometry.coordinates),nv(a,r.properties)}(cO.featureTo4326(t),cO.featureTo4326(e),cO.featureTo4326(r));return cO.to3857(n)}static booleanPointOnLine(t,e){let r=cO.featureTo4326(t),n=cO.featureTo4326(e);return iw(Lv(r),n)}static booleanCrosses(t,e){return function(t,e){var r=Rv(t),n=Rv(e),i=r.type,o=n.type;switch(i){case"MultiPoint":switch(o){case"LineString":return sC(r,n);case"Polygon":return lC(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"MultiPoint":return sC(n,r);case"LineString":return function(t,e){if(q_(t,e).features.length>0)for(var r=0;r<t.coordinates.length-1;r++)for(var n=0;n<e.coordinates.length-1;n++){var i=!0;if(0!==n&&n!==e.coordinates.length-2||(i=!1),uC(t.coordinates[r],t.coordinates[r+1],e.coordinates[n],i))return!0}return!1}(r,n);case"Polygon":return aC(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"MultiPoint":return lC(n,r);case"LineString":return aC(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}(cO.featureTo4326(t),cO.featureTo4326(e))}static lineIntersect(t,e){let r=cO.featureTo4326(t),n=cO.featureTo4326(e);return cO.to3857_featureList(q_(r,n))}static lineSplit(t,e){let r=cO.featureTo4326(t);return cO.featureTo4326(e),cO.to3857(uw(r,e))}static lineCrossesSplit(t,e,r){const n=sv([]);if(e.length>=1){const i=[];e.forEach((t=>{const e=cO.featureTo4326(t),r=Y_(e);r.features.length>0&&r.features.forEach((t=>{n.geometry.coordinates.push(t.geometry.coordinates)}));const o=bv(e);i.push(o)}));const o=Y_(ov(i));o.features.length>0&&o.features.forEach((t=>{n.geometry.coordinates.push(t.geometry.coordinates)}));for(let t=0;t<e.length;t++){const i=cO.featureTo4326(e[t]),o=uw(i,n);o.features.length>0&&(e[t].set("classname","del"),o.features.forEach((t=>{r(t,i.properties)})))}t.removeFeatures("del")}}static lineErase(t,e,r,n,i){const o=nO(ev(e),r,{units:"kilometers"});n.forEach((e=>{const r=cO.featureTo4326(e);if(nC(o,r))t.removeFeature(e);else if(!$E(o,r)){Fv(o);const n=uw(r,o);n.features.length>0&&(t.removeFeature(e),n.features.forEach((t=>{if(!nC(o,t)){let r=e.getProperties();e.getGeometry()&&delete r[e.getGeometryName()],i(t,r)}})))}}))}static featureToJson(t){return(new kf).writeFeatureObject(t)}static featureTo4326(t){return(new kf).writeFeatureObject(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}static featuresTo4326(t){return(new kf).writeFeaturesObject(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}static getCenter(t){return Vt(t instanceof X?t.getGeometry().getExtent():t.getExtent())}static to3857(t){return(new kf).readFeature(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}static to3857_featureList(t){return(new kf).readFeatures(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}}const AO=class{static isArray(t){return Array.isArray?Array.isArray(t):"[object Array]"===AO.objToString.call(t)}static isFunction(t){return"function"==typeof t}static isString(t){return"string"==typeof t}static isStringSafe(t){return"[object String]"===AO.objToString.call(t)}static isNumber(t){return"number"==typeof t}static isObject(t){var e=typeof t;return"function"===e||!!t&&"object"===e}static isBuiltInObject(t){return!!AO.BUILTIN_OBJECT[AO.objToString.call(t)]}static isTypedArray(t){return!!AO.TYPED_ARRAY[AO.objToString.call(t)]}static isDom(t){return"object"==typeof t&&"number"==typeof t.nodeType&&"object"==typeof t.ownerDocument}static isGradientObject(t){return null!=t.colorStops}static isImagePatternObject(t){return null!=t.image}static isRegExp(t){return"[object RegExp]"===AO.objToString.call(t)}static isPrimitive(t){return t[AO.primitiveKey]}};let fO=AO;e(fO,"BUILTIN_OBJECT",{"[object Function]":!0,"[object RegExp]":!0,"[object Date]":!0,"[object Error]":!0,"[object CanvasGradient]":!0,"[object CanvasPattern]":!0,"[object Image]":!0,"[object Canvas]":!0}),e(fO,"TYPED_ARRAY",{"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0}),e(fO,"primitiveKey","__ec_primitive__"),e(fO,"objToString",Object.prototype.toString);const pO=class{static merge(t,e,r){if(!fO.isObject(e)||!fO.isObject(t))return r?pO.clone(e):t;for(var n in e)if(e.hasOwnProperty(n)&&n!==pO.protoKey){var i=t[n],o=e[n];!fO.isObject(o)||!fO.isObject(i)||fO.isArray(o)||fO.isArray(i)||fO.isDom(o)||fO.isDom(i)||fO.isBuiltInObject(o)||fO.isBuiltInObject(i)||fO.isPrimitive(o)||fO.isPrimitive(i)?!r&&n in t||(t[n]=pO.clone(e[n])):pO.merge(i,o,r)}return t}static clone(t){if(null==t||"object"!=typeof t)return t;var e=t,r=fO.objToString.call(t);if("[object Array]"===r){if(!fO.isPrimitive(t)){e=[];for(var n=0,i=t.length;n<i;n++)e[n]=pO.clone(t[n])}}else if(fO.TYPED_ARRAY[r]){if(!fO.isPrimitive(t)){var o=t.constructor;if(o.from)e=o.from(t);else for(e=new o(t.length),n=0,i=t.length;n<i;n++)e[n]=pO.clone(t[n])}}else if(!fO.BUILTIN_OBJECT[r]&&!fO.isPrimitive(t)&&!fO.isDom(t))for(var s in e={},t)t.hasOwnProperty(s)&&s!==pO.protoKey&&(e[s]=pO.clone(t[s]));return e}};let dO=pO;function gO(t){let e,r="";for(e in t)t[e]&&String(t[e])&&(r+=`&${e}=${t[e]}`);return r&&(r="?"+r.slice(1)),r}e(dO,"protoKey","__proto__");const yO=Object.freeze(Object.defineProperty({__proto__:null,SecondToHHMMSS:function(t){let e=parseInt(t),r=0,n=0;e>60&&(r=Math.floor(e/60),e=Math.floor(e%60),r>60&&(n=Math.floor(r/60),r=Math.floor(r%60)));let i=Math.floor(e)+"秒";return r>0&&(i=Math.floor(r)+"分"+i),n>0&&(i=Math.floor(n)+"小时"+i),i},ToDegree:function(t=0,e=0,r=0,n=6){return(t+e/60+r/3600).toFixed(n=n>6?6:n)},ToDegreeMinuteSecond:function(t){let e;if(e="number"==typeof t?String(t):t,void 0===e||""==e)return{degree:0,minute:0,second:0};let r=e.indexOf("."),n=r<0?e:e.substring(0,r),i="0",o="0";return r>0&&(i="0"+e.substring(r),i=60*parseFloat(i)+"",r=i.indexOf("."),r>0&&(o="0"+i.substring(r),i=i.substring(0,r),o=60*parseFloat(o)+"",r=o.indexOf("."),o=o.substring(0,r+4),o=parseFloat(o).toFixed(2))),{degree:parseInt(n),minute:parseInt(i),second:parseFloat(o)}},formatDistance:function(t){return t?t>=1e3?(t/1e3).toFixed(2)+"公里":t+"米":"0米"},paramsToUrl:gO},Symbol.toStringTag,{value:"Module"}));function mO(t){return async function(t){return(await fetch(t,{method:"GET",mode:"cors",cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer"})).json()}(t)}const vO=Object.freeze(Object.defineProperty({__proto__:null,fetchJson:mO,format:yO,isutil:fO,json:dO},Symbol.toStringTag,{value:"Module"}));var _O=function(t){var e,r;t||(t={});var n=this.canvas_=document.createElement("canvas"),i=(Number(t.scale)>0?Number(t.scale):1)*lt||lt,o=n.getContext("2d");if(t.image){t.image.load();var s=t.image.getImage();if(s.width)n.width=Math.round(s.width*i),n.height=Math.round(s.height*i),o.globalAlpha="number"==typeof t.opacity?t.opacity:1,o.drawImage(s,0,0,s.width,s.height,0,0,n.width,n.height),e=o.createPattern(n,"repeat");else{var a=this;e=[0,0,0,0],s.onload=function(){n.width=Math.round(s.width*i),n.height=Math.round(s.height*i),o.globalAlpha="number"==typeof t.opacity?t.opacity:1,o.drawImage(s,0,0,s.width,s.height,0,0,n.width,n.height),e=o.createPattern(n,"repeat"),a.setColor(e)}}}else{var l=this.getPattern_(t);if(n.width=Math.round(l.width*i),n.height=Math.round(l.height*i),o.beginPath(),t.fill&&(o.fillStyle=Hn(t.fill.getColor()),o.fillRect(0,0,n.width,n.height)),o.scale(i,i),o.lineCap="round",o.lineWidth=l.stroke||1,o.fillStyle=Hn(t.color||"#000"),o.strokeStyle=Hn(t.color||"#000"),l.circles)for(r=0;r<l.circles.length;r++){var u=l.circles[r];o.beginPath(),o.arc(u[0],u[1],u[2],0,2*Math.PI),l.fill&&o.fill(),l.stroke&&o.stroke()}if(l.repeat||(l.repeat=[[0,0]]),l.char&&(o.font=l.font||l.width+"px Arial",o.textAlign="center",o.textBaseline="middle",l.angle?(o.fillText(l.char,l.width/4,l.height/4),o.fillText(l.char,5*l.width/4,5*l.height/4),o.fillText(l.char,l.width/4,5*l.height/4),o.fillText(l.char,5*l.width/4,l.height/4),o.fillText(l.char,3*l.width/4,3*l.height/4),o.fillText(l.char,-l.width/4,-l.height/4),o.fillText(l.char,3*l.width/4,-l.height/4),o.fillText(l.char,-l.width/4,3*l.height/4)):o.fillText(l.char,l.width/2,l.height/2)),l.lines)for(r=0;r<l.lines.length;r++)for(var h=0;h<l.repeat.length;h++){var c=l.lines[r];o.beginPath(),o.moveTo(c[0]+l.repeat[h][0],c[1]+l.repeat[h][1]);for(var A=2;A<c.length;A+=2)o.lineTo(c[A]+l.repeat[h][0],c[A+1]+l.repeat[h][1]);l.fill&&o.fill(),l.stroke&&o.stroke(),o.save(),o.strokeStyle="red",o.strokeWidth=.1,o.restore()}if(e=o.createPattern(n,"repeat"),t.offset){var f=t.offset;if("number"==typeof f&&(f=[f,f]),f instanceof Array){var p=Math.round(f[0]*i),d=Math.round(f[1]*i);o.scale(1/i,1/i),o.clearRect(0,0,n.width,n.height),o.translate(p,d),o.fillStyle=e,o.fillRect(-p,-d,n.width,n.height),e=o.createPattern(n,"repeat")}}}t.color=e,Rn.call(this,t)};Vm(_O,Rn),_O.prototype.clone=function(){var t=Tn.prototype.clone.call(this);return t.canvas_=this.canvas_,t},_O.prototype.getImage=function(){return this.canvas_},_O.prototype.getPattern_=function(t){var e,r=Km.prototype.patterns[t.pattern]||Km.prototype.patterns.dot,n=Math.round(t.spacing)||10;switch(t.pattern){case"dot":case"circle":e=0===t.size?0:t.size/2||2,t.angle?(n=r.width=r.height=Math.round(1.4*n),r.circles=[[n/4,n/4,e],[3*n/4,3*n/4,e]],"circle"==t.pattern&&(r.circles=r.circles.concat([[n/4+n,n/4,e],[n/4,n/4+n,e],[3*n/4-n,3*n/4,e],[3*n/4,3*n/4-n,e],[n/4+n,n/4+n,e],[3*n/4-n,3*n/4-n,e]]))):(r.width=r.height=n,r.circles=[[n/2,n/2,e]],"circle"==t.pattern&&(r.circles=r.circles.concat([[n/2+n,n/2,e],[n/2-n,n/2,e],[n/2,n/2+n,e],[n/2,n/2-n,e],[n/2+n,n/2+n,e],[n/2+n,n/2-n,e],[n/2-n,n/2+n,e],[n/2-n,n/2-n,e]])));break;case"tile":case"square":e=0===t.size?0:t.size/2||2,t.angle?(r.width=r.height=n,r.lines=[[n/2-e,n/2,n/2,n/2-e,n/2+e,n/2,n/2,n/2+e,n/2-e,n/2]]):(r.width=r.height=n,r.lines=[[n/2-e,n/2-e,n/2+e,n/2-e,n/2+e,n/2+e,n/2-e,n/2+e,n/2-e,n/2-e]]),"square"==t.pattern&&(r.repeat=[[0,0],[0,n],[n,0],[0,-n],[-n,0],[-n,-n],[n,n],[-n,n],[n,-n]]);break;case"cross":t.angle&&(t.angle=45);case"hatch":var i=Math.round(((t.angle||0)-90)%360);i>180&&(i-=360),i*=Math.PI/180;var o=Math.cos(i),s=Math.sin(i);if(Math.abs(s)<1e-4)r.width=r.height=n,r.lines=[[0,.5,n,.5]],r.repeat=[[0,0],[0,n]];else if(Math.abs(o)<1e-4)r.width=r.height=n,r.lines=[[.5,0,.5,n]],r.repeat=[[0,0],[n,0]],"cross"==t.pattern&&(r.lines.push([0,.5,n,.5]),r.repeat.push([0,n]));else{var a=r.width=Math.round(Math.abs(n/s))||1,l=r.height=Math.round(Math.abs(n/o))||1;"cross"==t.pattern?(r.lines=[[-a,-l,2*a,2*l],[2*a,-l,-a,2*l]],r.repeat=[[0,0]]):o*s>0?(r.lines=[[-a,-l,2*a,2*l]],r.repeat=[[0,0],[a,0],[0,l]]):(r.lines=[[2*a,-l,-a,2*l]],r.repeat=[[0,0],[-a,0],[0,l]])}r.stroke=0===t.size?0:t.size||4}return r};class wO{constructor(){e(this,"data"),e(this,"pi"),e(this,"x_pi"),e(this,"a"),e(this,"ee"),fm(),pm(Ig),this.data=[],this.data.push({dh:13,wkid:4502}),this.data.push({dh:14,wkid:4503}),this.data.push({dh:15,wkid:4504}),this.data.push({dh:16,wkid:4505}),this.data.push({dh:17,wkid:4506}),this.data.push({dh:18,wkid:4507}),this.data.push({dh:19,wkid:4508}),this.data.push({dh:20,wkid:4509}),this.data.push({dh:21,wkid:4510}),this.data.push({dh:22,wkid:4511}),this.data.push({dh:23,wkid:4512}),this.data.push({dh:75,wkid:4534}),this.data.push({dh:78,wkid:4535}),this.data.push({dh:81,wkid:4536}),this.data.push({dh:84,wkid:4537}),this.data.push({dh:87,wkid:4538}),this.data.push({dh:90,wkid:4539}),this.data.push({dh:93,wkid:4540}),this.data.push({dh:96,wkid:4541}),this.data.push({dh:99,wkid:4542}),this.data.push({dh:102,wkid:4543}),this.data.push({dh:105,wkid:4544}),this.data.push({dh:108,wkid:4545}),this.data.push({dh:111,wkid:4546}),this.data.push({dh:114,wkid:4547}),this.data.push({dh:117,wkid:4548}),this.data.push({dh:120,wkid:4549}),this.data.push({dh:123,wkid:4550}),this.data.push({dh:126,wkid:4551}),this.data.push({dh:129,wkid:4552}),this.data.push({dh:132,wkid:4553}),this.data.push({dh:135,wkid:4554}),this.pi=3.141592653589793,this.x_pi=52.35987755982988,this.a=6378245,this.ee=.006693421622965943}ConvertToMapCoord(t,e){return{Coord3857:this.ConvertCoordinatesTo3857(t,e),Coord4326:this.ConvertCoordinatesTo4326(t,e)}}ConvertCoordinatesTo3857(t,e){return-1==t.toUpperCase().indexOf("EPSG:")&&(t="EPSG:"+t),Ig(t,"EPSG:3857",e)}ConvertCoordinatesTo4326(t,e){return-1==t.toUpperCase().indexOf("EPSG:")&&(t="EPSG:"+t),Ig(t,"EPSG:4326",e)}formatJsonTo3857(t){let e;return e="EPSG:3857"==t.crs.properties.name?(new kf).readFeatures(t):"EPSG:4326"==t.crs.properties.name?(new kf).readFeatures(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"}):(new kf).readFeatures(t,{dataProjection:t.crs.properties.name,featureProjection:"EPSG:3857"}),e}formatJsonTo4326Json(t){let e,r=new kf;return e="EPSG:4326"==t.crs.properties.name?r.readFeatures(t):"EPSG:3857"==t.crs.properties.name?r.readFeatures(t,{dataProjection:"EPSG:3857",featureProjection:"EPSG:4326"}):r.readFeatures(t,{dataProjection:t.crs.properties.name,featureProjection:"EPSG:4326"}),r.writeFeaturesObject(e)}formatJsonToPoint(t){let e=this.formatJsonTo3857(t),r=[];return e.forEach((t=>{switch(t.getGeometry().getType()){case"Polygon":r.push(new X({geometry:t.getGeometry().getInteriorPoint(),properties:t.getProperties().properties}));break;case"Point":r.push(t)}})),r}LnglatToCGCS2000(t,e,r=3){let n,i;return n=3==r?3*parseInt(((t+1.5)/3).toString()):6*parseInt(((t+6)/6).toString())-3,this.data.forEach((t=>{t.dh!=n||(i=t.wkid)})),i?Ig("EPSG:4326","EPSG:"+i,[t,e]):[0,0]}ConvertWebMercatorToCGCS2000(t,e,r=3){let n=hr([t,e]);return this.LnglatToCGCS2000(n[0],n[1],r)}webMktToLngLat(t){return hr(t)}lngLatToWebMkt(t){return ur(t)}transformLat(t,e){let r=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.pi)+20*Math.sin(2*t*this.pi))/3,r+=2*(20*Math.sin(e*this.pi)+40*Math.sin(e/3*this.pi))/3,r+=2*(160*Math.sin(e/12*this.pi)+320*Math.sin(e*this.pi/30))/3,r}transformLon(t,e){let r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.pi)+20*Math.sin(2*t*this.pi))/3,r+=2*(20*Math.sin(t*this.pi)+40*Math.sin(t/3*this.pi))/3,r+=2*(150*Math.sin(t/12*this.pi)+300*Math.sin(t/30*this.pi))/3,r}transform(t,e){if(this.outOfChina(t,e))return[t,e];let r=this.transformLat(e-105,t-35),n=this.transformLon(e-105,t-35),i=t/180*this.pi,o=Math.sin(i);o=1-this.ee*o*o;let s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.pi),n=180*n/(this.a/s*Math.cos(i)*this.pi),[t+r,e+n]}outOfChina(t,e){return e<72.004||e>137.8347||t<.8293||t>55.8271}wgs84ToGcj02(t,e){if(this.outOfChina(t,e))return{lat:t,lon:e};let r=this.transformLat(e-105,t-35),n=this.transformLon(e-105,t-35),i=t/180*this.pi,o=Math.sin(i);o=1-this.ee*o*o;let s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.pi),n=180*n/(this.a/s*Math.cos(i)*this.pi),{mgLat:t+r,mgLon:e+n}}gcj02ToWgs84(t,e){let r=this.transform(t,e),n=2*e-r[1];return{latitude:2*t-r[0],lontitude:n}}gcj02ToBd09(t,e){let r=e,n=t,i=Math.sqrt(r*r+n*n)+2e-5*Math.sin(n*this.x_pi),o=Math.atan2(n,r)+3e-6*Math.cos(r*this.x_pi),s=i*Math.cos(o)+.0065;return{tempLat:i*Math.sin(o)+.006,tempLon:s}}bd09ToGcj02(t,e){let r=e-.0065,n=t-.006,i=Math.sqrt(r*r+n*n)-2e-5*Math.sin(n*this.x_pi),o=Math.atan2(n,r)-3e-6*Math.cos(r*this.x_pi),s=i*Math.cos(o);return{tempLat:i*Math.sin(o),tempLon:s}}wgs84ToBd09(t,e){let r=this.wgs84ToGcj02(t,e);return this.gcj02ToBd09(r[0],r[1])}bd09_To_gps84(t,e){let r=this.bd09ToGcj02(t,e),n=this.gcj02ToWgs84(r[0],r[1]);return n[0]=n[0].toFixed(6),n[1]=n[1].toFixed(6),n}}class bO extends X{constructor(t){super(),e(this,"option"),e(this,"Proj"),this.option={graphicType:"baseGraphic",lnglat:[0,0],dataWkID:Xp.EPSG3857,tooltipOption:{offset:[0,0]},popupOption:{offset:[0,0]},style:{text:{font:"14px Microsoft YaHei",text:"",fill:{color:"#8B4513"},stroke:{color:"rgba(255, 255, 255,1)",width:2},backgroundFill:{color:"rgba(255, 255, 255, 0.0)"},backgroundStroke:{color:"rgba(0, 0, 0, 0.0)",width:2},padding:[3,3,3,3],offsetX:0,offsetY:-10,textBaseline:"bottom"},image:{scale:1,radius:5,fill:{color:"rgba(255, 0, 0,1)"},stroke:{color:"rgba(255, 255, 0,1)",width:1}},stroke:{color:"rgba(255, 255, 0,1)",width:2,lineDash:null,pattern:void 0,image:void 0,ratio:1,patternColor:"rgba(0, 0, 0,1)",offset:0,scale:1,size:5,spacing:10,angle:0},fill:{patternColor:"rgba(0, 0, 0,1)",color:"rgba(255, 255, 255,0.2)",pattern:void 0,image:void 0,ratio:1,offset:0,scale:1,size:5,spacing:10,angle:0},imageOption:{},zIndex:999,radius:0,startAngle:0,stopAngle:0,rotation:0},attribute:null},this.option=dO.merge(this.option,t,!0),this.Proj=new wO,this.setStyle(new ji({zIndex:this.option.style.zIndex}))}setAttribute(t){let e=dO.merge(this.getProperties(),t,!0);this.setProperties(e)}toGeoJSON(){return(new kf).writeGeometryObject(this.getGeometry(),{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}bindPopup(t,e={offset:[0,0]}){this.option.popupInfo=t,this.option.popupOption=e}bindTooltip(t,e={offset:[0,0]}){this.option.tooltipInfo=t,this.option.tooltipOption=e}isPopupBind(){return!!this.option.popupInfo}isTooltipBind(){return!!this.option.tooltipInfo}openPopup(t,e){t&&(this.option.popupInfo=t),e&&(this.option.popupOption=e),this.dispatchEvent({type:"graphicPopopOpen",data:this.option.popupInfo,option:this.option.popupOption})}closePopup(){this.dispatchEvent({type:"graphicPopopClose",data:this.option.popupInfo})}openTooltip(t,e){t&&(this.option.tooltipInfo=t),e&&(this.option.tooltipOption=e),this.dispatchEvent({type:"graphicTooltipOpen",data:this.option.tooltipInfo,option:this.option.tooltipOption})}chaikin_copy(t,e){return t[0]=e[0],t[1]=e[1],t}chaikin_smooth_line(t,e=[]){Array.isArray(e)||(e=[]),t.length>0&&e.push(this.chaikin_copy([0,0],t[0]));for(var r=0;r<t.length-1;r++){var n=t[r],i=t[r+1],o=n[0],s=n[1],a=i[0],l=i[1],u=[.75*o+.25*a,.75*s+.25*l],h=[.25*o+.75*a,.25*s+.75*l];e.push(u),e.push(h)}return t.length>1&&e.push(this.chaikin_copy([0,0],t[t.length-1])),e}chaikin_smooth_polygon(t,e=[]){Array.isArray(e)||(e=[]);for(var r=0;r<t.length-1;r++){var n=t[r],i=t[r+1],o=n[0],s=n[1],a=i[0],l=i[1],u=[.75*o+.25*a,.75*s+.25*l],h=[.25*o+.75*a,.25*s+.75*l];e.push(u),e.push(h)}return e.push(e[0]),e}smoothFunc(t,e=5,r=!0){let n=Math.min(Math.max(e||5,1),10);for(;n>0;)t=r?this.chaikin_smooth_line(t):this.chaikin_smooth_polygon(t),n--;return t}setSmooth(t=5,e=!0){if(e){let n=this.getGeometry();var r=n.getCoordinates();n.setCoordinates(this.smoothFunc(r,t,e))}else{let n=this.getGeometry();r=n.getCoordinates()[0],n.setCoordinates([this.smoothFunc(r,t,e)])}}setTextStyle(t){var e;t=dO.merge(this.option.style.text,t,!0);let r=new Vi({text:t.text,font:t.font,fill:new Tn({color:t.fill.color}),stroke:new Rn({color:t.stroke.color,width:t.stroke.width}),backgroundFill:new Tn({color:t.backgroundFill.color}),backgroundStroke:new Rn({color:t.backgroundStroke.color,width:t.backgroundStroke.width}),padding:t.padding,textBaseline:t.textBaseline,offsetX:t.offsetX,offsetY:t.offsetY});null==(e=this.getStyle())||e.setText(r),this.option.style.text=t}setTrianglePointStyle(t){var e;t=dO.merge(this.option.style.image,t,!0);let r=new Oi({scale:t.scale,radius:t.radius,points:3,angle:Math.PI,displacement:[0,10],fill:new Tn({color:t.fill.color}),stroke:new Rn({color:t.stroke.color,width:t.stroke.width})});null==(e=this.getStyle())||e.setImage(r),this.option.style.image=t}setCirclePointStyle(t){var e;t=dO.merge(this.option.style.image,t,!0);let r=new Ri({scale:t.scale,radius:t.radius,fill:new Tn({color:t.fill.color}),stroke:new Rn({color:t.stroke.color,width:t.stroke.width})});null==(e=this.getStyle())||e.setImage(r),this.option.style.image=t}setStrokeSimpleStyle(t){t=dO.merge(this.option.style.stroke,t,!0);let e=new Rn({color:t.color,width:t.width,lineDash:t.lineDash});this.getStyle().setStroke(e),this.option.style.stroke=t}setStrokePatternStyle(t){t=dO.merge(this.option.style.stroke,t,!0);let e=new _O({pattern:t.pattern,image:t.image?new Ns({src:t.image}):void 0,ratio:t.ratio,color:t.patternColor,offset:t.offset,scale:t.scale,fill:new Tn({color:t.color}),size:t.size,spacing:t.spacing,angle:t.angle,width:t.width,lineDash:t.lineDash});this.getStyle().setStroke(e),this.option.style.stroke=t}setFillColor(t){var e;null==(e=this.getStyle())||e.setFill(new Tn({color:t})),this.option.style.fill.color=t}setFillPatternStyle(t){t=dO.merge(this.option.style.fill,t,!0);let e=new Km({pattern:t.pattern,image:void 0,ratio:t.ratio,color:t.patternColor,offset:t.offset,scale:t.scale,size:t.size,spacing:t.spacing,angle:t.angle,fill:new Tn({color:t.color})});this.getStyle().setFill(e),this.option.style.fill=t}setFillImageStyle(t){this.option.style.fill.image=t;const e=document.createElement("canvas").getContext("2d"),r=new Image;r.src=t,r.onload=()=>{this.getStyle().setFill(new Tn({color:e.createPattern(r,"repeat")}))}}setZIndex(t){this.option.style.zIndex=t,this.getStyle().setZIndex(t)}getCoordinates(t="3857"){let e=this.getGeometry().clone();return"4326"==t&&e.transform("EPSG:3857","EPSG:4326"),e.getCoordinates()}getGraphicJson(t="3857"){let e=this.getProperties();return this.getGeometry()&&delete e[this.getGeometryName()],{type:this.option.graphicType,lnglat:this.getCoordinates(t),dataWkID:t,style:this.option.style,attribute:e}}}class xO extends bO{constructor(t){let e;if(super(t),this.option.graphicType="PointGraphic",this.option=dO.merge(this.option,t,!0),0!=this.option.lnglat[0])switch(this.option.dataWkID){case Xp.EPSG4326:this.setGeometry(new nn(ur(this.option.lnglat)));break;case Xp.EPSG3857:this.setGeometry(new nn(this.option.lnglat));break;case Xp.BAIDU:e=this.Proj.bd09_To_gps84(this.option.lnglat[0],this.option.lnglat[1]),this.setGeometry(new nn([e.lontitude,e.latitude]));break;case Xp.GCJ02:e=this.Proj.gcj02ToWgs84(this.option.lnglat[0],this.option.lnglat[1]),this.setGeometry(new nn([e.lontitude,e.latitude]));break;case Xp.CGCS2000_GK_CM_6:break;default:this.setGeometry(new nn(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,this.option.lnglat)))}this.option.attribute&&this.setProperties(this.option.attribute),this.setTextStyle(this.option.style.text),this.option.style.image.scale>0&&this.setCirclePointStyle(this.option.style.image)}setCoordinates(t,e,r=Xp.EPSG4326){let n=this.getGeometry();this.option.dataWkID==Xp.EPSG4326?n.setCoordinates(ur([t,e])):this.option.dataWkID==Xp.EPSG3857?n.setCoordinates([t,e]):n.setCoordinates(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,[t,e]))}}class EO extends bO{constructor(t){let e;if(super(t),this.option.graphicType="ImagePointGraphic",0!=this.option.lnglat[0])switch(this.option.dataWkID){case Xp.EPSG4326:this.setGeometry(new nn(ur(t.lnglat)));break;case Xp.EPSG3857:this.setGeometry(new nn(t.lnglat));break;case Xp.BAIDU:e=this.Proj.bd09_To_gps84(t.lnglat[0],t.lnglat[1]),this.setGeometry(new nn([e.lontitude,e.latitude]));break;case Xp.GCJ02:e=this.Proj.gcj02ToWgs84(t.lnglat[0],t.lnglat[1]),this.setGeometry(new nn([e.lontitude,e.latitude]));break;default:this.setGeometry(new nn(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,t.lnglat)))}if(this.option.attribute&&this.setProperties(this.option.attribute),"gif"==this.option.style.imageOption.type){const t=gifler(this.option.style.imageOption.src);let e=document.createElement("canvas");t.frames(e,((t,e)=>{this.getStyle()||this.setStyle(new ji({image:new Ns({img:t.canvas,imgSize:[e.width,e.height],opacity:.8})})),t.clearRect(0,0,e.width,e.height),t.drawImage(e.buffer,e.x,e.y),this.option.style.imageOption.maprender()}),!0)}else this.setTextStyle(this.option.style.text),this.setPointIconStyle(this.option.style.imageOption)}setPointIconStyle(t){this.option.style.imageOption=t;let e=new Ns(this.option.style.imageOption);e.load(),this.getStyle().setImage(e)}setCoordinates(t,e,r=Xp.EPSG4326){let n=this.getGeometry();this.option.dataWkID==Xp.EPSG4326?n.setCoordinates(ur([t,e])):this.option.dataWkID==Xp.EPSG3857?n.setCoordinates([t,e]):n.setCoordinates(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,[t,e]))}setRotation(t){this.getStyle().getImage().setRotation(t),this.changed()}}class CO extends bO{constructor(t){super(t),this.option.graphicType="LineGraphic",0!=this.option.lnglat[0]&&this.setCoordinates(this.option.lnglat,this.option.dataWkID),this.option.attribute&&this.setProperties(this.option.attribute),this.option.style.stroke.image||this.option.style.stroke.pattern?this.setStrokePatternStyle(this.option.style.stroke):this.setStrokeSimpleStyle(this.option.style.stroke)}getGraphicJson(t="3857"){let e;e=this.option.style.stroke.image||this.option.style.stroke.pattern?{pattern:this.option.style.stroke.pattern,image:this.option.style.stroke.image,ratio:this.option.style.stroke.ratio,patternColor:this.option.style.stroke.patternColor,offset:this.option.style.stroke.offset,scale:this.option.style.stroke.scale,color:this.option.style.stroke.color,size:this.option.style.stroke.size,spacing:this.option.style.stroke.spacing,angle:this.option.style.stroke.angle,width:this.option.style.stroke.width,lineDash:this.option.style.stroke.lineDash}:{color:this.option.style.stroke.color,width:this.option.style.stroke.width,lineDash:this.option.style.stroke.lineDash};let r=this.getProperties();return this.getGeometry()&&delete r[this.getGeometryName()],{type:"LineGraphic",lnglat:this.getCoordinates(t),dataWkID:t,style:{stroke:e,text:this.option.style.text},attribute:r}}setCoordinates(t,e="4326"){switch(this.option.lnglat=t,this.option.dataWkID=e,e){case Xp.EPSG4326:this.setGeometry(new Nn(this.option.lnglat).transform("EPSG:4326","EPSG:3857"));break;case Xp.EPSG3857:this.setGeometry(new Nn(this.option.lnglat));break;case Xp.BAIDU:this.option.lnglat.forEach(((t,e)=>{let r=this.Proj.bd09_To_gps84(t[0],t[1]);this.option.lnglat[e]=[r.lontitude,r.latitude]})),this.setGeometry(new Nn(this.option.lnglat));break;case Xp.GCJ02:this.option.lnglat.forEach(((t,e)=>{let r=this.Proj.gcj02ToWgs84(t[0],t[1]);this.option.lnglat[e]=[r.lontitude,r.latitude]})),this.setGeometry(new Nn(this.option.lnglat));break;default:this.option.lnglat.forEach(((t,e)=>{this.option.lnglat[e]=this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,t)})),this.setGeometry(new Nn(this.option.lnglat))}}lineStyle(){let t=[];for(let e=0;e<10;e++)t.push(new ji({stroke:new Rn({color:[0,255,255,1/(10-e)],width:2*(10-e)-1}),fill:new Tn({color:"rgba(0, 0, 255, 0.05)"})}));return t}}class SO extends bO{constructor(t){if(super(t),this.option.graphicType="PolygonGraphic",0!=this.option.lnglat[0])switch(this.option.dataWkID){case Xp.EPSG4326:this.setGeometry(new bn(this.option.lnglat).transform("EPSG:4326","EPSG:3857"));break;case Xp.EPSG3857:this.setGeometry(new bn(this.option.lnglat));break;case Xp.BAIDU:this.option.lnglat.forEach(((t,e)=>{t.forEach(((e,r)=>{let n=this.Proj.bd09_To_gps84(e[0],e[1]);t[r]=[n.lontitude,n.latitude]}))})),this.setGeometry(new bn(this.option.lnglat));break;case Xp.GCJ02:this.option.lnglat.forEach(((t,e)=>{t.forEach(((e,r)=>{let n=this.Proj.gcj02ToWgs84(e[0],e[1]);t[r]=[n.lontitude,n.latitude]}))})),this.setGeometry(new bn(this.option.lnglat));break;default:this.option.lnglat.forEach((t=>{t.forEach(((e,r)=>{t[r]=this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,e)}))})),this.setGeometry(new bn(this.option.lnglat))}this.option.attribute&&this.setProperties(this.option.attribute),this.setPolygonStyle(this.option.style)}setPolygonStyle(t){t.stroke.pattern?this.setStrokePatternStyle(t.stroke):this.setStrokeSimpleStyle(t.stroke),t.fill.pattern?this.setFillPatternStyle(t.fill):t.fill.image?this.setFillImageStyle(t.fill.image):this.setFillColor(t.fill.color),this.setTextStyle(t.text)}setCoordinates(t,e=Xp.EPSG4326){switch(this.option.lnglat=t,this.option.dataWkID=e,this.option.dataWkID){case Xp.EPSG4326:this.setGeometry(new bn(this.option.lnglat).transform("EPSG:4326","EPSG:3857"));break;case Xp.EPSG3857:this.setGeometry(new bn(this.option.lnglat));break;case Xp.BAIDU:this.option.lnglat.forEach(((t,e)=>{t.forEach(((e,r)=>{let n=this.Proj.bd09_To_gps84(e[0],e[1]);t[r]=[n.lontitude,n.latitude]}))})),this.setGeometry(new bn(this.option.lnglat));break;case Xp.GCJ02:this.option.lnglat.forEach(((t,e)=>{t.forEach(((e,r)=>{let n=this.Proj.gcj02ToWgs84(e[0],e[1]);t[r]=[n.lontitude,n.latitude]}))})),this.setGeometry(new bn(this.option.lnglat));break;default:this.option.lnglat.forEach((t=>{t.forEach(((e,r)=>{t[r]=this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,e)}))})),this.setGeometry(new bn(this.option.lnglat))}}setGeometryFromExtent(t){this.setGeometry(xn(t))}}const BO=Object.freeze(Object.defineProperty({__proto__:null,CurveGraphic:class extends bO{constructor(t){super(t),this.option.graphicType="CurveGraphic",0!=this.option.lnglat[0]&&this.setCoordinates(this.option.lnglat,this.option.dataWkID),this.option.attribute&&this.setProperties(this.option.attribute),this.setStrokeSimpleStyle(this.option.style.stroke),this.setFillColor(this.option.style.fill.color),this.setTextStyle(this.option.style.text)}setAngle(t,e){this.option.dataWkID==Xp.EPSG4326?this.setGeometry(this.createRegularPolygonCurve(this.option.lnglat,this.option.style.radius,t,e,this.option.style.rotation)):this.option.dataWkID==Xp.EPSG3857?this.setGeometry(this.createRegularPolygonCurve(hr(this.option.lnglat),this.option.style.radius,t,e,this.option.style.rotation)):this.setGeometry(this.createRegularPolygonCurve(this.Proj.ConvertCoordinatesTo4326(this.option.dataWkID,this.option.lnglat),this.option.style.radius,t,e,this.option.style.rotation))}setCoordinates(t,e="4326"){switch(this.option.lnglat=t,this.option.dataWkID=e,this.option.dataWkID){case Xp.EPSG4326:this.setGeometry(this.createRegularPolygonCurve(this.option.lnglat,this.option.style.radius,this.option.style.startAngle,this.option.style.stopAngle,this.option.style.rotation));break;case Xp.EPSG3857:this.setGeometry(this.createRegularPolygonCurve(hr(this.option.lnglat),this.option.style.radius,this.option.style.startAngle,this.option.style.stopAngle,this.option.style.rotation));break;case Xp.BAIDU:case Xp.GCJ02:break;default:this.setGeometry(this.createRegularPolygonCurve(this.Proj.ConvertCoordinatesTo4326(this.option.dataWkID,this.option.lnglat),this.option.style.radius,this.option.style.startAngle,this.option.style.stopAngle,this.option.style.rotation))}}createRegularPolygonCurve(t,e,r,n,i){let o=cO.sector(t,e,r,n).getGeometry();return o.rotate(i,ur(t)),o}},DivGraphic:class extends kl{constructor(t){let r,n=qm.uuid15(),i=document.createElement("div");if(i.setAttribute("id",n),super({id:n,element:i}),e(this,"option"),e(this,"Proj"),e(this,"handlers"),e(this,"elementDiv"),this.handlers={},this.elementDiv=i,this.option={html:"<div></div>",positioning:id.bottomleft,hashMove:!1,enabledRightMenu:!0,contextmenu:[{text:"开始编辑对象",icon:"img/marker.png",callback:t=>{"开始编辑对象"==this.option.contextmenu[0].text?(this.option.contextmenu[0].text="停止编辑对象",this.startEdit()):(this.option.contextmenu[0].text="开始编辑对象",this.endEdit())}},{text:"删除对象",icon:"img/marker.png",callback:t=>{this.remove()}}]},this.option=dO.merge(this.option,t,!0),this.Proj=new wO,this.elementDiv.innerHTML=this.option.html,this.setPositioning(this.option.positioning),0!=this.option.coordinate[0])switch(this.option.dataWkID){case Xp.EPSG4326:this.setPosition(ur(this.option.coordinate));break;case Xp.EPSG3857:this.setPosition(this.option.coordinate);break;case Xp.BAIDU:r=this.Proj.bd09_To_gps84(this.option.coordinate[0],this.option.coordinate[1]),this.setPosition([r.lontitude,r.latitude]);break;case Xp.GCJ02:r=this.Proj.gcj02ToWgs84(this.option.coordinate[0],this.option.coordinate[1]),this.setPosition([r.lontitude,r.latitude]);break;case Xp.CGCS2000_GK_CM_6:break;default:this.setPosition(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,this.option.coordinate))}this.on(Rm.onFeatureContextmenu,(t=>{this._setFeatureContextmenu(t.data.contextmenu)})),this.element.addEventListener("mousedown",(t=>{this.option.hashMove?(this.set("isDragging",!0),this.set("dragStart",[t.x,t.y])):this.trigger(Rm.onClick,t)})),this.on("change:element",(t=>{})),this.on("change:position",(t=>{this.trigger(Rm.onChangePosition,{oldVal:t.oldValue,newVal:t.target.getPosition()})})),this.on("change:map",(t=>{null==t.oldValue&&(this.getMap().on("pointermove",(t=>{if(this.option.hashMove&&this.get("isDragging")){var e=this.get("dragStart"),r=this.getMap().getCoordinateFromPixel(e),n=t.coordinate,i=r[0]-n[0],o=r[1]-n[1],s=[this.getPosition()[0]-i,this.getPosition()[1]-o];this.setPosition(s),this.set("dragStart",t.pixel)}})),this.getMap().getViewport().addEventListener("mouseup",(t=>{this.option.hashMove&&this.set("isDragging",!1)})))}))}_setFeatureContextmenu(t){this.option.enabledRightMenu&&(t.clear(),this.option.contextmenu.length>0&&t.extend(this.option.contextmenu))}show(){this.element.classList.remove("mirage-hide")}hide(){this.element.classList.add("mirage-hide")}startEdit(){this.element.classList.add("mirage-edit-marker-selected"),this.option.hashMove=!0,this.trigger(Rm.onEditStart,{})}endEdit(){this.element.classList.remove("mirage-edit-marker-selected"),this.option.hashMove=!1,this.set("isDragging",!1),this.trigger(Rm.onEditEnd,{})}remove(){this.trigger(Rm.onFeatureDeleted,{}),this.getMap().removeOverlay(this)}setCoordinates(t,e,r=Xp.EPSG4326){this.option.coordinate=[t,e],this.option.dataWkID==Xp.EPSG4326?this.setPosition(ur([t,e])):this.option.dataWkID==Xp.EPSG3857?this.setPosition([t,e]):this.setPosition(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,[t,e]))}_on(t,e){return this.handlers[t]||(this.handlers[t]=[]),this.handlers[t].push(e),this}off(t,e){let r=this.handlers[t];for(let n=0;n<r.length;n++)if(r[n]==e){r.splice(n,1);break}return this}onec(t,e,r){var n=this;return this._on(t,(function i(){n.off(t,i),e.apply(r||n,arguments)})),this}trigger(t,e){this.handlers.hasOwnProperty(t)&&this.handlers[t].forEach((t=>{t.call(this,e)}))}},ImagePointGraphic:EO,LabelGraphic:class extends bO{constructor(t){let e;if(super(t),this.option.graphicType="LabelGraphic",0!=this.option.lnglat[0])switch(this.option.dataWkID){case Xp.EPSG4326:this.setGeometry(new nn(ur(t.lnglat)));break;case Xp.EPSG3857:this.setGeometry(new nn(t.lnglat));break;case Xp.BAIDU:e=this.Proj.bd09_To_gps84(t.lnglat[0],t.lnglat[1]),this.setGeometry(new nn([e.lontitude,e.latitude]));break;case Xp.GCJ02:e=this.Proj.gcj02ToWgs84(t.lnglat[0],t.lnglat[1]),this.setGeometry(new nn([e.lontitude,e.latitude]));break;default:this.setGeometry(new nn(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,t.lnglat)))}this.option.attribute&&this.setProperties(this.option.attribute),this.setStyle(new ji({zIndex:this.option.style.zIndex})),this.setTextStyle(this.option.style.text),this.option.style.image.scale>0&&this.setTrianglePointStyle(this.option.style.image)}setCoordinates(t,e,r=Xp.EPSG4326){let n=this.getGeometry();this.option.dataWkID==Xp.EPSG4326?n.setCoordinates(ur([t,e])):this.option.dataWkID==Xp.EPSG3857?n.setCoordinates([t,e]):n.setCoordinates(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,[t,e]))}},LineGraphic:CO,PointGraphic:xO,PolygonGraphic:SO},Symbol.toStringTag,{value:"Module"}));class IO extends Gm{constructor(t,r){super(t,r),e(this,"_graphicLayerSelect"),e(this,"selectFeature"),e(this,"_modify"),e(this,"_translate"),e(this,"_snap"),e(this,"_source"),e(this,"_draw"),e(this,"_tipPoint");let n={autoPointSize:!1,enabledRightMenu:!1,enabledPopup:!1,enabledTooltip:!1,imageRatio:5,zIndex:500,contextmenu:[{classname:"menudisabled",text:"操作",icon:"img/marker.png",items:[{text:"移动",icon:"img/marker.png",callback:t=>{this._translate.setActive(!0)}},{classname:"menudisabled",text:"编辑",icon:"img/marker.png",callback:t=>{this.startEdit()}},{text:"删除",icon:"img/marker.png",callback:t=>{this._source.removeFeature(this.selectFeature)}}]},{text:"保存为kml",icon:"img/marker.png",callback:t=>{qm.saveTokml(cO.featureTo4326(this.selectFeature),"文件.kml")}}],hashEdit:!1,hashMove:!1,hashSelect:!0};this.option=Object.assign({},n,this.option),this._source=new Aa({wrapX:!1}),this._source.on("featuresloadstart",(t=>{this.trigger(Rm.onLoadStart,t)})),this._source.on("featuresloadend",(t=>{this.trigger(Rm.onLoadEnd,t)})),this._source.on("featuresloaderror",(t=>{this.trigger(Rm.onLoadError,t)})),this._source.on("removefeature",(t=>{t.feature&&this.trigger(Rm.onFeatureDeleted,t.feature.getProperties())})),this._source.on("addfeature",(t=>{t.feature&&(t.feature.on("mousemove",(t=>{t.target.get("editstate")||("function"==typeof t.target.isTooltipBind&&t.target.isTooltipBind()?t.target.openTooltip():(this.showTooltip(t.target),this.trigger(Rm.onFeatureMousemove,{data:t.target})))})),t.feature.on("mouseout",(t=>{this.closeTooltip(),this.trigger(Rm.onFeatureMouseout,{data:t.target})})),t.feature.on("graphicPopopOpen",(t=>{this.showPopup(t.target,t.data,t.option)})),t.feature.on("graphicPopopClose",(t=>{this.closePopup(t.target)})),t.feature.on("graphicTooltipOpen",(t=>{this._showTooltip2(t.target,t.data,t.option)})))})),this._on(Rm.onFeatureSelected,(t=>{this.showTooltip(t.target),this.trigger(Rm.onFeatureMousemove,t)})),this._bindPoupEvent()}initSelect(){var t,e,r,n;this._graphicLayerSelect=new Bh({layers:[this.layer],condition:Au,style:t=>{const e=t.getGeometry().getType();return Xm.getStyle(e,{fillcolor:"rgba(0,191,255,0.1)",strokewidth:5,strokecolor:"rgba(0,191,255,1)"})},filter:function(t,e){if(e)return"ClusterImageLayer"!=e.get("layertype")&&!!t.get("editallows")}}),this._modify=new bh({features:this._graphicLayerSelect.getFeatures(),snapToPointer:!0,style:Xm.getEditPointStyle});const i=this._modify.getOverlay().getSource();this.layer instanceof ka?this._snap=new Mh({source:this.layer.getLayers[0].getSource(),pixelTolerance:10}):this._snap=new Mh({source:this.layer.getSource(),pixelTolerance:10}),this._graphicLayerSelect.on("select",(t=>{t.selected[0]?t.selected[0].set("editstate",!0):t.deselected[0].set("editstate",!1)})),i.on(["addfeature","removefeature"],(function(t){})),this._modify.on("modifystart",(t=>{let e=t.target.features_.array_[0];this.trigger(Rm.onEditModifyStart,{data:e})})),this._modify.on("modifyend",(t=>{let e=t.target.features_.array_[0];this.trigger(Rm.onEditModifyEnd,{data:e})})),this._modify.on("change:active",(t=>{let e=t.target.features_.array_[0];t.target.get("active")?(this.trigger(Rm.onEditStart,{data:e}),t.target.features_.forEach((function(t){if(t.set("editstate",!0),(t.getGeometry().getType()==qp.Polygon||t.getGeometry().getType()==qp.Line)&&t.getStyle()[0]!=Xm.getEditPolygonStyle()[0])return t.setStyle(Xm.getEditPolygonStyle()),void(t.getStyle()[0].text_.text_=t.get("name"))}))):(this.selectFeature&&this.selectFeature.set("editstate",!1),this.trigger(Rm.onEditEnd,{data:e}))})),this._translate=new Nh({layers:[this.layer]}),this._translate.on("translateend",(t=>{this.trigger(Rm.onFeatureMoved,t.features.getArray()[0].getProperties())})),this._graphicLayerSelect.setActive(!0),this._translate.setActive(!1),this._modify.setActive(!1),null==(t=this._map)||t.addInteraction(this._graphicLayerSelect),null==(e=this._map)||e.addInteraction(this._modify),null==(r=this._map)||r.addInteraction(this._snap),null==(n=this._map)||n.addInteraction(this._translate),this.option.hashMove&&this._translate.setActive(!0)}setSelectState(t=!0){this.option.hashSelect=t,this._graphicLayerSelect.setActive(t)}startMove(){this.option.hashMove=!0,this._translate.setActive(!0)}endMove(){this.option.hashMove=!1,this._translate.setActive(!1)}startEdit(){this.option.hashEdit=!0,this._graphicLayerSelect.setActive(!1),this._modify.setActive(!0)}endEdit(){this.option.hashEdit=!1,this._graphicLayerSelect.setActive(!1),this._modify.setActive(!1)}bindContextmenu(t){this.option.enabledRightMenu=!0,t&&(this.option.contextmenu=t)}unbindContextmenu(){this.option.enabledRightMenu=!1}appendContextmenu(t){t.forEach((t=>{this.option.contextmenu.push(t)}))}_setFeatureContextmenu(t,e){this.option.enabledRightMenu&&(e.clear(),this.selectFeature=t,this.option.contextmenu.forEach((e=>{e.data={SelectedFeature:t}})),this.option.contextmenu.length>0&&e.extend(this.option.contextmenu))}showTitle(t,e){new Promise(((r,n)=>{this.layer.getSource().getFeatures().forEach((r=>{let n=r.getProperties();if(t==n.dataType)try{r.getStyle().getText().setText(e?r.get("name"):"")}catch(dX){}})),this.layer.changed()}))}showTitleByClassname(t,e){this.layer.getSource().forEachFeature((r=>{let n=r.getProperties();t==n.dataType&&(r.getStyle().getText().setText(e?r.get("name"):""),r.changed())}))}_bindPoupEvent(){let t=document.getElementById("popup-closer");t&&(t.onclick=()=>{this.closePopup()})}bindPopup(t,e={offset:[0,0]}){this.option.enabledPopup=!0,t&&(this.option.popupInfo=t),this.option.popupOption=e}unbindPopup(){this.option.enabledPopup=!1,this.closePopup()}openPopup(t,e,r={offset:[0,0]}){if(e&&(this.option.popupInfo=e),this.option.enabledPopup&&this.option.popupInfo){let e="";if("string"==typeof this.option.popupInfo)e=this.option.popupInfo;else{let r=t.getProperties();this.option.popupInfo.forEach((t=>{t.dataType==r.dataType&&t.showContent.forEach((t=>{t.type?e+=t.html:e+=t.name+":"+r[t.field]+"<br>"}))}))}""!=e&&this.showPopup(t,e,r)}}showPopup(t,e,r){var n,i;let o=Vt(t.getGeometry().getExtent()),s=document.getElementById("popup-content");s&&(s.innerHTML=e),null==(n=this._map)||n.getOverlayById("popup").setPosition(o),null==(i=this._map)||i.getOverlayById("popup").setOffset(r.offset),this.trigger(Rm.onFeaturePopupOpen,{element:document.getElementById("popup-content"),data:t})}closePopup(t){var e;null==(e=this._map)||e.getOverlayById("popup").setPosition(void 0),this.trigger(Rm.onFeaturePopupClose,{element:document.getElementById("popup-content"),data:t})}bindTooltip(t,e={offset:[0,0]}){this.option.enabledTooltip=!0,t&&(this.option.tooltipInfo=t),this.option.tooltipOption=e}unbindTooltip(){this.option.enabledTooltip=!1,this.closeTooltip()}showTooltip(t){if(this.option.enabledTooltip&&this.option.tooltipInfo){let e="";if("string"==typeof this.option.tooltipInfo)e=this.option.tooltipInfo;else{let r=t.getProperties();this.option.tooltipInfo.forEach((t=>{t.dataType==r.dataType&&t.showContent.forEach((t=>{t.type?e+=t.html:e+=t.name+":"+r[t.field]+"<br>"}))}))}""!=e&&this._showTooltip2(t,e,this.option.tooltipOption)}}_showTooltip2(t,e,r){var n,i;let o=Vt(t.getGeometry().getExtent()),s=document.getElementById("tooltip-content");s&&(s.innerHTML=e),null==(n=this._map)||n.getOverlayById("tooltip").setPosition(o),null==(i=this._map)||i.getOverlayById("tooltip").setOffset(r.offset),this.trigger(Rm.onFeatureTooltipOpen,{element:document.getElementById("tooltip-content"),data:t})}closeTooltip(){var t;null==(t=this._map)||t.getOverlayById("tooltip").setPosition(void 0),this.trigger(Rm.onFeatureTooltiClose,{element:document.getElementById("tooltip-content"),data:""})}addGeoJson(t,e){this.addFeatures(t,this.formatJsonTo3857(e))}addGeoJsonPoint(t,e){this.addFeatures(t,this.formatJsonToPoint(e))}convertGeoJsontoFeatures(t){return this.formatJsonTo3857(t)}addFeatures(t,e,r,n){this.trigger(Rm.onLoadStart,t),e.forEach((e=>{let i=this._getFeatureAttribute(t),o=dO.merge(e.getProperties(),i,!1);r&&(o=dO.merge(o,r,!0)),e.setProperties(o),e.set("classname",t);let s=e.getStyle();if(s||(s=e.get("style")?Xm.getStyle(e.getGeometry().getType(),e.get("style")):Xm.getStyle(e.getGeometry().getType(),{}),e.setStyle(s)),n){let t=n(e.getProperties());s=Xm.getStyle(e.getGeometry().getType(),t)}"探方"!=e.get("dataType")&&"新增探方"!=e.get("dataType")||e.get("name")&&s.getText()&&s.getText().setText(e.get("name")+"\n"+e.get("负责人"))})),this._source.addFeatures(e),this._source.changed(),this.trigger(Rm.onLoadEnd,t)}_getFeatureAttribute(t="default"){return{classname:t,uuid:qm.uuid15(),editallows:!0,editstate:!1,movestate:!0,featuretype:Kp.vector,dataType:""}}addFeature(t,e,r,n){this.trigger(Rm.onLoadStart,t);let i=this._getFeatureAttribute(t),o=dO.merge(e.getProperties(),i,!1);r&&(o=dO.merge(o,r,!0)),e.setProperties(o),e.set("classname",t);let s=e.getStyle();if(!s){let t=e.get("style");if(t){if(s=Xm.getStyle(e.getGeometry().getType(),t),n){let t=n(e.getProperties());s=Xm.getStyle(e.getGeometry().getType(),t)}e.setStyle(s)}}this._source.addFeature(e),this.trigger(Rm.onLoadEnd,t)}setFeaturesAttribute(t){this._source.getFeatures().forEach((e=>{if(t){let r=dO.merge(e.getProperties(),t,!0);e.setProperties(r)}}))}setFeaturesAttributeByClassName(t,e){this.getFeaturesByClassName(t).forEach((t=>{if(e){let r=dO.merge(t.getProperties(),e,!0);t.setProperties(r)}}))}setFeatureAttribute(t,e){let r=this.getFeatureByUid(t);if(e){let t=dO.merge(r.getProperties(),e,!0);r.setProperties(t)}}getFeaturesAll(){return this._source.getFeatures()}getFeaturesByFieldName(t,e){let r=[];return this._source.getFeatures().forEach((n=>{n.get(t)==e&&r.push(n)})),r}getFeaturesByClassName(t){let e=[];return this._source.getFeatures().forEach((r=>{r.get("classname")==t&&e.push(r)})),e}getFeatures(t){let e=[];return this._source.getFeatures().forEach((r=>{r.get("name")==t&&e.push(r)})),e}getFeature(t){let e=null;return this._source.getFeatures().forEach((r=>{r.get("name")!=t||(e=r)})),e}getFeatureByUid(t){let e=null;return this._source.getFeatures().forEach((r=>{r.get("uuid")!=t||(e=r)})),e}removeFeature(t){"string"==typeof t?this._source.getFeatures().forEach((e=>{e.get("uuid")==t&&this._source.removeFeature(e)})):this._source.removeFeature(t)}removeFeatures(t){this._source.getFeatures().forEach((e=>{try{e.get("classname").replaceAll(" ","")===t.replaceAll(" ","")&&this._source.removeFeature(e)}catch(dX){}}))}removeFeaturesByJson(t){this._source.getFeatures().forEach((e=>{let r=0;for(let n=0;n<t.name.length;n++)try{e.get(t.name[n].replace(/\s*/g,"")).replace(/\s*/g,"")===t.value[n].replace(/\s*/g,"")&&r++}catch(dX){}r==t.name.length&&this._source.removeFeature(e)}))}setSymbol(t,e){this._source.getFeatures().forEach((r=>{let n=Xm.getStyle(r.getGeometry().getType(),t);if(e){let t=e(r.getProperties());n=Xm.getStyle(r.getGeometry().getType(),t)}r.setStyle(n)}))}setSymbolLevelColor(t){let e=[],r=0,n=0;void 0!==t.autolevel&&null!==t.autolevel||(t.autolevel=!0);let i=[{maxnum:0,fillcolor:"rgba(255,255,255,0.1)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,0.2)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,0.4)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,0.6)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,0.8)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,1)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1}];if(t.levelColor&&(i=t.levelColor),t.autolevel){let o=i.length;this._source.getFeatures().forEach((r=>{let n=r.get(t.attributeName);n&&e.push(parseInt(n))})),r=Math.max(...e),n=r/o,i.forEach(((t,e)=>{t.maxnum=n*e}))}return i.sort((function(t,e){return e.maxnum-t.maxnum})),this._source.getFeatures().forEach((e=>{if(e.get("classname")==t.classname){let r=e.get(t.attributeName);if(r)if(0==parseInt(r)){let t=Xm.getStyle(e.getGeometry().getType(),{fillcolor:"rgba(255,255,255,0)",strokecolor:"rgba(255,255,255,0.1)",strokewidth:.1});e.setStyle(t)}else for(let t=0;t<i.length;t++)if(parseFloat(r)>i[t].maxnum){let r=Xm.getStyle(e.getGeometry().getType(),{fillcolor:i[t].fillcolor,strokecolor:i[t].strokecolor,strokewidth:i[t].strokewidth});e.setStyle(r);break}}})),i}setSymbolByClassname(t,e,r){this._source.getFeatures().forEach((n=>{if(n.get("classname")==t){let t=Xm.getStyle(n.getGeometry().getType(),e);if(r){let e=r(n.getProperties());t=Xm.getStyle(n.getGeometry().getType(),e)}n.setStyle(t)}}))}setSymbolByFeatures(t,e,r){t.forEach((t=>{let n=Xm.getStyle(t.getGeometry().getType(),e);if(r){let e=r(t.getProperties());n=Xm.getStyle(t.getGeometry().getType(),e)}t.setStyle(n),t.changed()}))}setSymbolByStyleClass(t){this._source.getFeatures().forEach((e=>{t.forEach((t=>{if(e.get(t.className)==t.classValue){let r=Xm.getStyle(e.getGeometry().getType(),t.style);e.setStyle(r)}}))}))}setClassSymbol(t,e){this._source.getFeatures().forEach((r=>{r.get("classname")==t&&e.forEach((t=>{if(r.get(t.className)==t.classValue){let e=Xm.getStyle(r.getGeometry().getType(),t.style);r.setStyle(e)}}))}))}setFeaturesTileByJson(t,e){this._source.getFeatures().forEach((r=>{let n=r.get("featureStyle");r.get("dataType")==t&&(e&&r.get("name")?"探方"==r.get("dataType")?n.getText()&&n.getText().setText(r.get("name")+"\n"+r.get("负责人")):n.getText()&&n.getText().setText(r.get("name")):n.getText()&&n.getText().setText(""))}))}clear(){this._source.clear()}startDraw(t){var e;let r=t.type;t.attribute=Object.assign(this._getFeatureAttribute(),t.attribute),t.geometryFunction=null,t.type==qp.Rectangle&&(r=qp.Circle,t.geometryFunction=function(t,e,r){var n=Et([t[0],t[t.length-1]].map((function(t){return br(t)}))),i=[[Ht(n),zt(n),Jt(n),Zt(n),Ht(n)]],o=e;return o?o.setCoordinates(i):o=new bn(i),o}),t.style=t.style?t.style:{};const n=t.type==qp.Circle||t.type==qp.Rectangle?"移动到所需位置,单击结束绘制":"单击继续绘制,双击结束绘制"+(t.type===qp.Polygon?"多边形":"线"),i="点击任意位置开始绘制";let o=i;this._draw=new ch({type:r,geometryFunction:t.geometryFunction,freehand:t.freehand||!1,style:e=>{const r=e.getGeometry(),n=null==r?void 0:r.getType();let i=null;if(i=[Xm.getStyle(t.type,t.style)],o&&"Point"===n&&!this._modify.getOverlay().getSource().getFeatures().length){this._tipPoint=r;let t=Xm.getTipStyle();t.getText().setText(o),i.push(t)}return i}}),null==(e=this._map)||e.addInteraction(this._draw),this._draw.on("drawstart",(t=>{o=n,this.trigger(Rm.onDrawStart,t)})),this._draw.on("drawend",(e=>{var r,n;o=i,null==(r=this._draw)||r.setActive(!1),null==(n=this._map)||n.removeInteraction(this._draw),setTimeout((()=>{this.changeGraphicData(t,e.feature)}),100)}))}changeGraphicData(t,e){for(var r in t.style)""==t.style[r].toString()&&delete t.style[r];let n,i;switch(t.type){case qp.Circle:i=Object.assign({},Xm.getDefaultPolygonStyle(),t.style),n=new SO({lnglat:En(e.getGeometry(),128).getCoordinates(),dataWkID:Xp.EPSG3857,style:{stroke:{color:i.strokecolor,width:i.strokewidth,lineDash:i.strokelineDash},fill:{color:i.fillcolor}},attribute:t.attribute});break;case qp.Polygon:case qp.Rectangle:i=Object.assign({},Xm.getDefaultPolygonStyle(),t.style),n=new SO({lnglat:e.getGeometry().getCoordinates(),dataWkID:Xp.EPSG3857,style:{stroke:{color:i.strokecolor,width:i.strokewidth,lineDash:i.strokelineDash},fill:{color:i.fillcolor}},attribute:t.attribute});break;case qp.Line:i=Object.assign({},Xm.getDefaulLineStyle(),t.style),n=new CO({lnglat:e.getGeometry().getCoordinates(),dataWkID:Xp.EPSG3857,style:{stroke:{color:i.strokecolor,width:i.strokewidth,lineDash:i.strokelineDash}},attribute:t.attribute});break;case qp.Point:i=Object.assign({},Xm.getDefaultPointStyle(),t.style),n=i.imageOption?new EO({lnglat:e.getGeometry().getCoordinates(),dataWkID:Xp.EPSG3857,style:{text:{font:i.Font,text:i.text,fill:{color:i.FontColor},stroke:{color:i.FontStrokeColor,width:i.FontStrokeWidth}},imageOption:i.imageOption,zIndex:999},attribute:Object.assign({},t.attribute,{movestate:!1,editallows:!1})}):new xO({lnglat:e.getGeometry().getCoordinates(),dataWkID:Xp.EPSG3857,style:{text:{font:i.Font,text:i.text,fill:{color:i.FontColor},stroke:{color:i.FontStrokeColor,width:i.FontStrokeWidth}},image:{scale:i.scale,radius:i.radius,fill:{color:i.fillcolor},stroke:{color:i.strokecolor,width:i.strokewidth}},zIndex:999},attribute:Object.assign({},t.attribute,{movestate:!1,editallows:!1})})}t.attribute.classname?this.addFeature(t.attribute.classname,n):this.addFeature("temp",n),t.success&&t.success(n),this.trigger(Rm.onDrawEnd,n)}appendTo(t){var e;this._map=t,this.layer&&(null==(e=this._map)||e.addLayer(this.layer),this.isAdded=!0),this.initSelect(),this._map.on("singleclick",(t=>{var e;if(this.option.hashSelect){this._modify.setActive(!1),this._graphicLayerSelect.setActive(!0);const r=null==(e=this._map)?void 0:e.forEachFeatureAtPixel(t.pixel,(function(t,e){return{feature:t,layer:e}}));r&&r.feature}}))}toGeoJSON(){return(new kf).writeFeaturesObject(this.layer.getSource().getFeatures(),{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}}class PO extends IO{constructor(t,e){super(t,e),new ji({fill:new Tn({color:"#eeeeee"})}),this.layertype="GraphicImageLayer",this.layer=new Xf({imageRatio:this.option.imageRatio,source:this._source,zIndex:this.option.zIndex}),this.layer.set("layerid",t),this.layer.on(this.EventType.featureType.onFeatureContextmenu,(t=>{this._setFeatureContextmenu(t.data.feature,t.data.contextmenu)})),this._on("onClickTolayer",(t=>{"function"==typeof t.isPopupBind&&t.isPopupBind()?t.openPopup():this.option.enabledPopup&&this.openPopup(t)}))}}var TO=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const FO=function(t){function e(e){var r=this,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;void 0!==n.interpolate&&(i=n.interpolate);var o=void 0!==n.projection?n.projection:"EPSG:3857",s=void 0!==n.tileGrid?n.tileGrid:ff({extent:df(o),maxResolution:n.maxResolution,maxZoom:n.maxZoom,minZoom:n.minZoom,tileSize:n.tileSize});return(r=t.call(this,{attributions:n.attributions,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,interpolate:i,opaque:n.opaque,projection:o,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileGrid:s,tileLoadFunction:n.tileLoadFunction,tilePixelRatio:n.tilePixelRatio,tileUrlFunction:n.tileUrlFunction,url:n.url,urls:n.urls,wrapX:void 0===n.wrapX||n.wrapX,transition:n.transition,attributionsCollapsible:n.attributionsCollapsible,zDirection:n.zDirection})||this).gutter_=void 0!==n.gutter?n.gutter:0,r}return TO(e,t),e.prototype.getGutter=function(){return this.gutter_},e}(Qf);var MO=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const LO=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,wrapX:e.wrapX})||this;return r.resolution=void 0,r.distance=void 0!==e.distance?e.distance:20,r.minDistance=e.minDistance||0,r.interpolationRatio=0,r.features=[],r.geometryFunction=e.geometryFunction||function(t){var e=t.getGeometry();return K("Point"==e.getType(),10),e},r.createCustomCluster_=e.createCluster,r.source=null,r.boundRefresh_=r.refresh.bind(r),r.updateDistance(r.distance,r.minDistance),r.setSource(e.source||null),r}return MO(e,t),e.prototype.clear=function(e){this.features.length=0,t.prototype.clear.call(this,e)},e.prototype.getDistance=function(){return this.distance},e.prototype.getSource=function(){return this.source},e.prototype.loadFeatures=function(t,e,r){this.source.loadFeatures(t,e,r),e!==this.resolution&&(this.resolution=e,this.refresh())},e.prototype.setDistance=function(t){this.updateDistance(t,this.minDistance)},e.prototype.setMinDistance=function(t){this.updateDistance(this.distance,t)},e.prototype.getMinDistance=function(){return this.minDistance},e.prototype.setSource=function(t){this.source&&this.source.removeEventListener(P.CHANGE,this.boundRefresh_),this.source=t,t&&t.addEventListener(P.CHANGE,this.boundRefresh_),this.refresh()},e.prototype.refresh=function(){this.clear(),this.cluster(),this.addFeatures(this.features)},e.prototype.updateDistance=function(t,e){var r=0===t?0:Math.min(e,t)/t,n=t!==this.distance||this.interpolationRatio!==r;this.distance=t,this.minDistance=e,this.interpolationRatio=r,n&&this.refresh()},e.prototype.cluster=function(){if(void 0!==this.resolution&&this.source)for(var t=[1/0,1/0,-1/0,-1/0],e=this.distance*this.resolution,r=this.source.getFeatures(),n={},i=0,s=r.length;i<s;i++){var a=r[i];if(!(o(a)in n)){var l=this.geometryFunction(a);if(l){Ot(l.getCoordinates(),t),Ct(t,e,t);var u=this.source.getFeaturesInExtent(t).filter((function(t){var e=o(t);return!(e in n)&&(n[e]=!0,!0)}));this.features.push(this.createCluster(u,t))}}}},e.prototype.createCluster=function(t,e){for(var r=[0,0],n=t.length-1;n>=0;--n){var i=this.geometryFunction(t[n]);i?Re(r,i.getCoordinates()):t.splice(n,1)}Qe(r,1/t.length);var o=Vt(e),s=this.interpolationRatio,a=new nn([r[0]*(1-s)+o[0]*s,r[1]*(1-s)+o[1]*s]);return this.createCustomCluster_?this.createCustomCluster_(a,t):new X({geometry:a,features:t})},e}(Aa);var OO=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const NO=function(t){function e(e){var r=this,n=void 0===e.projection?"EPSG:3857":e.projection,i=e.tileGrid;if(void 0===i&&n&&(i=ff({extent:df(n),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize})),(r=t.call(this,{cacheSize:.1,attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:n,tileGrid:i,opaque:e.opaque,state:e.state,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate})||this).gutter_=void 0!==e.gutter?e.gutter:0,r.tileSize_=e.tileSize?Dn(e.tileSize):null,!r.tileSize_&&e.tilePixelRatio&&i){var o=Dn(i.getTileSize(0));r.tileSize_=[o[0]*e.tilePixelRatio,o[1]*e.tilePixelRatio]}return r.tileSizes_=null,r.tileLoadingKeys_={},r.loader_=e.loader,r.handleTileChange_=r.handleTileChange_.bind(r),r.bandCount=void 0===e.bandCount?4:e.bandCount,r}return OO(e,t),e.prototype.setTileSizes=function(t){this.tileSizes_=t},e.prototype.getTileSize=function(t){if(this.tileSizes_)return this.tileSizes_[t];if(this.tileSize_)return this.tileSize_;var e=this.getTileGrid();return e?Dn(e.getTileSize(t)):[256,256]},e.prototype.getGutterForProjection=function(t){return this.gutter_},e.prototype.setLoader=function(t){this.loader_=t},e.prototype.getTile=function(t,e,r,n,i){var o=this.getTileSize(t),s=jh(t,e,r);if(this.tileCache.containsKey(s))return this.tileCache.get(s);var a=this.loader_,l=b({tileCoord:[t,e,r],loader:function(){return n=function(){return a(t,e,r)},function(){var t;try{t=n()}catch(e){return Promise.reject(e)}return t instanceof Promise?t:Promise.resolve(t)}();var n},size:o},this.tileOptions),u=new tp(l);return u.key=this.getKey(),u.addEventListener(P.CHANGE,this.handleTileChange_),this.tileCache.set(s,u),u},e.prototype.handleTileChange_=function(t){var e,r=t.target,n=o(r),i=r.getState();i==da.LOADING?(this.tileLoadingKeys_[n]=!0,e=uf):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],e=i==da.ERROR?cf:i==da.LOADED?hf:void 0),e&&this.dispatchEvent(new mf(e,r))},e}(vf);function RO(t){return(e,...r)=>UO(t,e,r)}function kO(t,e){return RO(jO(t,e).get)}const{apply:UO,construct:DO,defineProperty:GO,get:QO,getOwnPropertyDescriptor:jO,getPrototypeOf:HO,has:zO,ownKeys:VO,set:KO,setPrototypeOf:qO}=Reflect,{iterator:WO,species:XO,toStringTag:YO,for:ZO}=Symbol,JO=Object,{create:$O,defineProperty:tN,freeze:eN,is:rN}=JO,nN=Array.prototype[WO],iN=RO(nN),oN=ArrayBuffer;kO(oN.prototype,"byteLength");const sN="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:null;sN&&kO(sN.prototype,"byteLength");const aN=HO(Uint8Array);aN.from;const lN=aN.prototype;lN[WO],RO(lN.keys),RO(lN.values),RO(lN.entries),RO(lN.set),RO(lN.reverse),RO(lN.fill),RO(lN.copyWithin),RO(lN.sort),RO(lN.slice),RO(lN.subarray),kO(lN,"buffer"),kO(lN,"byteOffset"),kO(lN,"length"),kO(lN,YO);const uN=Uint32Array,hN=Float32Array,cN=HO([][WO]()),AN=RO(cN.next),fN=RO(function*(){}().next),pN=HO(cN),dN=RO(DataView.prototype.getUint16),gN=WeakMap,yN=gN.prototype,mN=RO(yN.get),vN=RO(yN.set),_N=new gN,wN=$O(null,{next:{value:function(){const t=mN(_N,this);return AN(t)}},[WO]:{value:function(){return this}}}),bN=new gN,xN=$O(pN,{next:{value:function(){const t=mN(bN,this);return fN(t)},writable:!0,configurable:!0}});for(const ol of VO(cN))"next"!==ol&&tN(xN,ol,jO(cN,ol));const EN=new oN(4),CN=new hN(EN),SN=new uN(EN),BN=new uN(512),IN=new uN(512);for(let ol=0;ol<256;++ol){const t=ol-127;t<-27?(BN[ol]=0,BN[256|ol]=32768,IN[ol]=24,IN[256|ol]=24):t<-14?(BN[ol]=1024>>-t-14,BN[256|ol]=1024>>-t-14|32768,IN[ol]=-t-1,IN[256|ol]=-t-1):t<=15?(BN[ol]=t+15<<10,BN[256|ol]=t+15<<10|32768,IN[ol]=13,IN[256|ol]=13):t<128?(BN[ol]=31744,BN[256|ol]=64512,IN[ol]=24,IN[256|ol]=24):(BN[ol]=31744,BN[256|ol]=64512,IN[ol]=13,IN[256|ol]=13)}const PN=new uN(2048),TN=new uN(64),FN=new uN(64);for(let ol=1;ol<1024;++ol){let t=ol<<13,e=0;for(;0==(8388608&t);)t<<=1,e-=8388608;t&=-8388609,e+=947912704,PN[ol]=t|e}for(let ol=1024;ol<2048;++ol)PN[ol]=939524096+(ol-1024<<13);for(let ol=1;ol<31;++ol)TN[ol]=ol<<23;TN[31]=1199570944,TN[32]=2147483648;for(let ol=33;ol<63;++ol)TN[ol]=2147483648+(ol-32<<23);TN[63]=3347054592;for(let ol=1;ol<64;++ol)32!==ol&&(FN[ol]=1024);function MN(t,e,...r){return function(t){const e=t>>10;return SN[0]=PN[FN[e]+(1023&t)]+TN[e],CN[0]}(dN(t,e,...function(t){if(t[WO]===nN&&cN.next===AN)return t;const e=$O(wN);return vN(_N,e,iN(t)),e}(r)))}var LN={};function ON(t,e,r){r&&r.debug;const n="object"==typeof t?t.outer:t,i=new RegExp(`${e}\\="([^"]*)"`).exec(n);if(i)return i[1]}({get exports(){return LN},set exports(t){LN=t}}).exports=ON,LN.default=ON;var NN={},RN={get exports(){return NN},set exports(t){NN=t}},kN={},UN={get exports(){return kN},set exports(t){kN=t}},DN={};function GN(t,e,r){const n=new RegExp(e).exec(t.slice(r));return n?r+n.index:-1}({get exports(){return DN},set exports(t){DN=t}}).exports=GN,DN.default=GN;var QN={};function jN(t,e,r){const n=new RegExp(e).exec(t.slice(r));return n?r+n.index+n[0].length-1:-1}({get exports(){return QN},set exports(t){QN=t}}).exports=jN,QN.default=jN;var HN={};function zN(t,e){const r=new RegExp(e,"g"),n=t.match(r);return n?n.length:0}({get exports(){return HN},set exports(t){HN=t}}).exports=zN,HN.default=zN;const VN=DN,KN=QN,qN=HN;function WN(t,e,r){r&&r.debug;const n=!(r&&!1===typeof r.nested),i=r&&r.startIndex||0,o=VN(t,`<${e}[ >/]`,i);if(-1===o)return;const s=t.slice(o+e.length);let a=KN(s,"^[^<]*[ /]>",0);const l=-1!==a&&"/"===s[a-1];if(!1===l)if(n){let t=0,r=1,n=0;for(;-1!==(a=KN(s,"[ /]"+e+">",t));){const i=s.substring(t,a+1);if(r+=qN(i,"<"+e),n+=qN(i,"/"+e+">"),n>=r)break;t=a}}else a=KN(s,"[ /]"+e+">",0);const u=o+e.length+a+1;if(-1===u)return;const h=t.slice(o,u);let c;return c=l?null:h.slice(h.indexOf(">")+1,h.lastIndexOf("<")),{inner:c,outer:h,start:o,end:u}}UN.exports=WN,kN.default=WN;const XN=kN;function YN(t,e,r){const n=[],i=r&&r.debug||!1,o=!r||"boolean"!=typeof r.nested||r.nested;let s,a=r&&r.startIndex||0;for(;s=XN(t,e,{debug:i,startIndex:a});)a=o?s.start+1+e.length:s.end,n.push(s);return n}RN.exports=YN,NN.default=YN;const ZN={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},JN={};for(const ol in ZN)ZN.hasOwnProperty(ol)&&(JN[ZN[ol]]=parseInt(ol,10));const $N=[JN.BitsPerSample,JN.ExtraSamples,JN.SampleFormat,JN.StripByteCounts,JN.StripOffsets,JN.StripRowCounts,JN.TileByteCounts,JN.TileOffsets,JN.SubIFDs],tR={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},eR={};for(const ol in tR)tR.hasOwnProperty(ol)&&(eR[tR[ol]]=parseInt(ol,10));const rR={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"},nR=new Map;function iR(t,e){Array.isArray(t)||(t=[t]),t.forEach((t=>nR.set(t,e)))}async function oR(t){const e=nR.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);return new(await e())(t)}function sR(t,e,r,n=1){return new(Object.getPrototypeOf(t).constructor)(e*r*n)}function aR(t,e,r){return(1-r)*t+r*e}function lR(t,e,r){let n=0;for(let i=e;i<r;++i)n+=t[i];return n}function uR(t,e,r){switch(t){case 1:if(e<=8)return new Uint8Array(r);if(e<=16)return new Uint16Array(r);if(e<=32)return new Uint32Array(r);break;case 2:if(8===e)return new Int8Array(r);if(16===e)return new Int16Array(r);if(32===e)return new Int32Array(r);break;case 3:switch(e){case 16:case 32:return new Float32Array(r);case 64:return new Float64Array(r)}}throw Error("Unsupported data format/bitsPerSample")}iR([void 0,1],(()=>Promise.resolve().then((()=>Jft)).then((t=>t.default)))),iR(5,(()=>Promise.resolve().then((()=>rpt)).then((t=>t.default)))),iR(6,(()=>{throw new Error("old style JPEG compression is not supported.")})),iR(7,(()=>Promise.resolve().then((()=>gpt)).then((t=>t.default)))),iR([8,32946],(()=>Promise.resolve().then((()=>Eyt)).then((t=>t.default)))),iR(32773,(()=>Promise.resolve().then((()=>Cyt)).then((t=>t.default)))),iR(34887,(()=>Promise.resolve().then((()=>Byt)).then((t=>t.default)))),iR(50001,(()=>Promise.resolve().then((()=>Iyt)).then((t=>t.default))));const hR=class{constructor(t,e,r,n,i,o){this.fileDirectory=t,this.geoKeys=e,this.dataView=r,this.littleEndian=n,this.tiles=i?{}:null,this.isTiled=!t.StripOffsets;const s=t.PlanarConfiguration;if(this.planarConfiguration=void 0===s?1:s,1!==this.planarConfiguration&&2!==this.planarConfiguration)throw new Error("Invalid planar configuration.");this.source=o}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return void 0!==this.fileDirectory.SamplesPerPixel?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:void 0!==this.fileDirectory.RowsPerStrip?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(t){return this.isTiled||(t+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-t*this.getTileHeight()}getBytesPerPixel(){let t=0;for(let e=0;e<this.fileDirectory.BitsPerSample.length;++e)t+=this.getSampleByteSize(e);return t}getSampleByteSize(t){if(t>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${t} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[t]/8)}getReaderForSample(t){const e=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[t]:1,r=this.fileDirectory.BitsPerSample[t];switch(e){case 1:if(r<=8)return DataView.prototype.getUint8;if(r<=16)return DataView.prototype.getUint16;if(r<=32)return DataView.prototype.getUint32;break;case 2:if(r<=8)return DataView.prototype.getInt8;if(r<=16)return DataView.prototype.getInt16;if(r<=32)return DataView.prototype.getInt32;break;case 3:switch(r){case 16:return function(t,e){return MN(this,t,e)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(t=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[t]:1}getBitsPerSample(t=0){return this.fileDirectory.BitsPerSample[t]}getArrayForSample(t,e){return uR(this.getSampleFormat(t),this.getBitsPerSample(t),e)}async getTileOrStrip(t,e,r,n,i){const o=Math.ceil(this.getWidth()/this.getTileWidth()),s=Math.ceil(this.getHeight()/this.getTileHeight());let a;const{tiles:l}=this;let u,h;1===this.planarConfiguration?a=e*o+t:2===this.planarConfiguration&&(a=r*o*s+e*o+t),this.isTiled?(u=this.fileDirectory.TileOffsets[a],h=this.fileDirectory.TileByteCounts[a]):(u=this.fileDirectory.StripOffsets[a],h=this.fileDirectory.StripByteCounts[a]);const c=(await this.source.fetch([{offset:u,length:h}],i))[0];let A;return null!==l&&l[a]?A=l[a]:(A=(async()=>{let t=await n.decode(this.fileDirectory,c);const r=this.getSampleFormat(),i=this.getBitsPerSample();return function(t,e){return(1!==t&&2!==t||!(e<=32)||e%8!=0)&&(3!==t||16!==e&&32!==e&&64!==e)}(r,i)&&(t=function(t,e,r,n,i,o,s){const a=new DataView(t),l=2===r?1:n,u=uR(e,i,2===r?s*o:s*o*n),h=parseInt("1".repeat(i),2);if(1===e){let t;t=1===r?n*i:i;let e=o*t;0!=(7&e)&&(e=e+7&-8);for(let r=0;r<s;++r){const t=r*e;for(let e=0;e<o;++e){const n=t+e*l*i;for(let t=0;t<l;++t){const s=n+t*i,c=(r*o+e)*l+t,A=Math.floor(s/8),f=s%8;if(f+i<=8)u[c]=a.getUint8(A)>>8-i-f&h;else if(f+i<=16)u[c]=a.getUint16(A)>>16-i-f&h;else if(f+i<=24){const t=a.getUint16(A)<<8|a.getUint8(A+2);u[c]=t>>24-i-f&h}else u[c]=a.getUint32(A)>>32-i-f&h}}}}return u.buffer}(t,r,this.planarConfiguration,this.getSamplesPerPixel(),i,this.getTileWidth(),this.getBlockHeight(e))),t})(),null!==l&&(l[a]=A)),{x:t,y:e,sample:r,data:await A}}async _readRaster(t,e,r,n,i,o,s,a,l){const u=this.getTileWidth(),h=this.getTileHeight(),c=this.getWidth(),A=this.getHeight(),f=Math.max(Math.floor(t[0]/u),0),p=Math.min(Math.ceil(t[2]/u),Math.ceil(c/u)),d=Math.max(Math.floor(t[1]/h),0),g=Math.min(Math.ceil(t[3]/h),Math.ceil(A/h)),y=t[2]-t[0];let m=this.getBytesPerPixel();const v=[],_=[];for(let x=0;x<e.length;++x)1===this.planarConfiguration?v.push(lR(this.fileDirectory.BitsPerSample,0,e[x])/8):v.push(0),_.push(this.getReaderForSample(e[x]));const w=[],{littleEndian:b}=this;for(let x=d;x<g;++x)for(let o=f;o<p;++o)for(let s=0;s<e.length;++s){const a=s,f=e[s];2===this.planarConfiguration&&(m=this.getSampleByteSize(s));const p=this.getTileOrStrip(o,x,f,i,l);w.push(p),p.then((i=>{const o=i.data,s=new DataView(o),l=this.getBlockHeight(i.y),f=i.y*h,p=i.x*u,d=f+l,g=(i.x+1)*u,w=_[a],x=Math.min(l,l-(d-t[3]),A-f),E=Math.min(u,u-(g-t[2]),c-p);for(let h=Math.max(0,t[1]-f);h<x;++h)for(let i=Math.max(0,t[0]-p);i<E;++i){const o=(h*u+i)*m,l=w.call(s,o+v[a],b);let c;n?(c=(h+f-t[1])*y*e.length+(i+p-t[0])*e.length+a,r[c]=l):(c=(h+f-t[1])*y+i+p-t[0],r[a][c]=l)}}))}if(await Promise.all(w),o&&t[2]-t[0]!==o||s&&t[3]-t[1]!==s){let i;return i=n?function(t,e,r,n,i,o,s="nearest"){switch(s.toLowerCase()){case"nearest":return function(t,e,r,n,i,o){const s=e/n,a=r/i,l=sR(t,n,i,o);for(let u=0;u<i;++u){const i=Math.min(Math.round(a*u),r-1);for(let r=0;r<n;++r){const a=Math.min(Math.round(s*r),e-1);for(let s=0;s<o;++s){const h=t[i*e*o+a*o+s];l[u*n*o+r*o+s]=h}}}return l}(t,e,r,n,i,o);case"bilinear":case"linear":return function(t,e,r,n,i,o){const s=e/n,a=r/i,l=sR(t,n,i,o);for(let u=0;u<i;++u){const i=a*u,h=Math.floor(i),c=Math.min(Math.ceil(i),r-1);for(let r=0;r<n;++r){const a=s*r,A=a%1,f=Math.floor(a),p=Math.min(Math.ceil(a),e-1);for(let s=0;s<o;++s){const a=t[h*e*o+f*o+s],d=t[h*e*o+p*o+s],g=t[c*e*o+f*o+s],y=t[c*e*o+p*o+s],m=aR(aR(a,d,A),aR(g,y,A),i%1);l[u*n*o+r*o+s]=m}}}return l}(t,e,r,n,i,o);default:throw new Error(`Unsupported resampling method: '${s}'`)}}(r,t[2]-t[0],t[3]-t[1],o,s,e.length,a):function(t,e,r,n,i,o="nearest"){switch(o.toLowerCase()){case"nearest":return function(t,e,r,n,i){const o=e/n,s=r/i;return t.map((t=>{const a=sR(t,n,i);for(let l=0;l<i;++l){const i=Math.min(Math.round(s*l),r-1);for(let r=0;r<n;++r){const s=Math.min(Math.round(o*r),e-1),u=t[i*e+s];a[l*n+r]=u}}return a}))}(t,e,r,n,i);case"bilinear":case"linear":return function(t,e,r,n,i){const o=e/n,s=r/i;return t.map((t=>{const a=sR(t,n,i);for(let l=0;l<i;++l){const i=s*l,u=Math.floor(i),h=Math.min(Math.ceil(i),r-1);for(let r=0;r<n;++r){const s=o*r,c=s%1,A=Math.floor(s),f=Math.min(Math.ceil(s),e-1),p=t[u*e+A],d=t[u*e+f],g=t[h*e+A],y=t[h*e+f],m=aR(aR(p,d,c),aR(g,y,c),i%1);a[l*n+r]=m}}return a}))}(t,e,r,n,i);default:throw new Error(`Unsupported resampling method: '${o}'`)}}(r,t[2]-t[0],t[3]-t[1],o,s,a),i.width=o,i.height=s,i}return r.width=o||t[2]-t[0],r.height=s||t[3]-t[1],r}async readRasters({window:t,samples:e=[],interleave:r,pool:n=null,width:i,height:o,resampleMethod:s,fillValue:a,signal:l}={}){const u=t||[0,0,this.getWidth(),this.getHeight()];if(u[0]>u[2]||u[1]>u[3])throw new Error("Invalid subsets");const h=(u[2]-u[0])*(u[3]-u[1]),c=this.getSamplesPerPixel();if(e&&e.length){for(let p=0;p<e.length;++p)if(e[p]>=c)return Promise.reject(new RangeError(`Invalid sample index '${e[p]}'.`))}else for(let p=0;p<c;++p)e.push(p);let A;if(r)A=uR(this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,Math.max.apply(null,this.fileDirectory.BitsPerSample),h*e.length),a&&A.fill(a);else{A=[];for(let t=0;t<e.length;++t){const r=this.getArrayForSample(e[t],h);Array.isArray(a)&&t<a.length?r.fill(a[t]):a&&!Array.isArray(a)&&r.fill(a),A.push(r)}}const f=n||await oR(this.fileDirectory);return await this._readRaster(u,e,A,r,f,i,o,s,l)}async readRGB({window:t,interleave:e=!0,pool:r=null,width:n,height:i,resampleMethod:o,enableAlpha:s=!1,signal:a}={}){const l=t||[0,0,this.getWidth(),this.getHeight()];if(l[0]>l[2]||l[1]>l[3])throw new Error("Invalid subsets");const u=this.fileDirectory.PhotometricInterpretation;if(2===u){let l=[0,1,2];if(0!==this.fileDirectory.ExtraSamples&&s){l=[];for(let t=0;t<this.fileDirectory.BitsPerSample.length;t+=1)l.push(t)}return this.readRasters({window:t,interleave:e,samples:l,pool:r,width:n,height:i,resampleMethod:o,signal:a})}let h;switch(u){case 0:case 1:case 3:h=[0];break;case 5:h=[0,1,2,3];break;case 6:case 8:h=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const c={window:l,interleave:!0,samples:h,pool:r,width:n,height:i,resampleMethod:o,signal:a},{fileDirectory:A}=this,f=await this.readRasters(c),p=2**this.fileDirectory.BitsPerSample[0];let d;switch(u){case 0:d=function(t,e){const{width:r,height:n}=t,i=new Uint8Array(r*n*3);let o;for(let s=0,a=0;s<t.length;++s,a+=3)o=256-t[s]/e*256,i[a]=o,i[a+1]=o,i[a+2]=o;return i}(f,p);break;case 1:d=function(t,e){const{width:r,height:n}=t,i=new Uint8Array(r*n*3);let o;for(let s=0,a=0;s<t.length;++s,a+=3)o=t[s]/e*256,i[a]=o,i[a+1]=o,i[a+2]=o;return i}(f,p);break;case 3:d=function(t,e){const{width:r,height:n}=t,i=new Uint8Array(r*n*3),o=e.length/3,s=e.length/3*2;for(let a=0,l=0;a<t.length;++a,l+=3){const r=t[a];i[l]=e[r]/65536*256,i[l+1]=e[r+o]/65536*256,i[l+2]=e[r+s]/65536*256}return i}(f,A.ColorMap);break;case 5:d=function(t){const{width:e,height:r}=t,n=new Uint8Array(e*r*3);for(let i=0,o=0;i<t.length;i+=4,o+=3){const e=t[i],r=t[i+1],s=t[i+2],a=t[i+3];n[o]=(255-e)/256*255*((255-a)/256),n[o+1]=(255-r)/256*255*((255-a)/256),n[o+2]=(255-s)/256*255*((255-a)/256)}return n}(f);break;case 6:d=function(t){const{width:e,height:r}=t,n=new Uint8ClampedArray(e*r*3);for(let i=0,o=0;i<t.length;i+=3,o+=3){const e=t[i],r=t[i+1],s=t[i+2];n[o]=e+1.402*(s-128),n[o+1]=e-.34414*(r-128)-.71414*(s-128),n[o+2]=e+1.772*(r-128)}return n}(f);break;case 8:d=function(t){const{width:e,height:r}=t,n=new Uint8Array(e*r*3);for(let i=0,o=0;i<t.length;i+=3,o+=3){let e,r,s,a=(t[i+0]+16)/116,l=(t[i+1]<<24>>24)/500+a,u=a-(t[i+2]<<24>>24)/200;l=.95047*(l*l*l>.008856?l*l*l:(l-16/116)/7.787),a=1*(a*a*a>.008856?a*a*a:(a-16/116)/7.787),u=1.08883*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),e=3.2406*l+-1.5372*a+-.4986*u,r=-.9689*l+1.8758*a+.0415*u,s=.0557*l+-.204*a+1.057*u,e=e>.0031308?1.055*e**(1/2.4)-.055:12.92*e,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,n[o]=255*Math.max(0,Math.min(1,e)),n[o+1]=255*Math.max(0,Math.min(1,r)),n[o+2]=255*Math.max(0,Math.min(1,s))}return n}(f);break;default:throw new Error("Unsupported photometric interpretation.")}if(!e){const t=new Uint8Array(d.length/3),e=new Uint8Array(d.length/3),r=new Uint8Array(d.length/3);for(let n=0,i=0;n<d.length;n+=3,++i)t[i]=d[n],e[i]=d[n+1],r[i]=d[n+2];d=[t,e,r]}return d.width=f.width,d.height=f.height,d}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const t=[];for(let e=0;e<this.fileDirectory.ModelTiepoint.length;e+=6)t.push({i:this.fileDirectory.ModelTiepoint[e],j:this.fileDirectory.ModelTiepoint[e+1],k:this.fileDirectory.ModelTiepoint[e+2],x:this.fileDirectory.ModelTiepoint[e+3],y:this.fileDirectory.ModelTiepoint[e+4],z:this.fileDirectory.ModelTiepoint[e+5]});return t}getGDALMetadata(t=null){const e={};if(!this.fileDirectory.GDAL_METADATA)return null;const r=this.fileDirectory.GDAL_METADATA;let n=NN(r,"Item");n=null===t?n.filter((t=>void 0===LN(t,"sample"))):n.filter((e=>Number(LN(e,"sample"))===t));for(let i=0;i<n.length;++i){const t=n[i];e[LN(t,"name")]=t.inner}return e}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const t=this.fileDirectory.GDAL_NODATA;return Number(t.substring(0,t.length-1))}getOrigin(){const t=this.fileDirectory.ModelTiepoint,e=this.fileDirectory.ModelTransformation;if(t&&6===t.length)return[t[3],t[4],t[5]];if(e)return[e[3],e[7],e[11]];throw new Error("The image does not have an affine transformation.")}getResolution(t=null){const e=this.fileDirectory.ModelPixelScale,r=this.fileDirectory.ModelTransformation;if(e)return[e[0],-e[1],e[2]];if(r)return[r[0],r[5],r[10]];if(t){const[e,r,n]=t.getResolution();return[e*t.getWidth()/this.getWidth(),r*t.getHeight()/this.getHeight(),n*t.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return 1===this.geoKeys.GTRasterTypeGeoKey}getBoundingBox(){const t=this.getOrigin(),e=this.getResolution(),r=t[0],n=t[1],i=r+e[0]*this.getWidth(),o=n+e[1]*this.getHeight();return[Math.min(r,i),Math.min(n,o),Math.max(r,i),Math.max(n,o)]}};class cR{constructor(t){this._dataView=new DataView(t)}get buffer(){return this._dataView.buffer}getUint64(t,e){const r=this.getUint32(t,e),n=this.getUint32(t+4,e);let i;if(e){if(i=r+2**32*n,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}if(i=2**32*r+n,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}getInt64(t,e){let r=0;const n=(128&this._dataView.getUint8(t+(e?7:0)))>0;let i=!0;for(let o=0;o<8;o++){let s=this._dataView.getUint8(t+(e?o:7-o));n&&(i?0!==s&&(s=255&~(s-1),i=!1):s=255&~s),r+=s*256**o}return n&&(r=-r),r}getUint8(t,e){return this._dataView.getUint8(t,e)}getInt8(t,e){return this._dataView.getInt8(t,e)}getUint16(t,e){return this._dataView.getUint16(t,e)}getInt16(t,e){return this._dataView.getInt16(t,e)}getUint32(t,e){return this._dataView.getUint32(t,e)}getInt32(t,e){return this._dataView.getInt32(t,e)}getFloat16(t,e){return MN(this._dataView,t,e)}getFloat32(t,e){return this._dataView.getFloat32(t,e)}getFloat64(t,e){return this._dataView.getFloat64(t,e)}}class AR{constructor(t,e,r,n){this._dataView=new DataView(t),this._sliceOffset=e,this._littleEndian=r,this._bigTiff=n}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(t,e){return this.sliceOffset<=t&&this.sliceTop>=t+e}readUint8(t){return this._dataView.getUint8(t-this._sliceOffset,this._littleEndian)}readInt8(t){return this._dataView.getInt8(t-this._sliceOffset,this._littleEndian)}readUint16(t){return this._dataView.getUint16(t-this._sliceOffset,this._littleEndian)}readInt16(t){return this._dataView.getInt16(t-this._sliceOffset,this._littleEndian)}readUint32(t){return this._dataView.getUint32(t-this._sliceOffset,this._littleEndian)}readInt32(t){return this._dataView.getInt32(t-this._sliceOffset,this._littleEndian)}readFloat32(t){return this._dataView.getFloat32(t-this._sliceOffset,this._littleEndian)}readFloat64(t){return this._dataView.getFloat64(t-this._sliceOffset,this._littleEndian)}readUint64(t){const e=this.readUint32(t),r=this.readUint32(t+4);let n;if(this._littleEndian){if(n=e+2**32*r,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}if(n=2**32*e+r,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}readInt64(t){let e=0;const r=(128&this._dataView.getUint8(t+(this._littleEndian?7:0)))>0;let n=!0;for(let i=0;i<8;i++){let o=this._dataView.getUint8(t+(this._littleEndian?i:7-i));r&&(n?0!==o&&(o=255&~(o-1),n=!1):o=255&~o),e+=o*256**i}return r&&(e=-e),e}readOffset(t){return this._bigTiff?this.readUint64(t):this.readUint32(t)}}const fR="undefined"!=typeof navigator&&navigator.hardwareConcurrency||2,pR=class{constructor(t=fR,e){this.workers=null,this._awaitingDecoder=null,this.size=t,this.messageId=0,t&&(this._awaitingDecoder=e?Promise.resolve(e):new Promise((t=>{Promise.resolve().then((()=>Tyt)).then((e=>{t(e.create)}))})),this._awaitingDecoder.then((e=>{this._awaitingDecoder=null,this.workers=[];for(let r=0;r<t;r++)this.workers.push({worker:e(),idle:!0})})))}async decode(t,e){return this._awaitingDecoder&&await this._awaitingDecoder,0===this.size?oR(t).then((r=>r.decode(t,e))):new Promise((r=>{const n=this.workers.find((t=>t.idle))||this.workers[Math.floor(Math.random()*this.size)];n.idle=!1;const i=this.messageId++,o=t=>{t.data.id===i&&(n.idle=!0,r(t.data.decoded),n.worker.removeEventListener("message",o))};n.worker.addEventListener("message",o),n.worker.postMessage({fileDirectory:t,buffer:e,id:i},[e])}))}destroy(){this.workers&&(this.workers.forEach((t=>{t.worker.terminate()})),this.workers=null)}},dR="\r\n\r\n";function gR(t){if(void 0!==Object.fromEntries)return Object.fromEntries(t);const e={};for(const[r,n]of t)e[r.toLowerCase()]=n;return e}function yR(t){return gR(t.split("\r\n").map((t=>{const e=t.split(":").map((t=>t.trim()));return e[0]=e[0].toLowerCase(),e})))}function mR(t){let e,r,n;return t&&([,e,r,n]=t.match(/bytes (\d+)-(\d+)\/(\d+)/),e=parseInt(e,10),r=parseInt(r,10),n=parseInt(n,10)),{start:e,end:r,total:n}}class vR{async fetch(t,e=undefined){return Promise.all(t.map((t=>this.fetchSlice(t,e))))}async fetchSlice(t){throw new Error(`fetching of slice ${t} not possible, not implemented`)}get fileSize(){return null}async close(){}}var _R,wR,bR=xR;function xR(t){var e=this;if(e instanceof xR||(e=new xR),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var r=0,n=arguments.length;r<n;r++)e.push(arguments[r]);return e}function ER(t,e,r,n){if(!(this instanceof ER))return new ER(t,e,r,n);this.list=n,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}xR.Node=ER,xR.create=xR,xR.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,r=t.prev;return e&&(e.prev=r),r&&(r.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=r),t.list.length--,t.next=null,t.prev=null,t.list=null,e},xR.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}},xR.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}},xR.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)n=arguments[t],(r=this).tail=new ER(n,r.tail,null,r),r.head||(r.head=r.tail),r.length++;var r,n;return this.length},xR.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)n=arguments[t],(r=this).head=new ER(n,null,r.head,r),r.tail||(r.tail=r.head),r.length++;var r,n;return this.length},xR.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}},xR.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}},xR.prototype.forEach=function(t,e){e=e||this;for(var r=this.head,n=0;null!==r;n++)t.call(e,r.value,n,this),r=r.next},xR.prototype.forEachReverse=function(t,e){e=e||this;for(var r=this.tail,n=this.length-1;null!==r;n--)t.call(e,r.value,n,this),r=r.prev},xR.prototype.get=function(t){for(var e=0,r=this.head;null!==r&&e<t;e++)r=r.next;if(e===t&&null!==r)return r.value},xR.prototype.getReverse=function(t){for(var e=0,r=this.tail;null!==r&&e<t;e++)r=r.prev;if(e===t&&null!==r)return r.value},xR.prototype.map=function(t,e){e=e||this;for(var r=new xR,n=this.head;null!==n;)r.push(t.call(e,n.value,this)),n=n.next;return r},xR.prototype.mapReverse=function(t,e){e=e||this;for(var r=new xR,n=this.tail;null!==n;)r.push(t.call(e,n.value,this)),n=n.prev;return r},xR.prototype.reduce=function(t,e){var r,n=this.head;if(arguments.length>1)r=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,r=this.head.value}for(var i=0;null!==n;i++)r=t(r,n.value,i),n=n.next;return r},xR.prototype.reduceReverse=function(t,e){var r,n=this.tail;if(arguments.length>1)r=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,r=this.tail.value}for(var i=this.length-1;null!==n;i--)r=t(r,n.value,i),n=n.prev;return r},xR.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;null!==r;e++)t[e]=r.value,r=r.next;return t},xR.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;null!==r;e++)t[e]=r.value,r=r.prev;return t},xR.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new xR;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var n=0,i=this.head;null!==i&&n<t;n++)i=i.next;for(;null!==i&&n<e;n++,i=i.next)r.push(i.value);return r},xR.prototype.sliceReverse=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new xR;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var n=this.length,i=this.tail;null!==i&&n>e;n--)i=i.prev;for(;null!==i&&n>t;n--,i=i.prev)r.push(i.value);return r},xR.prototype.splice=function(t,e,...r){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,i=this.head;null!==i&&n<t;n++)i=i.next;var o,s,a,l,u=[];for(n=0;i&&n<e;n++)u.push(i.value),i=this.removeNode(i);for(null===i&&(i=this.tail),i!==this.head&&i!==this.tail&&(i=i.prev),n=0;n<r.length;n++)o=this,s=i,a=r[n],void 0,null===(l=s===o.head?new ER(a,null,s,o):new ER(a,s,s.next,o)).next&&(o.tail=l),null===l.prev&&(o.head=l),o.length++,i=l;return u},xR.prototype.reverse=function(){for(var t=this.head,e=this.tail,r=t;null!==r;r=r.prev){var n=r.prev;r.prev=r.next,r.next=n}return this.head=e,this.tail=t,this};try{(wR?_R:(wR=1,_R=function(t){t.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}))(xR)}catch(fCt){}const CR=bR,SR=Symbol("max"),BR=Symbol("length"),IR=Symbol("lengthCalculator"),PR=Symbol("allowStale"),TR=Symbol("maxAge"),FR=Symbol("dispose"),MR=Symbol("noDisposeOnSet"),LR=Symbol("lruList"),OR=Symbol("cache"),NR=Symbol("updateAgeOnGet"),RR=()=>1,kR=(t,e,r)=>{const n=t[OR].get(e);if(n){const e=n.value;if(UR(t,e)){if(GR(t,n),!t[PR])return}else r&&(t[NR]&&(n.value.now=Date.now()),t[LR].unshiftNode(n));return e.value}},UR=(t,e)=>{if(!e||!e.maxAge&&!t[TR])return!1;const r=Date.now()-e.now;return e.maxAge?r>e.maxAge:t[TR]&&r>t[TR]},DR=t=>{if(t[BR]>t[SR])for(let e=t[LR].tail;t[BR]>t[SR]&&null!==e;){const r=e.prev;GR(t,e),e=r}},GR=(t,e)=>{if(e){const r=e.value;t[FR]&&t[FR](r.key,r.value),t[BR]-=r.length,t[OR].delete(r.key),t[LR].removeNode(e)}};class QR{constructor(t,e,r,n,i){this.key=t,this.value=e,this.length=r,this.now=n,this.maxAge=i||0}}const jR=(t,e,r,n)=>{let i=r.value;UR(t,i)&&(GR(t,r),t[PR]||(i=void 0)),i&&e.call(n,i.value,i.key,t)};function HR(t,e){const r=Array.isArray(t)?t:Array.from(t),n=Array.isArray(e)?e:Array.from(e);return r.map(((t,e)=>[t,n[e]]))}class zR extends Error{constructor(t){super(t),Error.captureStackTrace&&Error.captureStackTrace(this,zR),this.name="AbortError"}}class VR extends Error{constructor(t,e){super(e),this.errors=t,this.message=e,this.name="AggregateError"}}const KR=VR;class qR{constructor(t,e,r=null){this.offset=t,this.length=e,this.data=r}get top(){return this.offset+this.length}}class WR{constructor(t,e,r){this.offset=t,this.length=e,this.blockIds=r}}class XR extends vR{constructor(t,{blockSize:e=65536,cacheSize:r=100}={}){super(),this.source=t,this.blockSize=e,this.blockCache=new class{constructor(t){if("number"==typeof t&&(t={max:t}),t||(t={}),t.max&&("number"!=typeof t.max||t.max<0))throw new TypeError("max must be a non-negative number");this[SR]=t.max||1/0;const e=t.length||RR;if(this[IR]="function"!=typeof e?RR:e,this[PR]=t.stale||!1,t.maxAge&&"number"!=typeof t.maxAge)throw new TypeError("maxAge must be a number");this[TR]=t.maxAge||0,this[FR]=t.dispose,this[MR]=t.noDisposeOnSet||!1,this[NR]=t.updateAgeOnGet||!1,this.reset()}set max(t){if("number"!=typeof t||t<0)throw new TypeError("max must be a non-negative number");this[SR]=t||1/0,DR(this)}get max(){return this[SR]}set allowStale(t){this[PR]=!!t}get allowStale(){return this[PR]}set maxAge(t){if("number"!=typeof t)throw new TypeError("maxAge must be a non-negative number");this[TR]=t,DR(this)}get maxAge(){return this[TR]}set lengthCalculator(t){"function"!=typeof t&&(t=RR),t!==this[IR]&&(this[IR]=t,this[BR]=0,this[LR].forEach((t=>{t.length=this[IR](t.value,t.key),this[BR]+=t.length}))),DR(this)}get lengthCalculator(){return this[IR]}get length(){return this[BR]}get itemCount(){return this[LR].length}rforEach(t,e){e=e||this;for(let r=this[LR].tail;null!==r;){const n=r.prev;jR(this,t,r,e),r=n}}forEach(t,e){e=e||this;for(let r=this[LR].head;null!==r;){const n=r.next;jR(this,t,r,e),r=n}}keys(){return this[LR].toArray().map((t=>t.key))}values(){return this[LR].toArray().map((t=>t.value))}reset(){this[FR]&&this[LR]&&this[LR].length&&this[LR].forEach((t=>this[FR](t.key,t.value))),this[OR]=new Map,this[LR]=new CR,this[BR]=0}dump(){return this[LR].map((t=>!UR(this,t)&&{k:t.key,v:t.value,e:t.now+(t.maxAge||0)})).toArray().filter((t=>t))}dumpLru(){return this[LR]}set(t,e,r){if((r=r||this[TR])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,i=this[IR](e,t);if(this[OR].has(t)){if(i>this[SR])return GR(this,this[OR].get(t)),!1;const o=this[OR].get(t).value;return this[FR]&&(this[MR]||this[FR](t,o.value)),o.now=n,o.maxAge=r,o.value=e,this[BR]+=i-o.length,o.length=i,this.get(t),DR(this),!0}const o=new QR(t,e,i,n,r);return o.length>this[SR]?(this[FR]&&this[FR](t,e),!1):(this[BR]+=o.length,this[LR].unshift(o),this[OR].set(t,this[LR].head),DR(this),!0)}has(t){if(!this[OR].has(t))return!1;const e=this[OR].get(t).value;return!UR(this,e)}get(t){return kR(this,t,!0)}peek(t){return kR(this,t,!1)}pop(){const t=this[LR].tail;return t?(GR(this,t),t.value):null}del(t){GR(this,this[OR].get(t))}load(t){this.reset();const e=Date.now();for(let r=t.length-1;r>=0;r--){const n=t[r],i=n.e||0;if(0===i)this.set(n.k,n.v);else{const t=i-e;t>0&&this.set(n.k,n.v,t)}}}prune(){this[OR].forEach(((t,e)=>kR(this,e,!1)))}}({max:r}),this.blockRequests=new Map,this.blockIdsToFetch=new Set}get fileSize(){return this.source.fileSize}async fetch(t,e){const r=new Map,n=new Map,i=new Set;for(const{offset:l,length:u}of t){let t=l+u;const{fileSize:e}=this;null!==e&&(t=Math.min(t,e));for(let o=Math.floor(l/this.blockSize)*this.blockSize;o<t;o+=this.blockSize){const t=Math.floor(o/this.blockSize);this.blockCache.has(t)?r.set(t,this.blockCache.get(t)):this.blockRequests.has(t)?n.set(t,this.blockRequests.get(t)):(this.blockIdsToFetch.has(t)||this.blockIdsToFetch.add(t),i.add(t))}}await async function(t){return new Promise((t=>setTimeout(t,void 0)))}(),this.fetchBlocks(e);for(const l of i){const t=this.blockRequests.get(l),e=this.blockCache.get(l);if(t)n.set(l,t);else{if(!e)throw new Error(`Block ${l} is not in the block requests`);r.set(l,e)}}let o=await Promise.allSettled(Array.from(n.values()));if(o.some((t=>"rejected"===t.status))){const t=new Set;for(const[r,i]of HR(n.keys(),o)){const{rejected:n,reason:o}=i;n&&"AbortError"===o.name&&o.signal!==e&&(this.blockIdsToFetch.add(r),t.add(r))}if(this.blockIdsToFetch.length>0){this.fetchBlocks(e);for(const e of t){const t=this.blockRequests.get(e);if(!t)throw new Error(`Block ${e} is not in the block requests`);n.set(e,t)}o=await Promise.allSettled(Array.from(n.values()))}}if(o.some((t=>"rejected"===t.status))){if(e&&e.aborted)throw new zR("Request was aborted");throw new KR(o.filter((t=>"rejected"===t.status)).map((t=>t.reason)),"Request failed")}const s=o.map((t=>t.value)),a=new Map(HR(Array.from(n.keys()),s));for(const[l,u]of r)a.set(l,u);return this.readSliceData(t,a)}fetchBlocks(t){if(this.blockIdsToFetch.size>0){const e=this.groupBlocks(this.blockIdsToFetch),r=this.source.fetch(e,t);for(let n=0;n<e.length;++n){const i=e[n];for(const e of i.blockIds){const i=(async()=>{try{const t=(await r)[n],i=e*this.blockSize,o=i-t.offset,s=Math.min(o+this.blockSize,t.data.byteLength),a=t.data.slice(o,s),l=new qR(i,a.byteLength,a);return this.blockCache.set(e,l),l}catch(i){throw"AbortError"===i.name&&(i.signal=t),i}finally{this.blockRequests.delete(e)}})();this.blockRequests.set(e,i)}}this.blockIdsToFetch.clear()}}groupBlocks(t){const e=Array.from(t).sort(((t,e)=>t-e));if(0===e.length)return[];let r=[],n=null;const i=[];for(const o of e)null===n||n+1===o?(r.push(o),n=o):(i.push(new WR(r[0]*this.blockSize,r.length*this.blockSize,r)),r=[o],n=o);return i.push(new WR(r[0]*this.blockSize,r.length*this.blockSize,r)),i}readSliceData(t,e){return t.map((t=>{const r=t.offset+t.length,n=Math.floor(t.offset/this.blockSize),i=Math.floor((t.offset+t.length)/this.blockSize),o=new ArrayBuffer(t.length),s=new Uint8Array(o);for(let a=n;a<=i;++a){const n=e.get(a),i=n.offset-t.offset;let o,l=0,u=0;i<0?l=-i:i>0&&(u=i),o=n.top-r<0?n.length-l:r-n.offset-l;const h=new Uint8Array(n.data,l,o);s.set(h,u)}return o}))}}class YR{get ok(){return this.status>=200&&this.status<=299}get status(){throw new Error("not implemented")}getHeader(t){throw new Error("not implemented")}async getData(){throw new Error("not implemented")}}class ZR{constructor(t){this.url=t}async request({headers:t,credentials:e,signal:r}={}){throw new Error("request is not implemented")}}class JR extends YR{constructor(t){super(),this.response=t}get status(){return this.response.status}getHeader(t){return this.response.headers.get(t)}async getData(){return this.response.arrayBuffer?await this.response.arrayBuffer():(await this.response.buffer()).buffer}}class $R extends ZR{constructor(t,e){super(t),this.credentials=e}async request({headers:t,credentials:e,signal:r}={}){const n=await fetch(this.url,{headers:t,credentials:e,signal:r});return new JR(n)}}class tk extends YR{constructor(t,e){super(),this.xhr=t,this.data=e}get status(){return this.xhr.status}getHeader(t){return this.xhr.getResponseHeader(t)}async getData(){return this.data}}class ek extends ZR{constructRequest(t,e){return new Promise(((r,n)=>{const i=new XMLHttpRequest;i.open("GET",this.url),i.responseType="arraybuffer";for(const[e,o]of Object.entries(t))i.setRequestHeader(e,o);i.onload=()=>{const t=i.response;r(new tk(i,t))},i.onerror=n,i.onabort=()=>n(new zR("Request aborted")),i.send(),e&&(e.aborted&&i.abort(),e.addEventListener("abort",(()=>i.abort())))}))}async request({headers:t,signal:e}={}){return await this.constructRequest(t,e)}}const rk={},nk=Object.freeze(Object.defineProperty({__proto__:null,default:rk},Symbol.toStringTag,{value:"Module"}));class ik extends YR{constructor(t,e){super(),this.response=t,this.dataPromise=e}get status(){return this.response.statusCode}getHeader(t){return this.response.headers[t]}async getData(){return await this.dataPromise}}class ok extends ZR{constructor(t){super(t),this.parsedUrl=rk.parse(this.url),this.httpApi=(this.parsedUrl.protocol,rk)}constructRequest(t,e){return new Promise(((r,n)=>{const i=this.httpApi.get({...this.parsedUrl,headers:t},(t=>{const e=new Promise((e=>{const r=[];t.on("data",(t=>{r.push(t)})),t.on("end",(()=>{const t=Buffer.concat(r).buffer;e(t)})),t.on("error",n)}));r(new ik(t,e))}));i.on("error",n),e&&(e.aborted&&i.destroy(new zR("Request aborted")),e.addEventListener("abort",(()=>i.destroy(new zR("Request aborted")))))}))}async request({headers:t,signal:e}={}){return await this.constructRequest(t,e)}}class sk extends vR{constructor(t,e,r,n){super(),this.client=t,this.headers=e,this.maxRanges=r,this.allowFullFile=n,this._fileSize=null}async fetch(t,e){return this.maxRanges>=t.length?this.fetchSlices(t,e):(this.maxRanges>0&&t.length,Promise.all(t.map((t=>this.fetchSlice(t,e)))))}async fetchSlices(t,e){const r=await this.client.request({headers:{...this.headers,Range:`bytes=${t.map((({offset:t,length:e})=>`${t}-${t+e}`)).join(",")}`},signal:e});if(r.ok){if(206===r.status){const{type:n,params:i}=function(t){const[e,...r]=t.split(";").map((t=>t.trim()));return{type:e,params:gR(r.map((t=>t.split("="))))}}(r.getHeader("content-type"));if("multipart/byteranges"===n){const t=function(t,e){let r=null;const n=new TextDecoder("ascii"),i=[],o=`--${e}`,s=`${o}--`;for(let a=0;a<10;++a)n.decode(new Uint8Array(t,a,o.length))===o&&(r=a);if(null===r)throw new Error("Could not find initial boundary");for(;r<t.byteLength;){const e=n.decode(new Uint8Array(t,r,Math.min(o.length+1024,t.byteLength-r)));if(0===e.length||e.startsWith(s))break;if(!e.startsWith(o))throw new Error("Part does not start with boundary");const a=e.substr(o.length+2);if(0===a.length)break;const l=a.indexOf(dR),u=yR(a.substr(0,l)),{start:h,end:c,total:A}=mR(u["content-range"]),f=r+o.length+l+dR.length,p=parseInt(c,10)+1-parseInt(h,10);i.push({headers:u,data:t.slice(f,f+p),offset:h,length:p,fileSize:A}),r=f+p+4}return i}(await r.getData(),i.boundary);return this._fileSize=t[0].fileSize||null,t}const o=await r.getData(),{start:s,end:a,total:l}=mR(r.getHeader("content-range"));this._fileSize=l||null;const u=[{data:o,offset:s,length:a-s}];if(t.length>1){const r=await Promise.all(t.slice(1).map((t=>this.fetchSlice(t,e))));return u.concat(r)}return u}{if(!this.allowFullFile)throw new Error("Server responded with full file");const t=await r.getData();return this._fileSize=t.byteLength,[{data:t,offset:0,length:t.byteLength}]}}throw new Error("Error fetching data.")}async fetchSlice(t,e){const{offset:r,length:n}=t,i=await this.client.request({headers:{...this.headers,Range:`bytes=${r}-${r+n}`},signal:e});if(i.ok){if(206===i.status){const t=await i.getData(),{total:e}=mR(i.getHeader("content-range"));return this._fileSize=e||null,{data:t,offset:r,length:n}}{if(!this.allowFullFile)throw new Error("Server responded with full file");const t=await i.getData();return this._fileSize=t.byteLength,{data:t,offset:0,length:t.byteLength}}}throw new Error("Error fetching data.")}get fileSize(){return this._fileSize}}function ak(t,{blockSize:e,cacheSize:r}){return null===e?t:new XR(t,e,r)}function lk(t,{forceXHR:e=!1,...r}={}){return"function"!=typeof fetch||e?"undefined"!=typeof XMLHttpRequest?function(t,{headers:e={},maxRanges:r=0,allowFullFile:n=!1,...i}={}){const o=new ek(t);return ak(new sk(o,e,r,n),i)}(t,r):function(t,{headers:e={},maxRanges:r=0,allowFullFile:n=!1,...i}={}){const o=new ok(t);return ak(new sk(o,e,r,n),i)}(t,r):function(t,{headers:e={},credentials:r,maxRanges:n=0,allowFullFile:i=!1,...o}={}){const s=new $R(t,r);return ak(new sk(s,e,n,i),o)}(t,r)}class uk extends vR{constructor(t){super(),this.file=t}async fetchSlice(t,e){return new Promise(((r,n)=>{const i=this.file.slice(t.offset,t.offset+t.length),o=new FileReader;o.onload=t=>r(t.target.result),o.onerror=n,o.onabort=n,o.readAsArrayBuffer(i),e&&e.addEventListener("abort",(()=>o.abort()))}))}}function hk(t){switch(t){case eR.BYTE:case eR.ASCII:case eR.SBYTE:case eR.UNDEFINED:return 1;case eR.SHORT:case eR.SSHORT:return 2;case eR.LONG:case eR.SLONG:case eR.FLOAT:case eR.IFD:return 4;case eR.RATIONAL:case eR.SRATIONAL:case eR.DOUBLE:case eR.LONG8:case eR.SLONG8:case eR.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function ck(t,e,r,n){let i=null,o=null;const s=hk(e);switch(e){case eR.BYTE:case eR.ASCII:case eR.UNDEFINED:i=new Uint8Array(r),o=t.readUint8;break;case eR.SBYTE:i=new Int8Array(r),o=t.readInt8;break;case eR.SHORT:i=new Uint16Array(r),o=t.readUint16;break;case eR.SSHORT:i=new Int16Array(r),o=t.readInt16;break;case eR.LONG:case eR.IFD:i=new Uint32Array(r),o=t.readUint32;break;case eR.SLONG:i=new Int32Array(r),o=t.readInt32;break;case eR.LONG8:case eR.IFD8:i=new Array(r),o=t.readUint64;break;case eR.SLONG8:i=new Array(r),o=t.readInt64;break;case eR.RATIONAL:i=new Uint32Array(2*r),o=t.readUint32;break;case eR.SRATIONAL:i=new Int32Array(2*r),o=t.readInt32;break;case eR.FLOAT:i=new Float32Array(r),o=t.readFloat32;break;case eR.DOUBLE:i=new Float64Array(r),o=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e!==eR.RATIONAL&&e!==eR.SRATIONAL)for(let a=0;a<r;++a)i[a]=o.call(t,n+a*s);else for(let a=0;a<r;a+=2)i[a]=o.call(t,n+a*s),i[a+1]=o.call(t,n+(a*s+4));return e===eR.ASCII?new TextDecoder("utf-8").decode(i):i}class Ak{constructor(t,e,r){this.fileDirectory=t,this.geoKeyDirectory=e,this.nextIFDByteOffset=r}}class fk extends Error{constructor(t){super(`No image at index ${t}`),this.index=t}}class pk{async readRasters(t={}){const{window:e,width:r,height:n}=t;let{resX:i,resY:o,bbox:s}=t;const a=await this.getImage();let l=a;const u=await this.getImageCount(),h=a.getBoundingBox();if(e&&s)throw new Error('Both "bbox" and "window" passed.');if(r||n){if(e){const[t,r]=a.getOrigin(),[n,i]=a.getResolution();s=[t+e[0]*n,r+e[1]*i,t+e[2]*n,r+e[3]*i]}const t=s||h;if(r){if(i)throw new Error("Both width and resX passed");i=(t[2]-t[0])/r}if(n){if(o)throw new Error("Both width and resY passed");o=(t[3]-t[1])/n}}if(i||o){const t=[];for(let e=0;e<u;++e){const r=await this.getImage(e),{SubfileType:n,NewSubfileType:i}=r.fileDirectory;(0===e||2===n||1&i)&&t.push(r)}t.sort(((t,e)=>t.getWidth()-e.getWidth()));for(let e=0;e<t.length;++e){const r=t[e],n=(h[2]-h[0])/r.getWidth(),s=(h[3]-h[1])/r.getHeight();if(l=r,i&&i>n||o&&o>s)break}}let c=e;if(s){const[t,e]=a.getOrigin(),[r,n]=l.getResolution(a);c=[Math.round((s[0]-t)/r),Math.round((s[1]-e)/n),Math.round((s[2]-t)/r),Math.round((s[3]-e)/n)],c=[Math.min(c[0],c[2]),Math.min(c[1],c[3]),Math.max(c[0],c[2]),Math.max(c[1],c[3])]}return l.readRasters({...t,window:c})}}let dk=class t extends pk{constructor(t,e,r,n,i={}){super(),this.source=t,this.littleEndian=e,this.bigTiff=r,this.firstIFDOffset=n,this.cache=i.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(t,e){const r=this.bigTiff?4048:1024;return new AR((await this.source.fetch([{offset:t,length:void 0!==e?e:r}]))[0],t,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(t){const e=this.bigTiff?20:12,r=this.bigTiff?8:2;let n=await this.getSlice(t);const i=this.bigTiff?n.readUint64(t):n.readUint16(t),o=i*e+(this.bigTiff?16:6);n.covers(t,o)||(n=await this.getSlice(t,o));const s={};let a=t+(this.bigTiff?8:2);for(let h=0;h<i;a+=e,++h){const t=n.readUint16(a),e=n.readUint16(a+2),r=this.bigTiff?n.readUint64(a+4):n.readUint32(a+4);let i,o;const l=hk(e),u=a+(this.bigTiff?12:8);if(l*r<=(this.bigTiff?8:4))i=ck(n,e,r,u);else{const t=n.readOffset(u),o=hk(e)*r;i=n.covers(t,o)?ck(n,e,r,t):ck(await this.getSlice(t,o),e,r,t)}o=1===r&&-1===$N.indexOf(t)&&e!==eR.RATIONAL&&e!==eR.SRATIONAL?i[0]:i,s[ZN[t]]=o}const l=function(t){const e=t.GeoKeyDirectory;if(!e)return null;const r={};for(let n=4;n<=4*e[3];n+=4){const i=rR[e[n]],o=e[n+1]?ZN[e[n+1]]:null,s=e[n+2],a=e[n+3];let l=null;if(o){if(l=t[o],null==l)throw new Error(`Could not get value of geoKey '${i}'.`);"string"==typeof l?l=l.substring(a,a+s-1):l.subarray&&(l=l.subarray(a,a+s),1===s&&(l=l[0]))}else l=a;r[i]=l}return r}(s),u=n.readOffset(t+r+e*i);return new Ak(s,l,u)}async requestIFD(t){if(this.ifdRequests[t])return this.ifdRequests[t];if(0===t)return this.ifdRequests[t]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[t];if(!this.ifdRequests[t-1])try{this.ifdRequests[t-1]=this.requestIFD(t-1)}catch(dX){if(dX instanceof fk)throw new fk(t);throw dX}return this.ifdRequests[t]=(async()=>{const e=await this.ifdRequests[t-1];if(0===e.nextIFDByteOffset)throw new fk(t);return this.parseFileDirectoryAt(e.nextIFDByteOffset)})(),this.ifdRequests[t]}async getImage(t=0){const e=await this.requestIFD(t);return new hR(e.fileDirectory,e.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let t=0,e=!0;for(;e;)try{await this.requestIFD(t),++t}catch(dX){if(!(dX instanceof fk))throw dX;e=!1}return t}async getGhostValues(){const t=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const e="GDAL_STRUCTURAL_METADATA_SIZE=",r=e.length+100;let n=await this.getSlice(t,r);if(e===ck(n,eR.ASCII,e.length,t)){const e=ck(n,eR.ASCII,r,t).split("\n")[0],i=Number(e.split("=")[1].split(" ")[0])+e.length;i>r&&(n=await this.getSlice(t,i));const o=ck(n,eR.ASCII,i,t);this.ghostValues={},o.split("\n").filter((t=>t.length>0)).map((t=>t.split("="))).forEach((([t,e])=>{this.ghostValues[t]=e}))}return this.ghostValues}static async fromSource(e,r,n){const i=(await e.fetch([{offset:0,length:1024}],n))[0],o=new cR(i),s=o.getUint16(0,0);let a;if(18761===s)a=!0;else{if(19789!==s)throw new TypeError("Invalid byte order value.");a=!1}const l=o.getUint16(2,a);let u;if(42===l)u=!1;else{if(43!==l)throw new TypeError("Invalid magic number.");if(u=!0,8!==o.getUint16(4,a))throw new Error("Unsupported offset byte-size.")}const h=u?o.getUint64(8,a):o.getUint32(4,a);return new t(e,a,u,h,r)}close(){return"function"==typeof this.source.close&&this.source.close()}};class gk extends pk{constructor(t,e){super(),this.mainFile=t,this.overviewFiles=e,this.imageFiles=[t].concat(e),this.fileDirectoriesPerFile=null,this.fileDirectoriesPerFileParsing=null,this.imageCount=null}async parseFileDirectoriesPerFile(){const t=[this.mainFile.parseFileDirectoryAt(this.mainFile.firstIFDOffset)].concat(this.overviewFiles.map((t=>t.parseFileDirectoryAt(t.firstIFDOffset))));return this.fileDirectoriesPerFile=await Promise.all(t),this.fileDirectoriesPerFile}async getImage(t=0){await this.getImageCount(),await this.parseFileDirectoriesPerFile();let e=0,r=0;for(let n=0;n<this.imageFiles.length;n++){const i=this.imageFiles[n];for(let o=0;o<this.imageCounts[n];o++){if(t===e){const t=await i.requestIFD(r);return new hR(t.fileDirectory,t.geoKeyDirectory,i.dataView,i.littleEndian,i.cache,i.source)}e++,r++}r=0}throw new RangeError("Invalid image index")}async getImageCount(){if(null!==this.imageCount)return this.imageCount;const t=[this.mainFile.getImageCount()].concat(this.overviewFiles.map((t=>t.getImageCount())));return this.imageCounts=await Promise.all(t),this.imageCount=this.imageCounts.reduce(((t,e)=>t+e),0),this.imageCount}}var yk,mk=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),vk="STATISTICS_MAXIMUM",_k="STATISTICS_MINIMUM";function wk(t){try{return t.getBoundingBox()}catch(r){var e=t.fileDirectory;return[0,0,e.ImageWidth,e.ImageLength]}}function bk(t){try{return t.getOrigin().slice(0,2)}catch(e){return[0,t.fileDirectory.ImageLength]}}function xk(t,e){try{return t.getResolution(e)}catch(r){return[e.fileDirectory.ImageWidth/t.fileDirectory.ImageWidth,e.fileDirectory.ImageHeight/t.fileDirectory.ImageHeight]}}function Ek(t){var e,r,n,i=t.geoKeys;return i?i.ProjectedCSTypeGeoKey?((r=nr(e="EPSG:"+i.ProjectedCSTypeGeoKey))||(n=$(i.ProjLinearUnitsGeoKey))&&(r=new se({code:e,units:n})),r):i.GeographicTypeGeoKey?((r=nr(e="EPSG:"+i.GeographicTypeGeoKey))||(n=$(i.GeogAngularUnitsGeoKey))&&(r=new se({code:e,units:n})),r):null:null}function Ck(t){return t.getImageCount().then((function(e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t.getImage(n);return Promise.all(r)}))}function Sk(t,e){var r;return r=t.blob?async function(t,e){return dk.fromSource(new uk(t),void 0)}(t.blob):t.overviews?async function(t,e=[],r={},n){const i=await dk.fromSource(lk(t,r),n),o=await Promise.all(e.map((t=>dk.fromSource(lk(t,r)))));return new gk(i,o)}(t.url,t.overviews,e):async function(t,e={},r){return dk.fromSource(lk(t,e),r)}(t.url,e),r.then(Ck)}function Bk(t,e,r,n,i){if(Array.isArray(t)){var o=t.length;if(!Array.isArray(e)||o!=e.length){var s=new Error(n);throw i(s),s}for(var a=0;a<o;++a)Bk(t[a],e[a],r,n,i)}else if(Math.abs(t-e)>r*t)throw new Error(n)}function Ik(t){return t instanceof Int8Array?127:t instanceof Uint8Array||t instanceof Uint8ClampedArray?255:t instanceof Int16Array?32767:t instanceof Uint16Array?65535:t instanceof Int32Array?2147483647:t instanceof Uint32Array?4294967295:t instanceof Float32Array?34e37:255}var Pk=function(t){function e(e){var r=t.call(this,{state:"loading",tileGrid:null,projection:null,opaque:e.opaque,transition:e.transition,interpolate:!1!==e.interpolate,wrapX:e.wrapX})||this;r.sourceInfo_=e.sources;var n=r.sourceInfo_.length;r.sourceOptions_=e.sourceOptions,r.sourceImagery_=new Array(n),r.resolutionFactors_=new Array(n),r.samplesPerPixel_,r.nodataValues_,r.metadata_,r.normalize_=!1!==e.normalize,r.addAlpha_=!1,r.error_=null,r.readMethod_=e.convertToRGB?"readRGB":"readRasters",r.setKey(r.sourceInfo_.map((function(t){return t.url})).join(","));for(var i=r,o=new Array(n),s=0;s<n;++s)o[s]=Sk(r.sourceInfo_[s],r.sourceOptions_);return Promise.all(o).then((function(t){i.configure_(t)})).catch((function(t){i.error_=t,i.setState("error")})),r}return mk(e,t),e.prototype.getError=function(){return this.error_},e.prototype.configure_=function(t){for(var e,r,n,i,o,s=new Array(t.length),a=new Array(t.length),l=new Array(t.length),u=0,h=t.length,c=function(h){var c=t[h],f=c.length,p=void 0,d=void 0,g=new Array(f),y=new Array(f),m=new Array(f);a[h]=new Array(f),l[h]=new Array(f);for(var v=0;v<f;++v){var _=c[v],w=_.getGDALNoData();l[h][v]=_.getGDALMetadata(0),a[h][v]=w;var b=A.sourceInfo_[h].bands;s[h]=b?b.length:_.getSamplesPerPixel();var x=f-(v+1);p||(p=wk(_)),d||(d=bk(_));var E=xk(_,c[0]);m[x]=E[0];var C=[_.getTileWidth(),_.getTileHeight()];g[x]=C;var S=E[0]/Math.abs(E[1]);y[x]=[C[0],C[1]/S]}if(e?Yt(e,p,e):e=p,r){var B="Origin mismatch for source ".concat(h,", got [").concat(d,"] but expected [").concat(r,"]");Bk(r,d,0,B,A.viewRejector)}else r=d;if(o){o.length-u>m.length&&(u=o.length-m.length);var I=o[o.length-1]/m[m.length-1];A.resolutionFactors_[h]=I;var P=m.map((function(t){return t*I}));B="Resolution mismatch for source ".concat(h,", got [").concat(P,"] but expected [").concat(o,"]"),Bk(o.slice(u,o.length),P,.02,B,A.viewRejector)}else o=m,A.resolutionFactors_[h]=1;n?Bk(n.slice(u,n.length),y,.01,"Tile size mismatch for source ".concat(h),A.viewRejector):n=y,i?Bk(i.slice(u,i.length),g,0,"Tile size mismatch for source ".concat(h),A.viewRejector):i=g,A.sourceImagery_[h]=c.reverse()},A=this,f=0;f<h;++f)c(f);for(var p=0,d=this.sourceImagery_.length;p<d;++p)for(var g=this.sourceImagery_[p];g.length<o.length;)g.unshift(void 0);if(!this.getProjection()){var y=t[0];for(p=y.length-1;p>=0;--p){var m=Ek(y[p]);if(m){this.projection=m;break}}}this.samplesPerPixel_=s,this.nodataValues_=a,this.metadata_=l;t:for(f=0;f<h;++f){if(void 0!==this.sourceInfo_[f].nodata){this.addAlpha_=!0;break}var v=a[f],_=this.sourceInfo_[f].bands;if(_){for(p=0;p<_.length;++p)if(null!==v[_[p]-1]){this.addAlpha_=!0;break t}}else for(var w=0;w<v.length;++w)if(null!==v[w]){this.addAlpha_=!0;break t}}var b=this.addAlpha_?1:0;this.bandCount=s.reduce((function(t,e){return t+e}),0)+b;var x=new lf({extent:e,minZoom:u,origin:r,resolutions:o,tileSizes:n});this.tileGrid=x,this.setTileSizes(i),this.setLoader(this.loadTile_.bind(this)),this.setState("ready"),this.viewResolver({projection:this.projection,resolutions:o,center:wr(Vt(e),this.projection),extent:xr(e,this.projection),zoom:0})},e.prototype.loadTile_=function(t,e,r){for(var n=this.getTileSize(t),i=this.sourceImagery_.length,o=new Array(i),s=this.addAlpha_,a=this.bandCount,l=this.samplesPerPixel_,u=this.nodataValues_,h=this.sourceInfo_,c=function(i){var s,a=h[i],l=A.resolutionFactors_[i],c=[Math.round(e*(n[0]*l)),Math.round(r*(n[1]*l)),Math.round((e+1)*(n[0]*l)),Math.round((r+1)*(n[1]*l))],f=A.sourceImagery_[i][t],p=void 0;a.bands&&(p=a.bands.map((function(t){return t-1}))),s="nodata"in a&&null!==a.nodata?a.nodata:p?p.map((function(t){return u[i][t]})):u[i],o[i]=f[A.readMethod_]({window:c,width:n[0],height:n[1],samples:p,fillValue:s,pool:(yk||(yk=new pR),yk),interleave:!1})},A=this,f=0;f<i;++f)c(f);var p=n[0]*n[1],d=p*a,g=this.normalize_,y=this.metadata_;return Promise.all(o).then((function(t){var e;e=g?new Uint8Array(d):new Float32Array(d);for(var r,n=0,o=0;o<p;++o){for(var a=s,c=0;c<i;++c){var A=h[c],f=A.min,m=A.max,v=void 0,_=void 0;if(g){var w=y[c][0];void 0===f&&(f=w&&_k in w?parseFloat(w[_k]):(r=t[c][0])instanceof Int8Array?-128:r instanceof Int16Array?-32768:r instanceof Int32Array?-2147483648:r instanceof Float32Array?12e-39:0),void 0===m&&(m=w&&vk in w?parseFloat(w[vk]):Ik(t[c][0])),_=-f*(v=255/(m-f))}for(var b=0;b<l[c];++b){var x,E=t[c][b][o];if(x=g?ae(v*E+_,0,255):E,s){var C,S=A.nodata;if(void 0===S)C=A.bands?A.bands[b]-1:b,S=u[c][C];var B=isNaN(S);(!B&&E!==S||B&&!isNaN(E))&&(a=!1,e[n]=x)}else e[n]=x;n++}}s&&(a||(e[n]=255),n++)}return e})).catch((function(t){throw t}))},e}(NO);Pk.prototype.getView;const Tk=Pk;var Fk=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const Mk=function(t){function e(e,r,n,i,o,s,a){var l=this,u=e.getExtent(),h=r.getExtent(),c=h?Yt(n,h):n,A=HA(e,r,Vt(c),i),f=new UA(e,r,c,u,A*jc,i),p=s(f.calculateSourceExtent(),A,o),d=p?kn.IDLE:kn.EMPTY,g=p?p.getPixelRatio():1;return(l=t.call(this,n,i,g,d)||this).targetProj_=r,l.maxSourceExtent_=u,l.triangulation_=f,l.targetResolution_=i,l.targetExtent_=n,l.sourceImage_=p,l.sourcePixelRatio_=g,l.interpolate_=a,l.canvas_=null,l.sourceListenerKey_=null,l}return Fk(e,t),e.prototype.disposeInternal=function(){this.state==kn.LOADING&&this.unlistenSource_(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.canvas_},e.prototype.getProjection=function(){return this.targetProj_},e.prototype.reproject_=function(){var t=this.sourceImage_.getState();if(t==kn.LOADED){var e=$t(this.targetExtent_)/this.targetResolution_,r=Xt(this.targetExtent_)/this.targetResolution_;this.canvas_=zA(e,r,this.sourcePixelRatio_,this.sourceImage_.getResolution(),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_)}this.state=t,this.changed()},e.prototype.load=function(){if(this.state==kn.IDLE){this.state=kn.LOADING,this.changed();var t=this.sourceImage_.getState();t==kn.LOADED||t==kn.ERROR?this.reproject_():(this.sourceListenerKey_=T(this.sourceImage_,P.CHANGE,(function(t){var e=this.sourceImage_.getState();e!=kn.LOADED&&e!=kn.ERROR||(this.unlistenSource_(),this.reproject_())}),this),this.sourceImage_.load())}},e.prototype.unlistenSource_=function(){M(this.sourceListenerKey_),this.sourceListenerKey_=null},e}(Ss);var Lk=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ok=function(t){function e(e,r){var n=t.call(this,e)||this;return n.image=r,n}return Lk(e,t),e}(h);function Nk(t,e){t.getImage().src=e}const Rk=function(t){function e(e){var r=this,n=void 0===e.imageSmoothing||e.imageSmoothing;return void 0!==e.interpolate&&(n=e.interpolate),(r=t.call(this,{attributions:e.attributions,projection:e.projection,state:e.state,interpolate:n})||this).on,r.once,r.un,r.resolutions_=void 0!==e.resolutions?e.resolutions:null,r.reprojectedImage_=null,r.reprojectedRevision_=0,r}return Lk(e,t),e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.findNearestResolution=function(t){if(this.resolutions_){var e=d(this.resolutions_,t,0);t=this.resolutions_[e]}return t},e.prototype.getImage=function(t,e,r,n){var i=this.getProjection();if(i&&n&&!cr(i,n)){if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&cr(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&Rt(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Mk(i,n,t,e,r,function(t,e,r){return this.getImageInternal(t,e,r,i)}.bind(this),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}return i&&(n=i),this.getImageInternal(t,e,r,n)},e.prototype.getImageInternal=function(t,e,r,i){return n()},e.prototype.handleImageChange=function(t){var e,r=t.target;switch(r.getState()){case kn.LOADING:this.loading=!0,e="imageloadstart";break;case kn.LOADED:this.loading=!1,e="imageloadend";break;case kn.ERROR:this.loading=!1,e="imageloaderror";break;default:return}this.hasListener(e)&&this.dispatchEvent(new Ok(e,r))},e}(ra);function kk(t,e){var r=[];Object.keys(e).forEach((function(t){null!==e[t]&&void 0!==e[t]&&r.push(t+"="+encodeURIComponent(e[t]))}));var n=r.join("&");return(t=-1===(t=t.replace(/[?&]$/,"")).indexOf("?")?t+"?":t+"&")+n}var Uk=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const Dk=function(t){function e(e){var r=this,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;return void 0!==n.interpolate&&(i=n.interpolate),(r=t.call(this,{attributions:n.attributions,interpolate:i,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.hidpi_=void 0===n.hidpi||n.hidpi,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:Nk,r.params_=n.params||{},r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return Uk(e,t),e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),r=this.hidpi_?r:1;var i=this.image_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&Pt(i.getExtent(),t))return i;var o={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};b(o,this.params_);var s=((t=t.slice())[0]+t[2])/2,a=(t[1]+t[3])/2;if(1!=this.ratio_){var l=this.ratio_*$t(t)/2,u=this.ratio_*Xt(t)/2;t[0]=s-l,t[1]=a-u,t[2]=s+l,t[3]=a+u}var h=e/r,c=Math.ceil($t(t)/h),A=Math.ceil(Xt(t)/h);t[0]=s-h*c/2,t[2]=s+h*c/2,t[1]=a-h*A/2,t[3]=a+h*A/2,this.imageSize_[0]=c,this.imageSize_[1]=A;var f=this.getRequestUrl_(t,this.imageSize_,r,n,o);return this.image_=new Is(t,e,r,f,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(P.CHANGE,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){var o=n.getCode().split(/:(?=\d+$)/).pop();i.SIZE=e[0]+","+e[1],i.BBOX=t.join(","),i.BBOXSR=o,i.IMAGESR=o,i.DPI=Math.round(90*r);var s=this.url_,a=s.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");return a==s&&K(!1,50),kk(a,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){b(this.params_,t),this.image_=null,this.changed()},e}(Rk);var Gk=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const Qk=function(t){function e(e){var r=this,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;return void 0!==n.interpolate&&(i=n.interpolate),(r=t.call(this,{attributions:n.attributions,interpolate:i,projection:n.projection,resolutions:n.resolutions,state:n.state})||this).canvasFunction_=n.canvasFunction,r.canvas_=null,r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return Gk(e,t),e.prototype.getImageInternal=function(t,e,r,n){e=this.findNearestResolution(e);var i=this.canvas_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&Pt(i.getExtent(),t))return i;re(t=t.slice(),this.ratio_);var o=[$t(t)/e*r,Xt(t)/e*r],s=this.canvasFunction_.call(this,t,e,r,o,n);return s&&(i=new pa(t,e,r,s)),this.canvas_=i,this.renderedRevision_=this.getRevision(),i},e}(Rk);var jk=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const Hk=function(t){function e(e){var r=this,n=void 0!==e.crossOrigin?e.crossOrigin:null,i=void 0!==e.imageLoadFunction?e.imageLoadFunction:Nk,o=void 0===e.imageSmoothing||e.imageSmoothing;return void 0!==e.interpolate&&(o=e.interpolate),(r=t.call(this,{attributions:e.attributions,interpolate:o,projection:nr(e.projection)})||this).url_=e.url,r.imageExtent_=e.imageExtent,r.image_=new Is(r.imageExtent_,void 0,1,r.url_,n,i),r.imageSize_=e.imageSize?e.imageSize:null,r.image_.addEventListener(P.CHANGE,r.handleImageChange.bind(r)),r}return jk(e,t),e.prototype.getImageExtent=function(){return this.imageExtent_},e.prototype.getImageInternal=function(t,e,r,n){return te(t,this.image_.getExtent())?this.image_:null},e.prototype.getUrl=function(){return this.url_},e.prototype.handleImageChange=function(e){if(this.image_.getState()==kn.LOADED){var r=this.image_.getExtent(),n=this.image_.getImage(),i=void 0,o=void 0;this.imageSize_?(i=this.imageSize_[0],o=this.imageSize_[1]):(i=n.width,o=n.height);var s=$t(r),a=Xt(r),l=s/i,u=a/o,h=i,c=o;if(l>u?h=Math.round(s/u):c=Math.round(a/l),h!==i||c!==o){var A=Jn(h,c);this.getInterpolate()||b(A,Hc);var f=A.canvas;A.drawImage(n,0,0,i,o,0,0,f.width,f.height),this.image_.setImage(f)}}t.prototype.handleImageChange.call(this,e)},e}(Rk);var zk="1.3.0",Vk=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Kk=[101,101];const qk=function(t){function e(e){var r=this,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;return void 0!==n.interpolate&&(i=n.interpolate),(r=t.call(this,{attributions:n.attributions,interpolate:i,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:Nk,r.params_=n.params||{},r.v13_=!0,r.updateV13_(),r.serverType_=n.serverType,r.hidpi_=void 0===n.hidpi||n.hidpi,r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return Vk(e,t),e.prototype.getFeatureInfoUrl=function(t,e,r,n){if(void 0!==this.url_){var i=nr(r),o=this.getProjection();o&&o!==i&&(e=HA(o,i,t,e),t=pr(t,i,o));var s=qt(t,e,0,Kk),a={SERVICE:"WMS",VERSION:zk,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};b(a,this.params_,n);var l=ye((t[0]-s[0])/e,4),u=ye((s[3]-t[1])/e,4);return a[this.v13_?"I":"X"]=l,a[this.v13_?"J":"Y"]=u,this.getRequestUrl_(s,Kk,1,o||i,a)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.url_){var r={SERVICE:"WMS",VERSION:zk,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var n=this.params_.LAYERS;if(Array.isArray(n)&&1!==n.length)return;r.LAYER=n}if(void 0!==t){var i=this.getProjection()?this.getProjection().getMetersPerUnit():1;r.SCALE=t*i/28e-5}return b(r,e),kk(this.url_,r)}},e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),1==r||this.hidpi_&&void 0!==this.serverType_||(r=1);var i=e/r,o=Vt(t),s=qt(o,i,0,[me($t(t)/i,4),me(Xt(t)/i,4)]),a=qt(o,i,0,[me(this.ratio_*$t(t)/i,4),me(this.ratio_*Xt(t)/i,4)]),l=this.image_;if(l&&this.renderedRevision_==this.getRevision()&&l.getResolution()==e&&l.getPixelRatio()==r&&Pt(l.getExtent(),s))return l;var u={SERVICE:"WMS",VERSION:zk,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};b(u,this.params_),this.imageSize_[0]=ge($t(a)/i,4),this.imageSize_[1]=ge(Xt(a)/i,4);var h=this.getRequestUrl_(a,this.imageSize_,r,n,u);return this.image_=new Is(a,e,r,h,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(P.CHANGE,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){if(K(void 0!==this.url_,9),i[this.v13_?"CRS":"SRS"]=n.getCode(),"STYLES"in this.params_||(i.STYLES=""),1!=r)switch(this.serverType_){case"geoserver":var o=90*r+.5|0;"FORMAT_OPTIONS"in i?i.FORMAT_OPTIONS+=";dpi:"+o:i.FORMAT_OPTIONS="dpi:"+o;break;case"mapserver":i.MAP_RESOLUTION=90*r;break;case"carmentaserver":case"qgis":i.DPI=90*r;break;default:K(!1,8)}i.WIDTH=e[0],i.HEIGHT=e[1];var s,a=n.getAxisOrientation();return s=this.v13_&&"ne"==a.substr(0,2)?[t[1],t[0],t[3],t[2]]:t,i.BBOX=s.join(","),kk(this.url_,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){b(this.params_,t),this.updateV13_(),this.image_=null,this.changed()},e.prototype.updateV13_=function(){var t=this.params_.VERSION||zk;this.v13_=function(t,e){for(var r=(""+t).split("."),n="1.3".split("."),i=0;i<Math.max(r.length,n.length);i++){var o=parseInt(r[i]||"0",10),s=parseInt(n[i]||"0",10);if(o>s)return 1;if(s>o)return-1}return 0}(t)>=0},e}(Rk);var Wk=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const Xk=function(t){function e(e){var r=t.call(this,{extent:e.extent,origin:e.origin,origins:e.origins,resolutions:e.resolutions,tileSize:e.tileSize,tileSizes:e.tileSizes,sizes:e.sizes})||this;return r.matrixIds_=e.matrixIds,r}return Wk(e,t),e.prototype.getMatrixId=function(t){return this.matrixIds_[t]},e.prototype.getMatrixIds=function(){return this.matrixIds_},e}(lf);var Yk=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Zk=function(t){function e(e){var r=this,n=void 0===e.imageSmoothing||e.imageSmoothing;void 0!==e.interpolate&&(n=e.interpolate);var i=void 0!==e.requestEncoding?e.requestEncoding:"KVP",o=e.tileGrid,s=e.urls;return void 0===s&&void 0!==e.url&&(s=bf(e.url)),(r=t.call(this,{attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:n,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileClass:e.tileClass,tileGrid:o,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,urls:s,wrapX:void 0!==e.wrapX&&e.wrapX,transition:e.transition,zDirection:e.zDirection})||this).version_=void 0!==e.version?e.version:"1.0.0",r.format_=void 0!==e.format?e.format:"image/jpeg",r.dimensions_=void 0!==e.dimensions?e.dimensions:{},r.layer_=e.layer,r.matrixSet_=e.matrixSet,r.style_=e.style,r.requestEncoding_=i,r.setKey(r.getKeyForDimensions_()),s&&s.length>0&&(r.tileUrlFunction=wf(s.map(r.createFromWMTSTemplate.bind(r)))),r}return Yk(e,t),e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.setTileUrlFunction(wf(t.map(this.createFromWMTSTemplate.bind(this))),e)},e.prototype.getDimensions=function(){return this.dimensions_},e.prototype.getFormat=function(){return this.format_},e.prototype.getLayer=function(){return this.layer_},e.prototype.getMatrixSet=function(){return this.matrixSet_},e.prototype.getRequestEncoding=function(){return this.requestEncoding_},e.prototype.getStyle=function(){return this.style_},e.prototype.getVersion=function(){return this.version_},e.prototype.getKeyForDimensions_=function(){var t=0,e=[];for(var r in this.dimensions_)e[t++]=r+"-"+this.dimensions_[r];return e.join("/")},e.prototype.updateDimensions=function(t){b(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())},e.prototype.createFromWMTSTemplate=function(t){var e=this.requestEncoding_,r={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};"KVP"==e&&b(r,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t="KVP"==e?kk(t,r):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in r?r[e.toLowerCase()]:t}));var n=this.tileGrid,i=this.dimensions_;return function(r,o,s){if(r){var a={TileMatrix:n.getMatrixId(r[0]),TileCol:r[1],TileRow:r[2]};b(a,i);var l=t;return"KVP"==e?kk(l,a):l.replace(/\{(\w+?)\}/g,(function(t,e){return a[e]}))}}},e}(Qf);const Jk=Zk;class $k extends dm{constructor(t){super(),e(this,"_map"),e(this,"segmentStyles"),e(this,"clearPrevious"),e(this,"showSegments"),e(this,"_tipPoint"),e(this,"_draw"),e(this,"isdraw"),e(this,"_source"),e(this,"layer"),e(this,"style"),e(this,"labelStyle"),e(this,"tipStyle"),e(this,"modifyStyle"),e(this,"segmentStyle"),e(this,"_modify"),this._map=t,this.segmentStyles=[],this.clearPrevious=!1,this.showSegments=!0,this._tipPoint=void 0,this.isdraw=!1,this._source=new Aa,this.layer=new Zs({source:this._source,zIndex:1e3,style:t=>this.styleFunction(t,this.showSegments,null,null)}),this.style=new ji({fill:new Tn({color:"rgba(255, 255, 255, 0.2)"}),stroke:new Rn({color:"rgba(255, 255, 0, 1)",lineDash:[10,10],width:2}),image:new Ri({radius:5,stroke:new Rn({color:"rgba(0, 0, 0, 1)"}),fill:new Tn({color:"rgba(255, 255, 255, 0.2)"})})}),this.labelStyle=new ji({text:new Vi({font:"14px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 1)"}),padding:[3,3,3,3],textBaseline:"bottom",offsetY:-15}),image:new Oi({radius:8,points:3,angle:Math.PI,displacement:[0,10],fill:new Tn({color:"rgba(0, 0, 0, 1)"})})}),this.tipStyle=new ji({text:new Vi({font:"12px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 0.8)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),this.modifyStyle=new ji({image:new Ri({radius:5,stroke:new Rn({color:"rgba(255, 255,255, 0.7)"}),fill:new Tn({color:"rgba(0, 255, 255, 0.8)"})}),text:new Vi({text:"拖动点修改图形",font:"12px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 0.7)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),this.segmentStyle=new ji({text:new Vi({font:"12px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 0.8)"}),padding:[2,2,2,2],textBaseline:"bottom",offsetY:-12}),image:new Oi({radius:6,points:3,angle:Math.PI,displacement:[0,8],fill:new Tn({color:"rgba(0, 0, 0, 0.8)"})})}),this._modify=new bh({source:this._source,style:this.modifyStyle}),this._map.addLayer(this.layer),this._map.addInteraction(this._modify)}getSource(){return this._source}clear(){this._source.clear()}formatLength(t){const e=Xe(t);let r;return r=e>1e3?Math.round(e/1e3*100)/100+" km":Math.round(100*e)/100+" m",r}formatArea(t){const e=Ze(t);let r;return r=e>1e5?Math.round(e/1e6*100)/100+" km²":Math.round(100*e)/100+" m²",r}styleFunction(t,e,r,n){this.segmentStyles=[this.segmentStyle];const i=[this.style],o=t.getGeometry(),s=o.getType();let a,l,u;if(r&&r!==s||("Polygon"===s?(a=o.getInteriorPoint(),l=this.formatArea(o),u=new Nn(o.getCoordinates()[0])):"LineString"===s&&(a=new nn(o.getLastCoordinate()),l=this.formatLength(o),u=o)),e&&u){let t=0;u.forEachSegment(((e,r)=>{const n=new Nn([e,r]),o=this.formatLength(n);this.segmentStyles.length-1<t&&this.segmentStyles.push(this.segmentStyle.clone());const s=new nn(n.getCoordinateAt(.5));this.segmentStyles[t].setGeometry(s),this.segmentStyles[t].getText().setText(o),i.push(this.segmentStyles[t]),t++}))}return l&&(this.labelStyle.setGeometry(a),this.labelStyle.getText().setText(l),i.push(this.labelStyle)),n&&"Point"===s&&!this._modify.getOverlay().getSource().getFeatures().length&&(this._tipPoint=o,this.tipStyle.getText().setText(n),i.push(this.tipStyle)),i}stopMeasure(){this._draw.setActive(!1),this._map.removeInteraction(this._draw),this.isdraw=!1}addInteraction(t){if(this.isdraw)return;this.isdraw=!0;const e="单击继续绘制,双击结束绘制"+("Polygon"===t?"多边形":"线"),r="点击任意位置";let n=r;this._draw=new ch({source:this._source,type:t,style:e=>this.styleFunction(e,!0,t,n)}),this._draw.on("drawstart",(t=>{this.clearPrevious&&this._source.clear(),this._modify.setActive(!1),n=e,this.trigger(Rm.onDrawStart,t)})),this._draw.on("drawend",(t=>{this.isdraw=!1,this._modify.setActive(!0),n=r,t.feature.setProperties({featuretype:Kp.Measure}),this.trigger(Rm.onDrawEnd,t)})),this._modify.setActive(!0),this._map.addInteraction(this._draw)}}var tU=function(t){D.call(this,t),this._listener=[],t&&!1===t.active?this.set("active",!1):this.set("active",!0)};Vm(tU,D),tU.prototype.setActive=function(t){this.set("active",!0===t)},tU.prototype.getActive=function(){return this.get("active")},function(){function t(t){this.get("active")&&t.context&&this.precompose(t)}function e(t){this.get("active")&&t.context&&this.postcompose(t)}function r(){if(this.renderSync)try{this.renderSync()}catch(dX){}else this.changed()}function n(n){this.filters_||(this.filters_=[]),this.filters_.push(n),n.addToLayer&&n.addToLayer(this),n.precompose&&n._listener.push({listener:this.on(["precompose","prerender"],t.bind(n)),target:this}),n.postcompose&&n._listener.push({listener:this.on(["postcompose","postrender"],e.bind(n)),target:this}),n._listener.push({listener:n.on("propertychange",r.bind(this)),target:this}),r.call(this)}function i(t){var e;if(this.filters_||(this.filters_=[]),t){for(e=this.filters_.length-1;e>=0;e--)this.filters_[e]===t&&this.filters_.splice(e,1);for(e=t._listener.length-1;e>=0;e--)t._listener[e].target===this&&(t.removeFromLayer&&t.removeFromLayer(this),N(t._listener[e].listener),t._listener.splice(e,1));r.call(this)}else this.filters_.forEach(function(t){this.removeFilter(t)}.bind(this))}Uh.prototype.addFilter=function(t){n.call(this,t)},Uh.prototype.removeFilter=function(t){i.call(this,t)},Uh.prototype.getFilters=function(){return this.filters_||[]},Wi.prototype.addFilter=function(t){n.call(this,t)},Wi.prototype.removeFilter=function(t){i.call(this,t)},Wi.prototype.getFilters=function(){return this.filters_||[]}}();var eU=function(t){if(tU.call(this,t=t||{}),t.feature)switch(t.feature.getGeometry().getType()){case"Polygon":case"MultiPolygon":this.feature_=t.feature}this.set("inner",t.inner),this.fillColor_=t.fill&&Hn(t.fill.getColor())||"rgba(0,0,0,0.2)"};Vm(eU,tU),eU.prototype.drawFeaturePath_=function(t,e){var r,n=t.context,i=n.canvas,o=t.frameState.pixelRatio;if(t.frameState.coordinateToPixelTransform){var s=t.frameState.coordinateToPixelTransform;if(t.inversePixelTransform){var a=t.inversePixelTransform;r=function(t){return[(t=[t[0]*s[0]+t[1]*s[1]+s[4],t[0]*s[2]+t[1]*s[3]+s[5]])[0]*a[0]-t[1]*a[1]+a[4],-t[0]*a[2]+t[1]*a[3]+a[5]]}}else r=function(t){return[(t[0]*s[0]+t[1]*s[1]+s[4])*o,(t[0]*s[2]+t[1]*s[3]+s[5])*o]}}else s=t.frameState.coordinateToPixelMatrix,r=function(t){return[(t[0]*s[0]+t[1]*s[1]+s[12])*o,(t[0]*s[4]+t[1]*s[5]+s[13])*o]};var l=this.feature_.getGeometry().getCoordinates();function u(t){for(var e=0;e<l.length;e++)for(var i=l[e],o=0;o<i.length;o++){var s=r([i[o][0][0]+t,i[o][0][1]]);n.moveTo(s[0],s[1]);for(var a=1;a<i[o].length;a++)s=r([i[o][a][0]+t,i[o][a][1]]),n.lineTo(s[0],s[1])}}if("Polygon"===this.feature_.getGeometry().getType()&&(l=[l]),n.beginPath(),e&&(n.moveTo(0,0),n.lineTo(i.width,0),n.lineTo(i.width,i.height),n.lineTo(0,i.height),n.lineTo(0,0)),this.get("wrapX")){var h=t.frameState.viewState.projection.getExtent(),c=h[2]-h[0],A=t.frameState.extent,f=this.feature_.getGeometry().getExtent(),p=f[2]-f[1],d=Math.floor((A[0]+p-h[0])/c),g=Math.floor((A[2]-p-h[2])/c)+1;d>g&&([d,g]=[g,d]);for(var y=d;y<=g;y++)u(y*c)}else u(0)},eU.prototype.postcompose=function(t){if(this.feature_){var e=t.context;e.save(),this.drawFeaturePath_(t,!this.get("inner")),e.fillStyle=this.fillColor_,e.fill("evenodd"),e.restore()}};var rU=function(t){tU.call(this,t=t||{}),this.set("blur",t.blur||8),this.set("intensity",t.intensity||.8)};Vm(rU,tU),rU.prototype.precompose=function(){},rU.prototype.postcompose=function(t){var e=t.context,r=e.canvas,n=r.width,i=r.height,o=document.createElement("canvas");o.width=n,o.height=i;var s=o.getContext("2d");s.filter="grayscale(1) invert(1) blur("+this.get("blur")+"px)",s.drawImage(r,0,0),e.save(),this.get("color")?(e.globalCompositeOperation="darken",e.globalAlpha=.3,e.drawImage(r,0,0)):(e.filter="grayscale(1)",e.drawImage(r,0,0)),e.globalCompositeOperation="color-dodge",e.globalAlpha=this.get("intensity"),e.drawImage(o,0,0),e.restore()};var nU=function(t){tU.call(this,t),this.setFilter(t)};Vm(nU,tU),nU.prototype.setFilter=function(t){switch(t=t||{}){case"grayscale":t={operation:"hue",color:[0,0,0],value:1};break;case"invert":t={operation:"difference",color:[255,255,255],value:1};break;case"sepia":t={operation:"color",color:[153,102,51],value:.6}}var e,r=t.color?Wn(t.color):[t.red,t.green,t.blue,t.value];switch(this.set("color",Hn(r)),this.set("value",t.value||1),this.set("preserveAlpha",t.preserveAlpha),t.operation){case"hue":case"difference":case"color-dodge":case"enhance":this.set("operation",t.operation);break;case"saturation":e=255*(t.value||0),this.set("color",Hn([0,0,e,e||1])),this.set("operation",t.operation);break;case"luminosity":e=255*(t.value||0),this.set("color",Hn([e,e,e,255])),this.set("operation","hard-light");break;case"contrast":e=255*(t.value||0),this.set("color",Hn([e,e,e,255])),this.set("operation","soft-light");break;default:this.set("operation","color"),this.setValue(t.value||1)}},nU.prototype.setValue=function(t){this.set("value",t);var e=Wn(this.get("color"));e[3]=t,this.set("color",Hn(e))},nU.prototype.setColor=function(t){(t=Wn(t))&&(t[3]=this.get("value"),this.set("color",Hn(t)))},nU.prototype.precompose=function(){},nU.prototype.postcompose=function(t){var e,r,n=t.context,i=n.canvas;if(n.save(),"enhance"==this.get("operation")){var o=this.get("value");if(o){var s=i.width,a=i.height;this.get("preserveAlpha")?((e=document.createElement("CANVAS")).width=i.width,e.height=i.height,(r=e.getContext("2d")).drawImage(i,0,0,s,a),r.globalCompositeOperation="color-burn",r.globalAlpha=o,r.drawImage(e,0,0,s,a),r.drawImage(e,0,0,s,a),r.drawImage(e,0,0,s,a),n.globalCompositeOperation="source-in",n.drawImage(e,0,0)):(n.globalCompositeOperation="color-burn",n.globalAlpha=o,n.drawImage(i,0,0,s,a),n.drawImage(i,0,0,s,a),n.drawImage(i,0,0,s,a))}}else this.get("preserveAlpha")?((e=document.createElement("CANVAS")).width=i.width,e.height=i.height,(r=e.getContext("2d")).drawImage(i,0,0),r.globalCompositeOperation=this.get("operation"),r.fillStyle=this.get("color"),r.fillRect(0,0,i.width,i.height),n.globalCompositeOperation="source-in",n.drawImage(e,0,0)):(n.globalCompositeOperation=this.get("operation"),n.fillStyle=this.get("color"),n.fillRect(0,0,i.width,i.height));n.restore()};var iU=function(t){tU.call(this,t),this._svg={}};Vm(iU,tU),iU.prototype.addSVGFilter=function(t){t.getId&&(t="#"+t.getId()),this._svg[t]=1,this.dispatchEvent({type:"propertychange",key:"svg",oldValue:this._svg})},iU.prototype.removeSVGFilter=function(t){t.getId&&(t="#"+t.getId()),delete this._svg[t],this.dispatchEvent({type:"propertychange",key:"svg",oldValue:this._svg})},iU.prototype.precompose=function(){},iU.prototype.postcompose=function(t){var e=[];for(var r in void 0!==this.get("url")&&e.push("url("+this.get("url")+")"),this._svg)e.push("url("+r+")");void 0!==this.get("blur")&&e.push("blur("+this.get("blur")+"px)"),void 0!==this.get("brightness")&&e.push("brightness("+this.get("brightness")+"%)"),void 0!==this.get("contrast")&&e.push("contrast("+this.get("contrast")+"%)"),void 0!==this.get("shadow")&&e.push("drop-shadow("+this.get("shadow")[0]+"px "+this.get("shadow")[1]+"px "+(this.get("shadowBlur")||0)+"px "+this.get("shadowColor")+")"),void 0!==this.get("grayscale")&&e.push("grayscale("+this.get("grayscale")+"%)"),void 0!==this.get("sepia")&&e.push("sepia("+this.get("sepia")+"%)"),void 0!==this.get("hueRotate")&&e.push("hue-rotate("+this.get("hueRotate")+"deg)"),void 0!==this.get("invert")&&e.push("invert("+this.get("invert")+"%)"),void 0!==this.get("saturate")&&e.push("saturate("+this.get("saturate")+"%)"),(e=e.join(" "))&&(t.context.save(),t.context.filter=e,t.context.drawImage(t.context.canvas,0,0),t.context.restore())};var oU=function(t){"string"==typeof t&&(t={feoperation:t}),t&&t.feoperation&&(D.call(this),this._name=t.feoperation,this.element=document.createElementNS(this.NS,this._name),this.setProperties(t),t.operations instanceof Array&&this.appendChild(t.operations))};Vm(oU,D),oU.prototype.NS="http://www.w3.org/2000/svg",oU.prototype.getName=function(){return this._name},oU.prototype.set=function(t,e){/^feoperation$|^operations$/.test(t)||(D.prototype.set.call(this,t,e),this.element.setAttribute(t,e))},oU.prototype.setProperties=function(t){for(var e in t=t||{})this.set(e,t[e])},oU.prototype.geElement=function(){return this.element},oU.prototype.appendChild=function(t){t instanceof Array?t.forEach(function(t){this.appendChild(t)}.bind(this)):(t instanceof oU||(t=new oU(t)),this.element.appendChild(t.geElement()))};var sU=function(t){t=t||{},D.call(this),sU.prototype.svg||(sU.prototype.svg=document.createElementNS(this.NS,"svg"),sU.prototype.svg.setAttribute("version","1.1"),sU.prototype.svg.setAttribute("width",0),sU.prototype.svg.setAttribute("height",0),sU.prototype.svg.style.position="absolute",document.body.appendChild(sU.prototype.svg)),this.element=document.createElementNS(this.NS,"filter"),this._id=t.id||"_ol_SVGFilter_"+sU.prototype._id++,this.element.setAttribute("id",this._id),t.color&&this.element.setAttribute("color-interpolation-filters",t.color),t.operation&&this.addOperation(t.operation),sU.prototype.svg.appendChild(this.element)};Vm(sU,D),sU.prototype.NS="http://www.w3.org/2000/svg",sU.prototype.svg=null,sU.prototype._id=0,sU.prototype.getId=function(){return this._id},sU.prototype.remove=function(){this.element.remove()},sU.prototype.addOperation=function(t){t instanceof Array?t.forEach(function(t){this.addOperation(t)}.bind(this)):(t instanceof oU||(t=new oU(t)),this.element.appendChild(t.geElement()))},sU.prototype.grayscale=function(t){this.addOperation({feoperation:"feColorMatrix",type:"saturate",values:t||0})},sU.prototype.luminanceToAlpha=function(t){t=t||{},this.addOperation({feoperation:"feColorMatrix",type:"luminanceToAlpha"}),t.gamma&&this.addOperation({feoperation:"feComponentTransfer",operations:[{feoperation:"feFuncA",type:"gamma",amplitude:t.gamma,exponent:1,offset:0}]})},sU.prototype.applyTo=function(t){var e=document.createElement("CANVAS");return e.width=t.naturalWidth||t.width,e.height=t.naturalHeight||t.height,e.getContext("2d").filter="url(#"+this.getId()+")",e.getContext("2d").drawImage(t,0,0),e};class aU extends Gm{constructor(t,r){super(t,r),e(this,"mask"),e(this,"pencil"),e(this,"colorize"),e(this,"canvasFilter"),e(this,"emboss"),e(this,"embossFilter"),e(this,"erode"),e(this,"erodeFilter"),e(this,"paperFilter"),e(this,"mImageExtent"),this.layerclass="tilelayer",this.mImageExtent=null,this.option={zIndex:900,projection:"EPSG:3857",url:"",ImageExtent:null,ImageExtentWKID:Xp.EPSG3857,opacity:1},this.option=Object.assign({},this.option,r),this.option.ImageExtent&&(this.mImageExtent=[this.option.ImageExtent.xmin,this.option.ImageExtent.ymin,this.option.ImageExtent.xmax,this.option.ImageExtent.ymax],this.option.ImageExtentWKID==Xp.EPSG4326&&(this.mImageExtent=dr(this.mImageExtent,"EPSG:4326","EPSG:3857")))}setOpacity(t){this.layer.setOpacity(t)}appendTo(t){t.addLayer(this.layer),this.isAdded=!0}addFilter(t){let e={feature:null,wrapX:!0,inner:!1,color:"rgba(255, 255, 255, 0.8)"};e=Object.assign({},e,t),this.mask=new eU({feature:e.feature,wrapX:e.wrapX,inner:e.inner,fill:new Tn({color:e.color})}),this.mask.set("active",!0),this.layer instanceof ka?this.layer.getLayers().forEach((t=>{t.addFilter(this.mask)})):this.layer.addFilter(this.mask)}removeMaskFilter(){this.layer instanceof ka?this.layer.getLayers().forEach((t=>{t.removeFilter(this.mask)})):this.layer.removeFilter(this.mask)}addPencilSketchFilter(){this.pencil=new rU,this.layer instanceof ka?this.layer.getLayers().forEach((t=>{t.addFilter(this.pencil)})):this.layer.addFilter(this.pencil)}removePencilSketchFilter(){this.layer instanceof ka?this.layer.getLayers().forEach((t=>{t.removeFilter(this.pencil)})):this.layer.removeFilter(this.pencil)}setPencilSketchFilter(t,e){this.pencil.set(t,e)}addColorizeFilter(t=!1){this.colorize=new nU;var e=new nU({operation:"enhance",value:1});this.layer instanceof ka?this.layer.getLayers().forEach((r=>{t&&r.addFilter(e),r.addFilter(this.colorize)})):(t&&this.layer.addFilter(e),this.layer.addFilter(this.colorize))}removeColorizeFilter(){this.layer instanceof ka?this.layer.getLayers().forEach((t=>{t.removeFilter(this.colorize)})):this.layer.removeFilter(this.colorize)}setColorizeFilter(t){switch(t.type){case $p.grayscale:case $p.invert:case $p.sepia:this.colorize.setFilter(t.type);break;default:this.colorize.setFilter({operation:t.type,red:Number(t.red),green:Number(t.green),blue:Number(t.blue),value:Number(t.value)})}}addCanvasFilter(){this.canvasFilter=new iU,this.erode=new oU({feoperation:"feMorphology",operator:"erode",radius:1}),this.emboss=new oU("feConvolveMatrix"),this.embossFilter=new sU({operation:this.emboss}),this.erodeFilter=new sU({operation:this.erode}),this.layer instanceof ka?this.layer.getLayers().forEach((t=>{t.addFilter(this.canvasFilter)})):this.layer.addFilter(this.canvasFilter)}removeCanvasFilter(){this.layer instanceof ka?this.layer.getLayers().forEach((t=>{t.removeFilter(this.canvasFilter)})):this.layer.removeFilter(this.canvasFilter)}setCanvasFilter(t,e){switch(t){case td.emboss:0==e?this.canvasFilter.removeSVGFilter(this.embossFilter):(this.emboss.set("kernelMatrix",[e,e,-e,e,1,-e,e,-e,-e]),this.canvasFilter.addSVGFilter(this.embossFilter));break;case td.erode:0==e?this.canvasFilter.removeSVGFilter(this.erodeFilter):(this.erode.set("radius",e),this.canvasFilter.addSVGFilter(this.erodeFilter));break;case td.paper:break;default:this.canvasFilter.set(t,e)}}}class lU extends aU{constructor(t,e){super(t,e),this.layerid=t,this.layertype="TileXyzLayer";let r=this;this.layerSource=new FO({tileUrlFunction:function(t,n,i){var o="C"+r.padLeft(t[1],8,16),s="R"+r.padLeft(t[2],8,16),a="L"+r.padLeft(t[0],2,10);return e.url.replace("{x}",o).replace("{y}",s).replace("{z}",a)}}),this.layer=new Vf({zIndex:e.zIndex,source:this.layerSource}),this.layer.set("layerid",t),this.mImageExtent&&this.layer.setExtent(this.mImageExtent),this.layerSource.on("tileloadstart",(function(){})),this.layerSource.on("tileloadend",(function(){})),this.layerSource.on("tileloaderror",(function(){}))}padLeft(t,e,r){let n=t.toString(r||10);return(new Array(e).join("0")+n).slice(-e)}}class uU extends aU{constructor(t,e){super(t,e),this.layertype="ArcGisMapServerLayer",this.layerSource=new Dk(e),this.layer=new Wc({source:this.layerSource}),this.layer.set("layerid",t),this.mImageExtent&&this.layer.setExtent(this.mImageExtent),this.layerSource.on("tileloadstart",(function(){})),this.layerSource.on("tileloadend",(function(){})),this.layerSource.on("tileloaderror",(function(){}))}}var hU={},cU={get exports(){return hU},set exports(t){hU=t}},AU={},fU={get exports(){return AU},set exports(t){AU=t}};const pU=$c(nk);var dU;function gU(){return dU||(dU=1,fU.exports=(t=t||function(t,e){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==Jc&&Jc.crypto&&(r=Jc.crypto),!r)try{r=pU}catch(d){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(d){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(d){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function t(){}return function(e){var r;return t.prototype=e,r=new t,t.prototype=null,r}}(),o={},s=o.lib={},a=s.Base={extend:function(t){var e=i(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},l=s.WordArray=a.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||h).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,i=t.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var s=r[o>>>2]>>>24-o%4*8&255;e[n+o>>>2]|=s<<24-(n+o)%4*8}else for(var a=0;a<i;a+=4)e[n+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=a.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],r=0;r<t;r+=4)e.push(n());return new l.init(e,t)}}),u=o.enc={},h=u.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var o=e[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new l.init(r,e/2)}},c=u.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var o=e[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new l.init(r,e)}},A=u.Utf8={stringify:function(t){try{return decodeURIComponent(escape(c.stringify(t)))}catch(dX){throw new Error("Malformed UTF-8 data")}},parse:function(t){return c.parse(unescape(encodeURIComponent(t)))}},f=s.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=A.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r,n=this._data,i=n.words,o=n.sigBytes,s=this.blockSize,a=o/(4*s),u=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*s,h=t.min(4*u,o);if(u){for(var c=0;c<u;c+=s)this._doProcessBlock(i,c);r=i.splice(0,u),n.sigBytes-=h}return new l.init(r,h)},clone:function(){var t=a.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});s.Hasher=f.extend({cfg:a.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new p.HMAC.init(t,r).finalize(e)}}});var p=o.algo={};return o}(Math),t)),AU;var t}var yU,mU,vU,_U,wU,bU={},xU={get exports(){return bU},set exports(t){bU=t}},EU={},CU={get exports(){return EU},set exports(t){EU=t}},SU={},BU={get exports(){return SU},set exports(t){SU=t}},IU={},PU={get exports(){return IU},set exports(t){IU=t}},TU={},FU={get exports(){return TU},set exports(t){TU=t}};function MU(){return wU||(wU=1,BU.exports=function(t){return function(){var e=t,r=e.lib,n=r.Base,i=r.WordArray,o=e.algo,s=o.MD5,a=o.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:s,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var r,n=this.cfg,o=n.hasher.create(),s=i.create(),a=s.words,l=n.keySize,u=n.iterations;a.length<l;){r&&o.update(r),r=o.update(t).finalize(e),o.reset();for(var h=1;h<u;h++)r=o.finalize(r),o.reset();s.concat(r)}return s.sigBytes=4*l,s}});e.EvpKDF=function(t,e,r){return a.create(r).compute(t,e)}}(),t.EvpKDF}(gU(),function(){return vU||(vU=1,PU.exports=(e=(t=a=gU()).lib,r=e.WordArray,n=e.Hasher,i=t.algo,o=[],s=i.SHA1=n.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],a=r[3],l=r[4],u=0;u<80;u++){if(u<16)o[u]=0|t[e+u];else{var h=o[u-3]^o[u-8]^o[u-14]^o[u-16];o[u]=h<<1|h>>>31}var c=(n<<5|n>>>27)+l+o[u];c+=u<20?1518500249+(i&s|~i&a):u<40?1859775393+(i^s^a):u<60?(i&s|i&a|s&a)-1894007588:(i^s^a)-899497514,l=a,a=s,s=i<<30|i>>>2,i=n,n=c}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+l|0},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),e[15+(n+64>>>9<<4)]=r,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}}),t.SHA1=n._createHelper(s),t.HmacSHA1=n._createHmacHelper(s),a.SHA1)),IU;var t,e,r,n,i,o,s,a}(),_U||(_U=1,FU.exports=(e=(t=gU()).lib.Base,r=t.enc.Utf8,void(t.algo.HMAC=e.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=r.parse(e));var n=t.blockSize,i=4*n;e.sigBytes>i&&(e=t.finalize(e)),e.clamp();for(var o=this._oKey=e.clone(),s=this._iKey=e.clone(),a=o.words,l=s.words,u=0;u<n;u++)a[u]^=1549556828,l[u]^=909522486;o.sigBytes=s.sigBytes=i,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,r=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(r))}})))))),SU;var t,e,r}var LU,OU,NU={},RU={get exports(){return NU},set exports(t){NU=t}};cU.exports=function(t){return function(){var e=t,r=e.lib,n=r.WordArray,i=r.BlockCipher,o=e.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],h=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],c=o.DES=i.extend({_doReset:function(){for(var t=this._key.words,e=[],r=0;r<56;r++){var n=s[r]-1;e[r]=t[n>>>5]>>>31-n%32&1}for(var i=this._subKeys=[],o=0;o<16;o++){var u=i[o]=[],h=l[o];for(r=0;r<24;r++)u[r/6|0]|=e[(a[r]-1+h)%28]<<31-r%6,u[4+(r/6|0)]|=e[28+(a[r+24]-1+h)%28]<<31-r%6;for(u[0]=u[0]<<1|u[0]>>>31,r=1;r<7;r++)u[r]=u[r]>>>4*(r-1)+3;u[7]=u[7]<<5|u[7]>>>27}var c=this._invSubKeys=[];for(r=0;r<16;r++)c[r]=i[15-r]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,r){this._lBlock=t[e],this._rBlock=t[e+1],A.call(this,4,252645135),A.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),A.call(this,1,1431655765);for(var n=0;n<16;n++){for(var i=r[n],o=this._lBlock,s=this._rBlock,a=0,l=0;l<8;l++)a|=u[l][((s^i[l])&h[l])>>>0];this._lBlock=s,this._rBlock=o^a}var c=this._lBlock;this._lBlock=this._rBlock,this._rBlock=c,A.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),A.call(this,16,65535),A.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function A(t,e){var r=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=r,this._lBlock^=r<<t}function f(t,e){var r=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=r,this._rBlock^=r<<t}e.DES=i._createHelper(c);var p=o.TripleDES=i.extend({_doReset:function(){var t=this._key.words;if(2!==t.length&&4!==t.length&&t.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var e=t.slice(0,2),r=t.length<4?t.slice(0,2):t.slice(2,4),i=t.length<6?t.slice(0,2):t.slice(4,6);this._des1=c.createEncryptor(n.create(e)),this._des2=c.createEncryptor(n.create(r)),this._des3=c.createEncryptor(n.create(i))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=i._createHelper(p)}(),t.TripleDES}(gU(),function(){return yU||(yU=1,xU.exports=(r=gU(),e=(t=r).lib.WordArray,t.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp();for(var i=[],o=0;o<r;o+=3)for(var s=(e[o>>>2]>>>24-o%4*8&255)<<16|(e[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|e[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<r;a++)i.push(n.charAt(s>>>6*(3-a)&63));var l=n.charAt(64);if(l)for(;i.length%4;)i.push(l);return i.join("")},parse:function(t){var r=t.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o<n.length;o++)i[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var a=t.indexOf(s);-1!==a&&(r=a)}return function(t,r,n){for(var i=[],o=0,s=0;s<r;s++)if(s%4){var a=n[t.charCodeAt(s-1)]<<s%4*2|n[t.charCodeAt(s)]>>>6-s%4*2;i[o>>>2]|=a<<24-o%4*8,o++}return e.create(i,o)}(t,r,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},r.enc.Base64)),bU;var t,e,r}(),function(){return mU||(mU=1,CU.exports=(t=gU(),function(e){var r=t,n=r.lib,i=n.WordArray,o=n.Hasher,s=r.algo,a=[];!function(){for(var t=0;t<64;t++)a[t]=4294967296*e.abs(e.sin(t+1))|0}();var l=s.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var r=0;r<16;r++){var n=e+r,i=t[n];t[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,s=t[e+0],l=t[e+1],f=t[e+2],p=t[e+3],d=t[e+4],g=t[e+5],y=t[e+6],m=t[e+7],v=t[e+8],_=t[e+9],w=t[e+10],b=t[e+11],x=t[e+12],E=t[e+13],C=t[e+14],S=t[e+15],B=o[0],I=o[1],P=o[2],T=o[3];B=u(B,I,P,T,s,7,a[0]),T=u(T,B,I,P,l,12,a[1]),P=u(P,T,B,I,f,17,a[2]),I=u(I,P,T,B,p,22,a[3]),B=u(B,I,P,T,d,7,a[4]),T=u(T,B,I,P,g,12,a[5]),P=u(P,T,B,I,y,17,a[6]),I=u(I,P,T,B,m,22,a[7]),B=u(B,I,P,T,v,7,a[8]),T=u(T,B,I,P,_,12,a[9]),P=u(P,T,B,I,w,17,a[10]),I=u(I,P,T,B,b,22,a[11]),B=u(B,I,P,T,x,7,a[12]),T=u(T,B,I,P,E,12,a[13]),P=u(P,T,B,I,C,17,a[14]),B=h(B,I=u(I,P,T,B,S,22,a[15]),P,T,l,5,a[16]),T=h(T,B,I,P,y,9,a[17]),P=h(P,T,B,I,b,14,a[18]),I=h(I,P,T,B,s,20,a[19]),B=h(B,I,P,T,g,5,a[20]),T=h(T,B,I,P,w,9,a[21]),P=h(P,T,B,I,S,14,a[22]),I=h(I,P,T,B,d,20,a[23]),B=h(B,I,P,T,_,5,a[24]),T=h(T,B,I,P,C,9,a[25]),P=h(P,T,B,I,p,14,a[26]),I=h(I,P,T,B,v,20,a[27]),B=h(B,I,P,T,E,5,a[28]),T=h(T,B,I,P,f,9,a[29]),P=h(P,T,B,I,m,14,a[30]),B=c(B,I=h(I,P,T,B,x,20,a[31]),P,T,g,4,a[32]),T=c(T,B,I,P,v,11,a[33]),P=c(P,T,B,I,b,16,a[34]),I=c(I,P,T,B,C,23,a[35]),B=c(B,I,P,T,l,4,a[36]),T=c(T,B,I,P,d,11,a[37]),P=c(P,T,B,I,m,16,a[38]),I=c(I,P,T,B,w,23,a[39]),B=c(B,I,P,T,E,4,a[40]),T=c(T,B,I,P,s,11,a[41]),P=c(P,T,B,I,p,16,a[42]),I=c(I,P,T,B,y,23,a[43]),B=c(B,I,P,T,_,4,a[44]),T=c(T,B,I,P,x,11,a[45]),P=c(P,T,B,I,S,16,a[46]),B=A(B,I=c(I,P,T,B,f,23,a[47]),P,T,s,6,a[48]),T=A(T,B,I,P,m,10,a[49]),P=A(P,T,B,I,C,15,a[50]),I=A(I,P,T,B,g,21,a[51]),B=A(B,I,P,T,x,6,a[52]),T=A(T,B,I,P,p,10,a[53]),P=A(P,T,B,I,w,15,a[54]),I=A(I,P,T,B,l,21,a[55]),B=A(B,I,P,T,v,6,a[56]),T=A(T,B,I,P,S,10,a[57]),P=A(P,T,B,I,y,15,a[58]),I=A(I,P,T,B,E,21,a[59]),B=A(B,I,P,T,d,6,a[60]),T=A(T,B,I,P,b,10,a[61]),P=A(P,T,B,I,f,15,a[62]),I=A(I,P,T,B,_,21,a[63]),o[0]=o[0]+B|0,o[1]=o[1]+I|0,o[2]=o[2]+P|0,o[3]=o[3]+T|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;r[i>>>5]|=128<<24-i%32;var o=e.floor(n/4294967296),s=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),t.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,l=a.words,u=0;u<4;u++){var h=l[u];l[u]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}return a},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});function u(t,e,r,n,i,o,s){var a=t+(e&r|~e&n)+i+s;return(a<<o|a>>>32-o)+e}function h(t,e,r,n,i,o,s){var a=t+(e&n|r&~n)+i+s;return(a<<o|a>>>32-o)+e}function c(t,e,r,n,i,o,s){var a=t+(e^r^n)+i+s;return(a<<o|a>>>32-o)+e}function A(t,e,r,n,i,o,s){var a=t+(r^(e|~n))+i+s;return(a<<o|a>>>32-o)+e}r.MD5=o._createHelper(l),r.HmacMD5=o._createHmacHelper(l)}(Math),t.MD5)),EU;var t}(),MU(),LU||(LU=1,RU.exports=(OU=gU(),MU(),void(OU.lib.Cipher||function(t){var e=OU,r=e.lib,n=r.Base,i=r.WordArray,o=r.BufferedBlockAlgorithm,s=e.enc;s.Utf8;var a=s.Base64,l=e.algo.EvpKDF,u=r.Cipher=o.extend({cfg:n.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,r){this.cfg=this.cfg.extend(r),this._xformMode=t,this._key=e,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?m:g}return function(e){return{encrypt:function(r,n,i){return t(n).encrypt(e,r,n,i)},decrypt:function(r,n,i){return t(n).decrypt(e,r,n,i)}}}}()});r.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var h=e.mode={},c=r.BlockCipherMode=n.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),A=h.CBC=function(){var e=c.extend();function r(e,r,n){var i,o=this._iv;o?(i=o,this._iv=t):i=this._prevBlock;for(var s=0;s<n;s++)e[r+s]^=i[s]}return e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize;r.call(this,t,e,i),n.encryptBlock(t,e),this._prevBlock=t.slice(e,e+i)}}),e.Decryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,o=t.slice(e,e+i);n.decryptBlock(t,e),r.call(this,t,e,i),this._prevBlock=o}}),e}(),f=(e.pad={}).Pkcs7={pad:function(t,e){for(var r=4*e,n=r-t.sigBytes%r,o=n<<24|n<<16|n<<8|n,s=[],a=0;a<n;a+=4)s.push(o);var l=i.create(s,n);t.concat(l)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}};r.BlockCipher=u.extend({cfg:u.cfg.extend({mode:A,padding:f}),reset:function(){var t;u.reset.call(this);var e=this.cfg,r=e.iv,n=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=n.createEncryptor:(t=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,r&&r.words):(this._mode=t.call(n,this,r&&r.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4});var p=r.CipherParams=n.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),d=(e.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,r=t.salt;return(r?i.create([1398893684,1701076831]).concat(r).concat(e):e).toString(a)},parse:function(t){var e,r=a.parse(t),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(e=i.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),p.create({ciphertext:r,salt:e})}},g=r.SerializableCipher=n.extend({cfg:n.extend({format:d}),encrypt:function(t,e,r,n){n=this.cfg.extend(n);var i=t.createEncryptor(r,n),o=i.finalize(e),s=i.cfg;return p.create({ciphertext:o,key:r,iv:s.iv,algorithm:t,mode:s.mode,padding:s.padding,blockSize:t.blockSize,formatter:n.format})},decrypt:function(t,e,r,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),t.createDecryptor(r,n).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),y=(e.kdf={}).OpenSSL={execute:function(t,e,r,n){n||(n=i.random(8));var o=l.create({keySize:e+r}).compute(t,n),s=i.create(o.words.slice(e),4*r);return o.sigBytes=4*e,p.create({key:o,iv:s,salt:n})}},m=r.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(t,e,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,t.keySize,t.ivSize);n.iv=i.iv;var o=g.encrypt.call(this,t,e,i.key,n);return o.mixIn(i),o},decrypt:function(t,e,r,n){n=this.cfg.extend(n),e=this._parse(e,n.format);var i=n.kdf.execute(r,t.keySize,t.ivSize,e.salt);return n.iv=i.iv,g.decrypt.call(this,t,e,i.key,n)}})}()))));var kU={};({get exports(){return kU},set exports(t){kU=t}}).exports=gU().enc.Utf8;const UU=r({__proto__:null,default:kU},[kU]);class DU{constructor(){}getMessage(){}getInfo(t){try{let n=JSON.parse(this.Decrypt1(t));if(n.showlog="%c"+n.name+"%c \n\n"+n.version+"\n"+n.EndUser+"\n"+n.Copyright+"\n授权截止:"+n.expirationDate+"\n\n"+n.ContactUs,n.expirationDate)var e=new Date;var r=n.expirationDate;return r=r.replace("-","/"),e>(r=new Date(Date.parse(r)))?"授权已过期":n}catch{return"获取授权失败"}}Encrypt1(t){return hU.encrypt(t,"apple3D").toString()}Decrypt1(t){return hU.decrypt(t,"apple3D").toString(UU)}}class GU extends gm{constructor(){super(),e(this,"_map"),e(this,"contextmenuitems"),e(this,"contextmenu"),e(this,"EventType"),this._map=null,this.contextmenuitems=[],this.contextmenu=null,this.EventType=Dm}initContextmenu(){this.contextmenu=new Nm({id:"contextmenu",width:150,defaultItems:!0,items:this.contextmenuitems}),this.contextmenu&&(this.contextmenu.set("id","contextmenu"),this._map&&(this._map.addControl(this.contextmenu),this.contextmenu.on("beforeopen",(t=>{if(this._map){let e=this._map.forEachFeatureAtPixel(t.pixel,(function(t,e){return t}));this.contextmenu.clear(),e?null!=e.get("featuretype")&&"量测图层"!=e.get("featuretype")||this.contextmenu.extend([{text:"定位到",icon:"img/marker.png",callback:t=>{this._map&&this._map.getView().setCenter(t.data.Center)},data:{Center:t.coordinate}}]):this.contextmenuitems.forEach((e=>{e.data={e:t}}))}})),this.contextmenu.on("open",(t=>{if(this._map){t.coordinate;let r=!1;if(this._map.getOverlays().forEach((e=>{let n=e.getElement();if(n&&"none"!==n.style.display){let i=t.pixel,o=n.getBoundingClientRect();o.left<=i[0]&&i[0]<=o.right&&o.top<=i[1]&&i[1]<=o.bottom&&(r=!0,e.dispatchEvent({type:this.EventType.featureType.onFeatureContextmenu,data:{contextmenu:this.contextmenu}}))}})),!r){var e=this._map.forEachFeatureAtPixel(t.pixel,(function(t,e){return{feature:t,layer:e}}));e?e.layer&&e.layer.dispatchEvent({type:this.EventType.featureType.onFeatureContextmenu,data:{feature:e.feature,layer:e.layer,contextmenu:this.contextmenu}}):this.trigger(this.EventType.XMapEventType.onMapContextmenu,t)}}}))))}}class QU extends aU{constructor(t,r){super(t,r),e(this,"projection"),this.layertype="TileXyzLayer",this.projection=this.option.projection,"GCJ02"==r.chinaCRS&&this.setGCJ02(),this.layerSource=new FO({url:r.url,crossOrigin:"Anonymous",projection:this.projection}),this.layer=new Vf({zIndex:r.zIndex,source:this.layerSource,useInterimTilesOnError:!1}),this.layer.set("layerid",t),this.mImageExtent&&this.layer.setExtent(dr(this.mImageExtent,"EPSG:4326","EPSG:3857")),this.layerSource.on("tileloadstart",(function(){})),this.layerSource.on("tileloadend",(function(){})),this.layerSource.on("tileloaderror",(function(){}))}setGCJ02(){const t=new se({code:"GCJ02",extent:[-20037508.342789244,-20037508.342789244,20037508.342789244,20037508.342789244],units:"m"});this.projection=t,rr(t);var e=function(t){return function(e,r,n){var i,o=e.length,s=n||2;i=r||(2!==s?e.slice():new Array(o));for(var a=0;a<o;a+=s)t(e,i,a);return i}},r={},n=Math.PI,i=6378245,o=.006693421622965943;function s(t,e){var r,s,a,l=(a=2*(r=t-105)-100+3*(s=e-35)+.2*s*s+.1*r*s+.2*Math.sqrt(Math.abs(r)),a+=2*(20*Math.sin(6*r*n)+20*Math.sin(2*r*n))/3,a+=2*(20*Math.sin(s*n)+40*Math.sin(s/3*n))/3,a+=2*(160*Math.sin(s/12*n)+320*Math.sin(s*n/30))/3),u=function(t,e){var r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*n)+20*Math.sin(2*t*n))/3,(r+=2*(20*Math.sin(t*n)+40*Math.sin(t/3*n))/3)+2*(150*Math.sin(t/12*n)+300*Math.sin(t/30*n))/3}(t-105,e-35),h=e/180*n,c=Math.sin(h);c=1-o*c*c;var A=Math.sqrt(c);return l=180*l/(i*(1-o)/(c*A)*n),[u=180*u/(i/A*Math.cos(h)*n),l]}function a(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271}r.toWGS84=e((function(t,e,r){var n=t[r],i=t[r+1];if(!a(n,i)){var o=s(n,i);n-=o[0],i-=o[1]}e[r]=n,e[r+1]=i})),r.fromWGS84=e((function(t,e,r){var n=t[r],i=t[r+1];if(!a(n,i)){var o=s(n,i);n+=o[0],i+=o[1]}e[r]=n,e[r+1]=i}));var l={},u=6378137,h=Math.PI/180;l.forward=e((function(t,e,r){var n=Math.max(Math.min(85.0511287798,t[r+1]),-85.0511287798),i=Math.sin(n*h);e[r]=u*t[r]*h,e[r+1]=u*Math.log((1+i)/(1-i))/2})),l.inverse=e((function(t,e,r){e[r]=t[r]/u/h,e[r+1]=(2*Math.atan(Math.exp(t[r+1]/u))-Math.PI/2)/h}));var c={ll2gmerc:function(t,e,n){let i=r.fromWGS84(t,e,n);return c.ll2smerc(i,i,n)},gmerc2ll:function(t,e,n){let i=c.smerc2ll(t,t,n);return r.toWGS84(i,e,n)},smerc2gmerc:function(t,e,n){let i=c.smerc2ll(t,t,n);return i=r.fromWGS84(i,i,n),c.ll2smerc(i,i,n)},gmerc2smerc:function(t,e,n){let i=c.smerc2ll(t,t,n);return i=r.toWGS84(i,i,n),c.ll2smerc(i,i,n)}};c.ll2smerc=l.forward,c.smerc2ll=l.inverse,lr("EPSG:4326",t,c.ll2gmerc,c.gmerc2ll),lr("EPSG:3857",t,c.smerc2gmerc,c.gmerc2smerc)}}class jU extends QU{constructor(t,e){super(t,e),this.layertype="TileTencentLayer",this.layerSource.setTileUrlFunction((function(t){let r=e.url,n=t[1],i=(1<<t[0])-t[2]-1,o=t[0],s=t[1]>>4,a=(1<<t[0])-t[2]-1>>4;if(e.subdomains&&r.indexOf("{s}")>0){let t=e.subdomains.split(",");r=r.replace("{s}",t[Math.floor(Math.random()*t.length)])}return r.replaceAll("{x}",n.toString()).replace("{ry}",i.toString()).replace("{z}",o.toString()).replace("{sx}",s.toString()).replace("{sy}",a.toString())}))}}var HU={},zU={},VU={},KU=function(t){return function(e,r,n){var i,o=e.length,s=n||2;i=r||(2!==s?e.slice():new Array(o));for(var a=0;a<o;a+=s)t(e,i,a);return i}},qU=KU,WU=[12890594.86,8362377.87,5591021,3481989.83,1678043.12,0],XU=[75,60,45,30,15,0],YU=[[1.410526172116255e-8,898305509648872e-20,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,17337981.2],[-7.435856389565537e-9,8983055097726239e-21,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,10260144.86],[-3.030883460898826e-8,898305509983578e-20,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,6856817.37],[-1.981981304930552e-8,8983055099779535e-21,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,4482777.06],[3.09191371068437e-9,8983055096812155e-21,6995724062e-14,23.10934304144901,-.00023663490511,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,2555164.4],[2.890871144776878e-9,8983055095805407e-21,-3.068298e-8,7.47137025468032,-353937994e-14,-.02145144861037,-1234426596e-14,.00010322952773,-323890364e-14,826088.5]],ZU=[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[.0008277824516172526,111320.7020463578,647795574.6671607,-4082003173.641316,10774905663.51142,-15171875531.51559,12053065338.62167,-5124939663.577472,913311935.9512032,67.5],[.00337398766765,111320.7020202162,4481351.045890365,-23393751.19931662,79682215.47186455,-115964993.2797253,97236711.15602145,-43661946.33752821,8477230.501135234,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837.749470245,992013.7397791013,-1221952.21711287,1340652.697009075,-620943.6990984312,144416.9293806241,37.5],[-.0003441963504368392,111320.7020576856,278.2353980772752,2485758.690035394,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,22.5],[-.0003218135878613132,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]];function JU(t,e,r,n){var i=t[r],o=t[r+1],s=n[0]+n[1]*Math.abs(i),a=Math.abs(o)/n[9],l=n[2]+n[3]*a+n[4]*a*a+n[5]*a*a*a+n[6]*a*a*a*a+n[7]*a*a*a*a*a+n[8]*a*a*a*a*a*a;e[r]=s*(i<0?-1:1),e[r+1]=l*(o<0?-1:1)}VU.forward=qU((function(t,e,r){var n,i,o=function(t,e,r){for(;t>180;)t-=360;for(;t<-180;)t+=360;return t}(t[r]),s=(n=t[r+1],n=Math.max(n,-74),Math.min(n,74)),a=null;for(i=0;i<XU.length;++i)if(s>=XU[i]){a=ZU[i];break}if(null===a)for(i=XU.length-1;i>=0;--i)if(s<=-XU[i]){a=ZU[i];break}e[r]=o,e[r+1]=s,JU(e,e,r,a)})),VU.inverse=qU((function(t,e,r){for(var n=Math.abs(t[r+1]),i=null,o=0;o<WU.length;o++)if(n>=WU[o]){i=YU[o];break}JU(t,e,r,i)}));var $U={},tD=KU,eD=6378137,rD=85.0511287798,nD=Math.PI/180;$U.forward=tD((function(t,e,r){var n=Math.max(Math.min(rD,t[r+1]),-rD),i=Math.sin(n*nD);e[r]=eD*t[r]*nD,e[r+1]=eD*Math.log((1+i)/(1-i))/2})),$U.inverse=tD((function(t,e,r){e[r]=t[r]/eD/nD,e[r+1]=(2*Math.atan(Math.exp(t[r+1]/eD))-Math.PI/2)/nD})),zU.baiduMercator=VU,zU.sphericalMercator=$U;var iD={},oD={},sD={},aD=KU,lD=Math.PI,uD=6378245,hD=.006693421622965943;function cD(t,e){var r,n,i,o=(i=2*(r=t-105)-100+3*(n=e-35)+.2*n*n+.1*r*n+.2*Math.sqrt(Math.abs(r)),i+=2*(20*Math.sin(6*r*lD)+20*Math.sin(2*r*lD))/3,i+=2*(20*Math.sin(n*lD)+40*Math.sin(n/3*lD))/3,i+=2*(160*Math.sin(n/12*lD)+320*Math.sin(n*lD/30))/3),s=function(t,e){var r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*lD)+20*Math.sin(2*t*lD))/3,(r+=2*(20*Math.sin(t*lD)+40*Math.sin(t/3*lD))/3)+2*(150*Math.sin(t/12*lD)+300*Math.sin(t/30*lD))/3}(t-105,e-35),a=e/180*lD,l=Math.sin(a);l=1-hD*l*l;var u=Math.sqrt(l);return o=180*o/(uD*(1-hD)/(l*u)*lD),[s=180*s/(uD/u*Math.cos(a)*lD),o]}function AD(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271}sD.toWGS84=aD((function(t,e,r){var n=t[r],i=t[r+1];if(!AD(n,i)){var o=cD(n,i);n-=o[0],i-=o[1]}e[r]=n,e[r+1]=i})),sD.fromWGS84=aD((function(t,e,r){var n=t[r],i=t[r+1];if(!AD(n,i)){var o=cD(n,i);n+=o[0],i+=o[1]}e[r]=n,e[r+1]=i}));var fD=KU,pD=sD,dD=3e3*Math.PI/180,gD=oD.toGCJ02=fD((function(t,e,r){var n=t[r]-.0065,i=t[r+1]-.006,o=Math.sqrt(n*n+i*i)-2e-5*Math.sin(i*dD),s=Math.atan2(i,n)-3e-6*Math.cos(n*dD);return e[r]=o*Math.cos(s),e[r+1]=o*Math.sin(s),e})),yD=oD.fromGCJ02=fD((function(t,e,r){var n=t[r],i=t[r+1],o=Math.sqrt(n*n+i*i)+2e-5*Math.sin(i*dD),s=Math.atan2(i,n)+3e-6*Math.cos(n*dD);return e[r]=o*Math.cos(s)+.0065,e[r+1]=o*Math.sin(s)+.006,e}));oD.toWGS84=function(t,e,r){var n=gD(t,e,r);return pD.toWGS84(n,n,r)},oD.fromWGS84=function(t,e,r){var n=pD.fromWGS84(t,e,r);return yD(n,n,r)},iD.bd09=oD,iD.gcj02=sD;var mD=zU,vD=iD;HU.smerc2bmerc=function(t,e,r){var n=mD.sphericalMercator.inverse(t,e,r);return n=vD.bd09.fromWGS84(n,n,r),mD.baiduMercator.forward(n,n,r)},HU.bmerc2smerc=function(t,e,r){var n=mD.baiduMercator.inverse(t,e,r);return n=vD.bd09.toWGS84(n,n,r),mD.sphericalMercator.forward(n,n,r)},HU.bmerc2ll=function(t,e,r){var n=mD.baiduMercator.inverse(t,e,r);return vD.bd09.toWGS84(n,n,r)},HU.ll2bmerc=function(t,e,r){var n=vD.bd09.fromWGS84(t,e,r);return mD.baiduMercator.forward(n,n,r)},HU.ll2smerc=mD.sphericalMercator.forward,HU.smerc2ll=mD.sphericalMercator.inverse,HU.datum=vD,HU.projection=mD;class _D extends aU{constructor(t,e){super(t,e),this.layertype="TileBaiDuLayer";let r=[-20037725.11268234,-19994619.55417086,20037725.11268234,19994619.55417086],n=new se({code:"baidu",extent:ne(r,HU.ll2bmerc),units:"m"});rr(n),lr("EPSG:4326",n,HU.ll2bmerc,HU.bmerc2ll),lr("EPSG:3857",n,HU.smerc2bmerc,HU.bmerc2smerc);let i=new Array(19);for(let s=0;s<19;++s)i[s]=Math.pow(2,18-s);var o=new lf({resolutions:i,origin:[0,0],extent:ne(r,HU.ll2bmerc),tileSize:[256,256]});this.layerSource=new Qf({projection:"baidu",tileGrid:o,tileUrlFunction:function(t,r,n){let i=e.url;if(e.subdomains&&i.indexOf("{s}")>0){let t=e.subdomains.split(",");i=i.replace("{s}",t[Math.floor(Math.random()*t.length)])}let o=t[0],s=t[1],a=-1-t[2];return i.replaceAll("{z}",o.toString()).replaceAll("{x}",s.toString()).replaceAll("{y}",a.toString())}}),this.layer=new Vf({zIndex:e.zIndex,source:this.layerSource,useInterimTilesOnError:!1}),this.layer.set("layerid",t)}}class wD extends aU{constructor(t,e){super(t,e),this.layertype="TileGroupLayer";let r=[];e.layers.forEach((t=>{"xyz"==t.type?r.push(new QU(t.name,t).layer):"tencent"==t.type?r.push(new jU(t.name,t).layer):"baidu"==t.type&&r.push(new _D(t.name,t).layer)})),this.layer=new ka({layers:r}),this.layer.set("layerid",t)}}class bD extends aU{constructor(t,e){super(t,e),this.layertype="imageLayer",this.layerSource=new Hk({url:this.option.url,projection:this.option.projection,imageExtent:this.mImageExtent}),this.layer=new Wc({source:this.layerSource,opacity:this.option.opacity}),this.layer.set("layerid",t),this.layerSource.on("tileloadstart",(function(t){})),this.layerSource.on("tileloadend",(function(t){})),this.layerSource.on("tileloaderror",(function(t){}))}}
85
+ ***************************************************************************** */var AS=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function fS(t,e){return t>e?1:t<e?-1:0}function pS(t,e,r){for(var n=new AS(null,null),i=n,o=n;;){var s=r(t,e.key);if(s<0){if(null===e.left)break;if(r(t,e.left.key)<0){var a=e.left;if(e.left=a.right,a.right=e,null===(e=a).left)break}o.left=e,o=e,e=e.left}else{if(!(s>0))break;if(null===e.right)break;if(r(t,e.right.key)>0&&(a=e.right,e.right=a.left,a.left=e,null===(e=a).right))break;i.right=e,i=e,e=e.right}}return i.right=e.left,o.left=e.right,e.left=n.right,e.right=n.left,e}function dS(t,e,r,n){var i=new AS(t,e);if(null===r)return i.left=i.right=null,i;var o=n(t,(r=pS(t,r,n)).key);return o<0?(i.left=r.left,i.right=r,r.left=null):o>=0&&(i.right=r.right,i.left=r,r.right=null),i}function gS(t,e,r){var n=null,i=null;if(e){var o=r((e=pS(t,e,r)).key,t);0===o?(n=e.left,i=e.right):o<0?(i=e.right,e.right=null,n=e):(n=e.left,e.left=null,i=e)}return{left:n,right:i}}function yS(t,e,r,n,i){if(t){n(e+(r?"└── ":"├── ")+i(t)+"\n");var o=e+(r?" ":"│ ");t.left&&yS(t.left,o,!1,n,i),t.right&&yS(t.right,o,!0,n,i)}}var mS=function(){function t(t){void 0===t&&(t=fS),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=dS(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var r=new AS(t,e);null===this._root&&(r.left=r.right=null,this._size++,this._root=r);var n=this._comparator,i=pS(t,this._root,n),o=n(t,i.key);return 0===o?this._root=i:(o<0?(r.left=i.left,r.right=i,i.left=null):o>0&&(r.right=i.right,r.left=i,i.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,r){var n;return null===e?null:0===r(t,(e=pS(t,e,r)).key)?(null===e.left?n=e.right:(n=pS(t,e.left,r)).right=e.right,this._size--,n):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=pS(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.prototype.findStatic=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return e;e=n<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=pS(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.prototype.contains=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return!0;e=n<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){for(var r=this._root,n=[],i=!1;!i;)null!==r?(n.push(r),r=r.left):0!==n.length?(r=n.pop(),t.call(e,r),r=r.right):i=!0;return this},t.prototype.range=function(t,e,r,n){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&r.call(n,s))return this;s=s.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var r=e.key;return t.push(r)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var r=e.data;return t.push(r)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},t.prototype.at=function(t){for(var e=this._root,r=!1,n=0,i=[];!r;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),n===t)return e;n++,e=e.right}else r=!0;return null},t.prototype.next=function(t){var e=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?(r=e,e=e.left):e=e.right}return r},t.prototype.prev=function(t){var e=this._root,r=null;if(null!==t.left){for(r=t.left;r.right;)r=r.right;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?e=e.left:(r=e,e=e.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){for(var e=t,r=[],n=!1,i=new AS(null,null),o=i;!n;)e?(r.push(e),e=e.left):r.length>0?e=(e=o=o.next=r.pop()).right:n=!0;return o.next=null,i.next}(this._root)},t.prototype.load=function(t,e,r){void 0===e&&(e=[]),void 0===r&&(r=!1);var n=t.length,i=this._comparator;if(r&&wS(t,e,0,n-1,i),null===this._root)this._root=vS(t,e,0,n),this._size=n;else{var o=function(t,e,r){for(var n=new AS(null,null),i=n,o=t,s=e;null!==o&&null!==s;)r(o.key,s.key)<0?(i.next=o,o=o.next):(i.next=s,s=s.next),i=i.next;return null!==o?i.next=o:null!==s&&(i.next=s),n.next}(this.toList(),function(t,e){for(var r=new AS(null,null),n=r,i=0;i<t.length;i++)n=n.next=new AS(t[i],e[i]);return n.next=null,r.next}(t,e),i);n=this._size+n,this._root=_S({head:o},0,n)}return this},t.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return yS(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},t.prototype.update=function(t,e,r){var n=this._comparator,i=gS(t,this._root,n),o=i.left,s=i.right;n(t,e)<0?s=dS(e,r,s,n):o=dS(e,r,o,n),this._root=function(t,e,r){return null===e?t:(null===t||((e=pS(t.key,e,r)).left=t),e)}(o,s,n)},t.prototype.split=function(t){return gS(t,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var t;return function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(dX){o=[6,dX],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}(this,(function(e){switch(e.label){case 0:t=this.minNode(),e.label=1;case 1:return t?[4,t]:[3,3];case 2:return e.sent(),t=this.next(t),[3,1];case 3:return[2]}}))},t}();function vS(t,e,r,n){var i=n-r;if(i>0){var o=r+Math.floor(i/2),s=t[o],a=e[o],l=new AS(s,a);return l.left=vS(t,e,r,o),l.right=vS(t,e,o+1,n),l}return null}function _S(t,e,r){var n=r-e;if(n>0){var i=e+Math.floor(n/2),o=_S(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=_S(t,i+1,r),s}return null}function wS(t,e,r,n,i){if(!(r>=n)){for(var o=t[r+n>>1],s=r-1,a=n+1;;){do{s++}while(i(t[s],o)<0);do{a--}while(i(t[a],o)>0);if(s>=a)break;var l=t[s];t[s]=t[a],t[a]=l,l=e[s],e[s]=e[a],e[a]=l}wS(t,e,r,a,i),wS(t,e,a+1,n,i)}}function bS(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xS(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ES(t,e,r){return e&&xS(t.prototype,e),r&&xS(t,r),t}var CS=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},SS=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var r=t.ll.x<e.ll.x?e.ll.x:t.ll.x,n=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:r,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:n,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},BS=Number.EPSILON;void 0===BS&&(BS=Math.pow(2,-52));var IS=BS*BS,PS=function(t,e){if(-BS<t&&t<BS&&-BS<e&&e<BS)return 0;var r=t-e;return r*r<IS*t*e?0:t<e?-1:1},TS=function(){function t(){bS(this,t),this.reset()}return ES(t,[{key:"reset",value:function(){this.xRounder=new FS,this.yRounder=new FS}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),t}(),FS=function(){function t(){bS(this,t),this.tree=new mS,this.round(0)}return ES(t,[{key:"round",value:function(t){var e=this.tree.add(t),r=this.tree.prev(e);if(null!==r&&0===PS(e.key,r.key))return this.tree.remove(t),r.key;var n=this.tree.next(e);return null!==n&&0===PS(e.key,n.key)?(this.tree.remove(t),n.key):t}}]),t}(),MS=new TS,LS=function(t,e){return t.x*e.y-t.y*e.x},OS=function(t,e){return t.x*e.x+t.y*e.y},NS=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y},o=LS(n,i);return PS(o,0)},RS=function(t){return Math.sqrt(OS(t,t))},kS=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y};return OS(i,n)/RS(i)/RS(n)},US=function(t,e,r){return 0===e.y?null:{x:t.x+e.x/e.y*(r-t.y),y:r}},DS=function(t,e,r){return 0===e.x?null:{x:r,y:t.y+e.y/e.x*(r-t.x)}},GS=function(){function t(e,r){bS(this,t),void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return ES(t,null,[{key:"compare",value:function(e,r){var n=t.comparePoints(e.point,r.point);return 0!==n?n:(e.point!==r.point&&e.link(r),e.isLeft!==r.isLeft?e.isLeft?1:-1:jS.compare(e.segment,r.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),ES(t,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,r=0,n=e.length;r<n;r++){var i=e[r];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var r=this.point.events[e];if(void 0===r.segment.consumedBy)for(var n=e+1;n<t;n++){var i=this.point.events[n];void 0===i.consumedBy&&r.otherSE.point.events===i.otherSE.point.events&&r.segment.consume(i.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,r=this.point.events.length;e<r;e++){var n=this.point.events[e];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&t.push(n)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,r=new Map,n=function(n){var i,o,s,a,l,u=n.otherSE;r.set(n,{sine:(i=e.point,o=t.point,s=u.point,a={x:o.x-i.x,y:o.y-i.y},l={x:s.x-i.x,y:s.y-i.y},LS(l,a)/RS(l)/RS(a)),cosine:kS(e.point,t.point,u.point)})};return function(t,e){r.has(t)||n(t),r.has(e)||n(e);var i=r.get(t),o=i.sine,s=i.cosine,a=r.get(e),l=a.sine,u=a.cosine;return o>=0&&l>=0?s<u?1:s>u?-1:0:o<0&&l<0?s<u?-1:s>u?1:0:l<o?-1:l>o?1:0}}}]),t}(),QS=0,jS=function(){function t(e,r,n,i){bS(this,t),this.id=++QS,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=n,this.windings=i}return ES(t,null,[{key:"compare",value:function(t,e){var r=t.leftSE.point.x,n=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<r)return 1;if(i<n)return-1;var s=t.leftSE.point.y,a=e.leftSE.point.y,l=t.rightSE.point.y,u=e.rightSE.point.y;if(r<n){if(a<s&&a<l)return 1;if(a>s&&a>l)return-1;var h=t.comparePoint(e.leftSE.point);if(h<0)return 1;if(h>0)return-1;var c=e.comparePoint(t.rightSE.point);return 0!==c?c:-1}if(r>n){if(s<a&&s<u)return-1;if(s>a&&s>u)return 1;var A=e.comparePoint(t.leftSE.point);if(0!==A)return A;var f=t.comparePoint(e.rightSE.point);return f<0?1:f>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){var p=e.comparePoint(t.rightSE.point);if(0!==p)return p}if(i>o){var d=t.comparePoint(e.rightSE.point);if(d<0)return 1;if(d>0)return-1}if(i!==o){var g=l-s,y=i-r,m=u-a,v=o-n;if(g>y&&m<v)return 1;if(g<y&&m>v)return-1}return i>o?1:i<o||l<u?-1:l>u?1:t.id<e.id?-1:t.id>e.id?1:0}}]),ES(t,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var 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}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(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}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,r=this.rightSE.point,n=this.vector();if(e.x===r.x)return t.x===e.x?0:t.x<e.x?1:-1;var i=(t.y-e.y)/n.y,o=e.x+i*n.x;if(t.x===o)return 0;var s=(t.x-e.x)/n.x,a=e.y+s*n.y;return t.y===a?0:t.y<a?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),r=t.bbox(),n=SS(e,r);if(null===n)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,l=CS(e,s)&&0===this.comparePoint(s),u=CS(r,i)&&0===t.comparePoint(i),h=CS(e,a)&&0===this.comparePoint(a),c=CS(r,o)&&0===t.comparePoint(o);if(u&&l)return c&&!h?o:!c&&h?a:null;if(u)return h&&i.x===a.x&&i.y===a.y?null:i;if(l)return c&&o.x===s.x&&o.y===s.y?null:s;if(c&&h)return null;if(c)return o;if(h)return a;var A=function(t,e,r,n){if(0===e.x)return DS(r,n,t.x);if(0===n.x)return DS(t,e,r.x);if(0===e.y)return US(r,n,t.y);if(0===n.y)return US(t,e,r.y);var i=LS(e,n);if(0==i)return null;var o={x:r.x-t.x,y:r.y-t.y},s=LS(o,e)/i,a=LS(o,n)/i;return{x:(t.x+a*e.x+(r.x+s*n.x))/2,y:(t.y+a*e.y+(r.y+s*n.y))/2}}(i,this.vector(),s,t.vector());return null===A?null:CS(n,A)?MS.round(A.x,A.y):null}},{key:"split",value:function(e){var r=[],n=void 0!==e.events,i=new GS(e,!0),o=new GS(e,!1),s=this.rightSE;this.replaceRightSE(o),r.push(o),r.push(i);var a=new t(i,s,this.rings.slice(),this.windings.slice());return GS.comparePoints(a.leftSE.point,a.rightSE.point)>0&&a.swapEvents(),GS.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),r}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,r=this.windings.length;e<r;e++)this.windings[e]*=-1}},{key:"consume",value:function(e){for(var r=this,n=e;r.consumedBy;)r=r.consumedBy;for(;n.consumedBy;)n=n.consumedBy;var i=t.compare(r,n);if(0!==i){if(i>0){var o=r;r=n,n=o}if(r.prev===n){var s=r;r=n,n=s}for(var a=0,l=n.rings.length;a<l;a++){var u=n.rings[a],h=n.windings[a],c=r.rings.indexOf(u);-1===c?(r.rings.push(u),r.windings.push(h)):r.windings[c]+=h}n.rings=null,n.windings=null,n.consumedBy=r,n.leftSE.consumedBy=r.leftSE,n.rightSE.consumedBy=r.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,r=this._afterState.windings,n=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],a=this.windings[i],l=e.indexOf(s);-1===l?(e.push(s),r.push(a)):r[l]+=a}for(var u=[],h=[],c=0,A=e.length;c<A;c++)if(0!==r[c]){var f=e[c],p=f.poly;if(-1===h.indexOf(p))if(f.isExterior)u.push(p);else{-1===h.indexOf(p)&&h.push(p);var d=u.indexOf(f.poly);-1!==d&&u.splice(d,1)}}for(var g=0,y=u.length;g<y;g++){var m=u[g].multiPoly;-1===n.indexOf(m)&&n.push(m)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch($S.type){case"union":var r=0===t.length,n=0===e.length;this._isInResult=r!==n;break;case"intersection":var i,o;t.length<e.length?(i=t.length,o=e.length):(i=e.length,o=t.length),this._isInResult=o===$S.numMultiPolys&&i<o;break;case"xor":var s=Math.abs(t.length-e.length);this._isInResult=s%2==1;break;case"difference":var a=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=a(t)!==a(e);break;default:throw new Error("Unrecognized operation type found ".concat($S.type))}return this._isInResult}}],[{key:"fromRing",value:function(e,r,n){var i,o,s,a=GS.comparePoints(e,r);if(a<0)i=e,o=r,s=1;else{if(!(a>0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));i=r,o=e,s=-1}return new t(new GS(i,!0),new GS(o,!1),[n],[s])}}]),t}(),HS=function(){function t(e,r,n){if(bS(this,t),!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=n,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=MS.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,s=1,a=e.length;s<a;s++){if("number"!=typeof e[s][0]||"number"!=typeof e[s][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var l=MS.round(e[s][0],e[s][1]);l.x===o.x&&l.y===o.y||(this.segments.push(jS.fromRing(o,l,this)),l.x<this.bbox.ll.x&&(this.bbox.ll.x=l.x),l.y<this.bbox.ll.y&&(this.bbox.ll.y=l.y),l.x>this.bbox.ur.x&&(this.bbox.ur.x=l.x),l.y>this.bbox.ur.y&&(this.bbox.ur.y=l.y),o=l)}i.x===o.x&&i.y===o.y||this.segments.push(jS.fromRing(o,i,this))}return ES(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.segments.length;e<r;e++){var n=this.segments[e];t.push(n.leftSE),t.push(n.rightSE)}return t}}]),t}(),zS=function(){function t(e,r){if(bS(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new HS(e[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(var n=1,i=e.length;n<i;n++){var o=new HS(e[n],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=r}return ES(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,r=this.interiorRings.length;e<r;e++)for(var n=this.interiorRings[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),VS=function(){function t(e,r){if(bS(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof e[0][0][0]&&(e=[e])}catch(s){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var n=0,i=e.length;n<i;n++){var o=new zS(e[n],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=r}return ES(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++)for(var n=this.polys[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),KS=function(){function t(e){bS(this,t),this.events=e;for(var r=0,n=e.length;r<n;r++)e[r].segment.ringOut=this;this.poly=null}return ES(t,null,[{key:"factory",value:function(e){for(var r=[],n=0,i=e.length;n<i;n++){var o=e[n];if(o.isInResult()&&!o.ringOut){for(var s=null,a=o.leftSE,l=o.rightSE,u=[a],h=a.point,c=[];s=a,a=l,u.push(a),a.point!==h;)for(;;){var A=a.getAvailableLinkedEvents();if(0===A.length){var f=u[0].point,p=u[u.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(f.x,",")+" ".concat(f.y,"]. Last matching segment found ends at")+" [".concat(p.x,", ").concat(p.y,"]."))}if(1===A.length){l=A[0].otherSE;break}for(var d=null,g=0,y=c.length;g<y;g++)if(c[g].point===a.point){d=g;break}if(null===d){c.push({index:u.length,point:a.point});var m=a.getLeftmostComparator(s);l=A.sort(m)[0].otherSE;break}var v=c.splice(d)[0],_=u.splice(v.index);_.unshift(_[0].otherSE),r.push(new t(_.reverse()))}r.push(new t(u))}}return r}}]),ES(t,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],r=1,n=this.events.length-1;r<n;r++){var i=this.events[r].point,o=this.events[r+1].point;0!==NS(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],a=e[1];0===NS(s,t,a)&&e.shift(),e.push(e[0]);for(var l=this.isExteriorRing()?1:-1,u=this.isExteriorRing()?0:e.length-1,h=this.isExteriorRing()?e.length:-1,c=[],A=u;A!=h;A+=l)c.push([e[A].x,e[A].y]);return c}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,r=this.events.length;e<r;e++){var n=this.events[e];GS.compare(t,n)>0&&(t=n)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),t}(),qS=function(){function t(e){bS(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return ES(t,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,r=this.interiorRings.length;e<r;e++){var n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}}]),t}(),WS=function(){function t(e){bS(this,t),this.rings=e,this.polys=this._composePolys(e)}return ES(t,[{key:"getGeom",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++){var n=this.polys[e].getGeom();null!==n&&t.push(n)}return t}},{key:"_composePolys",value:function(t){for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r];if(!i.poly)if(i.isExteriorRing())e.push(new qS(i));else{var o=i.enclosingRing();o.poly||e.push(new qS(o)),o.poly.addInterior(i)}}return e}}]),t}(),XS=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jS.compare;bS(this,t),this.queue=e,this.tree=new mS(r),this.segments=[]}return ES(t,[{key:"process",value:function(t){var e=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),r;var n=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!n)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=n,o=n,s=void 0,a=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===a;)null===(o=this.tree.next(o))?a=null:void 0===o.key.consumedBy&&(a=o.key);if(t.isLeft){var l=null;if(s){var u=s.getIntersection(e);if(null!==u&&(e.isAnEndpoint(u)||(l=u),!s.isAnEndpoint(u)))for(var h=this._splitSafely(s,u),c=0,A=h.length;c<A;c++)r.push(h[c])}var f=null;if(a){var p=a.getIntersection(e);if(null!==p&&(e.isAnEndpoint(p)||(f=p),!a.isAnEndpoint(p)))for(var d=this._splitSafely(a,p),g=0,y=d.length;g<y;g++)r.push(d[g])}if(null!==l||null!==f){var m;m=null===l?f:null===f||GS.comparePoints(l,f)<=0?l:f,this.queue.remove(e.rightSE),r.push(e.rightSE);for(var v=e.split(m),_=0,w=v.length;_<w;_++)r.push(v[_])}r.length>0?(this.tree.remove(e),r.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&a){var b=s.getIntersection(a);if(null!==b){if(!s.isAnEndpoint(b))for(var x=this._splitSafely(s,b),E=0,C=x.length;E<C;E++)r.push(x[E]);if(!a.isAnEndpoint(b))for(var S=this._splitSafely(a,b),B=0,I=S.length;B<I;B++)r.push(S[B])}}this.tree.remove(e)}return r}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var r=t.rightSE;this.queue.remove(r);var n=t.split(e);return n.push(r),void 0===t.consumedBy&&this.tree.insert(t),n}}]),t}(),YS="undefined"!=typeof process&&{}.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,ZS="undefined"!=typeof process&&{}.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,JS=function(){function t(){bS(this,t)}return ES(t,[{key:"run",value:function(t,e,r){$S.type=t,MS.reset();for(var n=[new VS(e,!0)],i=0,o=r.length;i<o;i++)n.push(new VS(r[i],!1));if($S.numMultiPolys=n.length,"difference"===$S.type)for(var s=n[0],a=1;a<n.length;)null!==SS(n[a].bbox,s.bbox)?a++:n.splice(a,1);if("intersection"===$S.type)for(var l=0,u=n.length;l<u;l++)for(var h=n[l],c=l+1,A=n.length;c<A;c++)if(null===SS(h.bbox,n[c].bbox))return[];for(var f=new mS(GS.compare),p=0,d=n.length;p<d;p++)for(var g=n[p].getSweepEvents(),y=0,m=g.length;y<m;y++)if(f.insert(g[y]),f.size>YS)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var v=new XS(f),_=f.size,w=f.pop();w;){var b=w.key;if(f.size===_){var x=b.segment;throw new Error("Unable to pop() ".concat(b.isLeft?"left":"right"," SweepEvent ")+"[".concat(b.point.x,", ").concat(b.point.y,"] from segment #").concat(x.id," ")+"[".concat(x.leftSE.point.x,", ").concat(x.leftSE.point.y,"] -> ")+"[".concat(x.rightSE.point.x,", ").concat(x.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(f.size>YS)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(v.segments.length>ZS)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var E=v.process(b),C=0,S=E.length;C<S;C++){var B=E[C];void 0===B.consumedBy&&f.insert(B)}_=f.size,w=f.pop()}MS.reset();var I=KS.factory(v.segments);return new WS(I).getGeom()}}]),t}(),$S=new JS;const tB={union:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return $S.run("union",t,r)},intersection:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return $S.run("intersection",t,r)},xor:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return $S.run("xor",t,r)},difference:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return $S.run("difference",t,r)}};"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(null==this)throw new TypeError(this+" is not an object");var e=Object(this),r=Math.max(Math.min(e.length,9007199254740991),0)||0,n=1 in arguments&&parseInt(Number(arguments[1]),10)||0;n=n<0?Math.max(r+n,0):Math.min(n,r);var i=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:r;for(i=i<0?Math.max(r+arguments[2],0):Math.min(i,r);n<i;)e[n]=t,++n;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};var eB=function(){};eB.prototype.interfaces_=function(){return[]},eB.prototype.getClass=function(){return eB},eB.prototype.equalsWithTolerance=function(t,e,r){return Math.abs(t-e)<=r};var rB=function(t){function e(e){t.call(this,e),this.name="IllegalArgumentException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),nB=function(){},iB={MAX_VALUE:{configurable:!0}};nB.isNaN=function(t){return Number.isNaN(t)},nB.doubleToLongBits=function(t){return t},nB.longBitsToDouble=function(t){return t},nB.isInfinite=function(t){return!Number.isFinite(t)},iB.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(nB,iB);var oB=function(){},sB=function(){},aB=function(){};function lB(){}var uB=function t(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)this.x=0,this.y=0,this.z=t.NULL_ORDINATE;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.z=e.z}else 2===arguments.length?(this.x=arguments[0],this.y=arguments[1],this.z=t.NULL_ORDINATE):3===arguments.length&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},hB={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};uB.prototype.setOrdinate=function(t,e){switch(t){case uB.X:this.x=e;break;case uB.Y:this.y=e;break;case uB.Z:this.z=e;break;default:throw new rB("Invalid ordinate index: "+t)}},uB.prototype.equals2D=function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!eB.equalsWithTolerance(this.x,e.x,r)&&!!eB.equalsWithTolerance(this.y,e.y,r)}},uB.prototype.getOrdinate=function(t){switch(t){case uB.X:return this.x;case uB.Y:return this.y;case uB.Z:return this.z}throw new rB("Invalid ordinate index: "+t)},uB.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||nB.isNaN(this.z))&&nB.isNaN(t.z)},uB.prototype.equals=function(t){return t instanceof uB&&this.equals2D(t)},uB.prototype.equalInZ=function(t,e){return eB.equalsWithTolerance(this.z,t.z,e)},uB.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},uB.prototype.clone=function(){},uB.prototype.copy=function(){return new uB(this)},uB.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},uB.prototype.distance3D=function(t){var e=this.x-t.x,r=this.y-t.y,n=this.z-t.z;return Math.sqrt(e*e+r*r+n*n)},uB.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},uB.prototype.hashCode=function(){var t=17;return 37*(t=37*t+uB.hashCode(this.x))+uB.hashCode(this.y)},uB.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},uB.prototype.interfaces_=function(){return[oB,sB,lB]},uB.prototype.getClass=function(){return uB},uB.hashCode=function(){if(1===arguments.length){var t=arguments[0],e=nB.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}},hB.DimensionalComparator.get=function(){return cB},hB.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},hB.NULL_ORDINATE.get=function(){return nB.NaN},hB.X.get=function(){return 0},hB.Y.get=function(){return 1},hB.Z.get=function(){return 2},Object.defineProperties(uB,hB);var cB=function(t){if(this._dimensionsToTest=2,0===arguments.length);else if(1===arguments.length){var e=arguments[0];if(2!==e&&3!==e)throw new rB("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};cB.prototype.compare=function(t,e){var r=t,n=e,i=cB.compare(r.x,n.x);if(0!==i)return i;var o=cB.compare(r.y,n.y);return 0!==o?o:this._dimensionsToTest<=2?0:cB.compare(r.z,n.z)},cB.prototype.interfaces_=function(){return[aB]},cB.prototype.getClass=function(){return cB},cB.compare=function(t,e){return t<e?-1:t>e?1:nB.isNaN(t)?nB.isNaN(e)?0:-1:nB.isNaN(e)?1:0};var AB=function(){};AB.prototype.create=function(){},AB.prototype.interfaces_=function(){return[]},AB.prototype.getClass=function(){return AB};var fB=function(){},pB={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};fB.prototype.interfaces_=function(){return[]},fB.prototype.getClass=function(){return fB},fB.toLocationSymbol=function(t){switch(t){case fB.EXTERIOR:return"e";case fB.BOUNDARY:return"b";case fB.INTERIOR:return"i";case fB.NONE:return"-"}throw new rB("Unknown location value: "+t)},pB.INTERIOR.get=function(){return 0},pB.BOUNDARY.get=function(){return 1},pB.EXTERIOR.get=function(){return 2},pB.NONE.get=function(){return-1},Object.defineProperties(fB,pB);var dB=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},gB=function(){},yB={LOG_10:{configurable:!0}};gB.prototype.interfaces_=function(){return[]},gB.prototype.getClass=function(){return gB},gB.log10=function(t){var e=Math.log(t);return nB.isInfinite(e)||nB.isNaN(e)?e:e/gB.LOG_10},gB.min=function(t,e,r,n){var i=t;return e<i&&(i=e),r<i&&(i=r),n<i&&(i=n),i},gB.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],r=arguments[2];return t<e?e:t>r?r:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var n=arguments[0],i=arguments[1],o=arguments[2];return n<i?i:n>o?o:n}},gB.wrap=function(t,e){return t<0?e- -t%e:t%e},gB.max=function(){if(3===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[0];return t>r&&(r=t),e>r&&(r=e),r}if(4===arguments.length){var n=arguments[1],i=arguments[2],o=arguments[3],s=arguments[0];return n>s&&(s=n),i>s&&(s=i),o>s&&(s=o),s}},gB.average=function(t,e){return(t+e)/2},yB.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(gB,yB);var mB=function(t){this.str=t};mB.prototype.append=function(t){this.str+=t},mB.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},mB.prototype.toString=function(t){return this.str};var vB=function(t){this.value=t};vB.prototype.intValue=function(){return this.value},vB.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},vB.isNaN=function(t){return Number.isNaN(t)};var _B=function(){};_B.isWhitespace=function(t){return t<=32&&t>=0||127===t},_B.toUpperCase=function(t){return t.toUpperCase()};var wB=function t(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length)if("number"==typeof arguments[0]){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}else"string"==typeof arguments[0]&&t.call(this,t.parse(arguments[0]));else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n,i)}},bB={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}};wB.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},wB.prototype.extractSignificantDigits=function(t,e){var r=this.abs(),n=wB.magnitude(r._hi),i=wB.TEN.pow(n);(r=r.divide(i)).gt(wB.TEN)?(r=r.divide(wB.TEN),n+=1):r.lt(wB.ONE)&&(r=r.multiply(wB.TEN),n-=1);for(var o=n+1,s=new mB,a=wB.MAX_PRINT_DIGITS-1,l=0;l<=a;l++){t&&l===o&&s.append(".");var u=Math.trunc(r._hi);if(u<0)break;var h=!1,c=0;u>9?(h=!0,c="9"):c="0"+u,s.append(c),r=r.subtract(wB.valueOf(u)).multiply(wB.TEN),h&&r.selfAdd(wB.TEN);var A=!0,f=wB.magnitude(r._hi);if(f<0&&Math.abs(f)>=a-l&&(A=!1),!A)break}return e[0]=n,s.toString()},wB.prototype.sqr=function(){return this.multiply(this)},wB.prototype.doubleValue=function(){return this._hi+this._lo},wB.prototype.subtract=function(){if(arguments[0]instanceof wB){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},wB.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},wB.prototype.isZero=function(){return 0===this._hi&&0===this._lo},wB.prototype.selfSubtract=function(){if(arguments[0]instanceof wB){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},wB.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},wB.prototype.min=function(t){return this.le(t)?this:t},wB.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof wB){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var r,n,i,o,s=arguments[0],a=arguments[1],l=null,u=null,h=null,c=null;return i=this._hi/s,c=(l=(h=wB.SPLIT*i)-(l=h-i))*(u=(c=wB.SPLIT*s)-(u=c-s))-(o=i*s)+l*(n=s-u)+(r=i-l)*u+r*n,c=i+(h=(this._hi-o-c+this._lo-i*a)/s),this._hi=c,this._lo=i-c+h,this}},wB.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},wB.prototype.divide=function(){if(arguments[0]instanceof wB){var t,e,r,n,i=arguments[0],o=null,s=null,a=null,l=null;return t=(r=this._hi/i._hi)-(o=(a=wB.SPLIT*r)-(o=a-r)),l=o*(s=(l=wB.SPLIT*i._hi)-(s=l-i._hi))-(n=r*i._hi)+o*(e=i._hi-s)+t*s+t*e,a=(this._hi-n-l+this._lo-r*i._lo)/i._hi,new wB(l=r+a,r-l+a)}if("number"==typeof arguments[0]){var u=arguments[0];return nB.isNaN(u)?wB.createNaN():wB.copy(this).selfDivide(u,0)}},wB.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},wB.prototype.pow=function(t){if(0===t)return wB.valueOf(1);var e=new wB(this),r=wB.valueOf(1),n=Math.abs(t);if(n>1)for(;n>0;)n%2==1&&r.selfMultiply(e),(n/=2)>0&&(e=e.sqr());else r=e;return t<0?r.reciprocal():r},wB.prototype.ceil=function(){if(this.isNaN())return wB.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new wB(t,e)},wB.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},wB.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},wB.prototype.setValue=function(){if(arguments[0]instanceof wB){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},wB.prototype.max=function(t){return this.ge(t)?this:t},wB.prototype.sqrt=function(){if(this.isZero())return wB.valueOf(0);if(this.isNegative())return wB.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,r=wB.valueOf(e),n=this.subtract(r.sqr())._hi*(.5*t);return r.add(n)},wB.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof wB){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e,r,n,i,o,s=arguments[0],a=null;return a=(n=this._hi+s)-(i=n-this._hi),r=(o=(a=s-i+(this._hi-a))+this._lo)+(n-(e=n+o)),this._hi=e+r,this._lo=r+(e-this._hi),this}}else if(2===arguments.length){var l,u,h,c,A=arguments[0],f=arguments[1],p=null,d=null,g=null;h=this._hi+A,u=this._lo+f,d=h-(g=h-this._hi),p=u-(c=u-this._lo);var y=(l=h+(g=(d=A-g+(this._hi-d))+u))+(g=(p=f-c+(this._lo-p))+(g+(h-l))),m=g+(l-y);return this._hi=y,this._lo=m,this}},wB.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof wB){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var r,n,i=arguments[0],o=arguments[1],s=null,a=null,l=null,u=null;s=(l=wB.SPLIT*this._hi)-this._hi,u=wB.SPLIT*i,s=l-s,r=this._hi-s,a=u-i;var h=(l=this._hi*i)+(u=s*(a=u-a)-l+s*(n=i-a)+r*a+r*n+(this._hi*o+this._lo*i)),c=u+(s=l-h);return this._hi=h,this._lo=c,this}},wB.prototype.selfSqr=function(){return this.selfMultiply(this)},wB.prototype.floor=function(){if(this.isNaN())return wB.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new wB(t,e)},wB.prototype.negate=function(){return this.isNaN()?this:new wB(-this._hi,-this._lo)},wB.prototype.clone=function(){},wB.prototype.multiply=function(){if(arguments[0]instanceof wB){var t=arguments[0];return t.isNaN()?wB.createNaN():wB.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return nB.isNaN(e)?wB.createNaN():wB.copy(this).selfMultiply(e,0)}},wB.prototype.isNaN=function(){return nB.isNaN(this._hi)},wB.prototype.intValue=function(){return Math.trunc(this._hi)},wB.prototype.toString=function(){var t=wB.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},wB.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!0,e),n=e[0]+1,i=r;if("."===r.charAt(0))i="0"+r;else if(n<0)i="0."+wB.stringOfChar("0",-n)+r;else if(-1===r.indexOf(".")){var o=n-r.length;i=r+wB.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},wB.prototype.reciprocal=function(){var t,e,r,n,i=null,o=null,s=null,a=null;t=(r=1/this._hi)-(i=(s=wB.SPLIT*r)-(i=s-r)),o=(a=wB.SPLIT*this._hi)-this._hi;var l=r+(s=(1-(n=r*this._hi)-(a=i*(o=a-o)-n+i*(e=this._hi-o)+t*o+t*e)-r*this._lo)/this._hi);return new wB(l,r-l+s)},wB.prototype.toSciNotation=function(){if(this.isZero())return wB.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!1,e),n=wB.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===r.charAt(0))throw new Error("Found leading zero: "+r);var i="";r.length>1&&(i=r.substring(1));var o=r.charAt(0)+"."+i;return this.isNegative()?"-"+o+n:o+n},wB.prototype.abs=function(){return this.isNaN()?wB.NaN:this.isNegative()?this.negate():new wB(this)},wB.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},wB.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},wB.prototype.add=function(){if(arguments[0]instanceof wB){var t=arguments[0];return wB.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return wB.copy(this).selfAdd(e)}},wB.prototype.init=function(){if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof wB){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._hi=r,this._lo=n}},wB.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},wB.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},wB.prototype.trunc=function(){return this.isNaN()?wB.NaN:this.isPositive()?this.floor():this.ceil()},wB.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},wB.prototype.interfaces_=function(){return[lB,oB,sB]},wB.prototype.getClass=function(){return wB},wB.sqr=function(t){return wB.valueOf(t).selfMultiply(t)},wB.valueOf=function(){if("string"==typeof arguments[0]){var t=arguments[0];return wB.parse(t)}if("number"==typeof arguments[0])return new wB(arguments[0])},wB.sqrt=function(t){return wB.valueOf(t).sqrt()},wB.parse=function(t){for(var e=0,r=t.length;_B.isWhitespace(t.charAt(e));)e++;var n=!1;if(e<r){var i=t.charAt(e);"-"!==i&&"+"!==i||(e++,"-"===i&&(n=!0))}for(var o=new wB,s=0,a=0,l=0;!(e>=r);){var u=t.charAt(e);if(e++,_B.isDigit(u)){var h=u-"0";o.selfMultiply(wB.TEN),o.selfAdd(h),s++}else{if("."!==u){if("e"===u||"E"===u){var c=t.substring(e);try{l=vB.parseInt(c)}catch(g){throw g instanceof Error?new Error("Invalid exponent "+c+" in string "+t):g}break}throw new Error("Unexpected character '"+u+"' at position "+e+" in string "+t)}a=s}}var A=o,f=s-a-l;if(0===f)A=o;else if(f>0){var p=wB.TEN.pow(f);A=o.divide(p)}else if(f<0){var d=wB.TEN.pow(-f);A=o.multiply(d)}return n?A.negate():A},wB.createNaN=function(){return new wB(nB.NaN,nB.NaN)},wB.copy=function(t){return new wB(t)},wB.magnitude=function(t){var e=Math.abs(t),r=Math.log(e)/Math.log(10),n=Math.trunc(Math.floor(r));return 10*Math.pow(10,n)<=e&&(n+=1),n},wB.stringOfChar=function(t,e){for(var r=new mB,n=0;n<e;n++)r.append(t);return r.toString()},bB.PI.get=function(){return new wB(3.141592653589793,12246467991473532e-32)},bB.TWO_PI.get=function(){return new wB(6.283185307179586,24492935982947064e-32)},bB.PI_2.get=function(){return new wB(1.5707963267948966,6123233995736766e-32)},bB.E.get=function(){return new wB(2.718281828459045,14456468917292502e-32)},bB.NaN.get=function(){return new wB(nB.NaN,nB.NaN)},bB.EPS.get=function(){return 123259516440783e-46},bB.SPLIT.get=function(){return 134217729},bB.MAX_PRINT_DIGITS.get=function(){return 32},bB.TEN.get=function(){return wB.valueOf(10)},bB.ONE.get=function(){return wB.valueOf(1)},bB.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},bB.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(wB,bB);var xB=function(){},EB={DP_SAFE_EPSILON:{configurable:!0}};xB.prototype.interfaces_=function(){return[]},xB.prototype.getClass=function(){return xB},xB.orientationIndex=function(t,e,r){var n=xB.orientationIndexFilter(t,e,r);if(n<=1)return n;var i=wB.valueOf(e.x).selfAdd(-t.x),o=wB.valueOf(e.y).selfAdd(-t.y),s=wB.valueOf(r.x).selfAdd(-e.x),a=wB.valueOf(r.y).selfAdd(-e.y);return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},xB.signOfDet2x2=function(t,e,r,n){return t.multiply(n).selfSubtract(e.multiply(r)).signum()},xB.intersection=function(t,e,r,n){var i=wB.valueOf(n.y).selfSubtract(r.y).selfMultiply(wB.valueOf(e.x).selfSubtract(t.x)),o=wB.valueOf(n.x).selfSubtract(r.x).selfMultiply(wB.valueOf(e.y).selfSubtract(t.y)),s=i.subtract(o),a=wB.valueOf(n.x).selfSubtract(r.x).selfMultiply(wB.valueOf(t.y).selfSubtract(r.y)),l=wB.valueOf(n.y).selfSubtract(r.y).selfMultiply(wB.valueOf(t.x).selfSubtract(r.x)),u=a.subtract(l).selfDivide(s).doubleValue(),h=wB.valueOf(t.x).selfAdd(wB.valueOf(e.x).selfSubtract(t.x).selfMultiply(u)).doubleValue(),c=wB.valueOf(e.x).selfSubtract(t.x).selfMultiply(wB.valueOf(t.y).selfSubtract(r.y)),A=wB.valueOf(e.y).selfSubtract(t.y).selfMultiply(wB.valueOf(t.x).selfSubtract(r.x)),f=c.subtract(A).selfDivide(s).doubleValue(),p=wB.valueOf(r.y).selfAdd(wB.valueOf(n.y).selfSubtract(r.y).selfMultiply(f)).doubleValue();return new uB(h,p)},xB.orientationIndexFilter=function(t,e,r){var n=null,i=(t.x-r.x)*(e.y-r.y),o=(t.y-r.y)*(e.x-r.x),s=i-o;if(i>0){if(o<=0)return xB.signum(s);n=i+o}else{if(!(i<0))return xB.signum(s);if(o>=0)return xB.signum(s);n=-i-o}var a=xB.DP_SAFE_EPSILON*n;return s>=a||-s>=a?xB.signum(s):2},xB.signum=function(t){return t>0?1:t<0?-1:0},EB.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(xB,EB);var CB=function(){},SB={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};SB.X.get=function(){return 0},SB.Y.get=function(){return 1},SB.Z.get=function(){return 2},SB.M.get=function(){return 3},CB.prototype.setOrdinate=function(t,e,r){},CB.prototype.size=function(){},CB.prototype.getOrdinate=function(t,e){},CB.prototype.getCoordinate=function(){},CB.prototype.getCoordinateCopy=function(t){},CB.prototype.getDimension=function(){},CB.prototype.getX=function(t){},CB.prototype.clone=function(){},CB.prototype.expandEnvelope=function(t){},CB.prototype.copy=function(){},CB.prototype.getY=function(t){},CB.prototype.toCoordinateArray=function(){},CB.prototype.interfaces_=function(){return[sB]},CB.prototype.getClass=function(){return CB},Object.defineProperties(CB,SB);var BB=function(){},IB=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(BB),PB=function(){};PB.arraycopy=function(t,e,r,n,i){for(var o=0,s=e;s<e+i;s++)r[n+o]=t[s],o++},PB.getProperty=function(t){return{"line.separator":"\n"}[t]};var TB=function t(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this.x=r,this.y=n,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var i=arguments[0],o=arguments[1];this.x=i.y*o.w-o.y*i.w,this.y=o.x*i.w-i.x*o.w,this.w=i.x*o.y-o.x*i.y}else if(arguments[0]instanceof uB&&arguments[1]instanceof uB){var s=arguments[0],a=arguments[1];this.x=s.y-a.y,this.y=a.x-s.x,this.w=s.x*a.y-a.x*s.y}}else if(3===arguments.length){var l=arguments[0],u=arguments[1],h=arguments[2];this.x=l,this.y=u,this.w=h}else if(4===arguments.length){var c=arguments[0],A=arguments[1],f=arguments[2],p=arguments[3],d=c.y-A.y,g=A.x-c.x,y=c.x*A.y-A.x*c.y,m=f.y-p.y,v=p.x-f.x,_=f.x*p.y-p.x*f.y;this.x=g*_-v*y,this.y=m*y-d*_,this.w=d*v-m*g}};TB.prototype.getY=function(){var t=this.y/this.w;if(nB.isNaN(t)||nB.isInfinite(t))throw new IB;return t},TB.prototype.getX=function(){var t=this.x/this.w;if(nB.isNaN(t)||nB.isInfinite(t))throw new IB;return t},TB.prototype.getCoordinate=function(){var t=new uB;return t.x=this.getX(),t.y=this.getY(),t},TB.prototype.interfaces_=function(){return[]},TB.prototype.getClass=function(){return TB},TB.intersection=function(t,e,r,n){var i=t.y-e.y,o=e.x-t.x,s=t.x*e.y-e.x*t.y,a=r.y-n.y,l=n.x-r.x,u=r.x*n.y-n.x*r.y,h=i*l-a*o,c=(o*u-l*s)/h,A=(a*s-i*u)/h;if(nB.isNaN(c)||nB.isInfinite(c)||nB.isNaN(A)||nB.isInfinite(A))throw new IB;return new uB(c,A)};var FB=function t(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof uB){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(4===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2],l=arguments[3];this.init(o,s,a,l)}},MB={serialVersionUID:{configurable:!0}};FB.prototype.getArea=function(){return this.getWidth()*this.getHeight()},FB.prototype.equals=function(t){if(!(t instanceof FB))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()},FB.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new FB;var e=this._minx>t._minx?this._minx:t._minx,r=this._miny>t._miny?this._miny:t._miny,n=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new FB(e,n,r,i)},FB.prototype.isNull=function(){return this._maxx<this._minx},FB.prototype.getMaxX=function(){return this._maxx},FB.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof uB){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof FB){var e=arguments[0];return!this.isNull()&&!e.isNull()&&e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&r>=this._minx&&r<=this._maxx&&n>=this._miny&&n<=this._maxy}},FB.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof FB){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof uB){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&!(r>this._maxx||r<this._minx||n>this._maxy||n<this._miny)}},FB.prototype.getMinY=function(){return this._miny},FB.prototype.getMinX=function(){return this._minx},FB.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof uB){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof FB){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(2===arguments.length){var r=arguments[0],n=arguments[1];this.isNull()?(this._minx=r,this._maxx=r,this._miny=n,this._maxy=n):(r<this._minx&&(this._minx=r),r>this._maxx&&(this._maxx=r),n<this._miny&&(this._miny=n),n>this._maxy&&(this._maxy=n))}},FB.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},FB.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},FB.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},FB.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},FB.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},FB.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},FB.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},FB.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},FB.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=r,this._maxy+=r,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},FB.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof FB){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof uB){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.covers(r,n)}},FB.prototype.centre=function(){return this.isNull()?null:new uB((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},FB.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof uB){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof FB){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.init(r.x,n.x,r.y,n.y)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];i<o?(this._minx=i,this._maxx=o):(this._minx=o,this._maxx=i),s<a?(this._miny=s,this._maxy=a):(this._miny=a,this._maxy=s)}},FB.prototype.getMaxY=function(){return this._maxy},FB.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 r=0;return this._maxy<t._miny?r=t._miny-this._maxy:this._miny>t._maxy&&(r=this._miny-t._maxy),0===e?r:0===r?e:Math.sqrt(e*e+r*r)},FB.prototype.hashCode=function(){var t=17;return 37*(t=37*(t=37*(t=37*t+uB.hashCode(this._minx))+uB.hashCode(this._maxx))+uB.hashCode(this._miny))+uB.hashCode(this._maxy)},FB.prototype.interfaces_=function(){return[oB,lB]},FB.prototype.getClass=function(){return FB},FB.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2];return r.x>=(t.x<e.x?t.x:e.x)&&r.x<=(t.x>e.x?t.x:e.x)&&r.y>=(t.y<e.y?t.y:e.y)&&r.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),l=Math.max(o.x,s.x),u=Math.min(n.x,i.x),h=Math.max(n.x,i.x);return!(u>l||h<a||(a=Math.min(o.y,s.y),l=Math.max(o.y,s.y),u=Math.min(n.y,i.y),h=Math.max(n.y,i.y),u>l||h<a))}},MB.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(FB,MB);var LB={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*$/},OB=function(t){this.geometryFactory=t||new _P};OB.prototype.read=function(t){var e,r,n;t=t.replace(/[\n\r]/g," ");var i=LB.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((i=LB.emptyTypeStr.exec(t))[2]=void 0),i&&(r=i[1].toLowerCase(),n=i[2],RB[r]&&(e=RB[r].apply(this,[n]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},OB.prototype.write=function(t){return this.extractGeometry(t)},OB.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!NB[e])return null;var r=e.toUpperCase();return t.isEmpty()?r+" EMPTY":r+"("+NB[e].apply(this,[t])+")"};var NB={coordinate:function(t){return t.x+" "+t.y},point:function(t){return NB.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+NB.point.apply(this,[t._geometries[r]])+")");return e.join(",")},linestring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(NB.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},linearring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(NB.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},multilinestring:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+NB.linestring.apply(this,[t._geometries[r]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+NB.linestring.apply(this,[t._shell])+")");for(var r=0,n=t._holes.length;r<n;++r)e.push("("+NB.linestring.apply(this,[t._holes[r]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+NB.polygon.apply(this,[t._geometries[r]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push(this.extractGeometry(t._geometries[r]));return e.join(",")}},RB={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(LB.spaces);return this.geometryFactory.createPoint(new uB(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPoint();for(var r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(LB.trimParens,"$1"),n.push(RB.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(n)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(LB.spaces),n.push(new uB(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(n)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(LB.spaces),n.push(new uB(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(n)},multilinestring:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiLineString();for(var r=t.trim().split(LB.parenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(LB.trimParens,"$1"),n.push(RB.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(n)},polygon:function(t){var e,r,n;if(void 0===t)return this.geometryFactory.createPolygon();for(var i,o=t.trim().split(LB.parenComma),s=[],a=0,l=o.length;a<l;++a)e=o[a].replace(LB.trimParens,"$1"),r=RB.linestring.apply(this,[e]),n=this.geometryFactory.createLinearRing(r._points),0===a?i=n:s.push(n);return this.geometryFactory.createPolygon(i,s)},multipolygon:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var r=t.trim().split(LB.doubleParenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(LB.trimParens,"$1"),n.push(RB.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(n)},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection();for(var e=(t=t.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),r=[],n=0,i=e.length;n<i;++n)r.push(this.read(e[n]));return this.geometryFactory.createGeometryCollection(r)}},kB=function(t){this.parser=new OB(t)};kB.prototype.write=function(t){return this.parser.write(t)},kB.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var UB=function(t){function e(e){t.call(this,e),this.name="RuntimeException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),DB=function(t){function e(){if(t.call(this),0===arguments.length)t.call(this);else if(1===arguments.length){var e=arguments[0];t.call(this,e)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(UB),GB=function(){};GB.prototype.interfaces_=function(){return[]},GB.prototype.getClass=function(){return GB},GB.shouldNeverReachHere=function(){if(0===arguments.length)GB.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new DB("Should never reach here"+(null!==t?": "+t:""))}},GB.isTrue=function(){var t,e;if(1===arguments.length)t=arguments[0],GB.isTrue(t,null);else if(2===arguments.length&&(e=arguments[1],!(t=arguments[0])))throw null===e?new DB:new DB(e)},GB.equals=function(){var t,e,r;if(2===arguments.length)t=arguments[0],e=arguments[1],GB.equals(t,e,null);else if(3===arguments.length&&(t=arguments[0],r=arguments[2],!(e=arguments[1]).equals(t)))throw new DB("Expected "+t+" but encountered "+e+(null!==r?": "+r:""))};var QB=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 uB,this._intPt[1]=new uB,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},jB={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};QB.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},QB.prototype.getTopologySummary=function(){var t=new mB;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},QB.prototype.computeIntersection=function(t,e,r,n){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=r,this._inputLines[1][1]=n,this._result=this.computeIntersect(t,e,r,n)},QB.prototype.getIntersectionNum=function(){return this._result},QB.prototype.computeIntLineIndex=function(){if(0===arguments.length)null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){var t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},QB.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},QB.prototype.setPrecisionModel=function(t){this._precisionModel=t},QB.prototype.isInteriorIntersection=function(){var t=this;if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var e=arguments[0],r=0;r<this._result;r++)if(!t._intPt[r].equals2D(t._inputLines[e][0])&&!t._intPt[r].equals2D(t._inputLines[e][1]))return!0;return!1}},QB.prototype.getIntersection=function(t){return this._intPt[t]},QB.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},QB.prototype.hasIntersection=function(){return this._result!==QB.NO_INTERSECTION},QB.prototype.getEdgeDistance=function(t,e){return QB.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},QB.prototype.isCollinear=function(){return this._result===QB.COLLINEAR_INTERSECTION},QB.prototype.toString=function(){return kB.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+kB.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},QB.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},QB.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},QB.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},QB.prototype.interfaces_=function(){return[]},QB.prototype.getClass=function(){return QB},QB.computeEdgeDistance=function(t,e,r){var n=Math.abs(r.x-e.x),i=Math.abs(r.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(r))o=n>i?n:i;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=n>i?s:a)||t.equals(e)||(o=Math.max(s,a))}return GB.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},QB.nonRobustComputeEdgeDistance=function(t,e,r){var n=t.x-e.x,i=t.y-e.y,o=Math.sqrt(n*n+i*i);return GB.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},jB.DONT_INTERSECT.get=function(){return 0},jB.DO_INTERSECT.get=function(){return 1},jB.COLLINEAR.get=function(){return 2},jB.NO_INTERSECTION.get=function(){return 0},jB.POINT_INTERSECTION.get=function(){return 1},jB.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(QB,jB);var HB=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(t){var e=new FB(this._inputLines[0][0],this._inputLines[0][1]),r=new FB(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&r.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],r=arguments[1],n=arguments[2];if(this._isProper=!1,FB.intersects(r,n,e)&&0===KB.orientationIndex(r,n,e)&&0===KB.orientationIndex(n,r,e))return this._isProper=!0,(e.equals(r)||e.equals(n))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(t,e,r,n,i){i.x=this.smallestInAbsValue(t.x,e.x,r.x,n.x),i.y=this.smallestInAbsValue(t.y,e.y,r.y,n.y),t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.safeHCoordinateIntersection=function(t,r,n,i){var o=null;try{o=TB.intersection(t,r,n,i)}catch(dX){if(!(dX instanceof IB))throw dX;o=e.nearestEndpoint(t,r,n,i)}return o},e.prototype.intersection=function(t,r,n,i){var o=this.intersectionWithNormalization(t,r,n,i);return this.isInSegmentEnvelopes(o)||(o=new uB(e.nearestEndpoint(t,r,n,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,r,n){var i=t,o=Math.abs(i);return Math.abs(e)<o&&(i=e,o=Math.abs(e)),Math.abs(r)<o&&(i=r,o=Math.abs(r)),Math.abs(n)<o&&(i=n),i},e.prototype.checkDD=function(t,e,r,n,i){var o=xB.intersection(t,e,r,n),s=this.isInSegmentEnvelopes(o);PB.out.println("DD in env = "+s+" --------------------- "+o),i.distance(o)>1e-4&&PB.out.println("Distance = "+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,r,n){var i=new uB(t),o=new uB(e),s=new uB(r),a=new uB(n),l=new uB;this.normalizeToEnvCentre(i,o,s,a,l);var u=this.safeHCoordinateIntersection(i,o,s,a);return u.x+=l.x,u.y+=l.y,u},e.prototype.computeCollinearIntersection=function(e,r,n,i){var o=FB.intersects(e,r,n),s=FB.intersects(e,r,i),a=FB.intersects(n,i,e),l=FB.intersects(n,i,r);return o&&s?(this._intPt[0]=n,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):a&&l?(this._intPt[0]=e,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||s||l?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&l?(this._intPt[0]=n,this._intPt[1]=r,!n.equals(r)||s||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||o||l?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&l?(this._intPt[0]=i,this._intPt[1]=r,!i.equals(r)||o||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,r,n,i){var o=t.x<e.x?t.x:e.x,s=t.y<e.y?t.y:e.y,a=t.x>e.x?t.x:e.x,l=t.y>e.y?t.y:e.y,u=r.x<n.x?r.x:n.x,h=r.y<n.y?r.y:n.y,c=r.x>n.x?r.x:n.x,A=r.y>n.y?r.y:n.y,f=((o>u?o:u)+(a<c?a:c))/2,p=((s>h?s:h)+(l<A?l:A))/2;i.x=f,i.y=p,t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.computeIntersect=function(e,r,n,i){if(this._isProper=!1,!FB.intersects(e,r,n,i))return t.NO_INTERSECTION;var o=KB.orientationIndex(e,r,n),s=KB.orientationIndex(e,r,i);if(o>0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=KB.orientationIndex(n,i,e),l=KB.orientationIndex(n,i,r);return a>0&&l>0||a<0&&l<0?t.NO_INTERSECTION:0===o&&0===s&&0===a&&0===l?this.computeCollinearIntersection(e,r,n,i):(0===o||0===s||0===a||0===l?(this._isProper=!1,e.equals2D(n)||e.equals2D(i)?this._intPt[0]=e:r.equals2D(n)||r.equals2D(i)?this._intPt[0]=r:0===o?this._intPt[0]=new uB(n):0===s?this._intPt[0]=new uB(i):0===a?this._intPt[0]=new uB(e):0===l&&(this._intPt[0]=new uB(r))):(this._isProper=!0,this._intPt[0]=this.intersection(e,r,n,i)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,r,n){var i=t,o=KB.distancePointLine(t,r,n),s=KB.distancePointLine(e,r,n);return s<o&&(o=s,i=e),(s=KB.distancePointLine(r,t,e))<o&&(o=s,i=r),(s=KB.distancePointLine(n,t,e))<o&&(o=s,i=n),i},e}(QB),zB=function(){};zB.prototype.interfaces_=function(){return[]},zB.prototype.getClass=function(){return zB},zB.orientationIndex=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=r.x-e.x,s=r.y-e.y;return zB.signOfDet2x2(n,i,o,s)},zB.signOfDet2x2=function(t,e,r,n){var i=null,o=null,s=null;if(i=1,0===t||0===n)return 0===e||0===r?0:e>0?r>0?-i:i:r>0?i:-i;if(0===e||0===r)return n>0?t>0?i:-i:t>0?-i:i;if(e>0?n>0?e<=n||(i=-i,o=t,t=r,r=o,o=e,e=n,n=o):e<=-n?(i=-i,r=-r,n=-n):(o=t,t=-r,r=o,o=e,e=-n,n=o):n>0?-e<=n?(i=-i,t=-t,e=-e):(o=-t,t=r,r=o,o=-e,e=n,n=o):e>=n?(t=-t,e=-e,r=-r,n=-n):(i=-i,o=-t,t=-r,r=o,o=-e,e=-n,n=o),t>0){if(!(r>0))return i;if(!(t<=r))return i}else{if(r>0)return-i;if(!(t>=r))return-i;i=-i,t=-t,r=-r}for(;;){if((n-=(s=Math.floor(r/t))*e)<0)return-i;if(n>e)return i;if(t>(r-=s*t)+r){if(e<n+n)return i}else{if(e>n+n)return-i;r=t-r,n=e-n,i=-i}if(0===n)return 0===r?0:-i;if(0===r)return i;if((e-=(s=Math.floor(t/r))*n)<0)return i;if(e>n)return-i;if(r>(t-=s*r)+t){if(n<e+e)return-i}else{if(n>e+e)return i;t=r-t,e=n-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var VB=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};VB.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 r=t.x,n=e.x;return r>n&&(r=e.x,n=t.x),this._p.x>=r&&this._p.x<=n&&(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 i=t.x-this._p.x,o=t.y-this._p.y,s=e.x-this._p.x,a=e.y-this._p.y,l=zB.signOfDet2x2(i,o,s,a);if(0===l)return this._isPointOnSegment=!0,null;a<o&&(l=-l),l>0&&this._crossingCount++}},VB.prototype.isPointInPolygon=function(){return this.getLocation()!==fB.EXTERIOR},VB.prototype.getLocation=function(){return this._isPointOnSegment?fB.BOUNDARY:this._crossingCount%2==1?fB.INTERIOR:fB.EXTERIOR},VB.prototype.isOnSegment=function(){return this._isPointOnSegment},VB.prototype.interfaces_=function(){return[]},VB.prototype.getClass=function(){return VB},VB.locatePointInRing=function(){if(arguments[0]instanceof uB&&dB(arguments[1],CB)){for(var t=arguments[1],e=new VB(arguments[0]),r=new uB,n=new uB,i=1;i<t.size();i++)if(t.getCoordinate(i,r),t.getCoordinate(i-1,n),e.countSegment(r,n),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof uB&&arguments[1]instanceof Array){for(var o=arguments[1],s=new VB(arguments[0]),a=1;a<o.length;a++){var l=o[a],u=o[a-1];if(s.countSegment(l,u),s.isOnSegment())return s.getLocation()}return s.getLocation()}};var KB=function(){},qB={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};KB.prototype.interfaces_=function(){return[]},KB.prototype.getClass=function(){return KB},KB.orientationIndex=function(t,e,r){return xB.orientationIndex(t,e,r)},KB.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,r=t[0].x,n=1;n<t.length-1;n++){var i=t[n].x-r,o=t[n+1].y;e+=i*(t[n-1].y-o)}return e/2}if(dB(arguments[0],CB)){var s=arguments[0],a=s.size();if(a<3)return 0;var l=new uB,u=new uB,h=new uB;s.getCoordinate(0,u),s.getCoordinate(1,h);var c=u.x;h.x-=c;for(var A=0,f=1;f<a-1;f++)l.y=u.y,u.x=h.x,u.y=h.y,s.getCoordinate(f+1,h),h.x-=c,A+=u.x*(l.y-h.y);return A/2}},KB.distanceLineLine=function(t,e,r,n){if(t.equals(e))return KB.distancePointLine(t,r,n);if(r.equals(n))return KB.distancePointLine(n,t,e);var i=!1;if(FB.intersects(t,e,r,n)){var o=(e.x-t.x)*(n.y-r.y)-(e.y-t.y)*(n.x-r.x);if(0===o)i=!0;else{var s=(t.y-r.y)*(n.x-r.x)-(t.x-r.x)*(n.y-r.y),a=((t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y))/o,l=s/o;(l<0||l>1||a<0||a>1)&&(i=!0)}}else i=!0;return i?gB.min(KB.distancePointLine(t,r,n),KB.distancePointLine(e,r,n),KB.distancePointLine(r,t,e),KB.distancePointLine(n,t,e)):0},KB.isPointInRing=function(t,e){return KB.locatePointInRing(t,e)!==fB.EXTERIOR},KB.computeLength=function(t){var e=t.size();if(e<=1)return 0;var r=0,n=new uB;t.getCoordinate(0,n);for(var i=n.x,o=n.y,s=1;s<e;s++){t.getCoordinate(s,n);var a=n.x,l=n.y,u=a-i,h=l-o;r+=Math.sqrt(u*u+h*h),i=a,o=l}return r},KB.isCCW=function(t){var e=t.length-1;if(e<3)throw new rB("Ring has fewer than 4 points, so orientation cannot be determined");for(var r=t[0],n=0,i=1;i<=e;i++){var o=t[i];o.y>r.y&&(r=o,n=i)}var s=n;do{(s-=1)<0&&(s=e)}while(t[s].equals2D(r)&&s!==n);var a=n;do{a=(a+1)%e}while(t[a].equals2D(r)&&a!==n);var l=t[s],u=t[a];if(l.equals2D(r)||u.equals2D(r)||l.equals2D(u))return!1;var h=KB.computeOrientation(l,r,u);return 0===h?l.x>u.x:h>0},KB.locatePointInRing=function(t,e){return VB.locatePointInRing(t,e)},KB.distancePointLinePerpendicular=function(t,e,r){var n=(r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y),i=((e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y))/n;return Math.abs(i)*Math.sqrt(n)},KB.computeOrientation=function(t,e,r){return KB.orientationIndex(t,e,r)},KB.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new rB("Line array must contain at least one vertex");for(var r=t.distance(e[0]),n=0;n<e.length-1;n++){var i=KB.distancePointLine(t,e[n],e[n+1]);i<r&&(r=i)}return r}if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];if(s.x===a.x&&s.y===a.y)return o.distance(s);var l=(a.x-s.x)*(a.x-s.x)+(a.y-s.y)*(a.y-s.y),u=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/l;if(u<=0)return o.distance(s);if(u>=1)return o.distance(a);var h=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/l;return Math.abs(h)*Math.sqrt(l)}},KB.isOnLine=function(t,e){for(var r=new HB,n=1;n<e.length;n++){var i=e[n-1],o=e[n];if(r.computeIntersection(t,i,o),r.hasIntersection())return!0}return!1},qB.CLOCKWISE.get=function(){return-1},qB.RIGHT.get=function(){return KB.CLOCKWISE},qB.COUNTERCLOCKWISE.get=function(){return 1},qB.LEFT.get=function(){return KB.COUNTERCLOCKWISE},qB.COLLINEAR.get=function(){return 0},qB.STRAIGHT.get=function(){return KB.COLLINEAR},Object.defineProperties(KB,qB);var WB=function(){};WB.prototype.filter=function(t){},WB.prototype.interfaces_=function(){return[]},WB.prototype.getClass=function(){return WB};var XB=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},YB={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}};XB.prototype.isGeometryCollection=function(){return this.getSortIndex()===XB.SORTINDEX_GEOMETRYCOLLECTION},XB.prototype.getFactory=function(){return this._factory},XB.prototype.getGeometryN=function(t){return this},XB.prototype.getArea=function(){return 0},XB.prototype.isRectangle=function(){return!1},XB.prototype.equals=function(){if(arguments[0]instanceof XB){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof XB))return!1;var r=e;return this.equalsExact(r)}},XB.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},XB.prototype.geometryChanged=function(){this.apply(XB.geometryChangedFilter)},XB.prototype.geometryChangedAction=function(){this._envelope=null},XB.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},XB.prototype.getLength=function(){return 0},XB.prototype.getNumGeometries=function(){return 1},XB.prototype.compareTo=function(){if(1===arguments.length){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)}if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.getSortIndex()!==r.getSortIndex()?this.getSortIndex()-r.getSortIndex():this.isEmpty()&&r.isEmpty()?0:this.isEmpty()?-1:r.isEmpty()?1:this.compareToSameClass(r,n)}},XB.prototype.getUserData=function(){return this._userData},XB.prototype.getSRID=function(){return this._SRID},XB.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},XB.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===XB.SORTINDEX_GEOMETRYCOLLECTION)throw new rB("This method does not support GeometryCollection arguments")},XB.prototype.equal=function(t,e,r){return 0===r?t.equals(e):t.distance(e)<=r},XB.prototype.norm=function(){var t=this.copy();return t.normalize(),t},XB.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},XB.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new FB(this._envelope)},XB.prototype.setSRID=function(t){this._SRID=t},XB.prototype.setUserData=function(t){this._userData=t},XB.prototype.compare=function(t,e){for(var r=t.iterator(),n=e.iterator();r.hasNext()&&n.hasNext();){var i=r.next(),o=n.next(),s=i.compareTo(o);if(0!==s)return s}return r.hasNext()?1:n.hasNext()?-1:0},XB.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},XB.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===XB.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===XB.SORTINDEX_MULTIPOINT||this.getSortIndex()===XB.SORTINDEX_MULTILINESTRING||this.getSortIndex()===XB.SORTINDEX_MULTIPOLYGON},XB.prototype.interfaces_=function(){return[sB,oB,lB]},XB.prototype.getClass=function(){return XB},XB.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},XB.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},YB.serialVersionUID.get=function(){return 0x799ea46522854c00},YB.SORTINDEX_POINT.get=function(){return 0},YB.SORTINDEX_MULTIPOINT.get=function(){return 1},YB.SORTINDEX_LINESTRING.get=function(){return 2},YB.SORTINDEX_LINEARRING.get=function(){return 3},YB.SORTINDEX_MULTILINESTRING.get=function(){return 4},YB.SORTINDEX_POLYGON.get=function(){return 5},YB.SORTINDEX_MULTIPOLYGON.get=function(){return 6},YB.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},YB.geometryChangedFilter.get=function(){return ZB},Object.defineProperties(XB,YB);var ZB=function(){};ZB.interfaces_=function(){return[WB]},ZB.filter=function(t){t.geometryChangedAction()};var JB=function(){};JB.prototype.filter=function(t){},JB.prototype.interfaces_=function(){return[]},JB.prototype.getClass=function(){return JB};var $B=function(){},tI={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}};$B.prototype.isInBoundary=function(t){},$B.prototype.interfaces_=function(){return[]},$B.prototype.getClass=function(){return $B},tI.Mod2BoundaryNodeRule.get=function(){return eI},tI.EndPointBoundaryNodeRule.get=function(){return rI},tI.MultiValentEndPointBoundaryNodeRule.get=function(){return nI},tI.MonoValentEndPointBoundaryNodeRule.get=function(){return iI},tI.MOD2_BOUNDARY_RULE.get=function(){return new eI},tI.ENDPOINT_BOUNDARY_RULE.get=function(){return new rI},tI.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new nI},tI.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new iI},tI.OGC_SFS_BOUNDARY_RULE.get=function(){return $B.MOD2_BOUNDARY_RULE},Object.defineProperties($B,tI);var eI=function(){};eI.prototype.isInBoundary=function(t){return t%2==1},eI.prototype.interfaces_=function(){return[$B]},eI.prototype.getClass=function(){return eI};var rI=function(){};rI.prototype.isInBoundary=function(t){return t>0},rI.prototype.interfaces_=function(){return[$B]},rI.prototype.getClass=function(){return rI};var nI=function(){};nI.prototype.isInBoundary=function(t){return t>1},nI.prototype.interfaces_=function(){return[$B]},nI.prototype.getClass=function(){return nI};var iI=function(){};iI.prototype.isInBoundary=function(t){return 1===t},iI.prototype.interfaces_=function(){return[$B]},iI.prototype.getClass=function(){return iI};var oI=function(){};function sI(t){this.message=t||""}oI.prototype.add=function(){},oI.prototype.addAll=function(){},oI.prototype.isEmpty=function(){},oI.prototype.iterator=function(){},oI.prototype.size=function(){},oI.prototype.toArray=function(){},oI.prototype.remove=function(){},sI.prototype=new Error,sI.prototype.name="IndexOutOfBoundsException";var aI=function(){};aI.prototype.hasNext=function(){},aI.prototype.next=function(){},aI.prototype.remove=function(){};var lI=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(oI);function uI(t){this.message=t||""}uI.prototype=new Error,uI.prototype.name="NoSuchElementException";var hI=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof oI&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,oI]},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.set=function(t,e){var r=this.array_[t];return this.array_[t]=e,r},e.prototype.iterator=function(){return new cI(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new sI;return this.array_[t]},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.remove=function(t){for(var e=!1,r=0,n=this.array_.length;r<n;r++)if(this.array_[r]===t){this.array_.splice(r,1),e=!0;break}return e},e}(lI),cI=function(t){function e(e){t.call(this),this.arrayList_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new uI;return this.arrayList_.get(this.position_++)},e.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},e.prototype.set=function(t){return this.arrayList_.set(this.position_-1,t)},e.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},e}(aI),AI=function(t){function e(){if(t.call(this),0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.ensureCapacity(r.length),this.add(r,n)}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={coordArrayType:{configurable:!0}};return r.coordArrayType.get=function(){return new Array(0).fill(null)},e.prototype.getCoordinate=function(t){return this.get(t)},e.prototype.addAll=function(){if(2===arguments.length){for(var e=arguments[1],r=!1,n=arguments[0].iterator();n.hasNext();)this.add(n.next(),e),r=!0;return r}return t.prototype.addAll.apply(this,arguments)},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),r=0;r<this.size();r++)e.add(r,this.get(r).copy());return e},e.prototype.toCoordinateArray=function(){return this.toArray(e.coordArrayType)},e.prototype.add=function(){var e=this;if(1===arguments.length){var r=arguments[0];t.prototype.add.call(this,r)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var n=arguments[0],i=arguments[1];return this.add(n,i,!0),!0}if(arguments[0]instanceof uB&&"boolean"==typeof arguments[1]){var o=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(o))return null;t.prototype.add.call(this,o)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var s=arguments[0],a=arguments[1];return this.add(s,a),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var l=arguments[0],u=arguments[1];if(arguments[2])for(var h=0;h<l.length;h++)e.add(l[h],u);else for(var c=l.length-1;c>=0;c--)e.add(l[c],u);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof uB){var A=arguments[0],f=arguments[1];if(!arguments[2]){var p=this.size();if(p>0){if(A>0&&this.get(A-1).equals2D(f))return null;if(A<p&&this.get(A).equals2D(f))return null}}t.prototype.add.call(this,A,f)}}else if(4===arguments.length){var d=arguments[0],g=arguments[1],y=arguments[2],m=arguments[3],v=1;y>m&&(v=-1);for(var _=y;_!==m;_+=v)e.add(d[_],g);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new uB(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,r),e}(hI),fI=function(){},pI={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};pI.ForwardComparator.get=function(){return dI},pI.BidirectionalComparator.get=function(){return gI},pI.coordArrayType.get=function(){return new Array(0).fill(null)},fI.prototype.interfaces_=function(){return[]},fI.prototype.getClass=function(){return fI},fI.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))},fI.ptNotInList=function(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(fI.indexOf(n,e)<0)return n}return null},fI.scroll=function(t,e){var r=fI.indexOf(e,t);if(r<0)return null;var n=new Array(t.length).fill(null);PB.arraycopy(t,r,n,0,t.length-r),PB.arraycopy(t,0,n,t.length-r,r),PB.arraycopy(n,0,t,0,t.length)},fI.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(!t[r].equals(e[r]))return!1;return!0}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];if(n===i)return!0;if(null===n||null===i)return!1;if(n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(0!==o.compare(n[s],i[s]))return!1;return!0}},fI.intersection=function(t,e){for(var r=new AI,n=0;n<t.length;n++)e.intersects(t[n])&&r.add(t[n],!0);return r.toCoordinateArray()},fI.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},fI.removeRepeatedPoints=function(t){return fI.hasRepeatedPoints(t)?new AI(t,!1).toCoordinateArray():t},fI.reverse=function(t){for(var e=t.length-1,r=Math.trunc(e/2),n=0;n<=r;n++){var i=t[n];t[n]=t[e-n],t[e-n]=i}},fI.removeNull=function(t){for(var e=0,r=0;r<t.length;r++)null!==t[r]&&e++;var n=new Array(e).fill(null);if(0===e)return n;for(var i=0,o=0;o<t.length;o++)null!==t[o]&&(n[i++]=t[o]);return n},fI.copyDeep=function(){if(1===arguments.length){for(var t=arguments[0],e=new Array(t.length).fill(null),r=0;r<t.length;r++)e[r]=new uB(t[r]);return e}if(5===arguments.length)for(var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4],l=0;l<a;l++)o[s+l]=new uB(n[i+l])},fI.isEqualReversed=function(t,e){for(var r=0;r<t.length;r++){var n=t[r],i=e[t.length-r-1];if(0!==n.compareTo(i))return!1}return!0},fI.envelope=function(t){for(var e=new FB,r=0;r<t.length;r++)e.expandToInclude(t[r]);return e},fI.toCoordinateArray=function(t){return t.toArray(fI.coordArrayType)},fI.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},fI.indexOf=function(t,e){for(var r=0;r<e.length;r++)if(t.equals(e[r]))return r;return-1},fI.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var r=t.length-1-e,n=t[e].compareTo(t[r]);if(0!==n)return n}return 1},fI.compare=function(t,e){for(var r=0;r<t.length&&r<e.length;){var n=t[r].compareTo(e[r]);if(0!==n)return n;r++}return r<e.length?-1:r<t.length?1:0},fI.minCoordinate=function(t){for(var e=null,r=0;r<t.length;r++)(null===e||e.compareTo(t[r])>0)&&(e=t[r]);return e},fI.extract=function(t,e,r){e=gB.clamp(e,0,t.length);var n=(r=gB.clamp(r,-1,t.length))-e+1;r<0&&(n=0),e>=t.length&&(n=0),r<e&&(n=0);var i=new Array(n).fill(null);if(0===n)return i;for(var o=0,s=e;s<=r;s++)i[o++]=t[s];return i},Object.defineProperties(fI,pI);var dI=function(){};dI.prototype.compare=function(t,e){var r=t,n=e;return fI.compare(r,n)},dI.prototype.interfaces_=function(){return[aB]},dI.prototype.getClass=function(){return dI};var gI=function(){};gI.prototype.compare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;var i=fI.compare(r,n);return fI.isEqualReversed(r,n)?0:i},gI.prototype.OLDcompare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;for(var i=fI.increasingDirection(r),o=fI.increasingDirection(n),s=i>0?0:r.length-1,a=o>0?0:r.length-1,l=0;l<r.length;l++){var u=r[s].compareTo(n[a]);if(0!==u)return u;s+=i,a+=o}return 0},gI.prototype.interfaces_=function(){return[aB]},gI.prototype.getClass=function(){return gI};var yI=function(){};yI.prototype.get=function(){},yI.prototype.put=function(){},yI.prototype.size=function(){},yI.prototype.values=function(){},yI.prototype.entrySet=function(){};var mI=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(yI);function vI(t){this.message=t||""}function _I(){}vI.prototype=new Error,vI.prototype.name="OperationNotSupported",_I.prototype=new oI,_I.prototype.contains=function(){};var wI=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof oI&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++)if(this.array_[e]===t)return!0;return!1},e.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.remove=function(t){throw new Error},e.prototype.size=function(){return this.array_.length},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.iterator=function(){return new bI(this)},e}(_I),bI=function(t){function e(e){t.call(this),this.hashSet_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new uI;return this.hashSet_.array_[this.position_++]},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new vI},e}(aI),xI=0;function EI(t){return null===t?xI:t.color}function CI(t){return null===t?null:t.parent}function SI(t,e){null!==t&&(t.color=e)}function BI(t){return null===t?null:t.left}function II(t){return null===t?null:t.right}function PI(){this.root_=null,this.size_=0}PI.prototype=new mI,PI.prototype.get=function(t){for(var e=this.root_;null!==e;){var r=t.compareTo(e.key);if(r<0)e=e.left;else{if(!(r>0))return e.value;e=e.right}}return null},PI.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:xI,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var r,n,i=this.root_;do{if(r=i,(n=t.compareTo(i.key))<0)i=i.left;else{if(!(n>0)){var o=i.value;return i.value=e,o}i=i.right}}while(null!==i);var s={key:t,left:null,right:null,value:e,parent:r,color:xI,getValue:function(){return this.value},getKey:function(){return this.key}};return n<0?r.left=s:r.right=s,this.fixAfterInsertion(s),this.size_++,null},PI.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(CI(t)===BI(CI(CI(t)))){var r=II(CI(CI(t)));1===EI(r)?(SI(CI(t),xI),SI(r,xI),SI(CI(CI(t)),1),t=CI(CI(t))):(t===II(CI(t))&&(t=CI(t),e.rotateLeft(t)),SI(CI(t),xI),SI(CI(CI(t)),1),e.rotateRight(CI(CI(t))))}else{var n=BI(CI(CI(t)));1===EI(n)?(SI(CI(t),xI),SI(n,xI),SI(CI(CI(t)),1),t=CI(CI(t))):(t===BI(CI(t))&&(t=CI(t),e.rotateRight(t)),SI(CI(t),xI),SI(CI(CI(t)),1),e.rotateLeft(CI(CI(t))))}this.root_.color=xI},PI.prototype.values=function(){var t=new hI,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=PI.successor(e));)t.add(e.value);return t},PI.prototype.entrySet=function(){var t=new wI,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=PI.successor(e));)t.add(e);return t},PI.prototype.rotateLeft=function(t){if(null!=t){var e=t.right;t.right=e.left,null!=e.left&&(e.left.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}},PI.prototype.rotateRight=function(t){if(null!=t){var e=t.left;t.left=e.right,null!=e.right&&(e.right.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}},PI.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},PI.successor=function(t){if(null===t)return null;if(null!==t.right){for(var e=t.right;null!==e.left;)e=e.left;return e}for(var r=t.parent,n=t;null!==r&&n===r.right;)n=r,r=r.parent;return r},PI.prototype.size=function(){return this.size_};var TI=function(){};function FI(){}function MI(){this.array_=[],arguments[0]instanceof oI&&this.addAll(arguments[0])}TI.prototype.interfaces_=function(){return[]},TI.prototype.getClass=function(){return TI},FI.prototype=new _I,MI.prototype=new FI,MI.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++)if(0===this.array_[e].compareTo(t))return!0;return!1},MI.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,r=this.array_.length;e<r;e++)if(1===this.array_[e].compareTo(t))return this.array_.splice(e,0,t),!0;return this.array_.push(t),!0},MI.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},MI.prototype.remove=function(t){throw new vI},MI.prototype.size=function(){return this.array_.length},MI.prototype.isEmpty=function(){return 0===this.array_.length},MI.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},MI.prototype.iterator=function(){return new LI(this)};var LI=function(t){this.treeSet_=t,this.position_=0};LI.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new uI;return this.treeSet_.array_[this.position_++]},LI.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},LI.prototype.remove=function(){throw new vI};var OI=function(){};OI.sort=function(){var t,e,r,n,i=arguments[0];if(1===arguments.length)n=function(t,e){return t.compareTo(e)},i.sort(n);else if(2===arguments.length)r=arguments[1],n=function(t,e){return r.compare(t,e)},i.sort(n);else if(3===arguments.length){(e=i.slice(arguments[1],arguments[2])).sort();var o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length));for(i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])}else if(4===arguments.length)for(e=i.slice(arguments[1],arguments[2]),r=arguments[3],n=function(t,e){return r.compare(t,e)},e.sort(n),o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length)),i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])},OI.asList=function(t){for(var e=new hI,r=0,n=t.length;r<n;r++)e.add(t[r]);return e};var NI=function(){},RI={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}};RI.P.get=function(){return 0},RI.L.get=function(){return 1},RI.A.get=function(){return 2},RI.FALSE.get=function(){return-1},RI.TRUE.get=function(){return-2},RI.DONTCARE.get=function(){return-3},RI.SYM_FALSE.get=function(){return"F"},RI.SYM_TRUE.get=function(){return"T"},RI.SYM_DONTCARE.get=function(){return"*"},RI.SYM_P.get=function(){return"0"},RI.SYM_L.get=function(){return"1"},RI.SYM_A.get=function(){return"2"},NI.prototype.interfaces_=function(){return[]},NI.prototype.getClass=function(){return NI},NI.toDimensionSymbol=function(t){switch(t){case NI.FALSE:return NI.SYM_FALSE;case NI.TRUE:return NI.SYM_TRUE;case NI.DONTCARE:return NI.SYM_DONTCARE;case NI.P:return NI.SYM_P;case NI.L:return NI.SYM_L;case NI.A:return NI.SYM_A}throw new rB("Unknown dimension value: "+t)},NI.toDimensionValue=function(t){switch(_B.toUpperCase(t)){case NI.SYM_FALSE:return NI.FALSE;case NI.SYM_TRUE:return NI.TRUE;case NI.SYM_DONTCARE:return NI.DONTCARE;case NI.SYM_P:return NI.P;case NI.SYM_L:return NI.L;case NI.SYM_A:return NI.A}throw new rB("Unknown dimension symbol: "+t)},Object.defineProperties(NI,RI);var kI=function(){};kI.prototype.filter=function(t){},kI.prototype.interfaces_=function(){return[]},kI.prototype.getClass=function(){return kI};var UI=function(){};UI.prototype.filter=function(t,e){},UI.prototype.isDone=function(){},UI.prototype.isGeometryChanged=function(){},UI.prototype.interfaces_=function(){return[]},UI.prototype.getClass=function(){return UI};var DI=function(t){function e(e,r){if(t.call(this,r),this._geometries=e||[],t.hasNullElements(this._geometries))throw new rB("geometries must not contain null elements")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var t=new FB,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},e.prototype.getGeometryN=function(t){return this._geometries[t]},e.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},e.prototype.getCoordinates=function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,r=0;r<this._geometries.length;r++)for(var n=this._geometries[r].getCoordinates(),i=0;i<n.length;i++)t[++e]=n[i];return t},e.prototype.getArea=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._geometries.length!==n._geometries.length)return!1;for(var i=0;i<this._geometries.length;i++)if(!this._geometries[i].equalsExact(n._geometries[i],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();OI.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var t=NI.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t},e.prototype.getDimension=function(){for(var t=NI.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},e.prototype.getLength=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},e.prototype.getNumGeometries=function(){return this._geometries.length},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createGeometryCollection(e)},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=new MI(OI.asList(this._geometries)),r=new MI(OI.asList(t._geometries));return this.compare(e,r)}if(2===arguments.length){for(var n=arguments[1],i=arguments[0],o=this.getNumGeometries(),s=i.getNumGeometries(),a=0;a<o&&a<s;){var l=this.getGeometryN(a),u=i.getGeometryN(a),h=l.compareToSameClass(u,n);if(0!==h)return h;a++}return a<o?1:a<s?-1:0}},e.prototype.apply=function(){var t=this;if(dB(arguments[0],JB))for(var e=arguments[0],r=0;r<this._geometries.length;r++)t._geometries[r].apply(e);else if(dB(arguments[0],UI)){var n=arguments[0];if(0===this._geometries.length)return null;for(var i=0;i<this._geometries.length&&(t._geometries[i].apply(n),!n.isDone());i++);n.isGeometryChanged()&&this.geometryChanged()}else if(dB(arguments[0],kI)){var o=arguments[0];o.filter(this);for(var s=0;s<this._geometries.length;s++)t._geometries[s].apply(o)}else if(dB(arguments[0],WB)){var a=arguments[0];a.filter(this);for(var l=0;l<this._geometries.length;l++)t._geometries[l].apply(a)}},e.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),GB.shouldNeverReachHere(),null},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._geometries=new Array(this._geometries.length).fill(null);for(var r=0;r<this._geometries.length;r++)e._geometries[r]=this._geometries[r].clone();return e},e.prototype.getGeometryType=function(){return"GeometryCollection"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.isEmpty=function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(e,r),e}(XB),GI=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return XB.SORTINDEX_MULTILINESTRING},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?NI.FALSE:0},e.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0},e.prototype.getDimension=function(){return 1},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[t-1-r]=this._geometries[r].reverse();return this.getFactory().createMultiLineString(e)},e.prototype.getBoundary=function(){return new QI(this).getBoundary()},e.prototype.getGeometryType=function(){return"MultiLineString"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[TI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(e,r),e}(DI),QI=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0],e=$B.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._geom=r,this._geomFact=r.getFactory(),this._bnRule=n}};QI.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return 1===e.length?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)},QI.prototype.getBoundary=function(){return this._geom instanceof JI?this.boundaryLineString(this._geom):this._geom instanceof GI?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},QI.prototype.boundaryLineString=function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():t.isClosed()?this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},QI.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},QI.prototype.computeBoundaryCoordinates=function(t){var e=this,r=new hI;this._endpointMap=new PI;for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);0!==i.getNumPoints()&&(e.addEndpoint(i.getCoordinateN(0)),e.addEndpoint(i.getCoordinateN(i.getNumPoints()-1)))}for(var o=this._endpointMap.entrySet().iterator();o.hasNext();){var s=o.next(),a=s.getValue().count;e._bnRule.isInBoundary(a)&&r.add(s.getKey())}return fI.toCoordinateArray(r)},QI.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new jI,this._endpointMap.put(t,e)),e.count++},QI.prototype.interfaces_=function(){return[]},QI.prototype.getClass=function(){return QI},QI.getBoundary=function(){return 1===arguments.length?new QI(arguments[0]).getBoundary():2===arguments.length?new QI(arguments[0],arguments[1]).getBoundary():void 0};var jI=function(){this.count=null};function HI(){}function zI(){}jI.prototype.interfaces_=function(){return[]},jI.prototype.getClass=function(){return jI};var VI=function(){};function KI(){}function qI(){}function WI(){}var XI=function(){},YI={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};XI.prototype.interfaces_=function(){return[]},XI.prototype.getClass=function(){return XI},XI.chars=function(t,e){for(var r=new Array(e).fill(null),n=0;n<e;n++)r[n]=t;return String(r)},XI.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new KI,r=new HI;return t.printStackTrace(r),e.toString()}if(2===arguments.length){var n=arguments[0],i=arguments[1],o="";new zI(XI.getStackTrace(n));for(var s=new WI,a=0;a<i;a++)try{o+=s.readLine()+XI.NEWLINE}catch(dX){if(!(dX instanceof qI))throw dX;GB.shouldNeverReachHere()}return o}},XI.split=function(t,e){for(var r=e.length,n=new hI,i=""+t,o=i.indexOf(e);o>=0;){var s=i.substring(0,o);n.add(s),o=(i=i.substring(o+r)).indexOf(e)}i.length>0&&n.add(i);for(var a=new Array(n.size()).fill(null),l=0;l<a.length;l++)a[l]=n.get(l);return a},XI.toString=function(){if(1===arguments.length){var t=arguments[0];return XI.SIMPLE_ORDINATE_FORMAT.format(t)}},XI.spaces=function(t){return XI.chars(" ",t)},YI.NEWLINE.get=function(){return PB.getProperty("line.separator")},YI.SIMPLE_ORDINATE_FORMAT.get=function(){return new VI},Object.defineProperties(XI,YI);var ZI=function(){};ZI.prototype.interfaces_=function(){return[]},ZI.prototype.getClass=function(){return ZI},ZI.copyCoord=function(t,e,r,n){for(var i=Math.min(t.getDimension(),r.getDimension()),o=0;o<i;o++)r.setOrdinate(n,o,t.getOrdinate(e,o))},ZI.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&t.getOrdinate(0,CB.X)===t.getOrdinate(e-1,CB.X)&&t.getOrdinate(0,CB.Y)===t.getOrdinate(e-1,CB.Y)},ZI.isEqual=function(t,e){var r=t.size();if(r!==e.size())return!1;for(var n=Math.min(t.getDimension(),e.getDimension()),i=0;i<r;i++)for(var o=0;o<n;o++){var s=t.getOrdinate(i,o),a=e.getOrdinate(i,o);if(!(t.getOrdinate(i,o)===e.getOrdinate(i,o)||nB.isNaN(s)&&nB.isNaN(a)))return!1}return!0},ZI.extend=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();if(ZI.copy(e,0,n,0,i),i>0)for(var o=i;o<r;o++)ZI.copy(e,i-1,n,o,1);return n},ZI.reverse=function(t){for(var e=t.size()-1,r=Math.trunc(e/2),n=0;n<=r;n++)ZI.swap(t,n,e-n)},ZI.swap=function(t,e,r){if(e===r)return null;for(var n=0;n<t.getDimension();n++){var i=t.getOrdinate(e,n);t.setOrdinate(e,n,t.getOrdinate(r,n)),t.setOrdinate(r,n,i)}},ZI.copy=function(t,e,r,n,i){for(var o=0;o<i;o++)ZI.copyCoord(t,e+o,r,n+o)},ZI.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var r=t.getDimension(),n=new mB;n.append("(");for(var i=0;i<e;i++){i>0&&n.append(" ");for(var o=0;o<r;o++)o>0&&n.append(","),n.append(XI.toString(t.getOrdinate(i,o)))}return n.append(")"),n.toString()}},ZI.ensureValidRing=function(t,e){var r=e.size();return 0===r?e:r<=3?ZI.createClosedRing(t,e,4):e.getOrdinate(0,CB.X)===e.getOrdinate(r-1,CB.X)&&e.getOrdinate(0,CB.Y)===e.getOrdinate(r-1,CB.Y)?e:ZI.createClosedRing(t,e,r+1)},ZI.createClosedRing=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();ZI.copy(e,0,n,0,i);for(var o=i;o<r;o++)ZI.copy(e,0,n,o,1);return n};var JI=function(t){function e(e,r){t.call(this,r),this._points=null,this.init(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new FB:this._points.expandEnvelope(new FB)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._points.size()!==n._points.size())return!1;for(var i=0;i<this._points.size();i++)if(!this.equal(this._points.getCoordinate(i),n._points.getCoordinate(i),r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=this,e=0;e<Math.trunc(this._points.size()/2);e++){var r=t._points.size()-1-e;if(!t._points.getCoordinate(e).equals(t._points.getCoordinate(r)))return t._points.getCoordinate(e).compareTo(t._points.getCoordinate(r))>0&&ZI.reverse(t._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?NI.FALSE:0},e.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return KB.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return ZI.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,r=0;e<this._points.size()&&r<t._points.size();){var n=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(r));if(0!==n)return n;e++,r++}return e<this._points.size()?1:r<t._points.size()?-1:0}if(2===arguments.length){var i=arguments[0];return arguments[1].compare(this._points,i._points)}},e.prototype.apply=function(){if(dB(arguments[0],JB))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(dB(arguments[0],UI)){var r=arguments[0];if(0===this._points.size())return null;for(var n=0;n<this._points.size()&&(r.filter(this._points,n),!r.isDone());n++);r.isGeometryChanged()&&this.geometryChanged()}else(dB(arguments[0],kI)||dB(arguments[0],WB))&&arguments[0].filter(this)},e.prototype.getBoundary=function(){return new QI(this).getBoundary()},e.prototype.isEquivalentClass=function(t){return t instanceof e},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._points=this._points.clone(),e},e.prototype.getCoordinateN=function(t){return this._points.getCoordinate(t)},e.prototype.getGeometryType=function(){return"LineString"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._points},e.prototype.isEmpty=function(){return 0===this._points.size()},e.prototype.init=function(t){if(null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),1===t.size())throw new rB("Invalid number of points in LineString (found "+t.size()+" - must be 0 or >= 2)");this._points=t},e.prototype.isCoordinate=function(t){for(var e=0;e<this._points.size();e++)if(this._points.getCoordinate(e).equals(t))return!0;return!1},e.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},e.prototype.getPointN=function(t){return this.getFactory().createPoint(this._points.getCoordinate(t))},e.prototype.interfaces_=function(){return[TI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,r),e}(XB),$I=function(){};$I.prototype.interfaces_=function(){return[]},$I.prototype.getClass=function(){return $I};var tP=function(t){function e(e,r){t.call(this,r),this._coordinates=e||null,this.init(this._coordinates)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new FB;var t=new FB;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},e.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},e.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),r))}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){},e.prototype.getCoordinate=function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},e.prototype.getBoundaryDimension=function(){return NI.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getNumPoints=function(){return this.isEmpty()?0:1},e.prototype.reverse=function(){return this.copy()},e.prototype.getX=function(){if(null===this.getCoordinate())throw new Error("getX called on empty Point");return this.getCoordinate().x},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0];return this.getCoordinate().compareTo(t.getCoordinate())}if(2===arguments.length){var e=arguments[0];return arguments[1].compare(this._coordinates,e._coordinates)}},e.prototype.apply=function(){if(dB(arguments[0],JB)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(dB(arguments[0],UI)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else(dB(arguments[0],kI)||dB(arguments[0],WB))&&arguments[0].filter(this)},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._coordinates=this._coordinates.clone(),e},e.prototype.getGeometryType=function(){return"Point"},e.prototype.copy=function(){return new e(this._coordinates.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._coordinates},e.prototype.getY=function(){if(null===this.getCoordinate())throw new Error("getY called on empty Point");return this.getCoordinate().y},e.prototype.isEmpty=function(){return 0===this._coordinates.size()},e.prototype.init=function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),GB.isTrue(t.size()<=1),this._coordinates=t},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return[$I]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(e,r),e}(XB),eP=function(){};eP.prototype.interfaces_=function(){return[]},eP.prototype.getClass=function(){return eP};var rP=function(t){function e(e,r,n){if(t.call(this,n),this._shell=null,this._holes=null,null===e&&(e=this.getFactory().createLinearRing()),null===r&&(r=[]),t.hasNullElements(r))throw new rB("holes must not contain null elements");if(e.isEmpty()&&t.hasNonEmptyElements(r))throw new rB("shell is empty but holes are not");this._shell=e,this._holes=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},e.prototype.getSortIndex=function(){return t.SORTINDEX_POLYGON},e.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var t=new Array(this.getNumPoints()).fill(null),e=-1,r=this._shell.getCoordinates(),n=0;n<r.length;n++)t[++e]=r[n];for(var i=0;i<this._holes.length;i++)for(var o=this._holes[i].getCoordinates(),s=0;s<o.length;s++)t[++e]=o[s];return t},e.prototype.getArea=function(){var t=0;t+=Math.abs(KB.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(KB.signedArea(this._holes[e].getCoordinateSequence()));return t},e.prototype.isRectangle=function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),r=0;r<5;r++){var n=t.getX(r);if(n!==e.getMinX()&&n!==e.getMaxX())return!1;var i=t.getY(r);if(i!==e.getMinY()&&i!==e.getMaxY())return!1}for(var o=t.getX(0),s=t.getY(0),a=1;a<=4;a++){var l=t.getX(a),u=t.getY(a);if(l!==o==(u!==s))return!1;o=l,s=u}return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e,i=this._shell,o=n._shell;if(!i.equalsExact(o,r))return!1;if(this._holes.length!==n._holes.length)return!1;for(var s=0;s<this._holes.length;s++)if(!this._holes[s].equalsExact(n._holes[s],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var t=0;t<this._holes.length;t++)this.normalize(this._holes[t],!1);OI.sort(this._holes)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(e.isEmpty())return null;var n=new Array(e.getCoordinates().length-1).fill(null);PB.arraycopy(e.getCoordinates(),0,n,0,n.length);var i=fI.minCoordinate(e.getCoordinates());fI.scroll(n,i),PB.arraycopy(n,0,e.getCoordinates(),0,n.length),e.getCoordinates()[n.length]=n[0],KB.isCCW(e.getCoordinates())===r&&fI.reverse(e.getCoordinates())}},e.prototype.getCoordinate=function(){return this._shell.getCoordinate()},e.prototype.getNumInteriorRing=function(){return this._holes.length},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.getLength=function(){var t=0;t+=this._shell.getLength();for(var e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},e.prototype.reverse=function(){var t=this.copy();t._shell=this._shell.copy().reverse(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].copy().reverse();return t},e.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=this._shell,r=t._shell;return e.compareToSameClass(r)}if(2===arguments.length){var n=arguments[1],i=arguments[0],o=this._shell,s=i._shell,a=o.compareToSameClass(s,n);if(0!==a)return a;for(var l=this.getNumInteriorRing(),u=i.getNumInteriorRing(),h=0;h<l&&h<u;){var c=this.getInteriorRingN(h),A=i.getInteriorRingN(h),f=c.compareToSameClass(A,n);if(0!==f)return f;h++}return h<l?1:h<u?-1:0}},e.prototype.apply=function(t){var e=this;if(dB(t,JB)){this._shell.apply(t);for(var r=0;r<this._holes.length;r++)e._holes[r].apply(t)}else if(dB(t,UI)){if(this._shell.apply(t),!t.isDone())for(var n=0;n<this._holes.length&&(e._holes[n].apply(t),!t.isDone());n++);t.isGeometryChanged()&&this.geometryChanged()}else if(dB(t,kI))t.filter(this);else if(dB(t,WB)){t.filter(this),this._shell.apply(t);for(var i=0;i<this._holes.length;i++)e._holes[i].apply(t)}},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this._holes.length+1).fill(null);t[0]=this._shell;for(var e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._shell=this._shell.clone(),e._holes=new Array(this._holes.length).fill(null);for(var r=0;r<this._holes.length;r++)e._holes[r]=this._holes[r].clone();return e},e.prototype.getGeometryType=function(){return"Polygon"},e.prototype.copy=function(){for(var t=this._shell.copy(),r=new Array(this._holes.length).fill(null),n=0;n<r.length;n++)r[n]=this._holes[n].copy();return new e(t,r,this._factory)},e.prototype.getExteriorRing=function(){return this._shell},e.prototype.isEmpty=function(){return this._shell.isEmpty()},e.prototype.getInteriorRingN=function(t){return this._holes[t]},e.prototype.interfaces_=function(){return[eP]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,r),e}(XB),nP=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return XB.SORTINDEX_MULTIPOINT},e.prototype.isValid=function(){return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getCoordinate=function(){if(1===arguments.length){var e=arguments[0];return this._geometries[e].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return NI.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.getGeometryType=function(){return"MultiPoint"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[$I]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(e,r),e}(DI),iP=function(t){function e(e,r){e instanceof uB&&r instanceof _P&&(e=r.getCoordinateSequenceFactory().create(e)),t.call(this,e,r),this.validateConstruction()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return XB.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return NI.FALSE},e.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},e.prototype.reverse=function(){var t=this._points.copy();return ZI.reverse(t),this.getFactory().createLinearRing(t)},e.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new rB("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new rB("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.MINIMUM_VALID_SIZE.get=function(){return 4},r.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,r),e}(JI),oP=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return XB.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createMultiPolygon(e)},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new hI,e=0;e<this._geometries.length;e++)for(var r=this._geometries[e].getBoundary(),n=0;n<r.getNumGeometries();n++)t.add(r.getGeometryN(n));var i=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(i))},e.prototype.getGeometryType=function(){return"MultiPolygon"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[eP]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,r),e}(DI),sP=function(t){this._factory=t||null,this._isUserDataCopied=!1},aP={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};sP.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},sP.prototype.edit=function(t,e){if(null===t)return null;var r=this.editInternal(t,e);return this._isUserDataCopied&&r.setUserData(t.getUserData()),r},sP.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof DI?this.editGeometryCollection(t,e):t instanceof rP?this.editPolygon(t,e):t instanceof tP||t instanceof JI?e.edit(t,this._factory):(GB.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},sP.prototype.editGeometryCollection=function(t,e){for(var r=e.edit(t,this._factory),n=new hI,i=0;i<r.getNumGeometries();i++){var o=this.edit(r.getGeometryN(i),e);null===o||o.isEmpty()||n.add(o)}return r.getClass()===nP?this._factory.createMultiPoint(n.toArray([])):r.getClass()===GI?this._factory.createMultiLineString(n.toArray([])):r.getClass()===oP?this._factory.createMultiPolygon(n.toArray([])):this._factory.createGeometryCollection(n.toArray([]))},sP.prototype.editPolygon=function(t,e){var r=e.edit(t,this._factory);if(null===r&&(r=this._factory.createPolygon(null)),r.isEmpty())return r;var n=this.edit(r.getExteriorRing(),e);if(null===n||n.isEmpty())return this._factory.createPolygon();for(var i=new hI,o=0;o<r.getNumInteriorRing();o++){var s=this.edit(r.getInteriorRingN(o),e);null===s||s.isEmpty()||i.add(s)}return this._factory.createPolygon(n,i.toArray([]))},sP.prototype.interfaces_=function(){return[]},sP.prototype.getClass=function(){return sP},sP.GeometryEditorOperation=function(){},aP.NoOpGeometryOperation.get=function(){return lP},aP.CoordinateOperation.get=function(){return uP},aP.CoordinateSequenceOperation.get=function(){return hP},Object.defineProperties(sP,aP);var lP=function(){};lP.prototype.edit=function(t,e){return t},lP.prototype.interfaces_=function(){return[sP.GeometryEditorOperation]},lP.prototype.getClass=function(){return lP};var uP=function(){};uP.prototype.edit=function(t,e){var r=this.editCoordinates(t.getCoordinates(),t);return null===r?t:t instanceof iP?e.createLinearRing(r):t instanceof JI?e.createLineString(r):t instanceof tP?r.length>0?e.createPoint(r[0]):e.createPoint():t},uP.prototype.interfaces_=function(){return[sP.GeometryEditorOperation]},uP.prototype.getClass=function(){return uP};var hP=function(){};hP.prototype.edit=function(t,e){return t instanceof iP?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof JI?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof tP?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},hP.prototype.interfaces_=function(){return[sP.GeometryEditorOperation]},hP.prototype.getClass=function(){return hP};var cP=function(){var t=this;if(this._dimension=3,this._coordinates=null,1===arguments.length){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 r=0;r<e;r++)t._coordinates[r]=new uB}else if(dB(arguments[0],CB)){var n=arguments[0];if(null===n)return this._coordinates=new Array(0).fill(null),null;this._dimension=n.getDimension(),this._coordinates=new Array(n.size()).fill(null);for(var i=0;i<this._coordinates.length;i++)t._coordinates[i]=n.getCoordinateCopy(i)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var o=arguments[0],s=arguments[1];this._coordinates=o,this._dimension=s,null===o&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var a=arguments[0],l=arguments[1];this._coordinates=new Array(a).fill(null),this._dimension=l;for(var u=0;u<a;u++)t._coordinates[u]=new uB}},AP={serialVersionUID:{configurable:!0}};cP.prototype.setOrdinate=function(t,e,r){switch(e){case CB.X:this._coordinates[t].x=r;break;case CB.Y:this._coordinates[t].y=r;break;case CB.Z:this._coordinates[t].z=r;break;default:throw new rB("invalid ordinateIndex")}},cP.prototype.size=function(){return this._coordinates.length},cP.prototype.getOrdinate=function(t,e){switch(e){case CB.X:return this._coordinates[t].x;case CB.Y:return this._coordinates[t].y;case CB.Z:return this._coordinates[t].z}return nB.NaN},cP.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}if(2===arguments.length){var e=arguments[0],r=arguments[1];r.x=this._coordinates[e].x,r.y=this._coordinates[e].y,r.z=this._coordinates[e].z}},cP.prototype.getCoordinateCopy=function(t){return new uB(this._coordinates[t])},cP.prototype.getDimension=function(){return this._dimension},cP.prototype.getX=function(t){return this._coordinates[t].x},cP.prototype.clone=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].clone();return new cP(t,this._dimension)},cP.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},cP.prototype.copy=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].copy();return new cP(t,this._dimension)},cP.prototype.toString=function(){if(this._coordinates.length>0){var t=new mB(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"},cP.prototype.getY=function(t){return this._coordinates[t].y},cP.prototype.toCoordinateArray=function(){return this._coordinates},cP.prototype.interfaces_=function(){return[CB,lB]},cP.prototype.getClass=function(){return cP},AP.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(cP,AP);var fP=function(){},pP={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};fP.prototype.readResolve=function(){return fP.instance()},fP.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array)return new cP(arguments[0]);if(dB(arguments[0],CB))return new cP(arguments[0])}else if(2===arguments.length){var t=arguments[0],e=arguments[1];return e>3&&(e=3),e<2?new cP(t):new cP(t,e)}},fP.prototype.interfaces_=function(){return[AB,lB]},fP.prototype.getClass=function(){return fP},fP.instance=function(){return fP.instanceObject},pP.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},pP.instanceObject.get=function(){return new fP},Object.defineProperties(fP,pP);var dP=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return this.map_.get(t)||null},e.prototype.put=function(t,e){return this.map_.set(t,e),e},e.prototype.values=function(){for(var t=new hI,e=this.map_.values(),r=e.next();!r.done;)t.add(r.value),r=e.next();return t},e.prototype.entrySet=function(){var t=new wI;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(yI),gP=function t(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=t.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof mP){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var r=arguments[0];this._modelType=t.FIXED,this.setScale(r)}else if(arguments[0]instanceof t){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}},yP={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};gP.prototype.equals=function(t){if(!(t instanceof gP))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},gP.prototype.compareTo=function(t){var e=t,r=this.getMaximumSignificantDigits(),n=e.getMaximumSignificantDigits();return new vB(r).compareTo(new vB(n))},gP.prototype.getScale=function(){return this._scale},gP.prototype.isFloating=function(){return this._modelType===gP.FLOATING||this._modelType===gP.FLOATING_SINGLE},gP.prototype.getType=function(){return this._modelType},gP.prototype.toString=function(){var t="UNKNOWN";return this._modelType===gP.FLOATING?t="Floating":this._modelType===gP.FLOATING_SINGLE?t="Floating-Single":this._modelType===gP.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},gP.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return nB.isNaN(t)||this._modelType===gP.FLOATING_SINGLE?t:this._modelType===gP.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof uB){var e=arguments[0];if(this._modelType===gP.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},gP.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===gP.FLOATING?t=16:this._modelType===gP.FLOATING_SINGLE?t=6:this._modelType===gP.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},gP.prototype.setScale=function(t){this._scale=Math.abs(t)},gP.prototype.interfaces_=function(){return[lB,oB]},gP.prototype.getClass=function(){return gP},gP.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},yP.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},yP.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(gP,yP);var mP=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},vP={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};mP.prototype.readResolve=function(){return mP.nameToTypeMap.get(this._name)},mP.prototype.toString=function(){return this._name},mP.prototype.interfaces_=function(){return[lB]},mP.prototype.getClass=function(){return mP},vP.serialVersionUID.get=function(){return-552860263173159e4},vP.nameToTypeMap.get=function(){return new dP},Object.defineProperties(mP,vP),gP.Type=mP,gP.FIXED=new mP("FIXED"),gP.FLOATING=new mP("FLOATING"),gP.FLOATING_SINGLE=new mP("FLOATING SINGLE");var _P=function t(){this._precisionModel=new gP,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?dB(arguments[0],AB)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof gP&&(this._precisionModel=arguments[0]):2===arguments.length?(this._precisionModel=arguments[0],this._SRID=arguments[1]):3===arguments.length&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},wP={serialVersionUID:{configurable:!0}};_P.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new uB(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new uB(t.getMinX(),t.getMinY()),new uB(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new uB(t.getMinX(),t.getMinY()),new uB(t.getMinX(),t.getMaxY()),new uB(t.getMaxX(),t.getMaxY()),new uB(t.getMaxX(),t.getMinY()),new uB(t.getMinX(),t.getMinY())]),null)},_P.prototype.createLineString=function(t){return t?t instanceof Array?new JI(this.getCoordinateSequenceFactory().create(t),this):dB(t,CB)?new JI(t,this):void 0:new JI(this.getCoordinateSequenceFactory().create([]),this)},_P.prototype.createMultiLineString=function(){return 0===arguments.length?new GI(null,this):1===arguments.length?new GI(arguments[0],this):void 0},_P.prototype.buildGeometry=function(t){for(var e=null,r=!1,n=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();null===e&&(e=s),s!==e&&(r=!0),o.isGeometryCollectionOrDerived()&&(n=!0)}if(null===e)return this.createGeometryCollection();if(r||n)return this.createGeometryCollection(_P.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof rP)return this.createMultiPolygon(_P.toPolygonArray(t));if(a instanceof JI)return this.createMultiLineString(_P.toLineStringArray(t));if(a instanceof tP)return this.createMultiPoint(_P.toPointArray(t));GB.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},_P.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},_P.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof uB){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(dB(arguments[0],CB))return new tP(arguments[0],this)}},_P.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},_P.prototype.createPolygon=function(){if(0===arguments.length)return new rP(null,null,this);if(1===arguments.length){if(dB(arguments[0],CB)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof iP){var r=arguments[0];return this.createPolygon(r,null)}}else if(2===arguments.length)return new rP(arguments[0],arguments[1],this)},_P.prototype.getSRID=function(){return this._SRID},_P.prototype.createGeometryCollection=function(){return 0===arguments.length?new DI(null,this):1===arguments.length?new DI(arguments[0],this):void 0},_P.prototype.createGeometry=function(t){return new sP(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},_P.prototype.getPrecisionModel=function(){return this._precisionModel},_P.prototype.createLinearRing=function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(dB(arguments[0],CB))return new iP(arguments[0],this)}},_P.prototype.createMultiPolygon=function(){return 0===arguments.length?new oP(null,this):1===arguments.length?new oP(arguments[0],this):void 0},_P.prototype.createMultiPoint=function(){if(0===arguments.length)return new nP(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new nP(arguments[0],this);if(arguments[0]instanceof Array){var t=arguments[0];return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(dB(arguments[0],CB)){var e=arguments[0];if(null===e)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(e.size()).fill(null),n=0;n<e.size();n++){var i=this.getCoordinateSequenceFactory().create(1,e.getDimension());ZI.copy(e,n,i,0,1),r[n]=this.createPoint(i)}return this.createMultiPoint(r)}}},_P.prototype.interfaces_=function(){return[lB]},_P.prototype.getClass=function(){return _P},_P.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_P.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},_P.getDefaultCoordinateSequenceFactory=function(){return fP.instance()},_P.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_P.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_P.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_P.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_P.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_P.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},_P.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},wP.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(_P,wP);var bP=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],xP=function(t){this.geometryFactory=t||new _P};xP.prototype.read=function(t){var e,r=(e="string"==typeof t?JSON.parse(t):t).type;if(!EP[r])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==bP.indexOf(r)?EP[r].apply(this,[e.coordinates]):"GeometryCollection"===r?EP[r].apply(this,[e.geometries]):EP[r].apply(this,[e])},xP.prototype.write=function(t){var e=t.getGeometryType();if(!CP[e])throw new Error("Geometry is not supported");return CP[e].apply(this,[t])};var EP={Feature:function(t){var e={};for(var r in t)e[r]=t[r];if(t.geometry){var n=t.geometry.type;if(!EP[n])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=EP.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var r=0;r<t.features.length;++r)e.features.push(this.read(t.features[r]))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},coordinates:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(new uB(n[0],n[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new uB(t[0],t[1]),new uB(t[2],t[1]),new uB(t[2],t[3]),new uB(t[0],t[3]),new uB(t[0],t[1])])},Point:function(t){var e=new uB(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],r=0;r<t.length;++r)e.push(EP.Point.apply(this,[t[r]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=EP.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],r=0;r<t.length;++r)e.push(EP.LineString.apply(this,[t[r]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=EP.coordinates.apply(this,[t[0]]),r=this.geometryFactory.createLinearRing(e),n=[],i=1;i<t.length;++i){var o=t[i],s=EP.coordinates.apply(this,[o]),a=this.geometryFactory.createLinearRing(s);n.push(a)}return this.geometryFactory.createPolygon(r,n)},MultiPolygon:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(EP.Polygon.apply(this,[n]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(this.read(n))}return this.geometryFactory.createGeometryCollection(e)}},CP={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:CP.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=CP.Point.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],r=t.getCoordinates(),n=0;n<r.length;++n){var i=r[n];e.push(CP.coordinate.apply(this,[i]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=CP.LineString.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],r=CP.LineString.apply(this,[t._shell]);e.push(r.coordinates);for(var n=0;n<t._holes.length;++n){var i=t._holes[n],o=CP.LineString.apply(this,[i]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=CP.Polygon.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=n.getGeometryType();e.push(CP[i].apply(this,[n]))}return{type:"GeometryCollection",geometries:e}}},SP=function(t){this.geometryFactory=t||new _P,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new xP(this.geometryFactory)};SP.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===gP.FIXED&&this.reducePrecision(e),e},SP.prototype.reducePrecision=function(t){var e,r;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(e=0,r=t.points.length;e<r;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,r=t.geometries.length;e<r;e++)this.reducePrecision(t.geometries[e])};var BP=function(){this.parser=new xP(this.geometryFactory)};BP.prototype.write=function(t){return this.parser.write(t)};var IP=function(){},PP={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};function TP(t){this.message=t||""}function FP(){this.array_=[]}IP.prototype.interfaces_=function(){return[]},IP.prototype.getClass=function(){return IP},IP.opposite=function(t){return t===IP.LEFT?IP.RIGHT:t===IP.RIGHT?IP.LEFT:t},PP.ON.get=function(){return 0},PP.LEFT.get=function(){return 1},PP.RIGHT.get=function(){return 2},Object.defineProperties(IP,PP),TP.prototype=new Error,TP.prototype.name="EmptyStackException",FP.prototype=new lI,FP.prototype.add=function(t){return this.array_.push(t),!0},FP.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},FP.prototype.push=function(t){return this.array_.push(t),t},FP.prototype.pop=function(t){if(0===this.array_.length)throw new TP;return this.array_.pop()},FP.prototype.peek=function(){if(0===this.array_.length)throw new TP;return this.array_[this.array_.length-1]},FP.prototype.empty=function(){return 0===this.array_.length},FP.prototype.isEmpty=function(){return this.empty()},FP.prototype.search=function(t){return this.array_.indexOf(t)},FP.prototype.size=function(){return this.array_.length},FP.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t};var MP=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};MP.prototype.getCoordinate=function(){return this._minCoord},MP.prototype.getRightmostSide=function(t,e){var r=this.getRightmostSideOfSegment(t,e);return r<0&&(r=this.getRightmostSideOfSegment(t,e-1)),r<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),r},MP.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();GB.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],r=t[this._minIndex+1],n=KB.computeOrientation(this._minCoord,r,e),i=!1;(e.y<this._minCoord.y&&r.y<this._minCoord.y&&n===KB.COUNTERCLOCKWISE||e.y>this._minCoord.y&&r.y>this._minCoord.y&&n===KB.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},MP.prototype.getRightmostSideOfSegment=function(t,e){var r=t.getEdge().getCoordinates();if(e<0||e+1>=r.length)return-1;if(r[e].y===r[e+1].y)return-1;var n=IP.LEFT;return r[e].y<r[e+1].y&&(n=IP.RIGHT),n},MP.prototype.getEdge=function(){return this._orientedDe},MP.prototype.checkForRightmostCoordinate=function(t){for(var e=this,r=t.getEdge().getCoordinates(),n=0;n<r.length-1;n++)(null===e._minCoord||r[n].x>e._minCoord.x)&&(e._minDe=t,e._minIndex=n,e._minCoord=r[n])},MP.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},MP.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();r.isForward()&&this.checkForRightmostCoordinate(r)}GB.isTrue(0!==this._minIndex||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),0===this._minIndex?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===IP.LEFT&&(this._orientedDe=this._minDe.getSym())},MP.prototype.interfaces_=function(){return[]},MP.prototype.getClass=function(){return MP};var LP=function(t){function e(r,n){t.call(this,e.msgWithCoord(r,n)),this.pt=n?new uB(n):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(t,e){return e?t:t+" [ "+e+" ]"},e}(UB),OP=function(){this.array_=[]};OP.prototype.addLast=function(t){this.array_.push(t)},OP.prototype.removeFirst=function(){return this.array_.shift()},OP.prototype.isEmpty=function(){return 0===this.array_.length};var NP=function(){this._finder=null,this._dirEdgeList=new hI,this._nodes=new hI,this._rightMostCoord=null,this._env=null,this._finder=new MP};NP.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},NP.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},NP.prototype.computeNodeDepth=function(t){for(var e=null,r=t.getEdges().iterator();r.hasNext();){var n=r.next();if(n.isVisited()||n.getSym().isVisited()){e=n;break}}if(null===e)throw new LP("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var i=t.getEdges().iterator();i.hasNext();){var o=i.next();o.setVisited(!0),this.copySymDepths(o)}},NP.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(IP.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},NP.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},NP.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(IP.RIGHT)>=1&&e.getDepth(IP.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},NP.prototype.computeDepths=function(t){var e=new wI,r=new OP,n=t.getNode();for(r.addLast(n),e.add(n),t.setVisited(!0);!r.isEmpty();){var i=r.removeFirst();e.add(i),this.computeNodeDepth(i);for(var o=i.getEdges().iterator();o.hasNext();){var s=o.next().getSym();if(!s.isVisited()){var a=s.getNode();e.contains(a)||(r.addLast(a),e.add(a))}}}},NP.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},NP.prototype.getEnvelope=function(){if(null===this._env){for(var t=new FB,e=this._dirEdgeList.iterator();e.hasNext();)for(var r=e.next().getEdge().getCoordinates(),n=0;n<r.length-1;n++)t.expandToInclude(r[n]);this._env=t}return this._env},NP.prototype.addReachable=function(t){var e=new FP;for(e.add(t);!e.empty();){var r=e.pop();this.add(r,e)}},NP.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(IP.LEFT,t.getDepth(IP.RIGHT)),e.setDepth(IP.RIGHT,t.getDepth(IP.LEFT))},NP.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var r=t.getEdges().iterator();r.hasNext();){var n=r.next();this._dirEdgeList.add(n);var i=n.getSym().getNode();i.isVisited()||e.push(i)}},NP.prototype.getNodes=function(){return this._nodes},NP.prototype.getDirectedEdges=function(){return this._dirEdgeList},NP.prototype.interfaces_=function(){return[oB]},NP.prototype.getClass=function(){return NP};var RP=function t(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var r=arguments[0];this.init(1),this.location[IP.ON]=r}else if(arguments[0]instanceof t){var n=arguments[0];if(this.init(n.location.length),null!==n)for(var i=0;i<this.location.length;i++)this.location[i]=n.location[i]}}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.init(3),this.location[IP.ON]=o,this.location[IP.LEFT]=s,this.location[IP.RIGHT]=a}};RP.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},RP.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==fB.NONE)return!1;return!0},RP.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===fB.NONE&&(this.location[e]=t)},RP.prototype.isLine=function(){return 1===this.location.length},RP.prototype.merge=function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[IP.ON]=this.location[IP.ON],e[IP.LEFT]=fB.NONE,e[IP.RIGHT]=fB.NONE,this.location=e}for(var r=0;r<this.location.length;r++)this.location[r]===fB.NONE&&r<t.location.length&&(this.location[r]=t.location[r])},RP.prototype.getLocations=function(){return this.location},RP.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[IP.LEFT];this.location[IP.LEFT]=this.location[IP.RIGHT],this.location[IP.RIGHT]=t},RP.prototype.toString=function(){var t=new mB;return this.location.length>1&&t.append(fB.toLocationSymbol(this.location[IP.LEFT])),t.append(fB.toLocationSymbol(this.location[IP.ON])),this.location.length>1&&t.append(fB.toLocationSymbol(this.location[IP.RIGHT])),t.toString()},RP.prototype.setLocations=function(t,e,r){this.location[IP.ON]=t,this.location[IP.LEFT]=e,this.location[IP.RIGHT]=r},RP.prototype.get=function(t){return t<this.location.length?this.location[t]:fB.NONE},RP.prototype.isArea=function(){return this.location.length>1},RP.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===fB.NONE)return!0;return!1},RP.prototype.setLocation=function(){if(1===arguments.length){var t=arguments[0];this.setLocation(IP.ON,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.location[e]=r}},RP.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(fB.NONE)},RP.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},RP.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},RP.prototype.interfaces_=function(){return[]},RP.prototype.getClass=function(){return RP};var kP=function t(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments[0])){var e=arguments[0];this.elt[0]=new RP(e),this.elt[1]=new RP(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.elt[0]=new RP(r.elt[0]),this.elt[1]=new RP(r.elt[1])}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.elt[0]=new RP(fB.NONE),this.elt[1]=new RP(fB.NONE),this.elt[n].setLocation(i)}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.elt[0]=new RP(o,s,a),this.elt[1]=new RP(o,s,a)}else if(4===arguments.length){var l=arguments[0],u=arguments[1],h=arguments[2],c=arguments[3];this.elt[0]=new RP(fB.NONE,fB.NONE,fB.NONE),this.elt[1]=new RP(fB.NONE,fB.NONE,fB.NONE),this.elt[l].setLocations(u,h,c)}};kP.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},kP.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},kP.prototype.isNull=function(t){return this.elt[t].isNull()},kP.prototype.setAllLocationsIfNull=function(){if(1===arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.elt[e].setAllLocationsIfNull(r)}},kP.prototype.isLine=function(t){return this.elt[t].isLine()},kP.prototype.merge=function(t){for(var e=this,r=0;r<2;r++)null===e.elt[r]&&null!==t.elt[r]?e.elt[r]=new RP(t.elt[r]):e.elt[r].merge(t.elt[r])},kP.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},kP.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(IP.ON)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return this.elt[e].get(r)}},kP.prototype.toString=function(){var t=new mB;return null!==this.elt[0]&&(t.append("A:"),t.append(this.elt[0].toString())),null!==this.elt[1]&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},kP.prototype.isArea=function(){if(0===arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1===arguments.length){var t=arguments[0];return this.elt[t].isArea()}},kP.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},kP.prototype.setLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(IP.ON,e)}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this.elt[r].setLocation(n,i)}},kP.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},kP.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},kP.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new RP(this.elt[t].location[0]))},kP.prototype.interfaces_=function(){return[]},kP.prototype.getClass=function(){return kP},kP.toLineLabel=function(t){for(var e=new kP(fB.NONE),r=0;r<2;r++)e.setLocation(r,t.getLocation(r));return e};var UP=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new hI,this._pts=new hI,this._label=new kP(fB.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new hI,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};UP.prototype.computeRing=function(){if(null!==this._ring)return null;for(var t=new Array(this._pts.size()).fill(null),e=0;e<this._pts.size();e++)t[e]=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=KB.isCCW(this._ring.getCoordinates())},UP.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},UP.prototype.computePoints=function(t){var e=this;this._startDe=t;var r=t,n=!0;do{if(null===r)throw new LP("Found null DirectedEdge");if(r.getEdgeRing()===e)throw new LP("Directed Edge visited twice during ring-building at "+r.getCoordinate());e._edges.add(r);var i=r.getLabel();GB.isTrue(i.isArea()),e.mergeLabel(i),e.addPoints(r.getEdge(),r.isForward(),n),n=!1,e.setEdgeRing(r,e),r=e.getNext(r)}while(r!==this._startDe)},UP.prototype.getLinearRing=function(){return this._ring},UP.prototype.getCoordinate=function(t){return this._pts.get(t)},UP.prototype.computeMaxNodeDegree=function(){var t=this;this._maxNodeDegree=0;var e=this._startDe;do{var r=e.getNode().getEdges().getOutgoingDegree(t);r>t._maxNodeDegree&&(t._maxNodeDegree=r),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},UP.prototype.addPoints=function(t,e,r){var n=t.getCoordinates();if(e){var i=1;r&&(i=0);for(var o=i;o<n.length;o++)this._pts.add(n[o])}else{var s=n.length-2;r&&(s=n.length-1);for(var a=s;a>=0;a--)this._pts.add(n[a])}},UP.prototype.isHole=function(){return this._isHole},UP.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},UP.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!KB.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();)if(r.next().containsPoint(t))return!1;return!0},UP.prototype.addHole=function(t){this._holes.add(t)},UP.prototype.isShell=function(){return null===this._shell},UP.prototype.getLabel=function(){return this._label},UP.prototype.getEdges=function(){return this._edges},UP.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},UP.prototype.getShell=function(){return this._shell},UP.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[1],r=arguments[0].getLocation(e,IP.RIGHT);if(r===fB.NONE)return null;if(this._label.getLocation(e)===fB.NONE)return this._label.setLocation(e,r),null}},UP.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},UP.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),r=0;r<this._holes.size();r++)e[r]=this._holes.get(r).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},UP.prototype.interfaces_=function(){return[]},UP.prototype.getClass=function(){return UP};var DP=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setEdgeRing=function(t,e){t.setMinEdgeRing(e)},e.prototype.getNext=function(t){return t.getNextMin()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(UP),GP=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildMinimalRings=function(){var t=new hI,e=this._startDe;do{if(null===e.getMinEdgeRing()){var r=new DP(e,this._geometryFactory);t.add(r)}e=e.getNext()}while(e!==this._startDe);return t},e.prototype.setEdgeRing=function(t,e){t.setEdgeRing(e)},e.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var t=this._startDe;do{t.getNode().getEdges().linkMinimalDirectedEdges(this),t=t.getNext()}while(t!==this._startDe)},e.prototype.getNext=function(t){return t.getNext()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(UP),QP=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._label=t}};QP.prototype.setVisited=function(t){this._isVisited=t},QP.prototype.setInResult=function(t){this._isInResult=t},QP.prototype.isCovered=function(){return this._isCovered},QP.prototype.isCoveredSet=function(){return this._isCoveredSet},QP.prototype.setLabel=function(t){this._label=t},QP.prototype.getLabel=function(){return this._label},QP.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},QP.prototype.updateIM=function(t){GB.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},QP.prototype.isInResult=function(){return this._isInResult},QP.prototype.isVisited=function(){return this._isVisited},QP.prototype.interfaces_=function(){return[]},QP.prototype.getClass=function(){return QP};var jP=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],r=arguments[1];this._coord=e,this._edges=r,this._label=new kP(0,fB.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();)if(t.next().getEdge().isInResult())return!0;return!1},e.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(t){t.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(t){},e.prototype.computeMergedLocation=function(t,e){var r=fB.NONE;if(r=this._label.getLocation(e),!t.isNull(e)){var n=t.getLocation(e);r!==fB.BOUNDARY&&(r=n)}return r},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],r=arguments[1];null===this._label?this._label=new kP(e,r):this._label.setLocation(e,r)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var t=this;if(arguments[0]instanceof e){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof kP)for(var n=arguments[0],i=0;i<2;i++){var o=t.computeMergedLocation(n,i);t._label.getLocation(i)===fB.NONE&&t._label.setLocation(i,o)}},e.prototype.add=function(t){this._edges.insert(t),t.setNode(this)},e.prototype.setLabelBoundary=function(t){if(null===this._label)return null;var e=fB.NONE;null!==this._label&&(e=this._label.getLocation(t));var r=null;switch(e){case fB.BOUNDARY:r=fB.INTERIOR;break;case fB.INTERIOR:default:r=fB.BOUNDARY}this._label.setLocation(t,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(QP),HP=function(){this.nodeMap=new PI,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};HP.prototype.find=function(t){return this.nodeMap.get(t)},HP.prototype.addNode=function(){if(arguments[0]instanceof uB){var t=arguments[0],e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof jP){var r=arguments[0],n=this.nodeMap.get(r.getCoordinate());return null===n?(this.nodeMap.put(r.getCoordinate(),r),r):(n.mergeLabel(r),n)}},HP.prototype.print=function(t){for(var e=this.iterator();e.hasNext();)e.next().print(t)},HP.prototype.iterator=function(){return this.nodeMap.values().iterator()},HP.prototype.values=function(){return this.nodeMap.values()},HP.prototype.getBoundaryNodes=function(t){for(var e=new hI,r=this.iterator();r.hasNext();){var n=r.next();n.getLabel().getLocation(t)===fB.BOUNDARY&&e.add(n)}return e},HP.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},HP.prototype.interfaces_=function(){return[]},HP.prototype.getClass=function(){return HP};var zP=function(){},VP={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};zP.prototype.interfaces_=function(){return[]},zP.prototype.getClass=function(){return zP},zP.isNorthern=function(t){return t===zP.NE||t===zP.NW},zP.isOpposite=function(t,e){return t!==e&&2==(t-e+4)%4},zP.commonHalfPlane=function(t,e){if(t===e)return t;if(2==(t-e+4)%4)return-1;var r=t<e?t:e;return 0===r&&3===(t>e?t:e)?3:r},zP.isInHalfPlane=function(t,e){return e===zP.SE?t===zP.SE||t===zP.SW:t===e||t===e+1},zP.quadrant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new rB("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?zP.NE:zP.SE:e>=0?zP.NW:zP.SW}if(arguments[0]instanceof uB&&arguments[1]instanceof uB){var r=arguments[0],n=arguments[1];if(n.x===r.x&&n.y===r.y)throw new rB("Cannot compute the quadrant for two identical points "+r);return n.x>=r.x?n.y>=r.y?zP.NE:zP.SE:n.y>=r.y?zP.NW:zP.SW}},VP.NE.get=function(){return 0},VP.NW.get=function(){return 1},VP.SW.get=function(){return 2},VP.SE.get=function(){return 3},Object.defineProperties(zP,VP);var KP=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,1===arguments.length){var t=arguments[0];this._edge=t}else if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];this._edge=e,this.init(r,n),this._label=null}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._edge=i,this.init(o,s),this._label=a}};KP.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:KB.computeOrientation(t._p0,t._p1,this._p1)},KP.prototype.getDy=function(){return this._dy},KP.prototype.getCoordinate=function(){return this._p0},KP.prototype.setNode=function(t){this._node=t},KP.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),r=this.getClass().getName(),n=r.lastIndexOf("."),i=r.substring(n+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},KP.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},KP.prototype.getDirectedCoordinate=function(){return this._p1},KP.prototype.getDx=function(){return this._dx},KP.prototype.getLabel=function(){return this._label},KP.prototype.getEdge=function(){return this._edge},KP.prototype.getQuadrant=function(){return this._quadrant},KP.prototype.getNode=function(){return this._node},KP.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),r=e.lastIndexOf(".");return" "+e.substring(r+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},KP.prototype.computeLabel=function(t){},KP.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=zP.quadrant(this._dx,this._dy),GB.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},KP.prototype.interfaces_=function(){return[oB]},KP.prototype.getClass=function(){return KP};var qP=function(t){function e(){var e=arguments[0],r=arguments[1];if(t.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=r,r)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var n=e.getNumPoints()-1;this.init(e.getCoordinate(n),e.getCoordinate(n-1))}this.computeDirectedLabel()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getNextMin=function(){return this._nextMin},e.prototype.getDepth=function(t){return this._depth[t]},e.prototype.setVisited=function(t){this._isVisited=t},e.prototype.computeDirectedLabel=function(){this._label=new kP(this._edge.getLabel()),this._isForward||this._label.flip()},e.prototype.getNext=function(){return this._next},e.prototype.setDepth=function(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new LP("assigned depths do not match",this.getCoordinate());this._depth[t]=e},e.prototype.isInteriorAreaEdge=function(){for(var t=this,e=!0,r=0;r<2;r++)t._label.isArea(r)&&t._label.getLocation(r,IP.LEFT)===fB.INTERIOR&&t._label.getLocation(r,IP.RIGHT)===fB.INTERIOR||(e=!1);return e},e.prototype.setNextMin=function(t){this._nextMin=t},e.prototype.print=function(e){t.prototype.print.call(this,e),e.print(" "+this._depth[IP.LEFT]+"/"+this._depth[IP.RIGHT]),e.print(" ("+this.getDepthDelta()+")"),this._isInResult&&e.print(" inResult")},e.prototype.setMinEdgeRing=function(t){this._minEdgeRing=t},e.prototype.isLineEdge=function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,fB.EXTERIOR),r=!this._label.isArea(1)||this._label.allPositionsEqual(1,fB.EXTERIOR);return t&&e&&r},e.prototype.setEdgeRing=function(t){this._edgeRing=t},e.prototype.getMinEdgeRing=function(){return this._minEdgeRing},e.prototype.getDepthDelta=function(){var t=this._edge.getDepthDelta();return this._isForward||(t=-t),t},e.prototype.setInResult=function(t){this._isInResult=t},e.prototype.getSym=function(){return this._sym},e.prototype.isForward=function(){return this._isForward},e.prototype.getEdge=function(){return this._edge},e.prototype.printEdge=function(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)},e.prototype.setSym=function(t){this._sym=t},e.prototype.setVisitedEdge=function(t){this.setVisited(t),this._sym.setVisited(t)},e.prototype.setEdgeDepths=function(t,e){var r=this.getEdge().getDepthDelta();this._isForward||(r=-r);var n=1;t===IP.LEFT&&(n=-1);var i=IP.opposite(t),o=e+r*n;this.setDepth(t,e),this.setDepth(i,o)},e.prototype.getEdgeRing=function(){return this._edgeRing},e.prototype.isInResult=function(){return this._isInResult},e.prototype.setNext=function(t){this._next=t},e.prototype.isVisited=function(){return this._isVisited},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.depthFactor=function(t,e){return t===fB.EXTERIOR&&e===fB.INTERIOR?1:t===fB.INTERIOR&&e===fB.EXTERIOR?-1:0},e}(KP),WP=function(){};WP.prototype.createNode=function(t){return new jP(t,null)},WP.prototype.interfaces_=function(){return[]},WP.prototype.getClass=function(){return WP};var XP=function(){if(this._edges=new hI,this._nodes=null,this._edgeEndList=new hI,0===arguments.length)this._nodes=new HP(new WP);else if(1===arguments.length){var t=arguments[0];this._nodes=new HP(t)}};XP.prototype.printEdges=function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var r=this._edges.get(e);r.print(t),r.eiList.print(t)}},XP.prototype.find=function(t){return this._nodes.find(t)},XP.prototype.addNode=function(){if(arguments[0]instanceof jP){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof uB){var e=arguments[0];return this._nodes.addNode(e)}},XP.prototype.getNodeIterator=function(){return this._nodes.iterator()},XP.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()},XP.prototype.debugPrintln=function(t){PB.out.println(t)},XP.prototype.isBoundaryNode=function(t,e){var r=this._nodes.find(e);if(null===r)return!1;var n=r.getLabel();return null!==n&&n.getLocation(t)===fB.BOUNDARY},XP.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()},XP.prototype.matchInSameDirection=function(t,e,r,n){return!!t.equals(r)&&KB.computeOrientation(t,e,n)===KB.COLLINEAR&&zP.quadrant(t,e)===zP.quadrant(r,n)},XP.prototype.getEdgeEnds=function(){return this._edgeEndList},XP.prototype.debugPrint=function(t){PB.out.print(t)},XP.prototype.getEdgeIterator=function(){return this._edges.iterator()},XP.prototype.findEdgeInSameDirection=function(t,e){for(var r=this,n=0;n<this._edges.size();n++){var i=r._edges.get(n),o=i.getCoordinates();if(r.matchInSameDirection(t,e,o[0],o[1]))return i;if(r.matchInSameDirection(t,e,o[o.length-1],o[o.length-2]))return i}return null},XP.prototype.insertEdge=function(t){this._edges.add(t)},XP.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var r=e.next();if(r.getEdge()===t)return r}return null},XP.prototype.addEdges=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next();e._edges.add(n);var i=new qP(n,!0),o=new qP(n,!1);i.setSym(o),o.setSym(i),e.add(i),e.add(o)}},XP.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},XP.prototype.getNodes=function(){return this._nodes.values()},XP.prototype.findEdge=function(t,e){for(var r=0;r<this._edges.size();r++){var n=this._edges.get(r),i=n.getCoordinates();if(t.equals(i[0])&&e.equals(i[1]))return n}return null},XP.prototype.interfaces_=function(){return[]},XP.prototype.getClass=function(){return XP},XP.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()};var YP=function(){this._geometryFactory=null,this._shellList=new hI;var t=arguments[0];this._geometryFactory=t};YP.prototype.sortShellsAndHoles=function(t,e,r){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isHole()?r.add(i):e.add(i)}},YP.prototype.computePolygons=function(t){for(var e=new hI,r=t.iterator();r.hasNext();){var n=r.next().toPolygon(this._geometryFactory);e.add(n)}return e},YP.prototype.placeFreeHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(null===n.getShell()){var i=this.findEdgeRingContaining(n,t);if(null===i)throw new LP("unable to assign hole to a shell",n.getCoordinate(0));n.setShell(i)}}},YP.prototype.buildMinimalEdgeRings=function(t,e,r){for(var n=new hI,i=t.iterator();i.hasNext();){var o=i.next();if(o.getMaxNodeDegree()>2){o.linkDirectedEdgesForMinimalEdgeRings();var s=o.buildMinimalRings(),a=this.findShell(s);null!==a?(this.placePolygonHoles(a,s),e.add(a)):r.addAll(s)}else n.add(o)}return n},YP.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();)if(e.next().containsPoint(t))return!0;return!1},YP.prototype.buildMaximalEdgeRings=function(t){for(var e=new hI,r=t.iterator();r.hasNext();){var n=r.next();if(n.isInResult()&&n.getLabel().isArea()&&null===n.getEdgeRing()){var i=new GP(n,this._geometryFactory);e.add(i),i.setInResult()}}return e},YP.prototype.placePolygonHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();n.isHole()&&n.setShell(t)}},YP.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},YP.prototype.findEdgeRingContaining=function(t,e){for(var r=t.getLinearRing(),n=r.getEnvelopeInternal(),i=r.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var l=a.next(),u=l.getLinearRing(),h=u.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var c=!1;h.contains(n)&&KB.isPointInRing(i,u.getCoordinates())&&(c=!0),c&&(null===o||s.contains(h))&&(o=l)}return o},YP.prototype.findShell=function(t){for(var e=0,r=null,n=t.iterator();n.hasNext();){var i=n.next();i.isHole()||(r=i,e++)}return GB.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),r},YP.prototype.add=function(){if(1===arguments.length){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){var e=arguments[0],r=arguments[1];XP.linkResultDirectedEdges(r);var n=this.buildMaximalEdgeRings(e),i=new hI,o=this.buildMinimalEdgeRings(n,this._shellList,i);this.sortShellsAndHoles(o,this._shellList,i),this.placeFreeHoles(this._shellList,i)}},YP.prototype.interfaces_=function(){return[]},YP.prototype.getClass=function(){return YP};var ZP=function(){};ZP.prototype.getBounds=function(){},ZP.prototype.interfaces_=function(){return[]},ZP.prototype.getClass=function(){return ZP};var JP=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};JP.prototype.getItem=function(){return this._item},JP.prototype.getBounds=function(){return this._bounds},JP.prototype.interfaces_=function(){return[ZP,lB]},JP.prototype.getClass=function(){return JP};var $P=function(){this._size=null,this._items=null,this._size=0,this._items=new hI,this._items.add(null)};$P.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},$P.prototype.size=function(){return this._size},$P.prototype.reorder=function(t){for(var e=this,r=null,n=this._items.get(t);2*t<=this._size&&((r=2*t)!==e._size&&e._items.get(r+1).compareTo(e._items.get(r))<0&&r++,e._items.get(r).compareTo(n)<0);t=r)e._items.set(t,e._items.get(r));this._items.set(t,n)},$P.prototype.clear=function(){this._size=0,this._items.clear()},$P.prototype.isEmpty=function(){return 0===this._size},$P.prototype.add=function(t){this._items.add(null),this._size+=1;var e=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(e/2)))<0;e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)},$P.prototype.interfaces_=function(){return[]},$P.prototype.getClass=function(){return $P};var tT=function(){};tT.prototype.visitItem=function(t){},tT.prototype.interfaces_=function(){return[]},tT.prototype.getClass=function(){return tT};var eT=function(){};eT.prototype.insert=function(t,e){},eT.prototype.remove=function(t,e){},eT.prototype.query=function(){},eT.prototype.interfaces_=function(){return[]},eT.prototype.getClass=function(){return eT};var rT=function(){if(this._childBoundables=new hI,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},nT={serialVersionUID:{configurable:!0}};rT.prototype.getLevel=function(){return this._level},rT.prototype.size=function(){return this._childBoundables.size()},rT.prototype.getChildBoundables=function(){return this._childBoundables},rT.prototype.addChildBoundable=function(t){GB.isTrue(null===this._bounds),this._childBoundables.add(t)},rT.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},rT.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},rT.prototype.interfaces_=function(){return[ZP,lB]},rT.prototype.getClass=function(){return rT},nT.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(rT,nT);var iT=function(){};iT.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},iT.min=function(t){return iT.sort(t),t.get(0)},iT.sort=function(t,e){var r=t.toArray();e?OI.sort(r,e):OI.sort(r);for(var n=t.iterator(),i=0,o=r.length;i<o;i++)n.next(),n.set(r[i])},iT.singletonList=function(t){var e=new hI;return e.add(t),e};var oT=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],r=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=r,this._distance=this.distance()};oT.prototype.expandToQueue=function(t,e){var r=oT.isComposite(this._boundable1),n=oT.isComposite(this._boundable2);if(r&&n)return oT.area(this._boundable1)>oT.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(r)return this.expand(this._boundable1,this._boundable2,t,e),null;if(n)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new rB("neither boundable is composite")},oT.prototype.isLeaves=function(){return!(oT.isComposite(this._boundable1)||oT.isComposite(this._boundable2))},oT.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},oT.prototype.expand=function(t,e,r,n){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new oT(o,e,this._itemDistance);s.getDistance()<n&&r.add(s)}},oT.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},oT.prototype.getDistance=function(){return this._distance},oT.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},oT.prototype.interfaces_=function(){return[oB]},oT.prototype.getClass=function(){return oT},oT.area=function(t){return t.getBounds().getArea()},oT.isComposite=function(t){return t instanceof rT};var sT=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new hI,this._nodeCapacity=null,0===arguments.length){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(1===arguments.length){var r=arguments[0];GB.isTrue(r>1,"Node capacity must be greater than 1"),this._nodeCapacity=r}},aT={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};sT.prototype.getNodeCapacity=function(){return this._nodeCapacity},sT.prototype.lastNode=function(t){return t.get(t.size()-1)},sT.prototype.size=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();r instanceof rT?t+=this.size(r):r instanceof JP&&(t+=1)}return t}},sT.prototype.removeItem=function(t,e){for(var r=null,n=t.getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof JP&&i.getItem()===e&&(r=i)}return null!==r&&(t.getChildBoundables().remove(r),!0)},sT.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new hI:t}if(1===arguments.length){for(var e=arguments[0],r=new hI,n=e.getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof rT){var o=this.itemsTree(i);null!==o&&r.add(o)}else i instanceof JP?r.add(i.getItem()):GB.shouldNeverReachHere()}return r.size()<=0?null:r}},sT.prototype.insert=function(t,e){GB.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new JP(t,e))},sT.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new hI;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];if(GB.isTrue(r>-2),n.getLevel()===r)return i.add(n),null;for(var o=n.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof rT?this.boundablesAtLevel(r,s,i):(GB.isTrue(s instanceof JP),-1===r&&i.add(s))}return null}},sT.prototype.query=function(){var t=this;if(1===arguments.length){var e=arguments[0];this.build();var r=new hI;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,r),r}if(2===arguments.length){var n=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i)}else if(3===arguments.length)if(dB(arguments[2],tT)&&arguments[0]instanceof Object&&arguments[1]instanceof rT)for(var o=arguments[0],s=arguments[2],a=arguments[1].getChildBoundables(),l=0;l<a.size();l++){var u=a.get(l);t.getIntersectsOp().intersects(u.getBounds(),o)&&(u instanceof rT?t.query(o,u,s):u instanceof JP?s.visitItem(u.getItem()):GB.shouldNeverReachHere())}else if(dB(arguments[2],lI)&&arguments[0]instanceof Object&&arguments[1]instanceof rT)for(var h=arguments[0],c=arguments[2],A=arguments[1].getChildBoundables(),f=0;f<A.size();f++){var p=A.get(f);t.getIntersectsOp().intersects(p.getBounds(),h)&&(p instanceof rT?t.query(h,p,c):p instanceof JP?c.add(p.getItem()):GB.shouldNeverReachHere())}},sT.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},sT.prototype.getRoot=function(){return this.build(),this._root},sT.prototype.remove=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=this.removeItem(n,i);if(o)return!0;for(var s=null,a=n.getChildBoundables().iterator();a.hasNext();){var l=a.next();if(this.getIntersectsOp().intersects(l.getBounds(),r)&&l instanceof rT&&(o=this.remove(r,l,i))){s=l;break}}return null!==s&&s.getChildBoundables().isEmpty()&&n.getChildBoundables().remove(s),o}},sT.prototype.createHigherLevels=function(t,e){GB.isTrue(!t.isEmpty());var r=this.createParentBoundables(t,e+1);return 1===r.size()?r.get(0):this.createHigherLevels(r,e+1)},sT.prototype.depth=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();if(r instanceof rT){var n=this.depth(r);n>t&&(t=n)}}return t+1}},sT.prototype.createParentBoundables=function(t,e){var r=this;GB.isTrue(!t.isEmpty());var n=new hI;n.add(this.createNode(e));var i=new hI(t);iT.sort(i,this.getComparator());for(var o=i.iterator();o.hasNext();){var s=o.next();r.lastNode(n).getChildBoundables().size()===r.getNodeCapacity()&&n.add(r.createNode(e)),r.lastNode(n).addChildBoundable(s)}return n},sT.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},sT.prototype.interfaces_=function(){return[lB]},sT.prototype.getClass=function(){return sT},sT.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},aT.IntersectsOp.get=function(){return lT},aT.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},aT.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(sT,aT);var lT=function(){},uT=function(){};uT.prototype.distance=function(t,e){},uT.prototype.interfaces_=function(){return[]},uT.prototype.getClass=function(){return uT};var hT=function(t){function e(r){r=r||e.DEFAULT_NODE_CAPACITY,t.call(this,r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return e.prototype.createParentBoundablesFromVerticalSlices=function(t,e){GB.isTrue(t.length>0);for(var r=new hI,n=0;n<t.length;n++)r.addAll(this.createParentBoundablesFromVerticalSlice(t[n],e));return r},e.prototype.createNode=function(t){return new cT(t)},e.prototype.size=function(){return 0===arguments.length?t.prototype.size.call(this):t.prototype.size.apply(this,arguments)},e.prototype.insert=function(){if(2!==arguments.length)return t.prototype.insert.apply(this,arguments);var e=arguments[0],r=arguments[1];if(e.isNull())return null;t.prototype.insert.call(this,e,r)},e.prototype.getIntersectsOp=function(){return e.intersectsOp},e.prototype.verticalSlices=function(t,e){for(var r=Math.trunc(Math.ceil(t.size()/e)),n=new Array(e).fill(null),i=t.iterator(),o=0;o<e;o++){n[o]=new hI;for(var s=0;i.hasNext()&&s<r;){var a=i.next();n[o].add(a),s++}}return n},e.prototype.query=function(){if(1===arguments.length){var e=arguments[0];return t.prototype.query.call(this,e)}if(2===arguments.length){var r=arguments[0],n=arguments[1];t.prototype.query.call(this,r,n)}else if(3===arguments.length)if(dB(arguments[2],tT)&&arguments[0]instanceof Object&&arguments[1]instanceof rT){var i=arguments[0],o=arguments[1],s=arguments[2];t.prototype.query.call(this,i,o,s)}else if(dB(arguments[2],lI)&&arguments[0]instanceof Object&&arguments[1]instanceof rT){var a=arguments[0],l=arguments[1],u=arguments[2];t.prototype.query.call(this,a,l,u)}},e.prototype.getComparator=function(){return e.yComparator},e.prototype.createParentBoundablesFromVerticalSlice=function(e,r){return t.prototype.createParentBoundables.call(this,e,r)},e.prototype.remove=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return t.prototype.remove.call(this,e,r)}return t.prototype.remove.apply(this,arguments)},e.prototype.depth=function(){return 0===arguments.length?t.prototype.depth.call(this):t.prototype.depth.apply(this,arguments)},e.prototype.createParentBoundables=function(t,r){GB.isTrue(!t.isEmpty());var n=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new hI(t);iT.sort(i,e.xComparator);var o=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt(n))));return this.createParentBoundablesFromVerticalSlices(o,r)},e.prototype.nearestNeighbour=function(){if(1===arguments.length){if(dB(arguments[0],uT)){var t=arguments[0],r=new oT(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(r)}if(arguments[0]instanceof oT){var n=arguments[0];return this.nearestNeighbour(n,nB.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof e&&dB(arguments[1],uT)){var i=arguments[0],o=arguments[1],s=new oT(this.getRoot(),i.getRoot(),o);return this.nearestNeighbour(s)}if(arguments[0]instanceof oT&&"number"==typeof arguments[1]){var a=arguments[0],l=arguments[1],u=null,h=new $P;for(h.add(a);!h.isEmpty()&&l>0;){var c=h.poll(),A=c.getDistance();if(A>=l)break;c.isLeaves()?(l=A,u=c):c.expandToQueue(h,l)}return[u.getBoundable(0).getItem(),u.getBoundable(1).getItem()]}}else if(3===arguments.length){var f=arguments[2],p=new JP(arguments[0],arguments[1]),d=new oT(this.getRoot(),p,f);return this.nearestNeighbour(d)[0]}},e.prototype.interfaces_=function(){return[eT,lB]},e.prototype.getClass=function(){return e},e.centreX=function(t){return e.avg(t.getMinX(),t.getMaxX())},e.avg=function(t,e){return(t+e)/2},e.centreY=function(t){return e.avg(t.getMinY(),t.getMaxY())},r.STRtreeNode.get=function(){return cT},r.serialVersionUID.get=function(){return 0x39920f7d5f261e0},r.xComparator.get=function(){return{interfaces_:function(){return[aB]},compare:function(r,n){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(n.getBounds()))}}},r.yComparator.get=function(){return{interfaces_:function(){return[aB]},compare:function(r,n){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(n.getBounds()))}}},r.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},r.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,r),e}(sT),cT=function(t){function e(){var e=arguments[0];t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var r=e.next();null===t?t=new FB(r.getBounds()):t.expandToInclude(r.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(rT),AT=function(){};AT.prototype.interfaces_=function(){return[]},AT.prototype.getClass=function(){return AT},AT.relativeSign=function(t,e){return t<e?-1:t>e?1:0},AT.compare=function(t,e,r){if(e.equals2D(r))return 0;var n=AT.relativeSign(e.x,r.x),i=AT.relativeSign(e.y,r.y);switch(t){case 0:return AT.compareValue(n,i);case 1:return AT.compareValue(i,n);case 2:return AT.compareValue(i,-n);case 3:return AT.compareValue(-n,i);case 4:return AT.compareValue(-n,-i);case 5:return AT.compareValue(-i,-n);case 6:return AT.compareValue(-i,n);case 7:return AT.compareValue(n,-i)}return GB.shouldNeverReachHere("invalid octant value"),0},AT.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var fT=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this._segString=t,this.coord=new uB(e),this.segmentIndex=r,this._segmentOctant=n,this._isInterior=!e.equals2D(t.getCoordinate(r))};fT.prototype.getCoordinate=function(){return this.coord},fT.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},fT.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:AT.compare(this._segmentOctant,this.coord,e.coord)},fT.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},fT.prototype.isInterior=function(){return this._isInterior},fT.prototype.interfaces_=function(){return[oB]},fT.prototype.getClass=function(){return fT};var pT=function(){this._nodeMap=new PI,this._edge=null;var t=arguments[0];this._edge=t};pT.prototype.getSplitCoordinates=function(){var t=new AI;this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next();this.addEdgeCoordinates(r,n,t),r=n}return t.toCoordinateArray()},pT.prototype.addCollapsedNodes=function(){var t=new hI;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var r=e.next().intValue();this.add(this._edge.getCoordinate(r),r)}},pT.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},pT.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e<this._edge.size()-2;e++){var r=this._edge.getCoordinate(e),n=this._edge.getCoordinate(e+2);r.equals2D(n)&&t.add(new vB(e+1))}},pT.prototype.addEdgeCoordinates=function(t,e,r){var n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);r.add(new uB(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)r.add(this._edge.getCoordinate(o));i&&r.add(new uB(e.coord))},pT.prototype.iterator=function(){return this._nodeMap.values().iterator()},pT.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},pT.prototype.findCollapseIndex=function(t,e,r){if(!t.coord.equals2D(e.coord))return!1;var n=e.segmentIndex-t.segmentIndex;return e.isInterior()||n--,1===n&&(r[0]=t.segmentIndex+1,!0)},pT.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=new Array(1).fill(null),r=this.iterator(),n=r.next();r.hasNext();){var i=r.next();this.findCollapseIndex(n,i,e)&&t.add(new vB(e[0])),n=i}},pT.prototype.getEdge=function(){return this._edge},pT.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},pT.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),s=0;o[s++]=new uB(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this._edge.getCoordinate(a);return i&&(o[s]=new uB(e.coord)),new mT(o,this._edge.getData())},pT.prototype.add=function(t,e){var r=new fT(this._edge,t,e,this._edge.getSegmentOctant(e)),n=this._nodeMap.get(r);return null!==n?(GB.isTrue(n.coord.equals2D(t),"Found equal nodes with different coordinates"),n):(this._nodeMap.put(r,r),r)},pT.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),r=t.get(0).getCoordinate(0);if(!r.equals2D(e[0]))throw new UB("bad split edge start point at "+r);var n=t.get(t.size()-1).getCoordinates(),i=n[n.length-1];if(!i.equals2D(e[e.length-1]))throw new UB("bad split edge end point at "+i)},pT.prototype.interfaces_=function(){return[]},pT.prototype.getClass=function(){return pT};var dT=function(){};dT.prototype.interfaces_=function(){return[]},dT.prototype.getClass=function(){return dT},dT.octant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new rB("Cannot compute the octant for point ( "+t+", "+e+" )");var r=Math.abs(t),n=Math.abs(e);return t>=0?e>=0?r>=n?0:1:r>=n?7:6:e>=0?r>=n?3:2:r>=n?4:5}if(arguments[0]instanceof uB&&arguments[1]instanceof uB){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(0===s&&0===a)throw new rB("Cannot compute the octant for two identical points "+i);return dT.octant(s,a)}};var gT=function(){};gT.prototype.getCoordinates=function(){},gT.prototype.size=function(){},gT.prototype.getCoordinate=function(t){},gT.prototype.isClosed=function(){},gT.prototype.setData=function(t){},gT.prototype.getData=function(){},gT.prototype.interfaces_=function(){return[]},gT.prototype.getClass=function(){return gT};var yT=function(){};yT.prototype.addIntersection=function(t,e){},yT.prototype.interfaces_=function(){return[gT]},yT.prototype.getClass=function(){return yT};var mT=function(){this._nodeList=new pT(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};mT.prototype.getCoordinates=function(){return this._pts},mT.prototype.size=function(){return this._pts.length},mT.prototype.getCoordinate=function(t){return this._pts[t]},mT.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},mT.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},mT.prototype.setData=function(t){this._data=t},mT.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:dT.octant(t,e)},mT.prototype.getData=function(){return this._data},mT.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var r=arguments[1],n=arguments[3],i=new uB(arguments[0].getIntersection(n));this.addIntersection(i,r)}},mT.prototype.toString=function(){return kB.toLineString(new cP(this._pts))},mT.prototype.getNodeList=function(){return this._nodeList},mT.prototype.addIntersectionNode=function(t,e){var r=e,n=r+1;if(n<this._pts.length){var i=this._pts[n];t.equals2D(i)&&(r=n)}return this._nodeList.add(t,r)},mT.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},mT.prototype.interfaces_=function(){return[yT]},mT.prototype.getClass=function(){return mT},mT.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new hI;return mT.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();)n.next().getNodeList().addSplitEdges(r)};var vT=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new uB,this.p1=new uB;else if(1===arguments.length){var t=arguments[0];this.p0=new uB(t.p0),this.p1=new uB(t.p1)}else if(2===arguments.length)this.p0=arguments[0],this.p1=arguments[1];else if(4===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=arguments[3];this.p0=new uB(e,r),this.p1=new uB(n,i)}},_T={serialVersionUID:{configurable:!0}};vT.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},vT.prototype.orientationIndex=function(){if(arguments[0]instanceof vT){var t=arguments[0],e=KB.orientationIndex(this.p0,this.p1,t.p0),r=KB.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&r>=0||e<=0&&r<=0?Math.max(e,r):0}if(arguments[0]instanceof uB){var n=arguments[0];return KB.orientationIndex(this.p0,this.p1,n)}},vT.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},vT.prototype.isVertical=function(){return this.p0.x===this.p1.x},vT.prototype.equals=function(t){if(!(t instanceof vT))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},vT.prototype.intersection=function(t){var e=new HB;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},vT.prototype.project=function(){if(arguments[0]instanceof uB){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new uB(t);var e=this.projectionFactor(t),r=new uB;return r.x=this.p0.x+e*(this.p1.x-this.p0.x),r.y=this.p0.y+e*(this.p1.y-this.p0.y),r}if(arguments[0]instanceof vT){var n=arguments[0],i=this.projectionFactor(n.p0),o=this.projectionFactor(n.p1);if(i>=1&&o>=1)return null;if(i<=0&&o<=0)return null;var s=this.project(n.p0);i<0&&(s=this.p0),i>1&&(s=this.p1);var a=this.project(n.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new vT(s,a)}},vT.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},vT.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},vT.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},vT.prototype.distancePerpendicular=function(t){return KB.distancePointLinePerpendicular(t,this.p0,this.p1)},vT.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},vT.prototype.midPoint=function(){return vT.midPoint(this.p0,this.p1)},vT.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,r=this.p1.y-this.p0.y,n=e*e+r*r;return n<=0?nB.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*r)/n},vT.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var r=new Array(2).fill(null),n=nB.MAX_VALUE,i=null,o=this.closestPoint(t.p0);n=o.distance(t.p0),r[0]=o,r[1]=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))<n&&(n=i,r[0]=s,r[1]=t.p1);var a=t.closestPoint(this.p0);(i=a.distance(this.p0))<n&&(n=i,r[0]=this.p0,r[1]=a);var l=t.closestPoint(this.p1);return(i=l.distance(this.p1))<n&&(n=i,r[0]=this.p1,r[1]=l),r},vT.prototype.closestPoint=function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1},vT.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},vT.prototype.getLength=function(){return this.p0.distance(this.p1)},vT.prototype.compareTo=function(t){var e=t,r=this.p0.compareTo(e.p0);return 0!==r?r:this.p1.compareTo(e.p1)},vT.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},vT.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)},vT.prototype.lineIntersection=function(t){try{return TB.intersection(this.p0,this.p1,t.p0,t.p1)}catch(e){if(!(e instanceof IB))throw e}return null},vT.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},vT.prototype.pointAlongOffset=function(t,e){var r=this.p0.x+t*(this.p1.x-this.p0.x),n=this.p0.y+t*(this.p1.y-this.p0.y),i=this.p1.x-this.p0.x,o=this.p1.y-this.p0.y,s=Math.sqrt(i*i+o*o),a=0,l=0;if(0!==e){if(s<=0)throw new Error("Cannot compute offset from zero-length line segment");a=e*i/s,l=e*o/s}return new uB(r-l,n+a)},vT.prototype.setCoordinates=function(){if(1===arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=r.x,this.p1.y=r.y}},vT.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||nB.isNaN(e))&&(e=1),e},vT.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},vT.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},vT.prototype.distance=function(){if(arguments[0]instanceof vT){var t=arguments[0];return KB.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof uB){var e=arguments[0];return KB.distancePointLine(e,this.p0,this.p1)}},vT.prototype.pointAlong=function(t){var e=new uB;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},vT.prototype.hashCode=function(){var t=nB.doubleToLongBits(this.p0.x);t^=31*nB.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),r=nB.doubleToLongBits(this.p1.x);return r^=31*nB.doubleToLongBits(this.p1.y),e^Math.trunc(r)^Math.trunc(r>>32)},vT.prototype.interfaces_=function(){return[oB,lB]},vT.prototype.getClass=function(){return vT},vT.midPoint=function(t,e){return new uB((t.x+e.x)/2,(t.y+e.y)/2)},_T.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(vT,_T);var wT=function(){this.tempEnv1=new FB,this.tempEnv2=new FB,this._overlapSeg1=new vT,this._overlapSeg2=new vT};wT.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[3];arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},wT.prototype.interfaces_=function(){return[]},wT.prototype.getClass=function(){return wT};var bT=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],r=arguments[2],n=arguments[3];this._pts=t,this._start=e,this._end=r,this._context=n};bT.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},bT.prototype.computeSelect=function(t,e,r,n){var i=this._pts[e],o=this._pts[r];if(n.tempEnv1.init(i,o),r-e==1)return n.select(this,e),null;if(!t.intersects(n.tempEnv1))return null;var s=Math.trunc((e+r)/2);e<s&&this.computeSelect(t,e,s,n),s<r&&this.computeSelect(t,s,r,n)},bT.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,r=this._start;r<=this._end;r++)t[e++]=this._pts[r];return t},bT.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},bT.prototype.setId=function(t){this._id=t},bT.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},bT.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new FB(t,e)}return this._env},bT.prototype.getEndIndex=function(){return this._end},bT.prototype.getStartIndex=function(){return this._start},bT.prototype.getContext=function(){return this._context},bT.prototype.getId=function(){return this._id},bT.prototype.computeOverlapsInternal=function(t,e,r,n,i,o){var s=this._pts[t],a=this._pts[e],l=r._pts[n],u=r._pts[i];if(e-t==1&&i-n==1)return o.overlap(this,t,r,n),null;if(o.tempEnv1.init(s,a),o.tempEnv2.init(l,u),!o.tempEnv1.intersects(o.tempEnv2))return null;var h=Math.trunc((t+e)/2),c=Math.trunc((n+i)/2);t<h&&(n<c&&this.computeOverlapsInternal(t,h,r,n,c,o),c<i&&this.computeOverlapsInternal(t,h,r,c,i,o)),h<e&&(n<c&&this.computeOverlapsInternal(h,e,r,n,c,o),c<i&&this.computeOverlapsInternal(h,e,r,c,i,o))},bT.prototype.interfaces_=function(){return[]},bT.prototype.getClass=function(){return bT};var xT=function(){};xT.prototype.interfaces_=function(){return[]},xT.prototype.getClass=function(){return xT},xT.getChainStartIndices=function(t){var e=0,r=new hI;r.add(new vB(e));do{var n=xT.findChainEnd(t,e);r.add(new vB(n)),e=n}while(e<t.length-1);return xT.toIntArray(r)},xT.findChainEnd=function(t,e){for(var r=e;r<t.length-1&&t[r].equals2D(t[r+1]);)r++;if(r>=t.length-1)return t.length-1;for(var n=zP.quadrant(t[r],t[r+1]),i=e+1;i<t.length&&(t[i-1].equals2D(t[i])||zP.quadrant(t[i-1],t[i])===n);)i++;return i-1},xT.getChains=function(){if(1===arguments.length){var t=arguments[0];return xT.getChains(t,null)}if(2===arguments.length){for(var e=arguments[0],r=arguments[1],n=new hI,i=xT.getChainStartIndices(e),o=0;o<i.length-1;o++){var s=new bT(e,i[o],i[o+1],r);n.add(s)}return n}},xT.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var ET=function(){};ET.prototype.computeNodes=function(t){},ET.prototype.getNodedSubstrings=function(){},ET.prototype.interfaces_=function(){return[]},ET.prototype.getClass=function(){return ET};var CT=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}};CT.prototype.setSegmentIntersector=function(t){this._segInt=t},CT.prototype.interfaces_=function(){return[ET]},CT.prototype.getClass=function(){return CT};var ST=function(t){function e(e){e?t.call(this,e):t.call(this),this._monoChains=new hI,this._index=new hT,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return mT.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(t){for(var e=this,r=xT.getChains(t.getCoordinates(),t).iterator();r.hasNext();){var n=r.next();n.setId(e._idCounter++),e._index.insert(n.getEnvelope(),n),e._monoChains.add(n)}},e.prototype.computeNodes=function(t){this._nodedSegStrings=t;for(var e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()},e.prototype.intersectChains=function(){for(var t=this,e=new BT(this._segInt),r=this._monoChains.iterator();r.hasNext();)for(var n=r.next(),i=t._index.query(n.getEnvelope()).iterator();i.hasNext();){var o=i.next();if(o.getId()>n.getId()&&(n.computeOverlaps(o,e),t._nOverlaps++),t._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.SegmentOverlapAction.get=function(){return BT},Object.defineProperties(e,r),e}(CT),BT=function(t){function e(){t.call(this),this._si=null;var e=arguments[0];this._si=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(4!==arguments.length)return t.prototype.overlap.apply(this,arguments);var e=arguments[1],r=arguments[2],n=arguments[3],i=arguments[0].getContext(),o=r.getContext();this._si.processIntersections(i,e,o,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(wT),IT=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.setQuadrantSegments(e)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.setQuadrantSegments(r),this.setEndCapStyle(n)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}},PT={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}};IT.prototype.getEndCapStyle=function(){return this._endCapStyle},IT.prototype.isSingleSided=function(){return this._isSingleSided},IT.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=IT.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=IT.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==IT.JOIN_ROUND&&(this._quadrantSegments=IT.DEFAULT_QUADRANT_SEGMENTS)},IT.prototype.getJoinStyle=function(){return this._joinStyle},IT.prototype.setJoinStyle=function(t){this._joinStyle=t},IT.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},IT.prototype.getSimplifyFactor=function(){return this._simplifyFactor},IT.prototype.getQuadrantSegments=function(){return this._quadrantSegments},IT.prototype.setEndCapStyle=function(t){this._endCapStyle=t},IT.prototype.getMitreLimit=function(){return this._mitreLimit},IT.prototype.setMitreLimit=function(t){this._mitreLimit=t},IT.prototype.setSingleSided=function(t){this._isSingleSided=t},IT.prototype.interfaces_=function(){return[]},IT.prototype.getClass=function(){return IT},IT.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},PT.CAP_ROUND.get=function(){return 1},PT.CAP_FLAT.get=function(){return 2},PT.CAP_SQUARE.get=function(){return 3},PT.JOIN_ROUND.get=function(){return 1},PT.JOIN_MITRE.get=function(){return 2},PT.JOIN_BEVEL.get=function(){return 3},PT.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},PT.DEFAULT_MITRE_LIMIT.get=function(){return 5},PT.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(IT,PT);var TT=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=KB.COUNTERCLOCKWISE,this._inputLine=t||null},FT={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};TT.prototype.isDeletable=function(t,e,r,n){var i=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[r];return!!this.isConcave(i,o,s)&&!!this.isShallow(i,o,s,n)&&this.isShallowSampled(i,o,t,r,n)},TT.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,r=this.findNextNonDeletedIndex(e),n=this.findNextNonDeletedIndex(r),i=!1;n<this._inputLine.length;){var o=!1;t.isDeletable(e,r,n,t._distanceTol)&&(t._isDeleted[r]=TT.DELETE,o=!0,i=!0),e=o?n:r,r=t.findNextNonDeletedIndex(e),n=t.findNextNonDeletedIndex(r)}return i},TT.prototype.isShallowConcavity=function(t,e,r,n){return KB.computeOrientation(t,e,r)===this._angleOrientation&&KB.distancePointLine(e,t,r)<n},TT.prototype.isShallowSampled=function(t,e,r,n,i){var o=Math.trunc((n-r)/TT.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var s=r;s<n;s+=o)if(!this.isShallow(t,e,this._inputLine[s],i))return!1;return!0},TT.prototype.isConcave=function(t,e,r){return KB.computeOrientation(t,e,r)===this._angleOrientation},TT.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=KB.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},TT.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===TT.DELETE;)e++;return e},TT.prototype.isShallow=function(t,e,r,n){return KB.distancePointLine(e,t,r)<n},TT.prototype.collapseLine=function(){for(var t=new AI,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==TT.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},TT.prototype.interfaces_=function(){return[]},TT.prototype.getClass=function(){return TT},TT.simplify=function(t,e){return new TT(t).simplify(e)},FT.INIT.get=function(){return 0},FT.DELETE.get=function(){return 1},FT.KEEP.get=function(){return 1},FT.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(TT,FT);var MT=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new hI},LT={COORDINATE_ARRAY_TYPE:{configurable:!0}};MT.prototype.getCoordinates=function(){return this._ptList.toArray(MT.COORDINATE_ARRAY_TYPE)},MT.prototype.setPrecisionModel=function(t){this._precisionModel=t},MT.prototype.addPt=function(t){var e=new uB(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},MT.prototype.revere=function(){},MT.prototype.addPts=function(t,e){if(e)for(var r=0;r<t.length;r++)this.addPt(t[r]);else for(var n=t.length-1;n>=0;n--)this.addPt(t[n])},MT.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance},MT.prototype.toString=function(){return(new _P).createLineString(this.getCoordinates()).toString()},MT.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new uB(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},MT.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},MT.prototype.interfaces_=function(){return[]},MT.prototype.getClass=function(){return MT},LT.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(MT,LT);var OT=function(){},NT={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};OT.prototype.interfaces_=function(){return[]},OT.prototype.getClass=function(){return OT},OT.toDegrees=function(t){return 180*t/Math.PI},OT.normalize=function(t){for(;t>Math.PI;)t-=OT.PI_TIMES_2;for(;t<=-Math.PI;)t+=OT.PI_TIMES_2;return t},OT.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],r=arguments[1],n=r.x-e.x,i=r.y-e.y;return Math.atan2(i,n)}},OT.isAcute=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)>0},OT.isObtuse=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)<0},OT.interiorAngle=function(t,e,r){var n=OT.angle(e,t),i=OT.angle(e,r);return Math.abs(i-n)},OT.normalizePositive=function(t){if(t<0){for(;t<0;)t+=OT.PI_TIMES_2;t>=OT.PI_TIMES_2&&(t=0)}else{for(;t>=OT.PI_TIMES_2;)t-=OT.PI_TIMES_2;t<0&&(t=0)}return t},OT.angleBetween=function(t,e,r){var n=OT.angle(e,t),i=OT.angle(e,r);return OT.diff(n,i)},OT.diff=function(t,e){var r=null;return(r=t<e?e-t:t-e)>Math.PI&&(r=2*Math.PI-r),r},OT.toRadians=function(t){return t*Math.PI/180},OT.getTurn=function(t,e){var r=Math.sin(e-t);return r>0?OT.COUNTERCLOCKWISE:r<0?OT.CLOCKWISE:OT.NONE},OT.angleBetweenOriented=function(t,e,r){var n=OT.angle(e,t),i=OT.angle(e,r)-n;return i<=-Math.PI?i+OT.PI_TIMES_2:i>Math.PI?i-OT.PI_TIMES_2:i},NT.PI_TIMES_2.get=function(){return 2*Math.PI},NT.PI_OVER_2.get=function(){return Math.PI/2},NT.PI_OVER_4.get=function(){return Math.PI/4},NT.COUNTERCLOCKWISE.get=function(){return KB.COUNTERCLOCKWISE},NT.CLOCKWISE.get=function(){return KB.CLOCKWISE},NT.NONE.get=function(){return KB.COLLINEAR},Object.defineProperties(OT,NT);var RT=function t(){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 vT,this._seg1=new vT,this._offset0=new vT,this._offset1=new vT,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._precisionModel=e,this._bufParams=r,this._li=new HB,this._filletAngleQuantum=Math.PI/2/r.getQuadrantSegments(),r.getQuadrantSegments()>=8&&r.getJoinStyle()===IT.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)},kT={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}};RT.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 r=KB.computeOrientation(this._s0,this._s1,this._s2),n=r===KB.CLOCKWISE&&this._side===IP.LEFT||r===KB.COUNTERCLOCKWISE&&this._side===IP.RIGHT;0===r?this.addCollinear(e):n?this.addOutsideTurn(r,e):this.addInsideTurn(r,e)},RT.prototype.addLineEndCap=function(t,e){var r=new vT(t,e),n=new vT;this.computeOffsetSegment(r,IP.LEFT,this._distance,n);var i=new vT;this.computeOffsetSegment(r,IP.RIGHT,this._distance,i);var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o);switch(this._bufParams.getEndCapStyle()){case IT.CAP_ROUND:this._segList.addPt(n.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,KB.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case IT.CAP_FLAT:this._segList.addPt(n.p1),this._segList.addPt(i.p1);break;case IT.CAP_SQUARE:var l=new uB;l.x=Math.abs(this._distance)*Math.cos(a),l.y=Math.abs(this._distance)*Math.sin(a);var u=new uB(n.p1.x+l.x,n.p1.y+l.y),h=new uB(i.p1.x+l.x,i.p1.y+l.y);this._segList.addPt(u),this._segList.addPt(h)}},RT.prototype.getCoordinates=function(){return this._segList.getCoordinates()},RT.prototype.addMitreJoin=function(t,e,r,n){var i=!0,o=null;try{o=TB.intersection(e.p0,e.p1,r.p0,r.p1),(n<=0?1:o.distance(t)/Math.abs(n))>this._bufParams.getMitreLimit()&&(i=!1)}catch(s){if(!(s instanceof IB))throw s;o=new uB(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,r,n,this._bufParams.getMitreLimit())},RT.prototype.addFilletCorner=function(t,e,r,n,i){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),l=r.x-t.x,u=r.y-t.y,h=Math.atan2(u,l);n===KB.CLOCKWISE?a<=h&&(a+=2*Math.PI):a>=h&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,h,n,i),this._segList.addPt(r)},RT.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*RT.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===IT.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===IT.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))},RT.prototype.createSquare=function(t){this._segList.addPt(new uB(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new uB(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new uB(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new uB(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},RT.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},RT.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},RT.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},RT.prototype.initSideSegments=function(t,e,r){this._s1=t,this._s2=e,this._side=r,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,r,this._distance,this._offset1)},RT.prototype.addLimitedMitreJoin=function(t,e,r,n){var i=this._seg0.p1,o=OT.angle(i,this._seg0.p0),s=OT.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=OT.normalize(o+s),l=OT.normalize(a+Math.PI),u=n*r,h=r-u*Math.abs(Math.sin(s)),c=i.x+u*Math.cos(l),A=i.y+u*Math.sin(l),f=new uB(c,A),p=new vT(i,f),d=p.pointAlongOffset(1,h),g=p.pointAlongOffset(1,-h);this._side===IP.LEFT?(this._segList.addPt(d),this._segList.addPt(g)):(this._segList.addPt(g),this._segList.addPt(d))},RT.prototype.computeOffsetSegment=function(t,e,r,n){var i=e===IP.LEFT?1:-1,o=t.p1.x-t.p0.x,s=t.p1.y-t.p0.y,a=Math.sqrt(o*o+s*s),l=i*r*o/a,u=i*r*s/a;n.p0.x=t.p0.x-u,n.p0.y=t.p0.y+l,n.p1.x=t.p1.x-u,n.p1.y=t.p1.y+l},RT.prototype.addFilletArc=function(t,e,r,n,i){var o=n===KB.CLOCKWISE?-1:1,s=Math.abs(e-r),a=Math.trunc(s/this._filletAngleQuantum+.5);if(a<1)return null;for(var l=s/a,u=0,h=new uB;u<s;){var c=e+o*u;h.x=t.x+i*Math.cos(c),h.y=t.y+i*Math.sin(c),this._segList.addPt(h),u+=l}},RT.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*RT.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var r=new uB((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(r);var n=new uB((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(n)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},RT.prototype.createCircle=function(t){var e=new uB(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},RT.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},RT.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new MT,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*RT.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},RT.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===IT.JOIN_BEVEL||this._bufParams.getJoinStyle()===IT.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,KB.CLOCKWISE,this._distance))},RT.prototype.closeRing=function(){this._segList.closeRing()},RT.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},RT.prototype.interfaces_=function(){return[]},RT.prototype.getClass=function(){return RT},kT.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},kT.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},kT.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},kT.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(RT,kT);var UT=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};UT.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var r=e<0,n=Math.abs(e),i=this.getSegGen(n);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,r,i);var o=i.getCoordinates();return r&&fI.reverse(o),o},UT.prototype.computeSingleSidedBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){r.addSegments(t,!0);var i=TT.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],IP.LEFT),r.addFirstSegment();for(var s=o-2;s>=0;s--)r.addNextSegment(i[s],!0)}else{r.addSegments(t,!1);var a=TT.simplify(t,n),l=a.length-1;r.initSideSegments(a[0],a[1],IP.LEFT),r.addFirstSegment();for(var u=2;u<=l;u++)r.addNextSegment(a[u],!0)}r.addLastSegment(),r.closeRing()},UT.prototype.computeRingBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);e===IP.RIGHT&&(n=-n);var i=TT.simplify(t,n),o=i.length-1;r.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++){var a=1!==s;r.addNextSegment(i[s],a)}r.closeRing()},UT.prototype.computeLineBufferCurve=function(t,e){var r=this.simplifyTolerance(this._distance),n=TT.simplify(t,r),i=n.length-1;e.initSideSegments(n[0],n[1],IP.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(n[o],!0);e.addLastSegment(),e.addLineEndCap(n[i-1],n[i]);var s=TT.simplify(t,-r),a=s.length-1;e.initSideSegments(s[a],s[a-1],IP.LEFT);for(var l=a-2;l>=0;l--)e.addNextSegment(s[l],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},UT.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case IT.CAP_ROUND:e.createCircle(t);break;case IT.CAP_SQUARE:e.createSquare(t)}},UT.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var r=Math.abs(e),n=this.getSegGen(r);if(t.length<=1)this.computePointCurve(t[0],n);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,n)}else this.computeLineBufferCurve(t,n);return n.getCoordinates()},UT.prototype.getBufferParameters=function(){return this._bufParams},UT.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},UT.prototype.getRingCurve=function(t,e,r){if(this._distance=r,t.length<=2)return this.getLineCurve(t,r);if(0===r)return UT.copyCoordinates(t);var n=this.getSegGen(r);return this.computeRingBufferCurve(t,e,n),n.getCoordinates()},UT.prototype.computeOffsetCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){var i=TT.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],IP.LEFT),r.addFirstSegment();for(var s=o-2;s>=0;s--)r.addNextSegment(i[s],!0)}else{var a=TT.simplify(t,n),l=a.length-1;r.initSideSegments(a[0],a[1],IP.LEFT),r.addFirstSegment();for(var u=2;u<=l;u++)r.addNextSegment(a[u],!0)}r.addLastSegment()},UT.prototype.getSegGen=function(t){return new RT(this._precisionModel,this._bufParams,t)},UT.prototype.interfaces_=function(){return[]},UT.prototype.getClass=function(){return UT},UT.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),r=0;r<e.length;r++)e[r]=new uB(t[r]);return e};var DT=function(){this._subgraphs=null,this._seg=new vT,this._cga=new KB;var t=arguments[0];this._subgraphs=t},GT={DepthSegment:{configurable:!0}};DT.prototype.findStabbedSegments=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=new hI,n=this._subgraphs.iterator();n.hasNext();){var i=n.next(),o=i.getEnvelope();e.y<o.getMinY()||e.y>o.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),r)}return r}if(3===arguments.length)if(dB(arguments[2],lI)&&arguments[0]instanceof uB&&arguments[1]instanceof qP){for(var s=arguments[0],a=arguments[1],l=arguments[2],u=a.getEdge().getCoordinates(),h=0;h<u.length-1;h++)if(t._seg.p0=u[h],t._seg.p1=u[h+1],t._seg.p0.y>t._seg.p1.y&&t._seg.reverse(),!(Math.max(t._seg.p0.x,t._seg.p1.x)<s.x||t._seg.isHorizontal()||s.y<t._seg.p0.y||s.y>t._seg.p1.y||KB.computeOrientation(t._seg.p0,t._seg.p1,s)===KB.RIGHT)){var c=a.getDepth(IP.LEFT);t._seg.p0.equals(u[h])||(c=a.getDepth(IP.RIGHT));var A=new QT(t._seg,c);l.add(A)}}else if(dB(arguments[2],lI)&&arguments[0]instanceof uB&&dB(arguments[1],lI))for(var f=arguments[0],p=arguments[2],d=arguments[1].iterator();d.hasNext();){var g=d.next();g.isForward()&&t.findStabbedSegments(f,g,p)}},DT.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:iT.min(e)._leftDepth},DT.prototype.interfaces_=function(){return[]},DT.prototype.getClass=function(){return DT},GT.DepthSegment.get=function(){return QT},Object.defineProperties(DT,GT);var QT=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new vT(t),this._leftDepth=e};QT.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 r=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==r||0!=(r=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?r:this._upwardSeg.compareTo(e._upwardSeg)},QT.prototype.compareX=function(t,e){var r=t.p0.compareTo(e.p0);return 0!==r?r:t.p1.compareTo(e.p1)},QT.prototype.toString=function(){return this._upwardSeg.toString()},QT.prototype.interfaces_=function(){return[oB]},QT.prototype.getClass=function(){return QT};var jT=function(t,e,r){this.p0=t||null,this.p1=e||null,this.p2=r||null};jT.prototype.area=function(){return jT.area(this.p0,this.p1,this.p2)},jT.prototype.signedArea=function(){return jT.signedArea(this.p0,this.p1,this.p2)},jT.prototype.interpolateZ=function(t){if(null===t)throw new rB("Supplied point is null.");return jT.interpolateZ(t,this.p0,this.p1,this.p2)},jT.prototype.longestSideLength=function(){return jT.longestSideLength(this.p0,this.p1,this.p2)},jT.prototype.isAcute=function(){return jT.isAcute(this.p0,this.p1,this.p2)},jT.prototype.circumcentre=function(){return jT.circumcentre(this.p0,this.p1,this.p2)},jT.prototype.area3D=function(){return jT.area3D(this.p0,this.p1,this.p2)},jT.prototype.centroid=function(){return jT.centroid(this.p0,this.p1,this.p2)},jT.prototype.inCentre=function(){return jT.inCentre(this.p0,this.p1,this.p2)},jT.prototype.interfaces_=function(){return[]},jT.prototype.getClass=function(){return jT},jT.area=function(t,e,r){return Math.abs(((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2)},jT.signedArea=function(t,e,r){return((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2},jT.det=function(t,e,r,n){return t*n-e*r},jT.interpolateZ=function(t,e,r,n){var i=e.x,o=e.y,s=r.x-i,a=n.x-i,l=r.y-o,u=n.y-o,h=s*u-a*l,c=t.x-i,A=t.y-o,f=(u*c-a*A)/h,p=(-l*c+s*A)/h;return e.z+f*(r.z-e.z)+p*(n.z-e.z)},jT.longestSideLength=function(t,e,r){var n=t.distance(e),i=e.distance(r),o=r.distance(t),s=n;return i>s&&(s=i),o>s&&(s=o),s},jT.isAcute=function(t,e,r){return!!OT.isAcute(t,e,r)&&!!OT.isAcute(e,r,t)&&!!OT.isAcute(r,t,e)},jT.circumcentre=function(t,e,r){var n=r.x,i=r.y,o=t.x-n,s=t.y-i,a=e.x-n,l=e.y-i,u=2*jT.det(o,s,a,l),h=jT.det(s,o*o+s*s,l,a*a+l*l),c=jT.det(o,o*o+s*s,a,a*a+l*l);return new uB(n-h/u,i+c/u)},jT.perpendicularBisector=function(t,e){var r=e.x-t.x,n=e.y-t.y,i=new TB(t.x+r/2,t.y+n/2,1),o=new TB(t.x-n+r/2,t.y+r+n/2,1);return new TB(i,o)},jT.angleBisector=function(t,e,r){var n=e.distance(t),i=n/(n+e.distance(r)),o=r.x-t.x,s=r.y-t.y;return new uB(t.x+i*o,t.y+i*s)},jT.area3D=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=e.z-t.z,s=r.x-t.x,a=r.y-t.y,l=r.z-t.z,u=i*l-o*a,h=o*s-n*l,c=n*a-i*s,A=u*u+h*h+c*c;return Math.sqrt(A)/2},jT.centroid=function(t,e,r){var n=(t.x+e.x+r.x)/3,i=(t.y+e.y+r.y)/3;return new uB(n,i)},jT.inCentre=function(t,e,r){var n=e.distance(r),i=t.distance(r),o=t.distance(e),s=n+i+o,a=(n*t.x+i*e.x+o*r.x)/s,l=(n*t.y+i*e.y+o*r.y)/s;return new uB(a,l)};var HT=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new hI;var t=arguments[0],e=arguments[1],r=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=r};HT.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,fB.EXTERIOR,fB.INTERIOR)},HT.prototype.addPolygon=function(t){var e=this,r=this._distance,n=IP.LEFT;this._distance<0&&(r=-this._distance,n=IP.RIGHT);var i=t.getExteriorRing(),o=fI.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance))return null;if(this._distance<=0&&o.length<3)return null;this.addPolygonRing(o,r,n,fB.EXTERIOR,fB.INTERIOR);for(var s=0;s<t.getNumInteriorRing();s++){var a=t.getInteriorRingN(s),l=fI.removeRepeatedPoints(a.getCoordinates());e._distance>0&&e.isErodedCompletely(a,-e._distance)||e.addPolygonRing(l,r,IP.opposite(n),fB.INTERIOR,fB.EXTERIOR)}},HT.prototype.isTriangleErodedCompletely=function(t,e){var r=new jT(t[0],t[1],t[2]),n=r.inCentre();return KB.distancePointLine(n,r.p0,r.p1)<Math.abs(e)},HT.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=fI.removeRepeatedPoints(t.getCoordinates()),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,fB.EXTERIOR,fB.INTERIOR)},HT.prototype.addCurve=function(t,e,r){if(null===t||t.length<2)return null;var n=new mT(t,new kP(0,fB.BOUNDARY,e,r));this._curveList.add(n)},HT.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},HT.prototype.addPolygonRing=function(t,e,r,n,i){if(0===e&&t.length<iP.MINIMUM_VALID_SIZE)return null;var o=n,s=i;t.length>=iP.MINIMUM_VALID_SIZE&&KB.isCCW(t)&&(o=i,s=n,r=IP.opposite(r));var a=this._curveBuilder.getRingCurve(t,r,e);this.addCurve(a,o,s)},HT.prototype.add=function(t){if(t.isEmpty())return null;t instanceof rP?this.addPolygon(t):t instanceof JI?this.addLineString(t):t instanceof tP?this.addPoint(t):(t instanceof nP||t instanceof GI||t instanceof oP||t instanceof DI)&&this.addCollection(t)},HT.prototype.isErodedCompletely=function(t,e){var r=t.getCoordinates();if(r.length<4)return e<0;if(4===r.length)return this.isTriangleErodedCompletely(r,e);var n=t.getEnvelopeInternal(),i=Math.min(n.getHeight(),n.getWidth());return e<0&&2*Math.abs(e)>i},HT.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},HT.prototype.interfaces_=function(){return[]},HT.prototype.getClass=function(){return HT};var zT=function(){};zT.prototype.locate=function(t){},zT.prototype.interfaces_=function(){return[]},zT.prototype.getClass=function(){return zT};var VT=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()};VT.prototype.next=function(){if(this._atStart)return this._atStart=!1,VT.isAtomic(this._parent)&&this._index++,this._parent;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new uI;var t=this._parent.getGeometryN(this._index++);return t instanceof DI?(this._subcollectionIterator=new VT(t),this._subcollectionIterator.next()):t},VT.prototype.remove=function(){throw new Error(this.getClass().getName())},VT.prototype.hasNext=function(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},VT.prototype.interfaces_=function(){return[aI]},VT.prototype.getClass=function(){return VT},VT.isAtomic=function(t){return!(t instanceof DI)};var KT=function(){this._geom=null;var t=arguments[0];this._geom=t};KT.prototype.locate=function(t){return KT.locate(t,this._geom)},KT.prototype.interfaces_=function(){return[zT]},KT.prototype.getClass=function(){return KT},KT.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&KB.isPointInRing(t,e.getCoordinates())},KT.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var r=e.getExteriorRing();if(!KT.isPointInRing(t,r))return!1;for(var n=0;n<e.getNumInteriorRing();n++){var i=e.getInteriorRingN(n);if(KT.isPointInRing(t,i))return!1}return!0},KT.containsPoint=function(t,e){if(e instanceof rP)return KT.containsPointInPolygon(t,e);if(e instanceof DI)for(var r=new VT(e);r.hasNext();){var n=r.next();if(n!==e&&KT.containsPoint(t,n))return!0}return!1},KT.locate=function(t,e){return e.isEmpty()?fB.EXTERIOR:KT.containsPoint(t,e)?fB.INTERIOR:fB.EXTERIOR};var qT=function(){this._edgeMap=new PI,this._edgeList=null,this._ptInAreaLocation=[fB.NONE,fB.NONE]};qT.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),r=e-1;return 0===e&&(r=this._edgeList.size()-1),this._edgeList.get(r)},qT.prototype.propagateSideLabels=function(t){for(var e=fB.NONE,r=this.iterator();r.hasNext();){var n=r.next().getLabel();n.isArea(t)&&n.getLocation(t,IP.LEFT)!==fB.NONE&&(e=n.getLocation(t,IP.LEFT))}if(e===fB.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,IP.ON)===fB.NONE&&a.setLocation(t,IP.ON,i),a.isArea(t)){var l=a.getLocation(t,IP.LEFT),u=a.getLocation(t,IP.RIGHT);if(u!==fB.NONE){if(u!==i)throw new LP("side location conflict",s.getCoordinate());l===fB.NONE&&GB.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=l}else GB.isTrue(a.getLocation(t,IP.LEFT)===fB.NONE,"found single null side"),a.setLocation(t,IP.RIGHT,i),a.setLocation(t,IP.LEFT,i)}}},qT.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},qT.prototype.print=function(t){PB.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();)e.next().print(t)},qT.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},qT.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var r=e.size()-1,n=e.get(r).getLabel().getLocation(t,IP.LEFT);GB.isTrue(n!==fB.NONE,"Found unlabelled area edge");for(var i=n,o=this.iterator();o.hasNext();){var s=o.next().getLabel();GB.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,IP.LEFT),l=s.getLocation(t,IP.RIGHT);if(a===l)return!1;if(l!==i)return!1;i=a}return!0},qT.prototype.findIndex=function(t){this.iterator();for(var e=0;e<this._edgeList.size();e++)if(this._edgeList.get(e)===t)return e;return-1},qT.prototype.iterator=function(){return this.getEdges().iterator()},qT.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new hI(this._edgeMap.values())),this._edgeList},qT.prototype.getLocation=function(t,e,r){return this._ptInAreaLocation[t]===fB.NONE&&(this._ptInAreaLocation[t]=KT.locate(e,r[t].getGeometry())),this._ptInAreaLocation[t]},qT.prototype.toString=function(){var t=new mB;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var r=e.next();t.append(r),t.append("\n")}return t.toString()},qT.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();)e.next().computeLabel(t)},qT.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],r=this.iterator();r.hasNext();)for(var n=r.next().getLabel(),i=0;i<2;i++)n.isLine(i)&&n.getLocation(i)===fB.BOUNDARY&&(e[i]=!0);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel(),l=0;l<2;l++)if(a.isAnyNull(l)){var u=fB.NONE;if(e[l])u=fB.EXTERIOR;else{var h=s.getCoordinate();u=this.getLocation(l,h,t)}a.setAllLocationsIfNull(l,u)}},qT.prototype.getDegree=function(){return this._edgeMap.size()},qT.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},qT.prototype.interfaces_=function(){return[]},qT.prototype.getClass=function(){return qT};var WT=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){var t=this;this.getResultAreaEdges();for(var e=null,r=null,n=this._SCANNING_FOR_INCOMING,i=0;i<this._resultAreaEdgeList.size();i++){var o=t._resultAreaEdgeList.get(i),s=o.getSym();if(o.getLabel().isArea())switch(null===e&&o.isInResult()&&(e=o),n){case t._SCANNING_FOR_INCOMING:if(!s.isInResult())continue;r=s,n=t._LINKING_TO_OUTGOING;break;case t._LINKING_TO_OUTGOING:if(!o.isInResult())continue;r.setNext(o),n=t._SCANNING_FOR_INCOMING}}if(n===this._LINKING_TO_OUTGOING){if(null===e)throw new LP("no outgoing dirEdge found",this.getCoordinate());GB.isTrue(e.isInResult(),"unable to link last incoming dirEdge"),r.setNext(e)}},e.prototype.insert=function(t){var e=t;this.insertEdgeEnd(e,e)},e.prototype.getRightmostEdge=function(){var t=this.getEdges(),e=t.size();if(e<1)return null;var r=t.get(0);if(1===e)return r;var n=t.get(e-1),i=r.getQuadrant(),o=n.getQuadrant();return zP.isNorthern(i)&&zP.isNorthern(o)?r:zP.isNorthern(i)||zP.isNorthern(o)?0!==r.getDy()?r:0!==n.getDy()?n:(GB.shouldNeverReachHere("found two horizontal edges incident on node"),null):n},e.prototype.print=function(t){PB.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var r=e.next();t.print("out "),r.print(t),t.println(),t.print("in "),r.getSym().print(t),t.println()}},e.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new hI;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList},e.prototype.updateLabelling=function(t){for(var e=this.iterator();e.hasNext();){var r=e.next().getLabel();r.setAllLocationsIfNull(0,t.getLocation(0)),r.setAllLocationsIfNull(1,t.getLocation(1))}},e.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,r=this._edgeList.size()-1;r>=0;r--){var n=this._edgeList.get(r),i=n.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=n}e.setNext(t)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),r=t.getDepth(IP.LEFT),n=t.getDepth(IP.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),r);if(this.computeDepths(0,e,i)!==n)throw new LP("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[1],s=arguments[2],a=arguments[0];a<o;a++){var l=this._edgeList.get(a);l.setEdgeDepths(IP.RIGHT,s),s=l.getDepth(IP.LEFT)}return s}},e.prototype.mergeSymLabels=function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},e.prototype.linkMinimalDirectedEdges=function(t){for(var e=this,r=null,n=null,i=this._SCANNING_FOR_INCOMING,o=this._resultAreaEdgeList.size()-1;o>=0;o--){var s=e._resultAreaEdgeList.get(o),a=s.getSym();switch(null===r&&s.getEdgeRing()===t&&(r=s),i){case e._SCANNING_FOR_INCOMING:if(a.getEdgeRing()!==t)continue;n=a,i=e._LINKING_TO_OUTGOING;break;case e._LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;n.setNextMin(s),i=e._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(GB.isTrue(null!==r,"found null for first outgoing dirEdge"),GB.isTrue(r.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(r))},e.prototype.getOutgoingDegree=function(){if(0===arguments.length){for(var t=0,e=this.iterator();e.hasNext();)e.next().isInResult()&&t++;return t}if(1===arguments.length){for(var r=arguments[0],n=0,i=this.iterator();i.hasNext();)i.next().getEdgeRing()===r&&n++;return n}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=fB.NONE,e=this.iterator();e.hasNext();){var r=e.next(),n=r.getSym();if(!r.isLineEdge()){if(r.isInResult()){t=fB.INTERIOR;break}if(n.isInResult()){t=fB.EXTERIOR;break}}}if(t===fB.NONE)return null;for(var i=t,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getSym();s.isLineEdge()?s.getEdge().setCovered(i===fB.INTERIOR):(s.isInResult()&&(i=fB.EXTERIOR),a.isInResult()&&(i=fB.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new kP(fB.NONE);for(var r=this.iterator();r.hasNext();)for(var n=r.next().getEdge().getLabel(),i=0;i<2;i++){var o=n.getLocation(i);o!==fB.INTERIOR&&o!==fB.BOUNDARY||this._label.setLocation(i,fB.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(qT),XT=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(t){return new jP(t,new WT)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(WP),YT=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};YT.prototype.compareTo=function(t){var e=t;return YT.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},YT.prototype.interfaces_=function(){return[oB]},YT.prototype.getClass=function(){return YT},YT.orientation=function(t){return 1===fI.increasingDirection(t)},YT.compareOriented=function(t,e,r,n){for(var i=e?1:-1,o=n?1:-1,s=e?t.length:-1,a=n?r.length:-1,l=e?0:t.length-1,u=n?0:r.length-1;;){var h=t[l].compareTo(r[u]);if(0!==h)return h;var c=(l+=i)===s,A=(u+=o)===a;if(c&&!A)return-1;if(!c&&A)return 1;if(c&&A)return 0}};var ZT=function(){this._edges=new hI,this._ocaMap=new PI};ZT.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var r=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var n=r.getCoordinates(),i=0;i<n.length;i++)i>0&&t.print(","),t.print(n[i].x+" "+n[i].y);t.println(")")}t.print(") ")},ZT.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},ZT.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},ZT.prototype.iterator=function(){return this._edges.iterator()},ZT.prototype.getEdges=function(){return this._edges},ZT.prototype.get=function(t){return this._edges.get(t)},ZT.prototype.findEqualEdge=function(t){var e=new YT(t.getCoordinates());return this._ocaMap.get(e)},ZT.prototype.add=function(t){this._edges.add(t);var e=new YT(t.getCoordinates());this._ocaMap.put(e,t)},ZT.prototype.interfaces_=function(){return[]},ZT.prototype.getClass=function(){return ZT};var JT=function(){};JT.prototype.processIntersections=function(t,e,r,n){},JT.prototype.isDone=function(){},JT.prototype.interfaces_=function(){return[]},JT.prototype.getClass=function(){return JT};var $T=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};$T.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if($T.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.size()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},$T.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},$T.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},$T.prototype.getLineIntersector=function(){return this._li},$T.prototype.hasProperIntersection=function(){return this._hasProper},$T.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},$T.prototype.hasIntersection=function(){return this._hasIntersection},$T.prototype.isDone=function(){return!1},$T.prototype.hasInteriorIntersection=function(){return this._hasInterior},$T.prototype.interfaces_=function(){return[JT]},$T.prototype.getClass=function(){return $T},$T.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var tF=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],r=arguments[2];this.coord=new uB(t),this.segmentIndex=e,this.dist=r};tF.prototype.getSegmentIndex=function(){return this.segmentIndex},tF.prototype.getCoordinate=function(){return this.coord},tF.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},tF.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},tF.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},tF.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},tF.prototype.getDistance=function(){return this.dist},tF.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},tF.prototype.interfaces_=function(){return[oB]},tF.prototype.getClass=function(){return tF};var eF=function(){this._nodeMap=new PI,this.edge=null;var t=arguments[0];this.edge=t};eF.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},eF.prototype.iterator=function(){return this._nodeMap.values().iterator()},eF.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},eF.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)},eF.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this.edge.pts[e.segmentIndex],i=e.dist>0||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),s=0;o[s++]=new uB(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this.edge.pts[a];return i&&(o[s]=e.coord),new sF(o,new kP(this.edge._label))},eF.prototype.add=function(t,e,r){var n=new tF(t,e,r),i=this._nodeMap.get(n);return null!==i?i:(this._nodeMap.put(n,n),n)},eF.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1},eF.prototype.interfaces_=function(){return[]},eF.prototype.getClass=function(){return eF};var rF=function(){};rF.prototype.getChainStartIndices=function(t){var e=0,r=new hI;r.add(new vB(e));do{var n=this.findChainEnd(t,e);r.add(new vB(n)),e=n}while(e<t.length-1);return rF.toIntArray(r)},rF.prototype.findChainEnd=function(t,e){for(var r=zP.quadrant(t[e],t[e+1]),n=e+1;n<t.length&&zP.quadrant(t[n-1],t[n])===r;)n++;return n-1},rF.prototype.interfaces_=function(){return[]},rF.prototype.getClass=function(){return rF},rF.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var nF=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new FB,this.env2=new FB;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new rF;this.startIndex=e.getChainStartIndices(this.pts)};nF.prototype.getCoordinates=function(){return this.pts},nF.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e>r?e:r},nF.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e<r?e:r},nF.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[r],e.startIndex[r+1],n)}else if(6===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],l=arguments[4],u=arguments[5],h=this.pts[i],c=this.pts[o],A=s.pts[a],f=s.pts[l];if(o-i==1&&l-a==1)return u.addIntersections(this.e,i,s.e,a),null;if(this.env1.init(h,c),this.env2.init(A,f),!this.env1.intersects(this.env2))return null;var p=Math.trunc((i+o)/2),d=Math.trunc((a+l)/2);i<p&&(a<d&&this.computeIntersectsForChain(i,p,s,a,d,u),d<l&&this.computeIntersectsForChain(i,p,s,d,l,u)),p<o&&(a<d&&this.computeIntersectsForChain(p,o,s,a,d,u),d<l&&this.computeIntersectsForChain(p,o,s,d,l,u))}},nF.prototype.getStartIndexes=function(){return this.startIndex},nF.prototype.computeIntersects=function(t,e){for(var r=0;r<this.startIndex.length-1;r++)for(var n=0;n<t.startIndex.length-1;n++)this.computeIntersectsForChain(r,t,n,e)},nF.prototype.interfaces_=function(){return[]},nF.prototype.getClass=function(){return nF};var iF=function t(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var e=0;e<2;e++)for(var r=0;r<3;r++)this._depth[e][r]=t.NULL_VALUE},oF={NULL_VALUE:{configurable:!0}};iF.prototype.getDepth=function(t,e){return this._depth[t][e]},iF.prototype.setDepth=function(t,e,r){this._depth[t][e]=r},iF.prototype.isNull=function(){if(0===arguments.length){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==iF.NULL_VALUE)return!1;return!0}if(1===arguments.length){var r=arguments[0];return this._depth[r][1]===iF.NULL_VALUE}if(2===arguments.length){var n=arguments[0],i=arguments[1];return this._depth[n][i]===iF.NULL_VALUE}},iF.prototype.normalize=function(){for(var t=this,e=0;e<2;e++)if(!t.isNull(e)){var r=t._depth[e][1];t._depth[e][2]<r&&(r=t._depth[e][2]),r<0&&(r=0);for(var n=1;n<3;n++){var i=0;t._depth[e][n]>r&&(i=1),t._depth[e][n]=i}}},iF.prototype.getDelta=function(t){return this._depth[t][IP.RIGHT]-this._depth[t][IP.LEFT]},iF.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?fB.EXTERIOR:fB.INTERIOR},iF.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},iF.prototype.add=function(){var t=this;if(1===arguments.length)for(var e=arguments[0],r=0;r<2;r++)for(var n=1;n<3;n++){var i=e.getLocation(r,n);i!==fB.EXTERIOR&&i!==fB.INTERIOR||(t.isNull(r,n)?t._depth[r][n]=iF.depthAtLocation(i):t._depth[r][n]+=iF.depthAtLocation(i))}else if(3===arguments.length){var o=arguments[0],s=arguments[1];arguments[2]===fB.INTERIOR&&this._depth[o][s]++}},iF.prototype.interfaces_=function(){return[]},iF.prototype.getClass=function(){return iF},iF.depthAtLocation=function(t){return t===fB.EXTERIOR?0:t===fB.INTERIOR?1:iF.NULL_VALUE},oF.NULL_VALUE.get=function(){return-1},Object.defineProperties(iF,oF);var sF=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new eF(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new iF,this._depthDelta=0,1===arguments.length){var r=arguments[0];e.call(this,r,null)}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.pts=n,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new e(t,kP.toLineLabel(this._label))},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(t){this._isIsolated=t},e.prototype.setName=function(t){this._name=t},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var r=t;if(this.pts.length!==r.pts.length)return!1;for(var n=!0,i=!0,o=this.pts.length,s=0;s<this.pts.length;s++)if(this.pts[s].equals2D(r.pts[s])||(n=!1),this.pts[s].equals2D(r.pts[--o])||(i=!1),!n&&!i)return!1;return!0},e.prototype.getCoordinate=function(){if(0===arguments.length)return this.pts.length>0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},e.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(t){e.updateIM(this._label,t)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&3===this.pts.length&&!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")},e.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new nF(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new FB;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},e.prototype.addIntersection=function(t,e,r,n){var i=new uB(t.getIntersection(n)),o=e,s=t.getEdgeDistance(r,n),a=o+1;if(a<this.pts.length){var l=this.pts[a];i.equals2D(l)&&(o=a,s=0)}this.eiList.add(i,o,s)},e.prototype.toString=function(){var t=new mB;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0},e.prototype.setDepthDelta=function(t){this._depthDelta=t},e.prototype.getEdgeIntersectionList=function(){return this.eiList},e.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.updateIM=function(){if(2!==arguments.length)return t.prototype.updateIM.apply(this,arguments);var e=arguments[0],r=arguments[1];r.setAtLeastIfValid(e.getLocation(0,IP.ON),e.getLocation(1,IP.ON),1),e.isArea()&&(r.setAtLeastIfValid(e.getLocation(0,IP.LEFT),e.getLocation(1,IP.LEFT),2),r.setAtLeastIfValid(e.getLocation(0,IP.RIGHT),e.getLocation(1,IP.RIGHT),2))},e}(QP),aF=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new ZT,this._bufParams=t||null};aF.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},aF.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new kP(t.getLabel())).flip(),r.merge(n);var i=aF.depthDelta(n),o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(aF.depthDelta(t.getLabel()))},aF.prototype.buildSubgraphs=function(t,e){for(var r=new hI,n=t.iterator();n.hasNext();){var i=n.next(),o=i.getRightmostCoordinate(),s=new DT(r).getDepth(o);i.computeDepth(s),i.findResultEdges(),r.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},aF.prototype.createSubgraphs=function(t){for(var e=new hI,r=t.getNodes().iterator();r.hasNext();){var n=r.next();if(!n.isVisited()){var i=new NP;i.create(n),e.add(i)}}return iT.sort(e,iT.reverseOrder()),e},aF.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},aF.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new ST,r=new HB;return r.setPrecisionModel(t),e.setSegmentIntersector(new $T(r)),e},aF.prototype.buffer=function(t,e){var r=this._workingPrecisionModel;null===r&&(r=t.getPrecisionModel()),this._geomFact=t.getFactory();var n=new UT(r,this._bufParams),i=new HT(t,e,n).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,r),this._graph=new XP(new XT),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new YP(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},aF.prototype.computeNodedEdges=function(t,e){var r=this.getNoder(e);r.computeNodes(t);for(var n=r.getNodedSubstrings().iterator();n.hasNext();){var i=n.next(),o=i.getCoordinates();if(2!==o.length||!o[0].equals2D(o[1])){var s=i.getData(),a=new sF(i.getCoordinates(),new kP(s));this.insertUniqueEdge(a)}}},aF.prototype.setNoder=function(t){this._workingNoder=t},aF.prototype.interfaces_=function(){return[]},aF.prototype.getClass=function(){return aF},aF.depthDelta=function(t){var e=t.getLocation(0,IP.LEFT),r=t.getLocation(0,IP.RIGHT);return e===fB.INTERIOR&&r===fB.EXTERIOR?1:e===fB.EXTERIOR&&r===fB.INTERIOR?-1:0},aF.convertSegStrings=function(t){for(var e=new _P,r=new hI;t.hasNext();){var n=t.next(),i=e.createLineString(n.getCoordinates());r.add(i)}return e.buildGeometry(r)};var lF=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){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(4===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=arguments[3];this._noder=r,this._scaleFactor=n,this._offsetX=i,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};lF.prototype.rescale=function(){var t=this;if(dB(arguments[0],oI))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.rescale(r.getCoordinates())}else if(arguments[0]instanceof Array){for(var n=arguments[0],i=0;i<n.length;i++)n[i].x=n[i].x/t._scaleFactor+t._offsetX,n[i].y=n[i].y/t._scaleFactor+t._offsetY;2===n.length&&n[0].equals2D(n[1])&&PB.out.println(n)}},lF.prototype.scale=function(){var t=this;if(dB(arguments[0],oI)){for(var e=arguments[0],r=new hI,n=e.iterator();n.hasNext();){var i=n.next();r.add(new mT(t.scale(i.getCoordinates()),i.getData()))}return r}if(arguments[0]instanceof Array){for(var o=arguments[0],s=new Array(o.length).fill(null),a=0;a<o.length;a++)s[a]=new uB(Math.round((o[a].x-t._offsetX)*t._scaleFactor),Math.round((o[a].y-t._offsetY)*t._scaleFactor),o[a].z);return fI.removeRepeatedPoints(s)}},lF.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},lF.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},lF.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},lF.prototype.interfaces_=function(){return[ET]},lF.prototype.getClass=function(){return lF};var uF=function(){this._li=new HB,this._segStrings=null;var t=arguments[0];this._segStrings=t},hF={fact:{configurable:!0}};uF.prototype.checkEndPtVertexIntersections=function(){var t=this;if(0===arguments.length)for(var e=this._segStrings.iterator();e.hasNext();){var r=e.next().getCoordinates();t.checkEndPtVertexIntersections(r[0],t._segStrings),t.checkEndPtVertexIntersections(r[r.length-1],t._segStrings)}else if(2===arguments.length)for(var n=arguments[0],i=arguments[1].iterator();i.hasNext();)for(var o=i.next().getCoordinates(),s=1;s<o.length-1;s++)if(o[s].equals(n))throw new UB("found endpt/interior pt intersection at index "+s+" :pt "+n)},uF.prototype.checkInteriorIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),r=this._segStrings.iterator();r.hasNext();){var n=r.next();this.checkInteriorIntersections(e,n)}else if(2===arguments.length)for(var i=arguments[0],o=arguments[1],s=i.getCoordinates(),a=o.getCoordinates(),l=0;l<s.length-1;l++)for(var u=0;u<a.length-1;u++)this.checkInteriorIntersections(i,l,o,u);else if(4===arguments.length){var h=arguments[0],c=arguments[1],A=arguments[2],f=arguments[3];if(h===A&&c===f)return null;var p=h.getCoordinates()[c],d=h.getCoordinates()[c+1],g=A.getCoordinates()[f],y=A.getCoordinates()[f+1];if(this._li.computeIntersection(p,d,g,y),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,p,d)||this.hasInteriorIntersection(this._li,g,y)))throw new UB("found non-noded intersection at "+p+"-"+d+" and "+g+"-"+y)}},uF.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},uF.prototype.checkCollapses=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(1===arguments.length)for(var r=arguments[0].getCoordinates(),n=0;n<r.length-2;n++)this.checkCollapse(r[n],r[n+1],r[n+2])},uF.prototype.hasInteriorIntersection=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++){var i=t.getIntersection(n);if(!i.equals(e)&&!i.equals(r))return!0}return!1},uF.prototype.checkCollapse=function(t,e,r){if(t.equals(r))throw new UB("found non-noded collapse at "+uF.fact.createLineString([t,e,r]))},uF.prototype.interfaces_=function(){return[]},uF.prototype.getClass=function(){return uF},hF.fact.get=function(){return new _P},Object.defineProperties(uF,hF);var cF=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],r=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=r,e<=0)throw new rB("Scale factor must be non-zero");1!==e&&(this._pt=new uB(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new uB,this._p1Scaled=new uB),this.initCorners(this._pt)},AF={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};cF.prototype.intersectsScaled=function(t,e){var r=Math.min(t.x,e.x),n=Math.max(t.x,e.x),i=Math.min(t.y,e.y),o=Math.max(t.y,e.y),s=this._maxx<r||this._minx>n||this._maxy<i||this._miny>o;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return GB.isTrue(!(s&&a),"Found bad envelope test"),a},cF.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 uB(this._maxx,this._maxy),this._corner[1]=new uB(this._minx,this._maxy),this._corner[2]=new uB(this._minx,this._miny),this._corner[3]=new uB(this._maxx,this._miny)},cF.prototype.intersects=function(t,e){return 1===this._scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},cF.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},cF.prototype.getCoordinate=function(){return this._originalPt},cF.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},cF.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=cF.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new FB(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},cF.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()))))},cF.prototype.intersectsToleranceSquare=function(t,e){var r=!1,n=!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()&&(r=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper()||r&&n||t.equals(this._pt)||e.equals(this._pt)))))},cF.prototype.addSnappedNode=function(t,e){var r=t.getCoordinate(e),n=t.getCoordinate(e+1);return!!this.intersects(r,n)&&(t.addIntersection(this.getCoordinate(),e),!0)},cF.prototype.interfaces_=function(){return[]},cF.prototype.getClass=function(){return cF},AF.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(cF,AF);var fF=function(){this.tempEnv1=new FB,this.selectedSegment=new vT};fF.prototype.select=function(){if(1===arguments.length);else if(2===arguments.length){var t=arguments[1];arguments[0].getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}},fF.prototype.interfaces_=function(){return[]},fF.prototype.getClass=function(){return fF};var pF=function(){this._index=null;var t=arguments[0];this._index=t},dF={HotPixelSnapAction:{configurable:!0}};pF.prototype.snap=function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=e.getSafeEnvelope(),o=new gF(e,r,n);return this._index.query(i,{interfaces_:function(){return[tT]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},pF.prototype.interfaces_=function(){return[]},pF.prototype.getClass=function(){return pF},dF.HotPixelSnapAction.get=function(){return gF},Object.defineProperties(pF,dF);var gF=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._hotPixel=e,this._parentEdge=r,this._hotPixelVertexIndex=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(2!==arguments.length)return t.prototype.select.apply(this,arguments);var e=arguments[1],r=arguments[0].getContext();if(null!==this._parentEdge&&r===this._parentEdge&&e===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(r,e)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(fF),yF=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new hI};yF.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];if(this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var l=0;l<this._li.getIntersectionNum();l++)this._interiorIntersections.add(this._li.getIntersection(l));t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1)}},yF.prototype.isDone=function(){return!1},yF.prototype.getInteriorIntersections=function(){return this._interiorIntersections},yF.prototype.interfaces_=function(){return[JT]},yF.prototype.getClass=function(){return yF};var mF=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 HB,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};mF.prototype.checkCorrectness=function(t){var e=mT.getNodedSubstrings(t),r=new uF(e);try{r.checkValid()}catch(n){if(!(n instanceof BB))throw n;n.printStackTrace()}},mF.prototype.getNodedSubstrings=function(){return mT.getNodedSubstrings(this._nodedSegStrings)},mF.prototype.snapRound=function(t,e){var r=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(r),this.computeVertexSnaps(t)},mF.prototype.findInteriorIntersections=function(t,e){var r=new yF(e);return this._noder.setSegmentIntersector(r),this._noder.computeNodes(t),r.getInteriorIntersections()},mF.prototype.computeVertexSnaps=function(){var t=this;if(dB(arguments[0],oI))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.computeVertexSnaps(r)}else if(arguments[0]instanceof mT)for(var n=arguments[0],i=n.getCoordinates(),o=0;o<i.length;o++){var s=new cF(i[o],t._scaleFactor,t._li);t._pointSnapper.snap(s,n,o)&&n.addIntersection(i[o],o)}},mF.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new ST,this._pointSnapper=new pF(this._noder.getIndex()),this.snapRound(t,this._li)},mF.prototype.computeIntersectionSnaps=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next(),i=new cF(n,e._scaleFactor,e._li);e._pointSnapper.snap(i)}},mF.prototype.interfaces_=function(){return[ET]},mF.prototype.getClass=function(){return mF};var vF=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new IT,this._resultGeometry=null,this._saveException=null,1===arguments.length){var t=arguments[0];this._argGeom=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._argGeom=e,this._bufParams=r}},_F={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};vF.prototype.bufferFixedPrecision=function(t){var e=new lF(new mF(new gP(1)),t.getScale()),r=new aF(this._bufParams);r.setWorkingPrecisionModel(t),r.setNoder(e),this._resultGeometry=r.buffer(this._argGeom,this._distance)},vF.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=vF.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(o){if(!(o instanceof LP))throw o;t._saveException=o}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var r=arguments[0],n=vF.precisionScaleFactor(this._argGeom,this._distance,r),i=new gP(n);this.bufferFixedPrecision(i)}},vF.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===gP.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},vF.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},vF.prototype.bufferOriginalPrecision=function(){try{var t=new aF(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(!(e instanceof UB))throw e;this._saveException=e}},vF.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},vF.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},vF.prototype.interfaces_=function(){return[]},vF.prototype.getClass=function(){return vF},vF.bufferOp=function(){if(2===arguments.length){var t=arguments[1];return new vF(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof XB&&"number"==typeof arguments[1]){var e=arguments[1],r=arguments[2],n=new vF(arguments[0]);return n.setQuadrantSegments(r),n.getResultGeometry(e)}if(arguments[2]instanceof IT&&arguments[0]instanceof XB&&"number"==typeof arguments[1]){var i=arguments[1];return new vF(arguments[0],arguments[2]).getResultGeometry(i)}}else if(4===arguments.length){var o=arguments[1],s=arguments[2],a=arguments[3],l=new vF(arguments[0]);return l.setQuadrantSegments(s),l.setEndCapStyle(a),l.getResultGeometry(o)}},vF.precisionScaleFactor=function(t,e,r){var n=t.getEnvelopeInternal(),i=gB.max(Math.abs(n.getMaxX()),Math.abs(n.getMaxY()),Math.abs(n.getMinX()),Math.abs(n.getMinY()))+2*(e>0?e:0),o=r-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},_F.CAP_ROUND.get=function(){return IT.CAP_ROUND},_F.CAP_BUTT.get=function(){return IT.CAP_FLAT},_F.CAP_FLAT.get=function(){return IT.CAP_FLAT},_F.CAP_SQUARE.get=function(){return IT.CAP_SQUARE},_F.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(vF,_F);var wF=function(){this._pt=[new uB,new uB],this._distance=nB.NaN,this._isNull=!0};wF.prototype.getCoordinates=function(){return this._pt},wF.prototype.getCoordinate=function(t){return this._pt[t]},wF.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},wF.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){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(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},wF.prototype.getDistance=function(){return this._distance},wF.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},wF.prototype.interfaces_=function(){return[]},wF.prototype.getClass=function(){return wF};var bF=function(){};bF.prototype.interfaces_=function(){return[]},bF.prototype.getClass=function(){return bF},bF.computeDistance=function(){if(arguments[2]instanceof wF&&arguments[0]instanceof JI&&arguments[1]instanceof uB)for(var t=arguments[1],e=arguments[2],r=arguments[0].getCoordinates(),n=new vT,i=0;i<r.length-1;i++){n.setCoordinates(r[i],r[i+1]);var o=n.closestPoint(t);e.setMinimum(o,t)}else if(arguments[2]instanceof wF&&arguments[0]instanceof rP&&arguments[1]instanceof uB){var s=arguments[0],a=arguments[1],l=arguments[2];bF.computeDistance(s.getExteriorRing(),a,l);for(var u=0;u<s.getNumInteriorRing();u++)bF.computeDistance(s.getInteriorRingN(u),a,l)}else if(arguments[2]instanceof wF&&arguments[0]instanceof XB&&arguments[1]instanceof uB){var h=arguments[0],c=arguments[1],A=arguments[2];if(h instanceof JI)bF.computeDistance(h,c,A);else if(h instanceof rP)bF.computeDistance(h,c,A);else if(h instanceof DI)for(var f=h,p=0;p<f.getNumGeometries();p++){var d=f.getGeometryN(p);bF.computeDistance(d,c,A)}else A.setMinimum(h.getCoordinate(),c)}else if(arguments[2]instanceof wF&&arguments[0]instanceof vT&&arguments[1]instanceof uB){var g=arguments[1],y=arguments[2],m=arguments[0].closestPoint(g);y.setMinimum(m,g)}};var xF=function(t){this._maxPtDist=new wF,this._inputGeom=t||null},EF={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};xF.prototype.computeMaxMidpointDistance=function(t){var e=new SF(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},xF.prototype.computeMaxVertexDistance=function(t){var e=new CF(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},xF.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},xF.prototype.getDistancePoints=function(){return this._maxPtDist},xF.prototype.interfaces_=function(){return[]},xF.prototype.getClass=function(){return xF},EF.MaxPointDistanceFilter.get=function(){return CF},EF.MaxMidpointDistanceFilter.get=function(){return SF},Object.defineProperties(xF,EF);var CF=function(t){this._maxPtDist=new wF,this._minPtDist=new wF,this._geom=t||null};CF.prototype.filter=function(t){this._minPtDist.initialize(),bF.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},CF.prototype.getMaxPointDistance=function(){return this._maxPtDist},CF.prototype.interfaces_=function(){return[JB]},CF.prototype.getClass=function(){return CF};var SF=function(t){this._maxPtDist=new wF,this._minPtDist=new wF,this._geom=t||null};SF.prototype.filter=function(t,e){if(0===e)return null;var r=t.getCoordinate(e-1),n=t.getCoordinate(e),i=new uB((r.x+n.x)/2,(r.y+n.y)/2);this._minPtDist.initialize(),bF.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},SF.prototype.isDone=function(){return!1},SF.prototype.isGeometryChanged=function(){return!1},SF.prototype.getMaxPointDistance=function(){return this._maxPtDist},SF.prototype.interfaces_=function(){return[UI]},SF.prototype.getClass=function(){return SF};var BF=function(t){this._comps=t||null};BF.prototype.filter=function(t){t instanceof rP&&this._comps.add(t)},BF.prototype.interfaces_=function(){return[kI]},BF.prototype.getClass=function(){return BF},BF.getPolygons=function(){if(1===arguments.length){var t=arguments[0];return BF.getPolygons(t,new hI)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e instanceof rP?r.add(e):e instanceof DI&&e.apply(new BF(r)),r}};var IF=function(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var t=arguments[0];this._lines=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._lines=e,this._isForcedToLineString=r}};IF.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof iP){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof JI&&this._lines.add(t)},IF.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},IF.prototype.interfaces_=function(){return[WB]},IF.prototype.getClass=function(){return IF},IF.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(IF.getLines(t))}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().buildGeometry(IF.getLines(e,r))}},IF.getLines=function(){if(1===arguments.length){var t=arguments[0];return IF.getLines(t,!1)}if(2===arguments.length){if(dB(arguments[0],oI)&&dB(arguments[1],oI)){for(var e=arguments[1],r=arguments[0].iterator();r.hasNext();){var n=r.next();IF.getLines(n,e)}return e}if(arguments[0]instanceof XB&&"boolean"==typeof arguments[1]){var i=arguments[0],o=arguments[1],s=new hI;return i.apply(new IF(s,o)),s}if(arguments[0]instanceof XB&&dB(arguments[1],oI)){var a=arguments[0],l=arguments[1];return a instanceof JI?l.add(a):a.apply(new IF(l)),l}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&dB(arguments[0],oI)&&dB(arguments[1],oI)){for(var u=arguments[1],h=arguments[2],c=arguments[0].iterator();c.hasNext();){var A=c.next();IF.getLines(A,u,h)}return u}if("boolean"==typeof arguments[2]&&arguments[0]instanceof XB&&dB(arguments[1],oI)){var f=arguments[1],p=arguments[2];return arguments[0].apply(new IF(f,p)),f}}};var PF=function(){if(this._boundaryRule=$B.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];if(null===t)throw new rB("Rule must be non-null");this._boundaryRule=t}};PF.prototype.locateInternal=function(){if(arguments[0]instanceof uB&&arguments[1]instanceof rP){var t=arguments[0],e=arguments[1];if(e.isEmpty())return fB.EXTERIOR;var r=e.getExteriorRing(),n=this.locateInPolygonRing(t,r);if(n===fB.EXTERIOR)return fB.EXTERIOR;if(n===fB.BOUNDARY)return fB.BOUNDARY;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i),s=this.locateInPolygonRing(t,o);if(s===fB.INTERIOR)return fB.EXTERIOR;if(s===fB.BOUNDARY)return fB.BOUNDARY}return fB.INTERIOR}if(arguments[0]instanceof uB&&arguments[1]instanceof JI){var a=arguments[0],l=arguments[1];if(!l.getEnvelopeInternal().intersects(a))return fB.EXTERIOR;var u=l.getCoordinates();return l.isClosed()||!a.equals(u[0])&&!a.equals(u[u.length-1])?KB.isOnLine(a,u)?fB.INTERIOR:fB.EXTERIOR:fB.BOUNDARY}if(arguments[0]instanceof uB&&arguments[1]instanceof tP){var h=arguments[0];return arguments[1].getCoordinate().equals2D(h)?fB.INTERIOR:fB.EXTERIOR}},PF.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?KB.locatePointInRing(t,e.getCoordinates()):fB.EXTERIOR},PF.prototype.intersects=function(t,e){return this.locate(t,e)!==fB.EXTERIOR},PF.prototype.updateLocationInfo=function(t){t===fB.INTERIOR&&(this._isIn=!0),t===fB.BOUNDARY&&this._numBoundaries++},PF.prototype.computeLocation=function(t,e){var r=this;if(e instanceof tP&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof JI)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof rP)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof GI)for(var n=e,i=0;i<n.getNumGeometries();i++){var o=n.getGeometryN(i);r.updateLocationInfo(r.locateInternal(t,o))}else if(e instanceof oP)for(var s=e,a=0;a<s.getNumGeometries();a++){var l=s.getGeometryN(a);r.updateLocationInfo(r.locateInternal(t,l))}else if(e instanceof DI)for(var u=new VT(e);u.hasNext();){var h=u.next();h!==e&&r.computeLocation(t,h)}},PF.prototype.locate=function(t,e){return e.isEmpty()?fB.EXTERIOR:e instanceof JI||e instanceof rP?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?fB.BOUNDARY:this._numBoundaries>0||this._isIn?fB.INTERIOR:fB.EXTERIOR)},PF.prototype.interfaces_=function(){return[]},PF.prototype.getClass=function(){return PF};var TF=function t(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length)t.call(this,arguments[0],t.INSIDE_AREA,arguments[1]);else if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];this._component=e,this._segIndex=r,this._pt=n}},FF={INSIDE_AREA:{configurable:!0}};TF.prototype.isInsideArea=function(){return this._segIndex===TF.INSIDE_AREA},TF.prototype.getCoordinate=function(){return this._pt},TF.prototype.getGeometryComponent=function(){return this._component},TF.prototype.getSegmentIndex=function(){return this._segIndex},TF.prototype.interfaces_=function(){return[]},TF.prototype.getClass=function(){return TF},FF.INSIDE_AREA.get=function(){return-1},Object.defineProperties(TF,FF);var MF=function(t){this._pts=t||null};MF.prototype.filter=function(t){t instanceof tP&&this._pts.add(t)},MF.prototype.interfaces_=function(){return[kI]},MF.prototype.getClass=function(){return MF},MF.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof tP?iT.singletonList(t):MF.getPoints(t,new hI)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e instanceof tP?r.add(e):e instanceof DI&&e.apply(new MF(r)),r}};var LF=function(){this._locations=null;var t=arguments[0];this._locations=t};LF.prototype.filter=function(t){(t instanceof tP||t instanceof JI||t instanceof rP)&&this._locations.add(new TF(t,0,t.getCoordinate()))},LF.prototype.interfaces_=function(){return[kI]},LF.prototype.getClass=function(){return LF},LF.getLocations=function(t){var e=new hI;return t.apply(new LF(e)),e};var OF=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new PF,this._minDistanceLocation=null,this._minDistance=nB.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=n,this._terminateDistance=i}};OF.prototype.computeContainmentDistance=function(){var t=this;if(0===arguments.length){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(2===arguments.length){var r=arguments[0],n=arguments[1],i=1-r,o=BF.getPolygons(this._geom[r]);if(o.size()>0){var s=LF.getLocations(this._geom[i]);if(this.computeContainmentDistance(s,o,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=n[0],this._minDistanceLocation[r]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&dB(arguments[0],lI)&&dB(arguments[1],lI)){for(var a=arguments[0],l=arguments[1],u=arguments[2],h=0;h<a.size();h++)for(var c=a.get(h),A=0;A<l.size();A++)if(t.computeContainmentDistance(c,l.get(A),u),t._minDistance<=t._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof TF&&arguments[1]instanceof rP){var f=arguments[0],p=arguments[1],d=arguments[2],g=f.getCoordinate();if(fB.EXTERIOR!==this._ptLocator.locate(g,p))return this._minDistance=0,d[0]=f,d[1]=new TF(p,g),null}},OF.prototype.computeMinDistanceLinesPoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(n.computeMinDistance(o,a,r),n._minDistance<=n._terminateDistance)return null}},OF.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=IF.getLines(this._geom[0]),r=IF.getLines(this._geom[1]),n=MF.getPoints(this._geom[0]),i=MF.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,r,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(r,n,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(n,i,t),void this.updateMinDistance(t,!1))))},OF.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},OF.prototype.updateMinDistance=function(t,e){if(null===t[0])return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},OF.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},OF.prototype.computeMinDistance=function(){var t=this;if(0===arguments.length){if(null!==this._minDistanceLocation)return null;if(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance)return null;this.computeFacetDistance()}else if(3===arguments.length)if(arguments[2]instanceof Array&&arguments[0]instanceof JI&&arguments[1]instanceof tP){var e=arguments[0],r=arguments[1],n=arguments[2];if(e.getEnvelopeInternal().distance(r.getEnvelopeInternal())>this._minDistance)return null;for(var i=e.getCoordinates(),o=r.getCoordinate(),s=0;s<i.length-1;s++){var a=KB.distancePointLine(o,i[s],i[s+1]);if(a<t._minDistance){t._minDistance=a;var l=new vT(i[s],i[s+1]).closestPoint(o);n[0]=new TF(e,s,l),n[1]=new TF(r,0,o)}if(t._minDistance<=t._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof JI&&arguments[1]instanceof JI){var u=arguments[0],h=arguments[1],c=arguments[2];if(u.getEnvelopeInternal().distance(h.getEnvelopeInternal())>this._minDistance)return null;for(var A=u.getCoordinates(),f=h.getCoordinates(),p=0;p<A.length-1;p++)for(var d=0;d<f.length-1;d++){var g=KB.distanceLineLine(A[p],A[p+1],f[d],f[d+1]);if(g<t._minDistance){t._minDistance=g;var y=new vT(A[p],A[p+1]),m=new vT(f[d],f[d+1]),v=y.closestPoints(m);c[0]=new TF(u,p,v[0]),c[1]=new TF(h,d,v[1])}if(t._minDistance<=t._terminateDistance)return null}}},OF.prototype.computeMinDistancePoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s),l=o.getCoordinate().distance(a.getCoordinate());if(l<n._minDistance&&(n._minDistance=l,r[0]=new TF(o,0,o.getCoordinate()),r[1]=new TF(a,0,a.getCoordinate())),n._minDistance<=n._terminateDistance)return null}},OF.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new rB("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},OF.prototype.computeMinDistanceLines=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(n.computeMinDistance(o,a,r),n._minDistance<=n._terminateDistance)return null}},OF.prototype.interfaces_=function(){return[]},OF.prototype.getClass=function(){return OF},OF.distance=function(t,e){return new OF(t,e).distance()},OF.isWithinDistance=function(t,e,r){return new OF(t,e,r).distance()<=r},OF.nearestPoints=function(t,e){return new OF(t,e).nearestPoints()};var NF=function(){this._pt=[new uB,new uB],this._distance=nB.NaN,this._isNull=!0};NF.prototype.getCoordinates=function(){return this._pt},NF.prototype.getCoordinate=function(t){return this._pt[t]},NF.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},NF.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){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(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},NF.prototype.toString=function(){return kB.toLineString(this._pt[0],this._pt[1])},NF.prototype.getDistance=function(){return this._distance},NF.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},NF.prototype.interfaces_=function(){return[]},NF.prototype.getClass=function(){return NF};var RF=function(){};RF.prototype.interfaces_=function(){return[]},RF.prototype.getClass=function(){return RF},RF.computeDistance=function(){if(arguments[2]instanceof NF&&arguments[0]instanceof JI&&arguments[1]instanceof uB)for(var t=arguments[0],e=arguments[1],r=arguments[2],n=new vT,i=t.getCoordinates(),o=0;o<i.length-1;o++){n.setCoordinates(i[o],i[o+1]);var s=n.closestPoint(e);r.setMinimum(s,e)}else if(arguments[2]instanceof NF&&arguments[0]instanceof rP&&arguments[1]instanceof uB){var a=arguments[0],l=arguments[1],u=arguments[2];RF.computeDistance(a.getExteriorRing(),l,u);for(var h=0;h<a.getNumInteriorRing();h++)RF.computeDistance(a.getInteriorRingN(h),l,u)}else if(arguments[2]instanceof NF&&arguments[0]instanceof XB&&arguments[1]instanceof uB){var c=arguments[0],A=arguments[1],f=arguments[2];if(c instanceof JI)RF.computeDistance(c,A,f);else if(c instanceof rP)RF.computeDistance(c,A,f);else if(c instanceof DI)for(var p=c,d=0;d<p.getNumGeometries();d++){var g=p.getGeometryN(d);RF.computeDistance(g,A,f)}else f.setMinimum(c.getCoordinate(),A)}else if(arguments[2]instanceof NF&&arguments[0]instanceof vT&&arguments[1]instanceof uB){var y=arguments[1],m=arguments[2],v=arguments[0].closestPoint(y);m.setMinimum(v,y)}};var kF=function(){this._g0=null,this._g1=null,this._ptDist=new NF,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},UF={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};kF.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},kF.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new rB("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},kF.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},kF.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},kF.prototype.computeOrientedDistance=function(t,e,r){var n=new DF(e);if(t.apply(n),r.setMaximum(n.getMaxPointDistance()),this._densifyFrac>0){var i=new GF(e,this._densifyFrac);t.apply(i),r.setMaximum(i.getMaxPointDistance())}},kF.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},kF.prototype.interfaces_=function(){return[]},kF.prototype.getClass=function(){return kF},kF.distance=function(){if(2===arguments.length)return new kF(arguments[0],arguments[1]).distance();if(3===arguments.length){var t=arguments[2],e=new kF(arguments[0],arguments[1]);return e.setDensifyFraction(t),e.distance()}},UF.MaxPointDistanceFilter.get=function(){return DF},UF.MaxDensifiedByFractionDistanceFilter.get=function(){return GF},Object.defineProperties(kF,UF);var DF=function(){this._maxPtDist=new NF,this._minPtDist=new NF,this._euclideanDist=new RF,this._geom=null;var t=arguments[0];this._geom=t};DF.prototype.filter=function(t){this._minPtDist.initialize(),RF.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},DF.prototype.getMaxPointDistance=function(){return this._maxPtDist},DF.prototype.interfaces_=function(){return[JB]},DF.prototype.getClass=function(){return DF};var GF=function(){this._maxPtDist=new NF,this._minPtDist=new NF,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};GF.prototype.filter=function(t,e){var r=this;if(0===e)return null;for(var n=t.getCoordinate(e-1),i=t.getCoordinate(e),o=(i.x-n.x)/this._numSubSegs,s=(i.y-n.y)/this._numSubSegs,a=0;a<this._numSubSegs;a++){var l=n.x+a*o,u=n.y+a*s,h=new uB(l,u);r._minPtDist.initialize(),RF.computeDistance(r._geom,h,r._minPtDist),r._maxPtDist.setMaximum(r._minPtDist)}},GF.prototype.isDone=function(){return!1},GF.prototype.isGeometryChanged=function(){return!1},GF.prototype.getMaxPointDistance=function(){return this._maxPtDist},GF.prototype.interfaces_=function(){return[UI]},GF.prototype.getClass=function(){return GF};var QF=function(t,e,r){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=r||null},jF={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};QF.prototype.checkMaximumDistance=function(t,e,r){var n=new kF(e,t);if(n.setDensifyFraction(.25),this._maxDistanceFound=n.orientedDistance(),this._maxDistanceFound>r){this._isValid=!1;var i=n.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+kB.toLineString(i[0],i[1])+")"}},QF.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=QF.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),QF.VERBOSE&&PB.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},QF.prototype.checkNegativeValid=function(){if(!(this._input instanceof rP||this._input instanceof oP||this._input instanceof DI))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)},QF.prototype.getErrorIndicator=function(){return this._errorIndicator},QF.prototype.checkMinimumDistance=function(t,e,r){var n=new OF(t,e,r);if(this._minDistanceFound=n.distance(),this._minDistanceFound<r){this._isValid=!1;var i=n.nearestPoints();this._errorLocation=n.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+kB.toLineString(i[0],i[1])+" )"}},QF.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)},QF.prototype.getErrorLocation=function(){return this._errorLocation},QF.prototype.getPolygonLines=function(t){for(var e=new hI,r=new IF(e),n=BF.getPolygons(t).iterator();n.hasNext();)n.next().apply(r);return t.getFactory().buildGeometry(e)},QF.prototype.getErrorMessage=function(){return this._errMsg},QF.prototype.interfaces_=function(){return[]},QF.prototype.getClass=function(){return QF},jF.VERBOSE.get=function(){return!1},jF.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(QF,jF);var HF=function(t,e,r){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=r||null},zF={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};HF.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},HF.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*HF.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new FB(this._input.getEnvelopeInternal());e.expandBy(this._distance);var r=new FB(this._result.getEnvelopeInternal());r.expandBy(t),r.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(r)),this.report("Envelope")},HF.prototype.checkDistance=function(){var t=new QF(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")},HF.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")},HF.prototype.checkPolygonal=function(){this._result instanceof rP||this._result instanceof oP||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},HF.prototype.getErrorIndicator=function(){return this._errorIndicator},HF.prototype.getErrorLocation=function(){return this._errorLocation},HF.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},HF.prototype.report=function(t){if(!HF.VERBOSE)return null;PB.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},HF.prototype.getErrorMessage=function(){return this._errorMsg},HF.prototype.interfaces_=function(){return[]},HF.prototype.getClass=function(){return HF},HF.isValidMsg=function(t,e,r){var n=new HF(t,e,r);return n.isValid()?null:n.getErrorMessage()},HF.isValid=function(t,e,r){return!!new HF(t,e,r).isValid()},zF.VERBOSE.get=function(){return!1},zF.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(HF,zF);var VF=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};VF.prototype.getCoordinates=function(){return this._pts},VF.prototype.size=function(){return this._pts.length},VF.prototype.getCoordinate=function(t){return this._pts[t]},VF.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},VF.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:dT.octant(this.getCoordinate(t),this.getCoordinate(t+1))},VF.prototype.setData=function(t){this._data=t},VF.prototype.getData=function(){return this._data},VF.prototype.toString=function(){return kB.toLineString(new cP(this._pts))},VF.prototype.interfaces_=function(){return[gT]},VF.prototype.getClass=function(){return VF};var KF=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new hI,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};KF.prototype.getInteriorIntersection=function(){return this._interiorIntersection},KF.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},KF.prototype.getIntersectionSegments=function(){return this._intSegments},KF.prototype.count=function(){return this._intersectionCount},KF.prototype.getIntersections=function(){return this._intersections},KF.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},KF.prototype.setKeepIntersections=function(t){this._keepIntersections=t},KF.prototype.processIntersections=function(t,e,r,n){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===r&&e===n)return null;if(this._isCheckEndSegmentsOnly&&!this.isEndSegment(t,e)&&!this.isEndSegment(r,n))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,this._intSegments[1]=o,this._intSegments[2]=s,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},KF.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},KF.prototype.hasIntersection=function(){return null!==this._interiorIntersection},KF.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},KF.prototype.interfaces_=function(){return[JT]},KF.prototype.getClass=function(){return KF},KF.createAllIntersectionsFinder=function(t){var e=new KF(t);return e.setFindAllIntersections(!0),e},KF.createAnyIntersectionFinder=function(t){return new KF(t)},KF.createIntersectionCounter=function(t){var e=new KF(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var qF=function(){this._li=new HB,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};qF.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},qF.prototype.getIntersections=function(){return this._segInt.getIntersections()},qF.prototype.isValid=function(){return this.execute(),this._isValid},qF.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},qF.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new KF(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new ST;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},qF.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new LP(this.getErrorMessage(),this._segInt.getInteriorIntersection())},qF.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+kB.toLineString(t[0],t[1])+" and "+kB.toLineString(t[2],t[3])},qF.prototype.interfaces_=function(){return[]},qF.prototype.getClass=function(){return qF},qF.computeIntersections=function(t){var e=new qF(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var WF=function t(){this._nv=null;var e=arguments[0];this._nv=new qF(t.toSegmentStrings(e))};WF.prototype.checkValid=function(){this._nv.checkValid()},WF.prototype.interfaces_=function(){return[]},WF.prototype.getClass=function(){return WF},WF.toSegmentStrings=function(t){for(var e=new hI,r=t.iterator();r.hasNext();){var n=r.next();e.add(new VF(n.getCoordinates(),n))}return e},WF.checkValid=function(t){new WF(t).checkValid()};var XF=function(t){this._mapOp=t};XF.prototype.map=function(t){for(var e=new hI,r=0;r<t.getNumGeometries();r++){var n=this._mapOp.map(t.getGeometryN(r));n.isEmpty()||e.add(n)}return t.getFactory().createGeometryCollection(_P.toGeometryArray(e))},XF.prototype.interfaces_=function(){return[]},XF.prototype.getClass=function(){return XF},XF.map=function(t,e){return new XF(e).map(t)};var YF=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new hI,this._resultLineList=new hI;var t=arguments[0],e=arguments[1],r=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=r};YF.prototype.collectLines=function(t){for(var e=this,r=this._op.getGraph().getEdgeEnds().iterator();r.hasNext();){var n=r.next();e.collectLineEdge(n,t,e._lineEdgesList),e.collectBoundaryTouchEdge(n,t,e._lineEdgesList)}},YF.prototype.labelIsolatedLine=function(t,e){var r=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,r)},YF.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},YF.prototype.collectLineEdge=function(t,e,r){var n=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!TM.isResultOfOp(n,e)||i.isCovered()||(r.add(i),t.setVisitedEdge(!0)))},YF.prototype.findCoveredLineEdges=function(){for(var t=this._op.getGraph().getNodes().iterator();t.hasNext();)t.next().getEdges().findCoveredLineEdges();for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var r=e.next(),n=r.getEdge();if(r.isLineEdge()&&!n.isCoveredSet()){var i=this._op.isCoveredByA(r.getCoordinate());n.setCovered(i)}}},YF.prototype.labelIsolatedLines=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next(),n=r.getLabel();r.isIsolated()&&(n.isNull(0)?this.labelIsolatedLine(r,0):this.labelIsolatedLine(r,1))}},YF.prototype.buildLines=function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var r=e.next(),n=this._geometryFactory.createLineString(r.getCoordinates());this._resultLineList.add(n),r.setInResult(!0)}},YF.prototype.collectBoundaryTouchEdge=function(t,e,r){var n=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(GB.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(TM.isResultOfOp(n,e)&&e===TM.INTERSECTION&&(r.add(t.getEdge()),t.setVisitedEdge(!0))))},YF.prototype.interfaces_=function(){return[]},YF.prototype.getClass=function(){return YF};var ZF=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new hI;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};ZF.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var r=this._geometryFactory.createPoint(e);this._resultPointList.add(r)}},ZF.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var r=e.next();if(!(r.isInResult()||r.isIncidentEdgeInResult()||0!==r.getEdges().getDegree()&&t!==TM.INTERSECTION)){var n=r.getLabel();TM.isResultOfOp(n,t)&&this.filterCoveredNodeToPoint(r)}}},ZF.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},ZF.prototype.interfaces_=function(){return[]},ZF.prototype.getClass=function(){return ZF};var JF=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};JF.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},JF.prototype.transformPolygon=function(t,e){var r=!0,n=this.transformLinearRing(t.getExteriorRing(),t);null!==n&&n instanceof iP&&!n.isEmpty()||(r=!1);for(var i=new hI,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof iP||(r=!1),i.add(s))}if(r)return this._factory.createPolygon(n,i.toArray([]));var a=new hI;return null!==n&&a.add(n),a.addAll(i),this._factory.buildGeometry(a)},JF.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},JF.prototype.getInputGeometry=function(){return this._inputGeom},JF.prototype.transformMultiLineString=function(t,e){for(var r=new hI,n=0;n<t.getNumGeometries();n++){var i=this.transformLineString(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},JF.prototype.transformCoordinates=function(t,e){return this.copy(t)},JF.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},JF.prototype.transformMultiPoint=function(t,e){for(var r=new hI,n=0;n<t.getNumGeometries();n++){var i=this.transformPoint(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},JF.prototype.transformMultiPolygon=function(t,e){for(var r=new hI,n=0;n<t.getNumGeometries();n++){var i=this.transformPolygon(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},JF.prototype.copy=function(t){return t.copy()},JF.prototype.transformGeometryCollection=function(t,e){for(var r=new hI,n=0;n<t.getNumGeometries();n++){var i=this.transform(t.getGeometryN(n));null!==i&&(this._pruneEmptyGeometry&&i.isEmpty()||r.add(i))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(_P.toGeometryArray(r)):this._factory.buildGeometry(r)},JF.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof tP)return this.transformPoint(t,null);if(t instanceof nP)return this.transformMultiPoint(t,null);if(t instanceof iP)return this.transformLinearRing(t,null);if(t instanceof JI)return this.transformLineString(t,null);if(t instanceof GI)return this.transformMultiLineString(t,null);if(t instanceof rP)return this.transformPolygon(t,null);if(t instanceof oP)return this.transformMultiPolygon(t,null);if(t instanceof DI)return this.transformGeometryCollection(t,null);throw new rB("Unknown Geometry subtype: "+t.getClass().getName())},JF.prototype.transformLinearRing=function(t,e){var r=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===r)return this._factory.createLinearRing(null);var n=r.size();return n>0&&n<4&&!this._preserveType?this._factory.createLineString(r):this._factory.createLinearRing(r)},JF.prototype.interfaces_=function(){return[]},JF.prototype.getClass=function(){return JF};var $F=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new vT,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof JI&&"number"==typeof arguments[1]){var e=arguments[1];t.call(this,arguments[0].getCoordinates(),e)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=n}};$F.prototype.snapVertices=function(t,e){for(var r=this._isClosed?t.size()-1:t.size(),n=0;n<r;n++){var i=t.get(n),o=this.findSnapForVertex(i,e);null!==o&&(t.set(n,new uB(o)),0===n&&this._isClosed&&t.set(t.size()-1,new uB(o)))}},$F.prototype.findSnapForVertex=function(t,e){for(var r=0;r<e.length;r++){if(t.equals2D(e[r]))return null;if(t.distance(e[r])<this._snapTolerance)return e[r]}return null},$F.prototype.snapTo=function(t){var e=new AI(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},$F.prototype.snapSegments=function(t,e){if(0===e.length)return null;var r=e.length;e[0].equals2D(e[e.length-1])&&(r=e.length-1);for(var n=0;n<r;n++){var i=e[n],o=this.findSegmentIndexToSnap(i,t);o>=0&&t.add(o+1,new uB(i),!1)}},$F.prototype.findSegmentIndexToSnap=function(t,e){for(var r=this,n=nB.MAX_VALUE,i=-1,o=0;o<e.size()-1;o++){if(r._seg.p0=e.get(o),r._seg.p1=e.get(o+1),r._seg.p0.equals2D(t)||r._seg.p1.equals2D(t)){if(r._allowSnappingToSourceVertices)continue;return-1}var s=r._seg.distance(t);s<r._snapTolerance&&s<n&&(n=s,i=o)}return i},$F.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},$F.prototype.interfaces_=function(){return[]},$F.prototype.getClass=function(){return $F},$F.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var tM=function(t){this._srcGeom=t||null},eM={SNAP_PRECISION_FACTOR:{configurable:!0}};tM.prototype.snapTo=function(t,e){var r=this.extractTargetCoordinates(t);return new rM(e,r).transform(this._srcGeom)},tM.prototype.snapToSelf=function(t,e){var r=this.extractTargetCoordinates(this._srcGeom),n=new rM(t,r,!0).transform(this._srcGeom),i=n;return e&&dB(i,eP)&&(i=n.buffer(0)),i},tM.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},tM.prototype.extractTargetCoordinates=function(t){for(var e=new MI,r=t.getCoordinates(),n=0;n<r.length;n++)e.add(r[n]);return e.toArray(new Array(0).fill(null))},tM.prototype.computeMinimumSegmentLength=function(t){for(var e=nB.MAX_VALUE,r=0;r<t.length-1;r++){var n=t[r].distance(t[r+1]);n<e&&(e=n)}return e},tM.prototype.interfaces_=function(){return[]},tM.prototype.getClass=function(){return tM},tM.snap=function(t,e,r){var n=new Array(2).fill(null),i=new tM(t);n[0]=i.snapTo(e,r);var o=new tM(e);return n[1]=o.snapTo(n[0],r),n},tM.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=tM.computeSizeBasedSnapTolerance(t),r=t.getPrecisionModel();if(r.getType()===gP.FIXED){var n=1/r.getScale()*2/1.415;n>e&&(e=n)}return e}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min(tM.computeOverlaySnapTolerance(i),tM.computeOverlaySnapTolerance(o))}},tM.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*tM.SNAP_PRECISION_FACTOR},tM.snapToSelf=function(t,e,r){return new tM(t).snapToSelf(e,r)},eM.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(tM,eM);var rM=function(t){function e(e,r,n){t.call(this),this._snapTolerance=e||null,this._snapPts=r||null,this._isSelfSnap=void 0!==n&&n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var r=new $F(t,this._snapTolerance);return r.setAllowSnappingToSourceVertices(this._isSelfSnap),r.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var r=t.toCoordinateArray(),n=this.snapLine(r,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(JF),nM=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};nM.prototype.getCommon=function(){return nB.longBitsToDouble(this._commonBits)},nM.prototype.add=function(t){var e=nB.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=nM.signExpBits(this._commonBits),this._isFirst=!1,null):nM.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=nM.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=nM.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},nM.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=nB.longBitsToDouble(t),r="0000000000000000000000000000000000000000000000000000000000000000"+nB.toBinaryString(t),n=r.substring(r.length-64);return n.substring(0,1)+" "+n.substring(1,12)+"(exp) "+n.substring(12)+" [ "+e+" ]"}},nM.prototype.interfaces_=function(){return[]},nM.prototype.getClass=function(){return nM},nM.getBit=function(t,e){return 0!=(t&1<<e)?1:0},nM.signExpBits=function(t){return t>>52},nM.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},nM.numCommonMostSigMantissaBits=function(t,e){for(var r=0,n=52;n>=0;n--){if(nM.getBit(t,n)!==nM.getBit(e,n))return r;r++}return 52};var iM=function(){this._commonCoord=null,this._ccFilter=new sM},oM={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};iM.prototype.addCommonBits=function(t){var e=new aM(this._commonCoord);t.apply(e),t.geometryChanged()},iM.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new uB(this._commonCoord);e.x=-e.x,e.y=-e.y;var r=new aM(e);return t.apply(r),t.geometryChanged(),t},iM.prototype.getCommonCoordinate=function(){return this._commonCoord},iM.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},iM.prototype.interfaces_=function(){return[]},iM.prototype.getClass=function(){return iM},oM.CommonCoordinateFilter.get=function(){return sM},oM.Translater.get=function(){return aM},Object.defineProperties(iM,oM);var sM=function(){this._commonBitsX=new nM,this._commonBitsY=new nM};sM.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},sM.prototype.getCommonCoordinate=function(){return new uB(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},sM.prototype.interfaces_=function(){return[JB]},sM.prototype.getClass=function(){return sM};var aM=function(){this.trans=null;var t=arguments[0];this.trans=t};aM.prototype.filter=function(t,e){var r=t.getOrdinate(e,0)+this.trans.x,n=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,r),t.setOrdinate(e,1,n)},aM.prototype.isDone=function(){return!1},aM.prototype.isGeometryChanged=function(){return!0},aM.prototype.interfaces_=function(){return[UI]},aM.prototype.getClass=function(){return aM};var lM=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()};lM.prototype.selfSnap=function(t){return new tM(t).snapTo(t,this._snapTolerance)},lM.prototype.removeCommonBits=function(t){this._cbr=new iM,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},lM.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},lM.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),r=TM.overlayOp(e[0],e[1],t);return this.prepareResult(r)},lM.prototype.checkValid=function(t){t.isValid()||PB.out.println("Snapped geometry is invalid")},lM.prototype.computeSnapTolerance=function(){this._snapTolerance=tM.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},lM.prototype.snap=function(t){var e=this.removeCommonBits(t);return tM.snap(e[0],e[1],this._snapTolerance)},lM.prototype.interfaces_=function(){return[]},lM.prototype.getClass=function(){return lM},lM.overlayOp=function(t,e,r){return new lM(t,e).getResultGeometry(r)},lM.union=function(t,e){return lM.overlayOp(t,e,TM.UNION)},lM.intersection=function(t,e){return lM.overlayOp(t,e,TM.INTERSECTION)},lM.symDifference=function(t,e){return lM.overlayOp(t,e,TM.SYMDIFFERENCE)},lM.difference=function(t,e){return lM.overlayOp(t,e,TM.DIFFERENCE)};var uM=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};uM.prototype.getResultGeometry=function(t){var e=null,r=!1,n=null;try{e=TM.overlayOp(this._geom[0],this._geom[1],t),r=!0}catch(i){if(!(i instanceof UB))throw i;n=i}if(!r)try{e=lM.overlayOp(this._geom[0],this._geom[1],t)}catch(i){throw i instanceof UB?n:i}return e},uM.prototype.interfaces_=function(){return[]},uM.prototype.getClass=function(){return uM},uM.overlayOp=function(t,e,r){return new uM(t,e).getResultGeometry(r)},uM.union=function(t,e){return uM.overlayOp(t,e,TM.UNION)},uM.intersection=function(t,e){return uM.overlayOp(t,e,TM.INTERSECTION)},uM.symDifference=function(t,e){return uM.overlayOp(t,e,TM.SYMDIFFERENCE)},uM.difference=function(t,e){return uM.overlayOp(t,e,TM.DIFFERENCE)};var hM=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};hM.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},hM.prototype.interfaces_=function(){return[]},hM.prototype.getClass=function(){return hM};var cM=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var e=arguments[0],r=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=r}else if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=n,this._xValue=i,this._obj=o}},AM={INSERT:{configurable:!0},DELETE:{configurable:!0}};cM.prototype.isDelete=function(){return this._eventType===cM.DELETE},cM.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},cM.prototype.getObject=function(){return this._obj},cM.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},cM.prototype.getInsertEvent=function(){return this._insertEvent},cM.prototype.isInsert=function(){return this._eventType===cM.INSERT},cM.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},cM.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},cM.prototype.interfaces_=function(){return[oB]},cM.prototype.getClass=function(){return cM},AM.INSERT.get=function(){return 1},AM.DELETE.get=function(){return 2},Object.defineProperties(cM,AM);var fM=function(){};fM.prototype.interfaces_=function(){return[]},fM.prototype.getClass=function(){return fM};var pM=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],r=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=r};pM.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(pM.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},pM.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},pM.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},pM.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},pM.prototype.isBoundaryPointInternal=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next().getCoordinate();if(t.isIntersection(n))return!0}return!1},pM.prototype.hasProperIntersection=function(){return this._hasProper},pM.prototype.hasIntersection=function(){return this._hasIntersection},pM.prototype.isDone=function(){return this._isDone},pM.prototype.isBoundaryPoint=function(t,e){return!(null===e||!this.isBoundaryPointInternal(t,e[0])&&!this.isBoundaryPointInternal(t,e[1]))},pM.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},pM.prototype.addIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),r.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,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))))},pM.prototype.interfaces_=function(){return[]},pM.prototype.getClass=function(){return pM},pM.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var dM=function(t){function e(){t.call(this),this.events=new hI,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){iT.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},e.prototype.computeIntersections=function(){if(1===arguments.length){var t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var e=0;e<this.events.size();e++){var r=this.events.get(e);if(r.isInsert()&&this.processOverlaps(e,r.getDeleteEventIndex(),r,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof pM&&dB(arguments[0],lI)&&dB(arguments[1],lI)){var n=arguments[0],i=arguments[1],o=arguments[2];this.addEdges(n,n),this.addEdges(i,i),this.computeIntersections(o)}else if("boolean"==typeof arguments[2]&&dB(arguments[0],lI)&&arguments[1]instanceof pM){var s=arguments[0],a=arguments[1];arguments[2]?this.addEdges(s,null):this.addEdges(s),this.computeIntersections(a)}},e.prototype.addEdge=function(t,e){for(var r=t.getMonotoneChainEdge(),n=r.getStartIndexes(),i=0;i<n.length-1;i++){var o=new hM(r,i),s=new cM(e,r.getMinX(i),o);this.events.add(s),this.events.add(new cM(r.getMaxX(i),s))}},e.prototype.processOverlaps=function(t,e,r,n){for(var i=r.getObject(),o=t;o<e;o++){var s=this.events.get(o);if(s.isInsert()){var a=s.getObject();r.isSameLabel(s)||(i.computeIntersections(a,n),this.nOverlaps++)}}},e.prototype.addEdges=function(){if(1===arguments.length)for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();){var i=n.next();this.addEdge(i,r)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(fM),gM=function(){this._min=nB.POSITIVE_INFINITY,this._max=nB.NEGATIVE_INFINITY},yM={NodeComparator:{configurable:!0}};gM.prototype.getMin=function(){return this._min},gM.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},gM.prototype.getMax=function(){return this._max},gM.prototype.toString=function(){return kB.toLineString(new uB(this._min,0),new uB(this._max,0))},gM.prototype.interfaces_=function(){return[]},gM.prototype.getClass=function(){return gM},yM.NodeComparator.get=function(){return mM},Object.defineProperties(gM,yM);var mM=function(){};mM.prototype.compare=function(t,e){var r=t,n=e,i=(r._min+r._max)/2,o=(n._min+n._max)/2;return i<o?-1:i>o?1:0},mM.prototype.interfaces_=function(){return[aB]},mM.prototype.getClass=function(){return mM};var vM=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],r=arguments[1],n=arguments[2];this._min=e,this._max=r,this._item=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,r){if(!this.intersects(t,e))return null;r.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(gM),_M=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],r=arguments[1];this._node1=e,this._node2=r,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},e.prototype.query=function(t,e,r){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,r),null!==this._node2&&this._node2.query(t,e,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(gM),wM=function(){this._leaves=new hI,this._root=null,this._level=0};wM.prototype.buildTree=function(){iT.sort(this._leaves,new gM.NodeComparator);for(var t=this._leaves,e=null,r=new hI;;){if(this.buildLevel(t,r),1===r.size())return r.get(0);e=t,t=r,r=e}},wM.prototype.insert=function(t,e,r){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new vM(t,e,r))},wM.prototype.query=function(t,e,r){this.init(),this._root.query(t,e,r)},wM.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},wM.prototype.printNode=function(t){PB.out.println(kB.toLineString(new uB(t._min,this._level),new uB(t._max,this._level)))},wM.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},wM.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var r=0;r<t.size();r+=2){var n=t.get(r);if(null===(r+1<t.size()?t.get(r):null))e.add(n);else{var i=new _M(t.get(r),t.get(r+1));e.add(i)}}},wM.prototype.interfaces_=function(){return[]},wM.prototype.getClass=function(){return wM};var bM=function(){this._items=new hI};bM.prototype.visitItem=function(t){this._items.add(t)},bM.prototype.getItems=function(){return this._items},bM.prototype.interfaces_=function(){return[tT]},bM.prototype.getClass=function(){return bM};var xM=function(){this._index=null;var t=arguments[0];if(!dB(t,eP))throw new rB("Argument must be Polygonal");this._index=new SM(t)},EM={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};xM.prototype.locate=function(t){var e=new VB(t),r=new CM(e);return this._index.query(t.y,t.y,r),e.getLocation()},xM.prototype.interfaces_=function(){return[zT]},xM.prototype.getClass=function(){return xM},EM.SegmentVisitor.get=function(){return CM},EM.IntervalIndexedGeometry.get=function(){return SM},Object.defineProperties(xM,EM);var CM=function(){this._counter=null;var t=arguments[0];this._counter=t};CM.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},CM.prototype.interfaces_=function(){return[tT]},CM.prototype.getClass=function(){return CM};var SM=function(){this._index=new wM;var t=arguments[0];this.init(t)};SM.prototype.init=function(t){for(var e=IF.getLines(t).iterator();e.hasNext();){var r=e.next().getCoordinates();this.addLine(r)}},SM.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var r=new vT(t[e-1],t[e]),n=Math.min(r.p0.y,r.p1.y),i=Math.max(r.p0.y,r.p1.y);this._index.insert(n,i,r)}},SM.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new bM;return this._index.query(t,e,r),r.getItems()}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._index.query(n,i,o)}},SM.prototype.interfaces_=function(){return[]},SM.prototype.getClass=function(){return SM};var BM=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new dP,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new PF,2===arguments.length){var e=arguments[0],r=arguments[1],n=$B.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=r,this._boundaryNodeRule=n,null!==r&&this.add(r)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];this._argIndex=i,this._parentGeom=o,this._boundaryNodeRule=s,null!==o&&this.add(o)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertBoundaryPoint=function(t,r){var n=this._nodes.addNode(r).getLabel(),i=1;fB.NONE,n.getLocation(t,IP.ON)===fB.BOUNDARY&&i++;var o=e.determineBoundary(this._boundaryNodeRule,i);n.setLocation(t,o)},e.prototype.computeSelfNodes=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var r=arguments[1],n=arguments[2],i=new pM(arguments[0],!0,!1);i.setIsDoneIfProperInt(n);var o=this.createEdgeSetIntersector(),s=this._parentGeom instanceof iP||this._parentGeom instanceof rP||this._parentGeom instanceof oP,a=r||!s;return o.computeIntersections(this._edges,i,a),this.addSelfIntersectionNodes(this._argIndex),i}},e.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();)e.next().eiList.addSplitEdges(t)},e.prototype.computeEdgeIntersections=function(t,e,r){var n=new pM(e,r,!0);return n.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,n),n},e.prototype.getGeometry=function(){return this._parentGeom},e.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},e.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},e.prototype.addPoint=function(){if(arguments[0]instanceof tP){var t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,fB.INTERIOR)}else if(arguments[0]instanceof uB){var e=arguments[0];this.insertPoint(this._argIndex,e,fB.INTERIOR)}},e.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),fB.EXTERIOR,fB.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var r=t.getInteriorRingN(e);this.addPolygonRing(r,fB.INTERIOR,fB.EXTERIOR)}},e.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],fB.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],fB.BOUNDARY)},e.prototype.addLineString=function(t){var e=fI.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var r=new sF(e,new kP(this._argIndex,fB.INTERIOR));this._lineEdgeMap.put(t,r),this.insertEdge(r),GB.isTrue(e.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),r=0,n=t.iterator();n.hasNext();){var i=n.next();e[r++]=i.getCoordinate().copy()}return e},e.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(t,e,r){if(this.isBoundaryNode(t,e))return null;r===fB.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,r)},e.prototype.addPolygonRing=function(t,e,r){if(t.isEmpty())return null;var n=fI.removeRepeatedPoints(t.getCoordinates());if(n.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=n[0],null;var i=e,o=r;KB.isCCW(n)&&(i=r,o=e);var s=new sF(n,new kP(this._argIndex,fB.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,n[0],fB.BOUNDARY)},e.prototype.insertPoint=function(t,e,r){var n=this._nodes.addNode(e),i=n.getLabel();null===i?n._label=new kP(t,r):i.setLocation(t,r)},e.prototype.createEdgeSetIntersector=function(){return new dM},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var r=e.next(),n=r.getLabel().getLocation(t),i=r.eiList.iterator();i.hasNext();){var o=i.next();this.addSelfIntersectionNode(t,o.coord,n)}},e.prototype.add=function(){if(1!==arguments.length)return t.prototype.add.apply(this,arguments);var e=arguments[0];if(e.isEmpty())return null;if(e instanceof oP&&(this._useBoundaryDeterminationRule=!1),e instanceof rP)this.addPolygon(e);else if(e instanceof JI)this.addLineString(e);else if(e instanceof tP)this.addPoint(e);else if(e instanceof nP)this.addCollection(e);else if(e instanceof GI)this.addCollection(e);else if(e instanceof oP)this.addCollection(e);else{if(!(e instanceof DI))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},e.prototype.locate=function(t){return dB(this._parentGeom,eP)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new xM(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},e.prototype.findEdge=function(){if(1===arguments.length){var e=arguments[0];return this._lineEdgeMap.get(e)}return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(t,e){return t.isInBoundary(e)?fB.BOUNDARY:fB.INTERIOR},e}(XP),IM=function(){if(this._li=new HB,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new BM(0,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1],n=$B.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new BM(0,e,n),this._arg[1]=new BM(1,r,n)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];i.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new BM(0,i,s),this._arg[1]=new BM(1,o,s)}};IM.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},IM.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},IM.prototype.interfaces_=function(){return[]},IM.prototype.getClass=function(){return IM};var PM=function(){};PM.prototype.interfaces_=function(){return[]},PM.prototype.getClass=function(){return PM},PM.map=function(){if(arguments[0]instanceof XB&&dB(arguments[1],PM.MapOp)){for(var t=arguments[0],e=arguments[1],r=new hI,n=0;n<t.getNumGeometries();n++){var i=e.map(t.getGeometryN(n));null!==i&&r.add(i)}return t.getFactory().buildGeometry(r)}if(dB(arguments[0],oI)&&dB(arguments[1],PM.MapOp)){for(var o=arguments[0],s=arguments[1],a=new hI,l=o.iterator();l.hasNext();){var u=l.next(),h=s.map(u);null!==h&&a.add(h)}return a}},PM.MapOp=function(){};var TM=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r),this._ptLocator=new PF,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new ZT,this._resultPolyList=new hI,this._resultLineList=new hI,this._resultPointList=new hI,this._graph=new XP(new XT),this._geomFact=e.getFactory()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new kP(t.getLabel())).flip();var i=e.getDepth();i.isNull()&&i.add(r),i.add(n),r.merge(n)}else this._edgeList.add(t)},e.prototype.getGraph=function(){return this._graph},e.prototype.cancelDuplicateResultEdges=function(){for(var t=this._graph.getEdgeEnds().iterator();t.hasNext();){var e=t.next(),r=e.getSym();e.isInResult()&&r.isInResult()&&(e.setInResult(!1),r.setInResult(!1))}},e.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},e.prototype.computeGeometry=function(t,r,n,i){var o=new hI;return o.addAll(t),o.addAll(r),o.addAll(n),o.isEmpty()?e.createEmptyResult(i,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(o)},e.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().mergeSymLabels()},e.prototype.isCovered=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(this._ptLocator.locate(t,n)!==fB.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var t=new hI,e=this._edgeList.iterator();e.hasNext();){var r=e.next();r.isCollapsed()&&(e.remove(),t.add(r.getCollapsedEdge()))}this._edgeList.addAll(t)},e.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),r=e.getEdges().getLabel();e.getLabel().merge(r)}},e.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},e.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();this.insertUniqueEdge(r)}},e.prototype.computeOverlay=function(t){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 e=new hI;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),WF.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var r=new YP(this._geomFact);r.add(this._graph),this._resultPolyList=r.getPolygons();var n=new YF(this,this._geomFact,this._ptLocator);this._resultLineList=n.build(t);var i=new ZF(this,this._geomFact,this._ptLocator);this._resultPointList=i.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)},e.prototype.labelIncompleteNode=function(t,e){var r=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,r)},e.prototype.copyPoints=function(t){for(var e=this._arg[t].getNodeIterator();e.hasNext();){var r=e.next();this._graph.addNode(r.getCoordinate()).setLabel(t,r.getLabel().getLocation(t))}},e.prototype.findResultAreaEdges=function(t){for(var r=this._graph.getEdgeEnds().iterator();r.hasNext();){var n=r.next(),i=n.getLabel();i.isArea()&&!n.isInteriorAreaEdge()&&e.isResultOfOp(i.getLocation(0,IP.RIGHT),i.getLocation(1,IP.RIGHT),t)&&n.setInResult(!0)}},e.prototype.computeLabelsFromDepths=function(){for(var t=this._edgeList.iterator();t.hasNext();){var e=t.next(),r=e.getLabel(),n=e.getDepth();if(!n.isNull()){n.normalize();for(var i=0;i<2;i++)r.isNull(i)||!r.isArea()||n.isNull(i)||(0===n.getDelta(i)?r.toLine(i):(GB.isTrue(!n.isNull(i,IP.LEFT),"depth of LEFT side has not been initialized"),r.setLocation(i,IP.LEFT,n.getLocation(i,IP.LEFT)),GB.isTrue(!n.isNull(i,IP.RIGHT),"depth of RIGHT side has not been initialized"),r.setLocation(i,IP.RIGHT,n.getLocation(i,IP.RIGHT))))}}},e.prototype.computeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},e.prototype.labelIncompleteNodes=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),r=e.getLabel();e.isIsolated()&&(r.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(r)}},e.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(IM);TM.overlayOp=function(t,e,r){return new TM(t,e).getResultGeometry(r)},TM.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return TM.createEmptyResult(TM.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var r=e;return XF.map(t,{interfaces_:function(){return[PM.MapOp]},map:function(t){return t.intersection(r)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),uM.overlayOp(t,e,TM.INTERSECTION)},TM.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return TM.createEmptyResult(TM.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),uM.overlayOp(t,e,TM.SYMDIFFERENCE)},TM.resultDimension=function(t,e,r){var n=e.getDimension(),i=r.getDimension(),o=-1;switch(t){case TM.INTERSECTION:o=Math.min(n,i);break;case TM.UNION:o=Math.max(n,i);break;case TM.DIFFERENCE:o=n;break;case TM.SYMDIFFERENCE:o=Math.max(n,i)}return o},TM.createEmptyResult=function(t,e,r,n){var i=null;switch(TM.resultDimension(t,e,r)){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()}return i},TM.difference=function(t,e){return t.isEmpty()?TM.createEmptyResult(TM.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),uM.overlayOp(t,e,TM.DIFFERENCE))},TM.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=t.getLocation(0),n=t.getLocation(1);return TM.isResultOfOp(r,n,e)}if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];switch(i===fB.BOUNDARY&&(i=fB.INTERIOR),o===fB.BOUNDARY&&(o=fB.INTERIOR),s){case TM.INTERSECTION:return i===fB.INTERIOR&&o===fB.INTERIOR;case TM.UNION:return i===fB.INTERIOR||o===fB.INTERIOR;case TM.DIFFERENCE:return i===fB.INTERIOR&&o!==fB.INTERIOR;case TM.SYMDIFFERENCE:return i===fB.INTERIOR&&o!==fB.INTERIOR||i!==fB.INTERIOR&&o===fB.INTERIOR}return!1}},TM.INTERSECTION=1,TM.UNION=2,TM.DIFFERENCE=3,TM.SYMDIFFERENCE=4;var FM=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new PF,this._seg=new vT;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};FM.prototype.isWithinToleranceOfBoundary=function(t){for(var e=this,r=0;r<this._linework.getNumGeometries();r++)for(var n=e._linework.getGeometryN(r).getCoordinateSequence(),i=0;i<n.size()-1;i++)if(n.getCoordinate(i,e._seg.p0),n.getCoordinate(i+1,e._seg.p1),e._seg.distance(t)<=e._boundaryDistanceTolerance)return!0;return!1},FM.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?fB.BOUNDARY:this._ptLocator.locate(t,this._g)},FM.prototype.extractLinework=function(t){var e=new MM;t.apply(e);var r=e.getLinework(),n=_P.toLineStringArray(r);return t.getFactory().createMultiLineString(n)},FM.prototype.interfaces_=function(){return[]},FM.prototype.getClass=function(){return FM};var MM=function(){this._linework=null,this._linework=new hI};MM.prototype.getLinework=function(){return this._linework},MM.prototype.filter=function(t){if(t instanceof rP){var e=t;this._linework.add(e.getExteriorRing());for(var r=0;r<e.getNumInteriorRing();r++)this._linework.add(e.getInteriorRingN(r))}},MM.prototype.interfaces_=function(){return[kI]},MM.prototype.getClass=function(){return MM};var LM=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};LM.prototype.extractPoints=function(t,e,r){for(var n=t.getCoordinates(),i=0;i<n.length-1;i++)this.computeOffsetPoints(n[i],n[i+1],e,r)},LM.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},LM.prototype.getPoints=function(t){for(var e=new hI,r=IF.getLines(this._g).iterator();r.hasNext();){var n=r.next();this.extractPoints(n,t,e)}return e},LM.prototype.computeOffsetPoints=function(t,e,r,n){var i=e.x-t.x,o=e.y-t.y,s=Math.sqrt(i*i+o*o),a=r*i/s,l=r*o/s,u=(e.x+t.x)/2,h=(e.y+t.y)/2;if(this._doLeft){var c=new uB(u-l,h+a);n.add(c)}if(this._doRight){var A=new uB(u+l,h-a);n.add(A)}},LM.prototype.interfaces_=function(){return[]},LM.prototype.getClass=function(){return LM};var OM=function t(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=t.TOLERANCE,this._testCoords=new hI;var e=arguments[0],r=arguments[1],n=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,r),this._geom=[e,r,n],this._locFinder=[new FM(this._geom[0],this._boundaryDistanceTolerance),new FM(this._geom[1],this._boundaryDistanceTolerance),new FM(this._geom[2],this._boundaryDistanceTolerance)]},NM={TOLERANCE:{configurable:!0}};OM.prototype.reportResult=function(t,e,r){PB.out.println("Overlay result invalid - A:"+fB.toLocationSymbol(e[0])+" B:"+fB.toLocationSymbol(e[1])+" expected:"+(r?"i":"e")+" actual:"+fB.toLocationSymbol(e[2]))},OM.prototype.isValid=function(t){return this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]),this.checkValid(t)},OM.prototype.checkValid=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=0;r<this._testCoords.size();r++){var n=t._testCoords.get(r);if(!t.checkValid(e,n))return t._invalidLocation=n,!1}return!0}if(2===arguments.length){var i=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),!!OM.hasLocation(this._location,fB.BOUNDARY)||this.isValidResult(i,this._location)}},OM.prototype.addTestPts=function(t){var e=new LM(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},OM.prototype.isValidResult=function(t,e){var r=TM.isResultOfOp(e[0],e[1],t),n=!(r^e[2]===fB.INTERIOR);return n||this.reportResult(t,e,r),n},OM.prototype.getInvalidLocation=function(){return this._invalidLocation},OM.prototype.interfaces_=function(){return[]},OM.prototype.getClass=function(){return OM},OM.hasLocation=function(t,e){for(var r=0;r<3;r++)if(t[r]===e)return!0;return!1},OM.computeBoundaryDistanceTolerance=function(t,e){return Math.min(tM.computeSizeBasedSnapTolerance(t),tM.computeSizeBasedSnapTolerance(e))},OM.isValid=function(t,e,r,n){return new OM(t,e,n).isValid(r)},NM.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(OM,NM);var RM=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};RM.prototype.extractElements=function(t,e){if(null===t)return null;for(var r=0;r<t.getNumGeometries();r++){var n=t.getGeometryN(r);this._skipEmpty&&n.isEmpty()||e.add(n)}},RM.prototype.combine=function(){for(var t=new hI,e=this._inputGeoms.iterator();e.hasNext();){var r=e.next();this.extractElements(r,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},RM.prototype.interfaces_=function(){return[]},RM.prototype.getClass=function(){return RM},RM.combine=function(){if(1===arguments.length)return new RM(arguments[0]).combine();if(2===arguments.length){var t=arguments[0],e=arguments[1];return new RM(RM.createList(t,e)).combine()}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];return new RM(RM.createList(r,n,i)).combine()}},RM.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},RM.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new hI;return r.add(t),r.add(e),r}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],s=new hI;return s.add(n),s.add(i),s.add(o),s}};var kM=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new hI)},UM={STRTREE_NODE_CAPACITY:{configurable:!0}};kM.prototype.reduceToGeometries=function(t){for(var e=new hI,r=t.iterator();r.hasNext();){var n=r.next(),i=null;dB(n,lI)?i=this.unionTree(n):n instanceof XB&&(i=n),e.add(i)}return e},kM.prototype.extractByEnvelope=function(t,e,r){for(var n=new hI,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);o.getEnvelopeInternal().intersects(t)?n.add(o):r.add(o)}return this._geomFactory.buildGeometry(n)},kM.prototype.unionOptimized=function(t,e){var r=t.getEnvelopeInternal(),n=e.getEnvelopeInternal();if(!r.intersects(n))return RM.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=r.intersection(n);return this.unionUsingEnvelopeIntersection(t,e,i)},kM.prototype.union=function(){if(null===this._inputPolys)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 hT(kM.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var r=e.next();t.insert(r.getEnvelopeInternal(),r)}this._inputPolys=null;var n=t.itemsTree();return this.unionTree(n)},kM.prototype.binaryUnion=function(){if(1===arguments.length){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];if(n-r<=1){var i=kM.getGeometry(e,r);return this.unionSafe(i,null)}if(n-r==2)return this.unionSafe(kM.getGeometry(e,r),kM.getGeometry(e,r+1));var o=Math.trunc((n+r)/2),s=this.binaryUnion(e,r,o),a=this.binaryUnion(e,o,n);return this.unionSafe(s,a)}},kM.prototype.repeatedUnion=function(t){for(var e=null,r=t.iterator();r.hasNext();){var n=r.next();e=null===e?n.copy():e.union(n)}return e},kM.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},kM.prototype.unionActual=function(t,e){return kM.restrictToPolygons(t.union(e))},kM.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},kM.prototype.unionUsingEnvelopeIntersection=function(t,e,r){var n=new hI,i=this.extractByEnvelope(r,t,n),o=this.extractByEnvelope(r,e,n),s=this.unionActual(i,o);return n.add(s),RM.combine(n)},kM.prototype.bufferUnion=function(){if(1===arguments.length){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().createGeometryCollection([e,r]).buffer(0)}},kM.prototype.interfaces_=function(){return[]},kM.prototype.getClass=function(){return kM},kM.restrictToPolygons=function(t){if(dB(t,eP))return t;var e=BF.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(_P.toPolygonArray(e))},kM.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},kM.union=function(t){return new kM(t).union()},UM.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(kM,UM);var DM=function(){};function GM(){return new QM}function QM(){this.reset()}DM.prototype.interfaces_=function(){return[]},DM.prototype.getClass=function(){return DM},DM.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return TM.createEmptyResult(TM.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),uM.overlayOp(t,e,TM.UNION)},QM.prototype={constructor:QM,reset:function(){this.s=this.t=0},add:function(t){HM(jM,t,this.t),HM(this,jM.s,this.s),this.s?this.t+=jM.t:this.s=jM.t},valueOf:function(){return this.s}};var jM=new QM;function HM(t,e,r){var n=t.s=e+r,i=n-e,o=n-i;t.t=e-o+(r-i)}var zM=1e-6,VM=Math.PI,KM=VM/2,qM=VM/4,WM=2*VM,XM=180/VM,YM=VM/180,ZM=Math.abs,JM=Math.atan,$M=Math.atan2,tL=Math.cos,eL=Math.sin,rL=Math.sqrt;function nL(t){return t>1?0:t<-1?VM:Math.acos(t)}function iL(t){return t>1?KM:t<-1?-KM:Math.asin(t)}function oL(){}function sL(t,e){t&&hL.hasOwnProperty(t.type)&&hL[t.type](t,e)}var aL,lL,uL={Feature:function(t,e){sL(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)sL(r[n].geometry,e)}},hL={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){cL(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)cL(r[n],e,0)},Polygon:function(t,e){AL(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)AL(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)sL(r[n],e)}};function cL(t,e,r){var n,i=-1,o=t.length-r;for(e.lineStart();++i<o;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function AL(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)cL(t[r],e,1);e.polygonEnd()}function fL(t){return[$M(t[1],t[0]),iL(t[2])]}function pL(t){var e=t[0],r=t[1],n=tL(r);return[n*tL(e),n*eL(e),eL(r)]}function dL(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function gL(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function yL(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function mL(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function vL(t){var e=rL(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function _L(t,e){function r(r,n){return r=t(r,n),e(r[0],r[1])}return t.invert&&e.invert&&(r.invert=function(r,n){return(r=e.invert(r,n))&&t.invert(r[0],r[1])}),r}function wL(t,e){return[t>VM?t-WM:t<-VM?t+WM:t,e]}function bL(t){return function(e,r){return[(e+=t)>VM?e-WM:e<-VM?e+WM:e,r]}}function xL(t){var e=bL(t);return e.invert=bL(-t),e}function EL(t,e){var r=tL(t),n=eL(t),i=tL(e),o=eL(e);function s(t,e){var s=tL(e),a=tL(t)*s,l=eL(t)*s,u=eL(e),h=u*r+a*n;return[$M(l*i-h*o,a*r-u*n),iL(h*i+l*o)]}return s.invert=function(t,e){var s=tL(e),a=tL(t)*s,l=eL(t)*s,u=eL(e),h=u*i-l*o;return[$M(l*i+u*o,a*r+h*n),iL(h*r-a*n)]},s}function CL(t,e){(e=pL(e))[0]-=t,vL(e);var r=nL(-e[1]);return((-e[2]<0?-r:r)+WM-zM)%WM}function SL(){var t,e=[];return{point:function(e,r){t.push([e,r])},lineStart:function(){e.push(t=[])},lineEnd:oL,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function BL(t,e){return ZM(t[0]-e[0])<zM&&ZM(t[1]-e[1])<zM}function IL(t,e,r,n){this.x=t,this.z=e,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function PL(t,e,r,n,i){var o,s,a=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,r,n=t[0],s=t[e];if(BL(n,s)){for(i.lineStart(),o=0;o<e;++o)i.point((n=t[o])[0],n[1]);i.lineEnd()}else a.push(r=new IL(n,t,null,!0)),l.push(r.o=new IL(n,null,r,!1)),a.push(r=new IL(s,t,null,!1)),l.push(r.o=new IL(s,null,r,!0))}})),a.length){for(l.sort(e),TL(a),TL(l),o=0,s=l.length;o<s;++o)l[o].e=r=!r;for(var u,h,c=a[0];;){for(var A=c,f=!0;A.v;)if((A=A.n)===c)return;u=A.z,i.lineStart();do{if(A.v=A.o.v=!0,A.e){if(f)for(o=0,s=u.length;o<s;++o)i.point((h=u[o])[0],h[1]);else n(A.x,A.n.x,1,i);A=A.n}else{if(f)for(u=A.p.z,o=u.length-1;o>=0;--o)i.point((h=u[o])[0],h[1]);else n(A.x,A.p.x,-1,i);A=A.p}u=(A=A.o).z,f=!f}while(!A.v);i.lineEnd()}}}function TL(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n<e;)i.n=r=t[n],r.p=i,i=r;i.n=r=t[0],r.p=i}}function FL(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ML(t){for(var e,r,n,i=t.length,o=-1,s=0;++o<i;)s+=t[o].length;for(r=new Array(s);--i>=0;)for(e=(n=t[i]).length;--e>=0;)r[--s]=n[e];return r}GM(),GM(),GM(),wL.invert=wL,1===(aL=FL).length&&(lL=aL,aL=function(t,e){return FL(lL(t),e)});var LL=1e9,OL=-LL,NL=GM();function RL(t){return t}GM(),GM(),GM();var kL=1/0,UL=kL,DL=-kL,GL=DL,QL={point:function(t,e){t<kL&&(kL=t),t>DL&&(DL=t),e<UL&&(UL=e),e>GL&&(GL=e)},lineStart:oL,lineEnd:oL,polygonStart:oL,polygonEnd:oL,result:function(){var t=[[kL,UL],[DL,GL]];return DL=GL=-(UL=kL=1/0),t}};function jL(t,e,r,n){return function(i,o){var s,a,l,u=e(o),h=i.invert(n[0],n[1]),c=SL(),A=e(c),f=!1,p={point:d,lineStart:y,lineEnd:m,polygonStart:function(){p.point=v,p.lineStart=_,p.lineEnd=w,a=[],s=[]},polygonEnd:function(){p.point=d,p.lineStart=y,p.lineEnd=m,a=ML(a);var t=function(t,e){var r=e[0],n=e[1],i=[eL(r),-tL(r),0],o=0,s=0;NL.reset();for(var a=0,l=t.length;a<l;++a)if(h=(u=t[a]).length)for(var u,h,c=u[h-1],A=c[0],f=c[1]/2+qM,p=eL(f),d=tL(f),g=0;g<h;++g,A=m,p=_,d=w,c=y){var y=u[g],m=y[0],v=y[1]/2+qM,_=eL(v),w=tL(v),b=m-A,x=b>=0?1:-1,E=x*b,C=E>VM,S=p*_;if(NL.add($M(S*x*eL(E),d*w+S*tL(E))),o+=C?b+x*WM:b,C^A>=r^m>=r){var B=gL(pL(c),pL(y));vL(B);var I=gL(i,B);vL(I);var P=(C^b>=0?-1:1)*iL(I[2]);(n>P||n===P&&(B[0]||B[1]))&&(s+=C^b>=0?1:-1)}}return(o<-zM||o<zM&&NL<-zM)^1&s}(s,h);a.length?(f||(o.polygonStart(),f=!0),PL(a,zL,t,r,o)):t&&(f||(o.polygonStart(),f=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),f&&(o.polygonEnd(),f=!1),a=s=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function d(e,r){var n=i(e,r);t(e=n[0],r=n[1])&&o.point(e,r)}function g(t,e){var r=i(t,e);u.point(r[0],r[1])}function y(){p.point=g,u.lineStart()}function m(){p.point=d,u.lineEnd()}function v(t,e){l.push([t,e]);var r=i(t,e);A.point(r[0],r[1])}function _(){A.lineStart(),l=[]}function w(){v(l[0][0],l[0][1]),A.lineEnd();var t,e,r,n,i=A.clean(),u=c.result(),h=u.length;if(l.pop(),s.push(l),l=null,h)if(1&i){if((e=(r=u[0]).length-1)>0){for(f||(o.polygonStart(),f=!0),o.lineStart(),t=0;t<e;++t)o.point((n=r[t])[0],n[1]);o.lineEnd()}}else h>1&&2&i&&u.push(u.pop().concat(u.shift())),a.push(u.filter(HL))}return p}}function HL(t){return t.length>1}function zL(t,e){return((t=t.x)[0]<0?t[1]-KM-zM:KM-t[1])-((e=e.x)[0]<0?e[1]-KM-zM:KM-e[1])}GM();const VL=jL((function(){return!0}),(function(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?VM:-VM,l=ZM(o-r);ZM(l-VM)<zM?(t.point(r,n=(n+s)/2>0?KM:-KM),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(o,n),e=0):i!==a&&l>=VM&&(ZM(r-i)<zM&&(r-=i*zM),ZM(o-a)<zM&&(o-=a*zM),n=function(t,e,r,n){var i,o,s=eL(t-r);return ZM(s)>zM?JM((eL(e)*(o=tL(n))*eL(r)-eL(n)*(i=tL(e))*eL(t))/(i*o*s)):(e+n)/2}(r,n,o,s),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),e=0),t.point(r=o,n=s),i=a},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var i;if(null==t)i=r*KM,n.point(-VM,i),n.point(0,i),n.point(VM,i),n.point(VM,0),n.point(VM,-i),n.point(0,-i),n.point(-VM,-i),n.point(-VM,0),n.point(-VM,i);else if(ZM(t[0]-e[0])>zM){var o=t[0]<e[0]?VM:-VM;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(e[0],e[1])}),[-VM,-KM]);function KL(t){return function(e){var r=new qL;for(var n in t)r[n]=t[n];return r.stream=e,r}}function qL(){}function WL(t,e,r){var n=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),null!=o&&t.clipExtent(null),function(t,e){t&&uL.hasOwnProperty(t.type)?uL[t.type](t,e):sL(t,e)}(r,t.stream(QL));var s=QL.result(),a=Math.min(n/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),l=+e[0][0]+(n-a*(s[1][0]+s[0][0]))/2,u=+e[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*a).translate([l,u])}qL.prototype={constructor:qL,point:function(t,e){this.stream.point(t,e)},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()}};var XL=16,YL=tL(30*YM);function ZL(t,e){return+e?function(t,e){function r(n,i,o,s,a,l,u,h,c,A,f,p,d,g){var y=u-n,m=h-i,v=y*y+m*m;if(v>4*e&&d--){var _=s+A,w=a+f,b=l+p,x=rL(_*_+w*w+b*b),E=iL(b/=x),C=ZM(ZM(b)-1)<zM||ZM(o-c)<zM?(o+c)/2:$M(w,_),S=t(C,E),B=S[0],I=S[1],P=B-n,T=I-i,F=m*P-y*T;(F*F/v>e||ZM((y*P+m*T)/v-.5)>.3||s*A+a*f+l*p<YL)&&(r(n,i,o,s,a,l,B,I,C,_/=x,w/=x,b,d,g),g.point(B,I),r(B,I,C,_,w,b,u,h,c,A,f,p,d,g))}}return function(e){var n,i,o,s,a,l,u,h,c,A,f,p,d={point:g,lineStart:y,lineEnd:v,polygonStart:function(){e.polygonStart(),d.lineStart=_},polygonEnd:function(){e.polygonEnd(),d.lineStart=y}};function g(r,n){r=t(r,n),e.point(r[0],r[1])}function y(){h=NaN,d.point=m,e.lineStart()}function m(n,i){var o=pL([n,i]),s=t(n,i);r(h,c,u,A,f,p,h=s[0],c=s[1],u=n,A=o[0],f=o[1],p=o[2],XL,e),e.point(h,c)}function v(){d.point=g,e.lineEnd()}function _(){y(),d.point=w,d.lineEnd=b}function w(t,e){m(n=t,e),i=h,o=c,s=A,a=f,l=p,d.point=m}function b(){r(h,c,u,A,f,p,i,o,n,s,a,l,XL,e),d.lineEnd=v,v()}return d}}(t,e):function(t){return KL({point:function(e,r){e=t(e,r),this.stream.point(e[0],e[1])}})}(t)}var JL=KL({point:function(t,e){this.stream.point(t*YM,e*YM)}});function $L(t){return function(e,r){var n=tL(e),i=tL(r),o=t(n*i);return[o*i*eL(e),o*eL(r)]}}function tO(t){return function(e,r){var n=rL(e*e+r*r),i=t(n),o=eL(i),s=tL(i);return[$M(e*o,n*s),iL(n&&r*o/n)]}}$L((function(t){return rL(2/(1+t))})).invert=tO((function(t){return 2*iL(t/2)}));var eO=$L((function(t){return(t=nL(t))&&t/eL(t)}));function rO(t,e){return[t,e]}function nO(t,e,r){var n=(r=r||{}).units||"kilometers",i=r.steps||8;if(!t)throw new Error("geojson is required");if("object"!=typeof r)throw new Error("options must be an object");if("number"!=typeof i)throw new Error("steps must be an number");if(void 0===e)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var o=[];switch(t.type){case"GeometryCollection":return xv(t,(function(t){var r=iO(t,e,n,i);r&&o.push(r)})),iv(o);case"FeatureCollection":return _v(t,(function(t){var r=iO(t,e,n,i);r&&_v(r,(function(t){t&&o.push(t)}))})),iv(o)}return iO(t,e,n,i)}function iO(t,e,r,n){var i=t.properties||{},o="Feature"===t.type?t.geometry:t;if("GeometryCollection"===o.type){var s=[];return xv(t,(function(t){var i=iO(t,e,r,n);i&&s.push(i)})),iv(s)}var a=function(t){var e,r=L_(t).geometry.coordinates,n=[-r[0],-r[1]];return(e=eO,function(t){var e,r,n,i,o,s,a,l,u,h,c=150,A=480,f=250,p=0,d=0,g=0,y=0,m=0,v=null,_=VL,w=null,b=RL,x=.5,E=ZL(B,x);function C(t){return[(t=o(t[0]*YM,t[1]*YM))[0]*c+r,n-t[1]*c]}function S(t){return(t=o.invert((t[0]-r)/c,(n-t[1])/c))&&[t[0]*XM,t[1]*XM]}function B(t,i){return[(t=e(t,i))[0]*c+r,n-t[1]*c]}function I(){o=_L(i=function(t,e,r){return(t%=WM)?e||r?_L(xL(t),EL(e,r)):xL(t):e||r?EL(e,r):wL}(g,y,m),e);var t=e(p,d);return r=A-t[0]*c,n=f+t[1]*c,P()}function P(){return u=h=null,C}return C.stream=function(t){return u&&h===t?u:u=JL(_(i,E(b(h=t))))},C.clipAngle=function(t){return arguments.length?(_=+t?function(t,e){var r=tL(t),n=r>0,i=ZM(r)>zM;function o(t,e){return tL(t)*tL(e)>r}function s(t,e,n){var i=[1,0,0],o=gL(pL(t),pL(e)),s=dL(o,o),a=o[0],l=s-a*a;if(!l)return!n&&t;var u=r*s/l,h=-r*a/l,c=gL(i,o),A=mL(i,u);yL(A,mL(o,h));var f=c,p=dL(A,f),d=dL(f,f),g=p*p-d*(dL(A,A)-1);if(!(g<0)){var y=rL(g),m=mL(f,(-p-y)/d);if(yL(m,A),m=fL(m),!n)return m;var v,_=t[0],w=e[0],b=t[1],x=e[1];w<_&&(v=_,_=w,w=v);var E=w-_,C=ZM(E-VM)<zM;if(!C&&x<b&&(v=b,b=x,x=v),C||E<zM?C?b+x>0^m[1]<(ZM(m[0]-_)<zM?b:x):b<=m[1]&&m[1]<=x:E>VM^(_<=m[0]&&m[0]<=w)){var S=mL(f,(-p+y)/d);return yL(S,A),[m,fL(S)]}}}function a(e,r){var i=n?t:VM-t,o=0;return e<-i?o|=1:e>i&&(o|=2),r<-i?o|=4:r>i&&(o|=8),o}return jL(o,(function(t){var e,r,l,u,h;return{lineStart:function(){u=l=!1,h=1},point:function(c,A){var f,p=[c,A],d=o(c,A),g=n?d?0:a(c,A):d?a(c+(c<0?VM:-VM),A):0;if(!e&&(u=l=d)&&t.lineStart(),d!==l&&(!(f=s(e,p))||BL(e,f)||BL(p,f))&&(p[0]+=zM,p[1]+=zM,d=o(p[0],p[1])),d!==l)h=0,d?(t.lineStart(),f=s(p,e),t.point(f[0],f[1])):(f=s(e,p),t.point(f[0],f[1]),t.lineEnd()),e=f;else if(i&&e&&n^d){var y;g&r||!(y=s(p,e,!0))||(h=0,n?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!d||e&&BL(e,p)||t.point(p[0],p[1]),e=p,l=d,r=g},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return h|(u&&l)<<1}}}),(function(r,n,i,o){!function(t,e,r,n,i,o){if(r){var s=tL(e),a=eL(e),l=n*r;null==i?(i=e+n*WM,o=e-l/2):(i=CL(s,i),o=CL(s,o),(n>0?i<o:i>o)&&(i+=n*WM));for(var u,h=i;n>0?h>o:h<o;h-=l)u=fL([s,-a*tL(h),-a*eL(h)]),t.point(u[0],u[1])}}(o,t,e,i,r,n)}),n?[0,-t]:[-VM,t-VM])}(v=t*YM,6*YM):(v=null,VL),P()):v*XM},C.clipExtent=function(t){return arguments.length?(b=null==t?(w=s=a=l=null,RL):function(t,e,r,n){function i(i,o){return t<=i&&i<=r&&e<=o&&o<=n}function o(i,o,a,u){var h=0,c=0;if(null==i||(h=s(i,a))!==(c=s(o,a))||l(i,o)<0^a>0)do{u.point(0===h||3===h?t:r,h>1?n:e)}while((h=(h+a+4)%4)!==c);else u.point(o[0],o[1])}function s(n,i){return ZM(n[0]-t)<zM?i>0?0:3:ZM(n[0]-r)<zM?i>0?2:1:ZM(n[1]-e)<zM?i>0?1:0:i>0?3:2}function a(t,e){return l(t.x,e.x)}function l(t,e){var r=s(t,1),n=s(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){var l,u,h,c,A,f,p,d,g,y,m,v=s,_=SL(),w={point:b,lineStart:function(){w.point=x,u&&u.push(h=[]),y=!0,g=!1,p=d=NaN},lineEnd:function(){l&&(x(c,A),f&&g&&_.rejoin(),l.push(_.result())),w.point=b,g&&v.lineEnd()},polygonStart:function(){v=_,l=[],u=[],m=!0},polygonEnd:function(){var e=function(){for(var e=0,r=0,i=u.length;r<i;++r)for(var o,s,a=u[r],l=1,h=a.length,c=a[0],A=c[0],f=c[1];l<h;++l)o=A,s=f,A=(c=a[l])[0],f=c[1],s<=n?f>n&&(A-o)*(n-s)>(f-s)*(t-o)&&++e:f<=n&&(A-o)*(n-s)<(f-s)*(t-o)&&--e;return e}(),r=m&&e,i=(l=ML(l)).length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&PL(l,a,e,o,s),s.polygonEnd()),v=s,l=u=h=null}};function b(t,e){i(t,e)&&v.point(t,e)}function x(o,s){var a=i(o,s);if(u&&h.push([o,s]),y)c=o,A=s,f=a,y=!1,a&&(v.lineStart(),v.point(o,s));else if(a&&g)v.point(o,s);else{var l=[p=Math.max(OL,Math.min(LL,p)),d=Math.max(OL,Math.min(LL,d))],_=[o=Math.max(OL,Math.min(LL,o)),s=Math.max(OL,Math.min(LL,s))];!function(t,e,r,n,i,o){var s,a=t[0],l=t[1],u=0,h=1,c=e[0]-a,A=e[1]-l;if(s=r-a,c||!(s>0)){if(s/=c,c<0){if(s<u)return;s<h&&(h=s)}else if(c>0){if(s>h)return;s>u&&(u=s)}if(s=i-a,c||!(s<0)){if(s/=c,c<0){if(s>h)return;s>u&&(u=s)}else if(c>0){if(s<u)return;s<h&&(h=s)}if(s=n-l,A||!(s>0)){if(s/=A,A<0){if(s<u)return;s<h&&(h=s)}else if(A>0){if(s>h)return;s>u&&(u=s)}if(s=o-l,A||!(s<0)){if(s/=A,A<0){if(s>h)return;s>u&&(u=s)}else if(A>0){if(s<u)return;s<h&&(h=s)}return u>0&&(t[0]=a+u*c,t[1]=l+u*A),h<1&&(e[0]=a+h*c,e[1]=l+h*A),!0}}}}}(l,_,t,e,r,n)?a&&(v.lineStart(),v.point(o,s),m=!1):(g||(v.lineStart(),v.point(l[0],l[1])),v.point(_[0],_[1]),a||v.lineEnd(),m=!1)}p=o,d=s,g=a}return w}}(w=+t[0][0],s=+t[0][1],a=+t[1][0],l=+t[1][1]),P()):null==w?null:[[w,s],[a,l]]},C.scale=function(t){return arguments.length?(c=+t,I()):c},C.translate=function(t){return arguments.length?(A=+t[0],f=+t[1],I()):[A,f]},C.center=function(t){return arguments.length?(p=t[0]%360*YM,d=t[1]%360*YM,I()):[p*XM,d*XM]},C.rotate=function(t){return arguments.length?(g=t[0]%360*YM,y=t[1]%360*YM,m=t.length>2?t[2]%360*YM:0,I()):[g*XM,y*XM,m*XM]},C.precision=function(t){return arguments.length?(E=ZL(B,x=t*t),P()):rL(x)},C.fitExtent=function(t,e){return WL(C,t,e)},C.fitSize=function(t,e){return function(t,e,r){return WL(t,[[0,0],e],r)}(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&S,I()}}((function(){return e}))()).scale(79.4188).clipAngle(179.999).rotate(n).scale(Ym)}(o),l={type:o.type,coordinates:sO(o.coordinates,a)},u=(new SP).read(l),h=uv(hv(e,r),"meters"),c=vF.bufferOp(u,h,n);if(!oO((c=(new BP).write(c)).coordinates))return tv({type:c.type,coordinates:aO(c.coordinates,a)},i)}function oO(t){return Array.isArray(t[0])?oO(t[0]):isNaN(t[0])}function sO(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return sO(t,e)}))}function aO(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return aO(t,e)}))}function lO(t,e,r){void 0===r&&(r={});var n=Rv(t),i=Rv(e),o=tB.intersection(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?rv(o[0],r.properties):av(o,r.properties)}function uO(t,e,r,n,i,o){for(var s=[],a=0;a<6;a++){var l=t[0]+e*i[a],u=t[1]+r*o[a];s.push([l,u])}return s.push(s[0].slice()),rv([s],n)}function hO(t,e,r,n,i,o){for(var s=[],a=0;a<6;a++){var l=[];l.push(t),l.push([t[0]+e*i[a],t[1]+r*o[a]]),l.push([t[0]+e*i[(a+1)%6],t[1]+r*o[(a+1)%6]]),l.push(t),s.push(rv([l],n))}return s}eO.invert=tO((function(t){return t})),rO.invert=rO;class cO{static sector(t,e,r,n){var i=function(t,e,r,n,i){if(!gv(i=i||{}))throw new Error("options is invalid");var o=i.properties;if(!t)throw new Error("center is required");if(null==r)throw new Error("bearing1 is required");if(null==n)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if("object"!=typeof i)throw new Error("options must be an object");if(Hx(r)===Hx(n))return F_(t,e,i);var s=Ov(t),a=function(t,e,r,n,i){void 0===i&&(i={});var o=i.steps||64,s=pw(r),a=pw(n),l=Array.isArray(t)||"Feature"!==t.type?{}:t.properties;if(s===a)return nv(F_(t,e,i).geometry.coordinates[0],l);for(var u=s,h=s<a?a:a+360,c=u,A=[],f=0;c<h;)A.push(T_(t,e,c,i).geometry.coordinates),c=u+360*++f/o;return c>h&&A.push(T_(t,e,h,i).geometry.coordinates),nv(A,l)}(t,e,r,n,i),l=[[s]];return mv(a,(function(t){l[0].push(t)})),l[0].push(s),rv(l,o)}(t,e/1e3,r,n);return cO.to3857(i)}static nearestPoint(t,e){var r=function(t,e){if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");var r,n=1/0,i=0;return _v(e,(function(e,r){var o=Wv(t,e);o<n&&(i=r,n=o)})),(r=t_(e.features[i])).properties.featureIndex=i,r.properties.distanceToPoint=n,r}(cO.featureTo4326(t),cO.featuresTo4326(e));return cO.to3857(r)}static bezierSpline(t,e){let r;r=t instanceof X?cO.featureTo4326(t):t;var n=function(t,e){void 0===e&&(e={});for(var r=e.resolution||1e4,n=e.sharpness||.85,i=[],o=Rv(t).coordinates.map((function(t){return{x:t[0],y:t[1]}})),s=new P_({duration:r,points:o,sharpness:n}),a=function(t){var e=s.pos(t);Math.floor(t/100)%2==0&&i.push([e.x,e.y])},l=0;l<s.duration;l+=10)a(l);return a(s.duration),nv(i,e.properties)}(r,e);return cO.to3857(n)}static pointsWithinPolygon(t,e){let r,n=cO.featuresTo4326(t);"Circle"==e.getGeometry().getType()?(e.setGeometry(En(e.getGeometry(),128)),r=cO.featureTo4326(e)):r=cO.featureTo4326(e);var i,o,s=(i=r,o=[],_v(n,(function(t){var e=!1;if("Point"===t.geometry.type)xv(i,(function(r){Kv(t,r)&&(e=!0)})),e&&o.push(t);else{if("MultiPoint"!==t.geometry.type)throw new Error("Input geometry must be a Point or MultiPoint");var r=[];xv(i,(function(n){mv(t,(function(t){Kv(t,n)&&(e=!0,r.push(t))}))})),e&&o.push(sv(r))}})),iv(o));return cO.to3857_featureList(s)}static lineOffset(t,e=1){var r=function(t,e,r){if(!gv(r=r||{}))throw new Error("options is invalid");var n=r.units;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");var i=kv(t),o=t.properties;switch(i){case"LineString":return JE(t,e,n);case"MultiLineString":var s=[];return Cv(t,(function(t){s.push(JE(t,e,n).geometry.coordinates)})),ov(s,o);default:throw new Error("geometry "+i+" is not supported")}}(cO.featureTo4326(t),e/=1e3,{units:"kilometers"});return cO.to3857(r)}static nearestPointOnLine(t,e){let r=cO.featureTo4326(t),n=X_(cO.featureTo4326(e),r,{units:"kilometers"});return cO.to3857(n)}static booleanOverlap(t,e){return gC(cO.featureTo4326(t),cO.featureTo4326(e))}static booleanPointInPolygon(t,e){return Kv(cO.featureTo4326(t),cO.featureTo4326(e))}static nearestPointOnLines(t,e){let r=cO.featureTo4326(t),n=X_(cO.featuresTo4326(e),r,{units:"kilometers"});return cO.to3857(n)}static buffer(t,e=5){e/=1e3;var r=nO(cO.featureTo4326(t),e,{units:"kilometers"});return cO.to3857(r)}static difference(t,e){new kf;let r=cO.featureTo4326(t);var n,i,o,s,a,l,u=(i=cO.featureTo4326(e),o=Rv(n=r),s=Rv(i),a=n.properties||{},0===(l=tB.difference(o.coordinates,s.coordinates)).length?null:1===l.length?rv(l[0],a):av(l,a));return cO.to3857(u)}static intersect(t,e){var r=lO(cO.featureTo4326(t),cO.featureTo4326(e));return cO.to3857(r)}static booleanContains(t,e){try{let r,n,i,o=[],s=new kf;n="Circle"==t.getGeometry().getType()?En(t.getGeometry(),128):t.getGeometry();let a=s.writeGeometryObject(n);return e.forEach((e=>{if(t!=e){i="Circle"==e.getGeometry().getType()?En(e.getGeometry(),128):e.getGeometry();let t=s.writeGeometryObject(i);if(nC(a,t))r=s.readFeature(t),o.push(r);else if("Point"!=i.getType()&&"LineString"!=i.getType()&&gC(a,t)){var n=lO(a,t);r=s.readFeature(n),r.setProperties({name:e.get("name")+"重叠区域","重叠对象":e.get("name"),"重叠面积":this.formatArea(i)}),o.push(r)}}})),o}catch(dX){}}static createPolygon(t,e,r,n){let i,o=[],s=cO.featuresTo4326(e),a=function(t,e){void 0===e&&(e={});var r=e.maxEdge||1/0,n=function(t){var e=[],r={};return _v(t,(function(t){if(t.geometry){var n=t.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(r,n)||(e.push(t),r[n]=!0)}})),iv(e)}(t),i=Yv(n);if(i.features=i.features.filter((function(t){var n=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],s=Wv(n,i,e),a=Wv(i,o,e),l=Wv(n,o,e);return s<=r&&a<=r&&l<=r})),i.features.length<1)return null;var o=E_(i);return 1===o.coordinates.length&&(o.coordinates=o.coordinates[0],o.type="Polygon"),tv(o)}(s),l={bbox:Fv(a)};switch(t){case Zp.voronoi:i=function(t,e){if(!gv(e=e||{}))throw new Error("options is invalid");var r=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(!Array.isArray(r))throw new Error("bbox is invalid");return Nv(t,"Point","points"),iv(function(){var t=CC,e=SC,r=null;function n(n){return new sS(n.map((function(r,i){var o=[Math.round(t(r,i,n)/nS)*nS,Math.round(e(r,i,n)/nS)*nS];return o.index=i,o.data=r,o})),r)}return n.polygons=function(t){return n(t).polygons()},n.links=function(t){return n(t).links()},n.triangles=function(t){return n(t).triangles()},n.x=function(e){return arguments.length?(t="function"==typeof e?e:EC(+e),n):t},n.y=function(t){return arguments.length?(e="function"==typeof t?t:EC(+t),n):e},n.extent=function(t){return arguments.length?(r=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],n):r&&[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},n.size=function(t){return arguments.length?(r=null==t?null:[[0,0],[+t[0],+t[1]]],n):r&&[r[1][0]-r[0][0],r[1][1]-r[0][1]]},n}().x((function(t){return t.geometry.coordinates[0]})).y((function(t){return t.geometry.coordinates[1]})).extent([[r[0],r[1]],[r[2],r[3]]]).polygons(t.features).map(aS))}(s,l);break;case Zp.tin:i=Yv(s,"z");break;case Zp.convex:return cO.to3857(a)}return i.features.forEach(((t,e)=>{let i=cO.to3857(t);i.setStyle(new ji({stroke:new Rn({color:r||Xm.getRandomColor(),width:5}),fill:new Tn({color:n||Xm.getRandomColor()})})),i.setProperties({uuid:qm.uuid15(),name:"第"+e+"个"}),o.push(i)})),o}static createGrid(t,e={box:[0,0,0,0],cellSide:50}){let r=[];e.cellSide=e.cellSide/1e3;let n,i={units:"kilometers"};switch(t){case Yp.point:n=function(t,e,r){void 0===r&&(r={}),r.mask&&!r.units&&(r.units="kilometers");for(var n=[],i=t[0],o=t[1],s=t[2],a=t[3],l=e/Wv([i,o],[s,o],r)*(s-i),u=e/Wv([i,o],[i,a],r)*(a-o),h=s-i,c=a-o,A=Math.floor(h/l),f=(c-Math.floor(c/u)*u)/2,p=i+(h-A*l)/2;p<=s;){for(var d=o+f;d<=a;){var g=ev([p,d],r.properties);r.mask?sw(g,r.mask)&&n.push(g):n.push(g),d+=u}p+=l}return iv(n)}(e.box,e.cellSide,i);break;case Yp.hex:n=function(t,e,r){void 0===r&&(r={});var n=JSON.stringify(r.properties||{}),i=t[0],o=t[1],s=t[2],a=t[3],l=(o+a)/2,u=(i+s)/2,h=2*e/Wv([i,l],[s,l],r)*(s-i),c=2*e/Wv([u,o],[u,a],r)*(a-o),A=h/2,f=2*A,p=Math.sqrt(3)/2*c,d=s-i,g=a-o,y=3/4*f,m=p,v=(d-f)/(f-A/2),_=Math.floor(v),w=(_*y-A/2-d)/2-A/2+y/2,b=Math.floor((g-p)/p),x=(g-b*p)/2,E=b*p-g>p/2;E&&(x-=p/4);for(var C=[],S=[],B=0;B<6;B++){var I=2*Math.PI/6*B;C.push(Math.cos(I)),S.push(Math.sin(I))}for(var P=[],T=0;T<=_;T++)for(var F=0;F<=b;F++){var M=T%2==1;if(!(0===F&&M||0===F&&E)){var L=T*y+i-w,O=F*m+o+x;if(M&&(O-=p/2),!0===r.triangles)hO([L,O],h/2,c/2,JSON.parse(n),C,S).forEach((function(t){r.mask?lO(r.mask,t)&&P.push(t):P.push(t)}));else{var N=uO([L,O],h/2,c/2,JSON.parse(n),C,S);r.mask?lO(r.mask,N)&&P.push(N):P.push(N)}}}return iv(P)}(e.box,e.cellSide,i);break;case Yp.square:void 0===(s=i)&&(s={}),n=function(t,e,r,n){void 0===n&&(n={});for(var i=[],o=t[0],s=t[1],a=t[2],l=t[3],u=e/Wv([o,s],[a,s],n)*(a-o),h=r/Wv([o,s],[o,l],n)*(l-s),c=a-o,A=l-s,f=Math.floor(c/u),p=Math.floor(A/h),d=(A-p*h)/2,g=o+(c-f*u)/2,y=0;y<f;y++){for(var m=s+d,v=0;v<p;v++){var _=rv([[[g,m],[g,m+h],[g+u,m+h],[g+u,m],[g,m]]],n.properties);n.mask?yC(n.mask,_)&&i.push(_):i.push(_),m+=h}g+=u}return iv(i)}(e.box,o=e.cellSide,o,s);break;case Yp.triangle:n=function(t,e,r){void 0===r&&(r={});for(var n=[],i=e/Wv([t[0],t[1]],[t[2],t[1]],r)*(t[2]-t[0]),o=e/Wv([t[0],t[1]],[t[0],t[3]],r)*(t[3]-t[1]),s=0,a=t[0];a<=t[2];){for(var l=0,u=t[1];u<=t[3];){var h=null,c=null;s%2==0&&l%2==0?(h=rv([[[a,u],[a,u+o],[a+i,u],[a,u]]],r.properties),c=rv([[[a,u+o],[a+i,u+o],[a+i,u],[a,u+o]]],r.properties)):s%2==0&&l%2==1?(h=rv([[[a,u],[a+i,u+o],[a+i,u],[a,u]]],r.properties),c=rv([[[a,u],[a,u+o],[a+i,u+o],[a,u]]],r.properties)):l%2==0&&s%2==1?(h=rv([[[a,u],[a,u+o],[a+i,u+o],[a,u]]],r.properties),c=rv([[[a,u],[a+i,u+o],[a+i,u],[a,u]]],r.properties)):l%2==1&&s%2==1&&(h=rv([[[a,u],[a,u+o],[a+i,u],[a,u]]],r.properties),c=rv([[[a,u+o],[a+i,u+o],[a+i,u],[a,u+o]]],r.properties)),r.mask?(lO(r.mask,h)&&n.push(h),lO(r.mask,c)&&n.push(c)):(n.push(h),n.push(c)),u+=o,l++}s++,a+=i}return iv(n)}(e.box,e.cellSide,i)}var o,s;return n.features.forEach(((t,e)=>{let n=cO.to3857(t);n.setProperties({uuid:qm.uuid15(),name:"第"+e+"个"}),r.push(n)})),r}static isobands(t,e,r){const n=zE(t,e,{zProperty:r});return cO.to3857_featureList(n)}static isolines(t,e,r){const n=zE(t,e,{zProperty:r});return cO.to3857_featureList(n)}static randomPolygons(t,e=.0111,r=100){let n=[],i=Math.round(10*Math.random());return i=i<3?3:i,function(t,e){void 0===e&&(e={}),null==t&&(t=1),dv(e.num_vertices)&&void 0!==e.num_vertices||(e.num_vertices=10),dv(e.max_radial_length)&&void 0!==e.max_radial_length||(e.max_radial_length=10);for(var r=[],n=function(t){var n,i=[],o=lS(Array(e.num_vertices+1)).map(Math.random);o.forEach((function(t,e,r){r[e]=e>0?t+r[e-1]:t})),o.forEach((function(t){t=2*t*Math.PI/o[o.length-1];var r=Math.random();i.push([r*(e.max_radial_length||10)*Math.sin(t),r*(e.max_radial_length||10)*Math.cos(t)])})),i[i.length-1]=i[0],i=i.map((n=uS(e.bbox),function(t){return[t[0]+n[0],t[1]+n[1]]})),r.push(rv([i]))},i=0;i<t;i++)n();return iv(r)}(r,{bbox:dr(t,"EPSG:3857","EPSG:4326"),num_vertices:i,max_radial_length:e}).features.forEach(((t,e)=>{let r=cO.to3857(t);r.setProperties({style:{fillcolor:Xm.getRandomColor(),strokecolor:Xm.getRandomColor(),strokewidth:2},uuid:qm.uuid15(),name:"第"+e+"个"}),n.push(r)})),n}static randomPolylines(t,e=.0111,r=100){let n=[],i=Math.round(10*Math.random());i=i<3?3:i;var o=function(t,e){if(void 0===e&&(e={}),!gv(e=e||{}))throw new Error("options is invalid");var r=e.bbox,n=e.num_vertices,i=e.max_length,o=e.max_rotation;null==t&&(t=1),(!dv(n)||void 0===n||n<2)&&(n=10),dv(i)&&void 0!==i||(i=1e-4),dv(o)&&void 0!==o||(o=Math.PI/8);for(var s=[],a=0;a<t;a++){for(var l=[uS(r)],u=0;u<n-1;u++){var h=(0===u?2*Math.random()*Math.PI:Math.tan((l[u][1]-l[u-1][1])/(l[u][0]-l[u-1][0])))+(Math.random()-.5)*o*2,c=Math.random()*i;l.push([l[u][0]+c*Math.cos(h),l[u][1]+c*Math.sin(h)])}s.push(nv(l))}return iv(s)}(r,{bbox:dr(t,"EPSG:3857","EPSG:4326"),num_vertices:i,max_length:e});return o.features.forEach(((t,e)=>{let r=cO.to3857(t);r.setProperties({style:{fillcolor:Xm.getRandomColor(),strokecolor:Xm.getRandomColor(),strokewidth:2},uuid:qm.uuid15(),name:"第"+e+"个"}),n.push(r)})),n}static randomPoints(t,e=100){let r=[];return function(t,e){void 0===e&&(e={}),null==t&&(t=1);for(var r=[],n=0;n<t;n++)r.push(ev(uS(e.bbox)));return iv(r)}(e,{bbox:dr(t,"EPSG:3857","EPSG:4326")}).features.forEach(((t,e)=>{let n=cO.to3857(t);n.setProperties({style:{fillcolor:Xm.getRandomColor(),strokecolor:Xm.getRandomColor(),strokewidth:2,radius:8},uuid:qm.uuid15(),name:"第"+e+"个"}),r.push(n)})),r}static formatArea(t){const e=Ze(t);let r;return r=e>1e5?Math.round(e/1e6*100)/100+" km²":Math.round(100*e)/100+" m²",r}static transTo3857(t){return dr(t,"EPSG:4326","EPSG:3857")}static randomLatLng(t){function e(t,e){return Math.floor(Math.random()*(e-t+1)+t)}let r=tv({type:"Polygon",coordinates:[[[114.02709960937501,22.59372606392931],[113.59313964843751,23.03929774776974],[113.48327636718751,22.253512814974744],[110.24230957031251,21.401933838235188],[107.88574218750001,22.522705703482472],[105.27099609375,23.664650731631625],[104.0625,22.998851594142923],[99.93164062500001,22.471954507739227],[98.85498046875001,25.025884063244828],[99.84375,29.065772888415406],[92.57080078125001,28.65203063036226],[85.53955078125001,29.219302076779456],[80.61767578125001,31.690781806136822],[79.69482421875,34.903952965590065],[75.49804687500001,37.26530995561875],[74.95971679687501,39.45316112807394],[81.82617187500001,42.74701217318067],[81.5185546875,44.25306865928177],[84.04541015625001,46.042735653846506],[87.72583007812501,48.026672195436014],[90.5712890625,45.10454630976873],[96.45996093750001,42.32606244456202],[105.71044921875001,41.19518982948959],[112.0166015625,42.84375132629023],[117.02636718750001,45.73685954736049],[120.60791015625,46.55886030311719],[117.83935546875001,48.922499263758255],[122.65136718750001,53.10721669189343],[127.13378906250001,49.53946900793534],[130.97900390625003,47.368594345213374],[134.45068359375003,48.019324184801185],[131.11083984375003,45.521743896993634],[130.51757812500003,43.197167282501276],[126.46362304687501,41.89409955811395],[121.94824218750001,39.26628442213066],[122.54150390625001,40.55554790286314],[121.70654296875001,41.19518982948959],[119.46533203125001,39.985538414809746],[118.64135742187501,39.206718844918505],[117.52075195312501,39.342794408952386],[117.43286132812501,38.41055825094609],[118.56445312500001,37.59682400108367],[119.080810546875,36.96744946416934],[120.81665039062501,37.326488613342086],[122.40966796875001,37.22158045838649],[120.05859375000001,36.35052700542766],[118.88305664062501,35.10193405724608],[120.47607421875001,33.422272258866045],[120.66284179687501,31.784216884487385],[121.81640625000001,30.996445897426373],[120.36621093750001,30.477082932837682],[121.28906250000001,29.19053283229458],[120.30029296875001,27.31321389856826],[119.102783203125,26.52956523826758],[118.45458984375001,24.9163314045991],[116.71875000000001,23.805449612314625],[115.04882812500001,22.84707068783908],[114.02709960937501,22.59372606392931]]]});t&&(r=t);let n=Fv(r),i=0,o=0,s=!0;try{do{i=e(1e6*n[0],1e6*n[2])/1e6,o=e(1e6*n[1],1e6*n[3])/1e6,s=Kv(ev([i,o]),r)}while(!s);return{lnglat:[i,o],box:this.transTo3857(n)}}catch(dX){}}static shortestPath(t,e,r){let n,i=cO.featureTo4326(t),o=cO.featureTo4326(e);r&&(n={obstacles:cO.featuresTo4326(r.obstacles)});let s=function(t,e,r){if(!gv(r=r||{}))throw new Error("options is invalid");var n=r.resolution,i=r.minDistance,o=r.obstacles||iv([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(n&&!dv(n)||n<=0)throw new Error("options.resolution must be a number, greater than 0");if(i)throw new Error("options.minDistance is not yet implemented");var s=Lv(t),a=Lv(e);switch(t=ev(s),e=ev(a),kv(o)){case"FeatureCollection":if(0===o.features.length)return nv([s,a]);break;case"Polygon":o=iv([tv(Rv(o))]);break;default:throw new Error("invalid obstacles")}var l=o;l.features.push(t),l.features.push(e);var u=Fv(function(t,e,r){if(!gv(r=r||{}))throw new Error("options is invalid");var n=r.origin,i=r.mutate;if(!t)throw new Error("geojson required");var o=Array.isArray(n)||"object"==typeof n;return!0!==i&&(t=t_(t)),"FeatureCollection"!==t.type||o?XE(t,1.15,n):(_v(t,(function(e,r){t.features[r]=XE(e,1.15,n)})),t)}(function(t,e){void 0===e&&(e={});var r=Number(t[0]),n=Number(t[1]),i=Number(t[2]),o=Number(t[3]);if(6===t.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var s=[r,n];return rv([[s,[i,n],[i,o],[r,o],s]],e.properties,{bbox:t,id:e.id})}(Fv(l))));n||(n=Wv([u[0],u[1]],[u[2],u[1]],r)/100),l.features.pop(),l.features.pop();for(var h=u[0],c=u[1],A=u[2],f=u[3],p=n/Wv([h,c],[A,c],r)*(A-h),d=n/Wv([h,c],[h,f],r)*(f-c),g=A-h,y=f-c,m=Math.floor(g/p),v=Math.floor(y/d),_=(g-m*p)/2,w=[],b=[],x=[],E=[],C=1/0,S=1/0,B=f-(y-v*d)/2,I=0;B>=c;){for(var P=[],T=[],F=h+_,M=0;F<=A;){var L=ev([F,B]),O=xC(L,o);P.push(O?0:1),T.push(F+"|"+B);var N=Wv(L,t);!O&&N<C&&(C=N,x={x:M,y:I});var R=Wv(L,e);!O&&R<S&&(S=R,E={x:M,y:I}),F+=p,M++}b.push(P),w.push(T),B-=d,I++}var k=new _C(b,{diagonal:!0}),U=k.grid[x.y][x.x],D=k.grid[E.y][E.x],G=vC.search(k,U,D),Q=[s];return G.forEach((function(t){var e=w[t.x][t.y].split("|");Q.push([+e[0],+e[1]])})),Q.push(a),function(t,e){void 0===e&&(e={});var r="object"==typeof e?e.mutate:e;if(!t)throw new Error("geojson is required");var n=kv(t),i=[];switch(n){case"LineString":i=C_(t);break;case"MultiLineString":case"Polygon":Ov(t).forEach((function(t){i.push(C_(t))}));break;case"MultiPolygon":Ov(t).forEach((function(t){var e=[];t.forEach((function(t){e.push(C_(t))})),i.push(e)}));break;case"Point":return t;case"MultiPoint":var o={};Ov(t).forEach((function(t){var e=t.join("-");Object.prototype.hasOwnProperty.call(o,e)||(i.push(t),o[e]=!0)}));break;default:throw new Error(n+" geometry not supported")}return t.coordinates?!0===r?(t.coordinates=i,t):{type:n,coordinates:i}:!0===r?(t.geometry.coordinates=i,t):tv({type:n,coordinates:i},t.properties,{bbox:t.bbox,id:t.id})}(nv(Q))}(i,o,n);return cO.to3857(s)}static lineMerger(t,e=1){let r=cO.featuresTo4326(t),n=[];r.features.forEach((t=>{let e=Ov(t);if(nv(e),n.length>0)e[e.length-1][0]===n[n.length-1][0]&&e[e.length-1][1]===n[n.length-1][1]&&(e=e.reverse()),n[n.length-1][0]===e[0][0]&&n[n.length-1][1]===e[0][1]&&e.splice(0,1);else if(r.features.length>1){let t=Ov(r.features[1]);var i=q_(nv([e[0],e[e.length-1]]),nv([t[0],t[t.length-1]]));i.features[0].geometry.coordinates[0]==e[0][0]&&i.features[0].geometry.coordinates[1]==e[0][1]&&(e=e.reverse())}e.forEach((t=>{n.push(t)}))}));let i=nv(n);return{line:cO.to3857(i),nodeData:cO.lineAttr(n),coordinates:cO.along(n,e)}}static along(t,e){let r=nv(t);e/=1e3;let n=[];n.push(r.geometry.coordinates[0]);const i=rw(r,{units:"kilometers"});for(let o=1;o<=i/e;o++){const t=ew(r,o*e,{units:"kilometers"});n.push(t.geometry.coordinates)}return n.push(r.geometry.coordinates[r.geometry.coordinates.length-1]),n}static lineAttr(t){let e=[];for(var r=0;r<t.length;r++){let n={coordIndex:0,distance:0,bearing:0,coords:[]};n.coordIndex=r,r+1<t.length?n.distance=1e3*Wv(t[r],t[r+1],{units:"kilometers"}):n.distance=0,n.coords=t[r],e.push(n)}return e}static movePointContain(t,e){let r=new kf,n=En(t.getGeometry(),128),i=r.writeGeometryObject(n,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"}),o={coordIndex:-1,distance:0,bearing:0,coords:[]};for(let s=0;s<e.length-1;s++)Kv(ev(e[s].coords),i)&&(o=e[s]);return o}static arrayDup(t){let e=new Map;return t.forEach((t=>{e.set(JSON.stringify(t),t)})),Array.from(e.values())}static decoratePath(t,e){let r=function(t,e,r){if(!gv(r=r||{}))throw new Error("options is invalid");var n=r.units,i=r.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var o=[];return Cv(t,(function(t){i&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,r,n){var i=rw(t,{units:r});if(i<=e)return n(t);var o=i/e;Number.isInteger(o)||(o=Math.floor(o)+1);for(var s=0;s<o;s++)n(nw(t,e*s,e*(s+1),{units:r}))}(t,e,n,(function(t){o.push(t)}))})),iv(o)}(nv(cO.arrayDup(t)),e,{units:"meters"});return cO.arrayDup(r.features.filter((t=>"Feature"===t.type)).map((t=>t.geometry.coordinates)).flat())}static lineSlice(t,e,r){var n=function(t,e,r){var n=Ov(r);if("LineString"!==kv(r))throw new Error("line must be a LineString");for(var i,o=X_(r,t),s=X_(r,e),a=[(i=o.properties.index<=s.properties.index?[o,s]:[s,o])[0].geometry.coordinates],l=i[0].properties.index+1;l<i[1].properties.index+1;l++)a.push(n[l]);return a.push(i[1].geometry.coordinates),nv(a,r.properties)}(cO.featureTo4326(t),cO.featureTo4326(e),cO.featureTo4326(r));return cO.to3857(n)}static booleanPointOnLine(t,e){let r=cO.featureTo4326(t),n=cO.featureTo4326(e);return iw(Lv(r),n)}static booleanCrosses(t,e){return function(t,e){var r=Rv(t),n=Rv(e),i=r.type,o=n.type;switch(i){case"MultiPoint":switch(o){case"LineString":return sC(r,n);case"Polygon":return lC(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"MultiPoint":return sC(n,r);case"LineString":return function(t,e){if(q_(t,e).features.length>0)for(var r=0;r<t.coordinates.length-1;r++)for(var n=0;n<e.coordinates.length-1;n++){var i=!0;if(0!==n&&n!==e.coordinates.length-2||(i=!1),uC(t.coordinates[r],t.coordinates[r+1],e.coordinates[n],i))return!0}return!1}(r,n);case"Polygon":return aC(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"MultiPoint":return lC(n,r);case"LineString":return aC(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}(cO.featureTo4326(t),cO.featureTo4326(e))}static lineIntersect(t,e){let r=cO.featureTo4326(t),n=cO.featureTo4326(e);return cO.to3857_featureList(q_(r,n))}static lineSplit(t,e){let r=cO.featureTo4326(t);return cO.featureTo4326(e),cO.to3857(uw(r,e))}static lineCrossesSplit(t,e,r){const n=sv([]);if(e.length>=1){const i=[];e.forEach((t=>{const e=cO.featureTo4326(t),r=Y_(e);r.features.length>0&&r.features.forEach((t=>{n.geometry.coordinates.push(t.geometry.coordinates)}));const o=bv(e);i.push(o)}));const o=Y_(ov(i));o.features.length>0&&o.features.forEach((t=>{n.geometry.coordinates.push(t.geometry.coordinates)}));for(let t=0;t<e.length;t++){const i=cO.featureTo4326(e[t]),o=uw(i,n);o.features.length>0&&(e[t].set("classname","del"),o.features.forEach((t=>{r(t,i.properties)})))}t.removeFeatures("del")}}static lineErase(t,e,r,n,i){const o=nO(ev(e),r,{units:"kilometers"});n.forEach((e=>{const r=cO.featureTo4326(e);if(nC(o,r))t.removeFeature(e);else if(!$E(o,r)){Fv(o);const n=uw(r,o);n.features.length>0&&(t.removeFeature(e),n.features.forEach((t=>{if(!nC(o,t)){let r=e.getProperties();e.getGeometry()&&delete r[e.getGeometryName()],i(t,r)}})))}}))}static featureToJson(t){return(new kf).writeFeatureObject(t)}static featureTo4326(t){return(new kf).writeFeatureObject(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}static featuresTo4326(t){return(new kf).writeFeaturesObject(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}static getCenter(t){return Vt(t instanceof X?t.getGeometry().getExtent():t.getExtent())}static to3857(t){return(new kf).readFeature(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}static to3857_featureList(t){return(new kf).readFeatures(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}}const AO=class{static isArray(t){return Array.isArray?Array.isArray(t):"[object Array]"===AO.objToString.call(t)}static isFunction(t){return"function"==typeof t}static isString(t){return"string"==typeof t}static isStringSafe(t){return"[object String]"===AO.objToString.call(t)}static isNumber(t){return"number"==typeof t}static isObject(t){var e=typeof t;return"function"===e||!!t&&"object"===e}static isBuiltInObject(t){return!!AO.BUILTIN_OBJECT[AO.objToString.call(t)]}static isTypedArray(t){return!!AO.TYPED_ARRAY[AO.objToString.call(t)]}static isDom(t){return"object"==typeof t&&"number"==typeof t.nodeType&&"object"==typeof t.ownerDocument}static isGradientObject(t){return null!=t.colorStops}static isImagePatternObject(t){return null!=t.image}static isRegExp(t){return"[object RegExp]"===AO.objToString.call(t)}static isPrimitive(t){return t[AO.primitiveKey]}};let fO=AO;e(fO,"BUILTIN_OBJECT",{"[object Function]":!0,"[object RegExp]":!0,"[object Date]":!0,"[object Error]":!0,"[object CanvasGradient]":!0,"[object CanvasPattern]":!0,"[object Image]":!0,"[object Canvas]":!0}),e(fO,"TYPED_ARRAY",{"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0}),e(fO,"primitiveKey","__ec_primitive__"),e(fO,"objToString",Object.prototype.toString);const pO=class{static merge(t,e,r){if(!fO.isObject(e)||!fO.isObject(t))return r?pO.clone(e):t;for(var n in e)if(e.hasOwnProperty(n)&&n!==pO.protoKey){var i=t[n],o=e[n];!fO.isObject(o)||!fO.isObject(i)||fO.isArray(o)||fO.isArray(i)||fO.isDom(o)||fO.isDom(i)||fO.isBuiltInObject(o)||fO.isBuiltInObject(i)||fO.isPrimitive(o)||fO.isPrimitive(i)?!r&&n in t||(t[n]=pO.clone(e[n])):pO.merge(i,o,r)}return t}static clone(t){if(null==t||"object"!=typeof t)return t;var e=t,r=fO.objToString.call(t);if("[object Array]"===r){if(!fO.isPrimitive(t)){e=[];for(var n=0,i=t.length;n<i;n++)e[n]=pO.clone(t[n])}}else if(fO.TYPED_ARRAY[r]){if(!fO.isPrimitive(t)){var o=t.constructor;if(o.from)e=o.from(t);else for(e=new o(t.length),n=0,i=t.length;n<i;n++)e[n]=pO.clone(t[n])}}else if(!fO.BUILTIN_OBJECT[r]&&!fO.isPrimitive(t)&&!fO.isDom(t))for(var s in e={},t)t.hasOwnProperty(s)&&s!==pO.protoKey&&(e[s]=pO.clone(t[s]));return e}};let dO=pO;function gO(t){let e,r="";for(e in t)t[e]&&String(t[e])&&(r+=`&${e}=${t[e]}`);return r&&(r="?"+r.slice(1)),r}e(dO,"protoKey","__proto__");const yO=Object.freeze(Object.defineProperty({__proto__:null,SecondToHHMMSS:function(t){let e=parseInt(t),r=0,n=0;e>60&&(r=Math.floor(e/60),e=Math.floor(e%60),r>60&&(n=Math.floor(r/60),r=Math.floor(r%60)));let i=Math.floor(e)+"秒";return r>0&&(i=Math.floor(r)+"分"+i),n>0&&(i=Math.floor(n)+"小时"+i),i},ToDegree:function(t=0,e=0,r=0,n=6){return(t+e/60+r/3600).toFixed(n=n>6?6:n)},ToDegreeMinuteSecond:function(t){let e;if(e="number"==typeof t?String(t):t,void 0===e||""==e)return{degree:0,minute:0,second:0};let r=e.indexOf("."),n=r<0?e:e.substring(0,r),i="0",o="0";return r>0&&(i="0"+e.substring(r),i=60*parseFloat(i)+"",r=i.indexOf("."),r>0&&(o="0"+i.substring(r),i=i.substring(0,r),o=60*parseFloat(o)+"",r=o.indexOf("."),o=o.substring(0,r+4),o=parseFloat(o).toFixed(2))),{degree:parseInt(n),minute:parseInt(i),second:parseFloat(o)}},formatDistance:function(t){return t?t>=1e3?(t/1e3).toFixed(2)+"公里":t+"米":"0米"},paramsToUrl:gO},Symbol.toStringTag,{value:"Module"}));function mO(t){return async function(t){return(await fetch(t,{method:"GET",mode:"cors",cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer"})).json()}(t)}const vO=Object.freeze(Object.defineProperty({__proto__:null,fetchJson:mO,format:yO,isutil:fO,json:dO},Symbol.toStringTag,{value:"Module"}));var _O=function(t){var e,r;t||(t={});var n=this.canvas_=document.createElement("canvas"),i=(Number(t.scale)>0?Number(t.scale):1)*lt||lt,o=n.getContext("2d");if(t.image){t.image.load();var s=t.image.getImage();if(s.width)n.width=Math.round(s.width*i),n.height=Math.round(s.height*i),o.globalAlpha="number"==typeof t.opacity?t.opacity:1,o.drawImage(s,0,0,s.width,s.height,0,0,n.width,n.height),e=o.createPattern(n,"repeat");else{var a=this;e=[0,0,0,0],s.onload=function(){n.width=Math.round(s.width*i),n.height=Math.round(s.height*i),o.globalAlpha="number"==typeof t.opacity?t.opacity:1,o.drawImage(s,0,0,s.width,s.height,0,0,n.width,n.height),e=o.createPattern(n,"repeat"),a.setColor(e)}}}else{var l=this.getPattern_(t);if(n.width=Math.round(l.width*i),n.height=Math.round(l.height*i),o.beginPath(),t.fill&&(o.fillStyle=Hn(t.fill.getColor()),o.fillRect(0,0,n.width,n.height)),o.scale(i,i),o.lineCap="round",o.lineWidth=l.stroke||1,o.fillStyle=Hn(t.color||"#000"),o.strokeStyle=Hn(t.color||"#000"),l.circles)for(r=0;r<l.circles.length;r++){var u=l.circles[r];o.beginPath(),o.arc(u[0],u[1],u[2],0,2*Math.PI),l.fill&&o.fill(),l.stroke&&o.stroke()}if(l.repeat||(l.repeat=[[0,0]]),l.char&&(o.font=l.font||l.width+"px Arial",o.textAlign="center",o.textBaseline="middle",l.angle?(o.fillText(l.char,l.width/4,l.height/4),o.fillText(l.char,5*l.width/4,5*l.height/4),o.fillText(l.char,l.width/4,5*l.height/4),o.fillText(l.char,5*l.width/4,l.height/4),o.fillText(l.char,3*l.width/4,3*l.height/4),o.fillText(l.char,-l.width/4,-l.height/4),o.fillText(l.char,3*l.width/4,-l.height/4),o.fillText(l.char,-l.width/4,3*l.height/4)):o.fillText(l.char,l.width/2,l.height/2)),l.lines)for(r=0;r<l.lines.length;r++)for(var h=0;h<l.repeat.length;h++){var c=l.lines[r];o.beginPath(),o.moveTo(c[0]+l.repeat[h][0],c[1]+l.repeat[h][1]);for(var A=2;A<c.length;A+=2)o.lineTo(c[A]+l.repeat[h][0],c[A+1]+l.repeat[h][1]);l.fill&&o.fill(),l.stroke&&o.stroke(),o.save(),o.strokeStyle="red",o.strokeWidth=.1,o.restore()}if(e=o.createPattern(n,"repeat"),t.offset){var f=t.offset;if("number"==typeof f&&(f=[f,f]),f instanceof Array){var p=Math.round(f[0]*i),d=Math.round(f[1]*i);o.scale(1/i,1/i),o.clearRect(0,0,n.width,n.height),o.translate(p,d),o.fillStyle=e,o.fillRect(-p,-d,n.width,n.height),e=o.createPattern(n,"repeat")}}}t.color=e,Rn.call(this,t)};Vm(_O,Rn),_O.prototype.clone=function(){var t=Tn.prototype.clone.call(this);return t.canvas_=this.canvas_,t},_O.prototype.getImage=function(){return this.canvas_},_O.prototype.getPattern_=function(t){var e,r=Km.prototype.patterns[t.pattern]||Km.prototype.patterns.dot,n=Math.round(t.spacing)||10;switch(t.pattern){case"dot":case"circle":e=0===t.size?0:t.size/2||2,t.angle?(n=r.width=r.height=Math.round(1.4*n),r.circles=[[n/4,n/4,e],[3*n/4,3*n/4,e]],"circle"==t.pattern&&(r.circles=r.circles.concat([[n/4+n,n/4,e],[n/4,n/4+n,e],[3*n/4-n,3*n/4,e],[3*n/4,3*n/4-n,e],[n/4+n,n/4+n,e],[3*n/4-n,3*n/4-n,e]]))):(r.width=r.height=n,r.circles=[[n/2,n/2,e]],"circle"==t.pattern&&(r.circles=r.circles.concat([[n/2+n,n/2,e],[n/2-n,n/2,e],[n/2,n/2+n,e],[n/2,n/2-n,e],[n/2+n,n/2+n,e],[n/2+n,n/2-n,e],[n/2-n,n/2+n,e],[n/2-n,n/2-n,e]])));break;case"tile":case"square":e=0===t.size?0:t.size/2||2,t.angle?(r.width=r.height=n,r.lines=[[n/2-e,n/2,n/2,n/2-e,n/2+e,n/2,n/2,n/2+e,n/2-e,n/2]]):(r.width=r.height=n,r.lines=[[n/2-e,n/2-e,n/2+e,n/2-e,n/2+e,n/2+e,n/2-e,n/2+e,n/2-e,n/2-e]]),"square"==t.pattern&&(r.repeat=[[0,0],[0,n],[n,0],[0,-n],[-n,0],[-n,-n],[n,n],[-n,n],[n,-n]]);break;case"cross":t.angle&&(t.angle=45);case"hatch":var i=Math.round(((t.angle||0)-90)%360);i>180&&(i-=360),i*=Math.PI/180;var o=Math.cos(i),s=Math.sin(i);if(Math.abs(s)<1e-4)r.width=r.height=n,r.lines=[[0,.5,n,.5]],r.repeat=[[0,0],[0,n]];else if(Math.abs(o)<1e-4)r.width=r.height=n,r.lines=[[.5,0,.5,n]],r.repeat=[[0,0],[n,0]],"cross"==t.pattern&&(r.lines.push([0,.5,n,.5]),r.repeat.push([0,n]));else{var a=r.width=Math.round(Math.abs(n/s))||1,l=r.height=Math.round(Math.abs(n/o))||1;"cross"==t.pattern?(r.lines=[[-a,-l,2*a,2*l],[2*a,-l,-a,2*l]],r.repeat=[[0,0]]):o*s>0?(r.lines=[[-a,-l,2*a,2*l]],r.repeat=[[0,0],[a,0],[0,l]]):(r.lines=[[2*a,-l,-a,2*l]],r.repeat=[[0,0],[-a,0],[0,l]])}r.stroke=0===t.size?0:t.size||4}return r};class wO{constructor(){e(this,"data"),e(this,"pi"),e(this,"x_pi"),e(this,"a"),e(this,"ee"),fm(),pm(Ig),this.data=[],this.data.push({dh:13,wkid:4502}),this.data.push({dh:14,wkid:4503}),this.data.push({dh:15,wkid:4504}),this.data.push({dh:16,wkid:4505}),this.data.push({dh:17,wkid:4506}),this.data.push({dh:18,wkid:4507}),this.data.push({dh:19,wkid:4508}),this.data.push({dh:20,wkid:4509}),this.data.push({dh:21,wkid:4510}),this.data.push({dh:22,wkid:4511}),this.data.push({dh:23,wkid:4512}),this.data.push({dh:75,wkid:4534}),this.data.push({dh:78,wkid:4535}),this.data.push({dh:81,wkid:4536}),this.data.push({dh:84,wkid:4537}),this.data.push({dh:87,wkid:4538}),this.data.push({dh:90,wkid:4539}),this.data.push({dh:93,wkid:4540}),this.data.push({dh:96,wkid:4541}),this.data.push({dh:99,wkid:4542}),this.data.push({dh:102,wkid:4543}),this.data.push({dh:105,wkid:4544}),this.data.push({dh:108,wkid:4545}),this.data.push({dh:111,wkid:4546}),this.data.push({dh:114,wkid:4547}),this.data.push({dh:117,wkid:4548}),this.data.push({dh:120,wkid:4549}),this.data.push({dh:123,wkid:4550}),this.data.push({dh:126,wkid:4551}),this.data.push({dh:129,wkid:4552}),this.data.push({dh:132,wkid:4553}),this.data.push({dh:135,wkid:4554}),this.pi=3.141592653589793,this.x_pi=52.35987755982988,this.a=6378245,this.ee=.006693421622965943}ConvertToMapCoord(t,e){return{Coord3857:this.ConvertCoordinatesTo3857(t,e),Coord4326:this.ConvertCoordinatesTo4326(t,e)}}ConvertCoordinatesTo3857(t,e){return-1==t.toUpperCase().indexOf("EPSG:")&&(t="EPSG:"+t),Ig(t,"EPSG:3857",e)}ConvertCoordinatesTo4326(t,e){return-1==t.toUpperCase().indexOf("EPSG:")&&(t="EPSG:"+t),Ig(t,"EPSG:4326",e)}formatJsonTo3857(t){let e;return e="EPSG:3857"==t.crs.properties.name?(new kf).readFeatures(t):"EPSG:4326"==t.crs.properties.name?(new kf).readFeatures(t,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"}):(new kf).readFeatures(t,{dataProjection:t.crs.properties.name,featureProjection:"EPSG:3857"}),e}formatJsonTo4326Json(t){let e,r=new kf;return e="EPSG:4326"==t.crs.properties.name?r.readFeatures(t):"EPSG:3857"==t.crs.properties.name?r.readFeatures(t,{dataProjection:"EPSG:3857",featureProjection:"EPSG:4326"}):r.readFeatures(t,{dataProjection:t.crs.properties.name,featureProjection:"EPSG:4326"}),r.writeFeaturesObject(e)}formatJsonToPoint(t){let e=this.formatJsonTo3857(t),r=[];return e.forEach((t=>{switch(t.getGeometry().getType()){case"Polygon":r.push(new X({geometry:t.getGeometry().getInteriorPoint(),properties:t.getProperties().properties}));break;case"Point":r.push(t)}})),r}LnglatToCGCS2000(t,e,r=3){let n,i;return n=3==r?3*parseInt(((t+1.5)/3).toString()):6*parseInt(((t+6)/6).toString())-3,this.data.forEach((t=>{t.dh!=n||(i=t.wkid)})),i?Ig("EPSG:4326","EPSG:"+i,[t,e]):[0,0]}ConvertWebMercatorToCGCS2000(t,e,r=3){let n=hr([t,e]);return this.LnglatToCGCS2000(n[0],n[1],r)}webMktToLngLat(t){return hr(t)}lngLatToWebMkt(t){return ur(t)}transformLat(t,e){let r=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.pi)+20*Math.sin(2*t*this.pi))/3,r+=2*(20*Math.sin(e*this.pi)+40*Math.sin(e/3*this.pi))/3,r+=2*(160*Math.sin(e/12*this.pi)+320*Math.sin(e*this.pi/30))/3,r}transformLon(t,e){let r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.pi)+20*Math.sin(2*t*this.pi))/3,r+=2*(20*Math.sin(t*this.pi)+40*Math.sin(t/3*this.pi))/3,r+=2*(150*Math.sin(t/12*this.pi)+300*Math.sin(t/30*this.pi))/3,r}transform(t,e){if(this.outOfChina(t,e))return[t,e];let r=this.transformLat(e-105,t-35),n=this.transformLon(e-105,t-35),i=t/180*this.pi,o=Math.sin(i);o=1-this.ee*o*o;let s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.pi),n=180*n/(this.a/s*Math.cos(i)*this.pi),[t+r,e+n]}outOfChina(t,e){return e<72.004||e>137.8347||t<.8293||t>55.8271}wgs84ToGcj02(t,e){if(this.outOfChina(t,e))return{lat:t,lon:e};let r=this.transformLat(e-105,t-35),n=this.transformLon(e-105,t-35),i=t/180*this.pi,o=Math.sin(i);o=1-this.ee*o*o;let s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.pi),n=180*n/(this.a/s*Math.cos(i)*this.pi),{mgLat:t+r,mgLon:e+n}}gcj02ToWgs84(t,e){let r=this.transform(t,e),n=2*e-r[1];return{latitude:2*t-r[0],lontitude:n}}gcj02ToBd09(t,e){let r=e,n=t,i=Math.sqrt(r*r+n*n)+2e-5*Math.sin(n*this.x_pi),o=Math.atan2(n,r)+3e-6*Math.cos(r*this.x_pi),s=i*Math.cos(o)+.0065;return{tempLat:i*Math.sin(o)+.006,tempLon:s}}bd09ToGcj02(t,e){let r=e-.0065,n=t-.006,i=Math.sqrt(r*r+n*n)-2e-5*Math.sin(n*this.x_pi),o=Math.atan2(n,r)-3e-6*Math.cos(r*this.x_pi),s=i*Math.cos(o);return{tempLat:i*Math.sin(o),tempLon:s}}wgs84ToBd09(t,e){let r=this.wgs84ToGcj02(t,e);return this.gcj02ToBd09(r[0],r[1])}bd09_To_gps84(t,e){let r=this.bd09ToGcj02(t,e),n=this.gcj02ToWgs84(r[0],r[1]);return n[0]=n[0].toFixed(6),n[1]=n[1].toFixed(6),n}}class bO extends X{constructor(t){super(),e(this,"option"),e(this,"Proj"),this.option={graphicType:"baseGraphic",lnglat:[0,0],dataWkID:Xp.EPSG3857,tooltipOption:{offset:[0,0]},popupOption:{offset:[0,0]},style:{text:{font:"14px Microsoft YaHei",text:"",fill:{color:"#8B4513"},stroke:{color:"rgba(255, 255, 255,1)",width:2},backgroundFill:{color:"rgba(255, 255, 255, 0.0)"},backgroundStroke:{color:"rgba(0, 0, 0, 0.0)",width:2},padding:[3,3,3,3],offsetX:0,offsetY:-10,textBaseline:"bottom"},image:{scale:1,radius:5,fill:{color:"rgba(255, 0, 0,1)"},stroke:{color:"rgba(255, 255, 0,1)",width:1}},stroke:{color:"rgba(255, 255, 0,1)",width:2,lineDash:null,pattern:void 0,image:void 0,ratio:1,patternColor:"rgba(0, 0, 0,1)",offset:0,scale:1,size:5,spacing:10,angle:0},fill:{patternColor:"rgba(0, 0, 0,1)",color:"rgba(255, 255, 255,0.2)",pattern:void 0,image:void 0,ratio:1,offset:0,scale:1,size:5,spacing:10,angle:0},imageOption:{},zIndex:999,radius:0,startAngle:0,stopAngle:0,rotation:0},attribute:null},this.option=dO.merge(this.option,t,!0),this.Proj=new wO,this.setStyle(new ji({zIndex:this.option.style.zIndex}))}setAttribute(t){let e=dO.merge(this.getProperties(),t,!0);this.setProperties(e)}toGeoJSON(){return(new kf).writeGeometryObject(this.getGeometry(),{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}bindPopup(t,e={offset:[0,0]}){this.option.popupInfo=t,this.option.popupOption=e}bindTooltip(t,e={offset:[0,0]}){this.option.tooltipInfo=t,this.option.tooltipOption=e}isPopupBind(){return!!this.option.popupInfo}isTooltipBind(){return!!this.option.tooltipInfo}openPopup(t,e){t&&(this.option.popupInfo=t),e&&(this.option.popupOption=e),this.dispatchEvent({type:"graphicPopopOpen",data:this.option.popupInfo,option:this.option.popupOption})}closePopup(){this.dispatchEvent({type:"graphicPopopClose",data:this.option.popupInfo})}openTooltip(t,e){t&&(this.option.tooltipInfo=t),e&&(this.option.tooltipOption=e),this.dispatchEvent({type:"graphicTooltipOpen",data:this.option.tooltipInfo,option:this.option.tooltipOption})}chaikin_copy(t,e){return t[0]=e[0],t[1]=e[1],t}chaikin_smooth_line(t,e=[]){Array.isArray(e)||(e=[]),t.length>0&&e.push(this.chaikin_copy([0,0],t[0]));for(var r=0;r<t.length-1;r++){var n=t[r],i=t[r+1],o=n[0],s=n[1],a=i[0],l=i[1],u=[.75*o+.25*a,.75*s+.25*l],h=[.25*o+.75*a,.25*s+.75*l];e.push(u),e.push(h)}return t.length>1&&e.push(this.chaikin_copy([0,0],t[t.length-1])),e}chaikin_smooth_polygon(t,e=[]){Array.isArray(e)||(e=[]);for(var r=0;r<t.length-1;r++){var n=t[r],i=t[r+1],o=n[0],s=n[1],a=i[0],l=i[1],u=[.75*o+.25*a,.75*s+.25*l],h=[.25*o+.75*a,.25*s+.75*l];e.push(u),e.push(h)}return e.push(e[0]),e}smoothFunc(t,e=5,r=!0){let n=Math.min(Math.max(e||5,1),10);for(;n>0;)t=r?this.chaikin_smooth_line(t):this.chaikin_smooth_polygon(t),n--;return t}setSmooth(t=5,e=!0){if(e){let n=this.getGeometry();var r=n.getCoordinates();n.setCoordinates(this.smoothFunc(r,t,e))}else{let n=this.getGeometry();r=n.getCoordinates()[0],n.setCoordinates([this.smoothFunc(r,t,e)])}}setTextStyle(t){var e;t=dO.merge(this.option.style.text,t,!0);let r=new Vi({text:t.text,font:t.font,fill:new Tn({color:t.fill.color}),stroke:new Rn({color:t.stroke.color,width:t.stroke.width}),backgroundFill:new Tn({color:t.backgroundFill.color}),backgroundStroke:new Rn({color:t.backgroundStroke.color,width:t.backgroundStroke.width}),padding:t.padding,textBaseline:t.textBaseline,offsetX:t.offsetX,offsetY:t.offsetY});null==(e=this.getStyle())||e.setText(r),this.option.style.text=t}setTrianglePointStyle(t){var e;t=dO.merge(this.option.style.image,t,!0);let r=new Oi({scale:t.scale,radius:t.radius,points:3,angle:Math.PI,displacement:[0,10],fill:new Tn({color:t.fill.color}),stroke:new Rn({color:t.stroke.color,width:t.stroke.width})});null==(e=this.getStyle())||e.setImage(r),this.option.style.image=t}setCirclePointStyle(t){var e;t=dO.merge(this.option.style.image,t,!0);let r=new Ri({scale:t.scale,radius:t.radius,fill:new Tn({color:t.fill.color}),stroke:new Rn({color:t.stroke.color,width:t.stroke.width})});null==(e=this.getStyle())||e.setImage(r),this.option.style.image=t}setStrokeSimpleStyle(t){t=dO.merge(this.option.style.stroke,t,!0);let e=new Rn({color:t.color,width:t.width,lineDash:t.lineDash});this.getStyle().setStroke(e),this.option.style.stroke=t}setStrokePatternStyle(t){t=dO.merge(this.option.style.stroke,t,!0);let e=new _O({pattern:t.pattern,image:t.image?new Ns({src:t.image}):void 0,ratio:t.ratio,color:t.patternColor,offset:t.offset,scale:t.scale,fill:new Tn({color:t.color}),size:t.size,spacing:t.spacing,angle:t.angle,width:t.width,lineDash:t.lineDash});this.getStyle().setStroke(e),this.option.style.stroke=t}setFillColor(t){var e;null==(e=this.getStyle())||e.setFill(new Tn({color:t})),this.option.style.fill.color=t}setFillPatternStyle(t){t=dO.merge(this.option.style.fill,t,!0);let e=new Km({pattern:t.pattern,image:void 0,ratio:t.ratio,color:t.patternColor,offset:t.offset,scale:t.scale,size:t.size,spacing:t.spacing,angle:t.angle,fill:new Tn({color:t.color})});this.getStyle().setFill(e),this.option.style.fill=t}setFillImageStyle(t){this.option.style.fill.image=t;const e=document.createElement("canvas").getContext("2d"),r=new Image;r.src=t,r.onload=()=>{this.getStyle().setFill(new Tn({color:e.createPattern(r,"repeat")}))}}setZIndex(t){this.option.style.zIndex=t,this.getStyle().setZIndex(t)}getCoordinates(t="3857"){let e=this.getGeometry().clone();return"4326"==t&&e.transform("EPSG:3857","EPSG:4326"),e.getCoordinates()}getGraphicJson(t="3857"){let e=this.getProperties();return this.getGeometry()&&delete e[this.getGeometryName()],{type:this.option.graphicType,lnglat:this.getCoordinates(t),dataWkID:t,style:this.option.style,attribute:e}}}class xO extends bO{constructor(t){let e;if(super(t),this.option.graphicType="PointGraphic",this.option=dO.merge(this.option,t,!0),0!=this.option.lnglat[0])switch(this.option.dataWkID){case Xp.EPSG4326:this.setGeometry(new nn(ur(this.option.lnglat)));break;case Xp.EPSG3857:this.setGeometry(new nn(this.option.lnglat));break;case Xp.BAIDU:e=this.Proj.bd09_To_gps84(this.option.lnglat[0],this.option.lnglat[1]),this.setGeometry(new nn([e.lontitude,e.latitude]));break;case Xp.GCJ02:e=this.Proj.gcj02ToWgs84(this.option.lnglat[0],this.option.lnglat[1]),this.setGeometry(new nn([e.lontitude,e.latitude]));break;case Xp.CGCS2000_GK_CM_6:break;default:this.setGeometry(new nn(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,this.option.lnglat)))}this.option.attribute&&this.setProperties(this.option.attribute),this.setTextStyle(this.option.style.text),this.option.style.image.scale>0&&this.setCirclePointStyle(this.option.style.image)}setCoordinates(t,e,r=Xp.EPSG4326){let n=this.getGeometry();this.option.dataWkID==Xp.EPSG4326?n.setCoordinates(ur([t,e])):this.option.dataWkID==Xp.EPSG3857?n.setCoordinates([t,e]):n.setCoordinates(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,[t,e]))}}class EO extends bO{constructor(t){let e;if(super(t),this.option.graphicType="ImagePointGraphic",0!=this.option.lnglat[0])switch(this.option.dataWkID){case Xp.EPSG4326:this.setGeometry(new nn(ur(t.lnglat)));break;case Xp.EPSG3857:this.setGeometry(new nn(t.lnglat));break;case Xp.BAIDU:e=this.Proj.bd09_To_gps84(t.lnglat[0],t.lnglat[1]),this.setGeometry(new nn([e.lontitude,e.latitude]));break;case Xp.GCJ02:e=this.Proj.gcj02ToWgs84(t.lnglat[0],t.lnglat[1]),this.setGeometry(new nn([e.lontitude,e.latitude]));break;default:this.setGeometry(new nn(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,t.lnglat)))}if(this.option.attribute&&this.setProperties(this.option.attribute),"gif"==this.option.style.imageOption.type){const t=gifler(this.option.style.imageOption.src);let e=document.createElement("canvas");t.frames(e,((t,e)=>{this.getStyle()||this.setStyle(new ji({image:new Ns({img:t.canvas,imgSize:[e.width,e.height],opacity:.8})})),t.clearRect(0,0,e.width,e.height),t.drawImage(e.buffer,e.x,e.y),this.option.style.imageOption.maprender()}),!0)}else this.setTextStyle(this.option.style.text),this.setPointIconStyle(this.option.style.imageOption)}setPointIconStyle(t){this.option.style.imageOption=t;let e=new Ns(this.option.style.imageOption);e.load(),this.getStyle().setImage(e)}setCoordinates(t,e,r=Xp.EPSG4326){let n=this.getGeometry();this.option.dataWkID==Xp.EPSG4326?n.setCoordinates(ur([t,e])):this.option.dataWkID==Xp.EPSG3857?n.setCoordinates([t,e]):n.setCoordinates(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,[t,e]))}setRotation(t){this.getStyle().getImage().setRotation(t),this.changed()}}class CO extends bO{constructor(t){super(t),this.option.graphicType="LineGraphic",0!=this.option.lnglat[0]&&this.setCoordinates(this.option.lnglat,this.option.dataWkID),this.option.attribute&&this.setProperties(this.option.attribute),this.option.style.stroke.image||this.option.style.stroke.pattern?this.setStrokePatternStyle(this.option.style.stroke):this.setStrokeSimpleStyle(this.option.style.stroke)}getGraphicJson(t="3857"){let e;e=this.option.style.stroke.image||this.option.style.stroke.pattern?{pattern:this.option.style.stroke.pattern,image:this.option.style.stroke.image,ratio:this.option.style.stroke.ratio,patternColor:this.option.style.stroke.patternColor,offset:this.option.style.stroke.offset,scale:this.option.style.stroke.scale,color:this.option.style.stroke.color,size:this.option.style.stroke.size,spacing:this.option.style.stroke.spacing,angle:this.option.style.stroke.angle,width:this.option.style.stroke.width,lineDash:this.option.style.stroke.lineDash}:{color:this.option.style.stroke.color,width:this.option.style.stroke.width,lineDash:this.option.style.stroke.lineDash};let r=this.getProperties();return this.getGeometry()&&delete r[this.getGeometryName()],{type:"LineGraphic",lnglat:this.getCoordinates(t),dataWkID:t,style:{stroke:e,text:this.option.style.text},attribute:r}}setCoordinates(t,e="4326"){switch(this.option.lnglat=t,this.option.dataWkID=e,e){case Xp.EPSG4326:this.setGeometry(new Nn(this.option.lnglat).transform("EPSG:4326","EPSG:3857"));break;case Xp.EPSG3857:this.setGeometry(new Nn(this.option.lnglat));break;case Xp.BAIDU:this.option.lnglat.forEach(((t,e)=>{let r=this.Proj.bd09_To_gps84(t[0],t[1]);this.option.lnglat[e]=[r.lontitude,r.latitude]})),this.setGeometry(new Nn(this.option.lnglat));break;case Xp.GCJ02:this.option.lnglat.forEach(((t,e)=>{let r=this.Proj.gcj02ToWgs84(t[0],t[1]);this.option.lnglat[e]=[r.lontitude,r.latitude]})),this.setGeometry(new Nn(this.option.lnglat));break;default:this.option.lnglat.forEach(((t,e)=>{this.option.lnglat[e]=this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,t)})),this.setGeometry(new Nn(this.option.lnglat))}}lineStyle(){let t=[];for(let e=0;e<10;e++)t.push(new ji({stroke:new Rn({color:[0,255,255,1/(10-e)],width:2*(10-e)-1}),fill:new Tn({color:"rgba(0, 0, 255, 0.05)"})}));return t}}class SO extends bO{constructor(t){if(super(t),this.option.graphicType="PolygonGraphic",0!=this.option.lnglat[0])switch(this.option.dataWkID){case Xp.EPSG4326:this.setGeometry(new bn(this.option.lnglat).transform("EPSG:4326","EPSG:3857"));break;case Xp.EPSG3857:this.setGeometry(new bn(this.option.lnglat));break;case Xp.BAIDU:this.option.lnglat.forEach(((t,e)=>{t.forEach(((e,r)=>{let n=this.Proj.bd09_To_gps84(e[0],e[1]);t[r]=[n.lontitude,n.latitude]}))})),this.setGeometry(new bn(this.option.lnglat));break;case Xp.GCJ02:this.option.lnglat.forEach(((t,e)=>{t.forEach(((e,r)=>{let n=this.Proj.gcj02ToWgs84(e[0],e[1]);t[r]=[n.lontitude,n.latitude]}))})),this.setGeometry(new bn(this.option.lnglat));break;default:this.option.lnglat.forEach((t=>{t.forEach(((e,r)=>{t[r]=this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,e)}))})),this.setGeometry(new bn(this.option.lnglat))}this.option.attribute&&this.setProperties(this.option.attribute),this.setPolygonStyle(this.option.style)}setPolygonStyle(t){t.stroke.pattern?this.setStrokePatternStyle(t.stroke):this.setStrokeSimpleStyle(t.stroke),t.fill.pattern?this.setFillPatternStyle(t.fill):t.fill.image?this.setFillImageStyle(t.fill.image):this.setFillColor(t.fill.color),this.setTextStyle(t.text)}setCoordinates(t,e=Xp.EPSG4326){switch(this.option.lnglat=t,this.option.dataWkID=e,this.option.dataWkID){case Xp.EPSG4326:this.setGeometry(new bn(this.option.lnglat).transform("EPSG:4326","EPSG:3857"));break;case Xp.EPSG3857:this.setGeometry(new bn(this.option.lnglat));break;case Xp.BAIDU:this.option.lnglat.forEach(((t,e)=>{t.forEach(((e,r)=>{let n=this.Proj.bd09_To_gps84(e[0],e[1]);t[r]=[n.lontitude,n.latitude]}))})),this.setGeometry(new bn(this.option.lnglat));break;case Xp.GCJ02:this.option.lnglat.forEach(((t,e)=>{t.forEach(((e,r)=>{let n=this.Proj.gcj02ToWgs84(e[0],e[1]);t[r]=[n.lontitude,n.latitude]}))})),this.setGeometry(new bn(this.option.lnglat));break;default:this.option.lnglat.forEach((t=>{t.forEach(((e,r)=>{t[r]=this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,e)}))})),this.setGeometry(new bn(this.option.lnglat))}}setGeometryFromExtent(t){this.setGeometry(xn(t))}}const BO=Object.freeze(Object.defineProperty({__proto__:null,CurveGraphic:class extends bO{constructor(t){super(t),this.option.graphicType="CurveGraphic",0!=this.option.lnglat[0]&&this.setCoordinates(this.option.lnglat,this.option.dataWkID),this.option.attribute&&this.setProperties(this.option.attribute),this.setStrokeSimpleStyle(this.option.style.stroke),this.setFillColor(this.option.style.fill.color),this.setTextStyle(this.option.style.text)}setAngle(t,e){this.option.dataWkID==Xp.EPSG4326?this.setGeometry(this.createRegularPolygonCurve(this.option.lnglat,this.option.style.radius,t,e,this.option.style.rotation)):this.option.dataWkID==Xp.EPSG3857?this.setGeometry(this.createRegularPolygonCurve(hr(this.option.lnglat),this.option.style.radius,t,e,this.option.style.rotation)):this.setGeometry(this.createRegularPolygonCurve(this.Proj.ConvertCoordinatesTo4326(this.option.dataWkID,this.option.lnglat),this.option.style.radius,t,e,this.option.style.rotation))}setCoordinates(t,e="4326"){switch(this.option.lnglat=t,this.option.dataWkID=e,this.option.dataWkID){case Xp.EPSG4326:this.setGeometry(this.createRegularPolygonCurve(this.option.lnglat,this.option.style.radius,this.option.style.startAngle,this.option.style.stopAngle,this.option.style.rotation));break;case Xp.EPSG3857:this.setGeometry(this.createRegularPolygonCurve(hr(this.option.lnglat),this.option.style.radius,this.option.style.startAngle,this.option.style.stopAngle,this.option.style.rotation));break;case Xp.BAIDU:case Xp.GCJ02:break;default:this.setGeometry(this.createRegularPolygonCurve(this.Proj.ConvertCoordinatesTo4326(this.option.dataWkID,this.option.lnglat),this.option.style.radius,this.option.style.startAngle,this.option.style.stopAngle,this.option.style.rotation))}}createRegularPolygonCurve(t,e,r,n,i){let o=cO.sector(t,e,r,n).getGeometry();return o.rotate(i,ur(t)),o}},DivGraphic:class extends kl{constructor(t){let r,n=qm.uuid15(),i=document.createElement("div");if(i.setAttribute("id",n),super({id:n,element:i}),e(this,"option"),e(this,"Proj"),e(this,"handlers"),e(this,"elementDiv"),this.handlers={},this.elementDiv=i,this.option={html:"<div></div>",positioning:id.bottomleft,hashMove:!1,enabledRightMenu:!0,contextmenu:[{text:"开始编辑对象",icon:"img/marker.png",callback:t=>{"开始编辑对象"==this.option.contextmenu[0].text?(this.option.contextmenu[0].text="停止编辑对象",this.startEdit()):(this.option.contextmenu[0].text="开始编辑对象",this.endEdit())}},{text:"删除对象",icon:"img/marker.png",callback:t=>{this.remove()}}]},this.option=dO.merge(this.option,t,!0),this.Proj=new wO,this.elementDiv.innerHTML=this.option.html,this.setPositioning(this.option.positioning),0!=this.option.coordinate[0])switch(this.option.dataWkID){case Xp.EPSG4326:this.setPosition(ur(this.option.coordinate));break;case Xp.EPSG3857:this.setPosition(this.option.coordinate);break;case Xp.BAIDU:r=this.Proj.bd09_To_gps84(this.option.coordinate[0],this.option.coordinate[1]),this.setPosition([r.lontitude,r.latitude]);break;case Xp.GCJ02:r=this.Proj.gcj02ToWgs84(this.option.coordinate[0],this.option.coordinate[1]),this.setPosition([r.lontitude,r.latitude]);break;case Xp.CGCS2000_GK_CM_6:break;default:this.setPosition(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,this.option.coordinate))}this.on(Rm.onFeatureContextmenu,(t=>{this._setFeatureContextmenu(t.data.contextmenu)})),this.element.addEventListener("mousedown",(t=>{this.option.hashMove?(this.set("isDragging",!0),this.set("dragStart",[t.x,t.y])):this.trigger(Rm.onClick,t)})),this.on("change:element",(t=>{})),this.on("change:position",(t=>{this.trigger(Rm.onChangePosition,{oldVal:t.oldValue,newVal:t.target.getPosition()})})),this.on("change:map",(t=>{null==t.oldValue&&(this.getMap().on("pointermove",(t=>{if(this.option.hashMove&&this.get("isDragging")){var e=this.get("dragStart"),r=this.getMap().getCoordinateFromPixel(e),n=t.coordinate,i=r[0]-n[0],o=r[1]-n[1],s=[this.getPosition()[0]-i,this.getPosition()[1]-o];this.setPosition(s),this.set("dragStart",t.pixel)}})),this.getMap().getViewport().addEventListener("mouseup",(t=>{this.option.hashMove&&this.set("isDragging",!1)})))}))}_setFeatureContextmenu(t){this.option.enabledRightMenu&&(t.clear(),this.option.contextmenu.length>0&&t.extend(this.option.contextmenu))}show(){this.element.classList.remove("mirage-hide")}hide(){this.element.classList.add("mirage-hide")}startEdit(){this.element.classList.add("mirage-edit-marker-selected"),this.option.hashMove=!0,this.trigger(Rm.onEditStart,{})}endEdit(){this.element.classList.remove("mirage-edit-marker-selected"),this.option.hashMove=!1,this.set("isDragging",!1),this.trigger(Rm.onEditEnd,{})}remove(){this.trigger(Rm.onFeatureDeleted,{}),this.getMap().removeOverlay(this)}setCoordinates(t,e,r=Xp.EPSG4326){this.option.coordinate=[t,e],this.option.dataWkID==Xp.EPSG4326?this.setPosition(ur([t,e])):this.option.dataWkID==Xp.EPSG3857?this.setPosition([t,e]):this.setPosition(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,[t,e]))}_on(t,e){return this.handlers[t]||(this.handlers[t]=[]),this.handlers[t].push(e),this}off(t,e){let r=this.handlers[t];for(let n=0;n<r.length;n++)if(r[n]==e){r.splice(n,1);break}return this}onec(t,e,r){var n=this;return this._on(t,(function i(){n.off(t,i),e.apply(r||n,arguments)})),this}trigger(t,e){this.handlers.hasOwnProperty(t)&&this.handlers[t].forEach((t=>{t.call(this,e)}))}},ImagePointGraphic:EO,LabelGraphic:class extends bO{constructor(t){let e;if(super(t),this.option.graphicType="LabelGraphic",0!=this.option.lnglat[0])switch(this.option.dataWkID){case Xp.EPSG4326:this.setGeometry(new nn(ur(t.lnglat)));break;case Xp.EPSG3857:this.setGeometry(new nn(t.lnglat));break;case Xp.BAIDU:e=this.Proj.bd09_To_gps84(t.lnglat[0],t.lnglat[1]),this.setGeometry(new nn([e.lontitude,e.latitude]));break;case Xp.GCJ02:e=this.Proj.gcj02ToWgs84(t.lnglat[0],t.lnglat[1]),this.setGeometry(new nn([e.lontitude,e.latitude]));break;default:this.setGeometry(new nn(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,t.lnglat)))}this.option.attribute&&this.setProperties(this.option.attribute),this.setStyle(new ji({zIndex:this.option.style.zIndex})),this.setTextStyle(this.option.style.text),this.option.style.image.scale>0&&this.setTrianglePointStyle(this.option.style.image)}setCoordinates(t,e,r=Xp.EPSG4326){let n=this.getGeometry();this.option.dataWkID==Xp.EPSG4326?n.setCoordinates(ur([t,e])):this.option.dataWkID==Xp.EPSG3857?n.setCoordinates([t,e]):n.setCoordinates(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID,[t,e]))}},LineGraphic:CO,PointGraphic:xO,PolygonGraphic:SO},Symbol.toStringTag,{value:"Module"}));class IO extends Gm{constructor(t,r){super(t,r),e(this,"_graphicLayerSelect"),e(this,"selectFeature"),e(this,"_modify"),e(this,"_translate"),e(this,"_snap"),e(this,"_source"),e(this,"_draw"),e(this,"_tipPoint");let n={autoPointSize:!1,enabledRightMenu:!1,enabledPopup:!1,enabledTooltip:!1,imageRatio:5,zIndex:500,contextmenu:[{classname:"menudisabled",text:"操作",icon:"img/marker.png",items:[{text:"移动",icon:"img/marker.png",callback:t=>{this._translate.setActive(!0)}},{classname:"menudisabled",text:"编辑",icon:"img/marker.png",callback:t=>{this.startEdit()}},{text:"删除",icon:"img/marker.png",callback:t=>{this._source.removeFeature(this.selectFeature)}}]},{text:"保存为kml",icon:"img/marker.png",callback:t=>{qm.saveTokml(cO.featureTo4326(this.selectFeature),"文件.kml")}}],hashEdit:!1,hashMove:!1,hashSelect:!0};this.option=Object.assign({},n,this.option),this._source=new Aa({wrapX:!1}),this._source.on("featuresloadstart",(t=>{this.trigger(Rm.onLoadStart,t)})),this._source.on("featuresloadend",(t=>{this.trigger(Rm.onLoadEnd,t)})),this._source.on("featuresloaderror",(t=>{this.trigger(Rm.onLoadError,t)})),this._source.on("removefeature",(t=>{t.feature&&this.trigger(Rm.onFeatureDeleted,t.feature.getProperties())})),this._source.on("addfeature",(t=>{t.feature&&(t.feature.on("mousemove",(t=>{t.target.get("editstate")||("function"==typeof t.target.isTooltipBind&&t.target.isTooltipBind()?t.target.openTooltip():(this.showTooltip(t.target),this.trigger(Rm.onFeatureMousemove,{data:t.target})))})),t.feature.on("mouseout",(t=>{this.closeTooltip(),this.trigger(Rm.onFeatureMouseout,{data:t.target})})),t.feature.on("graphicPopopOpen",(t=>{this.showPopup(t.target,t.data,t.option)})),t.feature.on("graphicPopopClose",(t=>{this.closePopup(t.target)})),t.feature.on("graphicTooltipOpen",(t=>{this._showTooltip2(t.target,t.data,t.option)})))})),this._on(Rm.onFeatureSelected,(t=>{this.showTooltip(t.target),this.trigger(Rm.onFeatureMousemove,t)})),this._bindPoupEvent()}initSelect(){var t,e,r,n;this._graphicLayerSelect=new Bh({layers:[this.layer],condition:Au,style:t=>{const e=t.getGeometry().getType();return Xm.getStyle(e,{fillcolor:"rgba(0,191,255,0.1)",strokewidth:5,strokecolor:"rgba(0,191,255,1)"})},filter:function(t,e){if(e)return"ClusterImageLayer"!=e.get("layertype")&&!!t.get("editallows")}}),this._modify=new bh({features:this._graphicLayerSelect.getFeatures(),snapToPointer:!0,style:Xm.getEditPointStyle});const i=this._modify.getOverlay().getSource();this.layer instanceof ka?this._snap=new Mh({source:this.layer.getLayers[0].getSource(),pixelTolerance:10}):this._snap=new Mh({source:this.layer.getSource(),pixelTolerance:10}),this._graphicLayerSelect.on("select",(t=>{t.selected[0]?t.selected[0].set("editstate",!0):t.deselected[0].set("editstate",!1)})),i.on(["addfeature","removefeature"],(function(t){})),this._modify.on("modifystart",(t=>{let e=t.target.features_.array_[0];this.trigger(Rm.onEditModifyStart,{data:e})})),this._modify.on("modifyend",(t=>{let e=t.target.features_.array_[0];this.trigger(Rm.onEditModifyEnd,{data:e})})),this._modify.on("change:active",(t=>{let e=t.target.features_.array_[0];t.target.get("active")?(this.trigger(Rm.onEditStart,{data:e}),t.target.features_.forEach((function(t){if(t.set("editstate",!0),(t.getGeometry().getType()==qp.Polygon||t.getGeometry().getType()==qp.Line)&&t.getStyle()[0]!=Xm.getEditPolygonStyle()[0])return t.setStyle(Xm.getEditPolygonStyle()),void(t.getStyle()[0].text_.text_=t.get("name"))}))):(this.selectFeature&&this.selectFeature.set("editstate",!1),this.trigger(Rm.onEditEnd,{data:e}))})),this._translate=new Nh({layers:[this.layer]}),this._translate.on("translateend",(t=>{this.trigger(Rm.onFeatureMoved,t.features.getArray()[0].getProperties())})),this._graphicLayerSelect.setActive(!0),this._translate.setActive(!1),this._modify.setActive(!1),null==(t=this._map)||t.addInteraction(this._graphicLayerSelect),null==(e=this._map)||e.addInteraction(this._modify),null==(r=this._map)||r.addInteraction(this._snap),null==(n=this._map)||n.addInteraction(this._translate),this.option.hashMove&&this._translate.setActive(!0)}setSelectState(t=!0){this.option.hashSelect=t,this._graphicLayerSelect.setActive(t)}startMove(){this.option.hashMove=!0,this._translate.setActive(!0)}endMove(){this.option.hashMove=!1,this._translate.setActive(!1)}startEdit(){this.option.hashEdit=!0,this._graphicLayerSelect.setActive(!1),this._modify.setActive(!0)}endEdit(){this.option.hashEdit=!1,this._graphicLayerSelect.setActive(!1),this._modify.setActive(!1)}bindContextmenu(t){this.option.enabledRightMenu=!0,t&&(this.option.contextmenu=t)}unbindContextmenu(){this.option.enabledRightMenu=!1}appendContextmenu(t){t.forEach((t=>{this.option.contextmenu.push(t)}))}_setFeatureContextmenu(t,e){this.option.enabledRightMenu&&(e.clear(),this.selectFeature=t,this.option.contextmenu.forEach((e=>{e.data={SelectedFeature:t}})),this.option.contextmenu.length>0&&e.extend(this.option.contextmenu))}showTitle(t,e){new Promise(((r,n)=>{this.layer.getSource().getFeatures().forEach((r=>{let n=r.getProperties();if(t==n.dataType)try{r.getStyle().getText().setText(e?r.get("name"):"")}catch(dX){}})),this.layer.changed()}))}showTitleByClassname(t,e){this.layer.getSource().forEachFeature((r=>{let n=r.getProperties();t==n.dataType&&(r.getStyle().getText().setText(e?r.get("name"):""),r.changed())}))}_bindPoupEvent(){let t=document.getElementById("popup-closer");t&&(t.onclick=()=>{this.closePopup()})}bindPopup(t,e={offset:[0,0]}){this.option.enabledPopup=!0,t&&(this.option.popupInfo=t),this.option.popupOption=e}unbindPopup(){this.option.enabledPopup=!1,this.closePopup()}openPopup(t,e,r={offset:[0,0]}){if(e&&(this.option.popupInfo=e),this.option.enabledPopup&&this.option.popupInfo){let e="";if("string"==typeof this.option.popupInfo)e=this.option.popupInfo;else{let r=t.getProperties();this.option.popupInfo.forEach((t=>{t.dataType==r.dataType&&t.showContent.forEach((t=>{t.type?e+=t.html:e+=t.name+":"+r[t.field]+"<br>"}))}))}""!=e&&this.showPopup(t,e,r)}}showPopup(t,e,r){var n,i;let o=Vt(t.getGeometry().getExtent()),s=document.getElementById("popup-content");s&&(s.innerHTML=e),null==(n=this._map)||n.getOverlayById("popup").setPosition(o),null==(i=this._map)||i.getOverlayById("popup").setOffset(r.offset),this.trigger(Rm.onFeaturePopupOpen,{element:document.getElementById("popup-content"),data:t})}closePopup(t){var e;null==(e=this._map)||e.getOverlayById("popup").setPosition(void 0),this.trigger(Rm.onFeaturePopupClose,{element:document.getElementById("popup-content"),data:t})}bindTooltip(t,e={offset:[0,0]}){this.option.enabledTooltip=!0,t&&(this.option.tooltipInfo=t),this.option.tooltipOption=e}unbindTooltip(){this.option.enabledTooltip=!1,this.closeTooltip()}showTooltip(t){if(this.option.enabledTooltip&&this.option.tooltipInfo){let e="";if("string"==typeof this.option.tooltipInfo)e=this.option.tooltipInfo;else{let r=t.getProperties();this.option.tooltipInfo.forEach((t=>{t.dataType==r.dataType&&t.showContent.forEach((t=>{t.type?e+=t.html:e+=t.name+":"+r[t.field]+"<br>"}))}))}""!=e&&this._showTooltip2(t,e,this.option.tooltipOption)}}_showTooltip2(t,e,r){var n,i;let o=Vt(t.getGeometry().getExtent()),s=document.getElementById("tooltip-content");s&&(s.innerHTML=e),null==(n=this._map)||n.getOverlayById("tooltip").setPosition(o),null==(i=this._map)||i.getOverlayById("tooltip").setOffset(r.offset),this.trigger(Rm.onFeatureTooltipOpen,{element:document.getElementById("tooltip-content"),data:t})}closeTooltip(){var t;null==(t=this._map)||t.getOverlayById("tooltip").setPosition(void 0),this.trigger(Rm.onFeatureTooltiClose,{element:document.getElementById("tooltip-content"),data:""})}addGeoJson(t,e){this.addFeatures(t,this.formatJsonTo3857(e))}addGeoJsonPoint(t,e){this.addFeatures(t,this.formatJsonToPoint(e))}convertGeoJsontoFeatures(t){return this.formatJsonTo3857(t)}addFeatures(t,e,r,n){this.trigger(Rm.onLoadStart,t),e.forEach((e=>{let i=this._getFeatureAttribute(t),o=dO.merge(e.getProperties(),i,!1);r&&(o=dO.merge(o,r,!0)),e.setProperties(o),e.set("classname",t);let s=e.getStyle();if(s||(s=e.get("style")?Xm.getStyle(e.getGeometry().getType(),e.get("style")):Xm.getStyle(e.getGeometry().getType(),{}),e.setStyle(s)),n){let t=n(e.getProperties());s=Xm.getStyle(e.getGeometry().getType(),t)}"探方"!=e.get("dataType")&&"新增探方"!=e.get("dataType")||e.get("name")&&s.getText()&&s.getText().setText(e.get("name")+"\n"+e.get("负责人"))})),this._source.addFeatures(e),this._source.changed(),this.trigger(Rm.onLoadEnd,t)}_getFeatureAttribute(t="default"){return{classname:t,uuid:qm.uuid15(),editallows:!0,editstate:!1,movestate:!0,featuretype:Kp.vector,dataType:""}}addFeature(t,e,r,n){this.trigger(Rm.onLoadStart,t);let i=this._getFeatureAttribute(t),o=dO.merge(e.getProperties(),i,!1);r&&(o=dO.merge(o,r,!0)),e.setProperties(o),e.set("classname",t);let s=e.getStyle();if(!s){let t=e.get("style");if(t){if(s=Xm.getStyle(e.getGeometry().getType(),t),n){let t=n(e.getProperties());s=Xm.getStyle(e.getGeometry().getType(),t)}e.setStyle(s)}}this._source.addFeature(e),this.trigger(Rm.onLoadEnd,t)}setFeaturesAttribute(t){this._source.getFeatures().forEach((e=>{if(t){let r=dO.merge(e.getProperties(),t,!0);e.setProperties(r)}}))}setFeaturesAttributeByClassName(t,e){this.getFeaturesByClassName(t).forEach((t=>{if(e){let r=dO.merge(t.getProperties(),e,!0);t.setProperties(r)}}))}setFeatureAttribute(t,e){let r=this.getFeatureByUid(t);if(e){let t=dO.merge(r.getProperties(),e,!0);r.setProperties(t)}}getFeaturesAll(){return this._source.getFeatures()}getFeaturesByFieldName(t,e){let r=[];return this._source.getFeatures().forEach((n=>{n.get(t)==e&&r.push(n)})),r}getFeaturesByClassName(t){let e=[];return this._source.getFeatures().forEach((r=>{r.get("classname")==t&&e.push(r)})),e}getFeatures(t){let e=[];return this._source.getFeatures().forEach((r=>{r.get("name")==t&&e.push(r)})),e}getFeature(t){let e=null;return this._source.getFeatures().forEach((r=>{r.get("name")!=t||(e=r)})),e}getFeatureByUid(t){let e=null;return this._source.getFeatures().forEach((r=>{r.get("uuid")!=t||(e=r)})),e}removeFeature(t){"string"==typeof t?this._source.getFeatures().forEach((e=>{e.get("uuid")==t&&this._source.removeFeature(e)})):this._source.removeFeature(t)}removeFeatures(t){this._source.getFeatures().forEach((e=>{try{e.get("classname").replaceAll(" ","")===t.replaceAll(" ","")&&this._source.removeFeature(e)}catch(dX){}}))}removeFeaturesByJson(t){this._source.getFeatures().forEach((e=>{let r=0;for(let n=0;n<t.name.length;n++)try{e.get(t.name[n].replace(/\s*/g,"")).replace(/\s*/g,"")===t.value[n].replace(/\s*/g,"")&&r++}catch(dX){}r==t.name.length&&this._source.removeFeature(e)}))}setSymbol(t,e){this._source.getFeatures().forEach((r=>{let n=Xm.getStyle(r.getGeometry().getType(),t);if(e){let t=e(r.getProperties());n=Xm.getStyle(r.getGeometry().getType(),t)}r.setStyle(n)}))}setSymbolLevelColor(t){let e=[],r=0,n=0;void 0!==t.autolevel&&null!==t.autolevel||(t.autolevel=!0);let i=[{maxnum:0,fillcolor:"rgba(255,255,255,0.1)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,0.2)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,0.4)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,0.6)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,0.8)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1},{maxnum:0,fillcolor:"rgba(255,0,0,1)",strokecolor:"rgba(255, 255, 255,1)",strokewidth:1}];if(t.levelColor&&(i=t.levelColor),t.autolevel){let o=i.length;this._source.getFeatures().forEach((r=>{let n=r.get(t.attributeName);n&&e.push(parseInt(n))})),r=Math.max(...e),n=r/o,i.forEach(((t,e)=>{t.maxnum=n*e}))}return i.sort((function(t,e){return e.maxnum-t.maxnum})),this._source.getFeatures().forEach((e=>{if(e.get("classname")==t.classname){let r=e.get(t.attributeName);if(r)if(0==parseInt(r)){let t=Xm.getStyle(e.getGeometry().getType(),{fillcolor:"rgba(255,255,255,0)",strokecolor:"rgba(255,255,255,0.1)",strokewidth:.1});e.setStyle(t)}else for(let t=0;t<i.length;t++)if(parseFloat(r)>i[t].maxnum){let r=Xm.getStyle(e.getGeometry().getType(),{fillcolor:i[t].fillcolor,strokecolor:i[t].strokecolor,strokewidth:i[t].strokewidth});e.setStyle(r);break}}})),i}setSymbolByClassname(t,e,r){this._source.getFeatures().forEach((n=>{if(n.get("classname")==t){let t=Xm.getStyle(n.getGeometry().getType(),e);if(r){let e=r(n.getProperties());t=Xm.getStyle(n.getGeometry().getType(),e)}n.setStyle(t)}}))}setSymbolByFeatures(t,e,r){t.forEach((t=>{let n=Xm.getStyle(t.getGeometry().getType(),e);if(r){let e=r(t.getProperties());n=Xm.getStyle(t.getGeometry().getType(),e)}t.setStyle(n),t.changed()}))}setSymbolByStyleClass(t){this._source.getFeatures().forEach((e=>{t.forEach((t=>{if(e.get(t.className)==t.classValue){let r=Xm.getStyle(e.getGeometry().getType(),t.style);e.setStyle(r)}}))}))}setClassSymbol(t,e){this._source.getFeatures().forEach((r=>{r.get("classname")==t&&e.forEach((t=>{if(r.get(t.className)==t.classValue){let e=Xm.getStyle(r.getGeometry().getType(),t.style);r.setStyle(e)}}))}))}setFeaturesTileByJson(t,e){this._source.getFeatures().forEach((r=>{let n=r.get("featureStyle");r.get("dataType")==t&&(e&&r.get("name")?"探方"==r.get("dataType")?n.getText()&&n.getText().setText(r.get("name")+"\n"+r.get("负责人")):n.getText()&&n.getText().setText(r.get("name")):n.getText()&&n.getText().setText(""))}))}clear(){this._source.clear()}startDraw(t){var e;let r=t.type;t.attribute=Object.assign(this._getFeatureAttribute(),t.attribute),t.geometryFunction=null,t.type==qp.Rectangle&&(r=qp.Circle,t.geometryFunction=function(t,e,r){var n=Et([t[0],t[t.length-1]].map((function(t){return br(t)}))),i=[[Ht(n),zt(n),Jt(n),Zt(n),Ht(n)]],o=e;return o?o.setCoordinates(i):o=new bn(i),o}),t.style=t.style?t.style:{};const n=t.type==qp.Circle||t.type==qp.Rectangle?"移动到所需位置,单击结束绘制":"单击继续绘制,双击结束绘制"+(t.type===qp.Polygon?"多边形":"线"),i="点击任意位置开始绘制";let o=i;this._draw=new ch({type:r,geometryFunction:t.geometryFunction,freehand:t.freehand||!1,style:e=>{const r=e.getGeometry(),n=null==r?void 0:r.getType();let i=null;if(i=[Xm.getStyle(t.type,t.style)],o&&"Point"===n&&!this._modify.getOverlay().getSource().getFeatures().length){this._tipPoint=r;let t=Xm.getTipStyle();t.getText().setText(o),i.push(t)}return i}}),null==(e=this._map)||e.addInteraction(this._draw),this._draw.on("drawstart",(t=>{o=n,this.trigger(Rm.onDrawStart,t)})),this._draw.on("drawend",(e=>{var r,n;o=i,null==(r=this._draw)||r.setActive(!1),null==(n=this._map)||n.removeInteraction(this._draw),setTimeout((()=>{this.changeGraphicData(t,e.feature)}),100)}))}changeGraphicData(t,e){for(var r in t.style)""==t.style[r].toString()&&delete t.style[r];let n,i;switch(t.type){case qp.Circle:i=Object.assign({},Xm.getDefaultPolygonStyle(),t.style),n=new SO({lnglat:En(e.getGeometry(),128).getCoordinates(),dataWkID:Xp.EPSG3857,style:{stroke:{color:i.strokecolor,width:i.strokewidth,lineDash:i.strokelineDash},fill:{color:i.fillcolor}},attribute:t.attribute});break;case qp.Polygon:case qp.Rectangle:i=Object.assign({},Xm.getDefaultPolygonStyle(),t.style),n=new SO({lnglat:e.getGeometry().getCoordinates(),dataWkID:Xp.EPSG3857,style:{stroke:{color:i.strokecolor,width:i.strokewidth,lineDash:i.strokelineDash},fill:{color:i.fillcolor}},attribute:t.attribute});break;case qp.Line:i=Object.assign({},Xm.getDefaulLineStyle(),t.style),n=new CO({lnglat:e.getGeometry().getCoordinates(),dataWkID:Xp.EPSG3857,style:{stroke:{color:i.strokecolor,width:i.strokewidth,lineDash:i.strokelineDash}},attribute:t.attribute});break;case qp.Point:i=Object.assign({},Xm.getDefaultPointStyle(),t.style),n=i.imageOption?new EO({lnglat:e.getGeometry().getCoordinates(),dataWkID:Xp.EPSG3857,style:{text:{font:i.Font,text:i.text,fill:{color:i.FontColor},stroke:{color:i.FontStrokeColor,width:i.FontStrokeWidth}},imageOption:i.imageOption,zIndex:999},attribute:Object.assign({},t.attribute,{movestate:!1,editallows:!1})}):new xO({lnglat:e.getGeometry().getCoordinates(),dataWkID:Xp.EPSG3857,style:{text:{font:i.Font,text:i.text,fill:{color:i.FontColor},stroke:{color:i.FontStrokeColor,width:i.FontStrokeWidth}},image:{scale:i.scale,radius:i.radius,fill:{color:i.fillcolor},stroke:{color:i.strokecolor,width:i.strokewidth}},zIndex:999},attribute:Object.assign({},t.attribute,{movestate:!1,editallows:!1})})}t.attribute.classname?this.addFeature(t.attribute.classname,n):this.addFeature("temp",n),t.success&&t.success(n),this.trigger(Rm.onDrawEnd,n)}appendTo(t){var e;this._map=t,this.layer&&(null==(e=this._map)||e.addLayer(this.layer),this.isAdded=!0),this.initSelect(),this._map.on("singleclick",(t=>{var e;if(this.option.hashSelect){this._modify.setActive(!1),this._graphicLayerSelect.setActive(!0);const r=null==(e=this._map)?void 0:e.forEachFeatureAtPixel(t.pixel,(function(t,e){return{feature:t,layer:e}}));r&&r.feature}}))}toGeoJSON(){return(new kf).writeFeaturesObject(this.layer.getSource().getFeatures(),{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}}class PO extends IO{constructor(t,e){super(t,e),new ji({fill:new Tn({color:"#eeeeee"})}),this.layertype="GraphicImageLayer",this.layer=new Xf({imageRatio:this.option.imageRatio,source:this._source,zIndex:this.option.zIndex}),this.layer.set("layerid",t),this.layer.on(this.EventType.featureType.onFeatureContextmenu,(t=>{this._setFeatureContextmenu(t.data.feature,t.data.contextmenu)})),this._on("onClickTolayer",(t=>{"function"==typeof t.isPopupBind&&t.isPopupBind()?t.openPopup():this.option.enabledPopup&&this.openPopup(t,this.option.popupInfo,this.option.popupOption)}))}}var TO=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const FO=function(t){function e(e){var r=this,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;void 0!==n.interpolate&&(i=n.interpolate);var o=void 0!==n.projection?n.projection:"EPSG:3857",s=void 0!==n.tileGrid?n.tileGrid:ff({extent:df(o),maxResolution:n.maxResolution,maxZoom:n.maxZoom,minZoom:n.minZoom,tileSize:n.tileSize});return(r=t.call(this,{attributions:n.attributions,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,interpolate:i,opaque:n.opaque,projection:o,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileGrid:s,tileLoadFunction:n.tileLoadFunction,tilePixelRatio:n.tilePixelRatio,tileUrlFunction:n.tileUrlFunction,url:n.url,urls:n.urls,wrapX:void 0===n.wrapX||n.wrapX,transition:n.transition,attributionsCollapsible:n.attributionsCollapsible,zDirection:n.zDirection})||this).gutter_=void 0!==n.gutter?n.gutter:0,r}return TO(e,t),e.prototype.getGutter=function(){return this.gutter_},e}(Qf);var MO=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const LO=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,wrapX:e.wrapX})||this;return r.resolution=void 0,r.distance=void 0!==e.distance?e.distance:20,r.minDistance=e.minDistance||0,r.interpolationRatio=0,r.features=[],r.geometryFunction=e.geometryFunction||function(t){var e=t.getGeometry();return K("Point"==e.getType(),10),e},r.createCustomCluster_=e.createCluster,r.source=null,r.boundRefresh_=r.refresh.bind(r),r.updateDistance(r.distance,r.minDistance),r.setSource(e.source||null),r}return MO(e,t),e.prototype.clear=function(e){this.features.length=0,t.prototype.clear.call(this,e)},e.prototype.getDistance=function(){return this.distance},e.prototype.getSource=function(){return this.source},e.prototype.loadFeatures=function(t,e,r){this.source.loadFeatures(t,e,r),e!==this.resolution&&(this.resolution=e,this.refresh())},e.prototype.setDistance=function(t){this.updateDistance(t,this.minDistance)},e.prototype.setMinDistance=function(t){this.updateDistance(this.distance,t)},e.prototype.getMinDistance=function(){return this.minDistance},e.prototype.setSource=function(t){this.source&&this.source.removeEventListener(P.CHANGE,this.boundRefresh_),this.source=t,t&&t.addEventListener(P.CHANGE,this.boundRefresh_),this.refresh()},e.prototype.refresh=function(){this.clear(),this.cluster(),this.addFeatures(this.features)},e.prototype.updateDistance=function(t,e){var r=0===t?0:Math.min(e,t)/t,n=t!==this.distance||this.interpolationRatio!==r;this.distance=t,this.minDistance=e,this.interpolationRatio=r,n&&this.refresh()},e.prototype.cluster=function(){if(void 0!==this.resolution&&this.source)for(var t=[1/0,1/0,-1/0,-1/0],e=this.distance*this.resolution,r=this.source.getFeatures(),n={},i=0,s=r.length;i<s;i++){var a=r[i];if(!(o(a)in n)){var l=this.geometryFunction(a);if(l){Ot(l.getCoordinates(),t),Ct(t,e,t);var u=this.source.getFeaturesInExtent(t).filter((function(t){var e=o(t);return!(e in n)&&(n[e]=!0,!0)}));this.features.push(this.createCluster(u,t))}}}},e.prototype.createCluster=function(t,e){for(var r=[0,0],n=t.length-1;n>=0;--n){var i=this.geometryFunction(t[n]);i?Re(r,i.getCoordinates()):t.splice(n,1)}Qe(r,1/t.length);var o=Vt(e),s=this.interpolationRatio,a=new nn([r[0]*(1-s)+o[0]*s,r[1]*(1-s)+o[1]*s]);return this.createCustomCluster_?this.createCustomCluster_(a,t):new X({geometry:a,features:t})},e}(Aa);var OO=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const NO=function(t){function e(e){var r=this,n=void 0===e.projection?"EPSG:3857":e.projection,i=e.tileGrid;if(void 0===i&&n&&(i=ff({extent:df(n),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize})),(r=t.call(this,{cacheSize:.1,attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:n,tileGrid:i,opaque:e.opaque,state:e.state,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate})||this).gutter_=void 0!==e.gutter?e.gutter:0,r.tileSize_=e.tileSize?Dn(e.tileSize):null,!r.tileSize_&&e.tilePixelRatio&&i){var o=Dn(i.getTileSize(0));r.tileSize_=[o[0]*e.tilePixelRatio,o[1]*e.tilePixelRatio]}return r.tileSizes_=null,r.tileLoadingKeys_={},r.loader_=e.loader,r.handleTileChange_=r.handleTileChange_.bind(r),r.bandCount=void 0===e.bandCount?4:e.bandCount,r}return OO(e,t),e.prototype.setTileSizes=function(t){this.tileSizes_=t},e.prototype.getTileSize=function(t){if(this.tileSizes_)return this.tileSizes_[t];if(this.tileSize_)return this.tileSize_;var e=this.getTileGrid();return e?Dn(e.getTileSize(t)):[256,256]},e.prototype.getGutterForProjection=function(t){return this.gutter_},e.prototype.setLoader=function(t){this.loader_=t},e.prototype.getTile=function(t,e,r,n,i){var o=this.getTileSize(t),s=jh(t,e,r);if(this.tileCache.containsKey(s))return this.tileCache.get(s);var a=this.loader_,l=b({tileCoord:[t,e,r],loader:function(){return n=function(){return a(t,e,r)},function(){var t;try{t=n()}catch(e){return Promise.reject(e)}return t instanceof Promise?t:Promise.resolve(t)}();var n},size:o},this.tileOptions),u=new tp(l);return u.key=this.getKey(),u.addEventListener(P.CHANGE,this.handleTileChange_),this.tileCache.set(s,u),u},e.prototype.handleTileChange_=function(t){var e,r=t.target,n=o(r),i=r.getState();i==da.LOADING?(this.tileLoadingKeys_[n]=!0,e=uf):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],e=i==da.ERROR?cf:i==da.LOADED?hf:void 0),e&&this.dispatchEvent(new mf(e,r))},e}(vf);function RO(t){return(e,...r)=>UO(t,e,r)}function kO(t,e){return RO(jO(t,e).get)}const{apply:UO,construct:DO,defineProperty:GO,get:QO,getOwnPropertyDescriptor:jO,getPrototypeOf:HO,has:zO,ownKeys:VO,set:KO,setPrototypeOf:qO}=Reflect,{iterator:WO,species:XO,toStringTag:YO,for:ZO}=Symbol,JO=Object,{create:$O,defineProperty:tN,freeze:eN,is:rN}=JO,nN=Array.prototype[WO],iN=RO(nN),oN=ArrayBuffer;kO(oN.prototype,"byteLength");const sN="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:null;sN&&kO(sN.prototype,"byteLength");const aN=HO(Uint8Array);aN.from;const lN=aN.prototype;lN[WO],RO(lN.keys),RO(lN.values),RO(lN.entries),RO(lN.set),RO(lN.reverse),RO(lN.fill),RO(lN.copyWithin),RO(lN.sort),RO(lN.slice),RO(lN.subarray),kO(lN,"buffer"),kO(lN,"byteOffset"),kO(lN,"length"),kO(lN,YO);const uN=Uint32Array,hN=Float32Array,cN=HO([][WO]()),AN=RO(cN.next),fN=RO(function*(){}().next),pN=HO(cN),dN=RO(DataView.prototype.getUint16),gN=WeakMap,yN=gN.prototype,mN=RO(yN.get),vN=RO(yN.set),_N=new gN,wN=$O(null,{next:{value:function(){const t=mN(_N,this);return AN(t)}},[WO]:{value:function(){return this}}}),bN=new gN,xN=$O(pN,{next:{value:function(){const t=mN(bN,this);return fN(t)},writable:!0,configurable:!0}});for(const ol of VO(cN))"next"!==ol&&tN(xN,ol,jO(cN,ol));const EN=new oN(4),CN=new hN(EN),SN=new uN(EN),BN=new uN(512),IN=new uN(512);for(let ol=0;ol<256;++ol){const t=ol-127;t<-27?(BN[ol]=0,BN[256|ol]=32768,IN[ol]=24,IN[256|ol]=24):t<-14?(BN[ol]=1024>>-t-14,BN[256|ol]=1024>>-t-14|32768,IN[ol]=-t-1,IN[256|ol]=-t-1):t<=15?(BN[ol]=t+15<<10,BN[256|ol]=t+15<<10|32768,IN[ol]=13,IN[256|ol]=13):t<128?(BN[ol]=31744,BN[256|ol]=64512,IN[ol]=24,IN[256|ol]=24):(BN[ol]=31744,BN[256|ol]=64512,IN[ol]=13,IN[256|ol]=13)}const PN=new uN(2048),TN=new uN(64),FN=new uN(64);for(let ol=1;ol<1024;++ol){let t=ol<<13,e=0;for(;0==(8388608&t);)t<<=1,e-=8388608;t&=-8388609,e+=947912704,PN[ol]=t|e}for(let ol=1024;ol<2048;++ol)PN[ol]=939524096+(ol-1024<<13);for(let ol=1;ol<31;++ol)TN[ol]=ol<<23;TN[31]=1199570944,TN[32]=2147483648;for(let ol=33;ol<63;++ol)TN[ol]=2147483648+(ol-32<<23);TN[63]=3347054592;for(let ol=1;ol<64;++ol)32!==ol&&(FN[ol]=1024);function MN(t,e,...r){return function(t){const e=t>>10;return SN[0]=PN[FN[e]+(1023&t)]+TN[e],CN[0]}(dN(t,e,...function(t){if(t[WO]===nN&&cN.next===AN)return t;const e=$O(wN);return vN(_N,e,iN(t)),e}(r)))}var LN={};function ON(t,e,r){r&&r.debug;const n="object"==typeof t?t.outer:t,i=new RegExp(`${e}\\="([^"]*)"`).exec(n);if(i)return i[1]}({get exports(){return LN},set exports(t){LN=t}}).exports=ON,LN.default=ON;var NN={},RN={get exports(){return NN},set exports(t){NN=t}},kN={},UN={get exports(){return kN},set exports(t){kN=t}},DN={};function GN(t,e,r){const n=new RegExp(e).exec(t.slice(r));return n?r+n.index:-1}({get exports(){return DN},set exports(t){DN=t}}).exports=GN,DN.default=GN;var QN={};function jN(t,e,r){const n=new RegExp(e).exec(t.slice(r));return n?r+n.index+n[0].length-1:-1}({get exports(){return QN},set exports(t){QN=t}}).exports=jN,QN.default=jN;var HN={};function zN(t,e){const r=new RegExp(e,"g"),n=t.match(r);return n?n.length:0}({get exports(){return HN},set exports(t){HN=t}}).exports=zN,HN.default=zN;const VN=DN,KN=QN,qN=HN;function WN(t,e,r){r&&r.debug;const n=!(r&&!1===typeof r.nested),i=r&&r.startIndex||0,o=VN(t,`<${e}[ >/]`,i);if(-1===o)return;const s=t.slice(o+e.length);let a=KN(s,"^[^<]*[ /]>",0);const l=-1!==a&&"/"===s[a-1];if(!1===l)if(n){let t=0,r=1,n=0;for(;-1!==(a=KN(s,"[ /]"+e+">",t));){const i=s.substring(t,a+1);if(r+=qN(i,"<"+e),n+=qN(i,"/"+e+">"),n>=r)break;t=a}}else a=KN(s,"[ /]"+e+">",0);const u=o+e.length+a+1;if(-1===u)return;const h=t.slice(o,u);let c;return c=l?null:h.slice(h.indexOf(">")+1,h.lastIndexOf("<")),{inner:c,outer:h,start:o,end:u}}UN.exports=WN,kN.default=WN;const XN=kN;function YN(t,e,r){const n=[],i=r&&r.debug||!1,o=!r||"boolean"!=typeof r.nested||r.nested;let s,a=r&&r.startIndex||0;for(;s=XN(t,e,{debug:i,startIndex:a});)a=o?s.start+1+e.length:s.end,n.push(s);return n}RN.exports=YN,NN.default=YN;const ZN={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},JN={};for(const ol in ZN)ZN.hasOwnProperty(ol)&&(JN[ZN[ol]]=parseInt(ol,10));const $N=[JN.BitsPerSample,JN.ExtraSamples,JN.SampleFormat,JN.StripByteCounts,JN.StripOffsets,JN.StripRowCounts,JN.TileByteCounts,JN.TileOffsets,JN.SubIFDs],tR={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},eR={};for(const ol in tR)tR.hasOwnProperty(ol)&&(eR[tR[ol]]=parseInt(ol,10));const rR={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"},nR=new Map;function iR(t,e){Array.isArray(t)||(t=[t]),t.forEach((t=>nR.set(t,e)))}async function oR(t){const e=nR.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);return new(await e())(t)}function sR(t,e,r,n=1){return new(Object.getPrototypeOf(t).constructor)(e*r*n)}function aR(t,e,r){return(1-r)*t+r*e}function lR(t,e,r){let n=0;for(let i=e;i<r;++i)n+=t[i];return n}function uR(t,e,r){switch(t){case 1:if(e<=8)return new Uint8Array(r);if(e<=16)return new Uint16Array(r);if(e<=32)return new Uint32Array(r);break;case 2:if(8===e)return new Int8Array(r);if(16===e)return new Int16Array(r);if(32===e)return new Int32Array(r);break;case 3:switch(e){case 16:case 32:return new Float32Array(r);case 64:return new Float64Array(r)}}throw Error("Unsupported data format/bitsPerSample")}iR([void 0,1],(()=>Promise.resolve().then((()=>Jft)).then((t=>t.default)))),iR(5,(()=>Promise.resolve().then((()=>rpt)).then((t=>t.default)))),iR(6,(()=>{throw new Error("old style JPEG compression is not supported.")})),iR(7,(()=>Promise.resolve().then((()=>gpt)).then((t=>t.default)))),iR([8,32946],(()=>Promise.resolve().then((()=>Eyt)).then((t=>t.default)))),iR(32773,(()=>Promise.resolve().then((()=>Cyt)).then((t=>t.default)))),iR(34887,(()=>Promise.resolve().then((()=>Byt)).then((t=>t.default)))),iR(50001,(()=>Promise.resolve().then((()=>Iyt)).then((t=>t.default))));const hR=class{constructor(t,e,r,n,i,o){this.fileDirectory=t,this.geoKeys=e,this.dataView=r,this.littleEndian=n,this.tiles=i?{}:null,this.isTiled=!t.StripOffsets;const s=t.PlanarConfiguration;if(this.planarConfiguration=void 0===s?1:s,1!==this.planarConfiguration&&2!==this.planarConfiguration)throw new Error("Invalid planar configuration.");this.source=o}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return void 0!==this.fileDirectory.SamplesPerPixel?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:void 0!==this.fileDirectory.RowsPerStrip?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(t){return this.isTiled||(t+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-t*this.getTileHeight()}getBytesPerPixel(){let t=0;for(let e=0;e<this.fileDirectory.BitsPerSample.length;++e)t+=this.getSampleByteSize(e);return t}getSampleByteSize(t){if(t>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${t} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[t]/8)}getReaderForSample(t){const e=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[t]:1,r=this.fileDirectory.BitsPerSample[t];switch(e){case 1:if(r<=8)return DataView.prototype.getUint8;if(r<=16)return DataView.prototype.getUint16;if(r<=32)return DataView.prototype.getUint32;break;case 2:if(r<=8)return DataView.prototype.getInt8;if(r<=16)return DataView.prototype.getInt16;if(r<=32)return DataView.prototype.getInt32;break;case 3:switch(r){case 16:return function(t,e){return MN(this,t,e)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(t=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[t]:1}getBitsPerSample(t=0){return this.fileDirectory.BitsPerSample[t]}getArrayForSample(t,e){return uR(this.getSampleFormat(t),this.getBitsPerSample(t),e)}async getTileOrStrip(t,e,r,n,i){const o=Math.ceil(this.getWidth()/this.getTileWidth()),s=Math.ceil(this.getHeight()/this.getTileHeight());let a;const{tiles:l}=this;let u,h;1===this.planarConfiguration?a=e*o+t:2===this.planarConfiguration&&(a=r*o*s+e*o+t),this.isTiled?(u=this.fileDirectory.TileOffsets[a],h=this.fileDirectory.TileByteCounts[a]):(u=this.fileDirectory.StripOffsets[a],h=this.fileDirectory.StripByteCounts[a]);const c=(await this.source.fetch([{offset:u,length:h}],i))[0];let A;return null!==l&&l[a]?A=l[a]:(A=(async()=>{let t=await n.decode(this.fileDirectory,c);const r=this.getSampleFormat(),i=this.getBitsPerSample();return function(t,e){return(1!==t&&2!==t||!(e<=32)||e%8!=0)&&(3!==t||16!==e&&32!==e&&64!==e)}(r,i)&&(t=function(t,e,r,n,i,o,s){const a=new DataView(t),l=2===r?1:n,u=uR(e,i,2===r?s*o:s*o*n),h=parseInt("1".repeat(i),2);if(1===e){let t;t=1===r?n*i:i;let e=o*t;0!=(7&e)&&(e=e+7&-8);for(let r=0;r<s;++r){const t=r*e;for(let e=0;e<o;++e){const n=t+e*l*i;for(let t=0;t<l;++t){const s=n+t*i,c=(r*o+e)*l+t,A=Math.floor(s/8),f=s%8;if(f+i<=8)u[c]=a.getUint8(A)>>8-i-f&h;else if(f+i<=16)u[c]=a.getUint16(A)>>16-i-f&h;else if(f+i<=24){const t=a.getUint16(A)<<8|a.getUint8(A+2);u[c]=t>>24-i-f&h}else u[c]=a.getUint32(A)>>32-i-f&h}}}}return u.buffer}(t,r,this.planarConfiguration,this.getSamplesPerPixel(),i,this.getTileWidth(),this.getBlockHeight(e))),t})(),null!==l&&(l[a]=A)),{x:t,y:e,sample:r,data:await A}}async _readRaster(t,e,r,n,i,o,s,a,l){const u=this.getTileWidth(),h=this.getTileHeight(),c=this.getWidth(),A=this.getHeight(),f=Math.max(Math.floor(t[0]/u),0),p=Math.min(Math.ceil(t[2]/u),Math.ceil(c/u)),d=Math.max(Math.floor(t[1]/h),0),g=Math.min(Math.ceil(t[3]/h),Math.ceil(A/h)),y=t[2]-t[0];let m=this.getBytesPerPixel();const v=[],_=[];for(let x=0;x<e.length;++x)1===this.planarConfiguration?v.push(lR(this.fileDirectory.BitsPerSample,0,e[x])/8):v.push(0),_.push(this.getReaderForSample(e[x]));const w=[],{littleEndian:b}=this;for(let x=d;x<g;++x)for(let o=f;o<p;++o)for(let s=0;s<e.length;++s){const a=s,f=e[s];2===this.planarConfiguration&&(m=this.getSampleByteSize(s));const p=this.getTileOrStrip(o,x,f,i,l);w.push(p),p.then((i=>{const o=i.data,s=new DataView(o),l=this.getBlockHeight(i.y),f=i.y*h,p=i.x*u,d=f+l,g=(i.x+1)*u,w=_[a],x=Math.min(l,l-(d-t[3]),A-f),E=Math.min(u,u-(g-t[2]),c-p);for(let h=Math.max(0,t[1]-f);h<x;++h)for(let i=Math.max(0,t[0]-p);i<E;++i){const o=(h*u+i)*m,l=w.call(s,o+v[a],b);let c;n?(c=(h+f-t[1])*y*e.length+(i+p-t[0])*e.length+a,r[c]=l):(c=(h+f-t[1])*y+i+p-t[0],r[a][c]=l)}}))}if(await Promise.all(w),o&&t[2]-t[0]!==o||s&&t[3]-t[1]!==s){let i;return i=n?function(t,e,r,n,i,o,s="nearest"){switch(s.toLowerCase()){case"nearest":return function(t,e,r,n,i,o){const s=e/n,a=r/i,l=sR(t,n,i,o);for(let u=0;u<i;++u){const i=Math.min(Math.round(a*u),r-1);for(let r=0;r<n;++r){const a=Math.min(Math.round(s*r),e-1);for(let s=0;s<o;++s){const h=t[i*e*o+a*o+s];l[u*n*o+r*o+s]=h}}}return l}(t,e,r,n,i,o);case"bilinear":case"linear":return function(t,e,r,n,i,o){const s=e/n,a=r/i,l=sR(t,n,i,o);for(let u=0;u<i;++u){const i=a*u,h=Math.floor(i),c=Math.min(Math.ceil(i),r-1);for(let r=0;r<n;++r){const a=s*r,A=a%1,f=Math.floor(a),p=Math.min(Math.ceil(a),e-1);for(let s=0;s<o;++s){const a=t[h*e*o+f*o+s],d=t[h*e*o+p*o+s],g=t[c*e*o+f*o+s],y=t[c*e*o+p*o+s],m=aR(aR(a,d,A),aR(g,y,A),i%1);l[u*n*o+r*o+s]=m}}}return l}(t,e,r,n,i,o);default:throw new Error(`Unsupported resampling method: '${s}'`)}}(r,t[2]-t[0],t[3]-t[1],o,s,e.length,a):function(t,e,r,n,i,o="nearest"){switch(o.toLowerCase()){case"nearest":return function(t,e,r,n,i){const o=e/n,s=r/i;return t.map((t=>{const a=sR(t,n,i);for(let l=0;l<i;++l){const i=Math.min(Math.round(s*l),r-1);for(let r=0;r<n;++r){const s=Math.min(Math.round(o*r),e-1),u=t[i*e+s];a[l*n+r]=u}}return a}))}(t,e,r,n,i);case"bilinear":case"linear":return function(t,e,r,n,i){const o=e/n,s=r/i;return t.map((t=>{const a=sR(t,n,i);for(let l=0;l<i;++l){const i=s*l,u=Math.floor(i),h=Math.min(Math.ceil(i),r-1);for(let r=0;r<n;++r){const s=o*r,c=s%1,A=Math.floor(s),f=Math.min(Math.ceil(s),e-1),p=t[u*e+A],d=t[u*e+f],g=t[h*e+A],y=t[h*e+f],m=aR(aR(p,d,c),aR(g,y,c),i%1);a[l*n+r]=m}}return a}))}(t,e,r,n,i);default:throw new Error(`Unsupported resampling method: '${o}'`)}}(r,t[2]-t[0],t[3]-t[1],o,s,a),i.width=o,i.height=s,i}return r.width=o||t[2]-t[0],r.height=s||t[3]-t[1],r}async readRasters({window:t,samples:e=[],interleave:r,pool:n=null,width:i,height:o,resampleMethod:s,fillValue:a,signal:l}={}){const u=t||[0,0,this.getWidth(),this.getHeight()];if(u[0]>u[2]||u[1]>u[3])throw new Error("Invalid subsets");const h=(u[2]-u[0])*(u[3]-u[1]),c=this.getSamplesPerPixel();if(e&&e.length){for(let p=0;p<e.length;++p)if(e[p]>=c)return Promise.reject(new RangeError(`Invalid sample index '${e[p]}'.`))}else for(let p=0;p<c;++p)e.push(p);let A;if(r)A=uR(this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,Math.max.apply(null,this.fileDirectory.BitsPerSample),h*e.length),a&&A.fill(a);else{A=[];for(let t=0;t<e.length;++t){const r=this.getArrayForSample(e[t],h);Array.isArray(a)&&t<a.length?r.fill(a[t]):a&&!Array.isArray(a)&&r.fill(a),A.push(r)}}const f=n||await oR(this.fileDirectory);return await this._readRaster(u,e,A,r,f,i,o,s,l)}async readRGB({window:t,interleave:e=!0,pool:r=null,width:n,height:i,resampleMethod:o,enableAlpha:s=!1,signal:a}={}){const l=t||[0,0,this.getWidth(),this.getHeight()];if(l[0]>l[2]||l[1]>l[3])throw new Error("Invalid subsets");const u=this.fileDirectory.PhotometricInterpretation;if(2===u){let l=[0,1,2];if(0!==this.fileDirectory.ExtraSamples&&s){l=[];for(let t=0;t<this.fileDirectory.BitsPerSample.length;t+=1)l.push(t)}return this.readRasters({window:t,interleave:e,samples:l,pool:r,width:n,height:i,resampleMethod:o,signal:a})}let h;switch(u){case 0:case 1:case 3:h=[0];break;case 5:h=[0,1,2,3];break;case 6:case 8:h=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const c={window:l,interleave:!0,samples:h,pool:r,width:n,height:i,resampleMethod:o,signal:a},{fileDirectory:A}=this,f=await this.readRasters(c),p=2**this.fileDirectory.BitsPerSample[0];let d;switch(u){case 0:d=function(t,e){const{width:r,height:n}=t,i=new Uint8Array(r*n*3);let o;for(let s=0,a=0;s<t.length;++s,a+=3)o=256-t[s]/e*256,i[a]=o,i[a+1]=o,i[a+2]=o;return i}(f,p);break;case 1:d=function(t,e){const{width:r,height:n}=t,i=new Uint8Array(r*n*3);let o;for(let s=0,a=0;s<t.length;++s,a+=3)o=t[s]/e*256,i[a]=o,i[a+1]=o,i[a+2]=o;return i}(f,p);break;case 3:d=function(t,e){const{width:r,height:n}=t,i=new Uint8Array(r*n*3),o=e.length/3,s=e.length/3*2;for(let a=0,l=0;a<t.length;++a,l+=3){const r=t[a];i[l]=e[r]/65536*256,i[l+1]=e[r+o]/65536*256,i[l+2]=e[r+s]/65536*256}return i}(f,A.ColorMap);break;case 5:d=function(t){const{width:e,height:r}=t,n=new Uint8Array(e*r*3);for(let i=0,o=0;i<t.length;i+=4,o+=3){const e=t[i],r=t[i+1],s=t[i+2],a=t[i+3];n[o]=(255-e)/256*255*((255-a)/256),n[o+1]=(255-r)/256*255*((255-a)/256),n[o+2]=(255-s)/256*255*((255-a)/256)}return n}(f);break;case 6:d=function(t){const{width:e,height:r}=t,n=new Uint8ClampedArray(e*r*3);for(let i=0,o=0;i<t.length;i+=3,o+=3){const e=t[i],r=t[i+1],s=t[i+2];n[o]=e+1.402*(s-128),n[o+1]=e-.34414*(r-128)-.71414*(s-128),n[o+2]=e+1.772*(r-128)}return n}(f);break;case 8:d=function(t){const{width:e,height:r}=t,n=new Uint8Array(e*r*3);for(let i=0,o=0;i<t.length;i+=3,o+=3){let e,r,s,a=(t[i+0]+16)/116,l=(t[i+1]<<24>>24)/500+a,u=a-(t[i+2]<<24>>24)/200;l=.95047*(l*l*l>.008856?l*l*l:(l-16/116)/7.787),a=1*(a*a*a>.008856?a*a*a:(a-16/116)/7.787),u=1.08883*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),e=3.2406*l+-1.5372*a+-.4986*u,r=-.9689*l+1.8758*a+.0415*u,s=.0557*l+-.204*a+1.057*u,e=e>.0031308?1.055*e**(1/2.4)-.055:12.92*e,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,n[o]=255*Math.max(0,Math.min(1,e)),n[o+1]=255*Math.max(0,Math.min(1,r)),n[o+2]=255*Math.max(0,Math.min(1,s))}return n}(f);break;default:throw new Error("Unsupported photometric interpretation.")}if(!e){const t=new Uint8Array(d.length/3),e=new Uint8Array(d.length/3),r=new Uint8Array(d.length/3);for(let n=0,i=0;n<d.length;n+=3,++i)t[i]=d[n],e[i]=d[n+1],r[i]=d[n+2];d=[t,e,r]}return d.width=f.width,d.height=f.height,d}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const t=[];for(let e=0;e<this.fileDirectory.ModelTiepoint.length;e+=6)t.push({i:this.fileDirectory.ModelTiepoint[e],j:this.fileDirectory.ModelTiepoint[e+1],k:this.fileDirectory.ModelTiepoint[e+2],x:this.fileDirectory.ModelTiepoint[e+3],y:this.fileDirectory.ModelTiepoint[e+4],z:this.fileDirectory.ModelTiepoint[e+5]});return t}getGDALMetadata(t=null){const e={};if(!this.fileDirectory.GDAL_METADATA)return null;const r=this.fileDirectory.GDAL_METADATA;let n=NN(r,"Item");n=null===t?n.filter((t=>void 0===LN(t,"sample"))):n.filter((e=>Number(LN(e,"sample"))===t));for(let i=0;i<n.length;++i){const t=n[i];e[LN(t,"name")]=t.inner}return e}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const t=this.fileDirectory.GDAL_NODATA;return Number(t.substring(0,t.length-1))}getOrigin(){const t=this.fileDirectory.ModelTiepoint,e=this.fileDirectory.ModelTransformation;if(t&&6===t.length)return[t[3],t[4],t[5]];if(e)return[e[3],e[7],e[11]];throw new Error("The image does not have an affine transformation.")}getResolution(t=null){const e=this.fileDirectory.ModelPixelScale,r=this.fileDirectory.ModelTransformation;if(e)return[e[0],-e[1],e[2]];if(r)return[r[0],r[5],r[10]];if(t){const[e,r,n]=t.getResolution();return[e*t.getWidth()/this.getWidth(),r*t.getHeight()/this.getHeight(),n*t.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return 1===this.geoKeys.GTRasterTypeGeoKey}getBoundingBox(){const t=this.getOrigin(),e=this.getResolution(),r=t[0],n=t[1],i=r+e[0]*this.getWidth(),o=n+e[1]*this.getHeight();return[Math.min(r,i),Math.min(n,o),Math.max(r,i),Math.max(n,o)]}};class cR{constructor(t){this._dataView=new DataView(t)}get buffer(){return this._dataView.buffer}getUint64(t,e){const r=this.getUint32(t,e),n=this.getUint32(t+4,e);let i;if(e){if(i=r+2**32*n,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}if(i=2**32*r+n,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}getInt64(t,e){let r=0;const n=(128&this._dataView.getUint8(t+(e?7:0)))>0;let i=!0;for(let o=0;o<8;o++){let s=this._dataView.getUint8(t+(e?o:7-o));n&&(i?0!==s&&(s=255&~(s-1),i=!1):s=255&~s),r+=s*256**o}return n&&(r=-r),r}getUint8(t,e){return this._dataView.getUint8(t,e)}getInt8(t,e){return this._dataView.getInt8(t,e)}getUint16(t,e){return this._dataView.getUint16(t,e)}getInt16(t,e){return this._dataView.getInt16(t,e)}getUint32(t,e){return this._dataView.getUint32(t,e)}getInt32(t,e){return this._dataView.getInt32(t,e)}getFloat16(t,e){return MN(this._dataView,t,e)}getFloat32(t,e){return this._dataView.getFloat32(t,e)}getFloat64(t,e){return this._dataView.getFloat64(t,e)}}class AR{constructor(t,e,r,n){this._dataView=new DataView(t),this._sliceOffset=e,this._littleEndian=r,this._bigTiff=n}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(t,e){return this.sliceOffset<=t&&this.sliceTop>=t+e}readUint8(t){return this._dataView.getUint8(t-this._sliceOffset,this._littleEndian)}readInt8(t){return this._dataView.getInt8(t-this._sliceOffset,this._littleEndian)}readUint16(t){return this._dataView.getUint16(t-this._sliceOffset,this._littleEndian)}readInt16(t){return this._dataView.getInt16(t-this._sliceOffset,this._littleEndian)}readUint32(t){return this._dataView.getUint32(t-this._sliceOffset,this._littleEndian)}readInt32(t){return this._dataView.getInt32(t-this._sliceOffset,this._littleEndian)}readFloat32(t){return this._dataView.getFloat32(t-this._sliceOffset,this._littleEndian)}readFloat64(t){return this._dataView.getFloat64(t-this._sliceOffset,this._littleEndian)}readUint64(t){const e=this.readUint32(t),r=this.readUint32(t+4);let n;if(this._littleEndian){if(n=e+2**32*r,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}if(n=2**32*e+r,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}readInt64(t){let e=0;const r=(128&this._dataView.getUint8(t+(this._littleEndian?7:0)))>0;let n=!0;for(let i=0;i<8;i++){let o=this._dataView.getUint8(t+(this._littleEndian?i:7-i));r&&(n?0!==o&&(o=255&~(o-1),n=!1):o=255&~o),e+=o*256**i}return r&&(e=-e),e}readOffset(t){return this._bigTiff?this.readUint64(t):this.readUint32(t)}}const fR="undefined"!=typeof navigator&&navigator.hardwareConcurrency||2,pR=class{constructor(t=fR,e){this.workers=null,this._awaitingDecoder=null,this.size=t,this.messageId=0,t&&(this._awaitingDecoder=e?Promise.resolve(e):new Promise((t=>{Promise.resolve().then((()=>Tyt)).then((e=>{t(e.create)}))})),this._awaitingDecoder.then((e=>{this._awaitingDecoder=null,this.workers=[];for(let r=0;r<t;r++)this.workers.push({worker:e(),idle:!0})})))}async decode(t,e){return this._awaitingDecoder&&await this._awaitingDecoder,0===this.size?oR(t).then((r=>r.decode(t,e))):new Promise((r=>{const n=this.workers.find((t=>t.idle))||this.workers[Math.floor(Math.random()*this.size)];n.idle=!1;const i=this.messageId++,o=t=>{t.data.id===i&&(n.idle=!0,r(t.data.decoded),n.worker.removeEventListener("message",o))};n.worker.addEventListener("message",o),n.worker.postMessage({fileDirectory:t,buffer:e,id:i},[e])}))}destroy(){this.workers&&(this.workers.forEach((t=>{t.worker.terminate()})),this.workers=null)}},dR="\r\n\r\n";function gR(t){if(void 0!==Object.fromEntries)return Object.fromEntries(t);const e={};for(const[r,n]of t)e[r.toLowerCase()]=n;return e}function yR(t){return gR(t.split("\r\n").map((t=>{const e=t.split(":").map((t=>t.trim()));return e[0]=e[0].toLowerCase(),e})))}function mR(t){let e,r,n;return t&&([,e,r,n]=t.match(/bytes (\d+)-(\d+)\/(\d+)/),e=parseInt(e,10),r=parseInt(r,10),n=parseInt(n,10)),{start:e,end:r,total:n}}class vR{async fetch(t,e=undefined){return Promise.all(t.map((t=>this.fetchSlice(t,e))))}async fetchSlice(t){throw new Error(`fetching of slice ${t} not possible, not implemented`)}get fileSize(){return null}async close(){}}var _R,wR,bR=xR;function xR(t){var e=this;if(e instanceof xR||(e=new xR),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var r=0,n=arguments.length;r<n;r++)e.push(arguments[r]);return e}function ER(t,e,r,n){if(!(this instanceof ER))return new ER(t,e,r,n);this.list=n,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}xR.Node=ER,xR.create=xR,xR.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,r=t.prev;return e&&(e.prev=r),r&&(r.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=r),t.list.length--,t.next=null,t.prev=null,t.list=null,e},xR.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}},xR.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}},xR.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)n=arguments[t],(r=this).tail=new ER(n,r.tail,null,r),r.head||(r.head=r.tail),r.length++;var r,n;return this.length},xR.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)n=arguments[t],(r=this).head=new ER(n,null,r.head,r),r.tail||(r.tail=r.head),r.length++;var r,n;return this.length},xR.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}},xR.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}},xR.prototype.forEach=function(t,e){e=e||this;for(var r=this.head,n=0;null!==r;n++)t.call(e,r.value,n,this),r=r.next},xR.prototype.forEachReverse=function(t,e){e=e||this;for(var r=this.tail,n=this.length-1;null!==r;n--)t.call(e,r.value,n,this),r=r.prev},xR.prototype.get=function(t){for(var e=0,r=this.head;null!==r&&e<t;e++)r=r.next;if(e===t&&null!==r)return r.value},xR.prototype.getReverse=function(t){for(var e=0,r=this.tail;null!==r&&e<t;e++)r=r.prev;if(e===t&&null!==r)return r.value},xR.prototype.map=function(t,e){e=e||this;for(var r=new xR,n=this.head;null!==n;)r.push(t.call(e,n.value,this)),n=n.next;return r},xR.prototype.mapReverse=function(t,e){e=e||this;for(var r=new xR,n=this.tail;null!==n;)r.push(t.call(e,n.value,this)),n=n.prev;return r},xR.prototype.reduce=function(t,e){var r,n=this.head;if(arguments.length>1)r=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,r=this.head.value}for(var i=0;null!==n;i++)r=t(r,n.value,i),n=n.next;return r},xR.prototype.reduceReverse=function(t,e){var r,n=this.tail;if(arguments.length>1)r=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,r=this.tail.value}for(var i=this.length-1;null!==n;i--)r=t(r,n.value,i),n=n.prev;return r},xR.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;null!==r;e++)t[e]=r.value,r=r.next;return t},xR.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;null!==r;e++)t[e]=r.value,r=r.prev;return t},xR.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new xR;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var n=0,i=this.head;null!==i&&n<t;n++)i=i.next;for(;null!==i&&n<e;n++,i=i.next)r.push(i.value);return r},xR.prototype.sliceReverse=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var r=new xR;if(e<t||e<0)return r;t<0&&(t=0),e>this.length&&(e=this.length);for(var n=this.length,i=this.tail;null!==i&&n>e;n--)i=i.prev;for(;null!==i&&n>t;n--,i=i.prev)r.push(i.value);return r},xR.prototype.splice=function(t,e,...r){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,i=this.head;null!==i&&n<t;n++)i=i.next;var o,s,a,l,u=[];for(n=0;i&&n<e;n++)u.push(i.value),i=this.removeNode(i);for(null===i&&(i=this.tail),i!==this.head&&i!==this.tail&&(i=i.prev),n=0;n<r.length;n++)o=this,s=i,a=r[n],void 0,null===(l=s===o.head?new ER(a,null,s,o):new ER(a,s,s.next,o)).next&&(o.tail=l),null===l.prev&&(o.head=l),o.length++,i=l;return u},xR.prototype.reverse=function(){for(var t=this.head,e=this.tail,r=t;null!==r;r=r.prev){var n=r.prev;r.prev=r.next,r.next=n}return this.head=e,this.tail=t,this};try{(wR?_R:(wR=1,_R=function(t){t.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}))(xR)}catch(fCt){}const CR=bR,SR=Symbol("max"),BR=Symbol("length"),IR=Symbol("lengthCalculator"),PR=Symbol("allowStale"),TR=Symbol("maxAge"),FR=Symbol("dispose"),MR=Symbol("noDisposeOnSet"),LR=Symbol("lruList"),OR=Symbol("cache"),NR=Symbol("updateAgeOnGet"),RR=()=>1,kR=(t,e,r)=>{const n=t[OR].get(e);if(n){const e=n.value;if(UR(t,e)){if(GR(t,n),!t[PR])return}else r&&(t[NR]&&(n.value.now=Date.now()),t[LR].unshiftNode(n));return e.value}},UR=(t,e)=>{if(!e||!e.maxAge&&!t[TR])return!1;const r=Date.now()-e.now;return e.maxAge?r>e.maxAge:t[TR]&&r>t[TR]},DR=t=>{if(t[BR]>t[SR])for(let e=t[LR].tail;t[BR]>t[SR]&&null!==e;){const r=e.prev;GR(t,e),e=r}},GR=(t,e)=>{if(e){const r=e.value;t[FR]&&t[FR](r.key,r.value),t[BR]-=r.length,t[OR].delete(r.key),t[LR].removeNode(e)}};class QR{constructor(t,e,r,n,i){this.key=t,this.value=e,this.length=r,this.now=n,this.maxAge=i||0}}const jR=(t,e,r,n)=>{let i=r.value;UR(t,i)&&(GR(t,r),t[PR]||(i=void 0)),i&&e.call(n,i.value,i.key,t)};function HR(t,e){const r=Array.isArray(t)?t:Array.from(t),n=Array.isArray(e)?e:Array.from(e);return r.map(((t,e)=>[t,n[e]]))}class zR extends Error{constructor(t){super(t),Error.captureStackTrace&&Error.captureStackTrace(this,zR),this.name="AbortError"}}class VR extends Error{constructor(t,e){super(e),this.errors=t,this.message=e,this.name="AggregateError"}}const KR=VR;class qR{constructor(t,e,r=null){this.offset=t,this.length=e,this.data=r}get top(){return this.offset+this.length}}class WR{constructor(t,e,r){this.offset=t,this.length=e,this.blockIds=r}}class XR extends vR{constructor(t,{blockSize:e=65536,cacheSize:r=100}={}){super(),this.source=t,this.blockSize=e,this.blockCache=new class{constructor(t){if("number"==typeof t&&(t={max:t}),t||(t={}),t.max&&("number"!=typeof t.max||t.max<0))throw new TypeError("max must be a non-negative number");this[SR]=t.max||1/0;const e=t.length||RR;if(this[IR]="function"!=typeof e?RR:e,this[PR]=t.stale||!1,t.maxAge&&"number"!=typeof t.maxAge)throw new TypeError("maxAge must be a number");this[TR]=t.maxAge||0,this[FR]=t.dispose,this[MR]=t.noDisposeOnSet||!1,this[NR]=t.updateAgeOnGet||!1,this.reset()}set max(t){if("number"!=typeof t||t<0)throw new TypeError("max must be a non-negative number");this[SR]=t||1/0,DR(this)}get max(){return this[SR]}set allowStale(t){this[PR]=!!t}get allowStale(){return this[PR]}set maxAge(t){if("number"!=typeof t)throw new TypeError("maxAge must be a non-negative number");this[TR]=t,DR(this)}get maxAge(){return this[TR]}set lengthCalculator(t){"function"!=typeof t&&(t=RR),t!==this[IR]&&(this[IR]=t,this[BR]=0,this[LR].forEach((t=>{t.length=this[IR](t.value,t.key),this[BR]+=t.length}))),DR(this)}get lengthCalculator(){return this[IR]}get length(){return this[BR]}get itemCount(){return this[LR].length}rforEach(t,e){e=e||this;for(let r=this[LR].tail;null!==r;){const n=r.prev;jR(this,t,r,e),r=n}}forEach(t,e){e=e||this;for(let r=this[LR].head;null!==r;){const n=r.next;jR(this,t,r,e),r=n}}keys(){return this[LR].toArray().map((t=>t.key))}values(){return this[LR].toArray().map((t=>t.value))}reset(){this[FR]&&this[LR]&&this[LR].length&&this[LR].forEach((t=>this[FR](t.key,t.value))),this[OR]=new Map,this[LR]=new CR,this[BR]=0}dump(){return this[LR].map((t=>!UR(this,t)&&{k:t.key,v:t.value,e:t.now+(t.maxAge||0)})).toArray().filter((t=>t))}dumpLru(){return this[LR]}set(t,e,r){if((r=r||this[TR])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,i=this[IR](e,t);if(this[OR].has(t)){if(i>this[SR])return GR(this,this[OR].get(t)),!1;const o=this[OR].get(t).value;return this[FR]&&(this[MR]||this[FR](t,o.value)),o.now=n,o.maxAge=r,o.value=e,this[BR]+=i-o.length,o.length=i,this.get(t),DR(this),!0}const o=new QR(t,e,i,n,r);return o.length>this[SR]?(this[FR]&&this[FR](t,e),!1):(this[BR]+=o.length,this[LR].unshift(o),this[OR].set(t,this[LR].head),DR(this),!0)}has(t){if(!this[OR].has(t))return!1;const e=this[OR].get(t).value;return!UR(this,e)}get(t){return kR(this,t,!0)}peek(t){return kR(this,t,!1)}pop(){const t=this[LR].tail;return t?(GR(this,t),t.value):null}del(t){GR(this,this[OR].get(t))}load(t){this.reset();const e=Date.now();for(let r=t.length-1;r>=0;r--){const n=t[r],i=n.e||0;if(0===i)this.set(n.k,n.v);else{const t=i-e;t>0&&this.set(n.k,n.v,t)}}}prune(){this[OR].forEach(((t,e)=>kR(this,e,!1)))}}({max:r}),this.blockRequests=new Map,this.blockIdsToFetch=new Set}get fileSize(){return this.source.fileSize}async fetch(t,e){const r=new Map,n=new Map,i=new Set;for(const{offset:l,length:u}of t){let t=l+u;const{fileSize:e}=this;null!==e&&(t=Math.min(t,e));for(let o=Math.floor(l/this.blockSize)*this.blockSize;o<t;o+=this.blockSize){const t=Math.floor(o/this.blockSize);this.blockCache.has(t)?r.set(t,this.blockCache.get(t)):this.blockRequests.has(t)?n.set(t,this.blockRequests.get(t)):(this.blockIdsToFetch.has(t)||this.blockIdsToFetch.add(t),i.add(t))}}await async function(t){return new Promise((t=>setTimeout(t,void 0)))}(),this.fetchBlocks(e);for(const l of i){const t=this.blockRequests.get(l),e=this.blockCache.get(l);if(t)n.set(l,t);else{if(!e)throw new Error(`Block ${l} is not in the block requests`);r.set(l,e)}}let o=await Promise.allSettled(Array.from(n.values()));if(o.some((t=>"rejected"===t.status))){const t=new Set;for(const[r,i]of HR(n.keys(),o)){const{rejected:n,reason:o}=i;n&&"AbortError"===o.name&&o.signal!==e&&(this.blockIdsToFetch.add(r),t.add(r))}if(this.blockIdsToFetch.length>0){this.fetchBlocks(e);for(const e of t){const t=this.blockRequests.get(e);if(!t)throw new Error(`Block ${e} is not in the block requests`);n.set(e,t)}o=await Promise.allSettled(Array.from(n.values()))}}if(o.some((t=>"rejected"===t.status))){if(e&&e.aborted)throw new zR("Request was aborted");throw new KR(o.filter((t=>"rejected"===t.status)).map((t=>t.reason)),"Request failed")}const s=o.map((t=>t.value)),a=new Map(HR(Array.from(n.keys()),s));for(const[l,u]of r)a.set(l,u);return this.readSliceData(t,a)}fetchBlocks(t){if(this.blockIdsToFetch.size>0){const e=this.groupBlocks(this.blockIdsToFetch),r=this.source.fetch(e,t);for(let n=0;n<e.length;++n){const i=e[n];for(const e of i.blockIds){const i=(async()=>{try{const t=(await r)[n],i=e*this.blockSize,o=i-t.offset,s=Math.min(o+this.blockSize,t.data.byteLength),a=t.data.slice(o,s),l=new qR(i,a.byteLength,a);return this.blockCache.set(e,l),l}catch(i){throw"AbortError"===i.name&&(i.signal=t),i}finally{this.blockRequests.delete(e)}})();this.blockRequests.set(e,i)}}this.blockIdsToFetch.clear()}}groupBlocks(t){const e=Array.from(t).sort(((t,e)=>t-e));if(0===e.length)return[];let r=[],n=null;const i=[];for(const o of e)null===n||n+1===o?(r.push(o),n=o):(i.push(new WR(r[0]*this.blockSize,r.length*this.blockSize,r)),r=[o],n=o);return i.push(new WR(r[0]*this.blockSize,r.length*this.blockSize,r)),i}readSliceData(t,e){return t.map((t=>{const r=t.offset+t.length,n=Math.floor(t.offset/this.blockSize),i=Math.floor((t.offset+t.length)/this.blockSize),o=new ArrayBuffer(t.length),s=new Uint8Array(o);for(let a=n;a<=i;++a){const n=e.get(a),i=n.offset-t.offset;let o,l=0,u=0;i<0?l=-i:i>0&&(u=i),o=n.top-r<0?n.length-l:r-n.offset-l;const h=new Uint8Array(n.data,l,o);s.set(h,u)}return o}))}}class YR{get ok(){return this.status>=200&&this.status<=299}get status(){throw new Error("not implemented")}getHeader(t){throw new Error("not implemented")}async getData(){throw new Error("not implemented")}}class ZR{constructor(t){this.url=t}async request({headers:t,credentials:e,signal:r}={}){throw new Error("request is not implemented")}}class JR extends YR{constructor(t){super(),this.response=t}get status(){return this.response.status}getHeader(t){return this.response.headers.get(t)}async getData(){return this.response.arrayBuffer?await this.response.arrayBuffer():(await this.response.buffer()).buffer}}class $R extends ZR{constructor(t,e){super(t),this.credentials=e}async request({headers:t,credentials:e,signal:r}={}){const n=await fetch(this.url,{headers:t,credentials:e,signal:r});return new JR(n)}}class tk extends YR{constructor(t,e){super(),this.xhr=t,this.data=e}get status(){return this.xhr.status}getHeader(t){return this.xhr.getResponseHeader(t)}async getData(){return this.data}}class ek extends ZR{constructRequest(t,e){return new Promise(((r,n)=>{const i=new XMLHttpRequest;i.open("GET",this.url),i.responseType="arraybuffer";for(const[e,o]of Object.entries(t))i.setRequestHeader(e,o);i.onload=()=>{const t=i.response;r(new tk(i,t))},i.onerror=n,i.onabort=()=>n(new zR("Request aborted")),i.send(),e&&(e.aborted&&i.abort(),e.addEventListener("abort",(()=>i.abort())))}))}async request({headers:t,signal:e}={}){return await this.constructRequest(t,e)}}const rk={},nk=Object.freeze(Object.defineProperty({__proto__:null,default:rk},Symbol.toStringTag,{value:"Module"}));class ik extends YR{constructor(t,e){super(),this.response=t,this.dataPromise=e}get status(){return this.response.statusCode}getHeader(t){return this.response.headers[t]}async getData(){return await this.dataPromise}}class ok extends ZR{constructor(t){super(t),this.parsedUrl=rk.parse(this.url),this.httpApi=(this.parsedUrl.protocol,rk)}constructRequest(t,e){return new Promise(((r,n)=>{const i=this.httpApi.get({...this.parsedUrl,headers:t},(t=>{const e=new Promise((e=>{const r=[];t.on("data",(t=>{r.push(t)})),t.on("end",(()=>{const t=Buffer.concat(r).buffer;e(t)})),t.on("error",n)}));r(new ik(t,e))}));i.on("error",n),e&&(e.aborted&&i.destroy(new zR("Request aborted")),e.addEventListener("abort",(()=>i.destroy(new zR("Request aborted")))))}))}async request({headers:t,signal:e}={}){return await this.constructRequest(t,e)}}class sk extends vR{constructor(t,e,r,n){super(),this.client=t,this.headers=e,this.maxRanges=r,this.allowFullFile=n,this._fileSize=null}async fetch(t,e){return this.maxRanges>=t.length?this.fetchSlices(t,e):(this.maxRanges>0&&t.length,Promise.all(t.map((t=>this.fetchSlice(t,e)))))}async fetchSlices(t,e){const r=await this.client.request({headers:{...this.headers,Range:`bytes=${t.map((({offset:t,length:e})=>`${t}-${t+e}`)).join(",")}`},signal:e});if(r.ok){if(206===r.status){const{type:n,params:i}=function(t){const[e,...r]=t.split(";").map((t=>t.trim()));return{type:e,params:gR(r.map((t=>t.split("="))))}}(r.getHeader("content-type"));if("multipart/byteranges"===n){const t=function(t,e){let r=null;const n=new TextDecoder("ascii"),i=[],o=`--${e}`,s=`${o}--`;for(let a=0;a<10;++a)n.decode(new Uint8Array(t,a,o.length))===o&&(r=a);if(null===r)throw new Error("Could not find initial boundary");for(;r<t.byteLength;){const e=n.decode(new Uint8Array(t,r,Math.min(o.length+1024,t.byteLength-r)));if(0===e.length||e.startsWith(s))break;if(!e.startsWith(o))throw new Error("Part does not start with boundary");const a=e.substr(o.length+2);if(0===a.length)break;const l=a.indexOf(dR),u=yR(a.substr(0,l)),{start:h,end:c,total:A}=mR(u["content-range"]),f=r+o.length+l+dR.length,p=parseInt(c,10)+1-parseInt(h,10);i.push({headers:u,data:t.slice(f,f+p),offset:h,length:p,fileSize:A}),r=f+p+4}return i}(await r.getData(),i.boundary);return this._fileSize=t[0].fileSize||null,t}const o=await r.getData(),{start:s,end:a,total:l}=mR(r.getHeader("content-range"));this._fileSize=l||null;const u=[{data:o,offset:s,length:a-s}];if(t.length>1){const r=await Promise.all(t.slice(1).map((t=>this.fetchSlice(t,e))));return u.concat(r)}return u}{if(!this.allowFullFile)throw new Error("Server responded with full file");const t=await r.getData();return this._fileSize=t.byteLength,[{data:t,offset:0,length:t.byteLength}]}}throw new Error("Error fetching data.")}async fetchSlice(t,e){const{offset:r,length:n}=t,i=await this.client.request({headers:{...this.headers,Range:`bytes=${r}-${r+n}`},signal:e});if(i.ok){if(206===i.status){const t=await i.getData(),{total:e}=mR(i.getHeader("content-range"));return this._fileSize=e||null,{data:t,offset:r,length:n}}{if(!this.allowFullFile)throw new Error("Server responded with full file");const t=await i.getData();return this._fileSize=t.byteLength,{data:t,offset:0,length:t.byteLength}}}throw new Error("Error fetching data.")}get fileSize(){return this._fileSize}}function ak(t,{blockSize:e,cacheSize:r}){return null===e?t:new XR(t,e,r)}function lk(t,{forceXHR:e=!1,...r}={}){return"function"!=typeof fetch||e?"undefined"!=typeof XMLHttpRequest?function(t,{headers:e={},maxRanges:r=0,allowFullFile:n=!1,...i}={}){const o=new ek(t);return ak(new sk(o,e,r,n),i)}(t,r):function(t,{headers:e={},maxRanges:r=0,allowFullFile:n=!1,...i}={}){const o=new ok(t);return ak(new sk(o,e,r,n),i)}(t,r):function(t,{headers:e={},credentials:r,maxRanges:n=0,allowFullFile:i=!1,...o}={}){const s=new $R(t,r);return ak(new sk(s,e,n,i),o)}(t,r)}class uk extends vR{constructor(t){super(),this.file=t}async fetchSlice(t,e){return new Promise(((r,n)=>{const i=this.file.slice(t.offset,t.offset+t.length),o=new FileReader;o.onload=t=>r(t.target.result),o.onerror=n,o.onabort=n,o.readAsArrayBuffer(i),e&&e.addEventListener("abort",(()=>o.abort()))}))}}function hk(t){switch(t){case eR.BYTE:case eR.ASCII:case eR.SBYTE:case eR.UNDEFINED:return 1;case eR.SHORT:case eR.SSHORT:return 2;case eR.LONG:case eR.SLONG:case eR.FLOAT:case eR.IFD:return 4;case eR.RATIONAL:case eR.SRATIONAL:case eR.DOUBLE:case eR.LONG8:case eR.SLONG8:case eR.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function ck(t,e,r,n){let i=null,o=null;const s=hk(e);switch(e){case eR.BYTE:case eR.ASCII:case eR.UNDEFINED:i=new Uint8Array(r),o=t.readUint8;break;case eR.SBYTE:i=new Int8Array(r),o=t.readInt8;break;case eR.SHORT:i=new Uint16Array(r),o=t.readUint16;break;case eR.SSHORT:i=new Int16Array(r),o=t.readInt16;break;case eR.LONG:case eR.IFD:i=new Uint32Array(r),o=t.readUint32;break;case eR.SLONG:i=new Int32Array(r),o=t.readInt32;break;case eR.LONG8:case eR.IFD8:i=new Array(r),o=t.readUint64;break;case eR.SLONG8:i=new Array(r),o=t.readInt64;break;case eR.RATIONAL:i=new Uint32Array(2*r),o=t.readUint32;break;case eR.SRATIONAL:i=new Int32Array(2*r),o=t.readInt32;break;case eR.FLOAT:i=new Float32Array(r),o=t.readFloat32;break;case eR.DOUBLE:i=new Float64Array(r),o=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e!==eR.RATIONAL&&e!==eR.SRATIONAL)for(let a=0;a<r;++a)i[a]=o.call(t,n+a*s);else for(let a=0;a<r;a+=2)i[a]=o.call(t,n+a*s),i[a+1]=o.call(t,n+(a*s+4));return e===eR.ASCII?new TextDecoder("utf-8").decode(i):i}class Ak{constructor(t,e,r){this.fileDirectory=t,this.geoKeyDirectory=e,this.nextIFDByteOffset=r}}class fk extends Error{constructor(t){super(`No image at index ${t}`),this.index=t}}class pk{async readRasters(t={}){const{window:e,width:r,height:n}=t;let{resX:i,resY:o,bbox:s}=t;const a=await this.getImage();let l=a;const u=await this.getImageCount(),h=a.getBoundingBox();if(e&&s)throw new Error('Both "bbox" and "window" passed.');if(r||n){if(e){const[t,r]=a.getOrigin(),[n,i]=a.getResolution();s=[t+e[0]*n,r+e[1]*i,t+e[2]*n,r+e[3]*i]}const t=s||h;if(r){if(i)throw new Error("Both width and resX passed");i=(t[2]-t[0])/r}if(n){if(o)throw new Error("Both width and resY passed");o=(t[3]-t[1])/n}}if(i||o){const t=[];for(let e=0;e<u;++e){const r=await this.getImage(e),{SubfileType:n,NewSubfileType:i}=r.fileDirectory;(0===e||2===n||1&i)&&t.push(r)}t.sort(((t,e)=>t.getWidth()-e.getWidth()));for(let e=0;e<t.length;++e){const r=t[e],n=(h[2]-h[0])/r.getWidth(),s=(h[3]-h[1])/r.getHeight();if(l=r,i&&i>n||o&&o>s)break}}let c=e;if(s){const[t,e]=a.getOrigin(),[r,n]=l.getResolution(a);c=[Math.round((s[0]-t)/r),Math.round((s[1]-e)/n),Math.round((s[2]-t)/r),Math.round((s[3]-e)/n)],c=[Math.min(c[0],c[2]),Math.min(c[1],c[3]),Math.max(c[0],c[2]),Math.max(c[1],c[3])]}return l.readRasters({...t,window:c})}}let dk=class t extends pk{constructor(t,e,r,n,i={}){super(),this.source=t,this.littleEndian=e,this.bigTiff=r,this.firstIFDOffset=n,this.cache=i.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(t,e){const r=this.bigTiff?4048:1024;return new AR((await this.source.fetch([{offset:t,length:void 0!==e?e:r}]))[0],t,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(t){const e=this.bigTiff?20:12,r=this.bigTiff?8:2;let n=await this.getSlice(t);const i=this.bigTiff?n.readUint64(t):n.readUint16(t),o=i*e+(this.bigTiff?16:6);n.covers(t,o)||(n=await this.getSlice(t,o));const s={};let a=t+(this.bigTiff?8:2);for(let h=0;h<i;a+=e,++h){const t=n.readUint16(a),e=n.readUint16(a+2),r=this.bigTiff?n.readUint64(a+4):n.readUint32(a+4);let i,o;const l=hk(e),u=a+(this.bigTiff?12:8);if(l*r<=(this.bigTiff?8:4))i=ck(n,e,r,u);else{const t=n.readOffset(u),o=hk(e)*r;i=n.covers(t,o)?ck(n,e,r,t):ck(await this.getSlice(t,o),e,r,t)}o=1===r&&-1===$N.indexOf(t)&&e!==eR.RATIONAL&&e!==eR.SRATIONAL?i[0]:i,s[ZN[t]]=o}const l=function(t){const e=t.GeoKeyDirectory;if(!e)return null;const r={};for(let n=4;n<=4*e[3];n+=4){const i=rR[e[n]],o=e[n+1]?ZN[e[n+1]]:null,s=e[n+2],a=e[n+3];let l=null;if(o){if(l=t[o],null==l)throw new Error(`Could not get value of geoKey '${i}'.`);"string"==typeof l?l=l.substring(a,a+s-1):l.subarray&&(l=l.subarray(a,a+s),1===s&&(l=l[0]))}else l=a;r[i]=l}return r}(s),u=n.readOffset(t+r+e*i);return new Ak(s,l,u)}async requestIFD(t){if(this.ifdRequests[t])return this.ifdRequests[t];if(0===t)return this.ifdRequests[t]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[t];if(!this.ifdRequests[t-1])try{this.ifdRequests[t-1]=this.requestIFD(t-1)}catch(dX){if(dX instanceof fk)throw new fk(t);throw dX}return this.ifdRequests[t]=(async()=>{const e=await this.ifdRequests[t-1];if(0===e.nextIFDByteOffset)throw new fk(t);return this.parseFileDirectoryAt(e.nextIFDByteOffset)})(),this.ifdRequests[t]}async getImage(t=0){const e=await this.requestIFD(t);return new hR(e.fileDirectory,e.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let t=0,e=!0;for(;e;)try{await this.requestIFD(t),++t}catch(dX){if(!(dX instanceof fk))throw dX;e=!1}return t}async getGhostValues(){const t=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const e="GDAL_STRUCTURAL_METADATA_SIZE=",r=e.length+100;let n=await this.getSlice(t,r);if(e===ck(n,eR.ASCII,e.length,t)){const e=ck(n,eR.ASCII,r,t).split("\n")[0],i=Number(e.split("=")[1].split(" ")[0])+e.length;i>r&&(n=await this.getSlice(t,i));const o=ck(n,eR.ASCII,i,t);this.ghostValues={},o.split("\n").filter((t=>t.length>0)).map((t=>t.split("="))).forEach((([t,e])=>{this.ghostValues[t]=e}))}return this.ghostValues}static async fromSource(e,r,n){const i=(await e.fetch([{offset:0,length:1024}],n))[0],o=new cR(i),s=o.getUint16(0,0);let a;if(18761===s)a=!0;else{if(19789!==s)throw new TypeError("Invalid byte order value.");a=!1}const l=o.getUint16(2,a);let u;if(42===l)u=!1;else{if(43!==l)throw new TypeError("Invalid magic number.");if(u=!0,8!==o.getUint16(4,a))throw new Error("Unsupported offset byte-size.")}const h=u?o.getUint64(8,a):o.getUint32(4,a);return new t(e,a,u,h,r)}close(){return"function"==typeof this.source.close&&this.source.close()}};class gk extends pk{constructor(t,e){super(),this.mainFile=t,this.overviewFiles=e,this.imageFiles=[t].concat(e),this.fileDirectoriesPerFile=null,this.fileDirectoriesPerFileParsing=null,this.imageCount=null}async parseFileDirectoriesPerFile(){const t=[this.mainFile.parseFileDirectoryAt(this.mainFile.firstIFDOffset)].concat(this.overviewFiles.map((t=>t.parseFileDirectoryAt(t.firstIFDOffset))));return this.fileDirectoriesPerFile=await Promise.all(t),this.fileDirectoriesPerFile}async getImage(t=0){await this.getImageCount(),await this.parseFileDirectoriesPerFile();let e=0,r=0;for(let n=0;n<this.imageFiles.length;n++){const i=this.imageFiles[n];for(let o=0;o<this.imageCounts[n];o++){if(t===e){const t=await i.requestIFD(r);return new hR(t.fileDirectory,t.geoKeyDirectory,i.dataView,i.littleEndian,i.cache,i.source)}e++,r++}r=0}throw new RangeError("Invalid image index")}async getImageCount(){if(null!==this.imageCount)return this.imageCount;const t=[this.mainFile.getImageCount()].concat(this.overviewFiles.map((t=>t.getImageCount())));return this.imageCounts=await Promise.all(t),this.imageCount=this.imageCounts.reduce(((t,e)=>t+e),0),this.imageCount}}var yk,mk=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),vk="STATISTICS_MAXIMUM",_k="STATISTICS_MINIMUM";function wk(t){try{return t.getBoundingBox()}catch(r){var e=t.fileDirectory;return[0,0,e.ImageWidth,e.ImageLength]}}function bk(t){try{return t.getOrigin().slice(0,2)}catch(e){return[0,t.fileDirectory.ImageLength]}}function xk(t,e){try{return t.getResolution(e)}catch(r){return[e.fileDirectory.ImageWidth/t.fileDirectory.ImageWidth,e.fileDirectory.ImageHeight/t.fileDirectory.ImageHeight]}}function Ek(t){var e,r,n,i=t.geoKeys;return i?i.ProjectedCSTypeGeoKey?((r=nr(e="EPSG:"+i.ProjectedCSTypeGeoKey))||(n=$(i.ProjLinearUnitsGeoKey))&&(r=new se({code:e,units:n})),r):i.GeographicTypeGeoKey?((r=nr(e="EPSG:"+i.GeographicTypeGeoKey))||(n=$(i.GeogAngularUnitsGeoKey))&&(r=new se({code:e,units:n})),r):null:null}function Ck(t){return t.getImageCount().then((function(e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t.getImage(n);return Promise.all(r)}))}function Sk(t,e){var r;return r=t.blob?async function(t,e){return dk.fromSource(new uk(t),void 0)}(t.blob):t.overviews?async function(t,e=[],r={},n){const i=await dk.fromSource(lk(t,r),n),o=await Promise.all(e.map((t=>dk.fromSource(lk(t,r)))));return new gk(i,o)}(t.url,t.overviews,e):async function(t,e={},r){return dk.fromSource(lk(t,e),r)}(t.url,e),r.then(Ck)}function Bk(t,e,r,n,i){if(Array.isArray(t)){var o=t.length;if(!Array.isArray(e)||o!=e.length){var s=new Error(n);throw i(s),s}for(var a=0;a<o;++a)Bk(t[a],e[a],r,n,i)}else if(Math.abs(t-e)>r*t)throw new Error(n)}function Ik(t){return t instanceof Int8Array?127:t instanceof Uint8Array||t instanceof Uint8ClampedArray?255:t instanceof Int16Array?32767:t instanceof Uint16Array?65535:t instanceof Int32Array?2147483647:t instanceof Uint32Array?4294967295:t instanceof Float32Array?34e37:255}var Pk=function(t){function e(e){var r=t.call(this,{state:"loading",tileGrid:null,projection:null,opaque:e.opaque,transition:e.transition,interpolate:!1!==e.interpolate,wrapX:e.wrapX})||this;r.sourceInfo_=e.sources;var n=r.sourceInfo_.length;r.sourceOptions_=e.sourceOptions,r.sourceImagery_=new Array(n),r.resolutionFactors_=new Array(n),r.samplesPerPixel_,r.nodataValues_,r.metadata_,r.normalize_=!1!==e.normalize,r.addAlpha_=!1,r.error_=null,r.readMethod_=e.convertToRGB?"readRGB":"readRasters",r.setKey(r.sourceInfo_.map((function(t){return t.url})).join(","));for(var i=r,o=new Array(n),s=0;s<n;++s)o[s]=Sk(r.sourceInfo_[s],r.sourceOptions_);return Promise.all(o).then((function(t){i.configure_(t)})).catch((function(t){i.error_=t,i.setState("error")})),r}return mk(e,t),e.prototype.getError=function(){return this.error_},e.prototype.configure_=function(t){for(var e,r,n,i,o,s=new Array(t.length),a=new Array(t.length),l=new Array(t.length),u=0,h=t.length,c=function(h){var c=t[h],f=c.length,p=void 0,d=void 0,g=new Array(f),y=new Array(f),m=new Array(f);a[h]=new Array(f),l[h]=new Array(f);for(var v=0;v<f;++v){var _=c[v],w=_.getGDALNoData();l[h][v]=_.getGDALMetadata(0),a[h][v]=w;var b=A.sourceInfo_[h].bands;s[h]=b?b.length:_.getSamplesPerPixel();var x=f-(v+1);p||(p=wk(_)),d||(d=bk(_));var E=xk(_,c[0]);m[x]=E[0];var C=[_.getTileWidth(),_.getTileHeight()];g[x]=C;var S=E[0]/Math.abs(E[1]);y[x]=[C[0],C[1]/S]}if(e?Yt(e,p,e):e=p,r){var B="Origin mismatch for source ".concat(h,", got [").concat(d,"] but expected [").concat(r,"]");Bk(r,d,0,B,A.viewRejector)}else r=d;if(o){o.length-u>m.length&&(u=o.length-m.length);var I=o[o.length-1]/m[m.length-1];A.resolutionFactors_[h]=I;var P=m.map((function(t){return t*I}));B="Resolution mismatch for source ".concat(h,", got [").concat(P,"] but expected [").concat(o,"]"),Bk(o.slice(u,o.length),P,.02,B,A.viewRejector)}else o=m,A.resolutionFactors_[h]=1;n?Bk(n.slice(u,n.length),y,.01,"Tile size mismatch for source ".concat(h),A.viewRejector):n=y,i?Bk(i.slice(u,i.length),g,0,"Tile size mismatch for source ".concat(h),A.viewRejector):i=g,A.sourceImagery_[h]=c.reverse()},A=this,f=0;f<h;++f)c(f);for(var p=0,d=this.sourceImagery_.length;p<d;++p)for(var g=this.sourceImagery_[p];g.length<o.length;)g.unshift(void 0);if(!this.getProjection()){var y=t[0];for(p=y.length-1;p>=0;--p){var m=Ek(y[p]);if(m){this.projection=m;break}}}this.samplesPerPixel_=s,this.nodataValues_=a,this.metadata_=l;t:for(f=0;f<h;++f){if(void 0!==this.sourceInfo_[f].nodata){this.addAlpha_=!0;break}var v=a[f],_=this.sourceInfo_[f].bands;if(_){for(p=0;p<_.length;++p)if(null!==v[_[p]-1]){this.addAlpha_=!0;break t}}else for(var w=0;w<v.length;++w)if(null!==v[w]){this.addAlpha_=!0;break t}}var b=this.addAlpha_?1:0;this.bandCount=s.reduce((function(t,e){return t+e}),0)+b;var x=new lf({extent:e,minZoom:u,origin:r,resolutions:o,tileSizes:n});this.tileGrid=x,this.setTileSizes(i),this.setLoader(this.loadTile_.bind(this)),this.setState("ready"),this.viewResolver({projection:this.projection,resolutions:o,center:wr(Vt(e),this.projection),extent:xr(e,this.projection),zoom:0})},e.prototype.loadTile_=function(t,e,r){for(var n=this.getTileSize(t),i=this.sourceImagery_.length,o=new Array(i),s=this.addAlpha_,a=this.bandCount,l=this.samplesPerPixel_,u=this.nodataValues_,h=this.sourceInfo_,c=function(i){var s,a=h[i],l=A.resolutionFactors_[i],c=[Math.round(e*(n[0]*l)),Math.round(r*(n[1]*l)),Math.round((e+1)*(n[0]*l)),Math.round((r+1)*(n[1]*l))],f=A.sourceImagery_[i][t],p=void 0;a.bands&&(p=a.bands.map((function(t){return t-1}))),s="nodata"in a&&null!==a.nodata?a.nodata:p?p.map((function(t){return u[i][t]})):u[i],o[i]=f[A.readMethod_]({window:c,width:n[0],height:n[1],samples:p,fillValue:s,pool:(yk||(yk=new pR),yk),interleave:!1})},A=this,f=0;f<i;++f)c(f);var p=n[0]*n[1],d=p*a,g=this.normalize_,y=this.metadata_;return Promise.all(o).then((function(t){var e;e=g?new Uint8Array(d):new Float32Array(d);for(var r,n=0,o=0;o<p;++o){for(var a=s,c=0;c<i;++c){var A=h[c],f=A.min,m=A.max,v=void 0,_=void 0;if(g){var w=y[c][0];void 0===f&&(f=w&&_k in w?parseFloat(w[_k]):(r=t[c][0])instanceof Int8Array?-128:r instanceof Int16Array?-32768:r instanceof Int32Array?-2147483648:r instanceof Float32Array?12e-39:0),void 0===m&&(m=w&&vk in w?parseFloat(w[vk]):Ik(t[c][0])),_=-f*(v=255/(m-f))}for(var b=0;b<l[c];++b){var x,E=t[c][b][o];if(x=g?ae(v*E+_,0,255):E,s){var C,S=A.nodata;if(void 0===S)C=A.bands?A.bands[b]-1:b,S=u[c][C];var B=isNaN(S);(!B&&E!==S||B&&!isNaN(E))&&(a=!1,e[n]=x)}else e[n]=x;n++}}s&&(a||(e[n]=255),n++)}return e})).catch((function(t){throw t}))},e}(NO);Pk.prototype.getView;const Tk=Pk;var Fk=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const Mk=function(t){function e(e,r,n,i,o,s,a){var l=this,u=e.getExtent(),h=r.getExtent(),c=h?Yt(n,h):n,A=HA(e,r,Vt(c),i),f=new UA(e,r,c,u,A*jc,i),p=s(f.calculateSourceExtent(),A,o),d=p?kn.IDLE:kn.EMPTY,g=p?p.getPixelRatio():1;return(l=t.call(this,n,i,g,d)||this).targetProj_=r,l.maxSourceExtent_=u,l.triangulation_=f,l.targetResolution_=i,l.targetExtent_=n,l.sourceImage_=p,l.sourcePixelRatio_=g,l.interpolate_=a,l.canvas_=null,l.sourceListenerKey_=null,l}return Fk(e,t),e.prototype.disposeInternal=function(){this.state==kn.LOADING&&this.unlistenSource_(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.canvas_},e.prototype.getProjection=function(){return this.targetProj_},e.prototype.reproject_=function(){var t=this.sourceImage_.getState();if(t==kn.LOADED){var e=$t(this.targetExtent_)/this.targetResolution_,r=Xt(this.targetExtent_)/this.targetResolution_;this.canvas_=zA(e,r,this.sourcePixelRatio_,this.sourceImage_.getResolution(),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_)}this.state=t,this.changed()},e.prototype.load=function(){if(this.state==kn.IDLE){this.state=kn.LOADING,this.changed();var t=this.sourceImage_.getState();t==kn.LOADED||t==kn.ERROR?this.reproject_():(this.sourceListenerKey_=T(this.sourceImage_,P.CHANGE,(function(t){var e=this.sourceImage_.getState();e!=kn.LOADED&&e!=kn.ERROR||(this.unlistenSource_(),this.reproject_())}),this),this.sourceImage_.load())}},e.prototype.unlistenSource_=function(){M(this.sourceListenerKey_),this.sourceListenerKey_=null},e}(Ss);var Lk=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ok=function(t){function e(e,r){var n=t.call(this,e)||this;return n.image=r,n}return Lk(e,t),e}(h);function Nk(t,e){t.getImage().src=e}const Rk=function(t){function e(e){var r=this,n=void 0===e.imageSmoothing||e.imageSmoothing;return void 0!==e.interpolate&&(n=e.interpolate),(r=t.call(this,{attributions:e.attributions,projection:e.projection,state:e.state,interpolate:n})||this).on,r.once,r.un,r.resolutions_=void 0!==e.resolutions?e.resolutions:null,r.reprojectedImage_=null,r.reprojectedRevision_=0,r}return Lk(e,t),e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.findNearestResolution=function(t){if(this.resolutions_){var e=d(this.resolutions_,t,0);t=this.resolutions_[e]}return t},e.prototype.getImage=function(t,e,r,n){var i=this.getProjection();if(i&&n&&!cr(i,n)){if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&cr(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&Rt(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Mk(i,n,t,e,r,function(t,e,r){return this.getImageInternal(t,e,r,i)}.bind(this),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}return i&&(n=i),this.getImageInternal(t,e,r,n)},e.prototype.getImageInternal=function(t,e,r,i){return n()},e.prototype.handleImageChange=function(t){var e,r=t.target;switch(r.getState()){case kn.LOADING:this.loading=!0,e="imageloadstart";break;case kn.LOADED:this.loading=!1,e="imageloadend";break;case kn.ERROR:this.loading=!1,e="imageloaderror";break;default:return}this.hasListener(e)&&this.dispatchEvent(new Ok(e,r))},e}(ra);function kk(t,e){var r=[];Object.keys(e).forEach((function(t){null!==e[t]&&void 0!==e[t]&&r.push(t+"="+encodeURIComponent(e[t]))}));var n=r.join("&");return(t=-1===(t=t.replace(/[?&]$/,"")).indexOf("?")?t+"?":t+"&")+n}var Uk=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const Dk=function(t){function e(e){var r=this,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;return void 0!==n.interpolate&&(i=n.interpolate),(r=t.call(this,{attributions:n.attributions,interpolate:i,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.hidpi_=void 0===n.hidpi||n.hidpi,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:Nk,r.params_=n.params||{},r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return Uk(e,t),e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),r=this.hidpi_?r:1;var i=this.image_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&Pt(i.getExtent(),t))return i;var o={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};b(o,this.params_);var s=((t=t.slice())[0]+t[2])/2,a=(t[1]+t[3])/2;if(1!=this.ratio_){var l=this.ratio_*$t(t)/2,u=this.ratio_*Xt(t)/2;t[0]=s-l,t[1]=a-u,t[2]=s+l,t[3]=a+u}var h=e/r,c=Math.ceil($t(t)/h),A=Math.ceil(Xt(t)/h);t[0]=s-h*c/2,t[2]=s+h*c/2,t[1]=a-h*A/2,t[3]=a+h*A/2,this.imageSize_[0]=c,this.imageSize_[1]=A;var f=this.getRequestUrl_(t,this.imageSize_,r,n,o);return this.image_=new Is(t,e,r,f,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(P.CHANGE,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){var o=n.getCode().split(/:(?=\d+$)/).pop();i.SIZE=e[0]+","+e[1],i.BBOX=t.join(","),i.BBOXSR=o,i.IMAGESR=o,i.DPI=Math.round(90*r);var s=this.url_,a=s.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");return a==s&&K(!1,50),kk(a,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){b(this.params_,t),this.image_=null,this.changed()},e}(Rk);var Gk=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const Qk=function(t){function e(e){var r=this,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;return void 0!==n.interpolate&&(i=n.interpolate),(r=t.call(this,{attributions:n.attributions,interpolate:i,projection:n.projection,resolutions:n.resolutions,state:n.state})||this).canvasFunction_=n.canvasFunction,r.canvas_=null,r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return Gk(e,t),e.prototype.getImageInternal=function(t,e,r,n){e=this.findNearestResolution(e);var i=this.canvas_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&Pt(i.getExtent(),t))return i;re(t=t.slice(),this.ratio_);var o=[$t(t)/e*r,Xt(t)/e*r],s=this.canvasFunction_.call(this,t,e,r,o,n);return s&&(i=new pa(t,e,r,s)),this.canvas_=i,this.renderedRevision_=this.getRevision(),i},e}(Rk);var jk=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const Hk=function(t){function e(e){var r=this,n=void 0!==e.crossOrigin?e.crossOrigin:null,i=void 0!==e.imageLoadFunction?e.imageLoadFunction:Nk,o=void 0===e.imageSmoothing||e.imageSmoothing;return void 0!==e.interpolate&&(o=e.interpolate),(r=t.call(this,{attributions:e.attributions,interpolate:o,projection:nr(e.projection)})||this).url_=e.url,r.imageExtent_=e.imageExtent,r.image_=new Is(r.imageExtent_,void 0,1,r.url_,n,i),r.imageSize_=e.imageSize?e.imageSize:null,r.image_.addEventListener(P.CHANGE,r.handleImageChange.bind(r)),r}return jk(e,t),e.prototype.getImageExtent=function(){return this.imageExtent_},e.prototype.getImageInternal=function(t,e,r,n){return te(t,this.image_.getExtent())?this.image_:null},e.prototype.getUrl=function(){return this.url_},e.prototype.handleImageChange=function(e){if(this.image_.getState()==kn.LOADED){var r=this.image_.getExtent(),n=this.image_.getImage(),i=void 0,o=void 0;this.imageSize_?(i=this.imageSize_[0],o=this.imageSize_[1]):(i=n.width,o=n.height);var s=$t(r),a=Xt(r),l=s/i,u=a/o,h=i,c=o;if(l>u?h=Math.round(s/u):c=Math.round(a/l),h!==i||c!==o){var A=Jn(h,c);this.getInterpolate()||b(A,Hc);var f=A.canvas;A.drawImage(n,0,0,i,o,0,0,f.width,f.height),this.image_.setImage(f)}}t.prototype.handleImageChange.call(this,e)},e}(Rk);var zk="1.3.0",Vk=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Kk=[101,101];const qk=function(t){function e(e){var r=this,n=e||{},i=void 0===n.imageSmoothing||n.imageSmoothing;return void 0!==n.interpolate&&(i=n.interpolate),(r=t.call(this,{attributions:n.attributions,interpolate:i,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:Nk,r.params_=n.params||{},r.v13_=!0,r.updateV13_(),r.serverType_=n.serverType,r.hidpi_=void 0===n.hidpi||n.hidpi,r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return Vk(e,t),e.prototype.getFeatureInfoUrl=function(t,e,r,n){if(void 0!==this.url_){var i=nr(r),o=this.getProjection();o&&o!==i&&(e=HA(o,i,t,e),t=pr(t,i,o));var s=qt(t,e,0,Kk),a={SERVICE:"WMS",VERSION:zk,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};b(a,this.params_,n);var l=ye((t[0]-s[0])/e,4),u=ye((s[3]-t[1])/e,4);return a[this.v13_?"I":"X"]=l,a[this.v13_?"J":"Y"]=u,this.getRequestUrl_(s,Kk,1,o||i,a)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.url_){var r={SERVICE:"WMS",VERSION:zk,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var n=this.params_.LAYERS;if(Array.isArray(n)&&1!==n.length)return;r.LAYER=n}if(void 0!==t){var i=this.getProjection()?this.getProjection().getMetersPerUnit():1;r.SCALE=t*i/28e-5}return b(r,e),kk(this.url_,r)}},e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),1==r||this.hidpi_&&void 0!==this.serverType_||(r=1);var i=e/r,o=Vt(t),s=qt(o,i,0,[me($t(t)/i,4),me(Xt(t)/i,4)]),a=qt(o,i,0,[me(this.ratio_*$t(t)/i,4),me(this.ratio_*Xt(t)/i,4)]),l=this.image_;if(l&&this.renderedRevision_==this.getRevision()&&l.getResolution()==e&&l.getPixelRatio()==r&&Pt(l.getExtent(),s))return l;var u={SERVICE:"WMS",VERSION:zk,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};b(u,this.params_),this.imageSize_[0]=ge($t(a)/i,4),this.imageSize_[1]=ge(Xt(a)/i,4);var h=this.getRequestUrl_(a,this.imageSize_,r,n,u);return this.image_=new Is(a,e,r,h,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(P.CHANGE,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){if(K(void 0!==this.url_,9),i[this.v13_?"CRS":"SRS"]=n.getCode(),"STYLES"in this.params_||(i.STYLES=""),1!=r)switch(this.serverType_){case"geoserver":var o=90*r+.5|0;"FORMAT_OPTIONS"in i?i.FORMAT_OPTIONS+=";dpi:"+o:i.FORMAT_OPTIONS="dpi:"+o;break;case"mapserver":i.MAP_RESOLUTION=90*r;break;case"carmentaserver":case"qgis":i.DPI=90*r;break;default:K(!1,8)}i.WIDTH=e[0],i.HEIGHT=e[1];var s,a=n.getAxisOrientation();return s=this.v13_&&"ne"==a.substr(0,2)?[t[1],t[0],t[3],t[2]]:t,i.BBOX=s.join(","),kk(this.url_,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){b(this.params_,t),this.updateV13_(),this.image_=null,this.changed()},e.prototype.updateV13_=function(){var t=this.params_.VERSION||zk;this.v13_=function(t,e){for(var r=(""+t).split("."),n="1.3".split("."),i=0;i<Math.max(r.length,n.length);i++){var o=parseInt(r[i]||"0",10),s=parseInt(n[i]||"0",10);if(o>s)return 1;if(s>o)return-1}return 0}(t)>=0},e}(Rk);var Wk=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const Xk=function(t){function e(e){var r=t.call(this,{extent:e.extent,origin:e.origin,origins:e.origins,resolutions:e.resolutions,tileSize:e.tileSize,tileSizes:e.tileSizes,sizes:e.sizes})||this;return r.matrixIds_=e.matrixIds,r}return Wk(e,t),e.prototype.getMatrixId=function(t){return this.matrixIds_[t]},e.prototype.getMatrixIds=function(){return this.matrixIds_},e}(lf);var Yk=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Zk=function(t){function e(e){var r=this,n=void 0===e.imageSmoothing||e.imageSmoothing;void 0!==e.interpolate&&(n=e.interpolate);var i=void 0!==e.requestEncoding?e.requestEncoding:"KVP",o=e.tileGrid,s=e.urls;return void 0===s&&void 0!==e.url&&(s=bf(e.url)),(r=t.call(this,{attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:n,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileClass:e.tileClass,tileGrid:o,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,urls:s,wrapX:void 0!==e.wrapX&&e.wrapX,transition:e.transition,zDirection:e.zDirection})||this).version_=void 0!==e.version?e.version:"1.0.0",r.format_=void 0!==e.format?e.format:"image/jpeg",r.dimensions_=void 0!==e.dimensions?e.dimensions:{},r.layer_=e.layer,r.matrixSet_=e.matrixSet,r.style_=e.style,r.requestEncoding_=i,r.setKey(r.getKeyForDimensions_()),s&&s.length>0&&(r.tileUrlFunction=wf(s.map(r.createFromWMTSTemplate.bind(r)))),r}return Yk(e,t),e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.setTileUrlFunction(wf(t.map(this.createFromWMTSTemplate.bind(this))),e)},e.prototype.getDimensions=function(){return this.dimensions_},e.prototype.getFormat=function(){return this.format_},e.prototype.getLayer=function(){return this.layer_},e.prototype.getMatrixSet=function(){return this.matrixSet_},e.prototype.getRequestEncoding=function(){return this.requestEncoding_},e.prototype.getStyle=function(){return this.style_},e.prototype.getVersion=function(){return this.version_},e.prototype.getKeyForDimensions_=function(){var t=0,e=[];for(var r in this.dimensions_)e[t++]=r+"-"+this.dimensions_[r];return e.join("/")},e.prototype.updateDimensions=function(t){b(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())},e.prototype.createFromWMTSTemplate=function(t){var e=this.requestEncoding_,r={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};"KVP"==e&&b(r,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t="KVP"==e?kk(t,r):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in r?r[e.toLowerCase()]:t}));var n=this.tileGrid,i=this.dimensions_;return function(r,o,s){if(r){var a={TileMatrix:n.getMatrixId(r[0]),TileCol:r[1],TileRow:r[2]};b(a,i);var l=t;return"KVP"==e?kk(l,a):l.replace(/\{(\w+?)\}/g,(function(t,e){return a[e]}))}}},e}(Qf);const Jk=Zk;class $k extends dm{constructor(t){super(),e(this,"_map"),e(this,"segmentStyles"),e(this,"clearPrevious"),e(this,"showSegments"),e(this,"_tipPoint"),e(this,"_draw"),e(this,"isdraw"),e(this,"_source"),e(this,"layer"),e(this,"style"),e(this,"labelStyle"),e(this,"tipStyle"),e(this,"modifyStyle"),e(this,"segmentStyle"),e(this,"_modify"),this._map=t,this.segmentStyles=[],this.clearPrevious=!1,this.showSegments=!0,this._tipPoint=void 0,this.isdraw=!1,this._source=new Aa,this.layer=new Zs({source:this._source,zIndex:1e3,style:t=>this.styleFunction(t,this.showSegments,null,null)}),this.style=new ji({fill:new Tn({color:"rgba(255, 255, 255, 0.2)"}),stroke:new Rn({color:"rgba(255, 255, 0, 1)",lineDash:[10,10],width:2}),image:new Ri({radius:5,stroke:new Rn({color:"rgba(0, 0, 0, 1)"}),fill:new Tn({color:"rgba(255, 255, 255, 0.2)"})})}),this.labelStyle=new ji({text:new Vi({font:"14px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 1)"}),padding:[3,3,3,3],textBaseline:"bottom",offsetY:-15}),image:new Oi({radius:8,points:3,angle:Math.PI,displacement:[0,10],fill:new Tn({color:"rgba(0, 0, 0, 1)"})})}),this.tipStyle=new ji({text:new Vi({font:"12px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 0.8)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),this.modifyStyle=new ji({image:new Ri({radius:5,stroke:new Rn({color:"rgba(255, 255,255, 0.7)"}),fill:new Tn({color:"rgba(0, 255, 255, 0.8)"})}),text:new Vi({text:"拖动点修改图形",font:"12px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 0.7)"}),padding:[2,2,2,2],textAlign:"left",offsetX:15})}),this.segmentStyle=new ji({text:new Vi({font:"12px Calibri,sans-serif",fill:new Tn({color:"rgba(255, 255, 255, 1)"}),backgroundFill:new Tn({color:"rgba(0, 0, 0, 0.8)"}),padding:[2,2,2,2],textBaseline:"bottom",offsetY:-12}),image:new Oi({radius:6,points:3,angle:Math.PI,displacement:[0,8],fill:new Tn({color:"rgba(0, 0, 0, 0.8)"})})}),this._modify=new bh({source:this._source,style:this.modifyStyle}),this._map.addLayer(this.layer),this._map.addInteraction(this._modify)}getSource(){return this._source}clear(){this._source.clear()}formatLength(t){const e=Xe(t);let r;return r=e>1e3?Math.round(e/1e3*100)/100+" km":Math.round(100*e)/100+" m",r}formatArea(t){const e=Ze(t);let r;return r=e>1e5?Math.round(e/1e6*100)/100+" km²":Math.round(100*e)/100+" m²",r}styleFunction(t,e,r,n){this.segmentStyles=[this.segmentStyle];const i=[this.style],o=t.getGeometry(),s=o.getType();let a,l,u;if(r&&r!==s||("Polygon"===s?(a=o.getInteriorPoint(),l=this.formatArea(o),u=new Nn(o.getCoordinates()[0])):"LineString"===s&&(a=new nn(o.getLastCoordinate()),l=this.formatLength(o),u=o)),e&&u){let t=0;u.forEachSegment(((e,r)=>{const n=new Nn([e,r]),o=this.formatLength(n);this.segmentStyles.length-1<t&&this.segmentStyles.push(this.segmentStyle.clone());const s=new nn(n.getCoordinateAt(.5));this.segmentStyles[t].setGeometry(s),this.segmentStyles[t].getText().setText(o),i.push(this.segmentStyles[t]),t++}))}return l&&(this.labelStyle.setGeometry(a),this.labelStyle.getText().setText(l),i.push(this.labelStyle)),n&&"Point"===s&&!this._modify.getOverlay().getSource().getFeatures().length&&(this._tipPoint=o,this.tipStyle.getText().setText(n),i.push(this.tipStyle)),i}stopMeasure(){this._draw.setActive(!1),this._map.removeInteraction(this._draw),this.isdraw=!1}addInteraction(t){if(this.isdraw)return;this.isdraw=!0;const e="单击继续绘制,双击结束绘制"+("Polygon"===t?"多边形":"线"),r="点击任意位置";let n=r;this._draw=new ch({source:this._source,type:t,style:e=>this.styleFunction(e,!0,t,n)}),this._draw.on("drawstart",(t=>{this.clearPrevious&&this._source.clear(),this._modify.setActive(!1),n=e,this.trigger(Rm.onDrawStart,t)})),this._draw.on("drawend",(t=>{this.isdraw=!1,this._modify.setActive(!0),n=r,t.feature.setProperties({featuretype:Kp.Measure}),this.trigger(Rm.onDrawEnd,t)})),this._modify.setActive(!0),this._map.addInteraction(this._draw)}}var tU=function(t){D.call(this,t),this._listener=[],t&&!1===t.active?this.set("active",!1):this.set("active",!0)};Vm(tU,D),tU.prototype.setActive=function(t){this.set("active",!0===t)},tU.prototype.getActive=function(){return this.get("active")},function(){function t(t){this.get("active")&&t.context&&this.precompose(t)}function e(t){this.get("active")&&t.context&&this.postcompose(t)}function r(){if(this.renderSync)try{this.renderSync()}catch(dX){}else this.changed()}function n(n){this.filters_||(this.filters_=[]),this.filters_.push(n),n.addToLayer&&n.addToLayer(this),n.precompose&&n._listener.push({listener:this.on(["precompose","prerender"],t.bind(n)),target:this}),n.postcompose&&n._listener.push({listener:this.on(["postcompose","postrender"],e.bind(n)),target:this}),n._listener.push({listener:n.on("propertychange",r.bind(this)),target:this}),r.call(this)}function i(t){var e;if(this.filters_||(this.filters_=[]),t){for(e=this.filters_.length-1;e>=0;e--)this.filters_[e]===t&&this.filters_.splice(e,1);for(e=t._listener.length-1;e>=0;e--)t._listener[e].target===this&&(t.removeFromLayer&&t.removeFromLayer(this),N(t._listener[e].listener),t._listener.splice(e,1));r.call(this)}else this.filters_.forEach(function(t){this.removeFilter(t)}.bind(this))}Uh.prototype.addFilter=function(t){n.call(this,t)},Uh.prototype.removeFilter=function(t){i.call(this,t)},Uh.prototype.getFilters=function(){return this.filters_||[]},Wi.prototype.addFilter=function(t){n.call(this,t)},Wi.prototype.removeFilter=function(t){i.call(this,t)},Wi.prototype.getFilters=function(){return this.filters_||[]}}();var eU=function(t){if(tU.call(this,t=t||{}),t.feature)switch(t.feature.getGeometry().getType()){case"Polygon":case"MultiPolygon":this.feature_=t.feature}this.set("inner",t.inner),this.fillColor_=t.fill&&Hn(t.fill.getColor())||"rgba(0,0,0,0.2)"};Vm(eU,tU),eU.prototype.drawFeaturePath_=function(t,e){var r,n=t.context,i=n.canvas,o=t.frameState.pixelRatio;if(t.frameState.coordinateToPixelTransform){var s=t.frameState.coordinateToPixelTransform;if(t.inversePixelTransform){var a=t.inversePixelTransform;r=function(t){return[(t=[t[0]*s[0]+t[1]*s[1]+s[4],t[0]*s[2]+t[1]*s[3]+s[5]])[0]*a[0]-t[1]*a[1]+a[4],-t[0]*a[2]+t[1]*a[3]+a[5]]}}else r=function(t){return[(t[0]*s[0]+t[1]*s[1]+s[4])*o,(t[0]*s[2]+t[1]*s[3]+s[5])*o]}}else s=t.frameState.coordinateToPixelMatrix,r=function(t){return[(t[0]*s[0]+t[1]*s[1]+s[12])*o,(t[0]*s[4]+t[1]*s[5]+s[13])*o]};var l=this.feature_.getGeometry().getCoordinates();function u(t){for(var e=0;e<l.length;e++)for(var i=l[e],o=0;o<i.length;o++){var s=r([i[o][0][0]+t,i[o][0][1]]);n.moveTo(s[0],s[1]);for(var a=1;a<i[o].length;a++)s=r([i[o][a][0]+t,i[o][a][1]]),n.lineTo(s[0],s[1])}}if("Polygon"===this.feature_.getGeometry().getType()&&(l=[l]),n.beginPath(),e&&(n.moveTo(0,0),n.lineTo(i.width,0),n.lineTo(i.width,i.height),n.lineTo(0,i.height),n.lineTo(0,0)),this.get("wrapX")){var h=t.frameState.viewState.projection.getExtent(),c=h[2]-h[0],A=t.frameState.extent,f=this.feature_.getGeometry().getExtent(),p=f[2]-f[1],d=Math.floor((A[0]+p-h[0])/c),g=Math.floor((A[2]-p-h[2])/c)+1;d>g&&([d,g]=[g,d]);for(var y=d;y<=g;y++)u(y*c)}else u(0)},eU.prototype.postcompose=function(t){if(this.feature_){var e=t.context;e.save(),this.drawFeaturePath_(t,!this.get("inner")),e.fillStyle=this.fillColor_,e.fill("evenodd"),e.restore()}};var rU=function(t){tU.call(this,t=t||{}),this.set("blur",t.blur||8),this.set("intensity",t.intensity||.8)};Vm(rU,tU),rU.prototype.precompose=function(){},rU.prototype.postcompose=function(t){var e=t.context,r=e.canvas,n=r.width,i=r.height,o=document.createElement("canvas");o.width=n,o.height=i;var s=o.getContext("2d");s.filter="grayscale(1) invert(1) blur("+this.get("blur")+"px)",s.drawImage(r,0,0),e.save(),this.get("color")?(e.globalCompositeOperation="darken",e.globalAlpha=.3,e.drawImage(r,0,0)):(e.filter="grayscale(1)",e.drawImage(r,0,0)),e.globalCompositeOperation="color-dodge",e.globalAlpha=this.get("intensity"),e.drawImage(o,0,0),e.restore()};var nU=function(t){tU.call(this,t),this.setFilter(t)};Vm(nU,tU),nU.prototype.setFilter=function(t){switch(t=t||{}){case"grayscale":t={operation:"hue",color:[0,0,0],value:1};break;case"invert":t={operation:"difference",color:[255,255,255],value:1};break;case"sepia":t={operation:"color",color:[153,102,51],value:.6}}var e,r=t.color?Wn(t.color):[t.red,t.green,t.blue,t.value];switch(this.set("color",Hn(r)),this.set("value",t.value||1),this.set("preserveAlpha",t.preserveAlpha),t.operation){case"hue":case"difference":case"color-dodge":case"enhance":this.set("operation",t.operation);break;case"saturation":e=255*(t.value||0),this.set("color",Hn([0,0,e,e||1])),this.set("operation",t.operation);break;case"luminosity":e=255*(t.value||0),this.set("color",Hn([e,e,e,255])),this.set("operation","hard-light");break;case"contrast":e=255*(t.value||0),this.set("color",Hn([e,e,e,255])),this.set("operation","soft-light");break;default:this.set("operation","color"),this.setValue(t.value||1)}},nU.prototype.setValue=function(t){this.set("value",t);var e=Wn(this.get("color"));e[3]=t,this.set("color",Hn(e))},nU.prototype.setColor=function(t){(t=Wn(t))&&(t[3]=this.get("value"),this.set("color",Hn(t)))},nU.prototype.precompose=function(){},nU.prototype.postcompose=function(t){var e,r,n=t.context,i=n.canvas;if(n.save(),"enhance"==this.get("operation")){var o=this.get("value");if(o){var s=i.width,a=i.height;this.get("preserveAlpha")?((e=document.createElement("CANVAS")).width=i.width,e.height=i.height,(r=e.getContext("2d")).drawImage(i,0,0,s,a),r.globalCompositeOperation="color-burn",r.globalAlpha=o,r.drawImage(e,0,0,s,a),r.drawImage(e,0,0,s,a),r.drawImage(e,0,0,s,a),n.globalCompositeOperation="source-in",n.drawImage(e,0,0)):(n.globalCompositeOperation="color-burn",n.globalAlpha=o,n.drawImage(i,0,0,s,a),n.drawImage(i,0,0,s,a),n.drawImage(i,0,0,s,a))}}else this.get("preserveAlpha")?((e=document.createElement("CANVAS")).width=i.width,e.height=i.height,(r=e.getContext("2d")).drawImage(i,0,0),r.globalCompositeOperation=this.get("operation"),r.fillStyle=this.get("color"),r.fillRect(0,0,i.width,i.height),n.globalCompositeOperation="source-in",n.drawImage(e,0,0)):(n.globalCompositeOperation=this.get("operation"),n.fillStyle=this.get("color"),n.fillRect(0,0,i.width,i.height));n.restore()};var iU=function(t){tU.call(this,t),this._svg={}};Vm(iU,tU),iU.prototype.addSVGFilter=function(t){t.getId&&(t="#"+t.getId()),this._svg[t]=1,this.dispatchEvent({type:"propertychange",key:"svg",oldValue:this._svg})},iU.prototype.removeSVGFilter=function(t){t.getId&&(t="#"+t.getId()),delete this._svg[t],this.dispatchEvent({type:"propertychange",key:"svg",oldValue:this._svg})},iU.prototype.precompose=function(){},iU.prototype.postcompose=function(t){var e=[];for(var r in void 0!==this.get("url")&&e.push("url("+this.get("url")+")"),this._svg)e.push("url("+r+")");void 0!==this.get("blur")&&e.push("blur("+this.get("blur")+"px)"),void 0!==this.get("brightness")&&e.push("brightness("+this.get("brightness")+"%)"),void 0!==this.get("contrast")&&e.push("contrast("+this.get("contrast")+"%)"),void 0!==this.get("shadow")&&e.push("drop-shadow("+this.get("shadow")[0]+"px "+this.get("shadow")[1]+"px "+(this.get("shadowBlur")||0)+"px "+this.get("shadowColor")+")"),void 0!==this.get("grayscale")&&e.push("grayscale("+this.get("grayscale")+"%)"),void 0!==this.get("sepia")&&e.push("sepia("+this.get("sepia")+"%)"),void 0!==this.get("hueRotate")&&e.push("hue-rotate("+this.get("hueRotate")+"deg)"),void 0!==this.get("invert")&&e.push("invert("+this.get("invert")+"%)"),void 0!==this.get("saturate")&&e.push("saturate("+this.get("saturate")+"%)"),(e=e.join(" "))&&(t.context.save(),t.context.filter=e,t.context.drawImage(t.context.canvas,0,0),t.context.restore())};var oU=function(t){"string"==typeof t&&(t={feoperation:t}),t&&t.feoperation&&(D.call(this),this._name=t.feoperation,this.element=document.createElementNS(this.NS,this._name),this.setProperties(t),t.operations instanceof Array&&this.appendChild(t.operations))};Vm(oU,D),oU.prototype.NS="http://www.w3.org/2000/svg",oU.prototype.getName=function(){return this._name},oU.prototype.set=function(t,e){/^feoperation$|^operations$/.test(t)||(D.prototype.set.call(this,t,e),this.element.setAttribute(t,e))},oU.prototype.setProperties=function(t){for(var e in t=t||{})this.set(e,t[e])},oU.prototype.geElement=function(){return this.element},oU.prototype.appendChild=function(t){t instanceof Array?t.forEach(function(t){this.appendChild(t)}.bind(this)):(t instanceof oU||(t=new oU(t)),this.element.appendChild(t.geElement()))};var sU=function(t){t=t||{},D.call(this),sU.prototype.svg||(sU.prototype.svg=document.createElementNS(this.NS,"svg"),sU.prototype.svg.setAttribute("version","1.1"),sU.prototype.svg.setAttribute("width",0),sU.prototype.svg.setAttribute("height",0),sU.prototype.svg.style.position="absolute",document.body.appendChild(sU.prototype.svg)),this.element=document.createElementNS(this.NS,"filter"),this._id=t.id||"_ol_SVGFilter_"+sU.prototype._id++,this.element.setAttribute("id",this._id),t.color&&this.element.setAttribute("color-interpolation-filters",t.color),t.operation&&this.addOperation(t.operation),sU.prototype.svg.appendChild(this.element)};Vm(sU,D),sU.prototype.NS="http://www.w3.org/2000/svg",sU.prototype.svg=null,sU.prototype._id=0,sU.prototype.getId=function(){return this._id},sU.prototype.remove=function(){this.element.remove()},sU.prototype.addOperation=function(t){t instanceof Array?t.forEach(function(t){this.addOperation(t)}.bind(this)):(t instanceof oU||(t=new oU(t)),this.element.appendChild(t.geElement()))},sU.prototype.grayscale=function(t){this.addOperation({feoperation:"feColorMatrix",type:"saturate",values:t||0})},sU.prototype.luminanceToAlpha=function(t){t=t||{},this.addOperation({feoperation:"feColorMatrix",type:"luminanceToAlpha"}),t.gamma&&this.addOperation({feoperation:"feComponentTransfer",operations:[{feoperation:"feFuncA",type:"gamma",amplitude:t.gamma,exponent:1,offset:0}]})},sU.prototype.applyTo=function(t){var e=document.createElement("CANVAS");return e.width=t.naturalWidth||t.width,e.height=t.naturalHeight||t.height,e.getContext("2d").filter="url(#"+this.getId()+")",e.getContext("2d").drawImage(t,0,0),e};class aU extends Gm{constructor(t,r){super(t,r),e(this,"mask"),e(this,"pencil"),e(this,"colorize"),e(this,"canvasFilter"),e(this,"emboss"),e(this,"embossFilter"),e(this,"erode"),e(this,"erodeFilter"),e(this,"paperFilter"),e(this,"mImageExtent"),this.layerclass="tilelayer",this.mImageExtent=null,this.option={zIndex:900,projection:"EPSG:3857",url:"",ImageExtent:null,ImageExtentWKID:Xp.EPSG3857,opacity:1},this.option=Object.assign({},this.option,r),this.option.ImageExtent&&(this.mImageExtent=[this.option.ImageExtent.xmin,this.option.ImageExtent.ymin,this.option.ImageExtent.xmax,this.option.ImageExtent.ymax],this.option.ImageExtentWKID==Xp.EPSG4326&&(this.mImageExtent=dr(this.mImageExtent,"EPSG:4326","EPSG:3857")))}setOpacity(t){this.layer.setOpacity(t)}appendTo(t){t.addLayer(this.layer),this.isAdded=!0}addFilter(t){let e={feature:null,wrapX:!0,inner:!1,color:"rgba(255, 255, 255, 0.8)"};e=Object.assign({},e,t),this.mask=new eU({feature:e.feature,wrapX:e.wrapX,inner:e.inner,fill:new Tn({color:e.color})}),this.mask.set("active",!0),this.layer instanceof ka?this.layer.getLayers().forEach((t=>{t.addFilter(this.mask)})):this.layer.addFilter(this.mask)}removeMaskFilter(){this.layer instanceof ka?this.layer.getLayers().forEach((t=>{t.removeFilter(this.mask)})):this.layer.removeFilter(this.mask)}addPencilSketchFilter(){this.pencil=new rU,this.layer instanceof ka?this.layer.getLayers().forEach((t=>{t.addFilter(this.pencil)})):this.layer.addFilter(this.pencil)}removePencilSketchFilter(){this.layer instanceof ka?this.layer.getLayers().forEach((t=>{t.removeFilter(this.pencil)})):this.layer.removeFilter(this.pencil)}setPencilSketchFilter(t,e){this.pencil.set(t,e)}addColorizeFilter(t=!1){this.colorize=new nU;var e=new nU({operation:"enhance",value:1});this.layer instanceof ka?this.layer.getLayers().forEach((r=>{t&&r.addFilter(e),r.addFilter(this.colorize)})):(t&&this.layer.addFilter(e),this.layer.addFilter(this.colorize))}removeColorizeFilter(){this.layer instanceof ka?this.layer.getLayers().forEach((t=>{t.removeFilter(this.colorize)})):this.layer.removeFilter(this.colorize)}setColorizeFilter(t){switch(t.type){case $p.grayscale:case $p.invert:case $p.sepia:this.colorize.setFilter(t.type);break;default:this.colorize.setFilter({operation:t.type,red:Number(t.red),green:Number(t.green),blue:Number(t.blue),value:Number(t.value)})}}addCanvasFilter(){this.canvasFilter=new iU,this.erode=new oU({feoperation:"feMorphology",operator:"erode",radius:1}),this.emboss=new oU("feConvolveMatrix"),this.embossFilter=new sU({operation:this.emboss}),this.erodeFilter=new sU({operation:this.erode}),this.layer instanceof ka?this.layer.getLayers().forEach((t=>{t.addFilter(this.canvasFilter)})):this.layer.addFilter(this.canvasFilter)}removeCanvasFilter(){this.layer instanceof ka?this.layer.getLayers().forEach((t=>{t.removeFilter(this.canvasFilter)})):this.layer.removeFilter(this.canvasFilter)}setCanvasFilter(t,e){switch(t){case td.emboss:0==e?this.canvasFilter.removeSVGFilter(this.embossFilter):(this.emboss.set("kernelMatrix",[e,e,-e,e,1,-e,e,-e,-e]),this.canvasFilter.addSVGFilter(this.embossFilter));break;case td.erode:0==e?this.canvasFilter.removeSVGFilter(this.erodeFilter):(this.erode.set("radius",e),this.canvasFilter.addSVGFilter(this.erodeFilter));break;case td.paper:break;default:this.canvasFilter.set(t,e)}}}class lU extends aU{constructor(t,e){super(t,e),this.layerid=t,this.layertype="TileXyzLayer";let r=this;this.layerSource=new FO({tileUrlFunction:function(t,n,i){var o="C"+r.padLeft(t[1],8,16),s="R"+r.padLeft(t[2],8,16),a="L"+r.padLeft(t[0],2,10);return e.url.replace("{x}",o).replace("{y}",s).replace("{z}",a)}}),this.layer=new Vf({zIndex:e.zIndex,source:this.layerSource}),this.layer.set("layerid",t),this.mImageExtent&&this.layer.setExtent(this.mImageExtent),this.layerSource.on("tileloadstart",(function(){})),this.layerSource.on("tileloadend",(function(){})),this.layerSource.on("tileloaderror",(function(){}))}padLeft(t,e,r){let n=t.toString(r||10);return(new Array(e).join("0")+n).slice(-e)}}class uU extends aU{constructor(t,e){super(t,e),this.layertype="ArcGisMapServerLayer",this.layerSource=new Dk(e),this.layer=new Wc({source:this.layerSource}),this.layer.set("layerid",t),this.mImageExtent&&this.layer.setExtent(this.mImageExtent),this.layerSource.on("tileloadstart",(function(){})),this.layerSource.on("tileloadend",(function(){})),this.layerSource.on("tileloaderror",(function(){}))}}var hU={},cU={get exports(){return hU},set exports(t){hU=t}},AU={},fU={get exports(){return AU},set exports(t){AU=t}};const pU=$c(nk);var dU;function gU(){return dU||(dU=1,fU.exports=(t=t||function(t,e){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==Jc&&Jc.crypto&&(r=Jc.crypto),!r)try{r=pU}catch(d){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(d){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(d){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function t(){}return function(e){var r;return t.prototype=e,r=new t,t.prototype=null,r}}(),o={},s=o.lib={},a=s.Base={extend:function(t){var e=i(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},l=s.WordArray=a.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||h).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,i=t.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var s=r[o>>>2]>>>24-o%4*8&255;e[n+o>>>2]|=s<<24-(n+o)%4*8}else for(var a=0;a<i;a+=4)e[n+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=a.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],r=0;r<t;r+=4)e.push(n());return new l.init(e,t)}}),u=o.enc={},h=u.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var o=e[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new l.init(r,e/2)}},c=u.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var o=e[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new l.init(r,e)}},A=u.Utf8={stringify:function(t){try{return decodeURIComponent(escape(c.stringify(t)))}catch(dX){throw new Error("Malformed UTF-8 data")}},parse:function(t){return c.parse(unescape(encodeURIComponent(t)))}},f=s.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=A.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r,n=this._data,i=n.words,o=n.sigBytes,s=this.blockSize,a=o/(4*s),u=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*s,h=t.min(4*u,o);if(u){for(var c=0;c<u;c+=s)this._doProcessBlock(i,c);r=i.splice(0,u),n.sigBytes-=h}return new l.init(r,h)},clone:function(){var t=a.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});s.Hasher=f.extend({cfg:a.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new p.HMAC.init(t,r).finalize(e)}}});var p=o.algo={};return o}(Math),t)),AU;var t}var yU,mU,vU,_U,wU,bU={},xU={get exports(){return bU},set exports(t){bU=t}},EU={},CU={get exports(){return EU},set exports(t){EU=t}},SU={},BU={get exports(){return SU},set exports(t){SU=t}},IU={},PU={get exports(){return IU},set exports(t){IU=t}},TU={},FU={get exports(){return TU},set exports(t){TU=t}};function MU(){return wU||(wU=1,BU.exports=function(t){return function(){var e=t,r=e.lib,n=r.Base,i=r.WordArray,o=e.algo,s=o.MD5,a=o.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:s,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var r,n=this.cfg,o=n.hasher.create(),s=i.create(),a=s.words,l=n.keySize,u=n.iterations;a.length<l;){r&&o.update(r),r=o.update(t).finalize(e),o.reset();for(var h=1;h<u;h++)r=o.finalize(r),o.reset();s.concat(r)}return s.sigBytes=4*l,s}});e.EvpKDF=function(t,e,r){return a.create(r).compute(t,e)}}(),t.EvpKDF}(gU(),function(){return vU||(vU=1,PU.exports=(e=(t=a=gU()).lib,r=e.WordArray,n=e.Hasher,i=t.algo,o=[],s=i.SHA1=n.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],a=r[3],l=r[4],u=0;u<80;u++){if(u<16)o[u]=0|t[e+u];else{var h=o[u-3]^o[u-8]^o[u-14]^o[u-16];o[u]=h<<1|h>>>31}var c=(n<<5|n>>>27)+l+o[u];c+=u<20?1518500249+(i&s|~i&a):u<40?1859775393+(i^s^a):u<60?(i&s|i&a|s&a)-1894007588:(i^s^a)-899497514,l=a,a=s,s=i<<30|i>>>2,i=n,n=c}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+l|0},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),e[15+(n+64>>>9<<4)]=r,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}}),t.SHA1=n._createHelper(s),t.HmacSHA1=n._createHmacHelper(s),a.SHA1)),IU;var t,e,r,n,i,o,s,a}(),_U||(_U=1,FU.exports=(e=(t=gU()).lib.Base,r=t.enc.Utf8,void(t.algo.HMAC=e.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=r.parse(e));var n=t.blockSize,i=4*n;e.sigBytes>i&&(e=t.finalize(e)),e.clamp();for(var o=this._oKey=e.clone(),s=this._iKey=e.clone(),a=o.words,l=s.words,u=0;u<n;u++)a[u]^=1549556828,l[u]^=909522486;o.sigBytes=s.sigBytes=i,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,r=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(r))}})))))),SU;var t,e,r}var LU,OU,NU={},RU={get exports(){return NU},set exports(t){NU=t}};cU.exports=function(t){return function(){var e=t,r=e.lib,n=r.WordArray,i=r.BlockCipher,o=e.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],h=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],c=o.DES=i.extend({_doReset:function(){for(var t=this._key.words,e=[],r=0;r<56;r++){var n=s[r]-1;e[r]=t[n>>>5]>>>31-n%32&1}for(var i=this._subKeys=[],o=0;o<16;o++){var u=i[o]=[],h=l[o];for(r=0;r<24;r++)u[r/6|0]|=e[(a[r]-1+h)%28]<<31-r%6,u[4+(r/6|0)]|=e[28+(a[r+24]-1+h)%28]<<31-r%6;for(u[0]=u[0]<<1|u[0]>>>31,r=1;r<7;r++)u[r]=u[r]>>>4*(r-1)+3;u[7]=u[7]<<5|u[7]>>>27}var c=this._invSubKeys=[];for(r=0;r<16;r++)c[r]=i[15-r]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,r){this._lBlock=t[e],this._rBlock=t[e+1],A.call(this,4,252645135),A.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),A.call(this,1,1431655765);for(var n=0;n<16;n++){for(var i=r[n],o=this._lBlock,s=this._rBlock,a=0,l=0;l<8;l++)a|=u[l][((s^i[l])&h[l])>>>0];this._lBlock=s,this._rBlock=o^a}var c=this._lBlock;this._lBlock=this._rBlock,this._rBlock=c,A.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),A.call(this,16,65535),A.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function A(t,e){var r=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=r,this._lBlock^=r<<t}function f(t,e){var r=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=r,this._rBlock^=r<<t}e.DES=i._createHelper(c);var p=o.TripleDES=i.extend({_doReset:function(){var t=this._key.words;if(2!==t.length&&4!==t.length&&t.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var e=t.slice(0,2),r=t.length<4?t.slice(0,2):t.slice(2,4),i=t.length<6?t.slice(0,2):t.slice(4,6);this._des1=c.createEncryptor(n.create(e)),this._des2=c.createEncryptor(n.create(r)),this._des3=c.createEncryptor(n.create(i))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=i._createHelper(p)}(),t.TripleDES}(gU(),function(){return yU||(yU=1,xU.exports=(r=gU(),e=(t=r).lib.WordArray,t.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp();for(var i=[],o=0;o<r;o+=3)for(var s=(e[o>>>2]>>>24-o%4*8&255)<<16|(e[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|e[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<r;a++)i.push(n.charAt(s>>>6*(3-a)&63));var l=n.charAt(64);if(l)for(;i.length%4;)i.push(l);return i.join("")},parse:function(t){var r=t.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o<n.length;o++)i[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var a=t.indexOf(s);-1!==a&&(r=a)}return function(t,r,n){for(var i=[],o=0,s=0;s<r;s++)if(s%4){var a=n[t.charCodeAt(s-1)]<<s%4*2|n[t.charCodeAt(s)]>>>6-s%4*2;i[o>>>2]|=a<<24-o%4*8,o++}return e.create(i,o)}(t,r,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},r.enc.Base64)),bU;var t,e,r}(),function(){return mU||(mU=1,CU.exports=(t=gU(),function(e){var r=t,n=r.lib,i=n.WordArray,o=n.Hasher,s=r.algo,a=[];!function(){for(var t=0;t<64;t++)a[t]=4294967296*e.abs(e.sin(t+1))|0}();var l=s.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var r=0;r<16;r++){var n=e+r,i=t[n];t[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,s=t[e+0],l=t[e+1],f=t[e+2],p=t[e+3],d=t[e+4],g=t[e+5],y=t[e+6],m=t[e+7],v=t[e+8],_=t[e+9],w=t[e+10],b=t[e+11],x=t[e+12],E=t[e+13],C=t[e+14],S=t[e+15],B=o[0],I=o[1],P=o[2],T=o[3];B=u(B,I,P,T,s,7,a[0]),T=u(T,B,I,P,l,12,a[1]),P=u(P,T,B,I,f,17,a[2]),I=u(I,P,T,B,p,22,a[3]),B=u(B,I,P,T,d,7,a[4]),T=u(T,B,I,P,g,12,a[5]),P=u(P,T,B,I,y,17,a[6]),I=u(I,P,T,B,m,22,a[7]),B=u(B,I,P,T,v,7,a[8]),T=u(T,B,I,P,_,12,a[9]),P=u(P,T,B,I,w,17,a[10]),I=u(I,P,T,B,b,22,a[11]),B=u(B,I,P,T,x,7,a[12]),T=u(T,B,I,P,E,12,a[13]),P=u(P,T,B,I,C,17,a[14]),B=h(B,I=u(I,P,T,B,S,22,a[15]),P,T,l,5,a[16]),T=h(T,B,I,P,y,9,a[17]),P=h(P,T,B,I,b,14,a[18]),I=h(I,P,T,B,s,20,a[19]),B=h(B,I,P,T,g,5,a[20]),T=h(T,B,I,P,w,9,a[21]),P=h(P,T,B,I,S,14,a[22]),I=h(I,P,T,B,d,20,a[23]),B=h(B,I,P,T,_,5,a[24]),T=h(T,B,I,P,C,9,a[25]),P=h(P,T,B,I,p,14,a[26]),I=h(I,P,T,B,v,20,a[27]),B=h(B,I,P,T,E,5,a[28]),T=h(T,B,I,P,f,9,a[29]),P=h(P,T,B,I,m,14,a[30]),B=c(B,I=h(I,P,T,B,x,20,a[31]),P,T,g,4,a[32]),T=c(T,B,I,P,v,11,a[33]),P=c(P,T,B,I,b,16,a[34]),I=c(I,P,T,B,C,23,a[35]),B=c(B,I,P,T,l,4,a[36]),T=c(T,B,I,P,d,11,a[37]),P=c(P,T,B,I,m,16,a[38]),I=c(I,P,T,B,w,23,a[39]),B=c(B,I,P,T,E,4,a[40]),T=c(T,B,I,P,s,11,a[41]),P=c(P,T,B,I,p,16,a[42]),I=c(I,P,T,B,y,23,a[43]),B=c(B,I,P,T,_,4,a[44]),T=c(T,B,I,P,x,11,a[45]),P=c(P,T,B,I,S,16,a[46]),B=A(B,I=c(I,P,T,B,f,23,a[47]),P,T,s,6,a[48]),T=A(T,B,I,P,m,10,a[49]),P=A(P,T,B,I,C,15,a[50]),I=A(I,P,T,B,g,21,a[51]),B=A(B,I,P,T,x,6,a[52]),T=A(T,B,I,P,p,10,a[53]),P=A(P,T,B,I,w,15,a[54]),I=A(I,P,T,B,l,21,a[55]),B=A(B,I,P,T,v,6,a[56]),T=A(T,B,I,P,S,10,a[57]),P=A(P,T,B,I,y,15,a[58]),I=A(I,P,T,B,E,21,a[59]),B=A(B,I,P,T,d,6,a[60]),T=A(T,B,I,P,b,10,a[61]),P=A(P,T,B,I,f,15,a[62]),I=A(I,P,T,B,_,21,a[63]),o[0]=o[0]+B|0,o[1]=o[1]+I|0,o[2]=o[2]+P|0,o[3]=o[3]+T|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;r[i>>>5]|=128<<24-i%32;var o=e.floor(n/4294967296),s=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),t.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,l=a.words,u=0;u<4;u++){var h=l[u];l[u]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}return a},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});function u(t,e,r,n,i,o,s){var a=t+(e&r|~e&n)+i+s;return(a<<o|a>>>32-o)+e}function h(t,e,r,n,i,o,s){var a=t+(e&n|r&~n)+i+s;return(a<<o|a>>>32-o)+e}function c(t,e,r,n,i,o,s){var a=t+(e^r^n)+i+s;return(a<<o|a>>>32-o)+e}function A(t,e,r,n,i,o,s){var a=t+(r^(e|~n))+i+s;return(a<<o|a>>>32-o)+e}r.MD5=o._createHelper(l),r.HmacMD5=o._createHmacHelper(l)}(Math),t.MD5)),EU;var t}(),MU(),LU||(LU=1,RU.exports=(OU=gU(),MU(),void(OU.lib.Cipher||function(t){var e=OU,r=e.lib,n=r.Base,i=r.WordArray,o=r.BufferedBlockAlgorithm,s=e.enc;s.Utf8;var a=s.Base64,l=e.algo.EvpKDF,u=r.Cipher=o.extend({cfg:n.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,r){this.cfg=this.cfg.extend(r),this._xformMode=t,this._key=e,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?m:g}return function(e){return{encrypt:function(r,n,i){return t(n).encrypt(e,r,n,i)},decrypt:function(r,n,i){return t(n).decrypt(e,r,n,i)}}}}()});r.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var h=e.mode={},c=r.BlockCipherMode=n.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),A=h.CBC=function(){var e=c.extend();function r(e,r,n){var i,o=this._iv;o?(i=o,this._iv=t):i=this._prevBlock;for(var s=0;s<n;s++)e[r+s]^=i[s]}return e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize;r.call(this,t,e,i),n.encryptBlock(t,e),this._prevBlock=t.slice(e,e+i)}}),e.Decryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,o=t.slice(e,e+i);n.decryptBlock(t,e),r.call(this,t,e,i),this._prevBlock=o}}),e}(),f=(e.pad={}).Pkcs7={pad:function(t,e){for(var r=4*e,n=r-t.sigBytes%r,o=n<<24|n<<16|n<<8|n,s=[],a=0;a<n;a+=4)s.push(o);var l=i.create(s,n);t.concat(l)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}};r.BlockCipher=u.extend({cfg:u.cfg.extend({mode:A,padding:f}),reset:function(){var t;u.reset.call(this);var e=this.cfg,r=e.iv,n=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=n.createEncryptor:(t=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,r&&r.words):(this._mode=t.call(n,this,r&&r.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4});var p=r.CipherParams=n.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),d=(e.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,r=t.salt;return(r?i.create([1398893684,1701076831]).concat(r).concat(e):e).toString(a)},parse:function(t){var e,r=a.parse(t),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(e=i.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),p.create({ciphertext:r,salt:e})}},g=r.SerializableCipher=n.extend({cfg:n.extend({format:d}),encrypt:function(t,e,r,n){n=this.cfg.extend(n);var i=t.createEncryptor(r,n),o=i.finalize(e),s=i.cfg;return p.create({ciphertext:o,key:r,iv:s.iv,algorithm:t,mode:s.mode,padding:s.padding,blockSize:t.blockSize,formatter:n.format})},decrypt:function(t,e,r,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),t.createDecryptor(r,n).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),y=(e.kdf={}).OpenSSL={execute:function(t,e,r,n){n||(n=i.random(8));var o=l.create({keySize:e+r}).compute(t,n),s=i.create(o.words.slice(e),4*r);return o.sigBytes=4*e,p.create({key:o,iv:s,salt:n})}},m=r.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(t,e,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,t.keySize,t.ivSize);n.iv=i.iv;var o=g.encrypt.call(this,t,e,i.key,n);return o.mixIn(i),o},decrypt:function(t,e,r,n){n=this.cfg.extend(n),e=this._parse(e,n.format);var i=n.kdf.execute(r,t.keySize,t.ivSize,e.salt);return n.iv=i.iv,g.decrypt.call(this,t,e,i.key,n)}})}()))));var kU={};({get exports(){return kU},set exports(t){kU=t}}).exports=gU().enc.Utf8;const UU=r({__proto__:null,default:kU},[kU]);class DU{constructor(){}getMessage(){}getInfo(t){try{let n=JSON.parse(this.Decrypt1(t));if(n.showlog="%c"+n.name+"%c \n\n"+n.version+"\n"+n.EndUser+"\n"+n.Copyright+"\n授权截止:"+n.expirationDate+"\n\n"+n.ContactUs,n.expirationDate)var e=new Date;var r=n.expirationDate;return r=r.replace("-","/"),e>(r=new Date(Date.parse(r)))?"授权已过期":n}catch{return"获取授权失败"}}Encrypt1(t){return hU.encrypt(t,"apple3D").toString()}Decrypt1(t){return hU.decrypt(t,"apple3D").toString(UU)}}class GU extends gm{constructor(){super(),e(this,"_map"),e(this,"contextmenuitems"),e(this,"contextmenu"),e(this,"EventType"),this._map=null,this.contextmenuitems=[],this.contextmenu=null,this.EventType=Dm}initContextmenu(){this.contextmenu=new Nm({id:"contextmenu",width:150,defaultItems:!0,items:this.contextmenuitems}),this.contextmenu&&(this.contextmenu.set("id","contextmenu"),this._map&&(this._map.addControl(this.contextmenu),this.contextmenu.on("beforeopen",(t=>{if(this._map){let e=this._map.forEachFeatureAtPixel(t.pixel,(function(t,e){return t}));this.contextmenu.clear(),e?null!=e.get("featuretype")&&"量测图层"!=e.get("featuretype")||this.contextmenu.extend([{text:"定位到",icon:"img/marker.png",callback:t=>{this._map&&this._map.getView().setCenter(t.data.Center)},data:{Center:t.coordinate}}]):this.contextmenuitems.forEach((e=>{e.data={e:t}}))}})),this.contextmenu.on("open",(t=>{if(this._map){t.coordinate;let r=!1;if(this._map.getOverlays().forEach((e=>{let n=e.getElement();if(n&&"none"!==n.style.display){let i=t.pixel,o=n.getBoundingClientRect();o.left<=i[0]&&i[0]<=o.right&&o.top<=i[1]&&i[1]<=o.bottom&&(r=!0,e.dispatchEvent({type:this.EventType.featureType.onFeatureContextmenu,data:{contextmenu:this.contextmenu}}))}})),!r){var e=this._map.forEachFeatureAtPixel(t.pixel,(function(t,e){return{feature:t,layer:e}}));e?e.layer&&e.layer.dispatchEvent({type:this.EventType.featureType.onFeatureContextmenu,data:{feature:e.feature,layer:e.layer,contextmenu:this.contextmenu}}):this.trigger(this.EventType.XMapEventType.onMapContextmenu,t)}}}))))}}class QU extends aU{constructor(t,r){super(t,r),e(this,"projection"),this.layertype="TileXyzLayer",this.projection=this.option.projection,"GCJ02"==r.chinaCRS&&this.setGCJ02(),this.layerSource=new FO({url:r.url,crossOrigin:"Anonymous",projection:this.projection}),this.layer=new Vf({zIndex:r.zIndex,source:this.layerSource,useInterimTilesOnError:!1}),this.layer.set("layerid",t),this.mImageExtent&&this.layer.setExtent(dr(this.mImageExtent,"EPSG:4326","EPSG:3857")),this.layerSource.on("tileloadstart",(function(){})),this.layerSource.on("tileloadend",(function(){})),this.layerSource.on("tileloaderror",(function(){}))}setGCJ02(){const t=new se({code:"GCJ02",extent:[-20037508.342789244,-20037508.342789244,20037508.342789244,20037508.342789244],units:"m"});this.projection=t,rr(t);var e=function(t){return function(e,r,n){var i,o=e.length,s=n||2;i=r||(2!==s?e.slice():new Array(o));for(var a=0;a<o;a+=s)t(e,i,a);return i}},r={},n=Math.PI,i=6378245,o=.006693421622965943;function s(t,e){var r,s,a,l=(a=2*(r=t-105)-100+3*(s=e-35)+.2*s*s+.1*r*s+.2*Math.sqrt(Math.abs(r)),a+=2*(20*Math.sin(6*r*n)+20*Math.sin(2*r*n))/3,a+=2*(20*Math.sin(s*n)+40*Math.sin(s/3*n))/3,a+=2*(160*Math.sin(s/12*n)+320*Math.sin(s*n/30))/3),u=function(t,e){var r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*n)+20*Math.sin(2*t*n))/3,(r+=2*(20*Math.sin(t*n)+40*Math.sin(t/3*n))/3)+2*(150*Math.sin(t/12*n)+300*Math.sin(t/30*n))/3}(t-105,e-35),h=e/180*n,c=Math.sin(h);c=1-o*c*c;var A=Math.sqrt(c);return l=180*l/(i*(1-o)/(c*A)*n),[u=180*u/(i/A*Math.cos(h)*n),l]}function a(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271}r.toWGS84=e((function(t,e,r){var n=t[r],i=t[r+1];if(!a(n,i)){var o=s(n,i);n-=o[0],i-=o[1]}e[r]=n,e[r+1]=i})),r.fromWGS84=e((function(t,e,r){var n=t[r],i=t[r+1];if(!a(n,i)){var o=s(n,i);n+=o[0],i+=o[1]}e[r]=n,e[r+1]=i}));var l={},u=6378137,h=Math.PI/180;l.forward=e((function(t,e,r){var n=Math.max(Math.min(85.0511287798,t[r+1]),-85.0511287798),i=Math.sin(n*h);e[r]=u*t[r]*h,e[r+1]=u*Math.log((1+i)/(1-i))/2})),l.inverse=e((function(t,e,r){e[r]=t[r]/u/h,e[r+1]=(2*Math.atan(Math.exp(t[r+1]/u))-Math.PI/2)/h}));var c={ll2gmerc:function(t,e,n){let i=r.fromWGS84(t,e,n);return c.ll2smerc(i,i,n)},gmerc2ll:function(t,e,n){let i=c.smerc2ll(t,t,n);return r.toWGS84(i,e,n)},smerc2gmerc:function(t,e,n){let i=c.smerc2ll(t,t,n);return i=r.fromWGS84(i,i,n),c.ll2smerc(i,i,n)},gmerc2smerc:function(t,e,n){let i=c.smerc2ll(t,t,n);return i=r.toWGS84(i,i,n),c.ll2smerc(i,i,n)}};c.ll2smerc=l.forward,c.smerc2ll=l.inverse,lr("EPSG:4326",t,c.ll2gmerc,c.gmerc2ll),lr("EPSG:3857",t,c.smerc2gmerc,c.gmerc2smerc)}}class jU extends QU{constructor(t,e){super(t,e),this.layertype="TileTencentLayer",this.layerSource.setTileUrlFunction((function(t){let r=e.url,n=t[1],i=(1<<t[0])-t[2]-1,o=t[0],s=t[1]>>4,a=(1<<t[0])-t[2]-1>>4;if(e.subdomains&&r.indexOf("{s}")>0){let t=e.subdomains.split(",");r=r.replace("{s}",t[Math.floor(Math.random()*t.length)])}return r.replaceAll("{x}",n.toString()).replace("{ry}",i.toString()).replace("{z}",o.toString()).replace("{sx}",s.toString()).replace("{sy}",a.toString())}))}}var HU={},zU={},VU={},KU=function(t){return function(e,r,n){var i,o=e.length,s=n||2;i=r||(2!==s?e.slice():new Array(o));for(var a=0;a<o;a+=s)t(e,i,a);return i}},qU=KU,WU=[12890594.86,8362377.87,5591021,3481989.83,1678043.12,0],XU=[75,60,45,30,15,0],YU=[[1.410526172116255e-8,898305509648872e-20,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,17337981.2],[-7.435856389565537e-9,8983055097726239e-21,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,10260144.86],[-3.030883460898826e-8,898305509983578e-20,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,6856817.37],[-1.981981304930552e-8,8983055099779535e-21,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,4482777.06],[3.09191371068437e-9,8983055096812155e-21,6995724062e-14,23.10934304144901,-.00023663490511,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,2555164.4],[2.890871144776878e-9,8983055095805407e-21,-3.068298e-8,7.47137025468032,-353937994e-14,-.02145144861037,-1234426596e-14,.00010322952773,-323890364e-14,826088.5]],ZU=[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[.0008277824516172526,111320.7020463578,647795574.6671607,-4082003173.641316,10774905663.51142,-15171875531.51559,12053065338.62167,-5124939663.577472,913311935.9512032,67.5],[.00337398766765,111320.7020202162,4481351.045890365,-23393751.19931662,79682215.47186455,-115964993.2797253,97236711.15602145,-43661946.33752821,8477230.501135234,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837.749470245,992013.7397791013,-1221952.21711287,1340652.697009075,-620943.6990984312,144416.9293806241,37.5],[-.0003441963504368392,111320.7020576856,278.2353980772752,2485758.690035394,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,22.5],[-.0003218135878613132,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]];function JU(t,e,r,n){var i=t[r],o=t[r+1],s=n[0]+n[1]*Math.abs(i),a=Math.abs(o)/n[9],l=n[2]+n[3]*a+n[4]*a*a+n[5]*a*a*a+n[6]*a*a*a*a+n[7]*a*a*a*a*a+n[8]*a*a*a*a*a*a;e[r]=s*(i<0?-1:1),e[r+1]=l*(o<0?-1:1)}VU.forward=qU((function(t,e,r){var n,i,o=function(t,e,r){for(;t>180;)t-=360;for(;t<-180;)t+=360;return t}(t[r]),s=(n=t[r+1],n=Math.max(n,-74),Math.min(n,74)),a=null;for(i=0;i<XU.length;++i)if(s>=XU[i]){a=ZU[i];break}if(null===a)for(i=XU.length-1;i>=0;--i)if(s<=-XU[i]){a=ZU[i];break}e[r]=o,e[r+1]=s,JU(e,e,r,a)})),VU.inverse=qU((function(t,e,r){for(var n=Math.abs(t[r+1]),i=null,o=0;o<WU.length;o++)if(n>=WU[o]){i=YU[o];break}JU(t,e,r,i)}));var $U={},tD=KU,eD=6378137,rD=85.0511287798,nD=Math.PI/180;$U.forward=tD((function(t,e,r){var n=Math.max(Math.min(rD,t[r+1]),-rD),i=Math.sin(n*nD);e[r]=eD*t[r]*nD,e[r+1]=eD*Math.log((1+i)/(1-i))/2})),$U.inverse=tD((function(t,e,r){e[r]=t[r]/eD/nD,e[r+1]=(2*Math.atan(Math.exp(t[r+1]/eD))-Math.PI/2)/nD})),zU.baiduMercator=VU,zU.sphericalMercator=$U;var iD={},oD={},sD={},aD=KU,lD=Math.PI,uD=6378245,hD=.006693421622965943;function cD(t,e){var r,n,i,o=(i=2*(r=t-105)-100+3*(n=e-35)+.2*n*n+.1*r*n+.2*Math.sqrt(Math.abs(r)),i+=2*(20*Math.sin(6*r*lD)+20*Math.sin(2*r*lD))/3,i+=2*(20*Math.sin(n*lD)+40*Math.sin(n/3*lD))/3,i+=2*(160*Math.sin(n/12*lD)+320*Math.sin(n*lD/30))/3),s=function(t,e){var r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*lD)+20*Math.sin(2*t*lD))/3,(r+=2*(20*Math.sin(t*lD)+40*Math.sin(t/3*lD))/3)+2*(150*Math.sin(t/12*lD)+300*Math.sin(t/30*lD))/3}(t-105,e-35),a=e/180*lD,l=Math.sin(a);l=1-hD*l*l;var u=Math.sqrt(l);return o=180*o/(uD*(1-hD)/(l*u)*lD),[s=180*s/(uD/u*Math.cos(a)*lD),o]}function AD(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271}sD.toWGS84=aD((function(t,e,r){var n=t[r],i=t[r+1];if(!AD(n,i)){var o=cD(n,i);n-=o[0],i-=o[1]}e[r]=n,e[r+1]=i})),sD.fromWGS84=aD((function(t,e,r){var n=t[r],i=t[r+1];if(!AD(n,i)){var o=cD(n,i);n+=o[0],i+=o[1]}e[r]=n,e[r+1]=i}));var fD=KU,pD=sD,dD=3e3*Math.PI/180,gD=oD.toGCJ02=fD((function(t,e,r){var n=t[r]-.0065,i=t[r+1]-.006,o=Math.sqrt(n*n+i*i)-2e-5*Math.sin(i*dD),s=Math.atan2(i,n)-3e-6*Math.cos(n*dD);return e[r]=o*Math.cos(s),e[r+1]=o*Math.sin(s),e})),yD=oD.fromGCJ02=fD((function(t,e,r){var n=t[r],i=t[r+1],o=Math.sqrt(n*n+i*i)+2e-5*Math.sin(i*dD),s=Math.atan2(i,n)+3e-6*Math.cos(n*dD);return e[r]=o*Math.cos(s)+.0065,e[r+1]=o*Math.sin(s)+.006,e}));oD.toWGS84=function(t,e,r){var n=gD(t,e,r);return pD.toWGS84(n,n,r)},oD.fromWGS84=function(t,e,r){var n=pD.fromWGS84(t,e,r);return yD(n,n,r)},iD.bd09=oD,iD.gcj02=sD;var mD=zU,vD=iD;HU.smerc2bmerc=function(t,e,r){var n=mD.sphericalMercator.inverse(t,e,r);return n=vD.bd09.fromWGS84(n,n,r),mD.baiduMercator.forward(n,n,r)},HU.bmerc2smerc=function(t,e,r){var n=mD.baiduMercator.inverse(t,e,r);return n=vD.bd09.toWGS84(n,n,r),mD.sphericalMercator.forward(n,n,r)},HU.bmerc2ll=function(t,e,r){var n=mD.baiduMercator.inverse(t,e,r);return vD.bd09.toWGS84(n,n,r)},HU.ll2bmerc=function(t,e,r){var n=vD.bd09.fromWGS84(t,e,r);return mD.baiduMercator.forward(n,n,r)},HU.ll2smerc=mD.sphericalMercator.forward,HU.smerc2ll=mD.sphericalMercator.inverse,HU.datum=vD,HU.projection=mD;class _D extends aU{constructor(t,e){super(t,e),this.layertype="TileBaiDuLayer";let r=[-20037725.11268234,-19994619.55417086,20037725.11268234,19994619.55417086],n=new se({code:"baidu",extent:ne(r,HU.ll2bmerc),units:"m"});rr(n),lr("EPSG:4326",n,HU.ll2bmerc,HU.bmerc2ll),lr("EPSG:3857",n,HU.smerc2bmerc,HU.bmerc2smerc);let i=new Array(19);for(let s=0;s<19;++s)i[s]=Math.pow(2,18-s);var o=new lf({resolutions:i,origin:[0,0],extent:ne(r,HU.ll2bmerc),tileSize:[256,256]});this.layerSource=new Qf({projection:"baidu",tileGrid:o,tileUrlFunction:function(t,r,n){let i=e.url;if(e.subdomains&&i.indexOf("{s}")>0){let t=e.subdomains.split(",");i=i.replace("{s}",t[Math.floor(Math.random()*t.length)])}let o=t[0],s=t[1],a=-1-t[2];return i.replaceAll("{z}",o.toString()).replaceAll("{x}",s.toString()).replaceAll("{y}",a.toString())}}),this.layer=new Vf({zIndex:e.zIndex,source:this.layerSource,useInterimTilesOnError:!1}),this.layer.set("layerid",t)}}class wD extends aU{constructor(t,e){super(t,e),this.layertype="TileGroupLayer";let r=[];e.layers.forEach((t=>{"xyz"==t.type?r.push(new QU(t.name,t).layer):"tencent"==t.type?r.push(new jU(t.name,t).layer):"baidu"==t.type&&r.push(new _D(t.name,t).layer)})),this.layer=new ka({layers:r}),this.layer.set("layerid",t)}}class bD extends aU{constructor(t,e){super(t,e),this.layertype="imageLayer",this.layerSource=new Hk({url:this.option.url,projection:this.option.projection,imageExtent:this.mImageExtent}),this.layer=new Wc({source:this.layerSource,opacity:this.option.opacity}),this.layer.set("layerid",t),this.layerSource.on("tileloadstart",(function(t){})),this.layerSource.on("tileloadend",(function(t){})),this.layerSource.on("tileloaderror",(function(t){}))}}
86
86
  /*!
87
87
  * html2canvas 1.4.1 <https://html2canvas.hertzen.com>
88
88
  * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
@@ -466,7 +466,7 @@ var vlt=function(){return"undefined"!=typeof window?window:"undefined"!=typeof g
466
466
  * By Jimmy Wärting, https://github.com/jimmywarting
467
467
  * License: MIT
468
468
  * See https://github.com/eligrey/Blob.js/blob/master/LICENSE.md
469
- */vlt.URL=vlt.URL||vlt.webkitURL||function(t,e){return(e=document.createElement("a")).href=t,e};var wlt=vlt.Blob,blt=URL.createObjectURL,xlt=URL.revokeObjectURL,Elt=vlt.Symbol&&vlt.Symbol.toStringTag,Clt=!1,Slt=!1,Blt=!!vlt.ArrayBuffer,Ilt=_lt&&_lt.prototype.append&&_lt.prototype.getBlob;try{Clt=2===new Blob(["ä"]).size,Slt=2===new Blob([new Uint8Array([1,2])]).size}catch(dX){}function Plt(t){return t.map((function(t){if(t.buffer instanceof ArrayBuffer){var e=t.buffer;if(t.byteLength!==e.byteLength){var r=new Uint8Array(t.byteLength);r.set(new Uint8Array(e,t.byteOffset,t.byteLength)),e=r.buffer}return e}return t}))}function Tlt(t,e){e=e||{};var r=new _lt;return Plt(t).forEach((function(t){r.append(t)})),e.type?r.getBlob(e.type):r.getBlob()}function Flt(t,e){return new wlt(Plt(t),e||{})}if(vlt.Blob&&(Tlt.prototype=Blob.prototype,Flt.prototype=Blob.prototype),Elt)try{File.prototype[Elt]="File",Blob.prototype[Elt]="Blob",FileReader.prototype[Elt]="FileReader"}catch(dX){}function Mlt(){var t=!!vlt.ActiveXObject||"-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,e=vlt.XMLHttpRequest&&vlt.XMLHttpRequest.prototype.send;t&&e&&(XMLHttpRequest.prototype.send=function(t){t instanceof Blob?(this.setRequestHeader("Content-Type",t.type),e.call(this,t)):e.call(this,t)});try{new File([],"")}catch(n){try{var r=new Function('class File extends Blob {constructor(chunks, name, opts) {opts = opts || {};super(chunks, opts || {});this.name = name;this.lastModifiedDate = opts.lastModified ? new Date(opts.lastModified) : new Date;this.lastModified = +this.lastModifiedDate;}};return new File([], ""), File')();vlt.File=r}catch(i){r=function(t,e,r){var n=new Blob(t,r),i=r&&void 0!==r.lastModified?new Date(r.lastModified):new Date;return n.name=e,n.lastModifiedDate=i,n.lastModified=+i,n.toString=function(){return"[object File]"},Elt&&(n[Elt]="File"),n},vlt.File=r}}}Clt?(Mlt(),vlt.Blob=Slt?vlt.Blob:Flt):Ilt?(Mlt(),vlt.Blob=Tlt):function(){function t(t){for(var e=[],r=0;r<t.length;r++){var n=t.charCodeAt(r);n<128?e.push(n):n<2048?e.push(192|n>>6,128|63&n):n<55296||n>=57344?e.push(224|n>>12,128|n>>6&63,128|63&n):(r++,n=65536+((1023&n)<<10|1023&t.charCodeAt(r)),e.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}return e}function e(t){var e,r,n,i,o,s;for(e="",n=t.length,r=0;r<n;)switch((i=t[r++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:e+=String.fromCharCode(i);break;case 12:case 13:o=t[r++],e+=String.fromCharCode((31&i)<<6|63&o);break;case 14:o=t[r++],s=t[r++],e+=String.fromCharCode((15&i)<<12|(63&o)<<6|(63&s)<<0)}return e}function r(t){for(var e=new Array(t.byteLength),r=new Uint8Array(t),n=e.length;n--;)e[n]=r[n];return e}function n(t){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r=[],n=0;n<t.length;n+=3){var i=t[n],o=n+1<t.length,s=o?t[n+1]:0,a=n+2<t.length,l=a?t[n+2]:0,u=i>>2,h=(3&i)<<4|s>>4,c=(15&s)<<2|l>>6,A=63&l;a||(A=64,o||(c=64)),r.push(e[u],e[h],e[c],e[A])}return r.join("")}var i=Object.create||function(t){function e(){}return e.prototype=t,new e};if(Blt)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],s=ArrayBuffer.isView||function(t){return t&&o.indexOf(Object.prototype.toString.call(t))>-1};function a(e,n){for(var i=0,o=(e=e||[]).length;i<o;i++){var l=e[i];l instanceof a?e[i]=l._buffer:"string"==typeof l?e[i]=t(l):Blt&&(ArrayBuffer.prototype.isPrototypeOf(l)||s(l))?e[i]=r(l):Blt&&(u=l)&&DataView.prototype.isPrototypeOf(u)?e[i]=r(l.buffer):e[i]=t(String(l))}var u;this._buffer=[].concat.apply([],e),this.size=this._buffer.length,this.type=n&&n.type||""}function l(t,e,r){r=r||{};var n=a.call(this,t,r)||this;return n.name=e,n.lastModifiedDate=r.lastModified?new Date(r.lastModified):new Date,n.lastModified=+n.lastModifiedDate,n}if(a.prototype.slice=function(t,e,r){return new a([this._buffer.slice(t||0,e||this._buffer.length)],{type:r})},a.prototype.toString=function(){return"[object Blob]"},l.prototype=i(a.prototype),l.prototype.constructor=l,Object.setPrototypeOf)Object.setPrototypeOf(l,a);else try{l.__proto__=a}catch(dX){}function u(){if(!(this instanceof u))throw new TypeError("Failed to construct 'FileReader': Please use the 'new' operator, this DOM object constructor cannot be called as a function.");var t=document.createDocumentFragment();this.addEventListener=t.addEventListener,this.dispatchEvent=function(e){var r=this["on"+e.type];"function"==typeof r&&r(e),t.dispatchEvent(e)},this.removeEventListener=t.removeEventListener}function h(t,e,r){if(!(e instanceof a))throw new TypeError("Failed to execute '"+r+"' on 'FileReader': parameter 1 is not of type 'Blob'.");t.result="",setTimeout((function(){this.readyState=u.LOADING,t.dispatchEvent(new Event("load")),t.dispatchEvent(new Event("loadend"))}))}l.prototype.toString=function(){return"[object File]"},u.EMPTY=0,u.LOADING=1,u.DONE=2,u.prototype.error=null,u.prototype.onabort=null,u.prototype.onerror=null,u.prototype.onload=null,u.prototype.onloadend=null,u.prototype.onloadstart=null,u.prototype.onprogress=null,u.prototype.readAsDataURL=function(t){h(this,t,"readAsDataURL"),this.result="data:"+t.type+";base64,"+n(t._buffer)},u.prototype.readAsText=function(t){h(this,t,"readAsText"),this.result=e(t._buffer)},u.prototype.readAsArrayBuffer=function(t){h(this,t,"readAsText"),this.result=t._buffer.slice()},u.prototype.abort=function(){},URL.createObjectURL=function(t){return t instanceof a?"data:"+t.type+";base64,"+n(t._buffer):blt.call(URL,t)},URL.revokeObjectURL=function(t){xlt&&xlt.call(URL,t)};var c=vlt.XMLHttpRequest&&vlt.XMLHttpRequest.prototype.send;c&&(XMLHttpRequest.prototype.send=function(t){t instanceof a?(this.setRequestHeader("Content-Type",t.type),c.call(this,e(t._buffer))):c.call(this,t)}),vlt.FileReader=u,vlt.File=l,vlt.Blob=a}();var Llt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";void 0===vlt.btoa&&(vlt.btoa=function(t){var e,r,n,i,o,s=0,a=0,l="",u=[];if(!t)return t;do{e=(o=t.charCodeAt(s++)<<16|t.charCodeAt(s++)<<8|t.charCodeAt(s++))>>18&63,r=o>>12&63,n=o>>6&63,i=63&o,u[a++]=Llt.charAt(e)+Llt.charAt(r)+Llt.charAt(n)+Llt.charAt(i)}while(s<t.length);l=u.join("");var h=t.length%3;return(h?l.slice(0,h-3):l)+"===".slice(h||3)}),void 0===vlt.atob&&(vlt.atob=function(t){var e,r,n,i,o,s,a=0,l=0,u=[];if(!t)return t;t+="";do{e=(s=Llt.indexOf(t.charAt(a++))<<18|Llt.indexOf(t.charAt(a++))<<12|(i=Llt.indexOf(t.charAt(a++)))<<6|(o=Llt.indexOf(t.charAt(a++))))>>16&255,r=s>>8&255,n=255&s,u[l++]=64==i?String.fromCharCode(e):64==o?String.fromCharCode(e,r):String.fromCharCode(e,r,n)}while(a<t.length);return u.join("")});class Olt extends Cl{constructor(t){const r=t||{};let n=document.createElement("div");n.setAttribute("id","mouse-position"),n.innerHTML="",n.style.float="right",n.style.left=" 0px",n.style.right="0px",n.style.bottom="0px";var i=document.createElement("div");i.setAttribute("id","locationbar"),i.style.position="absolute",i.style.zIndex="991",i.style.padding=" 3px 10px",i.style.fontSize=" 13px",i.style.color="#e9e9e9",i.style.textShadow="2px 2px 2px #000",i.style.backgroundColor="rgba(0,0,0,.4)",i.style.minHeight="26px",i.style.left=" 0px",i.style.right="0px",i.style.bottom="0px",i.appendChild(n),super({element:i,target:r.target}),e(this,"_mouseposition"),this._mouseposition=n}show(){this.element.style.display="block"}hide(){this.element.style.display="none"}updateMousePosition(t){this._mouseposition.innerHTML=t}}class Nlt extends Cl{constructor(t,r,n,i){const o=t||{},s=new Image;s.src="image/basemaps/bingimage.png",s.className="mirage-mapswitch-image";const a=document.createElement("div");a.className="mirage-mapswitch-button-itemLabel",a.innerHTML=r;const l=document.createElement("div");l.className="mirage-mapswitch-button mirage-mapswitch-toolbar-button",l.appendChild(s),l.appendChild(a);const u=document.createElement("div");u.className="mirage-mapswitch-box";const h=document.createElement("div");h.className="mirage-mapswitch-baseLayerPicker-dropDown",h.style.maxHeight="300px",n.forEach((t=>{const e=new Image;e.src=t.icon,e.className="mirage-mapswitch-baseLayerPicker-itemIcon";const r=document.createElement("div");r.className="mirage-mapswitch-baseLayerPicker-itemLabel",r.innerHTML=t.name;const n=document.createElement("div");n.className="mirage-mapswitch-baseLayerPicker-item mirage-mapswitch-baseLayerPicker-selectedItem",n.appendChild(e),n.appendChild(r),n.addEventListener("click",(t=>{this._isshow=!1,h.className="mirage-mapswitch-baseLayerPicker-dropDown",s.src=t.currentTarget.children[0].src,a.innerHTML=t.currentTarget.innerText,i(t.currentTarget.innerText)}),!1),h.appendChild(n)})),u.appendChild(l),u.appendChild(h),super({element:u,target:o.target}),e(this,"_isshow"),e(this,"baseLayerList"),e(this,"mianImage"),e(this,"mianLabel"),this.mianImage=s,this.mianLabel=a,this.baseLayerList=n,this._isshow=!1,l.addEventListener("click",this.showSwitch.bind(this),!1)}changeBaseLayer(t){this.baseLayerList.forEach((e=>{if(e.name===t)return this.mianImage.src=e.icon,void(this.mianLabel.innerHTML=e.name)}))}showSwitch(t){this._isshow=!this._isshow;let e=document.getElementsByClassName("mirage-mapswitch-baseLayerPicker-dropDown");this._isshow?e[0].className="mirage-mapswitch-baseLayerPicker-dropDown mirage-mapswitch-baseLayerPicker-dropDown-visible":e[0].className="mirage-mapswitch-baseLayerPicker-dropDown"}show(){this.element.style.display="block"}hide(){this.element.style.display="none"}}var Rlt=function(t){t=t||{};var e=document.createElement("button"),r=document.createElement("div");r.className=(t.className||"ol-swipe")+" ol-unselectable ol-control",r.appendChild(e),r.addEventListener("mousedown",this.move.bind(this)),r.addEventListener("touchstart",this.move.bind(this)),Cl.call(this,{element:r}),this.precomposeRight_=this.precomposeRight.bind(this),this.precomposeLeft_=this.precomposeLeft.bind(this),this.postcompose_=this.postcompose.bind(this),this.layers=[],t.layers&&this.addLayer(t.layers,!1),t.rightLayers&&this.addLayer(t.rightLayers,!0),this.on("propertychange",function(t){if(this.getMap())try{this.getMap().renderSync()}catch(e){}"horizontal"===this.get("orientation")?(this.element.style.top=100*this.get("position")+"%",this.element.style.left=""):("vertical"!==this.get("orientation")&&this.set("orientation","vertical"),this.element.style.left=100*this.get("position")+"%",this.element.style.top=""),"orientation"===t.key&&(this.element.classList.remove("horizontal","vertical"),this.element.classList.add(this.get("orientation"))),this.isMoving||this.layers.forEach((function(t){t.layer.getImageRatio&&t.layer.changed()}))}.bind(this)),this.set("position",t.position||.5),this.set("orientation",t.orientation||"vertical")};Vm(Rlt,Cl),Rlt.prototype.setMap=function(t){var e,r;if(this.getMap()){for(e=0;e<this.layers.length;e++)(r=this.layers[e]).right?r.layer.un(["precompose","prerender"],this.precomposeRight_):r.layer.un(["precompose","prerender"],this.precomposeLeft_),r.layer.un(["postcompose","postrender"],this.postcompose_);try{this.getMap().renderSync()}catch(dX){}}if(Cl.prototype.setMap.call(this,t),t){for(this._listener=[],e=0;e<this.layers.length;e++)(r=this.layers[e]).right?r.layer.on(["precompose","prerender"],this.precomposeRight_):r.layer.on(["precompose","prerender"],this.precomposeLeft_),r.layer.on(["postcompose","postrender"],this.postcompose_);try{t.renderSync()}catch(dX){}}},Rlt.prototype.isLayer_=function(t){for(var e=0;e<this.layers.length;e++)if(this.layers[e].layer===t)return e;return-1},Rlt.prototype.addLayer=function(t,e){t instanceof Array||(t=[t]);for(var r=0;r<t.length;r++){var n=t[r];if(this.isLayer_(n)<0&&(this.layers.push({layer:n,right:e}),this.getMap())){e?n.on(["precompose","prerender"],this.precomposeRight_):n.on(["precompose","prerender"],this.precomposeLeft_),n.on(["postcompose","postrender"],this.postcompose_);try{this.getMap().renderSync()}catch(dX){}}}},Rlt.prototype.removeLayers=function(){var t=[];this.layers.forEach((function(e){t.push(e.layer)})),this.removeLayer(t)},Rlt.prototype.removeLayer=function(t){t instanceof Array||(t=[t]);for(var e=0;e<t.length;e++){var r=this.isLayer_(t[e]);r>=0&&this.getMap()&&(this.layers[r].right?t[e].un(["precompose","prerender"],this.precomposeRight_):t[e].un(["precompose","prerender"],this.precomposeLeft_),t[e].un(["postcompose","postrender"],this.postcompose_),this.layers.splice(r,1))}if(this.getMap())try{this.getMap().renderSync()}catch(dX){}},Rlt.prototype.getRectangle=function(){var t;return"vertical"===this.get("orientation")?[0,0,(t=this.getMap().getSize())[0]*this.get("position"),t[1]]:[0,0,(t=this.getMap().getSize())[0],t[1]*this.get("position")]},Rlt.prototype.move=function(t){var e,r=this;switch(this._movefn||(this._movefn=this.move.bind(this)),t.type){case"touchcancel":case"touchend":case"mouseup":r.isMoving=!1,["mouseup","mousemove","touchend","touchcancel","touchmove"].forEach((function(t){document.removeEventListener(t,r._movefn)})),this.layers.forEach((function(t){t.layer.getImageRatio&&t.layer.changed()}));break;case"mousedown":case"touchstart":r.isMoving=!0,["mouseup","mousemove","touchend","touchcancel","touchmove"].forEach((function(t){document.addEventListener(t,r._movefn)}));case"mousemove":case"touchmove":if(r.isMoving)if("vertical"===r.get("orientation")){var n=t.pageX||t.touches&&t.touches.length&&t.touches[0].pageX||t.changedTouches&&t.changedTouches.length&&t.changedTouches[0].pageX;if(!n)break;n-=r.getMap().getTargetElement().getBoundingClientRect().left+window.pageXOffset-document.documentElement.clientLeft;var i=(e=r.getMap().getSize()[0])-Math.min(Math.max(0,e-n),e);e=i/e,r.set("position",e),r.dispatchEvent({type:"moving",size:[i,r.getMap().getSize()[1]],position:[e,0]})}else{var o=t.pageY||t.touches&&t.touches.length&&t.touches[0].pageY||t.changedTouches&&t.changedTouches.length&&t.changedTouches[0].pageY;if(!o)break;o-=r.getMap().getTargetElement().getBoundingClientRect().top+window.pageYOffset-document.documentElement.clientTop;var s=(e=r.getMap().getSize()[1])-Math.min(Math.max(0,e-o),e);e=s/e,r.set("position",e),r.dispatchEvent({type:"moving",size:[r.getMap().getSize()[0],s],position:[0,e]})}}},Rlt.prototype._transformPt=function(t,e){var r=t.inversePixelTransform,n=e[0],i=e[1];return e[0]=r[0]*n+r[2]*i+r[4],e[1]=r[1]*n+r[3]*i+r[5],e},Rlt.prototype._drawRect=function(t,e){var r=t.inversePixelTransform;if(r){var n=[[e[0][0],e[0][1]],[e[0][0],e[1][1]],[e[1][0],e[1][1]],[e[1][0],e[0][1]],[e[0][0],e[0][1]]];if(t.context.save(),t.target.getImageRatio){var i=-Math.atan2(t.frameState.pixelToCoordinateTransform[1],t.frameState.pixelToCoordinateTransform[0]);t.context.translate(t.frameState.size[0]/2,t.frameState.size[1]/2),t.context.rotate(i),t.context.translate(-t.frameState.size[0]/2,-t.frameState.size[1]/2)}n.forEach((function(e,n){e=[e[0]*r[0]-e[1]*r[1]+r[4],-e[0]*r[2]+e[1]*r[3]+r[5]],n?t.context.lineTo(e[0],e[1]):t.context.moveTo(e[0],e[1])})),t.context.restore()}else{var o=t.frameState.pixelRatio;t.context.rect(e[0][0]*o,e[0][1]*o,e[1][0]*o,e[1][1]*o)}},Rlt.prototype.precomposeLeft=function(t){var e=t.context;if(e instanceof WebGLRenderingContext){if("prerender"===t.type){e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.enable(e.SCISSOR_TEST);var r,n,i=this.getMap().getSize(),o=this._transformPt(t,[0,i[1]]),s=this._transformPt(t,[i[0],0]),a=s[0]-o[0],l=s[1]-o[1];"vertical"===this.get("orientation")?(r=Math.round(a*this.get("position")),n=l):(r=a,n=Math.round(l*this.get("position")),o[1]+=l-n),e.scissor(o[0],o[1],r,n)}}else{var u=t.frameState.size;e.save(),e.beginPath();var h=[[0,0],[u[0],u[1]]];"vertical"===this.get("orientation")?h[1]=[.5*u[0]+this.getMap().getSize()[0]*(this.get("position")-.5),u[1]]:h[1]=[u[0],.5*u[1]+this.getMap().getSize()[1]*(this.get("position")-.5)],this._drawRect(t,h),e.clip()}},Rlt.prototype.precomposeRight=function(t){var e=t.context;if(e instanceof WebGLRenderingContext){if("prerender"===t.type){e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.enable(e.SCISSOR_TEST);var r,n,i=this.getMap().getSize(),o=this._transformPt(t,[0,i[1]]),s=this._transformPt(t,[i[0],0]),a=s[0]-o[0],l=s[1]-o[1];"vertical"===this.get("orientation")?(n=l,r=Math.round(a*(1-this.get("position"))),o[0]+=a-r):(r=a,n=Math.round(l*(1-this.get("position")))),e.scissor(o[0],o[1],r,n)}}else{var u=t.frameState.size;e.save(),e.beginPath();var h=[[0,0],[u[0],u[1]]];"vertical"===this.get("orientation")?h[0]=[.5*u[0]+this.getMap().getSize()[0]*(this.get("position")-.5),0]:h[0]=[0,.5*u[1]+this.getMap().getSize()[1]*(this.get("position")-.5)],this._drawRect(t,h),e.clip()}},Rlt.prototype.postcompose=function(t){if(t.context instanceof WebGLRenderingContext){if("postrender"===t.type){var e=t.context;e.disable(e.SCISSOR_TEST)}}else t.target.getClassName&&"ol-layer"!==t.target.getClassName()&&t.target.get("declutter")?setTimeout((function(){t.context.restore()}),0):t.context.restore()};class klt{constructor(){e(this,"events",new Map)}on(t,e,r){return this.events.has(t)||this.events.set(t,[]),(this.events.get(t)||[]).push({handler:e,once:r}),()=>{this.off(t,e)}}once(t,e){return this.on(t,e,!0)}fire(t,...e){let r=0;for(;r<(this.events.get(t)||[]).length;){const n=this.events.get(t)||[],{handler:i,once:o}=n[r];o&&n.splice(r--,1),r++,i(...e)}}off(t,e){t&&(e?this.events.set(t,(this.events.get(t)||[]).filter((t=>t.handler!==e))):this.events.set(t,[]))}}class Ult extends klt{constructor(){super(),e(this,"_swipe"),this._swipe=new Rlt}show(t,e,r="vertical"){this.fire("show",{swipe:this._swipe,leftlayerID:t,rightlayerID:e}),this._swipe.set("orientation",r)}hide(){this.fire("hide",this._swipe)}}class Dlt extends Cl{constructor(t){const r=t||{};var n=document.createElement("div");n.style.zIndex="999",n.style.width="200px",n.className="huitudiv",n.setAttribute("id","huitutext1"),n.style.position="absolute",n.style.zIndex="991",n.style.padding=" 3px 10px",n.style.fontSize=" 25px",n.style.color="#000",n.style.textShadow="2px 2px 2px #fff",n.style.backgroundColor="rgba(0,0,0,.4)",n.style.minHeight="26px",n.style.right="100px",n.style.bottom="50px",n.innerHTML="",super({element:n,target:r.target}),e(this,"_mouseposition"),this._mouseposition=n}show(){this.element.style.display="block"}getElement(){return this._mouseposition}hide(){this.element.style.display="none"}updateHtml(t){this._mouseposition.innerHTML=t}updateElementStyle(t,e){this._mouseposition.style[t]=e}}const Glt=Object.freeze(Object.defineProperty({__proto__:null,Locationbar:Olt,baseLayerSwitch:Nlt,drawTextControl:Dlt,swipeControl:Ult},Symbol.toStringTag,{value:"Module"}));var Qlt=function(t){t||(t={});var e=this;this.selection_=new V,this.handles_=new V,this.overlayLayer_=new Zs({source:new Aa({features:this.handles_,useSpatialIndex:!1,wrapX:!1}),name:"Transform overlay",displayInLayerSwitcher:!1,style:function(t){return e.style[(t.get("handle")||"default")+(t.get("constraint")||"")+(t.get("option")||"")]}}),nu.call(this,{handleDownEvent:this.handleDownEvent_,handleDragEvent:this.handleDragEvent_,handleMoveEvent:this.handleMoveEvent_,handleUpEvent:this.handleUpEvent_}),this.features_=t.features,"function"==typeof t.filter&&(this._filter=t.filter),this.layers_=t.layers?t.layers instanceof Array?t.layers:[t.layers]:null,this._handleEvent=t.condition||function(){return!0},this.addFn_=t.addCondition||function(){return!1},this.setPointRadius(t.pointRadius),this.set("translateFeature",!1!==t.translateFeature),this.set("translate",!1!==t.translate),this.set("translateBBox",!0===t.translateBBox),this.set("stretch",!1!==t.stretch),this.set("scale",!1!==t.scale),this.set("rotate",!1!==t.rotate),this.set("keepAspectRatio",t.keepAspectRatio||function(t){return t.originalEvent.shiftKey}),this.set("modifyCenter",t.modifyCenter||function(t){return t.originalEvent.metaKey||t.originalEvent.ctrlKey}),this.set("noFlip",t.noFlip||!1),this.set("selection",!1!==t.selection),this.set("hitTolerance",t.hitTolerance||0),this.set("enableRotatedTransform",t.enableRotatedTransform||!1),this.set("keepRectangle",t.keepRectangle||!1),this.on("propertychange",(function(){this.drawSketch_()})),this.setDefaultStyle()};function jlt(t,e){var r=(t[0]*e[0]+t[1]*e[1])/(e[0]*e[0]+e[1]*e[1]);return[e[0]*r,e[1]*r]}function Hlt(t,e){return[e[0]-t[0],e[1]-t[1]]}function zlt(t,e){return[t[0]+e[0],t[1]+e[1]]}Vm(Qlt,nu),Qlt.prototype.Cursors={default:"auto",select:"pointer",translate:"move",rotate:"move",rotate0:"move",scale:"nesw-resize",scale1:"nwse-resize",scale2:"nesw-resize",scale3:"nwse-resize",scalev:"ew-resize",scaleh1:"ns-resize",scalev2:"ew-resize",scaleh3:"ns-resize"},Qlt.prototype.setMap=function(t){var e=this.getMap();if(e){var r=e.getTargetElement();e.removeLayer(this.overlayLayer_),this.previousCursor_&&r&&(r.style.cursor=this.previousCursor_),this.previousCursor_=void 0}nu.prototype.setMap.call(this,t),this.overlayLayer_.setMap(t),null===t&&this.select(null),null!==t&&(this.isTouch=/touch/.test(t.getViewport().className),this.setDefaultStyle())},Qlt.prototype.setActive=function(t){this.select(null),this.overlayLayer_.setVisible(t),nu.prototype.setActive.call(this,t)},Qlt.prototype.setDefaultStyle=function(t){var e=(t=t||{}).pointStroke||new Rn({color:[255,0,0,1],width:1}),r=t.stroke||new Rn({color:[255,0,0,1],width:1,lineDash:[4,4]}),n=t.fill||new Tn({color:[255,0,0,.01]}),i=t.pointFill||new Tn({color:[255,255,255,.8]}),o=new Oi({fill:i,stroke:e,radius:this.isTouch?12:6,displacement:this.isTouch?[24,-24]:[12,-12],points:15});o.setDisplacement||(o.getAnchor()[0]=this.isTouch?-10:-5);var s=new Oi({fill:i,stroke:e,radius:this.isTouch?16:8,points:4,angle:Math.PI/4}),a=new Oi({fill:i,stroke:e,radius:this.isTouch?12:6,points:4,angle:Math.PI/4});function l(t,e,r){return[new ji({image:t,stroke:e,fill:r})]}this.style={default:l(s,r,n),translate:l(s,e,i),rotate:l(o,e,i),rotate0:l(s,e,i),scale:l(s,e,i),scale1:l(s,e,i),scale2:l(s,e,i),scale3:l(s,e,i),scalev:l(a,e,i),scaleh1:l(a,e,i),scalev2:l(a,e,i),scaleh3:l(a,e,i)},this.drawSketch_()},Qlt.prototype.setStyle=function(t,e){if(e){this.style[t]=e instanceof Array?e:[e];for(var r=0;r<this.style[t].length;r++){var n=this.style[t][r].getImage();n&&("rotate"==t&&(n.getAnchor()[0]=-5),this.isTouch&&n.setScale(1.8));var i=this.style[t][r].getText();i&&("rotate"==t&&i.setOffsetX(this.isTouch?14:7),this.isTouch&&i.setScale(1.8))}this.drawSketch_()}},Qlt.prototype.getFeatureAtPixel_=function(t){var e=this;return this.getMap().forEachFeatureAtPixel(t,(function(t,r){var n=!1;if(!r){if(t===e.bbox_)return!!e.get("translateBBox")&&{feature:t,handle:"translate",constraint:"",option:""};if(e.handles_.forEach((function(e){e===t&&(n=!0)})),n)return{feature:t,handle:t.get("handle"),constraint:t.get("constraint"),option:t.get("option")}}if(!e.get("selection"))return e.selection_.getArray().some((function(e){return t===e}))?{feature:t}:null;if(e._filter)return e._filter(t,r)?{feature:t}:null;if(e.layers_){for(var i=0;i<e.layers_.length;i++)if(e.layers_[i]===r)return{feature:t};return null}return e.features_?(e.features_.forEach((function(e){e===t&&(n=!0)})),n?{feature:t}:null):{feature:t}}),{hitTolerance:this.get("hitTolerance")})||{}},Qlt.prototype.getGeometryRotateToZero_=function(t,e){var r=t.getGeometry(),n=this.getMap().getView().getRotation();if(0===n||!this.get("enableRotatedTransform"))return e?r.clone():r;var i=r.clone();return i.rotate(-1*n,this.getMap().getView().getCenter()),i},Qlt.prototype._isRectangle=function(t){return!(!this.get("keepRectangle")||"Polygon"!==t.getType())&&5===t.getCoordinates()[0].length},Qlt.prototype.drawSketch_=function(t){var e,r,n,i=this.selection_.item(0)&&this._isRectangle(this.selection_.item(0).getGeometry());if(this.overlayLayer_.getSource().clear(),this.selection_.getLength()){var o,s=this.getMap().getView().getRotation(),a=this.getGeometryRotateToZero_(this.selection_.item(0)).getExtent();i&&(o=this.getGeometryRotateToZero_(this.selection_.item(0)).getCoordinates()[0].slice(0,4)).unshift(o[3]),a=Ct(a,0),this.selection_.forEach(function(t){var e=this.getGeometryRotateToZero_(t).getExtent();kt(a,e)}.bind(this));var l=1===this.selection_.getLength()?this._pointRadius(this.selection_.item(0)):0;if(!l||l instanceof Array||(l=[l,l]),!0===t)this.ispt_||(this.overlayLayer_.getSource().addFeature(new X({geometry:new nn(this.center_),handle:"rotate0"})),n=xn(a),this.get("enableRotatedTransform")&&0!==s&&n.rotate(s,this.getMap().getView().getCenter()),r=this.bbox_=new X(n),this.overlayLayer_.getSource().addFeature(r));else{if(this.ispt_){var u=this.getMap().getPixelFromCoordinate([a[0],a[1]]);if(u){var h=l&&l[0]||10,c=l&&l[1]||10;a=Et([this.getMap().getCoordinateFromPixel([u[0]-h,u[1]-c]),this.getMap().getCoordinateFromPixel([u[0]+h,u[1]+c])])}}n=i?new bn([o]):xn(a),this.get("enableRotatedTransform")&&0!==s&&n.rotate(s,this.getMap().getView().getCenter()),r=this.bbox_=new X(n);var A=[],f=n.getCoordinates()[0];if(!this.ispt_||l){if(A.push(r),!this.iscircle_&&!this.ispt_&&this.get("stretch")&&this.get("scale"))for(e=0;e<f.length-1;e++)r=new X({geometry:new nn([(f[e][0]+f[e+1][0])/2,(f[e][1]+f[e+1][1])/2]),handle:"scale",constraint:e%2?"h":"v",option:e}),A.push(r);if(this.get("scale"))for(e=0;e<f.length-1;e++)r=new X({geometry:new nn(f[e]),handle:"scale",option:e}),A.push(r);this.get("translate")&&!this.get("translateFeature")&&(r=new X({geometry:new nn([(f[0][0]+f[2][0])/2,(f[0][1]+f[2][1])/2]),handle:"translate"}),A.push(r))}!this.iscircle_&&this.get("rotate")&&(r=new X({geometry:new nn(f[3]),handle:"rotate"}),A.push(r)),this.overlayLayer_.getSource().addFeatures(A)}}},Qlt.prototype.select=function(t,e){if(!t)return this.selection_.clear(),void this.drawSketch_();if(t.getGeometry&&t.getGeometry()){if(e)this.selection_.push(t);else{var r=this.selection_.getArray().indexOf(t);this.selection_.removeAt(r)}this.ispt_=1===this.selection_.getLength()&&"Point"==this.selection_.item(0).getGeometry().getType(),this.iscircle_=1===this.selection_.getLength()&&"Circle"==this.selection_.item(0).getGeometry().getType(),this.drawSketch_(),this.watchFeatures_(),this.dispatchEvent({type:"select",feature:t,features:this.selection_})}},Qlt.prototype.setSelection=function(t){this.selection_.clear(),t.forEach(function(t){this.selection_.push(t)}.bind(this)),this.ispt_=1===this.selection_.getLength()&&"Point"==this.selection_.item(0).getGeometry().getType(),this.iscircle_=1===this.selection_.getLength()&&"Circle"==this.selection_.item(0).getGeometry().getType(),this.drawSketch_(),this.watchFeatures_(),this.dispatchEvent({type:"select",features:this.selection_})},Qlt.prototype.watchFeatures_=function(){this._featureListeners&&this._featureListeners.forEach((function(t){N(t)})),this._featureListeners=[],this.selection_.forEach(function(t){this._featureListeners.push(t.on("change",function(){this.isUpdating_||this.drawSketch_()}.bind(this)))}.bind(this))},Qlt.prototype.handleDownEvent_=function(t){if(this._handleEvent(t,this.selection_)){var e=this.getFeatureAtPixel_(t.pixel),r=e.feature;if(this.selection_.getLength()&&this.selection_.getArray().indexOf(r)>=0&&(this.ispt_&&this.get("translate")||this.get("translateFeature"))&&(e.handle="translate"),e.handle){this.mode_=e.handle,this.opt_=e.option,this.constraint_=e.constraint;var n=this.getMap().getView().getRotation();this.coordinate_=t.coordinate,this.pixel_=t.pixel,this.geoms_=[],this.rotatedGeoms_=[];for(var i,o=[1/0,1/0,-1/0,-1/0],s=[1/0,1/0,-1/0,-1/0],a=0;i=this.selection_.item(a);a++)if(this.geoms_.push(i.getGeometry().clone()),o=kt(o,i.getGeometry().getExtent()),this.get("enableRotatedTransform")&&0!==n){var l=this.getGeometryRotateToZero_(i,!0);this.rotatedGeoms_.push(l),s=kt(s,l.getExtent())}if(this.extent_=xn(o).getCoordinates()[0],this.get("enableRotatedTransform")&&0!==n&&(this.rotatedExtent_=xn(s).getCoordinates()[0]),"rotate"===this.mode_){this.center_=this.getCenter()||Vt(o);var u=t.map.getTargetElement();u.style.cursor=this.Cursors.rotate0,this.previousCursor_=u.style.cursor}else this.center_=Vt(o);return this.angle_=Math.atan2(this.center_[1]-t.coordinate[1],this.center_[0]-t.coordinate[0]),this.dispatchEvent({type:this.mode_+"start",feature:this.selection_.item(0),features:this.selection_,pixel:t.pixel,coordinate:t.coordinate}),!0}if(this.get("selection")){if(r){this.addFn_(t)||this.selection_.clear();var h=this.selection_.getArray().indexOf(r);h<0?this.selection_.push(r):this.selection_.removeAt(h)}else this.selection_.clear();return this.ispt_=1===this.selection_.getLength()&&"Point"==this.selection_.item(0).getGeometry().getType(),this.iscircle_=1===this.selection_.getLength()&&"Circle"==this.selection_.item(0).getGeometry().getType(),this.drawSketch_(),this.watchFeatures_(),this.dispatchEvent({type:"select",feature:r,features:this.selection_,pixel:t.pixel,coordinate:t.coordinate}),!1}}},Qlt.prototype.getFeatures=function(){return this.selection_},Qlt.prototype.getCenter=function(){return this.get("center")},Qlt.prototype.setCenter=function(t){return this.set("center",t)},Qlt.prototype.handleDragEvent_=function(t){if(this._handleEvent(t,this.features_)){var e,r,n,i,o=this.getMap().getView().getRotation(),s=[this.coordinate_[0],this.coordinate_[1]],a=[t.coordinate[0],t.coordinate[1]];switch(this.isUpdating_=!0,this.mode_){case"rotate":var l=Math.atan2(this.center_[1]-a[1],this.center_[0]-a[0]);if(!this.ispt)for(e=0;n=this.selection_.item(e);e++)(i=this.geoms_[e].clone()).rotate(l-this.angle_,this.center_),"Circle"==i.getType()&&i.setCenterAndRadius(i.getCenter(),i.getRadius()),n.setGeometry(i);this.drawSketch_(!0),this.dispatchEvent({type:"rotating",feature:this.selection_.item(0),features:this.selection_,angle:l-this.angle_,pixel:t.pixel,coordinate:t.coordinate});break;case"translate":var u=a[0]-s[0],h=a[1]-s[1];for(e=0;n=this.selection_.item(e);e++)n.getGeometry().translate(u,h);this.handles_.forEach((function(t){t.getGeometry().translate(u,h)})),this.coordinate_=t.coordinate,this.dispatchEvent({type:"translating",feature:this.selection_.item(0),features:this.selection_,delta:[u,h],pixel:t.pixel,coordinate:t.coordinate});break;case"scale":var c=this.center_;if(this.get("modifyCenter")(t)){var A=this.extent_;this.get("enableRotatedTransform")&&0!==o&&(A=this.rotatedExtent_),c=A[(Number(this.opt_)+2)%4]}var f=1==this.geoms_.length&&this._isRectangle(this.geoms_[0]),p=this.constraint_,d=this.opt_,g=this.coordinate_,y=t.coordinate;if(this.get("enableRotatedTransform")&&0!==o){var m=new nn(this.coordinate_);m.rotate(-1*o,c),g=m.getCoordinates();var v=new nn(t.coordinate);v.rotate(-1*o,c),y=v.getCoordinates()}var _=(y[0]-c[0])/(g[0]-c[0]),w=(y[1]-c[1])/(g[1]-c[1]),b=[y[0]-g[0],y[1]-g[1]];if(this.get("enableRotatedTransform")&&0!==o){var x=new nn(c);x.rotate(-1*o,this.getMap().getView().getCenter()),c=x.getCoordinates()}for(this.get("noFlip")&&(_<0&&(_=-_),w<0&&(w=-w)),this.constraint_?"h"==this.constraint_?_=1:w=1:this.get("keepAspectRatio")(t)&&(_=w=Math.min(_,w)),e=0;n=this.selection_.item(e);e++)(i=0!==o&&this.get("enableRotatedTransform")?this.rotatedGeoms_[e].clone():this.geoms_[e].clone()).applyTransform((function(t,e,n){if(n<2)return e;if(f){var o=[[6],[0,8],[2],[4]],s=[t[0],t[1]],a=[t[2],t[3]],l=[t[4],t[5]],u=[t[6],t[7]],h=[t[8],t[9]];if(p){var A=d%2==0?Hlt(s,a):Hlt(u,s),g=jlt(b,A),m=[...o[d],...o[d+1<o.length?d+1:0]];for(r=0;r<t.length;r+=n)e[r]=m.includes(r)?t[r]+g[0]:t[r],e[r+1]=m.includes(r)?t[r+1]+g[1]:t[r+1]}else{var v,x;switch(d){case 0:v=jlt(b=Hlt(u,y),Hlt(l,u)),x=jlt(b,Hlt(s,u)),[e[0],e[1]]=zlt(s,v),[e[4],e[5]]=zlt(l,x),[e[6],e[7]]=zlt(u,b),[e[8],e[9]]=zlt(h,v);break;case 1:v=jlt(b=Hlt(s,y),Hlt(u,s)),x=jlt(b,Hlt(a,s)),[e[0],e[1]]=zlt(s,b),[e[2],e[3]]=zlt(a,v),[e[6],e[7]]=zlt(u,x),[e[8],e[9]]=zlt(h,b);break;case 2:v=jlt(b=Hlt(a,y),Hlt(s,a)),x=jlt(b,Hlt(l,a)),[e[0],e[1]]=zlt(s,x),[e[2],e[3]]=zlt(a,b),[e[4],e[5]]=zlt(l,v),[e[8],e[9]]=zlt(h,x);break;case 3:v=jlt(b=Hlt(l,y),Hlt(a,l)),x=jlt(b,Hlt(u,l)),[e[2],e[3]]=zlt(a,x),[e[4],e[5]]=zlt(l,b),[e[6],e[7]]=zlt(u,v)}}}else for(r=0;r<t.length;r+=n)1!=_&&(e[r]=c[0]+(t[r]-c[0])*_),1!=w&&(e[r+1]=c[1]+(t[r+1]-c[1])*w);return"Circle"==i.getType()&&i.setCenterAndRadius(i.getCenter(),i.getRadius()),e})),this.get("enableRotatedTransform")&&0!==o&&i.rotate(o,this.getMap().getView().getCenter()),n.setGeometry(i);this.drawSketch_(),this.dispatchEvent({type:"scaling",feature:this.selection_.item(0),features:this.selection_,scale:[_,w],pixel:t.pixel,coordinate:t.coordinate})}this.isUpdating_=!1}},Qlt.prototype.handleMoveEvent_=function(t){if(this._handleEvent(t,this.features_)&&!this.mode_){var e=this.getFeatureAtPixel_(t.pixel),r=t.map.getTargetElement();if(e.feature){var n=e.handle?this.Cursors[(e.handle||"default")+(e.constraint||"")+(e.option||"")]:this.Cursors.select;void 0===this.previousCursor_&&(this.previousCursor_=r.style.cursor),r.style.cursor=n}else void 0!==this.previousCursor_&&(r.style.cursor=this.previousCursor_),this.previousCursor_=void 0}},Qlt.prototype.handleUpEvent_=function(t){return"rotate"===this.mode_&&(t.map.getTargetElement().style.cursor=this.Cursors.default,this.previousCursor_=void 0),this.dispatchEvent({type:this.mode_+"end",feature:this.selection_.item(0),features:this.selection_,oldgeom:this.geoms_[0],oldgeoms:this.geoms_}),this.drawSketch_(),this.mode_=null,!1},Qlt.prototype.getFeatures=function(){return this.selection_},Qlt.prototype.setPointRadius=function(t){this._pointRadius="function"==typeof t?t:function(){return t}};class Vlt{constructor(t){e(this,"transformInteraction"),this.transformInteraction=new Qlt({enableRotatedTransform:!1,hitTolerance:2,translateFeature:!0,scale:!0,rotate:!0,keepAspectRatio:!1,keepRectangle:!1,translate:!0,stretch:!0,pointRadius:function(t){let e=t.get("radius")||10;return[e,e]}}),this.transformInteraction.setActive(!1),this.transformInteraction.on(["select"],(t=>{s&&t.features&&t.features.getLength()&&this.transformInteraction.setCenter(t.features.getArray()[0].getGeometry().getFirstCoordinate())}));let r=0,n=10,i=[1,1],o=[0,0],s=!1;this.transformInteraction.on(["rotatestart","translatestart","scalestart"],(function(t){r=t.feature.get("angle")||0,n=t.feature.get("radius")||10,i=t.feature.get("Scale")||[1,1],o=[0,0]})),this.transformInteraction.on("rotating",(t=>{t.feature.set("angle",r-t.angle),t.feature.dispatchEvent({type:"onRotating",data:r-t.angle})})),this.transformInteraction.on("translating",(t=>{o[0]+=t.delta[0],o[1]+=t.delta[1],t.feature.dispatchEvent({type:"onMoveing",data:Vt(t.features.getArray()[0].getGeometry().getExtent())})})),this.transformInteraction.on("scaling",(t=>{if(1===t.features.getLength()){let e=t.features.item(0);e.set("radius",n*Math.abs(t.scale[0])),e.set("Scale",[i[0]*Math.abs(t.scale[0]),i[1]*Math.abs(t.scale[1])]),t.feature.dispatchEvent({type:"onScaling",data:[i[0]*Math.abs(t.scale[0]),i[1]*Math.abs(t.scale[1])]})}})),this.transformInteraction.on(["rotateend","translateend","scaleend"],(t=>{}))}setHandleStyle(){{let t=new Oi({fill:new Tn({color:[255,255,255,.01]}),stroke:new Rn({width:1,color:[0,0,0,.01]}),radius:8,points:10});this.transformInteraction.setStyle("rotate",new ji({text:new Vi({text:"",font:"16px Fontawesome",textAlign:"left",fill:new Tn({color:"red"})}),image:t})),this.transformInteraction.setStyle("rotate0",new ji({text:new Vi({text:"",font:"20px Fontawesome",fill:new Tn({color:[255,255,255,.8]}),stroke:new Rn({width:2,color:"red"})})})),this.transformInteraction.setStyle("translate",new ji({text:new Vi({text:"",font:"20px Fontawesome",fill:new Tn({color:[255,255,255,.8]}),stroke:new Rn({width:2,color:"red"})})}))}this.transformInteraction.set("translate",this.transformInteraction.get("translate"))}appendTo(t){t.addInteraction(this.transformInteraction)}setActive(t){this.transformInteraction.setActive(t)}}var Klt,qlt=function(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)},Wlt=function(t,e){return t[0]==e[0]&&t[1]==e[1]};!function(){function t(t,e){var r;for(let n=t.length-1;n>0;n--)(t[n][0]>e&&t[n-1][0]<e||t[n][0]<e&&t[n-1][0]>e)&&(r=[e,(e-t[n][0])/(t[n-1][0]-t[n][0])*(t[n-1][1]-t[n][1])+t[n][1]],t.splice(n,0,r))}function e(t,e){var r;for(let n=t.length-1;n>0;n--)(t[n][1]>e&&t[n-1][1]<e||t[n][1]<e&&t[n-1][1]>e)&&(r=[(e-t[n][1])/(t[n-1][1]-t[n][1])*(t[n-1][0]-t[n][0])+t[n][0],e],t.splice(n,0,r))}Klt=function(r,n){var i="Polygon"===n.getType();if(!i&&"MultiPolygon"!==n.getType())return null;var o=n.getCoordinates();return i&&(o=[o]),o.forEach((function(n){n.forEach((function(n){t(n,r[0]),t(n,r[2]),e(n,r[1]),e(n,r[3])}))})),o.forEach((function(t){t.forEach((function(t){t.forEach((function(t){t[0]<r[0]?t[0]=r[0]:t[0]>r[2]&&(t[0]=r[2]),t[1]<r[1]?t[1]=r[1]:t[1]>r[3]&&(t[1]=r[3])}))}))})),i?new bn(o[0]):new oh(o)}}();var Xlt=function(t,e,r,n){var i=[];!1!==n&&i.push(t);var o=qlt(t,e);if(o){var s=Math.round(o/r);if(s>1)for(var a=(e[0]-t[0])/s,l=(e[1]-t[1])/s,u=1;u<s;u++)i.push([t[0]+a*u,t[1]+l*u])}return i.push(e),i};Nn.prototype.sampleAt=function(t){for(var e=this.getCoordinates(),r=[],n=1;n<e.length;n++)r=r.concat(Xlt(e[n-1],e[n],t,1===n));return new Nn(r)},Ju.prototype.sampleAt=function(t){var e=this.getCoordinates(),r=[];return e.forEach((function(e){for(var n=[],i=1;i<e.length;i++)n=n.concat(Xlt(e[i-1],e[i],t,1===i));r.push(n)})),new Ju(r)},bn.prototype.sampleAt=function(t){var e=this.getCoordinates(),r=[];return e.forEach((function(e){for(var n=[],i=1;i<e.length;i++)n=n.concat(Xlt(e[i-1],e[i],t,1===i));r.push(n)})),new bn(r)},oh.prototype.sampleAt=function(t){var e=this.getCoordinates(),r=[];return e.forEach((function(e){var n=[];r.push(n),e.forEach((function(e){for(var r=[],i=1;i<e.length;i++)r=r.concat(Xlt(e[i-1],e[i],t,1===i));n.push(r)}))})),new oh(r)},Xu.prototype.intersection=function(t,e){if(t.sampleAt){var r=Ct(this.getCenter().concat(this.getCenter()),this.getRadius());t=(t=Klt(r,t)).simplify(e);var n=this.getCenter(),i=this.getRadius(),o=t.sampleAt(e).getCoordinates();switch(t.getType()){case"Polygon":o=[o];case"MultiPolygon":var s=!1,a=[];return o.forEach((function(t){var e=[];a.push(e),t.forEach((function(t){var r=[];e.push(r),t.forEach((function(t){var e=qlt(n,t);e>i?(s=!0,r.push([n[0]+i/e*(t[0]-n[0]),n[1]+i/e*(t[1]-n[1])])):r.push(t)}))}))})),s?"Polygon"===t.getType()?new bn(a[0]):new oh(a):t}}return t},Nn.prototype.splitAt=function(t,e){var r;if(!t)return[this];if(e||(e=1e-10),t.length&&t[0].length){var n=[this];for(r=0;r<t.length;r++){for(var i=[],o=0;o<n.length;o++){var s=n[o].splitAt(t[r],e);i=i.concat(s)}n=i}return n}if(Wlt(t,this.getFirstCoordinate())||Wlt(t,this.getLastCoordinate()))return[this];var a=this.getCoordinates(),l=[a[0]],u=[];for(r=0;r<a.length-1;r++)if(!Wlt(a[r],a[r+1])){if(Wlt(t,a[r+1]))l.push(a[r+1]),u.push(new Nn(l)),l=[];else if(!Wlt(t,a[r])){var h,c,A=!1;a[r][0]==a[r+1][0]?(h=(a[r][1]-t[1])/(a[r][1]-a[r+1][1]),A=a[r][0]==t[0]&&0<h&&h<=1):a[r][1]==a[r+1][1]?(h=(a[r][0]-t[0])/(a[r][0]-a[r+1][0]),A=a[r][1]==t[1]&&0<h&&h<=1):(h=(a[r][0]-t[0])/(a[r][0]-a[r+1][0]),c=(a[r][1]-t[1])/(a[r][1]-a[r+1][1]),A=Math.abs(h-c)<=e&&0<h&&h<=1),A&&(l.push(t),u.push(new Nn(l)),l=[t])}l.push(a[r+1])}return l.length>1&&u.push(new Nn(l)),u.length?u:[this]};var Ylt=function(t){t||(t={}),Jl.call(this,{handleEvent:function(t){switch(t.type){case"singleclick":return this.handleDownEvent(t);case"pointermove":return this.handleMoveEvent(t);default:return!0}}}),this.snapDistance_=t.snapDistance||25,this.tolerance_=t.tolerance||1e-10,this.cursor_=t.cursor,this.setSources(t.sources),t.features&&this.sources_.push(new Aa({features:t.features})),this.filterSplit_=t.filter||function(){return!0};var e=[255,255,255,1],r=[0,153,255,1],n=new Tn({color:"rgba(255,255,255,0.4)"}),i=new Rn({color:"#3399CC",width:1.25}),o=[new ji({image:new Ri({fill:n,stroke:i,radius:5}),fill:n,stroke:i})],s=[new ji({stroke:new Rn({color:e,width:5})}),new ji({image:new Ri({radius:6,fill:new Tn({color:r}),stroke:new Rn({color:e,width:1.5})}),stroke:new Rn({color:r,width:3})})];t.sketchStyle&&(o=t.sketchStyle instanceof Array?t.sketchStyle:[t.sketchStyle]),t.featureStyle&&(s=t.featureStyle instanceof Array?t.featureStyle:[t.featureStyle]),this.overlayLayer_=new Zs({source:new Aa({useSpatialIndex:!1}),name:"Split overlay",displayInLayerSwitcher:!1,style:function(t){return t._sketch_?o:s}})};function Zlt(t){const e=t.frameState,r=pt(t.inversePixelTransform.slice(),e.coordinateToPixelTransform);return new vs(t.context,e.pixelRatio,e.extent,r,e.viewState.rotation)}Vm(Ylt,Jl),Ylt.prototype.setMap=function(t){this.getMap()&&this.getMap().removeLayer(this.overlayLayer_),Jl.prototype.setMap.call(this,t),this.overlayLayer_.setMap(t)},Ylt.prototype.getSources=function(){if(!this.sources_&&this.getMap()){var t=[],e=function(r){r.forEach((function(r){r.getVisible()&&(r.getSource&&r.getSource()instanceof Aa?t.unshift(r.getSource()):r.getLayers&&e(r.getLayers()))}))};return e(this.getMap().getLayers()),t}return this.sources_||[]},Ylt.prototype.setSources=function(t){this.sources_=!!t&&(t instanceof Array?t||!1:[t])},Ylt.prototype.getClosestFeature=function(t){var e,r,n,i,o=this.snapDistance_+1;if(this.getSources().forEach((function(s){var a=s.getClosestFeatureToCoordinate(t.coordinate);if(a&&a.getGeometry().splitAt){var l=a.getGeometry().getClosestPoint(t.coordinate),u=new Nn([t.coordinate,l]),h=u.getLength()/t.frameState.viewState.resolution;h<o&&(e=s,o=h,r=a,i=u,n=l)}})),o>this.snapDistance_)return!1;var s=this.getNearestCoord(n,r.getGeometry().getCoordinates()),a=this.getMap().getPixelFromCoordinate(s);return qlt(t.pixel,a)<this.snapDistance_&&(n=s),{source:e,feature:r,coord:n,link:i}},Ylt.prototype.getNearestCoord=function(t,e){for(var r,n,i=Number.MAX_VALUE,o=0;o<e.length;o++)(r=qlt(t,e[o]))<i&&(i=r,n=e[o]);return n},Ylt.prototype.handleDownEvent=function(t){var e=this.getClosestFeature(t);if(e){var r=this;r.overlayLayer_.getSource().clear();var n,i=e.feature.getGeometry().splitAt(e.coord,this.tolerance_);if(i.length>1){var o=[];for(n=0;n<i.length;n++){var s=e.feature.clone();s.setGeometry(i[n]),o.push(s)}for(r.dispatchEvent({type:"beforesplit",original:e.feature,features:o}),e.source.dispatchEvent({type:"beforesplit",original:e.feature,features:o}),e.source.removeFeature(e.feature),n=0;n<o.length;n++)e.source.addFeature(o[n]);r.dispatchEvent({type:"aftersplit",original:e.feature,features:o}),e.source.dispatchEvent({type:"aftersplit",original:e.feature,features:o})}}return!1},Ylt.prototype.handleMoveEvent=function(t){var e=t.map;this.overlayLayer_.getSource().clear();var r,n,i=this.getClosestFeature(t);i&&this.filterSplit_(i.feature)?(this.overlayLayer_.getSource().addFeature(i.feature),(r=new X(new nn(i.coord)))._sketch_=!0,this.overlayLayer_.getSource().addFeature(r),(n=new X(i.link))._sketch_=!0,this.overlayLayer_.getSource().addFeature(n),this.dispatchEvent({type:"pointermove",coordinate:t.coordinate,frameState:t.frameState,originalEvent:t.originalEvent,map:t.map,pixel:t.pixel,feature:i.feature,linkGeometry:i.link})):this.dispatchEvent(t);var o=e.getTargetElement();this.cursor_&&(i?o.style.cursor!=this.cursor_&&(this.previousCursor_=o.style.cursor,o.style.cursor=this.cursor_):void 0!==this.previousCursor_&&(o.style.cursor=this.previousCursor_,this.previousCursor_=void 0))},window.ol&&(ol.util?ol.util.VERSION||(ol.util.VERSION=ol.VERSION||"6.1.0"):ol.util={VERSION:ol.VERSION||"5.3.0"});var Jlt=a.split(".");Jlt=100*parseInt(Jlt[0])+parseInt(Jlt[1]);var $lt=function(t,e){var r=t.frameState.pixelRatio;if(Jlt>605&&1!==r&&e.getImage()instanceof Ns){var n=(e=e.clone()).getImage();n.setScale(n.getScale()*r);var i=n.getAnchor();if(n.setDisplacement){var o=n.getDisplacement();o&&(o[0]-=i[0]/r,o[1]+=i[1]/r,n.setAnchor([0,0]))}else i&&(i[0]/=r,i[1]/=r)}return e},tut=function(t){var e=t||{};Zs.call(this,e),this.oldcluster=new Aa,this.clusters=[],this.animation={start:!1},this.set("animationDuration","number"==typeof e.animationDuration?e.animationDuration:700),this.set("animationMethod",e.animationMethod||ya),this.getSource().on("change",this.saveCluster.bind(this)),this.on(["precompose","prerender"],this.animate.bind(this)),this.on(["postcompose","postrender"],this.postanimate.bind(this))};Vm(tut,Zs),tut.prototype.saveCluster=function(){if(this.oldcluster){if(this.oldcluster.clear(),!this.get("animationDuration"))return;var t=this.getSource().getFeatures();t.length&&t[0].get("features")&&(this.oldcluster.addFeatures(this.clusters),this.clusters=t.slice(0),this.sourceChanged=!0)}},tut.prototype.getClusterForFeature=function(t,e){for(var r,n=0;r=e[n];n++){var i=r.get("features");if(i&&i.length)for(var o,s=0;o=i[s];s++)if(t===o)return r}return!1},tut.prototype.stopAnimation=function(){this.animation.start=!1,this.animation.cA=[],this.animation.cB=[]},tut.prototype.animate=function(t){var e=this.get("animationDuration");if(e){var r,n,i=t.frameState.viewState.resolution,o=this.animation,s=t.frameState.time;if(o.resolution!=i&&this.sourceChanged){var a=t.frameState.extent;for(o.resolution<i?(a=Ct(a,100*i),o.cA=this.oldcluster.getFeaturesInExtent(a),o.cB=this.getSource().getFeaturesInExtent(a),o.revers=!1):(a=Ct(a,100*i),o.cA=this.getSource().getFeaturesInExtent(a),o.cB=this.oldcluster.getFeaturesInExtent(a),o.revers=!0),o.clusters=[],r=0;n=o.cA[r];r++){var l=n.get("features");if(l&&l.length){var u=this.getClusterForFeature(l[0],o.cB);u&&o.clusters.push({f:n,pt:u.getGeometry().getCoordinates()})}}if(o.resolution=i,this.sourceChanged=!1,!o.clusters.length||o.clusters.length>1e3)return void this.stopAnimation();s=o.start=(new Date).getTime()}if(o.start){var h=t.vectorContext||Zlt(t),c=(s-o.start)/e;c>1&&(this.stopAnimation(),c=1),c=this.get("animationMethod")(c);var A=this.getStyle(),f="function"==typeof A?A:A.length?function(){return A}:function(){return[A]};for(t.context.save(),t.context.globalAlpha=this.getOpacity(),r=0;u=o.clusters[r];r++){var p=u.f.getGeometry().getCoordinates(),d=p[0]-u.pt[0],g=p[1]-u.pt[1];o.revers?(p[0]=u.pt[0]+c*d,p[1]=u.pt[1]+c*g):(p[0]=p[0]-c*d,p[1]=p[1]-c*g);var y=f(u.f,i,!0);if(y.length||(y=[y]),1!==u.f.get("features").length||d||g){var m=new nn(p);l=new X(m)}else l=u.f.get("features")[0];for(var v,_=0;v=y[_];_++)if(v.getText()&&/\n/.test(v.getText().getText())){var w,b=v.getText().getOffsetX(),x=v.getText().getOffsetY(),E=v.getText().getRotation()||0,C=1.2*Number((v.getText().getFont()||"10px").match(/\d+/)),S=v.getText().getText().split("\n"),B=S.length-1,I=v.clone();S.forEach((function(e,r){switch(1==r&&(I.setImage(),I.setFill(),I.setStroke()),v.getText().getTextBaseline()){case"alphabetic":case"ideographic":case"bottom":w=B;break;case"hanging":case"top":w=0;break;default:w=B/2}I.getText().setOffsetX(b-Math.sin(E)*C*(r-w)),I.getText().setOffsetY(x+Math.cos(E)*C*(r-w)),I.getText().setText(e),h.drawFeature(l,$lt(t,I))}))}else h.drawFeature(l,$lt(t,v))}t.context.restore(),t.frameState.animate=!0,t.context.save(),t.context.beginPath(),t.context.rect(0,0,0,0),t.context.clip(),this.clip_=!0}}},tut.prototype.postanimate=function(t){this.clip_&&(t.context.restore(),this.clip_=!1)};var eut,rut=function(t){t=t||{},this.pointRadius=t.pointRadius||12,this.circleMaxObjects=t.circleMaxObjects||10,this.maxObjects=t.maxObjects||60,this.spiral=!1!==t.spiral,this.animate=t.animate,this.animationDuration=t.animationDuration||500,this.selectCluster_=!1!==t.selectCluster,this._autoClose=!1!==t.autoClose;var e=this.overlayLayer_=new Zs({source:new Aa({features:new V,wrapX:t.wrapX,useSpatialIndex:!0}),name:"Cluster overlay",updateWhileAnimating:!0,updateWhileInteracting:!0,displayInLayerSwitcher:!1,style:t.featureStyle});if(t.layers)if("function"==typeof t.layers){var r=t.layers;t.layers=function(t){return t===e||r(t)}}else t.layers.push&&t.layers.push(this.overlayLayer_);if(t.filter){var n=t.filter;t.filter=function(t,e){return!(!e&&t.get("selectclusterlink"))&&n(t,e)}}else t.filter=function(t,e){return!(!e&&t.get("selectclusterlink"))};this.filter_=t.filter,this._autoClose||t.toggleCondition||(t.toggleCondition=Au),Bh.call(this,t),this.on("select",this.selectCluster.bind(this))};Vm(rut,Bh),rut.prototype.setMap=function(t){this.getMap()&&this.getMap().removeLayer(this.overlayLayer_),this._listener&&N(this._listener),this._listener=null,Bh.prototype.setMap.call(this,t),this.overlayLayer_.setMap(t),t&&t.getView()&&(this._listener=t.getView().on("change:resolution",this.clear.bind(this)))},rut.prototype.clear=function(){this.getFeatures().clear(),this.overlayLayer_.getSource().clear()},rut.prototype.getLayer=function(){return this.overlayLayer_},rut.prototype.selectCluster=function(t){if(t instanceof X&&(t={selected:[t]}),t.selected.length){var e=t.selected[0];if(!e.get("selectclusterfeature")){var r=this.overlayLayer_.getSource();this._autoClose&&r.clear();var n=e.get("features");if(n&&1!=n.length){this.selectCluster_||this.getFeatures().clear();var i,o,s,a,l,u,h,c=e.getGeometry().getCoordinates(),A=this.getMap().getView().getResolution(),f=[];if(!this.spiral||n.length<=this.circleMaxObjects)for(a=Math.min(n.length,this.circleMaxObjects),i=A*this.pointRadius*(.5+a/4),s=0;s<a;s++)o=2*Math.PI*s/a,2!=a&&4!=a||(o+=Math.PI/4),l=[c[0]+i*Math.sin(o),c[1]+i*Math.cos(o)],(u=new X({selectclusterfeature:!0,features:[n[s]],geometry:new nn(l)})).setStyle(n[s].getStyle()),f.push(u),h=new X({selectclusterlink:!0,geometry:new Nn([c,l])}),f.push(h);else{o=0;var p=2*this.pointRadius;for(a=Math.min(this.maxObjects,n.length),s=0;s<a;s++){o+=(p+.1)/(i=p/2+p*o/(2*Math.PI));var d=A*i*Math.sin(o),g=A*i*Math.cos(o);l=[c[0]+d,c[1]+g],(u=new X({selectclusterfeature:!0,features:[n[s]],geometry:new nn(l)})).setStyle(n[s].getStyle()),f.push(u),h=new X({selectclusterlink:!0,geometry:new Nn([c,l])}),f.push(h)}}e.set("selectcluserfeatures",f),this.animate?this.animateCluster_(c,f):r.addFeatures(f)}}}else this._autoClose?this.clear():t.deselected.forEach((t=>{var e=t.get("selectcluserfeatures");e&&e.forEach((t=>{this.overlayLayer_.getSource().removeFeature(t)}))}))},rut.prototype.animateCluster_=function(t,e){if(this.listenerKey_&&N(this.listenerKey_),e.length){var r=this.overlayLayer_.getStyle(),n="function"==typeof r?r:r.length?function(){return r}:function(){return[r]},i=this.animationDuration||500,o=(new Date).getTime();this.listenerKey_=this.overlayLayer_.on(["postcompose","postrender"],function(r){for(var s,a=r.vectorContext||Zlt(r),l=r.frameState.pixelRatio,u=this.getMap().getView().getResolution(),h=ya((r.frameState.time-o)/i),c=0;s=e[c];c++)if(s.get("features")){var A=s.getGeometry().getCoordinates();A[0]=t[0]+h*(A[0]-t[0]),A[1]=t[1]+h*(A[1]-t[1]);for(var f=new nn(A),p=n(s,u),d=0;d<p.length;d++){var g,y=!Uh.prototype.getFeaturesAtPixel&&p[d].getImage();y&&(g=y.getScale(),y.setScale(l)),a.setStyle?(a.setStyle(p[d]),a.drawGeometry(f)):(a.setImageStyle(y),a.drawPointGeometry(f)),y&&y.setScale(g)}}if(h>1)return N(this.listenerKey_),this.overlayLayer_.getSource().addFeatures(e),void this.overlayLayer_.changed();r.frameState.animate=!0}.bind(this));var s=new X(new nn(this.getMap().getView().getCenter()));s.setStyle(new ji({image:new Ri({})})),this.overlayLayer_.getSource().addFeature(s)}},rut.prototype.getClusterExtent=function(t){if(!t.get("features"))return null;var e=[1/0,1/0,-1/0,-1/0];return t.get("features").forEach((function(t){e=kt(e,t.getGeometry().getExtent())})),e[0]===e[2]&&e[1]===e[3]?null:e},function(){var t=function(t,e,r){return(t[0]-r[0])*(e[1]-r[1])-(t[1]-r[1])*(e[0]-r[0])<=0};eut=function(e){var r;e.sort((function(t,e){return t[0]==e[0]?t[1]-e[1]:t[0]-e[0]}));var n=[];for(r=0;r<e.length;r++){for(;n.length>=2&&t(n[n.length-2],n[n.length-1],e[r]);)n.pop();n.push(e[r])}var i=[];for(r=e.length-1;r>=0;r--){for(;i.length>=2&&t(i[i.length-2],i[i.length-1],e[r]);)i.pop();i.push(e[r])}return i.pop(),n.pop(),n.concat(i)};var e=function(t){var r,n,i=[];switch(t.getType()){case"Point":i.push(t.getCoordinates());break;case"LineString":case"LinearRing":case"MultiPoint":i=t.getCoordinates();break;case"MultiLineString":for(n=t.getLineStrings(),r=0;r<n.length;r++)i.concat(e(n[r]));break;case"Polygon":i=e(t.getLinearRing(0));break;case"MultiPolygon":for(n=t.getPolygons(),r=0;r<n.length;r++)i.concat(e(n[r]));break;case"GeometryCollection":for(n=t.getGeometries(),r=0;r<n.length;r++)i.concat(e(n[r]))}return i};Mr.prototype.convexHull=function(){return eut(e(this))}}();const nut=eut;var iut=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),out={Point:function(t){return void 0!==t.m&&void 0!==t.z?new nn([t.x,t.y,t.z,t.m],Y.XYZM):void 0!==t.z?new nn([t.x,t.y,t.z],Y.XYZ):void 0!==t.m?new nn([t.x,t.y,t.m],Y.XYM):new nn([t.x,t.y])},LineString:function(t){var e=uut(t);return new Nn(t.paths[0],e)},Polygon:function(t){var e=uut(t);return new bn(t.rings,e)},MultiPoint:function(t){var e=uut(t);return new eh(t.points,e)},MultiLineString:function(t){var e=uut(t);return new Ju(t.paths,e)},MultiPolygon:function(t){var e=uut(t);return new oh(t.rings,e)}},sut={Point:function(t,e){var r,n=t.getCoordinates(),i=t.getLayout();return i===Y.XYZ?r={x:n[0],y:n[1],z:n[2]}:i===Y.XYM?r={x:n[0],y:n[1],m:n[2]}:i===Y.XYZM?r={x:n[0],y:n[1],z:n[2],m:n[3]}:i===Y.XY?r={x:n[0],y:n[1]}:K(!1,34),r},LineString:function(t,e){var r=hut(t);return{hasZ:r.hasZ,hasM:r.hasM,paths:[t.getCoordinates()]}},Polygon:function(t,e){var r=hut(t);return{hasZ:r.hasZ,hasM:r.hasM,rings:t.getCoordinates(!1)}},MultiPoint:function(t,e){var r=hut(t);return{hasZ:r.hasZ,hasM:r.hasM,points:t.getCoordinates()}},MultiLineString:function(t,e){var r=hut(t);return{hasZ:r.hasZ,hasM:r.hasM,paths:t.getCoordinates()}},MultiPolygon:function(t,e){for(var r=hut(t),n=t.getCoordinates(!1),i=[],o=0;o<n.length;o++)for(var s=n[o].length-1;s>=0;s--)i.push(n[o][s]);return{hasZ:r.hasZ,hasM:r.hasM,rings:i}}},aut=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this)||this).geometryName_=n.geometryName,r}return iut(e,t),e.prototype.readFeatureFromObject=function(t,e,r){var n=t,i=lut(n.geometry,e),o=new X;if(this.geometryName_&&o.setGeometryName(this.geometryName_),o.setGeometry(i),n.attributes){o.setProperties(n.attributes,!0);var s=n.attributes[r];void 0!==s&&o.setId(s)}return o},e.prototype.readFeaturesFromObject=function(t,e){var r=e||{};if(t.features){for(var n=[],i=t.features,o=0,s=i.length;o<s;++o)n.push(this.readFeatureFromObject(i[o],r,t.objectIdFieldName));return n}return[this.readFeatureFromObject(t,r)]},e.prototype.readGeometryFromObject=function(t,e){return lut(t,e)},e.prototype.readProjectionFromObject=function(t){return t.spatialReference&&void 0!==t.spatialReference.wkid?nr("EPSG:"+t.spatialReference.wkid):null},e.prototype.writeGeometryObject=function(t,e){return cut(t,this.adaptOptions(e))},e.prototype.writeFeatureObject=function(t,e){e=this.adaptOptions(e);var r={};if(!t.hasProperties())return r.attributes={},r;var n=t.getProperties(),i=t.getGeometry();if(i){r.geometry=cut(i,e);var o=e&&(e.dataProjection||e.featureProjection);o&&(r.geometry.spatialReference={wkid:Number(nr(o).getCode().split(":").pop())}),delete n[t.getGeometryName()]}return C(n)?r.attributes={}:r.attributes=n,r},e.prototype.writeFeaturesObject=function(t,e){e=this.adaptOptions(e);for(var r=[],n=0,i=t.length;n<i;++n)r.push(this.writeFeatureObject(t[n],e));return{features:r}},e}(Mf);function lut(t,e){var r,n,i;if(!t)return null;if("number"==typeof t.x&&"number"==typeof t.y)i="Point";else if(t.points)i="MultiPoint";else if(t.paths)i=1===t.paths.length?"LineString":"MultiLineString";else if(t.rings){var o=t,s=uut(o),a=function(t,e){var r,n,i=[],o=[],s=[];for(r=0,n=t.length;r<n;++r)i.length=0,Hr(i,0,t[r],e.length),dn(i,0,i.length,e.length)?o.push([t[r]]):s.push(t[r]);for(;s.length;){var a=s.shift(),l=!1;for(r=o.length-1;r>=0;r--){var u=o[r][0];if(Pt(new en(u).getExtent(),new en(a).getExtent())){o[r].push(a),l=!0;break}}l||o.push([a.reverse()])}return o}(o.rings,s);1===a.length?(i="Polygon",t=b({},t,((r={}).rings=a[0],r))):(i="MultiPolygon",t=b({},t,((n={}).rings=a,n)))}return Yc((0,out[i])(t),!1,e)}function uut(t){var e=Y.XY;return!0===t.hasZ&&!0===t.hasM?e=Y.XYZM:!0===t.hasZ?e=Y.XYZ:!0===t.hasM&&(e=Y.XYM),e}function hut(t){var e=t.getLayout();return{hasZ:e===Y.XYZ||e===Y.XYZM,hasM:e===Y.XYM||e===Y.XYZM}}function cut(t,e){return(0,sut[t.getType()])(Yc(t,!0,e),e)}const Aut=aut;var fut="http://www.w3.org/2001/XMLSchema-instance";function put(t,e){return Lut().createElementNS(t,e)}function dut(t,e){return gut(t,e,[]).join("")}function gut(t,e,r){if(t.nodeType==Node.CDATA_SECTION_NODE||t.nodeType==Node.TEXT_NODE)e?r.push(String(t.nodeValue).replace(/(\r\n|\r|\n)/g,"")):r.push(t.nodeValue);else{var n=void 0;for(n=t.firstChild;n;n=n.nextSibling)gut(n,e,r)}return r}function yut(t){return"documentElement"in t}function mut(t){return(new DOMParser).parseFromString(t,"application/xml")}function vut(t,e){return function(r,n){var i=t.call(void 0!==e?e:this,r,n);void 0!==i&&y(n[n.length-1],i)}}function _ut(t,e){return function(r,n){var i=t.call(void 0!==e?e:this,r,n);void 0!==i&&n[n.length-1].push(i)}}function wut(t,e){return function(r,n){var i=t.call(void 0!==e?e:this,r,n);void 0!==i&&(n[n.length-1]=i)}}function but(t,e,r){return function(n,i){var o=t.call(void 0!==r?r:this,n,i);void 0!==o&&(i[i.length-1][void 0!==e?e:n.localName]=o)}}function xut(t,e){return function(r,n,i){t.call(void 0!==e?e:this,r,n,i),i[i.length-1].node.appendChild(r)}}function Eut(t,e){var r=t;return function(t,n,i){var o=n[n.length-1].node,s=r;return void 0===s&&(s=i),put(void 0!==e?e:o.namespaceURI,s)}}var Cut=Eut();function Sut(t,e){for(var r=e.length,n=new Array(r),i=0;i<r;++i)n[i]=t[e[i]];return n}function But(t,e,r){var n,i,o=void 0!==r?r:{};for(n=0,i=t.length;n<i;++n)o[t[n]]=e;return o}function Iut(t,e,r,n){var i;for(i=e.firstElementChild;i;i=i.nextElementSibling){var o=t[i.namespaceURI];if(void 0!==o){var s=o[i.localName];void 0!==s&&s.call(n,i,r)}}}function Put(t,e,r,n,i){return n.push(t),Iut(e,r,n,i),n.pop()}function Tut(t,e,r,n,i,o,s){return i.push(t),function(t,e,r,n,i,o){for(var s,a,l=(void 0!==i?i:r).length,u=0;u<l;++u)void 0!==(s=r[u])&&void 0!==(a=e.call(void 0!==o?o:this,s,n,void 0!==i?i[u]:void 0))&&t[a.namespaceURI][a.localName].call(o,a,s,n)}(e,r,n,i,o,s),i.pop()}var Fut=void 0,Mut=void 0;function Lut(){return void 0===Mut&&"undefined"!=typeof document&&(Mut=document.implementation.createDocument("","",null)),Mut}var Out=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const Nut=function(t){function e(){var e=t.call(this)||this;return e.xmlSerializer_=(void 0===Fut&&"undefined"!=typeof XMLSerializer&&(Fut=new XMLSerializer),Fut),e}return Out(e,t),e.prototype.getType=function(){return"xml"},e.prototype.readFeature=function(t,e){if(t){if("string"==typeof t){var r=mut(t);return this.readFeatureFromDocument(r,e)}return yut(t)?this.readFeatureFromDocument(t,e):this.readFeatureFromNode(t,e)}return null},e.prototype.readFeatureFromDocument=function(t,e){var r=this.readFeaturesFromDocument(t,e);return r.length>0?r[0]:null},e.prototype.readFeatureFromNode=function(t,e){return null},e.prototype.readFeatures=function(t,e){if(t){if("string"==typeof t){var r=mut(t);return this.readFeaturesFromDocument(r,e)}return yut(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}return[]},e.prototype.readFeaturesFromDocument=function(t,e){for(var r=[],n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&y(r,this.readFeaturesFromNode(n,e));return r},e.prototype.readFeaturesFromNode=function(t,e){return n()},e.prototype.readGeometry=function(t,e){if(t){if("string"==typeof t){var r=mut(t);return this.readGeometryFromDocument(r,e)}return yut(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}return null},e.prototype.readGeometryFromDocument=function(t,e){return null},e.prototype.readGeometryFromNode=function(t,e){return null},e.prototype.readProjection=function(t){if(t){if("string"==typeof t){var e=mut(t);return this.readProjectionFromDocument(e)}return yut(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}return null},e.prototype.readProjectionFromDocument=function(t){return this.dataProjection},e.prototype.readProjectionFromNode=function(t){return this.dataProjection},e.prototype.writeFeature=function(t,e){var r=this.writeFeatureNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeFeatureNode=function(t,e){return null},e.prototype.writeFeatures=function(t,e){var r=this.writeFeaturesNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeFeaturesNode=function(t,e){return null},e.prototype.writeGeometry=function(t,e){var r=this.writeGeometryNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeGeometryNode=function(t,e){return null},e}(Xc);var Rut=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),kut="http://www.opengis.net/gml",Uut=/^[\s\xa0]*$/,Dut=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.featureType=n.featureType,r.featureNS=n.featureNS,r.srsName=n.srsName,r.schemaLocation="",r.FEATURE_COLLECTION_PARSERS={},r.FEATURE_COLLECTION_PARSERS[r.namespace]={featureMember:_ut(r.readFeaturesInternal),featureMembers:wut(r.readFeaturesInternal)},r.supportedMediaTypes=["application/gml+xml"],r}return Rut(e,t),e.prototype.readFeaturesInternal=function(t,e){var r=t.localName,n=null;if("FeatureCollection"==r)n=Put([],this.FEATURE_COLLECTION_PARSERS,t,e,this);else if("featureMembers"==r||"featureMember"==r||"member"==r){var i=e[0],o=i.featureType,s=i.featureNS;if(!o&&t.childNodes){o=[],s={};for(var a=0,l=t.childNodes.length;a<l;++a){var u=t.childNodes[a];if(1===u.nodeType){var h=u.nodeName.split(":").pop();if(-1===o.indexOf(h)){var c="",A=0,f=u.namespaceURI;for(var p in s){if(s[p]===f){c=p;break}++A}c||(s[c="p"+A]=f),o.push(c+":"+h)}}}"featureMember"!=r&&(i.featureType=o,i.featureNS=s)}if("string"==typeof s){var d=s;(s={}).p0=d}var g={},y=Array.isArray(o)?o:[o];for(var m in s){var v={};for(a=0,l=y.length;a<l;++a)(-1===y[a].indexOf(":")?"p0":y[a].split(":")[0])===m&&(v[y[a].split(":").pop()]="featureMembers"==r?_ut(this.readFeatureElement,this):wut(this.readFeatureElement,this));g[s[m]]=v}n=Put("featureMember"==r||"member"==r?void 0:[],g,t,e)}return null===n&&(n=[]),n},e.prototype.readGeometryOrExtent=function(t,e){var r=e[0];return r.srsName=t.firstElementChild.getAttribute("srsName"),r.srsDimension=t.firstElementChild.getAttribute("srsDimension"),Put(null,this.GEOMETRY_PARSERS,t,e,this)},e.prototype.readExtentElement=function(t,e){var r=e[0],n=this.readGeometryOrExtent(t,e);return n?Zc(n,r):void 0},e.prototype.readGeometryElement=function(t,e){var r=e[0],n=this.readGeometryOrExtent(t,e);return n?Yc(n,!1,r):void 0},e.prototype.readFeatureElementInternal=function(t,e,r){for(var n,i={},o=t.firstElementChild;o;o=o.nextElementSibling){var s=void 0,a=o.localName;0===o.childNodes.length||1===o.childNodes.length&&(3===o.firstChild.nodeType||4===o.firstChild.nodeType)?(s=dut(o,!1),Uut.test(s)&&(s=void 0)):(r&&(s="boundedBy"===a?this.readExtentElement(o,e):this.readGeometryElement(o,e)),s?"boundedBy"!==a&&(n=a):s=this.readFeatureElementInternal(o,e,!1));var l=o.attributes.length;if(l>0){s={_content_:s};for(var u=0;u<l;u++)s[o.attributes[u].name]=o.attributes[u].value}i[a]?(i[a]instanceof Array||(i[a]=[i[a]]),i[a].push(s)):i[a]=s}if(r){var h=new X(i);n&&h.setGeometryName(n);var c=t.getAttribute("fid")||function(t,e,r){return t.getAttributeNS(e,"id")||""}(t,this.namespace);return c&&h.setId(c),h}return i},e.prototype.readFeatureElement=function(t,e){return this.readFeatureElementInternal(t,e,!0)},e.prototype.readPoint=function(t,e){var r=this.readFlatCoordinatesFromNode(t,e);if(r)return new nn(r,Y.XYZ)},e.prototype.readMultiPoint=function(t,e){var r=Put([],this.MULTIPOINT_PARSERS,t,e,this);return r?new eh(r):void 0},e.prototype.readMultiLineString=function(t,e){var r=Put([],this.MULTILINESTRING_PARSERS,t,e,this);if(r)return new Ju(r)},e.prototype.readMultiPolygon=function(t,e){var r=Put([],this.MULTIPOLYGON_PARSERS,t,e,this);if(r)return new oh(r)},e.prototype.pointMemberParser=function(t,e){Iut(this.POINTMEMBER_PARSERS,t,e,this)},e.prototype.lineStringMemberParser=function(t,e){Iut(this.LINESTRINGMEMBER_PARSERS,t,e,this)},e.prototype.polygonMemberParser=function(t,e){Iut(this.POLYGONMEMBER_PARSERS,t,e,this)},e.prototype.readLineString=function(t,e){var r=this.readFlatCoordinatesFromNode(t,e);return r?new Nn(r,Y.XYZ):void 0},e.prototype.readFlatLinearRing=function(t,e){return Put(null,this.GEOMETRY_FLAT_COORDINATES_PARSERS,t,e,this)||void 0},e.prototype.readLinearRing=function(t,e){var r=this.readFlatCoordinatesFromNode(t,e);if(r)return new en(r,Y.XYZ)},e.prototype.readPolygon=function(t,e){var r=Put([null],this.FLAT_LINEAR_RINGS_PARSERS,t,e,this);if(r&&r[0]){var n,i=r[0],o=[i.length],s=void 0;for(s=1,n=r.length;s<n;++s)y(i,r[s]),o.push(i.length);return new bn(i,Y.XYZ,o)}},e.prototype.readFlatCoordinatesFromNode=function(t,e){return Put(null,this.GEOMETRY_FLAT_COORDINATES_PARSERS,t,e,this)},e.prototype.readGeometryFromNode=function(t,e){return this.readGeometryElement(t,[this.getReadOptions(t,e||{})])||null},e.prototype.readFeaturesFromNode=function(t,e){var r={featureType:this.featureType,featureNS:this.featureNS};return e&&b(r,this.getReadOptions(t,e)),this.readFeaturesInternal(t,[r])||[]},e.prototype.readProjectionFromNode=function(t){return nr(this.srsName?this.srsName:t.firstElementChild.getAttribute("srsName"))},e}(Nut);Dut.prototype.namespace=kut,Dut.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{}},Dut.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{}},Dut.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{}},Dut.prototype.MULTIPOINT_PARSERS={"http://www.opengis.net/gml":{pointMember:_ut(Dut.prototype.pointMemberParser),pointMembers:_ut(Dut.prototype.pointMemberParser)}},Dut.prototype.MULTILINESTRING_PARSERS={"http://www.opengis.net/gml":{lineStringMember:_ut(Dut.prototype.lineStringMemberParser),lineStringMembers:_ut(Dut.prototype.lineStringMemberParser)}},Dut.prototype.MULTIPOLYGON_PARSERS={"http://www.opengis.net/gml":{polygonMember:_ut(Dut.prototype.polygonMemberParser),polygonMembers:_ut(Dut.prototype.polygonMemberParser)}},Dut.prototype.POINTMEMBER_PARSERS={"http://www.opengis.net/gml":{Point:_ut(Dut.prototype.readFlatCoordinatesFromNode)}},Dut.prototype.LINESTRINGMEMBER_PARSERS={"http://www.opengis.net/gml":{LineString:_ut(Dut.prototype.readLineString)}},Dut.prototype.POLYGONMEMBER_PARSERS={"http://www.opengis.net/gml":{Polygon:_ut(Dut.prototype.readPolygon)}},Dut.prototype.RING_PARSERS={"http://www.opengis.net/gml":{LinearRing:wut(Dut.prototype.readFlatLinearRing)}};const Gut=Dut;function Qut(t){var e,r=dut(t,!1);return(e=/^\s*(true|1)|(false|0)\s*$/.exec(r))?void 0!==e[1]||!1:void 0}function jut(t){var e,r=dut(t,!1);return(e=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(r))?parseFloat(e[1]):void 0}function Hut(t){return zut(dut(t,!1))}function zut(t){var e=/^\s*(\d+)\s*$/.exec(t);return e?parseInt(e[1],10):void 0}function Vut(t){return dut(t,!1).trim()}function Kut(t,e){Wut(t,e?"1":"0")}function qut(t,e){var r=e.toPrecision();t.appendChild(Lut().createTextNode(r))}function Wut(t,e){t.appendChild(Lut().createTextNode(e))}var Xut=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Yut=kut+" http://schemas.opengis.net/gml/2.1.2/feature.xsd",Zut={MultiLineString:"lineStringMember",MultiCurve:"curveMember",MultiPolygon:"polygonMember",MultiSurface:"surfaceMember"},Jut=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,n)||this).FEATURE_COLLECTION_PARSERS[kut].featureMember=_ut(r.readFeaturesInternal),r.schemaLocation=n.schemaLocation?n.schemaLocation:Yut,r}return Xut(e,t),e.prototype.readFlatCoordinates=function(t,e){var r=dut(t,!1).replace(/^\s*|\s*$/g,""),n=e[0].srsName,i="enu";if(n){var o=nr(n);o&&(i=o.getAxisOrientation())}for(var s=r.trim().split(/\s+/),a=[],l=0,u=s.length;l<u;l++){var h=s[l].split(/,+/),c=parseFloat(h[0]),A=parseFloat(h[1]),f=3===h.length?parseFloat(h[2]):0;"en"===i.substr(0,2)?a.push(c,A,f):a.push(A,c,f)}return a},e.prototype.readBox=function(t,e){var r=Put([null],this.BOX_PARSERS_,t,e,this);return Mt(r[1][0],r[1][1],r[1][3],r[1][4])},e.prototype.innerBoundaryIsParser=function(t,e){var r=Put(void 0,this.RING_PARSERS,t,e,this);r&&e[e.length-1].push(r)},e.prototype.outerBoundaryIsParser=function(t,e){var r=Put(void 0,this.RING_PARSERS,t,e,this);r&&(e[e.length-1][0]=r)},e.prototype.GEOMETRY_NODE_FACTORY_=function(t,e,r){var n,i=e[e.length-1],o=i.multiSurface,s=i.surface,a=i.multiCurve;return Array.isArray(t)?n="Envelope":"MultiPolygon"===(n=t.getType())&&!0===o?n="MultiSurface":"Polygon"===n&&!0===s?n="Surface":"MultiLineString"===n&&!0===a&&(n="MultiCurve"),put("http://www.opengis.net/gml",n)},e.prototype.writeFeatureElement=function(t,e,r){var n=e.getId();n&&t.setAttribute("fid",n);var i=r[r.length-1],o=i.featureNS,s=e.getGeometryName();i.serializers||(i.serializers={},i.serializers[o]={});var a=[],l=[];if(e.hasProperties()){var u=e.getProperties();for(var h in u){var c=u[h];null!==c&&(a.push(h),l.push(c),h==s||"function"==typeof c.getSimplifiedGeometry?h in i.serializers[o]||(i.serializers[o][h]=xut(this.writeGeometryElement,this)):h in i.serializers[o]||(i.serializers[o][h]=xut(Wut)))}}var A=b({},i);A.node=t,Tut(A,i.serializers,Eut(void 0,o),l,r,a)},e.prototype.writeCurveOrLineString=function(t,e,r){var n=r[r.length-1].srsName;if("LineStringSegment"!==t.nodeName&&n&&t.setAttribute("srsName",n),"LineString"===t.nodeName||"LineStringSegment"===t.nodeName){var i=this.createCoordinatesNode_(t.namespaceURI);t.appendChild(i),this.writeCoordinates_(i,e,r)}else if("Curve"===t.nodeName){var o=put(t.namespaceURI,"segments");t.appendChild(o),this.writeCurveSegments_(o,e,r)}},e.prototype.writeLineStringOrCurveMember=function(t,e,r){var n=this.GEOMETRY_NODE_FACTORY_(e,r);n&&(t.appendChild(n),this.writeCurveOrLineString(n,e,r))},e.prototype.writeMultiCurveOrLineString=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName,s=n.curve;o&&t.setAttribute("srsName",o);var a=e.getLineStrings();Tut({node:t,hasZ:i,srsName:o,curve:s},this.LINESTRINGORCURVEMEMBER_SERIALIZERS,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,a,r,void 0,this)},e.prototype.writeGeometryElement=function(t,e,r){var n,i=r[r.length-1],o=b({},i);o.node=t,n=Array.isArray(e)?Zc(e,i):Yc(e,!0,i),Tut(o,this.GEOMETRY_SERIALIZERS,this.GEOMETRY_NODE_FACTORY_,[n],r,void 0,this)},e.prototype.createCoordinatesNode_=function(t){var e=put(t,"coordinates");return e.setAttribute("decimal","."),e.setAttribute("cs",","),e.setAttribute("ts"," "),e},e.prototype.writeCoordinates_=function(t,e,r){for(var n=r[r.length-1],i=n.hasZ,o=n.srsName,s=e.getCoordinates(),a=s.length,l=new Array(a),u=0;u<a;++u){var h=s[u];l[u]=this.getCoords_(h,o,i)}Wut(t,l.join(" "))},e.prototype.writeCurveSegments_=function(t,e,r){var n=put(t.namespaceURI,"LineStringSegment");t.appendChild(n),this.writeCurveOrLineString(n,e,r)},e.prototype.writeSurfaceOrPolygon=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName;if("PolygonPatch"!==t.nodeName&&o&&t.setAttribute("srsName",o),"Polygon"===t.nodeName||"PolygonPatch"===t.nodeName){var s=e.getLinearRings();Tut({node:t,hasZ:i,srsName:o},this.RING_SERIALIZERS,this.RING_NODE_FACTORY_,s,r,void 0,this)}else if("Surface"===t.nodeName){var a=put(t.namespaceURI,"patches");t.appendChild(a),this.writeSurfacePatches_(a,e,r)}},e.prototype.RING_NODE_FACTORY_=function(t,e,r){var n=e[e.length-1],i=n.node,o=n.exteriorWritten;return void 0===o&&(n.exteriorWritten=!0),put(i.namespaceURI,void 0!==o?"innerBoundaryIs":"outerBoundaryIs")},e.prototype.writeSurfacePatches_=function(t,e,r){var n=put(t.namespaceURI,"PolygonPatch");t.appendChild(n),this.writeSurfaceOrPolygon(n,e,r)},e.prototype.writeRing=function(t,e,r){var n=put(t.namespaceURI,"LinearRing");t.appendChild(n),this.writeLinearRing(n,e,r)},e.prototype.getCoords_=function(t,e,r){var n="enu";e&&(n=nr(e).getAxisOrientation());var i="en"===n.substr(0,2)?t[0]+","+t[1]:t[1]+","+t[0];return r&&(i+=","+(t[2]||0)),i},e.prototype.writePoint=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName;o&&t.setAttribute("srsName",o);var s=this.createCoordinatesNode_(t.namespaceURI);t.appendChild(s);var a=e.getCoordinates();Wut(s,this.getCoords_(a,o,i))},e.prototype.writeMultiPoint=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName;o&&t.setAttribute("srsName",o);var s=e.getPoints();Tut({node:t,hasZ:i,srsName:o},this.POINTMEMBER_SERIALIZERS,Eut("pointMember"),s,r,void 0,this)},e.prototype.writePointMember=function(t,e,r){var n=put(t.namespaceURI,"Point");t.appendChild(n),this.writePoint(n,e,r)},e.prototype.writeLinearRing=function(t,e,r){var n=r[r.length-1].srsName;n&&t.setAttribute("srsName",n);var i=this.createCoordinatesNode_(t.namespaceURI);t.appendChild(i),this.writeCoordinates_(i,e,r)},e.prototype.writeMultiSurfaceOrPolygon=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName,s=n.surface;o&&t.setAttribute("srsName",o);var a=e.getPolygons();Tut({node:t,hasZ:i,srsName:o,surface:s},this.SURFACEORPOLYGONMEMBER_SERIALIZERS,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,a,r,void 0,this)},e.prototype.writeSurfaceOrPolygonMember=function(t,e,r){var n=this.GEOMETRY_NODE_FACTORY_(e,r);n&&(t.appendChild(n),this.writeSurfaceOrPolygon(n,e,r))},e.prototype.writeEnvelope=function(t,e,r){var n=r[r.length-1].srsName;n&&t.setAttribute("srsName",n);var i=[e[0]+" "+e[1],e[2]+" "+e[3]];Tut({node:t},this.ENVELOPE_SERIALIZERS,Cut,i,r,["lowerCorner","upperCorner"],this)},e.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_=function(t,e,r){var n=e[e.length-1].node;return put("http://www.opengis.net/gml",Zut[n.nodeName])},e}(Gut);Jut.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{coordinates:wut(Jut.prototype.readFlatCoordinates)}},Jut.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{innerBoundaryIs:Jut.prototype.innerBoundaryIsParser,outerBoundaryIs:Jut.prototype.outerBoundaryIsParser}},Jut.prototype.BOX_PARSERS_={"http://www.opengis.net/gml":{coordinates:_ut(Jut.prototype.readFlatCoordinates)}},Jut.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{Point:wut(Gut.prototype.readPoint),MultiPoint:wut(Gut.prototype.readMultiPoint),LineString:wut(Gut.prototype.readLineString),MultiLineString:wut(Gut.prototype.readMultiLineString),LinearRing:wut(Gut.prototype.readLinearRing),Polygon:wut(Gut.prototype.readPolygon),MultiPolygon:wut(Gut.prototype.readMultiPolygon),Box:wut(Jut.prototype.readBox)}},Jut.prototype.GEOMETRY_SERIALIZERS={"http://www.opengis.net/gml":{Curve:xut(Jut.prototype.writeCurveOrLineString),MultiCurve:xut(Jut.prototype.writeMultiCurveOrLineString),Point:xut(Jut.prototype.writePoint),MultiPoint:xut(Jut.prototype.writeMultiPoint),LineString:xut(Jut.prototype.writeCurveOrLineString),MultiLineString:xut(Jut.prototype.writeMultiCurveOrLineString),LinearRing:xut(Jut.prototype.writeLinearRing),Polygon:xut(Jut.prototype.writeSurfaceOrPolygon),MultiPolygon:xut(Jut.prototype.writeMultiSurfaceOrPolygon),Surface:xut(Jut.prototype.writeSurfaceOrPolygon),MultiSurface:xut(Jut.prototype.writeMultiSurfaceOrPolygon),Envelope:xut(Jut.prototype.writeEnvelope)}},Jut.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{lineStringMember:xut(Jut.prototype.writeLineStringOrCurveMember),curveMember:xut(Jut.prototype.writeLineStringOrCurveMember)}},Jut.prototype.RING_SERIALIZERS={"http://www.opengis.net/gml":{outerBoundaryIs:xut(Jut.prototype.writeRing),innerBoundaryIs:xut(Jut.prototype.writeRing)}},Jut.prototype.POINTMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{pointMember:xut(Jut.prototype.writePointMember)}},Jut.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{surfaceMember:xut(Jut.prototype.writeSurfaceOrPolygonMember),polygonMember:xut(Jut.prototype.writeSurfaceOrPolygonMember)}},Jut.prototype.ENVELOPE_SERIALIZERS={"http://www.opengis.net/gml":{lowerCorner:xut(Wut),upperCorner:xut(Wut)}};const $ut=Jut;var tht=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),eht=kut+" http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd",rht={MultiLineString:"lineStringMember",MultiCurve:"curveMember",MultiPolygon:"polygonMember",MultiSurface:"surfaceMember"},nht=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,n)||this).surface_=void 0!==n.surface&&n.surface,r.curve_=void 0!==n.curve&&n.curve,r.multiCurve_=void 0===n.multiCurve||n.multiCurve,r.multiSurface_=void 0===n.multiSurface||n.multiSurface,r.schemaLocation=n.schemaLocation?n.schemaLocation:eht,r.hasZ=void 0!==n.hasZ&&n.hasZ,r}return tht(e,t),e.prototype.readMultiCurve=function(t,e){var r=Put([],this.MULTICURVE_PARSERS,t,e,this);return r?new Ju(r):void 0},e.prototype.readFlatCurveRing=function(t,e){for(var r=Put([],this.MULTICURVE_PARSERS,t,e,this),n=[],i=0,o=r.length;i<o;++i)y(n,r[i].getFlatCoordinates());return n},e.prototype.readMultiSurface=function(t,e){var r=Put([],this.MULTISURFACE_PARSERS,t,e,this);if(r)return new oh(r)},e.prototype.curveMemberParser=function(t,e){Iut(this.CURVEMEMBER_PARSERS,t,e,this)},e.prototype.surfaceMemberParser=function(t,e){Iut(this.SURFACEMEMBER_PARSERS,t,e,this)},e.prototype.readPatch=function(t,e){return Put([null],this.PATCHES_PARSERS,t,e,this)},e.prototype.readSegment=function(t,e){return Put([],this.SEGMENTS_PARSERS,t,e,this)},e.prototype.readPolygonPatch=function(t,e){return Put([null],this.FLAT_LINEAR_RINGS_PARSERS,t,e,this)},e.prototype.readLineStringSegment=function(t,e){return Put([null],this.GEOMETRY_FLAT_COORDINATES_PARSERS,t,e,this)},e.prototype.interiorParser=function(t,e){var r=Put(void 0,this.RING_PARSERS,t,e,this);r&&e[e.length-1].push(r)},e.prototype.exteriorParser=function(t,e){var r=Put(void 0,this.RING_PARSERS,t,e,this);r&&(e[e.length-1][0]=r)},e.prototype.readSurface=function(t,e){var r=Put([null],this.SURFACE_PARSERS,t,e,this);if(r&&r[0]){var n,i=r[0],o=[i.length],s=void 0;for(s=1,n=r.length;s<n;++s)y(i,r[s]),o.push(i.length);return new bn(i,Y.XYZ,o)}},e.prototype.readCurve=function(t,e){var r=Put([null],this.CURVE_PARSERS,t,e,this);return r?new Nn(r,Y.XYZ):void 0},e.prototype.readEnvelope=function(t,e){var r=Put([null],this.ENVELOPE_PARSERS,t,e,this);return Mt(r[1][0],r[1][1],r[2][0],r[2][1])},e.prototype.readFlatPos=function(t,e){for(var r,n=dut(t,!1),i=/^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/,o=[];r=i.exec(n);)o.push(parseFloat(r[1])),n=n.substr(r[0].length);if(""===n){var s=e[0].srsName,a="enu";if(s&&(a=nr(s).getAxisOrientation()),"neu"===a){var l,u=void 0;for(u=0,l=o.length;u<l;u+=3){var h=o[u],c=o[u+1];o[u]=c,o[u+1]=h}}var A=o.length;if(2==A&&o.push(0),0!==A)return o}},e.prototype.readFlatPosList=function(t,e){var r=dut(t,!1).replace(/^\s*|\s*$/g,""),n=e[0],i=n.srsName,o=n.srsDimension,s="enu";i&&(s=nr(i).getAxisOrientation());var a,l,u,h=r.split(/\s+/),c=2;t.getAttribute("srsDimension")?c=zut(t.getAttribute("srsDimension")):t.getAttribute("dimension")?c=zut(t.getAttribute("dimension")):t.parentNode.getAttribute("srsDimension")?c=zut(t.parentNode.getAttribute("srsDimension")):o&&(c=zut(o));for(var A=[],f=0,p=h.length;f<p;f+=c)a=parseFloat(h[f]),l=parseFloat(h[f+1]),u=3===c?parseFloat(h[f+2]):0,"en"===s.substr(0,2)?A.push(a,l,u):A.push(l,a,u);return A},e.prototype.writePos_=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=i?"3":"2";t.setAttribute("srsDimension",o);var s=n.srsName,a="enu";s&&(a=nr(s).getAxisOrientation());var l,u=e.getCoordinates();l="en"===a.substr(0,2)?u[0]+" "+u[1]:u[1]+" "+u[0],i&&(l+=" "+(u[2]||0)),Wut(t,l)},e.prototype.getCoords_=function(t,e,r){var n="enu";e&&(n=nr(e).getAxisOrientation());var i="en"===n.substr(0,2)?t[0]+" "+t[1]:t[1]+" "+t[0];return r&&(i+=" "+(t[2]||0)),i},e.prototype.writePosList_=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=i?"3":"2";t.setAttribute("srsDimension",o);for(var s,a=n.srsName,l=e.getCoordinates(),u=l.length,h=new Array(u),c=0;c<u;++c)s=l[c],h[c]=this.getCoords_(s,a,i);Wut(t,h.join(" "))},e.prototype.writePoint=function(t,e,r){var n=r[r.length-1].srsName;n&&t.setAttribute("srsName",n);var i=put(t.namespaceURI,"pos");t.appendChild(i),this.writePos_(i,e,r)},e.prototype.writeEnvelope=function(t,e,r){var n=r[r.length-1].srsName;n&&t.setAttribute("srsName",n);var i=[e[0]+" "+e[1],e[2]+" "+e[3]];Tut({node:t},this.ENVELOPE_SERIALIZERS,Cut,i,r,["lowerCorner","upperCorner"],this)},e.prototype.writeLinearRing=function(t,e,r){var n=r[r.length-1].srsName;n&&t.setAttribute("srsName",n);var i=put(t.namespaceURI,"posList");t.appendChild(i),this.writePosList_(i,e,r)},e.prototype.RING_NODE_FACTORY_=function(t,e,r){var n=e[e.length-1],i=n.node,o=n.exteriorWritten;return void 0===o&&(n.exteriorWritten=!0),put(i.namespaceURI,void 0!==o?"interior":"exterior")},e.prototype.writeSurfaceOrPolygon=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName;if("PolygonPatch"!==t.nodeName&&o&&t.setAttribute("srsName",o),"Polygon"===t.nodeName||"PolygonPatch"===t.nodeName){var s=e.getLinearRings();Tut({node:t,hasZ:i,srsName:o},this.RING_SERIALIZERS,this.RING_NODE_FACTORY_,s,r,void 0,this)}else if("Surface"===t.nodeName){var a=put(t.namespaceURI,"patches");t.appendChild(a),this.writeSurfacePatches_(a,e,r)}},e.prototype.writeCurveOrLineString=function(t,e,r){var n=r[r.length-1].srsName;if("LineStringSegment"!==t.nodeName&&n&&t.setAttribute("srsName",n),"LineString"===t.nodeName||"LineStringSegment"===t.nodeName){var i=put(t.namespaceURI,"posList");t.appendChild(i),this.writePosList_(i,e,r)}else if("Curve"===t.nodeName){var o=put(t.namespaceURI,"segments");t.appendChild(o),this.writeCurveSegments_(o,e,r)}},e.prototype.writeMultiSurfaceOrPolygon=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName,s=n.surface;o&&t.setAttribute("srsName",o);var a=e.getPolygons();Tut({node:t,hasZ:i,srsName:o,surface:s},this.SURFACEORPOLYGONMEMBER_SERIALIZERS,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,a,r,void 0,this)},e.prototype.writeMultiPoint=function(t,e,r){var n=r[r.length-1],i=n.srsName,o=n.hasZ;i&&t.setAttribute("srsName",i);var s=e.getPoints();Tut({node:t,hasZ:o,srsName:i},this.POINTMEMBER_SERIALIZERS,Eut("pointMember"),s,r,void 0,this)},e.prototype.writeMultiCurveOrLineString=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName,s=n.curve;o&&t.setAttribute("srsName",o);var a=e.getLineStrings();Tut({node:t,hasZ:i,srsName:o,curve:s},this.LINESTRINGORCURVEMEMBER_SERIALIZERS,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,a,r,void 0,this)},e.prototype.writeRing=function(t,e,r){var n=put(t.namespaceURI,"LinearRing");t.appendChild(n),this.writeLinearRing(n,e,r)},e.prototype.writeSurfaceOrPolygonMember=function(t,e,r){var n=this.GEOMETRY_NODE_FACTORY_(e,r);n&&(t.appendChild(n),this.writeSurfaceOrPolygon(n,e,r))},e.prototype.writePointMember=function(t,e,r){var n=put(t.namespaceURI,"Point");t.appendChild(n),this.writePoint(n,e,r)},e.prototype.writeLineStringOrCurveMember=function(t,e,r){var n=this.GEOMETRY_NODE_FACTORY_(e,r);n&&(t.appendChild(n),this.writeCurveOrLineString(n,e,r))},e.prototype.writeSurfacePatches_=function(t,e,r){var n=put(t.namespaceURI,"PolygonPatch");t.appendChild(n),this.writeSurfaceOrPolygon(n,e,r)},e.prototype.writeCurveSegments_=function(t,e,r){var n=put(t.namespaceURI,"LineStringSegment");t.appendChild(n),this.writeCurveOrLineString(n,e,r)},e.prototype.writeGeometryElement=function(t,e,r){var n,i=r[r.length-1],o=b({},i);o.node=t,n=Array.isArray(e)?Zc(e,i):Yc(e,!0,i),Tut(o,this.GEOMETRY_SERIALIZERS,this.GEOMETRY_NODE_FACTORY_,[n],r,void 0,this)},e.prototype.writeFeatureElement=function(t,e,r){var n=e.getId();n&&t.setAttribute("fid",n);var i=r[r.length-1],o=i.featureNS,s=e.getGeometryName();i.serializers||(i.serializers={},i.serializers[o]={});var a=[],l=[];if(e.hasProperties()){var u=e.getProperties();for(var h in u){var c=u[h];null!==c&&(a.push(h),l.push(c),h==s||"function"==typeof c.getSimplifiedGeometry?h in i.serializers[o]||(i.serializers[o][h]=xut(this.writeGeometryElement,this)):h in i.serializers[o]||(i.serializers[o][h]=xut(Wut)))}}var A=b({},i);A.node=t,Tut(A,i.serializers,Eut(void 0,o),l,r,a)},e.prototype.writeFeatureMembers_=function(t,e,r){var n=r[r.length-1],i=n.featureType,o=n.featureNS,s={};s[o]={},s[o][i]=xut(this.writeFeatureElement,this);var a=b({},n);a.node=t,Tut(a,s,Eut(i,o),e,r)},e.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_=function(t,e,r){var n=e[e.length-1].node;return put(this.namespace,rht[n.nodeName])},e.prototype.GEOMETRY_NODE_FACTORY_=function(t,e,r){var n,i=e[e.length-1],o=i.multiSurface,s=i.surface,a=i.curve,l=i.multiCurve;return Array.isArray(t)?n="Envelope":"MultiPolygon"===(n=t.getType())&&!0===o?n="MultiSurface":"Polygon"===n&&!0===s?n="Surface":"LineString"===n&&!0===a?n="Curve":"MultiLineString"===n&&!0===l&&(n="MultiCurve"),put(this.namespace,n)},e.prototype.writeGeometryNode=function(t,e){e=this.adaptOptions(e);var r=put(this.namespace,"geom"),n={node:r,hasZ:this.hasZ,srsName:this.srsName,curve:this.curve_,surface:this.surface_,multiSurface:this.multiSurface_,multiCurve:this.multiCurve_};return e&&b(n,e),this.writeGeometryElement(r,t,[n]),r},e.prototype.writeFeaturesNode=function(t,e){e=this.adaptOptions(e);var r=put(this.namespace,"featureMembers");r.setAttributeNS(fut,"xsi:schemaLocation",this.schemaLocation);var n={srsName:this.srsName,hasZ:this.hasZ,curve:this.curve_,surface:this.surface_,multiSurface:this.multiSurface_,multiCurve:this.multiCurve_,featureNS:this.featureNS,featureType:this.featureType};return e&&b(n,e),this.writeFeatureMembers_(r,t,[n]),r},e}(Gut);nht.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{pos:wut(nht.prototype.readFlatPos),posList:wut(nht.prototype.readFlatPosList),coordinates:wut($ut.prototype.readFlatCoordinates)}},nht.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{interior:nht.prototype.interiorParser,exterior:nht.prototype.exteriorParser}},nht.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{Point:wut(Gut.prototype.readPoint),MultiPoint:wut(Gut.prototype.readMultiPoint),LineString:wut(Gut.prototype.readLineString),MultiLineString:wut(Gut.prototype.readMultiLineString),LinearRing:wut(Gut.prototype.readLinearRing),Polygon:wut(Gut.prototype.readPolygon),MultiPolygon:wut(Gut.prototype.readMultiPolygon),Surface:wut(nht.prototype.readSurface),MultiSurface:wut(nht.prototype.readMultiSurface),Curve:wut(nht.prototype.readCurve),MultiCurve:wut(nht.prototype.readMultiCurve),Envelope:wut(nht.prototype.readEnvelope)}},nht.prototype.MULTICURVE_PARSERS={"http://www.opengis.net/gml":{curveMember:_ut(nht.prototype.curveMemberParser),curveMembers:_ut(nht.prototype.curveMemberParser)}},nht.prototype.MULTISURFACE_PARSERS={"http://www.opengis.net/gml":{surfaceMember:_ut(nht.prototype.surfaceMemberParser),surfaceMembers:_ut(nht.prototype.surfaceMemberParser)}},nht.prototype.CURVEMEMBER_PARSERS={"http://www.opengis.net/gml":{LineString:_ut(Gut.prototype.readLineString),Curve:_ut(nht.prototype.readCurve)}},nht.prototype.SURFACEMEMBER_PARSERS={"http://www.opengis.net/gml":{Polygon:_ut(Gut.prototype.readPolygon),Surface:_ut(nht.prototype.readSurface)}},nht.prototype.SURFACE_PARSERS={"http://www.opengis.net/gml":{patches:wut(nht.prototype.readPatch)}},nht.prototype.CURVE_PARSERS={"http://www.opengis.net/gml":{segments:wut(nht.prototype.readSegment)}},nht.prototype.ENVELOPE_PARSERS={"http://www.opengis.net/gml":{lowerCorner:_ut(nht.prototype.readFlatPosList),upperCorner:_ut(nht.prototype.readFlatPosList)}},nht.prototype.PATCHES_PARSERS={"http://www.opengis.net/gml":{PolygonPatch:wut(nht.prototype.readPolygonPatch)}},nht.prototype.SEGMENTS_PARSERS={"http://www.opengis.net/gml":{LineStringSegment:vut(nht.prototype.readLineStringSegment)}},Gut.prototype.RING_PARSERS={"http://www.opengis.net/gml":{LinearRing:wut(Gut.prototype.readFlatLinearRing),Ring:wut(nht.prototype.readFlatCurveRing)}},nht.prototype.writeFeatures,nht.prototype.RING_SERIALIZERS={"http://www.opengis.net/gml":{exterior:xut(nht.prototype.writeRing),interior:xut(nht.prototype.writeRing)}},nht.prototype.ENVELOPE_SERIALIZERS={"http://www.opengis.net/gml":{lowerCorner:xut(Wut),upperCorner:xut(Wut)}},nht.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{surfaceMember:xut(nht.prototype.writeSurfaceOrPolygonMember),polygonMember:xut(nht.prototype.writeSurfaceOrPolygonMember)}},nht.prototype.POINTMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{pointMember:xut(nht.prototype.writePointMember)}},nht.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{lineStringMember:xut(nht.prototype.writeLineStringOrCurveMember),curveMember:xut(nht.prototype.writeLineStringOrCurveMember)}},nht.prototype.GEOMETRY_SERIALIZERS={"http://www.opengis.net/gml":{Curve:xut(nht.prototype.writeCurveOrLineString),MultiCurve:xut(nht.prototype.writeMultiCurveOrLineString),Point:xut(nht.prototype.writePoint),MultiPoint:xut(nht.prototype.writeMultiPoint),LineString:xut(nht.prototype.writeCurveOrLineString),MultiLineString:xut(nht.prototype.writeMultiCurveOrLineString),LinearRing:xut(nht.prototype.writeLinearRing),Polygon:xut(nht.prototype.writeSurfaceOrPolygon),MultiPolygon:xut(nht.prototype.writeMultiSurfaceOrPolygon),Surface:xut(nht.prototype.writeSurfaceOrPolygon),MultiSurface:xut(nht.prototype.writeMultiSurfaceOrPolygon),Envelope:xut(nht.prototype.writeEnvelope)}};const iht=nht;var oht,sht,aht,lht,uht,hht,cht,Aht,fht,pht=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),dht=["http://www.google.com/kml/ext/2.2"],ght=[null,"http://earth.google.com/kml/2.0","http://earth.google.com/kml/2.1","http://earth.google.com/kml/2.2","http://www.opengis.net/kml/2.2"],yht={fraction:_s.FRACTION,pixels:_s.PIXELS,insetPixels:_s.PIXELS},mht=But(ght,{ExtendedData:Act,Region:fct,MultiGeometry:but(nct,"geometry"),LineString:but(tct,"geometry"),LinearRing:but(ect,"geometry"),Point:but(ict,"geometry"),Polygon:but(sct,"geometry"),Style:but(lct),StyleMap:function(t,e){var r=Ght.call(this,t,e);if(r){var n=e[e.length-1];Array.isArray(r)?n.Style=r:"string"==typeof r?n.styleUrl=r:K(!1,38)}},address:but(Vut),description:but(Vut),name:but(Vut),open:but(Qut),phoneNumber:but(Vut),styleUrl:but(kht),visibility:but(Qut)},But(dht,{MultiTrack:but((function(t,e){var r=Put([],qht,t,e);if(r)return new Ju(r)}),"geometry"),Track:but(Xht,"geometry")})),vht=But(ght,{ExtendedData:Act,Region:fct,Link:function(t,e){Iut(_ht,t,e)},address:but(Vut),description:but(Vut),name:but(Vut),open:but(Qut),phoneNumber:but(Vut),visibility:but(Qut)}),_ht=But(ght,{href:but(Rht)}),wht=But(ght,{LatLonAltBox:function(t,e){var r=Put({},gct,t,e);if(r){var n=e[e.length-1],i=[parseFloat(r.west),parseFloat(r.south),parseFloat(r.east),parseFloat(r.north)];n.extent=i,n.altitudeMode=r.altitudeMode,n.minAltitude=parseFloat(r.minAltitude),n.maxAltitude=parseFloat(r.maxAltitude)}},Lod:function(t,e){var r=Put({},yct,t,e);if(r){var n=e[e.length-1];n.minLodPixels=parseFloat(r.minLodPixels),n.maxLodPixels=parseFloat(r.maxLodPixels),n.minFadeExtent=parseFloat(r.minFadeExtent),n.maxFadeExtent=parseFloat(r.maxFadeExtent)}}}),bht=But(ght,["Document","Placemark"]),xht=But(ght,{Document:xut((function(t,e,r){Tut({node:t},bct,xct,e,r,void 0,this)})),Placemark:xut(qct)}),Eht=null,Cht=null,Sht=null,Bht=null,Iht=null,Pht=null;function Tht(t){return 32/Math.min(t[0],t[1])}function Fht(t){return t}var Mht=function(t){function e(e){var r=t.call(this)||this,n=e||{};return Pht||(Eht=new Tn({color:oht=[255,255,255,1]}),sht=[20,2],aht=_s.PIXELS,lht=_s.PIXELS,uht=[64,64],hht="https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png",Cht=new Ns({anchor:sht,anchorOrigin:ws.BOTTOM_LEFT,anchorXUnits:aht,anchorYUnits:lht,crossOrigin:"anonymous",rotation:0,scale:Tht(uht),size:uht,src:hht}),cht="NO_IMAGE",Sht=new Rn({color:oht,width:1}),Aht=new Rn({color:[51,51,51,1],width:2}),Bht=new Vi({font:"bold 16px Helvetica",fill:Eht,stroke:Aht,scale:.8}),Iht=new ji({fill:Eht,image:Cht,text:Bht,stroke:Sht,zIndex:0}),Pht=[Iht]),r.dataProjection=nr("EPSG:4326"),r.defaultStyle_=n.defaultStyle?n.defaultStyle:Pht,r.extractStyles_=void 0===n.extractStyles||n.extractStyles,r.writeStyles_=void 0===n.writeStyles||n.writeStyles,r.sharedStyles_={},r.showPointNames_=void 0===n.showPointNames||n.showPointNames,r.crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:"anonymous",r.iconUrlFunction_=n.iconUrlFunction?n.iconUrlFunction:Fht,r.supportedMediaTypes=["application/vnd.google-earth.kml+xml"],r}return pht(e,t),e.prototype.readDocumentOrFolder_=function(t,e){return Put([],But(ght,{Document:vut(this.readDocumentOrFolder_,this),Folder:vut(this.readDocumentOrFolder_,this),Placemark:_ut(this.readPlacemark_,this),Style:this.readSharedStyle_.bind(this),StyleMap:this.readSharedStyleMap_.bind(this)}),t,e,this)||void 0},e.prototype.readPlacemark_=function(t,e){var r,n,i,o,s,a=Put({geometry:null},mht,t,e,this);if(a){var l=new X,u=t.getAttribute("id");null!==u&&l.setId(u);var h=e[0],c=a.geometry;if(c&&Yc(c,!1,h),l.setGeometry(c),delete a.geometry,this.extractStyles_){var A=(r=a.Style,n=a.styleUrl,i=this.defaultStyle_,o=this.sharedStyles_,s=this.showPointNames_,function(t,e){var a=s,l="",u=[];if(a){var h=t.getGeometry();if(h)if(h instanceof EA)a=(u=h.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return"Point"===e||"MultiPoint"===e}))).length>0;else{var c=h.getType();a="Point"===c||"MultiPoint"===c}}a&&(l=t.get("name"),(a=a&&!!l)&&l.search(/&[^&]+;/)>-1&&(fht||(fht=document.createElement("textarea")),fht.innerHTML=l,l=fht.value));var A=i;if(r?A=r:n&&(A=Lht(n,i,o)),a){var f=function(t,e){var r=[0,0],n="start",i=t.getImage();if(i){var o=i.getSize();if(o&&2==o.length){var s=i.getScaleArray(),a=i.getAnchor();r[0]=s[0]*(o[0]-a[0]),r[1]=s[1]*(o[1]/2-a[1]),n="left"}}var l=t.getText();return l?((l=l.clone()).setFont(l.getFont()||Bht.getFont()),l.setScale(l.getScale()||Bht.getScale()),l.setFill(l.getFill()||Bht.getFill()),l.setStroke(l.getStroke()||Aht)):l=Bht.clone(),l.setText(e),l.setOffsetX(r[0]),l.setOffsetY(r[1]),l.setTextAlign(n),new ji({image:i,text:l})}(A[0],l);return u.length>0?(f.setGeometry(new EA(u)),[f,new ji({geometry:A[0].getGeometry(),image:null,fill:A[0].getFill(),stroke:A[0].getStroke(),text:null})].concat(A.slice(1))):f}return A});l.setStyle(A)}return delete a.Style,l.setProperties(a,!0),l}},e.prototype.readSharedStyle_=function(t,e){var r=t.getAttribute("id");if(null!==r){var n=lct.call(this,t,e);if(n){var i,o=t.baseURI;o&&"about:blank"!=o||(o=window.location.href),i=o?new URL("#"+r,o).href:"#"+r,this.sharedStyles_[i]=n}}},e.prototype.readSharedStyleMap_=function(t,e){var r=t.getAttribute("id");if(null!==r){var n=Ght.call(this,t,e);if(n){var i,o=t.baseURI;o&&"about:blank"!=o||(o=window.location.href),i=o?new URL("#"+r,o).href:"#"+r,this.sharedStyles_[i]=n}}},e.prototype.readFeatureFromNode=function(t,e){return p(ght,t.namespaceURI)&&this.readPlacemark_(t,[this.getReadOptions(t,e)])||null},e.prototype.readFeaturesFromNode=function(t,e){if(!p(ght,t.namespaceURI))return[];var r,n=t.localName;if("Document"==n||"Folder"==n)return(r=this.readDocumentOrFolder_(t,[this.getReadOptions(t,e)]))||[];if("Placemark"==n){var i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i?[i]:[]}if("kml"==n){r=[];for(var o=t.firstElementChild;o;o=o.nextElementSibling){var s=this.readFeaturesFromNode(o,e);s&&y(r,s)}return r}return[]},e.prototype.readName=function(t){if(t){if("string"==typeof t){var e=mut(t);return this.readNameFromDocument(e)}return yut(t)?this.readNameFromDocument(t):this.readNameFromNode(t)}},e.prototype.readNameFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE){var r=this.readNameFromNode(e);if(r)return r}},e.prototype.readNameFromNode=function(t){for(var e=t.firstElementChild;e;e=e.nextElementSibling)if(p(ght,e.namespaceURI)&&"name"==e.localName)return Vut(e);for(e=t.firstElementChild;e;e=e.nextElementSibling){var r=e.localName;if(p(ght,e.namespaceURI)&&("Document"==r||"Folder"==r||"Placemark"==r||"kml"==r)){var n=this.readNameFromNode(e);if(n)return n}}},e.prototype.readNetworkLinks=function(t){var e=[];if("string"==typeof t){var r=mut(t);y(e,this.readNetworkLinksFromDocument(r))}else yut(t)?y(e,this.readNetworkLinksFromDocument(t)):y(e,this.readNetworkLinksFromNode(t));return e},e.prototype.readNetworkLinksFromDocument=function(t){for(var e=[],r=t.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&y(e,this.readNetworkLinksFromNode(r));return e},e.prototype.readNetworkLinksFromNode=function(t){for(var e=[],r=t.firstElementChild;r;r=r.nextElementSibling)if(p(ght,r.namespaceURI)&&"NetworkLink"==r.localName){var n=Put({},vht,r,[]);e.push(n)}for(r=t.firstElementChild;r;r=r.nextElementSibling){var i=r.localName;!p(ght,r.namespaceURI)||"Document"!=i&&"Folder"!=i&&"kml"!=i||y(e,this.readNetworkLinksFromNode(r))}return e},e.prototype.readRegion=function(t){var e=[];if("string"==typeof t){var r=mut(t);y(e,this.readRegionFromDocument(r))}else yut(t)?y(e,this.readRegionFromDocument(t)):y(e,this.readRegionFromNode(t));return e},e.prototype.readRegionFromDocument=function(t){for(var e=[],r=t.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&y(e,this.readRegionFromNode(r));return e},e.prototype.readRegionFromNode=function(t){for(var e=[],r=t.firstElementChild;r;r=r.nextElementSibling)if(p(ght,r.namespaceURI)&&"Region"==r.localName){var n=Put({},wht,r,[]);e.push(n)}for(r=t.firstElementChild;r;r=r.nextElementSibling){var i=r.localName;!p(ght,r.namespaceURI)||"Document"!=i&&"Folder"!=i&&"kml"!=i||y(e,this.readRegionFromNode(r))}return e},e.prototype.writeFeaturesNode=function(t,e){e=this.adaptOptions(e);var r=put(ght[4],"kml"),n="http://www.w3.org/2000/xmlns/";r.setAttributeNS(n,"xmlns:gx",dht[0]),r.setAttributeNS(n,"xmlns:xsi",fut),r.setAttributeNS(fut,"xsi:schemaLocation","http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd");var i={node:r},o={};t.length>1?o.Document=t:1==t.length&&(o.Placemark=t[0]);var s=bht[r.namespaceURI],a=Sut(o,s);return Tut(i,xht,Cut,a,[e],s,this),r},e}(Nut);function Lht(t,e,r){return Array.isArray(t)?t:"string"==typeof t?Lht(r[t],e,r):e}function Oht(t){var e=dut(t,!1),r=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e);if(r){var n=r[1];return[parseInt(n.substr(6,2),16),parseInt(n.substr(4,2),16),parseInt(n.substr(2,2),16),parseInt(n.substr(0,2),16)/255]}}function Nht(t){var e=dut(t,!1),r=[];e=e.replace(/\s*,\s*/g,",");for(var n,i=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?),([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|,|$)(?:([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|$))?\s*/i;n=i.exec(e);){var o=parseFloat(n[1]),s=parseFloat(n[2]),a=n[3]?parseFloat(n[3]):0;r.push(o,s,a),e=e.substr(n[0].length)}if(""===e)return r}function Rht(t){var e=dut(t,!1).trim(),r=t.baseURI;return r&&"about:blank"!=r||(r=window.location.href),r?new URL(e,r).href:e}function kht(t){var e=dut(t,!1).trim().replace(/^(?!.*#)/,"#"),r=t.baseURI;return r&&"about:blank"!=r||(r=window.location.href),r?new URL(e,r).href:e}function Uht(t){return jut(t)}var Dht=But(ght,{Pair:function(t,e){var r=Put({},pct,t,e,this);if(r){var n=r.key;if(n&&"normal"==n){var i=r.styleUrl;i&&(e[e.length-1]=i);var o=r.Style;o&&(e[e.length-1]=o)}}}});function Ght(t,e){return Put(void 0,Dht,t,e,this)}var Qht=But(ght,{Icon:but((function(t,e){return Put({},Yht,t,e)||null})),color:but(Oht),heading:but(jut),hotSpot:but((function(t){var e,r=t.getAttribute("xunits"),n=t.getAttribute("yunits");return e="insetPixels"!==r?"insetPixels"!==n?ws.BOTTOM_LEFT:ws.TOP_LEFT:"insetPixels"!==n?ws.BOTTOM_RIGHT:ws.TOP_RIGHT,{x:parseFloat(t.getAttribute("x")),xunits:yht[r],y:parseFloat(t.getAttribute("y")),yunits:yht[n],origin:e}})),scale:but(Uht)}),jht=But(ght,{color:but(Oht),scale:but(Uht)}),Hht=But(ght,{color:but(Oht),width:but(jut)}),zht=But(ght,{color:but(Oht),fill:but(Qut),outline:but(Qut)}),Vht=But(ght,{coordinates:wut(Nht)});function Kht(t,e){return Put(null,Vht,t,e)}var qht=But(dht,{Track:_ut(Xht)}),Wht=But(ght,{when:function(t,e){var r=e[e.length-1].whens,n=dut(t,!1),i=Date.parse(n);r.push(isNaN(i)?0:i)}},But(dht,{coord:function(t,e){var r=e[e.length-1].coordinates,n=dut(t,!1),i=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(n);if(i){var o=parseFloat(i[1]),s=parseFloat(i[2]),a=parseFloat(i[3]);r.push([o,s,a])}else r.push([])}}));function Xht(t,e){var r=Put({coordinates:[],whens:[]},Wht,t,e);if(r){for(var n=[],i=r.coordinates,o=r.whens,s=0,a=Math.min(i.length,o.length);s<a;++s)3==i[s].length&&n.push(i[s][0],i[s][1],i[s][2],o[s]);return new Nn(n,Y.XYZM)}}var Yht=But(ght,{href:but(Rht)},But(dht,{x:but(jut),y:but(jut),w:but(jut),h:but(jut)})),Zht=But(ght,{coordinates:wut(Nht)});function Jht(t,e){return Put(null,Zht,t,e)}var $ht=But(ght,{extrude:but(Qut),tessellate:but(Qut),altitudeMode:but(Vut)});function tct(t,e){var r=Put({},$ht,t,e),n=Jht(t,e);if(n){var i=new Nn(n,Y.XYZ);return i.setProperties(r,!0),i}}function ect(t,e){var r=Put({},$ht,t,e),n=Jht(t,e);if(n){var i=new bn(n,Y.XYZ,[n.length]);return i.setProperties(r,!0),i}}var rct=But(ght,{LineString:_ut(tct),LinearRing:_ut(ect),MultiGeometry:_ut(nct),Point:_ut(ict),Polygon:_ut(sct)});function nct(t,e){var r,n=Put([],rct,t,e);if(!n)return null;if(0===n.length)return new EA(n);for(var i=!0,o=n[0].getType(),s=1,a=n.length;s<a;++s)if(n[s].getType()!=o){i=!1;break}if(i){var l=void 0,u=void 0;if("Point"==o){var h=n[0];for(l=h.getLayout(),u=h.getFlatCoordinates(),s=1,a=n.length;s<a;++s)y(u,n[s].getFlatCoordinates());uct(r=new eh(u,l),n)}else"LineString"==o?uct(r=new Ju(n),n):"Polygon"==o?uct(r=new oh(n),n):"GeometryCollection"==o?r=new EA(n):K(!1,37)}else r=new EA(n);return r}function ict(t,e){var r=Put({},$ht,t,e),n=Jht(t,e);if(n){var i=new nn(n,Y.XYZ);return i.setProperties(r,!0),i}}var oct=But(ght,{innerBoundaryIs:function(t,e){var r=Put([],mct,t,e);if(r.length>0){var n=e[e.length-1];n.push.apply(n,r)}},outerBoundaryIs:function(t,e){var r=Put(void 0,vct,t,e);r&&(e[e.length-1][0]=r)}});function sct(t,e){var r=Put({},$ht,t,e),n=Put([null],oct,t,e);if(n&&n[0]){for(var i=n[0],o=[i.length],s=1,a=n.length;s<a;++s)y(i,n[s]),o.push(i.length);var l=new bn(i,Y.XYZ,o);return l.setProperties(r,!0),l}}var act=But(ght,{IconStyle:function(t,e){var r=Put({},Qht,t,e);if(r){var n,i,o,s,a=e[e.length-1],l="Icon"in r?r.Icon:{},u=!("Icon"in r)||Object.keys(l).length>0,h=l.href;h?n=h:u&&(n=hht);var c,A=ws.BOTTOM_LEFT,f=r.hotSpot;f?(i=[f.x,f.y],o=f.xunits,s=f.yunits,A=f.origin):/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(n)&&(/pushpin/.test(n)?(i=sht,o=aht,s=lht):/arrow-reverse/.test(n)?(i=[54,42],o=aht,s=lht):/paddle/.test(n)&&(i=[32,1],o=aht,s=lht));var p,d=l.x,g=l.y;void 0!==d&&void 0!==g&&(c=[d,g]);var y,m=l.w,v=l.h;void 0!==m&&void 0!==v&&(p=[m,v]);var _=r.heading;void 0!==_&&(y=Ae(_));var w=r.scale,b=r.color;if(u){n==hht&&(p=uht);var x=new Ns({anchor:i,anchorOrigin:A,anchorXUnits:o,anchorYUnits:s,crossOrigin:this.crossOrigin_,offset:c,offsetOrigin:ws.BOTTOM_LEFT,rotation:y,scale:w,size:p,src:this.iconUrlFunction_(n),color:b}),E=x.getScaleArray()[0],C=x.getSize();if(null===C){var S=x.getImageState();if(S===kn.IDLE||S===kn.LOADING){var B=function(){var t=x.getImageState();if(t!==kn.IDLE&&t!==kn.LOADING){var e=x.getSize();if(e&&2==e.length){var r=Tht(e);x.setScale(E*r)}x.unlistenImageChange(B)}};x.listenImageChange(B),S===kn.IDLE&&x.load()}}else if(2==C.length){var I=Tht(C);x.setScale(E*I)}a.imageStyle=x}else a.imageStyle=cht}},LabelStyle:function(t,e){var r=Put({},jht,t,e);if(r){var n=e[e.length-1],i=new Vi({fill:new Tn({color:"color"in r?r.color:oht}),scale:r.scale});n.textStyle=i}},LineStyle:function(t,e){var r=Put({},Hht,t,e);if(r){var n=e[e.length-1],i=new Rn({color:"color"in r?r.color:oht,width:"width"in r?r.width:1});n.strokeStyle=i}},PolyStyle:function(t,e){var r=Put({},zht,t,e);if(r){var n=e[e.length-1],i=new Tn({color:"color"in r?r.color:oht});n.fillStyle=i;var o=r.fill;void 0!==o&&(n.fill=o);var s=r.outline;void 0!==s&&(n.outline=s)}}});function lct(t,e){var r=Put({},act,t,e,this);if(!r)return null;var n,i="fillStyle"in r?r.fillStyle:Eht,o=r.fill;void 0===o||o||(i=null),"imageStyle"in r?r.imageStyle!=cht&&(n=r.imageStyle):n=Cht;var s="textStyle"in r?r.textStyle:Bht,a="strokeStyle"in r?r.strokeStyle:Sht,l=r.outline;return void 0===l||l?[new ji({fill:i,image:n,stroke:a,text:s,zIndex:void 0})]:[new ji({geometry:function(t){var e=t.getGeometry(),r=e.getType();return"GeometryCollection"===r?new EA(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return"Polygon"!==e&&"MultiPolygon"!==e}))):"Polygon"!==r&&"MultiPolygon"!==r?e:void 0},fill:i,image:n,stroke:a,text:s,zIndex:void 0}),new ji({geometry:function(t){var e=t.getGeometry(),r=e.getType();return"GeometryCollection"===r?new EA(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return"Polygon"===e||"MultiPolygon"===e}))):"Polygon"===r||"MultiPolygon"===r?e:void 0},fill:i,stroke:null,zIndex:void 0})]}function uct(t,e){var r,n,i,o=e.length,s=new Array(e.length),a=new Array(e.length),l=new Array(e.length);r=!1,n=!1,i=!1;for(var u=0;u<o;++u){var h=e[u];s[u]=h.get("extrude"),a[u]=h.get("tessellate"),l[u]=h.get("altitudeMode"),r=r||void 0!==s[u],n=n||void 0!==a[u],i=i||l[u]}r&&t.set("extrude",s),n&&t.set("tessellate",a),i&&t.set("altitudeMode",l)}var hct=But(ght,{displayName:but(Vut),value:but(Vut)}),cct=But(ght,{Data:function(t,e){var r=t.getAttribute("name");Iut(hct,t,e);var n=e[e.length-1];r&&n.displayName?n[r]={value:n.value,displayName:n.displayName,toString:function(){return n.value}}:null!==r?n[r]=n.value:null!==n.displayName&&(n[n.displayName]=n.value),delete n.value},SchemaData:function(t,e){Iut(dct,t,e)}});function Act(t,e){Iut(cct,t,e)}function fct(t,e){Iut(wht,t,e)}var pct=But(ght,{Style:but(lct),key:but(Vut),styleUrl:but(kht)}),dct=But(ght,{SimpleData:function(t,e){var r=t.getAttribute("name");if(null!==r){var n=Vut(t);e[e.length-1][r]=n}}}),gct=But(ght,{altitudeMode:but(Vut),minAltitude:but(jut),maxAltitude:but(jut),north:but(jut),south:but(jut),east:but(jut),west:but(jut)}),yct=But(ght,{minLodPixels:but(jut),maxLodPixels:but(jut),minFadeExtent:but(jut),maxFadeExtent:but(jut)}),mct=But(ght,{LinearRing:_ut(Kht)}),vct=But(ght,{LinearRing:wut(Kht)});function _ct(t,e){for(var r=Wn(e),n=[255*(4==r.length?r[3]:1),r[2],r[1],r[0]],i=0;i<4;++i){var o=Math.floor(n[i]).toString(16);n[i]=1==o.length?"0"+o:o}Wut(t,n.join(""))}var wct=But(ght,{Data:xut((function(t,e,r){t.setAttribute("name",e.name);var n={node:t},i=e.value;"object"==typeof i?(null!==i&&i.displayName&&Tut(n,wct,Cut,[i.displayName],r,["displayName"]),null!==i&&i.value&&Tut(n,wct,Cut,[i.value],r,["value"])):Tut(n,wct,Cut,[i],r,["value"])})),value:xut((function(t,e){Wut(t,e)})),displayName:xut((function(t,e){!function(t,e){t.appendChild(Lut().createCDATASection(e))}(t,e)}))}),bct=But(ght,{Placemark:xut(qct)}),xct=function(t,e,r){return put(e[e.length-1].node.namespaceURI,"Placemark")},Ect=Eut("Data"),Cct=But(ght,["href"],But(dht,["x","y","w","h"])),Sct=But(ght,{href:xut(Wut)},But(dht,{x:xut(qut),y:xut(qut),w:xut(qut),h:xut(qut)})),Bct=function(t,e,r){return put(dht[0],"gx:"+r)},Ict=But(ght,["scale","heading","Icon","color","hotSpot"]),Pct=But(ght,{Icon:xut((function(t,e,r){var n={node:t},i=r[r.length-1].node,o=Cct[i.namespaceURI],s=Sut(e,o);Tut(n,Sct,Cut,s,r,o),s=Sut(e,o=Cct[dht[0]]),Tut(n,Sct,Bct,s,r,o)})),color:xut(_ct),heading:xut(qut),hotSpot:xut((function(t,e){t.setAttribute("x",String(e.x)),t.setAttribute("y",String(e.y)),t.setAttribute("xunits",e.xunits),t.setAttribute("yunits",e.yunits)})),scale:xut(nAt)}),Tct=But(ght,["color","scale"]),Fct=But(ght,{color:xut(_ct),scale:xut(nAt)}),Mct=But(ght,["color","width"]),Lct=But(ght,{color:xut(_ct),width:xut(qut)}),Oct={Point:"Point",LineString:"LineString",LinearRing:"LinearRing",Polygon:"Polygon",MultiPoint:"MultiGeometry",MultiLineString:"MultiGeometry",MultiPolygon:"MultiGeometry",GeometryCollection:"MultiGeometry"},Nct=function(t,e,r){if(t)return put(e[e.length-1].node.namespaceURI,Oct[t.getType()])},Rct=Eut("Point"),kct=Eut("LineString"),Uct=Eut("LinearRing"),Dct=Eut("Polygon"),Gct=But(ght,{LineString:xut(Yct),Point:xut(Yct),Polygon:xut(eAt),GeometryCollection:xut(Qct)});function Qct(t,e,r){var n,i={node:t},o=e.getType(),s=[];"GeometryCollection"===o?(e.getGeometriesArrayRecursive().forEach((function(t){var e=t.getType();"MultiPoint"===e?s=s.concat(t.getPoints()):"MultiLineString"===e?s=s.concat(t.getLineStrings()):"MultiPolygon"===e?s=s.concat(t.getPolygons()):"Point"===e||"LineString"===e||"Polygon"===e?s.push(t):K(!1,39)})),n=Nct):"MultiPoint"===o?(s=e.getPoints(),n=Rct):"MultiLineString"===o?(s=e.getLineStrings(),n=kct):"MultiPolygon"===o?(s=e.getPolygons(),n=Dct):K(!1,39),Tut(i,Gct,n,s,r)}var jct=But(ght,{LinearRing:xut(Yct)});function Hct(t,e,r){Tut({node:t},jct,Uct,[e],r)}var zct=But(ght,{ExtendedData:xut((function(t,e,r){for(var n={node:t},i=e.names,o=e.values,s=i.length,a=0;a<s;a++)Tut(n,wct,Ect,[{name:i[a],value:o[a]}],r)})),MultiGeometry:xut(Qct),LineString:xut(Yct),LinearRing:xut(Yct),Point:xut(Yct),Polygon:xut(eAt),Style:xut((function(t,e,r){var n,i={node:t},o={};if(e.pointStyles.length){var s=e.pointStyles[0].getText();s&&(o.LabelStyle=s);var a=e.pointStyles[0].getImage();a&&"function"==typeof a.getSrc&&(o.IconStyle=a)}e.lineStyles.length&&(n=e.lineStyles[0].getStroke())&&(o.LineStyle=n),e.polyStyles.length&&((n=e.polyStyles[0].getStroke())&&!o.LineStyle&&(o.LineStyle=n),o.PolyStyle=e.polyStyles[0]);var l=r[r.length-1].node,u=iAt[l.namespaceURI],h=Sut(o,u);Tut(i,oAt,Cut,h,r,u)})),address:xut(Wut),description:xut(Wut),name:xut(Wut),open:xut(Kut),phoneNumber:xut(Wut),styleUrl:xut(Wut),visibility:xut(Kut)}),Vct=But(ght,["name","open","visibility","address","phoneNumber","description","styleUrl","Style"]),Kct=Eut("ExtendedData");function qct(t,e,r){var n={node:t};e.getId()&&t.setAttribute("id",e.getId());var i=e.getProperties(),o={address:1,description:1,name:1,open:1,phoneNumber:1,styleUrl:1,visibility:1};o[e.getGeometryName()]=1;var s=Object.keys(i||{}).sort().filter((function(t){return!o[t]})),a=e.getStyleFunction();if(a){var l=a(e,0);if(l){var u=Array.isArray(l)?l:[l],h=u;if(e.getGeometry()&&(h=u.filter((function(t){var r=t.getGeometryFunction()(e);if(r){var n=r.getType();return"GeometryCollection"===n?r.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return"Point"===e||"MultiPoint"===e})).length:"Point"===n||"MultiPoint"===n}}))),this.writeStyles_){var c=u,A=u;e.getGeometry()&&(c=u.filter((function(t){var r=t.getGeometryFunction()(e);if(r){var n=r.getType();return"GeometryCollection"===n?r.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return"LineString"===e||"MultiLineString"===e})).length:"LineString"===n||"MultiLineString"===n}})),A=u.filter((function(t){var r=t.getGeometryFunction()(e);if(r){var n=r.getType();return"GeometryCollection"===n?r.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return"Polygon"===e||"MultiPolygon"===e})).length:"Polygon"===n||"MultiPolygon"===n}}))),i.Style={pointStyles:h,lineStyles:c,polyStyles:A}}if(h.length&&void 0===i.name){var f=h[0].getText();f&&(i.name=f.getText())}}}var p=r[r.length-1].node,d=Vct[p.namespaceURI],g=Sut(i,d);if(Tut(n,zct,Cut,g,r,d),s.length>0){var y=Sut(i,s);Tut(n,zct,Kct,[{names:s,values:y}],r)}var m=r[0],v=e.getGeometry();v&&(v=Yc(v,!0,m)),Tut(n,zct,Nct,[v],r)}var Wct=But(ght,["extrude","tessellate","altitudeMode","coordinates"]),Xct=But(ght,{extrude:xut(Kut),tessellate:xut(Kut),altitudeMode:xut(Wut),coordinates:xut((function(t,e,r){var n,i=r[r.length-1],o=i.layout,s=i.stride;o==Y.XY||o==Y.XYM?n=2:o==Y.XYZ||o==Y.XYZM?n=3:K(!1,34);var a=e.length,l="";if(a>0){l+=e[0];for(var u=1;u<n;++u)l+=","+e[u];for(var h=s;h<a;h+=s)for(l+=" "+e[h],u=1;u<n;++u)l+=","+e[h+u]}Wut(t,l)}))});function Yct(t,e,r){var n=e.getFlatCoordinates(),i={node:t};i.layout=e.getLayout(),i.stride=e.getStride();var o=e.getProperties();o.coordinates=n;var s=r[r.length-1].node,a=Wct[s.namespaceURI],l=Sut(o,a);Tut(i,Xct,Cut,l,r,a)}var Zct=But(ght,["color","fill","outline"]),Jct=But(ght,{outerBoundaryIs:xut(Hct),innerBoundaryIs:xut(Hct)}),$ct=Eut("innerBoundaryIs"),tAt=Eut("outerBoundaryIs");function eAt(t,e,r){var n=e.getLinearRings(),i=n.shift(),o={node:t};Tut(o,Jct,$ct,n,r),Tut(o,Jct,tAt,[i],r)}var rAt=But(ght,{color:xut(_ct),fill:xut(Kut),outline:xut(Kut)});function nAt(t,e){qut(t,Math.round(1e6*e)/1e6)}var iAt=But(ght,["IconStyle","LabelStyle","LineStyle","PolyStyle"]),oAt=But(ght,{IconStyle:xut((function(t,e,r){var n={node:t},i={},o=e.getSrc(),s=e.getSize(),a=e.getImageSize(),l={href:o};if(s){l.w=s[0],l.h=s[1];var u=e.getAnchor(),h=e.getOrigin();if(h&&a&&0!==h[0]&&h[1]!==s[1]&&(l.x=h[0],l.y=a[1]-(h[1]+s[1])),u&&(u[0]!==s[0]/2||u[1]!==s[1]/2)){var c={x:u[0],xunits:_s.PIXELS,y:s[1]-u[1],yunits:_s.PIXELS};i.hotSpot=c}}i.Icon=l;var A=e.getScaleArray()[0],f=s;null===f&&(f=uht),2==f.length&&(A/=Tht(f)),1!==A&&(i.scale=A);var p=e.getRotation();0!==p&&(i.heading=p);var d=e.getColor();d&&(i.color=d);var g=r[r.length-1].node,y=Ict[g.namespaceURI],m=Sut(i,y);Tut(n,Pct,Cut,m,r,y)})),LabelStyle:xut((function(t,e,r){var n={node:t},i={},o=e.getFill();o&&(i.color=o.getColor());var s=e.getScale();s&&1!==s&&(i.scale=s);var a=r[r.length-1].node,l=Tct[a.namespaceURI],u=Sut(i,l);Tut(n,Fct,Cut,u,r,l)})),LineStyle:xut((function(t,e,r){var n={node:t},i={color:e.getColor(),width:Number(e.getWidth())||1},o=r[r.length-1].node,s=Mct[o.namespaceURI],a=Sut(i,s);Tut(n,Lct,Cut,a,r,s)})),PolyStyle:xut((function(t,e,r){var n={node:t},i=e.getFill(),o=e.getStroke(),s={color:i?i.getColor():void 0,fill:!!i&&void 0,outline:!!o&&void 0},a=r[r.length-1].node,l=Zct[a.namespaceURI],u=Sut(s,l);Tut(n,rAt,Cut,u,r,l)}))});const sAt=Mht;var aAt=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),lAt=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,n)||this).schemaLocation=n.schemaLocation?n.schemaLocation:r.namespace+" http://schemas.opengis.net/gml/3.2.1/gml.xsd",r}return aAt(e,t),e}(iht);lAt.prototype.namespace="http://www.opengis.net/gml/3.2",lAt.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml/3.2":{pos:wut(iht.prototype.readFlatPos),posList:wut(iht.prototype.readFlatPosList),coordinates:wut($ut.prototype.readFlatCoordinates)}},lAt.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml/3.2":{interior:iht.prototype.interiorParser,exterior:iht.prototype.exteriorParser}},lAt.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml/3.2":{Point:wut(Gut.prototype.readPoint),MultiPoint:wut(Gut.prototype.readMultiPoint),LineString:wut(Gut.prototype.readLineString),MultiLineString:wut(Gut.prototype.readMultiLineString),LinearRing:wut(Gut.prototype.readLinearRing),Polygon:wut(Gut.prototype.readPolygon),MultiPolygon:wut(Gut.prototype.readMultiPolygon),Surface:wut(lAt.prototype.readSurface),MultiSurface:wut(iht.prototype.readMultiSurface),Curve:wut(lAt.prototype.readCurve),MultiCurve:wut(iht.prototype.readMultiCurve),Envelope:wut(lAt.prototype.readEnvelope)}},lAt.prototype.MULTICURVE_PARSERS={"http://www.opengis.net/gml/3.2":{curveMember:_ut(iht.prototype.curveMemberParser),curveMembers:_ut(iht.prototype.curveMemberParser)}},lAt.prototype.MULTISURFACE_PARSERS={"http://www.opengis.net/gml/3.2":{surfaceMember:_ut(iht.prototype.surfaceMemberParser),surfaceMembers:_ut(iht.prototype.surfaceMemberParser)}},lAt.prototype.CURVEMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{LineString:_ut(Gut.prototype.readLineString),Curve:_ut(iht.prototype.readCurve)}},lAt.prototype.SURFACEMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{Polygon:_ut(Gut.prototype.readPolygon),Surface:_ut(iht.prototype.readSurface)}},lAt.prototype.SURFACE_PARSERS={"http://www.opengis.net/gml/3.2":{patches:wut(iht.prototype.readPatch)}},lAt.prototype.CURVE_PARSERS={"http://www.opengis.net/gml/3.2":{segments:wut(iht.prototype.readSegment)}},lAt.prototype.ENVELOPE_PARSERS={"http://www.opengis.net/gml/3.2":{lowerCorner:_ut(iht.prototype.readFlatPosList),upperCorner:_ut(iht.prototype.readFlatPosList)}},lAt.prototype.PATCHES_PARSERS={"http://www.opengis.net/gml/3.2":{PolygonPatch:wut(iht.prototype.readPolygonPatch)}},lAt.prototype.SEGMENTS_PARSERS={"http://www.opengis.net/gml/3.2":{LineStringSegment:vut(iht.prototype.readLineStringSegment)}},lAt.prototype.MULTIPOINT_PARSERS={"http://www.opengis.net/gml/3.2":{pointMember:_ut(Gut.prototype.pointMemberParser),pointMembers:_ut(Gut.prototype.pointMemberParser)}},lAt.prototype.MULTILINESTRING_PARSERS={"http://www.opengis.net/gml/3.2":{lineStringMember:_ut(Gut.prototype.lineStringMemberParser),lineStringMembers:_ut(Gut.prototype.lineStringMemberParser)}},lAt.prototype.MULTIPOLYGON_PARSERS={"http://www.opengis.net/gml/3.2":{polygonMember:_ut(Gut.prototype.polygonMemberParser),polygonMembers:_ut(Gut.prototype.polygonMemberParser)}},lAt.prototype.POINTMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{Point:_ut(Gut.prototype.readFlatCoordinatesFromNode)}},lAt.prototype.LINESTRINGMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{LineString:_ut(Gut.prototype.readLineString)}},lAt.prototype.POLYGONMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{Polygon:_ut(Gut.prototype.readPolygon)}},lAt.prototype.RING_PARSERS={"http://www.opengis.net/gml/3.2":{LinearRing:wut(Gut.prototype.readFlatLinearRing),Ring:wut(lAt.prototype.readFlatCurveRing)}},lAt.prototype.RING_SERIALIZERS={"http://www.opengis.net/gml/3.2":{exterior:xut(iht.prototype.writeRing),interior:xut(iht.prototype.writeRing)}},lAt.prototype.ENVELOPE_SERIALIZERS={"http://www.opengis.net/gml/3.2":{lowerCorner:xut(Wut),upperCorner:xut(Wut)}},lAt.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS={"http://www.opengis.net/gml/3.2":{surfaceMember:xut(iht.prototype.writeSurfaceOrPolygonMember),polygonMember:xut(iht.prototype.writeSurfaceOrPolygonMember)}},lAt.prototype.POINTMEMBER_SERIALIZERS={"http://www.opengis.net/gml/3.2":{pointMember:xut(iht.prototype.writePointMember)}},lAt.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS={"http://www.opengis.net/gml/3.2":{lineStringMember:xut(iht.prototype.writeLineStringOrCurveMember),curveMember:xut(iht.prototype.writeLineStringOrCurveMember)}},lAt.prototype.GEOMETRY_SERIALIZERS={"http://www.opengis.net/gml/3.2":{Curve:xut(iht.prototype.writeCurveOrLineString),MultiCurve:xut(iht.prototype.writeMultiCurveOrLineString),Point:xut(lAt.prototype.writePoint),MultiPoint:xut(iht.prototype.writeMultiPoint),LineString:xut(iht.prototype.writeCurveOrLineString),MultiLineString:xut(iht.prototype.writeMultiCurveOrLineString),LinearRing:xut(iht.prototype.writeLinearRing),Polygon:xut(iht.prototype.writeSurfaceOrPolygon),MultiPolygon:xut(iht.prototype.writeMultiSurfaceOrPolygon),Surface:xut(iht.prototype.writeSurfaceOrPolygon),MultiSurface:xut(iht.prototype.writeMultiSurfaceOrPolygon),Envelope:xut(iht.prototype.writeEnvelope)}};const uAt=lAt,hAt=function(){function t(t){this.tagName_=t}return t.prototype.getTagName=function(){return this.tagName_},t}();var cAt=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const AAt=function(t){function e(e,r){var n=t.call(this,e)||this;return n.conditions=r,K(n.conditions.length>=2,57),n}return cAt(e,t),e}(hAt);var fAt=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const pAt=function(t){function e(e){return t.call(this,"And",Array.prototype.slice.call(arguments))||this}return fAt(e,t),e}(AAt);var dAt=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const gAt=function(t){function e(e,r,n){var i=t.call(this,"BBOX")||this;if(i.geometryName=e,i.extent=r,4!==r.length)throw new Error("Expected an extent with four values ([minX, minY, maxX, maxY])");return i.srsName=n,i}return dAt(e,t),e}(hAt);var yAt=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),mAt={"http://www.opengis.net/gml":{boundedBy:but(Gut.prototype.readExtentElement,"bounds")},"http://www.opengis.net/wfs/2.0":{member:_ut(Gut.prototype.readFeaturesInternal)}},vAt={"http://www.opengis.net/wfs":{totalInserted:but(Hut),totalUpdated:but(Hut),totalDeleted:but(Hut)},"http://www.opengis.net/wfs/2.0":{totalInserted:but(Hut),totalUpdated:but(Hut),totalDeleted:but(Hut)}},_At={"http://www.opengis.net/wfs":{TransactionSummary:but(LAt,"transactionSummary"),InsertResults:but(kAt,"insertIds")},"http://www.opengis.net/wfs/2.0":{TransactionSummary:but(LAt,"transactionSummary"),InsertResults:but(kAt,"insertIds")}},wAt={"http://www.opengis.net/wfs":{PropertyName:xut(Wut)},"http://www.opengis.net/wfs/2.0":{PropertyName:xut(Wut)}},bAt={"http://www.opengis.net/wfs":{Insert:xut(UAt),Update:xut(jAt),Delete:xut(QAt),Property:xut(HAt),Native:xut(zAt)},"http://www.opengis.net/wfs/2.0":{Insert:xut(UAt),Update:xut(jAt),Delete:xut(QAt),Property:xut(HAt),Native:xut(zAt)}},xAt="feature",EAt="http://www.w3.org/2000/xmlns/",CAt={"2.0.0":"http://www.opengis.net/ogc/1.1","1.1.0":"http://www.opengis.net/ogc","1.0.0":"http://www.opengis.net/ogc"},SAt={"2.0.0":"http://www.opengis.net/wfs/2.0","1.1.0":"http://www.opengis.net/wfs","1.0.0":"http://www.opengis.net/wfs"},BAt={"2.0.0":"http://www.opengis.net/fes/2.0","1.1.0":"http://www.opengis.net/fes","1.0.0":"http://www.opengis.net/fes"},IAt={"2.0.0":"http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd","1.1.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd","1.0.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd"},PAt={"2.0.0":uAt,"1.1.0":iht,"1.0.0":$ut},TAt="1.1.0",FAt=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.version_=n.version?n.version:TAt,r.featureType_=n.featureType,r.featureNS_=n.featureNS,r.gmlFormat_=n.gmlFormat?n.gmlFormat:new PAt[r.version_],r.schemaLocation_=n.schemaLocation?n.schemaLocation:IAt[r.version_],r}return yAt(e,t),e.prototype.getFeatureType=function(){return this.featureType_},e.prototype.setFeatureType=function(t){this.featureType_=t},e.prototype.readFeaturesFromNode=function(t,e){var r={node:t};b(r,{featureType:this.featureType_,featureNS:this.featureNS_}),b(r,this.getReadOptions(t,e||{}));var n=[r],i=Put([],"2.0.0"===this.version_?mAt:this.gmlFormat_.FEATURE_COLLECTION_PARSERS,t,n,this.gmlFormat_);return i||(i=[]),i},e.prototype.readTransactionResponse=function(t){if(t){if("string"==typeof t){var e=mut(t);return this.readTransactionResponseFromDocument(e)}return yut(t)?this.readTransactionResponseFromDocument(t):this.readTransactionResponseFromNode(t)}},e.prototype.readFeatureCollectionMetadata=function(t){if(t){if("string"==typeof t){var e=mut(t);return this.readFeatureCollectionMetadataFromDocument(e)}return yut(t)?this.readFeatureCollectionMetadataFromDocument(t):this.readFeatureCollectionMetadataFromNode(t)}},e.prototype.readFeatureCollectionMetadataFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readFeatureCollectionMetadataFromNode(e)},e.prototype.readFeatureCollectionMetadataFromNode=function(t){var e={},r=zut(t.getAttribute("numberOfFeatures"));return e.numberOfFeatures=r,Put(e,mAt,t,[],this.gmlFormat_)},e.prototype.readTransactionResponseFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readTransactionResponseFromNode(e)},e.prototype.readTransactionResponseFromNode=function(t){return Put({},_At,t,[])},e.prototype.writeGetFeature=function(t){var e=this,r=put(SAt[this.version_],"GetFeature");r.setAttribute("service","WFS"),r.setAttribute("version",this.version_),t.handle&&r.setAttribute("handle",t.handle),t.outputFormat&&r.setAttribute("outputFormat",t.outputFormat),void 0!==t.maxFeatures&&r.setAttribute("maxFeatures",String(t.maxFeatures)),t.resultType&&r.setAttribute("resultType",t.resultType),void 0!==t.startIndex&&r.setAttribute("startIndex",String(t.startIndex)),void 0!==t.count&&r.setAttribute("count",String(t.count)),void 0!==t.viewParams&&r.setAttribute("viewParams",t.viewParams),r.setAttributeNS(fut,"xsi:schemaLocation",this.schemaLocation_);var n={node:r};if(b(n,{version:this.version_,srsName:t.srsName,featureNS:t.featureNS?t.featureNS:this.featureNS_,featurePrefix:t.featurePrefix,propertyNames:t.propertyNames?t.propertyNames:[]}),K(Array.isArray(t.featureTypes),11),"string"==typeof t.featureTypes[0]){var i=t.filter;t.bbox&&(K(t.geometryName,12),i=this.combineBboxAndFilter(t.geometryName,t.bbox,t.srsName,i)),b(n,{geometryName:t.geometryName,filter:i}),aft(r,t.featureTypes,[n])}else t.featureTypes.forEach((function(i){var o=e.combineBboxAndFilter(i.geometryName,i.bbox,t.srsName,t.filter);b(n,{geometryName:i.geometryName,filter:o}),aft(r,[i.name],[n])}));return r},e.prototype.combineBboxAndFilter=function(t,e,r,n){var i=function(t,e,r){return new gAt(t,e,r)}(t,e,r);return n?function(t){var e=[null].concat(Array.prototype.slice.call(arguments));return new(Function.prototype.bind.apply(pAt,e))}(n,i):i},e.prototype.writeTransaction=function(t,e,r,n){var i,o=[],s=n.version?n.version:this.version_,a=put(SAt[s],"Transaction");a.setAttribute("service","WFS"),a.setAttribute("version",s),n&&(i=n.gmlOptions?n.gmlOptions:{},n.handle&&a.setAttribute("handle",n.handle)),a.setAttributeNS(fut,"xsi:schemaLocation",IAt[s]);var l=function(t,e,r,n){var i,o=n.featurePrefix?n.featurePrefix:xAt;return"1.0.0"===r?i=2:"1.1.0"===r?i=3:"2.0.0"===r&&(i=3.2),b({node:t},{version:r,featureNS:n.featureNS,featureType:n.featureType,featurePrefix:o,gmlVersion:i,hasZ:n.hasZ,srsName:n.srsName},e)}(a,i,s,n);return t&&MAt("Insert",t,o,l),e&&MAt("Update",e,o,l),r&&MAt("Delete",r,o,l),n.nativeElements&&MAt("Native",n.nativeElements,o,l),a},e.prototype.readProjectionFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readProjectionFromNode(e);return null},e.prototype.readProjectionFromNode=function(t){if(t.firstElementChild&&t.firstElementChild.firstElementChild)for(var e=(t=t.firstElementChild.firstElementChild).firstElementChild;e;e=e.nextElementSibling)if(0!==e.childNodes.length&&(1!==e.childNodes.length||3!==e.firstChild.nodeType)){var r=[{}];return this.gmlFormat_.readGeometryElement(e,r),nr(r.pop().srsName)}return null},e}(Nut);function MAt(t,e,r,n){Tut(n,bAt,Eut(t),e,r)}function LAt(t,e){return Put({},vAt,t,e)}var OAt={"http://www.opengis.net/ogc":{FeatureId:_ut((function(t,e){return t.getAttribute("fid")}))},"http://www.opengis.net/ogc/1.1":{FeatureId:_ut((function(t,e){return t.getAttribute("fid")}))}};function NAt(t,e){Iut(OAt,t,e)}var RAt={"http://www.opengis.net/wfs":{Feature:NAt},"http://www.opengis.net/wfs/2.0":{Feature:NAt}};function kAt(t,e){return Put([],RAt,t,e)}function UAt(t,e,r){var n=r[r.length-1],i=n.featureType,o=n.featureNS,s=n.gmlVersion,a=put(o,i);t.appendChild(a),2===s?$ut.prototype.writeFeatureElement(a,e,r):3===s?iht.prototype.writeFeatureElement(a,e,r):uAt.prototype.writeFeatureElement(a,e,r)}function DAt(t,e,r){var n=r[r.length-1].version,i=CAt[n],o=put(i,"Filter"),s=put(i,"FeatureId");o.appendChild(s),s.setAttribute("fid",e),t.appendChild(o)}function GAt(t,e){var r=(t=t||xAt)+":";return 0===e.indexOf(r)?e:r+e}function QAt(t,e,r){var n=r[r.length-1];K(void 0!==e.getId(),26);var i=n.featureType,o=n.featurePrefix,s=n.featureNS,a=GAt(o,i);t.setAttribute("typeName",a),t.setAttributeNS(EAt,"xmlns:"+o,s);var l=e.getId();void 0!==l&&DAt(t,l,r)}function jAt(t,e,r){var n=r[r.length-1];K(void 0!==e.getId(),27);var i=n.version,o=n.featureType,s=n.featurePrefix,a=n.featureNS,l=GAt(s,o),u=e.getGeometryName();t.setAttribute("typeName",l),t.setAttributeNS(EAt,"xmlns:"+s,a);var h=e.getId();if(void 0!==h){for(var c=e.getKeys(),A=[],f=0,p=c.length;f<p;f++){var d=e.get(c[f]);if(void 0!==d){var g=c[f];d&&"function"==typeof d.getSimplifiedGeometry&&(g=u),A.push({name:g,value:d})}}Tut({version:i,gmlVersion:n.gmlVersion,node:t,hasZ:n.hasZ,srsName:n.srsName},bAt,Eut("Property"),A,r),DAt(t,h,r)}}function HAt(t,e,r){var n=r[r.length-1],i=n.version,o=SAt[i],s=put(o,"Name"),a=n.gmlVersion;if(t.appendChild(s),Wut(s,e.name),void 0!==e.value&&null!==e.value){var l=put(o,"Value");t.appendChild(l),e.value&&"function"==typeof e.value.getSimplifiedGeometry?2===a?$ut.prototype.writeGeometryElement(l,e.value,r):3===a?iht.prototype.writeGeometryElement(l,e.value,r):uAt.prototype.writeGeometryElement(l,e.value,r):Wut(l,e.value)}}function zAt(t,e,r){e.vendorId&&t.setAttribute("vendorId",e.vendorId),void 0!==e.safeToIgnore&&t.setAttribute("safeToIgnore",String(e.safeToIgnore)),void 0!==e.value&&Wut(t,e.value)}var VAt={"http://www.opengis.net/wfs":{Query:xut(KAt)},"http://www.opengis.net/wfs/2.0":{Query:xut(KAt)},"http://www.opengis.net/ogc":{During:xut(YAt),And:xut(ZAt),Or:xut(ZAt),Not:xut(JAt),BBOX:xut(qAt),Contains:xut(WAt),Intersects:xut(WAt),Within:xut(WAt),DWithin:xut(XAt),PropertyIsEqualTo:xut($At),PropertyIsNotEqualTo:xut($At),PropertyIsLessThan:xut($At),PropertyIsLessThanOrEqualTo:xut($At),PropertyIsGreaterThan:xut($At),PropertyIsGreaterThanOrEqualTo:xut($At),PropertyIsNull:xut(tft),PropertyIsBetween:xut(eft),PropertyIsLike:xut(rft)},"http://www.opengis.net/fes/2.0":{During:xut(YAt),And:xut(ZAt),Or:xut(ZAt),Not:xut(JAt),BBOX:xut(qAt),Contains:xut(WAt),Disjoint:xut(WAt),Intersects:xut(WAt),ResourceId:xut((function(t,e,r){t.setAttribute("rid",e.rid)})),Within:xut(WAt),DWithin:xut(XAt),PropertyIsEqualTo:xut($At),PropertyIsNotEqualTo:xut($At),PropertyIsLessThan:xut($At),PropertyIsLessThanOrEqualTo:xut($At),PropertyIsGreaterThan:xut($At),PropertyIsGreaterThanOrEqualTo:xut($At),PropertyIsNull:xut(tft),PropertyIsBetween:xut(eft),PropertyIsLike:xut(rft)}};function KAt(t,e,r){var n,i,o=r[r.length-1],s=o.version,a=o.featurePrefix,l=o.featureNS,u=o.propertyNames,h=o.srsName;n=a?GAt(a,e):e,i="2.0.0"===s?"typeNames":"typeName",t.setAttribute(i,n),h&&t.setAttribute("srsName",h),l&&t.setAttributeNS(EAt,"xmlns:"+a,l);var c=b({},o);c.node=t,Tut(c,wAt,Eut("PropertyName"),u,r);var A=o.filter;if(A){var f=put(lft(s),"Filter");t.appendChild(f),function(t,e,r){var n=r[r.length-1],i={node:t};b(i,{context:n}),Tut(i,VAt,Eut(e.getTagName()),[e],r)}(f,A,r)}}function qAt(t,e,r){var n=r[r.length-1],i=n.context.version;n.srsName=e.srsName;var o=PAt[i];oft(i,t,e.geometryName),o.prototype.writeGeometryElement(t,e.extent,r)}function WAt(t,e,r){var n=r[r.length-1],i=n.context.version;n.srsName=e.srsName;var o=PAt[i];oft(i,t,e.geometryName),o.prototype.writeGeometryElement(t,e.geometry,r)}function XAt(t,e,r){var n=r[r.length-1].context.version;WAt(t,e,r);var i=put(lft(n),"Distance");Wut(i,e.distance.toString()),"2.0.0"===n?i.setAttribute("uom",e.unit):i.setAttribute("units",e.unit),t.appendChild(i)}function YAt(t,e,r){var n=r[r.length-1].context.version;nft(BAt[n],"ValueReference",t,e.propertyName);var i=put(kut,"TimePeriod");t.appendChild(i);var o=put(kut,"begin");i.appendChild(o),sft(o,e.begin);var s=put(kut,"end");i.appendChild(s),sft(s,e.end)}function ZAt(t,e,r){var n=r[r.length-1].context,i={node:t};b(i,{context:n});for(var o=e.conditions,s=0,a=o.length;s<a;++s){var l=o[s];Tut(i,VAt,Eut(l.getTagName()),[l],r)}}function JAt(t,e,r){var n=r[r.length-1].context,i={node:t};b(i,{context:n});var o=e.condition;Tut(i,VAt,Eut(o.getTagName()),[o],r)}function $At(t,e,r){var n=r[r.length-1].context.version;void 0!==e.matchCase&&t.setAttribute("matchCase",e.matchCase.toString()),oft(n,t,e.propertyName),ift(n,t,""+e.expression)}function tft(t,e,r){oft(r[r.length-1].context.version,t,e.propertyName)}function eft(t,e,r){var n=r[r.length-1].context.version,i=lft(n);oft(n,t,e.propertyName);var o=put(i,"LowerBoundary");t.appendChild(o),ift(n,o,""+e.lowerBoundary);var s=put(i,"UpperBoundary");t.appendChild(s),ift(n,s,""+e.upperBoundary)}function rft(t,e,r){var n=r[r.length-1].context.version;t.setAttribute("wildCard",e.wildCard),t.setAttribute("singleChar",e.singleChar),t.setAttribute("escapeChar",e.escapeChar),void 0!==e.matchCase&&t.setAttribute("matchCase",e.matchCase.toString()),oft(n,t,e.propertyName),ift(n,t,""+e.pattern)}function nft(t,e,r,n){var i=put(t,e);Wut(i,n),r.appendChild(i)}function ift(t,e,r){nft(lft(t),"Literal",e,r)}function oft(t,e,r){"2.0.0"===t?nft(BAt[t],"ValueReference",e,r):nft(CAt[t],"PropertyName",e,r)}function sft(t,e){var r=put(kut,"TimeInstant");t.appendChild(r);var n=put(kut,"timePosition");r.appendChild(n),Wut(n,e)}function aft(t,e,r){var n=r[r.length-1],i=b({},n);i.node=t,Tut(i,VAt,Eut("Query"),e,r)}function lft(t){return"2.0.0"===t?BAt[t]:CAt[t]}const uft=FAt;var hft=function(t){(t=t||{}).displacement||(t.displacement=[t.offsetX||0,-t.offsetY||0]),this.sanchor_="anchored"===t.kind?8:0,this._shadow=Number(t.shadow)||0,t.stroke||(t.stroke=new Rn({width:0,color:"#000"}));var e=t.stroke.getWidth();if(e<0&&(e=0),"folio"==t.kind&&(e+=6),t.stroke.setWidth(e),Oi.call(this,{radius:t.radius+e+this.sanchor_/2+this._shadow/2,points:0,displacement:[t.displacement[0]||0,(t.displacement[1]||0)+this.sanchor_],fill:Oi.prototype.render?new Tn({color:[0,0,0,0]}):null}),!this.getHitDetectionImage){var r=Oi.prototype.getImage.call(this);if(!this.hitDetectionCanvas_)for(var n in this)if(this[n]&&this[n].getContext&&this[n]!==r){this.hitDetectionCanvas_=this[n];break}this.hitDetectionCanvas_=document.createElement("canvas"),this.hitDetectionCanvas_.width=r.width,this.hitDetectionCanvas_.height=r.height;var i=this.hitDetectionCanvas_;this.getHitDetectionImage=function(){return i}}this._stroke=t.stroke,this._fill=t.fill,this._crop=t.crop,this._crossOrigin=t.crossOrigin,this._kind=t.kind||"default",this._radius=t.radius,this._src=t.src,this._offset=[t.offsetX?t.offsetX:0,t.offsetY?t.offsetY:0],this._onload=t.onload,"number"==typeof t.opacity&&this.setOpacity(t.opacity),"number"==typeof t.rotation&&this.setRotation(t.rotation),this.getImage()};Vm(hft,Oi),hft.prototype.setOffset=function(t){this._offset=[t[0]||0,t[1]||0],this.getImage()},hft.prototype.clone=function(){var t=new hft({stroke:this._stroke,fill:this._fill,shadow:this._shadow,crop:this._crop,crossOrigin:this._crossOrigin,kind:this._kind,radius:this._radius,src:this._src,offsetX:this._offset[0],offsetY:this._offset[1],opacity:this.getOpacity(),rotation:this.getRotation()});return t.getImage(),t},CanvasRenderingContext2D.prototype.roundRect=function(t,e,r,n,i){return i?(r<2*i&&(i=r/2),n<2*i&&(i=n/2),this.beginPath(),this.moveTo(t+i,e),this.arcTo(t+r,e,t+r,e+n,i),this.arcTo(t+r,e+n,t,e+n,i),this.arcTo(t,e+n,t,e,i),this.arcTo(t,e,t+r,e,i),this.closePath()):this.rect(t,e,r,n),this},hft.prototype.drawBack_=function(t,e,r,n){var i=this._shadow,o=t.canvas;t.beginPath(),t.fillStyle=e,t.clearRect(0,0,o.width,o.height);var s=o.width/n,a=o.height/n;switch(this._kind){case"square":t.rect(0,0,s-i,a-i);break;case"circle":t.arc(this._radius+r,this._radius+r,this._radius+r,0,2*Math.PI,!1);break;case"folio":r-=6,t.strokeStyle="rgba(0,0,0,0.5)",t.lineWidth=1;var l=s-i-12,u=Math.atan(6/l);t.save(),t.rotate(-u),t.translate(-6,2),t.beginPath(),t.rect(6,6,l,l),t.stroke(),t.fill(),t.restore(),t.save(),t.translate(6,-1),t.rotate(u),t.beginPath(),t.rect(6,6,l,l),t.stroke(),t.fill(),t.restore(),t.beginPath(),t.rect(6,6,l,l),t.stroke();break;case"anchored":t.roundRect(this.sanchor_/2,0,s-this.sanchor_-i,a-this.sanchor_-i,r),t.moveTo(s/2-this.sanchor_-i/2,a-this.sanchor_-i),t.lineTo(s/2+this.sanchor_-i/2,a-this.sanchor_-i),t.lineTo(s/2-i/2,a-i);break;default:t.roundRect(0,0,s-i,a-i,r)}t.closePath()},hft.prototype.getImage=function(t){t=t||1;var e,r=Oi.prototype.getImage.call(this,t);if(this._gethit)return r;var n=0;this._stroke&&(e=Hn(this._stroke.getColor()),n=this._stroke.getWidth()),this._gethit=!0;var i=this.getHitDetectionImage().getContext("2d");i.save(),i.setTransform(1,0,0,1,0,0),this.drawBack_(i,"#000",n,1),i.fill(),i.restore(),this._gethit=!1,(i=r.getContext("2d")).save(),i.setTransform(t,0,0,t,0,0),this.drawBack_(i,e,n,t),this._shadow&&(i.shadowColor="rgba(0,0,0,0.5)",i.shadowBlur=t*this._shadow/2,i.shadowOffsetX=t*this._shadow/2,i.shadowOffsetY=t*this._shadow/2),i.fill(),i.restore();var o=this,s=this.img_=new Image;if(this._crossOrigin&&(s.crossOrigin=this._crossOrigin),s.src=this._src,s.width?o.drawImage_(r,s,t):s.onload=function(){o.drawImage_(r,s,t),o._onload&&o._onload()},!this.getDisplacement){var a=this.getAnchor();a[0]=(r.width/t-this._shadow)/2-this._offset[0],this.sanchor_?a[1]=r.height/t-this._shadow-this._offset[1]:a[1]=(r.height/t-this._shadow)/2-this._offset[1]}return r},hft.prototype.getPhoto=function(){return this.img_},hft.prototype.drawImage_=function(t,e,r){var n=t.getContext("2d"),i=0;this._stroke&&(i=this._stroke.getWidth());var o,s,a,l,u,h,c,A,f,p=2*this._radius;n.save(),Oi.prototype.render&&n.setTransform(r,0,0,r,0,0),"circle"==this._kind&&(n.beginPath(),n.arc(this._radius+i,this._radius+i,this._radius,0,2*Math.PI,!1),n.clip()),this._crop?(A=f=(o=Math.min(e.width/p,e.height/p))*p,h=(e.width-A)/2,c=(e.height-f)/2,s=a=0,l=u=p+1):(h=c=0,s=(p-(l=(o=Math.min(p/e.width,p/e.height))*(A=e.width)))/2,a=(p-(u=o*(f=e.height)))/2),s+=i+this.sanchor_/2,a+=i,n.drawImage(e,h,c,A,f,s,a,l,u),"circle"==this._kind&&i&&(n.beginPath(),n.strokeStyle=Hn(this._stroke.getColor()),n.lineWidth=i/4,n.arc(this._radius+i,this._radius+i,this._radius,0,2*Math.PI,!1),n.stroke()),n.restore()};var cft=function(t){t=t||{},this.duration_="number"==typeof t.duration?t.duration>=0?t.duration:0:1e3,this.fade_="function"==typeof t.fade?t.fade:null,this.repeat_=Number(t.repeat);var e="function"==typeof t.easing?t.easing:va;t.revers?this.easing_=function(t){return 1-e(t)}:this.easing_=e,this.hiddenStyle=t.hiddenStyle,D.call(this)};Vm(cft,D),cft.hiddenStyle=new ji({image:new Ri({}),stroke:new Rn({color:"transparent"})}),cft.prototype.drawGeom_=function(t,e,r){this.fade_&&(t.context.globalAlpha=this.fade_(1-t.elapsed));for(var n=t.style,i=0;i<n.length;i++)try{var o=t.vectorContext||Zlt(t),s=$lt(t,n[i]);o.setStyle(s),s.getZIndex()<0?o.drawGeometry(r||e):o.drawGeometry(e)}catch(a){}},cft.prototype.animate=function(){return!1},Uh.prototype.animateFeature=function(t,e){var r=this._featureAnimationLayer;r||(r=this._featureAnimationLayer=new Zs({source:new Aa})).setMap(this),r.getSource().addFeature(t);var n=e.on("animationend",(function(e){e.feature===t&&(r.getSource().removeFeature(t),N(n))}));r.animateFeature(t,e)},Wi.prototype.animateFeature=function(t,e,r){var n,i=this,o=t.getStyle(),s=o||(this.getStyleFunction?this.getStyleFunction()(t):null);s||(s=[]),s instanceof Array||(s=[s]);var a={vectorContext:null,frameState:null,start:0,time:0,elapsed:0,extent:!1,feature:t,geom:t.getGeometry(),typeGeom:t.getGeometry().getType(),bbox:t.getGeometry().getExtent(),coord:Vt(t.getGeometry().getExtent()),style:s};e instanceof Array||(e=[e]);for(var l=e.length-1;l>=0;l--)0===e[l].duration_&&e.splice(l,1);var u=0,h=0,c=r&&this.getFilters?this.getFilters():[];function A(r){a.type=r.type;try{a.vectorContext=r.vectorContext||Zlt(r)}catch(o){}if(a.frameState=r.frameState,a.inversePixelTransform=r.inversePixelTransform,a.extent||(a.extent=r.frameState.extent,a.start=r.frameState.time,a.context=r.context),a.time=r.frameState.time-a.start,a.elapsed=a.time/e[h].duration_,a.elapsed>1&&(a.elapsed=1),r.context.save(),c.forEach((function(t){t.get("active")&&t.precompose(r)})),this.getOpacity&&(r.context.globalAlpha=this.getOpacity()),e[h].animate(a)){var n={type:"animating",step:h,start:a.start,time:a.time,elapsed:a.elapsed,rotation:a.rotation||0,geom:a.geom,coordinate:a.coord,feature:t};e[h].dispatchEvent(n),i.dispatchEvent(n)}else++u<e[h].repeat_?a.extent=!1:h<e.length-1?(e[h].dispatchEvent({type:"animationend",feature:t}),h++,u=0,a.extent=!1):f();c.forEach((function(t){t.get("active")&&t.postcompose(r)})),r.context.restore(),r.frameState.animate=!0}function f(r){N(n),n=null,t.setStyle(o);var s={type:"animationend",feature:t};if(r)for(var a in r)r.hasOwnProperty(a)&&(s[a]=r[a]);e[h].dispatchEvent(s),i.dispatchEvent(s)}function p(r){if(e.length&&!n){if(n=i.on(["postcompose","postrender"],A.bind(i)),i.renderSync)try{i.renderSync()}catch(dX){}else i.changed();t.setStyle(e[h].hiddenStyle||cft.hiddenStyle);var o={type:"animationstart",feature:t};if(r)for(var s in r)r.hasOwnProperty(s)&&(o[s]=r[s]);e[h].dispatchEvent(o),i.dispatchEvent(o)}}return p(),{start:p,stop:f,isPlaying:function(){return!!n}}};var Aft=function(t){t=t||{},cft.call(this,t),this.amplitude_=t.amplitude||40,this.bounce_=-Math.PI*(t.bounce||3)};Vm(Aft,cft),Aft.prototype.animate=function(t){var e=t.geom.clone(),r=Math.abs(Math.sin(this.bounce_*t.elapsed))*this.amplitude_*(1-this.easing_(t.elapsed))*t.frameState.viewState.resolution;return e.translate(0,r),this.drawGeom_(t,e,t.geom),t.time<=this.duration_};var fft=function(t){cft.call(this,t),this.set("nb",t.nb||10)};Vm(fft,cft),fft.prototype.animate=function(t){return Math.round(this.easing_(t.elapsed)*this.get("nb"))%2||this.drawGeom_(t,t.geom),t.time<=this.duration_};var pft=function(t){t=t||{},this.speed_=t.speed||0,cft.call(this,t),this.side_=t.side||"top"};Vm(pft,cft),pft.prototype.animate=function(t){if(!t.time){var e=t.frameState.viewState.rotation,r=t.frameState.size[1]*t.frameState.viewState.resolution;"top"!=this.side_&&(r*=-1),this.dx=-Math.sin(e)*r,this.dy=Math.cos(e)*r,this.speed_&&(this.duration_=r/this.speed_/t.frameState.viewState.resolution)}var n=t.geom.clone();return n.translate(this.dx*(1-this.easing_(t.elapsed)),this.dy*(1-this.easing_(t.elapsed))),this.drawGeom_(t,n,t.geom),t.time<=this.duration_};var dft=function(t){t=t||{},this.speed_=t.speed||0,cft.call(this,t)};Vm(dft,cft),dft.prototype.animate=function(t){return t.context.globalAlpha=this.easing_(t.elapsed),this.drawGeom_(t,t.geom),t.time<=this.duration_};var gft=function(t){switch(t=t||{},cft.call(this,t),this.speed_=t.speed||0,this.path_=t.path,t.rotate){case!0:case 0:this.rotate_=0;break;default:this.rotate_=t.rotate||!1}this.path_&&this.path_.getGeometry&&(this.path_=this.path_.getGeometry()),this.path_&&this.path_.getLineString&&(this.path_=this.path_.getLineString()),this.path_.getLength?(this.dist_=this.path_.getLength(),this.path_&&this.path_.getCoordinates&&(this.path_=this.path_.getCoordinates())):this.dist_=0,this.speed_>0&&(this.duration_=this.dist_/this.speed_)};Vm(gft,cft),gft.prototype.animate=function(t){if(!t.time&&!this.dist_)return!1;var e,r,n,i,o,s,a=this.dist_*this.easing_(t.elapsed),l=0;r=this.path_[0];for(var u=1;u<this.path_.length;u++){if(e=r,i=(r=this.path_[u])[0]-e[0],o=r[1]-e[1],(s=Math.sqrt(i*i+o*o))&&l+s>=a){n=(a-l)/s,r=[e[0]+(r[0]-e[0])*n,e[1]+(r[1]-e[1])*n];break}l+=s}var h=t.style;if(t.rotation=Math.PI/2+Math.atan2(e[1]-r[1],e[0]-r[0]),!1!==this.rotate_){var c=[],A=this.rotate_-t.rotation+t.frameState.viewState.rotation;t.rotation=Math.PI/2+Math.atan2(e[1]-r[1],e[0]-r[0]);for(var f=0;n=t.style[f];f++)n.getImage()&&n.getImage().setRotation(A),c.push(n);t.style=c}return t.geom.setCoordinates(r),this.drawGeom_(t,t.geom),t.style=h,t.time<=this.duration_};var yft=function(t){t=t||{},cft.call(this,t),this.amplitude_=t.amplitude||40,this.bounce_=-Math.PI*(t.bounce||6),this.horizontal_=t.horizontal};Vm(yft,cft),yft.prototype.animate=function(t){var e=t.geom.clone(),r=t.geom.clone(),n=this.easing_(t.elapsed);return n=Math.sin(this.bounce_*n)*this.amplitude_*(1-n)*t.frameState.viewState.resolution,this.horizontal_?(e.translate(n,0),r.translate(n,0)):e.translate(0,n),this.drawGeom_(t,e,r),t.time<=this.duration_};var mft=function(t){cft.call(this,t)};Vm(mft,cft),mft.prototype.animate=function(t){return this.drawGeom_(t,t.geom),t.time<=this.duration_};var vft=function(t){t=t||{},this.speed_=t.speed||0,cft.call(this,t),this.side_=t.side||"left"};Vm(vft,cft),vft.prototype.animate=function(t){t.time||("left"==this.side_?this.dx=t.extent[0]-t.bbox[2]:this.dx=t.extent[2]-t.bbox[0],this.speed_&&(this.duration_=Math.abs(this.dx)/this.speed_/t.frameState.viewState.resolution));var e=t.geom.clone();return e.translate(this.dx*(1-this.easing_(t.elapsed)),0),this.drawGeom_(t,e),t.time<=this.duration_};var _ft=function(t){cft.call(this,t)};Vm(_ft,cft),_ft.prototype.animate=function(t){var e=this.easing_(t.elapsed);if(e){t.context.save();var r=t.frameState.pixelRatio;t.context.globalAlpha=e,t.context.scale(e,1/e);var n=t.frameState.coordinateToPixelTransform,i=(1/e-1)*r*(n[0]*t.coord[0]+n[1]*t.coord[1]+n[4]),o=(e-1)*r*(n[2]*t.coord[0]+n[3]*t.coord[1]+n[5]);t.context.translate(i,o),this.drawGeom_(t,t.geom),t.context.restore()}return t.time<=this.duration_};var wft=function(t){t=t||{},cft.call(this,t),this.speed_=t.speed||0,this.side_=t.side||"left"};Vm(wft,cft),wft.prototype.animate=function(t){var e,r;!t.time&&this.speed_&&("left"==this.side_?(e=this.dx=t.extent[0]-t.bbox[2],r=this.dy=t.extent[3]-t.bbox[1]):(e=this.dx=t.extent[2]-t.bbox[0],r=this.dy=t.extent[3]-t.bbox[1]),this.duration_=Math.sqrt(e*e+r*r)/this.speed_/t.frameState.viewState.resolution);var n=t.geom.clone(),i=t.geom.clone();return n.translate(this.dx*(1-this.easing_(t.elapsed)),this.dy*Math.cos(Math.PI/2*this.easing_(t.elapsed))),i.translate(this.dx*(1-this.easing_(t.elapsed)),0),this.drawGeom_(t,n,i),t.time<=this.duration_};var bft=function(t){t=t||{},cft.call(this,t),this.set("zoomout",t.zoomOut)};Vm(bft,cft),Vm((function(t){(t=t||{}).zoomOut=!0,bft.call(this,t)}),bft),bft.prototype.animate=function(t){var e=this.easing_(t.elapsed);if(e){this.get("zoomout")&&(e=1/e);var r,n,i=t.style,o=[];for(r=0;r<i.length;r++)(n=i[r].getImage())&&(o[r]=n.getScale(),"postrender"===t.type?n.setScale(o[r]*e/t.frameState.pixelRatio):n.setScale(o[r]*e));for(this.drawGeom_(t,t.geom),r=0;r<i.length;r++)(n=i[r].getImage())&&n.setScale(o[r])}return t.time<=this.duration_};var xft=function(t){(t=t||{}).loader=this._loader,t.strategy=ia,Aa.call(this,t),this.set("time",t.time||new Date),this.set("step",t.step||1)};Vm(xft,Aa),function(){function t(t){var e=Math.PI/180,r=t-2451545,n=280.46+.9856474*r,i=357.528+.9856003*r;return i%=360,{lambda:(n%=360)+1.915*Math.sin(i*e)+.02*Math.sin(2*i*e),R:1.00014-.01671*Math.cos(i*e)-.0014*Math.cos(2*i*e)}}function e(t){var e=(t-2451545)/36525;return 23.43929111-e*(46.836769/3600-e*(1831e-7/3600+e*(5.565e-7-e*(1.6e-10-4.34e-8*e/3600))))}function r(t,e){var r=180/Math.PI,n=Math.PI/180,i=Math.atan(Math.cos(e*n)*Math.tan(t*n))*r,o=Math.asin(Math.sin(e*n)*Math.sin(t*n))*r;return{alpha:i+=90*Math.floor(t/90)-90*Math.floor(i/90),delta:o}}xft.prototype._loader=function(t,e,r){var n=this.getCoordinates(this.get("time")),i=new bn([n]);i.transform("EPSG:4326",r),this.addFeature(new X(i))},xft.prototype.setTime=function(t){this.set("time",t),this.refresh()},xft.prototype.getSunPosition=function(n){var i=(n?new Date(n):new Date)/864e5+2440587.5,o=(18.697374558+24.06570982441908*(i-2451545))%24,s=t(i),a=e(i),l=r(s.lambda,a);return[l.alpha-15*o,l.delta]},xft.getNightLat=function(n,i){var o=180/Math.PI,s=Math.PI/180,a=(i?new Date(i):new Date)/864e5+2440587.5,l=(18.697374558+24.06570982441908*(a-2451545))%24,u=t(a),h=e(a),c=r(u.lambda,h),A=15*l+n-c.alpha;return Math.atan(-Math.cos(A*s)/Math.tan(c.delta*s))*o},xft.prototype.getCoordinates=function(n,i){for(var o=180/Math.PI,s=Math.PI/180,a=(n?new Date(n):new Date)/864e5+2440587.5,l=(18.697374558+24.06570982441908*(a-2451545))%24,u=[],h=t(a),c=e(a),A=r(h.lambda,c),f=this.get("step")||1,p=-180;p<=180;p+=f){var d=p,g=15*l+d-A.alpha,y=Math.atan(-Math.cos(g*s)/Math.tan(A.delta*s))*o;u.push([d,y])}switch(i){case"line":break;case"day":A.delta*=-1;default:y=A.delta<0?90:-90;for(var m=180;m>=-180;m-=f)u.push([m,y]);u.push(u[0])}if("daynight"===i){var v=[];u.forEach((function(t){v.push(t.slice())})),v[0][1]=-v[0][1],v[v.length-1][1]=-v[0][1],v[v.length-1][1]=-v[0][1],u=[u,v]}return u}}();var Eft=function(t){t=t||{},this.source=t.source,this.nodes=new Aa,this.maxIteration=t.maxIteration||2e4,this.stepIteration=t.stepIteration||2e3,this.astar=!0,this.candidat=[],D.call(this),this.set("epsilon",t.epsilon||1e-6)};Vm(Eft,D),Eft.prototype.weight=function(){return 1},Eft.prototype.direction=function(){return 2},Eft.prototype.getLength=function(t){return t.getGeometry&&(t=t.getGeometry()),t.getLength()},Eft.prototype.getNodeSource=function(){return this.nodes},Eft.prototype.getEdges=function(t){var e=Ct(Et([t]),this.get("epsilon")),r=[];return this.source.forEachFeatureIntersectingExtent(e,(function(t){r.push(t)})),r},Eft.prototype.getNode=function(t){var e=Ct(Et([t]),this.get("epsilon")),r=[];return this.nodes.forEachFeatureIntersectingExtent(e,(function(t){r.push(t)})),r[0]},Eft.prototype.addNode=function(t,e,r,n,i){if(this.wdist&&e>this.wdist)return!1;var o=this.getNode(t),s=e+this.getLength(new Nn([this.end,t]))*this.weight();if(this.astar&&this.wdist&&s>this.wdist)return!1;if(o){if(o!==this.arrival&&o.get("wdist")<=e)return o;o.set("dist",r),o.set("wdist",e),o.set("dtotal",s),o.set("from",n),o.set("prev",i),o===this.arrival&&(this.wdist=e),this.candidat.push(o)}else o=new X({geometry:new nn(t),from:n,prev:i,dist:r||0,wdist:e,dtotal:s}),e<0?o.set("wdist",!1):this.candidat.push(o),this.nodes.addFeature(o);return o},Eft.prototype.closestCoordinate=function(t){var e=this.source.getClosestFeatureToCoordinate(t),r=e.getGeometry().getFirstCoordinate(),n=e.getGeometry().getLastCoordinate();return qlt(t,r)<qlt(t,n)?r:n},Eft.prototype.path=function(t,e){if(this.running)return!1;if(t=this.closestCoordinate(t),this.end=this.closestCoordinate(e),t[0]===this.end[0]&&t[1]===this.end[1])return this.dispatchEvent({type:"finish",route:[],wDistance:-1,distance:this.wdist}),!1;var r=this;return this.nodes.clear(),this.candidat=[],this.wdist=0,this.running=!0,this.addNode(t,0),this.arrival=this.addNode(this.end,-1),this.nb=0,this.dispatchEvent({type:"start"}),setTimeout((function(){r._resume()})),[t,this.end]},Eft.prototype.resume=function(){this.running||this.candidat.length&&(this.running=!0,this.nb=0,this._resume())},Eft.prototype.pause=function(){this.running&&(this.nb=-1)},Eft.prototype.getBestWay=function(){for(var t,e,r=-1,n=0;e=this.candidat[n];n++)e.get("wdist")>r&&(t=e,r=e.get("wdist"));return this.getRoute(t)},Eft.prototype._resume=function(){if(this.running){for(;this.candidat.length;){this.candidat.sort((function(t,e){return t.get("dtotal")<e.get("dtotal")?1:t.get("dtotal")===e.get("dtotal")?0:-1}));for(var t,e=this.candidat.pop(),r=e.getGeometry().getCoordinates(),n=this.getEdges(r),i=0;t=n[i];i++){if(e.get("from")!==t){var o=this.getLength(t),s=e.get("wdist")+o*this.weight(t);o=e.get("dist")+o;var a=t.getGeometry().getFirstCoordinate(),l=t.getGeometry().getLastCoordinate(),u=this.direction(t);0!==u&&(r[0]===a[0]&&r[1]===a[1]&&-1!==u&&this.addNode(l,s,o,t,e),r[0]===l[0]&&r[0]===l[0]&&1!==u&&this.addNode(a,s,o,t,e))}if(-1===this.nb||this.nb++>this.maxIteration)return this.running=!1,void this.dispatchEvent({type:"pause",overflow:-1!==this.nb});if(!(this.nb%this.stepIteration)){var h=this;return window.setTimeout((function(){h._resume()}),5),void this.dispatchEvent({type:"calculating"})}}}this.nodes.clear(),this.running=!1,this.dispatchEvent({type:"finish",route:this.getRoute(this.arrival),wDistance:this.wdist,distance:this.arrival.get("dist")})}},Eft.prototype.getRoute=function(t){for(var e=[];t;)e.unshift(t.get("from")),t=t.get("prev");return e.shift(),e};var Cft=Vv,Sft=function(t,e){return[Math.round(t[0]/e)*e,Math.round(t[1]/e)*e]},Bft=$c(N_),Ift=Sft;function Pft(t,e,r){return"FeatureCollection"===t.type?t.features.reduce((function(t,r){return Pft(r,e,t)}),r):e(r,t)}function Tft(t){return"LineString"===t.geometry.type}var Fft={compactNode:Mft,compactGraph:function(t,e,r,n){var i=(n=n||{}).progress,o=Object.keys(t).reduce((function(e,r,o,s){var a=t[r],l=Object.keys(a),u=l.length;return!(void 0!==n.compact&&!n.compact)&&(1===u?!t[l[0]][r]:2===u&&l.filter((function(e){return t[e][r]})).length===u)||(e[r]=a),o%1e3==0&&i&&i("compact:ends",o,s.length),e}),{});return Object.keys(o).reduce((function(s,a,l,u){var h=Mft(a,t,o,e,r,!1,n);return s.graph[a]=h.edges,s.coordinates[a]=h.coordinates,n.edgeDataReduceFn&&(s.reducedEdges[a]=h.reducedEdges),l%1e3==0&&i&&i("compact:nodes",l,u.length),s}),{graph:{},coordinates:{},reducedEdges:{}})}};function Mft(t,e,r,n,i,o,s){s=s||{};var a=e[t];return Object.keys(a).reduce((function(a,l){var u=function(t,e,r,n,i,o,s,a){var l=r[t][e],u=r[e][t],h=[],c=[],A=a.edgeDataSeed;for(a.edgeDataReduceFn&&(A=a.edgeDataReduceFn(A,o[e][t]));!n[e];){var f=r[e];if(!f)break;var p=Object.keys(f).filter((function(e){return e!==t}))[0];if(l+=f[p],s){if(u+=r[p][e],c.indexOf(e)>=0){n[e]=r[e];break}c.push(e)}a.edgeDataReduceFn&&(A=a.edgeDataReduceFn(A,o[e][p])),h.push(i[e]),t=e,e=p}return{vertex:e,weight:l,reverseWeight:u,coordinates:h,reducedEdge:A}}(t,l,e,r,n,i,o,s),h=u.weight,c=u.reverseWeight;if(u.vertex!==t&&((!a.edges[u.vertex]||a.edges[u.vertex]>h)&&(a.edges[u.vertex]=h,a.coordinates[u.vertex]=[n[t]].concat(u.coordinates),a.reducedEdges[u.vertex]=u.reducedEdge),o&&!isNaN(c)&&(!a.incomingEdges[u.vertex]||a.incomingEdges[u.vertex]>c))){a.incomingEdges[u.vertex]=c;var A=[n[t]].concat(u.coordinates);A.reverse(),a.incomingCoordinates[u.vertex]=A}return a}),{edges:{},incomingEdges:{},coordinates:{},incomingCoordinates:{},reducedEdges:{}})}var Lft=function(t,e){var r=(e=e||{}).keyFn||function(t){return t.join(",")},n=e.precision||1e-5,i=function(t,e){var r=[];return"FeatureCollection"===t.type&&(r=r.concat(t.features.filter(e))),{type:"FeatureCollection",features:r}}(t,Tft),o=Bft(i).features.reduce((function(t,i,o,s){var a=Ift(i.geometry.coordinates,n);return t[r(a)]=i.geometry.coordinates,o%1e3==0&&e.progress&&e.progress("topo:vertices",o,s.length),t}),{}),s=Pft(i,(function(t,i,o,s){return i.geometry.coordinates.forEach((function(e,o,s){if(o>0){var a=r(Ift(s[o-1],n)),l=r(Ift(e,n));t.push([a,l,i.properties])}})),o%1e3==0&&e.progress&&e.progress("topo:edges",o,s.length),t}),[]);return{vertices:o,edges:s}},Oft=Fft,Nft=$c(Xv).default,{point:Rft}=D_,kft=function(t,e){var r,n=(e=e||{}).weightFn||function(t,e){return Nft(Rft(t),Rft(e))};"FeatureCollection"===t.type?r=Lft(t,e):t.edges&&(r=t),t=r.edges.reduce((function(t,i,o,s){var a=i[0],l=i[1],u=i[2],h=n(r.vertices[a],r.vertices[l],u),c=function(r){t.vertices[r]||(t.vertices[r]={},e.edgeDataReduceFn&&(t.edgeData[r]={}))},A=function(r,n,i){t.vertices[r][n]=i,e.edgeDataReduceFn&&(t.edgeData[r][n]=e.edgeDataReduceFn(e.edgeDataSeed,u))};return h&&(c(a),c(l),h instanceof Object?(h.forward&&A(a,l,h.forward),h.backward&&A(l,a,h.backward)):(A(a,l,h),A(l,a,h))),o%1e3==0&&e.progress&&e.progress("edgeweights",o,s.length),t}),{edgeData:{},vertices:{}});var i=Oft.compactGraph(t.vertices,r.vertices,t.edgeData,e);return{vertices:t.vertices,edgeData:t.edgeData,sourceVertices:r.vertices,compactedVertices:i.graph,compactedCoordinates:i.coordinates,compactedEdges:e.edgeDataReduceFn?i.reducedEdges:null}},Uft=Fft,Dft=Sft,Gft=Qft;function Qft(t,e){if(e=e||{},t.compactedVertices||(t=kft(t,e)),this._graph=t,this._keyFn=e.keyFn||function(t){return t.join(",")},this._precision=e.precision||1e-5,this._options=e,0===Object.keys(this._graph.compactedVertices).filter((function(t){return"edgeData"!==t})).length)throw new Error("Compacted graph contains no forks (topology has no intersections).")}Qft.prototype={findPath:function(t,e){var r=this._keyFn(Dft(t.geometry.coordinates,this._precision)),n=this._keyFn(Dft(e.geometry.coordinates,this._precision));if(!this._graph.vertices[r]||!this._graph.vertices[n])return null;this._createPhantom(r),this._createPhantom(n);var i=function(t,e,r){var n={};n[e]=0;for(var i=new Cft([[0,[e],e]],(function(t,e){return t[0]-e[0]}));i.length;){var o=i.pop(),s=o[0],a=o[2];if(a===r)return o.slice(0,2);var l=t[a];Object.keys(l).forEach((function(t){var e=s+l[t];if(!(t in n)||e<n[t]){n[t]=e;var r=[e,o[1].concat([t]),t];i.push(r)}}))}return null}(this._graph.compactedVertices,r,n);if(i){var o=i[0];return{path:(i=i[1]).reduce(function(t,e,r,n){return r>0&&(t=t.concat(this._graph.compactedCoordinates[n[r-1]][e])),t}.bind(this),[]).concat([this._graph.sourceVertices[n]]),weight:o,edgeDatas:this._graph.compactedEdges?i.reduce(function(t,e,r,n){return r>0&&t.push({reducedEdge:this._graph.compactedEdges[n[r-1]][e]}),t}.bind(this),[]):void 0}}return null},serialize:function(){return this._graph},_createPhantom:function(t){if(this._graph.compactedVertices[t])return null;var e=Uft.compactNode(t,this._graph.vertices,this._graph.compactedVertices,this._graph.sourceVertices,this._graph.edgeData,!0,this._options);return this._graph.compactedVertices[t]=e.edges,this._graph.compactedCoordinates[t]=e.coordinates,this._graph.compactedEdges&&(this._graph.compactedEdges[t]=e.reducedEdges),Object.keys(e.incomingEdges).forEach(function(r){this._graph.compactedVertices[r][t]=e.incomingEdges[r],this._graph.compactedCoordinates[r][t]=[this._graph.sourceVertices[r]].concat(e.incomingCoordinates[r].slice(0,-1)),this._graph.compactedEdges&&(this._graph.compactedEdges[r][t]=e.reducedEdges[r])}.bind(this)),t},_removePhantom:function(t){t&&(Object.keys(this._graph.compactedVertices[t]).forEach(function(e){delete this._graph.compactedVertices[e][t]}.bind(this)),Object.keys(this._graph.compactedCoordinates[t]).forEach(function(e){delete this._graph.compactedCoordinates[e][t]}.bind(this)),this._graph.compactedEdges&&Object.keys(this._graph.compactedEdges[t]).forEach(function(e){delete this._graph.compactedEdges[e][t]}.bind(this)),delete this._graph.compactedVertices[t],delete this._graph.compactedCoordinates[t],this._graph.compactedEdges&&delete this._graph.compactedEdges[t])}};var jft=function(t){t||(t={}),null==t.typing&&(t.typing=300);var e=document.createElement("DIV"),r=(t.className||"")+" ol-scale";t.target||(r+=" ol-unselectable ol-control"),this._input=document.createElement("INPUT"),this._input.value="-",e.setAttribute("class",r),!1===t.editable&&(this._input.readOnly=!0),e.appendChild(this._input),Cl.call(this,{element:e,target:t.target}),this._input.addEventListener("change",this.setScale.bind(this)),this.set("ppi",t.ppi||96)};Vm(jft,Cl),jft.prototype.setMap=function(t){this._listener&&N(this._listener),this._listener=null,Cl.prototype.setMap.call(this,t),t&&(this._listener=t.on("moveend",this.getScale.bind(this)))},jft.prototype.getScale=function(){var t=this.getMap();if(t){var e=function(t,e){var r=t.getView(),n=r.getProjection(),i=r.getCenter(),o=t.getPixelFromCoordinate(i);o[1]+=1;var s=t.getCoordinateFromPixel(o);return qe(pr(i,n,"EPSG:4326"),pr(s,n,"EPSG:4326"))*((e||96)/.0254)}(t,this.get("ppi"));return this._input.value=this.formatScale(e),e}},jft.prototype.formatScale=function(t){return"1 / "+(t=t>100?100*Math.round(t/100):Math.round(t)).toLocaleString()},jft.prototype.setScale=function(t){var e=this.getMap();e&&t&&(t.target&&(t=t.target.value),function(t,e,r){if(t&&e){var n=e;if("string"==typeof e&&((n=e.split("/")[1])||(n=e),n=n.replace(/[^\d]/g,""),n=parseInt(n)),!n)return;var i=t.getView(),o=i.getProjection(),s=i.getCenter(),a=t.getPixelFromCoordinate(s);a[1]+=1;var l=t.getCoordinateFromPixel(a),u=qe(pr(s,o,"EPSG:4326"),pr(l,o,"EPSG:4326"));u*=(r||96)/.0254,i.setResolution(i.getResolution()*n/u)}}(e,t,this.get("ppi"))),this.getScale()};var Hft=function(t){Wc.call(this,t)};Vm(Hft,Wc),Hft.prototype.getExtent=function(){return this.getSource().getExtent()};var zft=function(t){var e={attributions:t.attributions,logo:t.logo,projection:t.projection};this._image=t.image?t.image:new Image,this._image.crossOrigin=t.crossOrigin;var r=this;this._image.onload=function(){r.setCrop(r.crop),r.changed()},t.image||(this._image.src=t.url),e.canvasFunction=this.calculateImage,Qk.call(this,e),this.center=t.imageCenter,this.setScale(t.imageScale),this.rotate=t.imageRotate?t.imageRotate:0,this.crop=t.imageCrop,this.mask=t.imageMask,this.setCrop(this.crop),this.on("change",function(){this.set("extent",this.calculateExtent())}.bind(this))};Vm(zft,Qk),zft.prototype.calculateImage=function(t,e,r,n){if(this.center){var i=document.createElement("canvas");i.width=n[0],i.height=n[1];var o=i.getContext("2d");if(!this._imageSize)return i;if(this.mask){o.beginPath();var s=f(this.mask[0]);o.moveTo(s[0],s[1]);for(var a=1;a<this.mask.length;a++)s=f(this.mask[a]),o.lineTo(s[0],s[1]);o.clip()}var l=f(this.center),u=(this._image.naturalWidth/2-this.crop[0])*this.scale[0]/e*r,h=(this._image.naturalHeight/2-this.crop[1])*this.scale[1]/e*r,c=this._imageSize[0]*this.scale[0]/e*r,A=this._imageSize[1]*this.scale[1]/e*r;return o.translate(l[0],l[1]),this.rotate&&o.rotate(this.rotate),o.drawImage(this._image,this.crop[0],this.crop[1],this._imageSize[0],this._imageSize[1],-u,-h,c,A),i}function f(e){return[(e[0]-t[0])/(t[2]-t[0])*n[0],(e[1]-t[3])/(t[1]-t[3])*n[1]]}},zft.prototype.getCenter=function(){return this.center},zft.prototype.setCenter=function(t){this.center=t,this.changed()},zft.prototype.getScale=function(){return this.scale},zft.prototype.setScale=function(t){switch(typeof t){case"number":t=[t,t];break;case"object":if(2!=t.length)return;break;default:return}this.scale=t,this.changed()},zft.prototype.getRotation=function(){return this.rotate},zft.prototype.setRotation=function(t){this.rotate=t,this.changed()},zft.prototype.getGeoImage=function(){return this._image},zft.prototype.getCrop=function(){return this.crop},zft.prototype.setMask=function(t){this.mask=t,this.changed()},zft.prototype.getMask=function(){return this.mask},zft.prototype.setCrop=function(t){if(this._image.naturalWidth){if(t){switch(typeof t){case"number":t=[t,t,this._image.naturalWidth-t,this._image.naturalHeight-t];break;case"object":if(4!=t.length)return;break;default:return}t=Et([[t[0],t[1]],[t[2],t[3]]]),this.crop=[Math.max(0,t[0]),Math.max(0,t[1]),Math.min(this._image.naturalWidth,t[2]),Math.min(this._image.naturalHeight,t[3])]}else this.crop=[0,0,this._image.naturalWidth,this._image.naturalHeight];this.crop[2]<=this.crop[0]&&(this.crop[2]=this.crop[0]+1),this.crop[3]<=this.crop[1]&&(this.crop[3]=this.crop[1]+1),this._imageSize=[this.crop[2]-this.crop[0],this.crop[3]-this.crop[1]],this.changed()}else this.crop=t},zft.prototype.getExtent=function(t){var e=this.get("extent");if(e||(e=this.calculateExtent()),t)for(var r=0;r<t.length;r++)t[r]=e[r];return e},zft.prototype.calculateExtent=function(t){var e;if(!1!==t&&this.getMask())e=new bn([this.getMask()]);else{var r=this.getCenter(),n=this.getScale(),i=this.getGeoImage().width*n[0],o=this.getGeoImage().height*n[1];(e=xn(Et([[r[0]-i/2,r[1]-o/2],[r[0]+i/2,r[1]+o/2]]))).rotate(-this.getRotation(),r)}return e.getExtent()};const Vft=Object.freeze(Object.defineProperty({__proto__:null,ArcGisFeatureServiceLayer:class extends IO{constructor(t,e){super(t,e),this.layertype="ArcGisFeatureServiceLayer";const r=this.option.url,n=new Aut;let i=this;var o;this._source=new Aa({loader:function(t,e,o,s,a){const l=r+"/query/?f=json&returnGeometry=true&spatialRel=esriSpatialRelIntersects&geometry="+encodeURIComponent('{"xmin":'+t[0]+',"ymin":'+t[1]+',"xmax":'+t[2]+',"ymax":'+t[3]+',"spatialReference":{"wkid":102100}}')+"&geometryType=esriGeometryEnvelope&inSR=102100&outFields=*&outSR=102100";fetch(l,{method:"GET"}).then((function(t){return t.json()})).then((t=>{const e=n.readFeatures(t,{featureProjection:o});e.length>0&&(i.addFeatures("",e),s(e))}))},strategy:(o=ff({tileSize:512}),function(t,e,r){var n=o.getZForResolution(function(t,e){return t}(e)),i=o.getTileRangeForExtentAndZ(Er(t),n),s=[],a=[n,0,0];for(a[1]=i.minX;a[1]<=i.maxX;++a[1])for(a[2]=i.minY;a[2]<=i.maxY;++a[2])s.push(xr(o.getTileCoordExtent(a)));return s})}),this._source.on("featuresloadend",(t=>{this.trigger(Rm.onLoadEnd,t)})),this.layer=new Zs({source:this._source}),this.layer.set("layerid",t),this.layer.set("hashMove",this.option.hashMove)}},ArcGisMapServerLayer:uU,ArcGisTileXyzLayer:lU,ClusterImageLayer:class extends IO{constructor(t,r){super(t,r),e(this,"styleCache"),e(this,"clusterSource"),e(this,"selectCluster"),this.styleCache={},this.layertype="ClusterImageLayer",this.option={distance:40,imageFieldName:"主照片地址",animationDuration:600,maxResolution:40},this.option=Object.assign({},this.option,r),this._source=new Aa,this.clusterSource=new LO({distance:this.option.distance,source:this._source}),this.layer=new tut({source:this.clusterSource,animationDuration:this.option.animationDuration,maxResolution:this.option.maxResolution,renderOrder:function(t,e){return e.getGeometry().getExtent()[1]-t.getGeometry().getExtent()[1]},style:(t,e)=>this.getFeatureStyle(t,e,"")}),this.layer.set("layerid",t),this.layer.set("layertype",this.layertype),this.selectCluster=new Bh({layers:[this.layer],condition:Au,style:(t,e)=>this.getFeatureStyle(t,e,"sel")}),this.selectCluster.setActive(!0),this.selectCluster.getFeatures().on(["add"],(t=>{var e=t.target.getArray()[0].get("features");e&&this.trigger(Rm.onFeatureSelected,e)})),this.selectCluster.getFeatures().on(["remove"],(function(t){}))}addFeaturesMN(t,e){for(var r,n,i,o,s=t.getView().calculateExtent(t.getSize()),a=[],l=0;l<e;++l)a[l]=new X(new nn([s[0]+(s[2]-s[0])*Math.random(),s[1]+(s[3]-s[1])*Math.random()])),a[l].set("id",l),a[l].set("name","123123"),a[l].set("classname",l),a[l].set("thumbnail","");null==(n=null==(r=this.clusterSource)?void 0:r.getSource())||n.clear(),null==(o=null==(i=this.clusterSource)?void 0:i.getSource())||o.addFeatures(a)}getFeatureStyle(t,e,r){let n,i=t.get("features")[0].get("uuid"),o=t.get("features")[0],s=t.get("features").length,a=o.get(this.option.imageFieldName);if(a=a.replace("_sss","_s"),n||(this.styleCache[i]=n=new ji({image:new hft({src:a,radius:20,crop:!0,kind:s>1?"folio":"square",shadow:!0,onload:function(){try{t.changed()}catch{}},stroke:new Rn({width:2,color:"sel"===r?"rgba(0, 255, 0,1)":"#fff"})})})),s>1){let t=new ji({image:new Oi({points:12,radius:9,fill:new Tn({color:"rgba(0, 255, 0,0.3)"})}),text:new Vi({text:s.toString(),font:"bold 12px helvetica,sans-serif",fill:new Tn({color:"#000"})})});var l=t.getImage().getAnchor();return l[0]-=20,l[1]+=20,[n,t]}return[n]}appendTo(t){var e,r;this._map=t,this.selectCluster&&(null==(e=this._map)||e.addInteraction(this.selectCluster)),this.layer&&(null==(r=this._map)||r.addLayer(this.layer))}},ClusterLayer:class extends IO{constructor(t,r){super(t,r),e(this,"styleCache"),e(this,"clusterSource"),e(this,"selectCluster"),this.option={convexhull:!0,animatesel:!0,haslink:!0,distance:40,levelColor:[{maxnum:5e3,strokecolor:"rgba(192,0,0,0.5)",strokewidth:15,fillcolor:"rgba(192,0,0,1)"},{maxnum:1e3,strokecolor:"rgba(255,165,0,0.5)",strokewidth:15,fillcolor:"rgba(255,165,0,1)"},{maxnum:500,strokecolor:"rgba(255,128,0,0.5)",strokewidth:15,fillcolor:"rgba(255,128,0,1)"},{maxnum:100,strokecolor:"rgba(0,191,255,0.5)",strokewidth:15,fillcolor:"rgba(0,191,255,1)"},{maxnum:50,strokecolor:"rgba(139,0,139,0.5)",strokewidth:15,fillcolor:"rgba(139,0,139,1)"},{maxnum:2,strokecolor:"rgba(255,165,0,0.5)",strokewidth:15,fillcolor:"rgba(\t255,165,0,1)"}]},this.option=Object.assign({},this.option,r),this.styleCache={},this.layertype="ClusterLayer",this.clusterSource=new LO({distance:this.option.distance,source:this._source}),this.layer=new tut({zIndex:this.option.zIndex,source:this.clusterSource,style:this.getStyle.bind(this)}),this.layer.set("layerid",t);var n=new Ri({radius:5,stroke:new Rn({color:"rgba(0,255,255,1)",width:1}),fill:new Tn({color:"rgba(0,255,255,0.3)"})}),i=new ji({image:n}),o=new ji({image:n,stroke:new Rn({color:"#fff",width:1})});this.selectCluster=new rut({layers:[this.layer],condition:Au,pointRadius:7,animate:this.option.animatesel,featureStyle:()=>[this.option.haslink?o:i],style:(t,e)=>{let r=t.get("features");if(r){if(r.length>1){var n=[this.getStyle(t,e)];if(this.option.convexhull&&nut){var i=[];for(let t=0;t<r.length;t++)i.push(r[t].getGeometry().getFirstCoordinate());var o=nut(i);n.push(new ji({stroke:new Rn({color:"rgba(0,0,192,0.5)",width:2}),fill:new Tn({color:"rgba(0,0,192,0.3)"}),geometry:new bn([o]),zIndex:100}))}return n}return[new ji({image:new Ri({radius:5,stroke:new Rn({color:"rgba(255,0,0,0.5)",width:10}),fill:new Tn({color:"rgba(255,0,0,1)"})}),text:new Vi({text:r[0].getProperties().name,font:"13px Microsoft YaHei",offsetY:-15,fill:new Tn({color:"#8B4513"}),stroke:new Rn({color:"#fff",width:2})})})]}}}),this.selectCluster.getFeatures().on(["add"],(t=>{t.target.getArray()[0].get("features")})),this.selectCluster.getFeatures().on(["remove"],(function(t){}))}appendTo(t){var e;this._map=t,this._map.addInteraction(this.selectCluster),this.layer&&(null==(e=this._map)||e.addLayer(this.layer))}showTitle(t,e){new Promise(((r,n)=>{this._source.getFeatures().forEach((r=>{let n=r.getProperties();if(t==n.dataType)try{r.getStyle().getText().setText(e?r.get("name"):"")}catch(dX){}})),this.layer.changed()}))}addFeaturesMN(t,e){for(var r,n,i=t.getView().calculateExtent(t.getSize()),o=[],s=0;s<e;++s)o[s]=new X(new nn([i[0]+(i[2]-i[0])*Math.random(),i[1]+(i[3]-i[1])*Math.random()])),o[s].set("id",s),o[s].set("name","123123"),o[s].set("classname",s);null==(n=null==(r=this.clusterSource)?void 0:r.getSource())||n.addFeatures(o)}getStyle(t,e){var r=t.get("features").length,n=this.styleCache[r];return 1==r?n=this.styleCache[r]=t.get("features")[0].getStyle():n||(this.option.levelColor.sort((function(t,e){return t.maxnum-e.maxnum})),this.option.levelColor.forEach((t=>{var e=Math.max(8,Math.min(.75*r,20));r>=t.maxnum&&(n=this.styleCache[r]=new ji({image:new Ri({radius:e,stroke:new Rn({color:t.strokecolor,width:t.strokewidth,lineCap:"butt"}),fill:new Tn({color:t.fillcolor})}),text:new Vi({text:r.toString(),fill:new Tn({color:"#fff"})})}))}))),n}},DayNightLayer:class extends IO{constructor(t,e){super(t,e),this.layertype="DayNightLayer",this._source=new xft({}),this.layer=new Zs({source:this._source,zIndex:500,style:new ji({image:new Ri({radius:5,fill:new Tn({color:"red"})}),fill:new Tn({color:[0,0,50,.5]})})}),this.layer.set("layerid",t),this._source.on("addfeature",(t=>{}))}setDataTime(t){this._source.setTime(t)}},DivLayer:class extends Gm{constructor(t,r){super(t,r),e(this,"DivGraphicList"),this.layertype="DivLayer",this.layerid=t,this.DivGraphicList=[],this._on(this.EventType.XMapEventType.onRemoveLayer,(t=>{this.layerid==t&&this.DivGraphicList.length>0&&this.removeAll()}))}getDivList(){return this.DivGraphicList}addDiv(t){this.DivGraphicList.push(t),this._map.addOverlay(t)}removeDiv(t){this._map.removeOverlay(t),this.DivGraphicList.forEach(((e,r,n)=>{if(e===t)return this.DivGraphicList.slice(r,1),void this.trigger(Rm.onFeatureDeleted,{value:e})}))}removeAll(){this.DivGraphicList.forEach((t=>{this._map.removeOverlay(t),this.trigger(Rm.onFeatureDeleted,{element:t})})),this.DivGraphicList=[]}appendTo(t){this._map=t}},GeoImageLayer:class extends aU{constructor(t,r){super(t,r),e(this,"GraphicLayer"),e(this,"graphic");let n={imageCenter:[0,0],imageScale:[1,1],imageRotate:0,imageMask:null,ImageExtentWKID:Xp.EPSG3857,opacity:1,hashEdit:!1};this.option=Object.assign({},n,this.option),this.GraphicLayer=null,this.graphic=null,this.option.ImageExtentWKID==Xp.EPSG4326&&(this.option.imageCenter=ur(this.option.imageCenter)),this.layertype="GeoImageLayer",this.layerSource=new zft({url:this.option.url,imageMask:this.option.imageMask,imageCenter:this.option.imageCenter,imageScale:this.option.imageScale,imageRotate:Number(this.option.imageRotate*Math.PI/180)}),this.layer=new Hft({source:this.layerSource,opacity:this.option.opacity}),this.layer.set("layerid",t),this.layerSource.on("imageloadend",(t=>{this.graphic&&this.graphic.setGeometryFromExtent(this.layerSource.getExtent()),this.layerSource._image.setAttribute("crossOrigin","Anonymous"),this.trigger(this.EventType.LayerEventType.tileloadend,t)})),this.layerSource.on("change",(t=>{this.layerSource._image.setAttribute("crossOrigin","Anonymous"),this.graphic&&this.graphic.setGeometryFromExtent(this.layerSource.getExtent())})),this.layerSource.on("tileloaderror",(function(){})),this._on(this.EventType.XMapEventType.onRemoveLayer,(t=>{this.GraphicLayer&&this.graphic&&this.GraphicLayer.removeFeature(this.graphic)}))}getAttribute(){return this.option}startEdit(t){this.option.hashEdit=!0,this.GraphicLayer=t,this.graphic?this.GraphicLayer.addFeature("GeoImageLayerGraphicTemp",this.graphic):this.setExtent()}endEdit(){this.option.hashEdit=!1,this.graphic&&this.GraphicLayer.removeFeature(this.graphic)}setExtent(){this.graphic||(this.graphic=new SO({graphicType:"PolygonGraphic",style:{stroke:{color:"rgba(255, 0, 0,0)",width:0},fill:{color:"rgba(255, 0, 0,0)"},zIndex:800},attribute:{name:this.layerid+"_graphic",movestate:!1,editallows:!1}}),this.graphic.setGeometryFromExtent(this.layerSource.getExtent()),this.GraphicLayer.addFeature("GeoImageLayerGraphicTemp",this.graphic),this.graphic.set("Scale",this.option.imageScale),this.graphic.on("onRotating",(t=>{this.option.imageRotate=t.data,this.layerSource.setRotation(t.data)})),this.graphic.on("onScaling",(t=>{this.option.imageScale=[t.data,t.data],this.layerSource.setScale(t.data)})),this.graphic.on("onMoveing",(t=>{this.option.imageCenter=t.data,this.layerSource.setCenter(t.data)})))}setScale(t){this.graphic.set("Scale",t),this.layerSource.setScale(t)}computeAutoScale(t){let e=jt(t)/jt(this.layerSource.getExtent());this.graphic.set("Scale",[e,e]),this.layerSource.setScale([e,e])}getGraphic(){return this.graphic}},GraphicImageLayer:PO,GraphicLayer:class extends IO{constructor(t,r){super(t,r),e(this,"animList"),this.animList=[],this.layertype="GraphicLayer",this.layer=new Zs({source:this._source,zIndex:this.option.zIndex}),this.layer.set("layerid",t),this._source.on("addfeature",(t=>{t.feature.get("loadAnimation")&&setTimeout((()=>{this.animateFeature(t.feature,t.feature.get("loadAnimation"))}),1),t.feature.get("pulseAnimate")&&setTimeout((()=>{this.pulseAnimate(t.feature,t.feature.get("pulseAnimate"))}),1)})),this._source.on("removefeature",(t=>{t.feature.get("pulseAnimate")&&this.animList.forEach(((e,r)=>{t.feature.get("uuid")==e.uuid&&e.anim.stop({user:!0})}))})),this.layer.on(this.EventType.featureType.onFeatureContextmenu,(t=>{this._setFeatureContextmenu(t.data.feature,t.data.contextmenu)})),this._on("onClickTolayer",(t=>{"function"==typeof t.isPopupBind&&t.isPopupBind()?t.openPopup():this.option.enabledPopup&&this.openPopup(t,this.option.popupInfo,this.option.popupOption)}))}pathAnimate(t,e,r){let n={rotate:!0,speed:1,revers:!0,repeat:1/0,easing:va};r=Object.assign({},n,r);let i=new gft({path:e,rotate:r.rotate,speed:r.speed,repeat:r.repeat,revers:r.revers});return this.trigger(Rm.onPathAnimateStart,{data:t}),i.on("animationend",(t=>{this.trigger(Rm.onPathAnimateEnd,{data:t.feature})})),i.on("animating",(t=>{this.trigger(Rm.onPathAnimateRunning,{data:t})})),this.layer.animateFeature(t,i)}pulseAnimate(t,e){let r={fade:ya,duration:2e3,revers:!1,repeat:1/0,easing:ya,radius:30,fillcolor:"rgba(255,0,0,0.2)",strokecolor:"red",strokewidth:1};e=Object.assign({},r,e);let n=new xO({graphicType:"PointGraphic",lnglat:t.getGeometry().getCoordinates(),style:{image:{radius:e.radius,scale:1,fill:{color:e.fillcolor},stroke:{color:e.strokecolor,width:e.strokewidth}},zIndex:990},attribute:{uuid:t.get("uuid")}}),i=new bft(e);this.animList.push({uuid:t.get("uuid"),anim:this.layer.animateFeature(n,i)}),i.on("animationend",(t=>{this.animList.forEach(((e,r)=>{t.feature.get("uuid")==e.uuid&&this.animList.splice(r,1)}))}))}animateFeatures(t,e){t.forEach(((t,r)=>{this.animateFeature(t,e)}))}animateFeature(t,e){let r,n={duration:3e3,animateType:Jp.Bounce,repeat:1,speed:.8,revers:!1,zoomOut:!1,side:!1};switch((e=Object.assign({},n,e)).animateType){case Jp.Blink:r=new fft(e);break;case Jp.Drop:r=new pft(e);break;case Jp.Fade:r=new dft(e);break;case Jp.Path:r=new gft(e);break;case Jp.Shake:r=new yft(e);break;case Jp.Show:r=new mft(e);break;case Jp.Slide:r=new vft(e);break;case Jp.Teleport:r=new _ft(e);break;case Jp.Throw:r=new wft(e);break;case Jp.Zoom:r=new bft(e);break;case Jp.ZoomOut:e.zoomOut=!0,r=new bft(e);break;default:r=new Aft(e)}this.layer.animateFeature(t,r)}},HeatmapLayer:class extends IO{constructor(t,e){super(t,e),this.layertype="HeatmapLayer",this._source=new Aa({wrapX:!1}),this.option={blur:25,radius:8,gradient:["#00f","#0ff","#0f0","#ff0","#f00"]},this.option=Object.assign({},this.option,e),this.layer=new Dc({source:this._source,zIndex:this.option.zIndex,gradient:this.option.gradient,blur:this.option.blur,radius:this.option.radius}),this.layer.set("layerid",t)}setBlur(t){this.layer.setBlur(parseInt(t,10))}setRadius(t){this.layer.setRadius(parseInt(t,10))}},ImageCanvasLayer:class extends Gm{constructor(t,r){if(super(t,r),e(this,"scale"),e(this,"ppi"),e(this,"layerOption"),e(this,"drawText"),this.option={},this.layerOption={line1Style:"rgba(255,0,0, 0.1)",line1Width:.5,line5Style:"rgba(255,0,0, 0.3)",line5Width:1,line10Style:"rgba(255,0,0, 0.5)",line10Width:2,lineRectStyle:"rgba(255, 0, 0, 1)",lineRectWidth:5},this.layerOption=Object.assign({},this.layerOption,r),this.layertype="ImageCanvasLayer",this.layer=new Wc({zIndex:r.zIndex}),!document.getElementById("hutia")){let t=document.createElement("div");t.setAttribute("id","hutia"),t.style.width="1cm",document.body.appendChild(t)}this.layer.setSource(new Qk({canvasFunction:(t,e,r,n,i)=>{var o=document.createElement("canvas");this.trigger(Rm.onScaleChange,{Scale:Math.round(this.scale.getScale())});var s=this._map.getSize(),a=new Array(2);a[0]=n[0]-s[0],a[1]=n[1]-s[1],o.width=n[0],o.height=n[1],a[0]=0,a[1]=0;const l=this.ppi/2.54/10;let u=a[0]/2,h=a[1]/2,c=o.width-a[0],A=o.height-a[1],f=o.getContext("2d");f.clearRect(u,h,c,A);let p=0;for(let d=h;d<o.height-h;d+=l)f.beginPath(),f.moveTo(u,d),f.lineTo(o.width-u,d),f.closePath(),p%10==0?(f.lineWidth=this.layerOption.line10Width,f.strokeStyle=this.layerOption.line10Style):p%5==0?(f.lineWidth=this.layerOption.line5Width,f.strokeStyle=this.layerOption.line5Style):(f.lineWidth=this.layerOption.line1Width,f.strokeStyle=this.layerOption.line1Style),f.stroke(),p++;p=0;for(let d=u;d<o.width-u;d+=l)f.beginPath(),f.moveTo(d,h),f.lineTo(d,o.height-h),f.closePath(),p%10==0?(f.lineWidth=this.layerOption.line10Width,f.strokeStyle=this.layerOption.line10Style):p%5==0?(f.lineWidth=this.layerOption.line5Width,f.strokeStyle=this.layerOption.line5Style):(f.lineWidth=this.layerOption.line1Width,f.strokeStyle=this.layerOption.line1Style),f.stroke(),p++;return f.lineWidth=this.layerOption.lineRectWidth,f.strokeStyle=this.layerOption.lineRectStyle,f.strokeRect(u,h,c,A),o}})),this.layer.set("layerid",t),this.layer.on(Rm.onClick,(t=>{t.feature&&this.trigger(Rm.onClick,t.feature.getProperties())}))}setScale(t){this.scale.setScale(t)}setText(t){this.drawText.updateHtml(t)}setElementStyle(t,e){this.drawText.updateElementStyle(t,e)}appendTo(t){var e;this._map=t,this.layer&&(null==(e=this._map)||e.addLayer(this.layer),this.isAdded=!0);var r=document.getElementById("hutia").offsetWidth,n=screen.width/r,i=screen.height/r,o=Math.round(Math.sqrt(n*n+i*i)/2.54);this.ppi=Math.sqrt(window.screen.width*window.screen.width+window.screen.height*window.screen.height)/o,this.ppi=Math.round(this.ppi),this.scale=new jft({}),this.scale.set("ppi",this.ppi),this.scale.set("Visible",!1),this._map.addControl(this.scale),this.drawText=new Dlt({}),this._map.addControl(this.drawText),this._map.getView().on("change",(t=>{this.layer.getSource().changed()})),document.querySelector(".ol-scale").style.display="none"}setMouseLock(t=!1){let e,r;this._map.getInteractions().forEach((function(n){n instanceof _u&&(e=n),n instanceof Gu&&(r=n),e&&e.setActive(t),r&&r.setActive(t)}))}},PathLayer:class extends Gm{constructor(t,r){super(t,r),e(this,"autoPointSize"),e(this,"result"),e(this,"resultlayer"),e(this,"resultSource"),e(this,"nodesLayer"),e(this,"dijkstra"),e(this,"pathDatalayer"),e(this,"animating"),e(this,"distance"),e(this,"lastTime"),e(this,"pathLine"),e(this,"position"),e(this,"geoMarker"),e(this,"styles"),e(this,"vueThis"),e(this,"pathLineFeature"),e(this,"lastAngle"),e(this,"pathIndex"),e(this,"timer"),e(this,"pathNodeInfo"),e(this,"geoMarkerCircle"),e(this,"moveNodeInfo"),e(this,"FeatureMoveProgressInfo"),e(this,"oldPathLineFeature"),e(this,"routeFeatures"),e(this,"_source"),e(this,"multiLinePathData"),e(this,"fun",(t=>{this.vueThis.moveFeature(t)})),this.option=dO.merge({roadNetworkData:"",pathDefaultStyle:{color:"rgba(255, 255, 255, 0.1)",width:1},pathStyle:{color:"#089519",width:10,imageUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACISURBVDhP3Yy9CYAwFIQzg+ASTuFmuokjuIaFpb2Vc8S7vEswKFE78YOD5H6e+zne+xqq9H0Hhj0U6WU/gwPbZTw7gmJn/UvKR1iwXmKRjlwfYWB5gsNGKh+hYX4ijBUzLx/BZzUvkI0j9JRFNkUhHM3zE3QaR5hBM4tgkG3AaPW85U338zi3A+g3FErF6/qjAAAAAElFTkSuQmCC"},trackPathStyle:{color:"rgba(180,205,205, 1)",width:10},geoMarkerStyle:{url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAlCAYAAABGWhk4AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAABYgAAAWIBXyfQUwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAYGSURBVEiJlZdvaFvXFcB/7+mPI8lvjmxHil0vKkuq1bCuYbVsQrDxFup9aSAezA5pExpGRh26hdF0FOIv+9CyrLCh7dvABARmyIWB6Qad69Ik1PH8h67E0C6anbqTI8myZUeWZE1/nu4+6D7n2VZpcuCgq/vu/d37zjvn3HMVIQS1RFEUxWiaFECYFPE1AGtN6iNRAYv8VWVfRaouf2tKTbDcrQG1AXbZRgKLprGVWrtW93ZIqCJBdsAB1Mfj8d/H4/F3gXrZZyymmMz2SIQQu1RCrYATaAKeDoVC54WUUCh0HnhaPnPKscpejmJ+C5MJrMABQAMOpjY2xgpW13cB6sq5e02NjQPAQyAD/A8oA7tMstcUe8Gu8fHxM41ud/u1Ww/Ua7ceqI1ud/v4+PgZwCXHWOWc3ebYYwKLHOwGfG1tbV2ZbG51IZnT1bdnhfr2rFhI5vRMNrfa1tbWBfjk2AOGvQ2eecfm3dYBznA4fKHe5fS8MbmiVgRUBLwxuaLWu5yecDh8Qdq4rtauVZNtjY9mBxx9fX0tL3QEXv3wyy0xcT+9s/rE/TQffrklXugIvNrX19fCIw+xYvIQ1QRVzeBgMPia3W5zvPlRdJ8rvflRVLHbbY5gMPjaHrBqwC01TOC6evVq++DZs78JLaTUqWiWn//Aw7s/ahOXjh/icL1d+WI9j9OmKj9sb3t2e3t74s6dOymgxKNo3Oe3h4BjiURiUgghbi5vGe4r1lOp5fVUatn4bzxLJBKTwDE5d8evDTvbqEaUd2xsbNCYXNb10szMzGh/f//LwIvAi/39/S/PzMyMlnW9ZIwbGxsbBLySYTO+3S7ww4dbt4QQIrm29unQ0NArQC/QA3RL7QF6h4aGXkmurX0qhBDp9NYne8H7XGx+fv58Op22njp16pb8KCpAIBCoB5ibm8vKb1gBihMTEz1ut7sQCAT+AuSoJqiyERRGYLiohrHW0NDQEA6Hf+L3+497PJ5jLpfLC5DL5VaTyeRiJBL5bHBw8K/pdDpNNbS3gG2qIa4jd+sAGoEjwPeHh4cvbm5uLgqTFPWKKOoVc5fY3NxcHB4evgg8J+c2SpZVka9bJ+1z8ObNmxd7enp+pSiK9at0kd9Nx5mN5VhIbgPwnMdJZ6uLX59owddgRwhRvn379h96e3tvUE1MWaBgkVAHoF2/fr3r3Llzv1UUxfrnf63R/94iUytZYtkSugBdQCxbYi6eY+SzdZqcVjpaXKrP5+tyOp1zk5OTCaqZTleAbwGa3+9vnZ+ff0/TNN+f5lb55cR/9wZcTflj3xF+EfCSyWS+6ujo+GkkEokBmZ0UOTo6ekHTNN/iZoG3Pl55LCjAWx+vsLhZQNM03+jo6AXpBNad/NDa2noc4J2pGNulrz0j98l2qcI7UzEAJMNugC2A1e12Pwvwzwe5x4YaYsyRDCtgUQF1YGCg2eFwNGeKOvdS+ScG30vlyRR1HA5H88DAQDOgqoCIRqMFIYSos6jY1P0H7jeJTVWos6gIIUQ0Gi0AQgUq09PTW7lcbsVuUXje63xi8PNeJ3aLQi6XW5ment4CKirV8CttbGz8G6DniPbEYGOOZJQAXaXq0MVIJDIFcO1kC09p9seGPqXZuXayBQDJ2ElCGtVwbkwkEiNer7frH/fTvBT+D+VK7YLREKuq8LfBZ/jxdxpYXV2dOXz48M+ADSBrLvjUeDx+9/Tp02f8zc66l545yJ2VLMntck3o9w45+PtZP93f1iiVSpnLly8PLSwsJKhmuAJUE7OL6tFydGRk5FI+n08KIUShrIvQ3XXx+gfL4sSNz8WJG5+L1z9YFqG766JQ1oUQQuTz+eTIyMgl4KhkuCRzp/jTAA9wtLu7++TS0tL74htkaWnp/e7u7pMS6pEMO2CpdfQfoJrtXMFgsKOzs7OztbW1vampyQ+QSqUisVjsi9nZ2dkrV67MUz018lQTfBFZxylCiFr1sI1qOq1jd80A1SOpLCEFqSVMx78QQuxUmya4sYBFAo22+aqgSy2b2hVMFWetMtasxkK17iDGlWHnTmIuY/8P3C0FYo4OztIAAAAASUVORK5CYII="},navigationOption:{defaultZoom:15,turnToZoom:17,speed:1,tracking:!0,trackingDirection:!0,showNode:!0,showStartEndNode:!0,showPathLine:!0,scale:1,pointDistance:.5}},r,!0),this.layertype="PathLayer",this._source=new Aa({wrapX:!1,url:this.option.roadNetworkData,format:new kf}),this._source.on("featuresloadend",(t=>{let e=[];t.features.forEach((t=>{let r=t.getGeometry();e.push(r.getCoordinates())})),this.multiLinePathData=new X({geometry:new Ju(e)})}));let n=[];this.pathDatalayer=new Zs({source:this._source,zIndex:900,style:new ji({stroke:new Rn({width:this.option.pathDefaultStyle.width,color:this.option.pathDefaultStyle.color}),fill:new Tn({color:this.option.pathDefaultStyle.color})})}),this.vueThis=this,this.styles={route:new ji({stroke:new Rn({width:6,color:[237,212,0,.8]})}),icon:new ji({image:new Ns({anchor:[.5,1],src:"data/icon.png"})}),geoMarker:new ji({zIndex:999,image:new Ns({src:this.option.geoMarkerStyle.url,rotation:0,rotateWithView:!1})})},this.resultSource=new Aa,this.resultlayer=new Zs({source:this.resultSource,zIndex:200,updateWhileAnimating:!0,updateWhileInteracting:!0}),this.position=new nn([0,0]),this.geoMarker=new X({geometry:this.position}),this.geoMarker.setStyle(this.styles.geoMarker),this.resultSource.addFeature(this.geoMarker),this.resultlayer.on("change",(t=>{})),this.dijkstra=new Eft({source:this._source}),this.dijkstra.on("start",(t=>{this.resultSource.clear()})),this.dijkstra.on("finish",(t=>{if(this.resultSource.clear(),!t.route.length)return void this.trigger(Rm.onPathComputerComplete,{pathLine:null,distance:0});if(this.routeFeatures=t.route,this.pathNodeInfo=cO.lineMerger(t.route,this.option.navigationOption.pointDistance),this.pathLineFeature=this.pathNodeInfo.line,this.pathLine=this.pathLineFeature.getGeometry(),this.option.navigationOption.totalDistance=Xe(this.pathLine)*this.option.navigationOption.scale,this.option.navigationOption.showNode){let t=0;this.pathLine.forEachSegment(((e,r)=>{let n=new X({geometry:new nn(e)});n.setStyle(new ji({image:new Ri({radius:12,fill:new Tn({color:"#bb1422"})}),text:new Vi({offsetX:0,offsetY:0,textAlign:"center",textBaseline:"middle",text:t.toString(),font:"12px sans-serif",fill:new Tn({color:"white"})})})),t++,this.resultSource.addFeature(n)}))}this.position.setCoordinates(this.pathLine.getFirstCoordinate()),this.setNavigationMarker(this.pathLine.getFirstCoordinate(),0),this.option.navigationOption.tracking&&(this._map.getView().setCenter(this.pathLine.getFirstCoordinate()),this._map.getView().setZoom(this.option.navigationOption.defaultZoom)),this.geoMarkerCircle=new X({geometry:new Xu(this.pathLine.getFirstCoordinate(),50)}),this.oldPathLineFeature=new X({geometry:new Nn([this.pathLine.getFirstCoordinate()])}),this.oldPathLineFeature.setStyle(new ji({stroke:new Rn({color:this.option.trackPathStyle.color,width:this.option.trackPathStyle.width})})),this.pathLineFeature.setStyle(this.styleFunc.bind(this)),this.geoMarkerCircle.setStyle(new ji({stroke:new Rn({width:6,color:[237,212,0,.8]}),fill:new Tn({color:"rgba(255, 255, 255, 0.1)"})})),this.option.navigationOption.showPathLine&&(this.resultSource.addFeature(this.geoMarker),this.resultSource.addFeature(this.oldPathLineFeature),this.resultSource.addFeature(this.pathLineFeature));let e=Xe(this.pathLineFeature.getGeometry());this.trigger(Rm.onPathComputerComplete,{pathLine:this.pathLineFeature,distance:e})})),this.dijkstra.on("pause",(t=>{t.overflow&&this.dijkstra.resume()})),this.dijkstra.on("calculating",(t=>{var e=this.dijkstra.getBestWay();this.resultSource.clear(),this.resultSource.addFeatures(e)})),this.nodesLayer=new Zs({source:this.dijkstra.getNodeSource(),style:new ji({image:new Ri({radius:5,fill:new Tn({color:[255,0,0,.1]})})})}),n.push(this.nodesLayer),n.push(this.resultlayer),n.push(this.pathDatalayer),this.layer=new ka({layers:n}),this.layer.set("layerid",t),this.animating=!1,this.distance=0,this.lastTime}styleFunc(t,e){let r=[];r.push(new ji({stroke:new Rn({color:this.option.pathStyle.color,width:this.option.pathStyle.width})}));const n=t.get("geometry");if("linestring"===n.getType().toLowerCase()){const t=n.getCoordinates(),i=n.getLength(),o=80*e,s=Math.ceil(i/o);for(let e=1;e<s;e++){const t=e/s,i=n.getCoordinateAt(t),o=n.getCoordinateAt(t+.05*t),a=o[0]-i[0],l=o[1]-i[1],u=Math.atan2(l,a);r.push(new ji({geometry:new nn(i),image:new Ns({scale:.8,rotateWithView:!0,rotation:-u,src:this.option.pathStyle.imageUrl})}))}this.option.navigationOption.showStartEndNode&&(r.push(new ji({geometry:new nn(t[0]),image:new Ri({radius:12,fill:new Tn({color:"green"})}),text:new Vi({offsetX:0,offsetY:0,textAlign:"center",textBaseline:"middle",text:"起",font:"12px sans-serif",fill:new Tn({color:"white"})})})),r.push(new ji({geometry:new nn(t[t.length-1]),image:new Ri({radius:12,fill:new Tn({color:"#bb1422"})}),text:new Vi({offsetX:0,offsetY:0,textAlign:"center",textBaseline:"middle",text:"终",font:"12px sans-serif",fill:new Tn({color:"white"})})})))}return r}moveFeature(t){this.resultlayer.changed();const e=t.frameState.time,r=e-this.lastTime;if(this.distance=(this.distance+this.option.navigationOption.speed*r/1e6)%2,this.lastTime=e,this.trigger(Rm.onFeatureMoveProgress,{progress:this.distance,distance:this.distance,elapsedTime:r}),this.distance>=1)this.stopAnimation();else{const e=this.pathLine.getCoordinateAt(this.distance);let n,i=(this.distance+this.option.navigationOption.speed*r/1e6)%2;n=i>=1?this.pathLine.getLastCoordinate():this.pathLine.getCoordinateAt(i);let o=this.setAngle(e,n);this.position.setCoordinates(e),this.option.navigationOption.tracking?(this._map.getView().setCenter(e),this._map.getView().setRotation(o.viewAngle)):this.styles.geoMarker.getImage().setRotation(o.markAngle);const s=function(t){if(!(t.context instanceof CanvasRenderingContext2D))throw new Error("Only works for render events from Canvas 2D layers");var e=t.inversePixelTransform[0],r=t.frameState,n=pt(t.inversePixelTransform.slice(),r.coordinateToPixelTransform),i=Hs(r.viewState.resolution,e);return new vs(t.context,e,r.extent,n,r.viewState.rotation,i,void 0)}(t);s.setStyle(this.styles.geoMarker),s.drawGeometry(this.position),this._map.render()}}setAngle(t,e){let r=e[1]-t[1],n=e[0]-t[0],i=1,o=Math.atan(r/n);r<=0&&n>=0?(i=2,o=-o):n>=0&&r>=0?(o=-o,i=1):n<=0&&r>=0?(o=Math.PI-o,i=4):n<=0&&r<=0&&(o=Math.PI-o,i=3);var s=Math.atan2(1,0);return{viewAngle:-s-o,markAngle:s+o,Angle:s-Math.atan2(r,n),xx:i}}startAnimation(t=!0,e=!0,r=10){this.lastAngle=0,this.distance=0,this.animating=!0,this.lastTime=Date.now(),this._map.getView().setCenter(this.pathLine.getFirstCoordinate()),this._map.getView().setZoom(15),this.resultlayer.addEventListener("postrender",this.fun)}pauseAnimation(){this.resultlayer.removeEventListener("postrender",this.fun)}resumeAnimation(){this.resultlayer.addEventListener("postrender",this.fun)}stopAnimation(){this.animating=!1,this.position.setCoordinates(this.pathLine.getLastCoordinate()),this.geoMarker.setGeometry(this.position),this._map.getView().setRotation(0),this._map.getView().setCenter(this.pathLine.getLastCoordinate()),this.resultlayer.removeEventListener("postrender",this.fun)}startAnimation2(t){clearInterval(this.timer),t&&(this.option.navigationOption=Object.assign({},this.option.navigationOption,t)),this.distance=0,this.animating=!0,this.lastTime=Date.now(),this.pathNodeInfo.nodeData.length>3?this.moveNodeInfo={currentNode:this.pathNodeInfo.nodeData[0],nextNode:this.pathNodeInfo.nodeData[1],threeNode:this.pathNodeInfo.nodeData[2]}:this.moveNodeInfo={currentNode:this.pathNodeInfo.nodeData[0],nextNode:this.pathNodeInfo.nodeData[1],threeNode:this.pathNodeInfo.nodeData[1]},this.option.navigationOption.tracking&&(this._map.getView().setCenter(this.pathLine.getFirstCoordinate()),this._map.getView().setZoom(this.option.navigationOption.defaultZoom),this._map.getView().setRotation(this.setAngle(ur(this.moveNodeInfo.currentNode.coords),ur(this.moveNodeInfo.nextNode.coords)).viewAngle)),this.oldPathLineFeature.getGeometry().setCoordinates([this.pathLine.getFirstCoordinate()]),this.pathIndex=0,this.FeatureMoveProgressInfo={nodeNum:this.moveNodeInfo.currentNode.coordIndex,progress:this.pathIndex/this.pathNodeInfo.coordinates.length,remainingDistance:this.option.navigationOption.totalDistance-this.option.navigationOption.totalDistance*(this.pathIndex/this.pathNodeInfo.coordinates.length),nextNodeDistance:this.moveNodeInfo.currentNode.distance*this.option.navigationOption.scale,totalDistance:this.option.navigationOption.totalDistance,angle:this.ComputDirection()},this.timer=setInterval((()=>{this.moveFeature3(this.pathIndex),this.pathIndex=this.pathIndex+this.option.navigationOption.speed}),1)}stopAnimation2(){this.animating=!1,this.position.setCoordinates(this.pathLine.getLastCoordinate()),this.geoMarker.setGeometry(this.position),this._map.getView().setRotation(0),this._map.getView().setCenter(this.pathLine.getLastCoordinate()),clearInterval(this.timer)}pauseAnimation2(){clearInterval(this.timer)}resumeAnimation2(){this.timer=setInterval((()=>{this.moveFeature3(this.pathIndex),this.pathIndex=this.pathIndex+this.option.navigationOption.speed}),100)}moveFeature3(t){const e=(new Date).getTime(),r=e-this.lastTime;if(this.distance=(this.distance+this.option.navigationOption.speed*r/1e6)%2,this.lastTime=e,t>=this.pathNodeInfo.coordinates.length)this.stopAnimation2();else{const e=ur(this.pathNodeInfo.coordinates[t]);this.oldPathLineFeature.getGeometry().appendCoordinate(e),this.oldPathLineFeature.getGeometry().changed();let r=Xe(new Nn([e,ur(this.moveNodeInfo.nextNode.coords)]))*this.option.navigationOption.scale;if(this.position.setCoordinates(e),this.geoMarker.getGeometry().setCoordinates(e),this.geoMarkerCircle.getGeometry().setCenter(e),this.FeatureMoveProgressInfo.nodeNum=this.moveNodeInfo.currentNode.coordIndex,this.FeatureMoveProgressInfo.nextNodeDistance=r,this.FeatureMoveProgressInfo.progress=t/this.pathNodeInfo.coordinates.length,this.FeatureMoveProgressInfo.remainingDistance=this.option.navigationOption.totalDistance-this.option.navigationOption.totalDistance*this.FeatureMoveProgressInfo.progress,r<=1*this.option.navigationOption.speed){let t=this.moveNodeInfo.currentNode.coordIndex+1;if(t<this.pathNodeInfo.nodeData.length-1){this.moveNodeInfo.currentNode=this.pathNodeInfo.nodeData[t],this.moveNodeInfo.nextNode=this.pathNodeInfo.nodeData[t+1],t<this.pathNodeInfo.nodeData.length-2?(this.moveNodeInfo.threeNode=this.pathNodeInfo.nodeData[t+2],this.FeatureMoveProgressInfo.angle=this.ComputDirection()):this.FeatureMoveProgressInfo.angle="直行";let e=this.setAngle(ur(this.moveNodeInfo.currentNode.coords),ur(this.moveNodeInfo.nextNode.coords));this.option.navigationOption.tracking?this._map.getView().setRotation(e.viewAngle):this.styles.geoMarker.getImage().setRotation(e.markAngle)}}this.trigger(Rm.onFeatureMoveProgress,this.FeatureMoveProgressInfo),this.option.navigationOption.tracking&&this._map.getView().setCenter(e)}}moveFeature2(){const t=(new Date).getTime(),e=t-this.lastTime;if(this.distance=(this.distance+this.option.navigationOption.speed*e/1e6)%2,this.lastTime=t,this.distance>=1)this.stopAnimation2();else{const t=this.pathLine.getCoordinateAt(this.distance);let r,n=Xe(new Nn([t,ur(this.moveNodeInfo.nextNode.coords)]));if(this.position.setCoordinates(t),this.geoMarker.getGeometry().setCoordinates(t),this.geoMarkerCircle.getGeometry().setCenter(t),n<100){let t=cO.movePointContain(this.geoMarkerCircle,this.pathNodeInfo.nodeData);if(-1!=t.coordIndex&&t.coordIndex!=this.moveNodeInfo.currentNode.coordIndex&&t.coordIndex<=this.moveNodeInfo.currentNode.coordIndex+2){this.moveNodeInfo={currentNode:this.pathNodeInfo.nodeData[t.coordIndex],nextNode:this.pathNodeInfo.nodeData[t.coordIndex+1],threeNode:this.pathNodeInfo.nodeData[t.coordIndex+2]};let n=this._map.getPixelFromCoordinate(ur(this.moveNodeInfo.currentNode.coords)),i=this._map.getPixelFromCoordinate(ur(this.moveNodeInfo.nextNode.coords)),o=this._map.getPixelFromCoordinate(ur(this.moveNodeInfo.threeNode.coords)),s=(i[0]-n[0])*(o[1]-i[1])-(i[1]-n[1])*(o[0]-i[0]),a=this.setAngle(ur(this.moveNodeInfo.nextNode.coords),ur(this.moveNodeInfo.threeNode.coords));this.trigger(Rm.onFeatureMoveProgress,{nodeNum:this.moveNodeInfo.currentNode.coordIndex,progress:this.distance,distance:this.option.navigationOption.totalDistance-this.option.navigationOption.totalDistance*this.distance,elapsedTime:e,nextNodeDistance:this.moveNodeInfo.currentNode.distance,nextNodeDirection:a.markAngle,angle:s>0?"右":"左",xx:a.xx}),r=this.setAngle(ur(this.moveNodeInfo.currentNode.coords),ur(this.moveNodeInfo.nextNode.coords)),this.option.navigationOption.tracking?this._map.getView().setRotation(r.viewAngle):this.styles.geoMarker.getImage().setRotation(r.markAngle)}}this.option.navigationOption.tracking?this._map.getView().setCenter(t):this.styles.geoMarker.getImage().setRotation(r.markAngle)}}ComputDirection(){let t=this._map.getPixelFromCoordinate(ur(this.moveNodeInfo.currentNode.coords)),e=this._map.getPixelFromCoordinate(ur(this.moveNodeInfo.nextNode.coords)),r=this._map.getPixelFromCoordinate(ur(this.moveNodeInfo.threeNode.coords)),n=(e[0]-t[0])*(r[1]-e[1])-(e[1]-t[1])*(r[0]-e[0]);return 0==n?"直行":n>0?"右":"左"}getNearestPointOnPathNetWork(t){let e;return e=t instanceof X?t:new X({geometry:new nn(t)}),cO.nearestPointOnLine(e,this.multiLinePathData)}addNavigationMarker(){this.resultSource.addFeature(this.geoMarker)}setNavigationMarker(t,e=0){let r;r=t instanceof X?t:new X({geometry:new nn(t)}),this.position.setCoordinates(r.getGeometry().getCoordinates());let n=cO.nearestPointOnLine(r,this.multiLinePathData);this.geoMarker.setGeometry(n.getGeometry()),this.styles.geoMarker.getImage().setRotation(e),this.pathLineFeature&&this.resultSource.hasFeature(this.pathLineFeature)&&this.updateNavigationMarker(n)}updateNavigationMarker(t){let e=new X({geometry:new nn(this.pathLine.getFirstCoordinate())});new X({geometry:new nn(this.pathLine.getLastCoordinate())});let r=cO.lineSlice(e,t,this.pathLineFeature);this.pathIndex=t.get("index"),this.moveNodeInfo={currentNode:this.pathNodeInfo.nodeData[this.pathIndex],nextNode:this.pathNodeInfo.nodeData[this.pathIndex+1]};let n=Xe(r.getGeometry())*this.option.navigationOption.scale;this.FeatureMoveProgressInfo={nodeNum:this.moveNodeInfo.currentNode.coordIndex,progress:n/this.option.navigationOption.totalDistance,remainingDistance:this.option.navigationOption.totalDistance-n,nextNodeDistance:Xe(new Nn([t.getGeometry().getCoordinates(),ur(this.moveNodeInfo.nextNode.coords)]))*this.option.navigationOption.scale,totalDistance:this.option.navigationOption.totalDistance,angle:""},this.pathIndex<this.pathNodeInfo.nodeData.length-2?(this.moveNodeInfo.threeNode=this.pathNodeInfo.nodeData[this.pathIndex+2],this.FeatureMoveProgressInfo.angle=this.ComputDirection()):(this.moveNodeInfo.threeNode=this.pathNodeInfo.nodeData[this.pathIndex+1],this.FeatureMoveProgressInfo.angle="直行"),this.trigger(Rm.onFeatureMoveProgress,this.FeatureMoveProgressInfo),this.oldPathLineFeature.setGeometry(r.getGeometry()),this.oldPathLineFeature.getGeometry().changed();let i=this.setAngle(ur(this.moveNodeInfo.currentNode.coords),ur(this.moveNodeInfo.nextNode.coords));this.option.navigationOption.tracking?this._map.getView().setRotation(i.viewAngle):this.styles.geoMarker.getImage().setRotation(i.markAngle),this.option.navigationOption.tracking&&this._map.getView().setCenter(t.getGeometry().getCoordinates())}getPathLine(){return this.pathLine}computerPath(t,e){let r,n;r=t instanceof X?t.getGeometry().getCoordinates():t,n=e instanceof X?e.getGeometry().getCoordinates():e,clearInterval(this.timer),this.resultSource.clear(),this.dijkstra.path(r,n)}computerPath2(t,e){let r=this.getFile("../public/tempData/铁路_简版.json","text/json"),n=this.formatJsonTo4326Json(JSON.parse(r));var i=new Gft(n,{weightFn:function(t,e,r){var n=t[0]-e[0],i=t[1]-e[1];return Math.sqrt(n*n+i*i)}});let o=cO.featureTo4326(t),s=cO.featureTo4326(e);i.findPath(o,s)}addGeoJsonUrl(t,e){let r=this.getFile(e,"text/json"),n=this.formatJsonTo3857(JSON.parse(r));this.addFeatures(t,n)}addGeoJson(t,e){this.addFeatures(t,this.formatJsonTo3857(e))}convertGeoJsontoFeatures(t){return this.formatJsonTo3857(t)}addFeatures(t,e){var r;null==(r=this._map)||r.getView().getZoom(),e.forEach((e=>{e.set("classname",t),e.get("featuretype")||e.set("featuretype",Kp.vector),Xm.getFeaturesDefaultStyle(e,25,this.autoPointSize);let r=Xm.getStyle(e.getGeometry().getType(),e.get("style"));e.setStyle(r)})),this._source.addFeatures(e)}addFeature(t,e){e.set("classname",t),this._source.addFeature(e)}getFeaturesByClassName(t){let e=[];return this._source.getFeatures().forEach((r=>{r.get("classname")==t&&e.push(r)})),e}getFeatures(t){let e=[];return this._source.getFeatures().forEach((r=>{r.get("name")==t&&e.push(r)})),e}getFeature(t){let e=null;return this._source.getFeatures().forEach((r=>{r.get("name")!=t||(e=r)})),e}removeFeatures(t){this._source.getFeatures().forEach((e=>{e.get("classname")==t&&this._source.removeFeature(e)}))}removeNavigationPath(){this.resultSource.forEachFeature((t=>{t!=this.geoMarker&&this.resultSource.removeFeature(t)}))}removeNavigationMarker(){this.resultSource.removeFeature(this.geoMarker)}removeNavigationAll(){this.resultSource.clear()}pathToGeoJSON(){return(new kf).writeFeaturesObject(this.routeFeatures,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}appendTo(t){var e;this._map=t,this.layer&&(null==(e=this._map)||e.addLayer(this.layer),this.isAdded=!0)}},PbfLayer:class extends Gm{constructor(t,r){super(t,r),e(this,"_source"),this.layertype="PbfLayer",this.layerid=t,this._source=new If({format:new NA,url:r.url,tileLoadFunction:function(t,e){t.setLoader((function(r,n,i){fetch(e).then((function(e){e.arrayBuffer().then((function(e){const n=t.getFormat().readFeatures(e,{extent:r,featureProjection:i});let o=[];n.forEach((t=>{let e=BA(t);e.set("movestate",!0),e.set("editstate",!0),o.push(BA(t))})),t.setFeatures(o)}))}))}))}});const n=new ji({fill:new Tn({color:"#eeeeee"}),stroke:new Rn({color:"#eeeeee",width:1})});this.layer=new of({zIndex:r.zIndex,source:this._source,style:function(t){return r.featureStyle&&r.featureStyle.forEach((e=>{if(t.get(e.propertiesName)==e.propertiesValue)return n.getFill().setColor(e.fillColor),n.getStroke().setColor(e.strokeColor),void n.getStroke().setWidth(e.strokeWidth)})),n}}),this.layer.set("layerid",t)}},TifLayer:class extends aU{constructor(t,e){super(t,e),this.layertype="GeoTIFFLayer",this.layerSource=new Tk({sources:[{url:this.option.url}]}),this.layer=new Vp({source:this.layerSource}),this.layer.set("layerid",t),this.mImageExtent&&this.layer.setExtent(this.mImageExtent),this.layerSource.on("tileloadstart",(t=>{this.trigger(Um.tileloadstart,t)})),this.layerSource.on("tileloadend",(t=>{this.trigger(Um.tileloadend,t)})),this.layerSource.on("tileloaderror",(t=>{this.trigger(Um.tileloaderror,t)}))}padLeft(t,e,r){let n=t.toString(r||10);return(new Array(e).join("0")+n).slice(-e)}},TileTencentLayer:jU,TileXyzLayer:QU,WfsLayer:class extends IO{constructor(t,r){super(t,r),e(this,"geoserverData"),this.layertype="WfsLayer";const n=this.option.url;this._source=new Aa({format:new kf,url:function(t){return n+"&version=1.1.0&request=GetFeature&typename=xianjie1:2020年初县级矢量3857&outputFormat=application/json&srsname=EPSG:3857&NaN"+t.join(",")+",EPSG:3857"},strategy:oa}),this.layer=new Zs({source:this._source,style:new ji({stroke:new Rn({color:"rgba(0, 0, 255, 1.0)",width:2})})}),this.layer.set("layerid",t),this.geoserverData={wsName:"",uri:"mars",wfsURL:this.option.url,layer:"hfty"}}loadData(){var t={srcName:"EPSG:3857",featureNS:this.geoserverData.uri,featurePrefix:this.geoserverData.wsName,featureTypes:[this.geoserverData.layer],outputFormat:"application/json"},e=(new uft).writeGetFeature(t);fetch(this.geoserverData.wfsURL,{method:"POST",body:(new XMLSerializer).serializeToString(e)}).then((function(t){return t.json()})).then((t=>{var e=new kf({geometryName:"geom"}).readFeatures(t);this._source&&this.addFeatures("wms",e)}))}},WmsLayer:class extends aU{constructor(t,e){super(t,e),this.layertype="ImageWMSLayer",this.layerSource=new qk(e),this.layer=new Wc({source:this.layerSource}),this.layer.set("layerid",t),this.mImageExtent&&this.layer.setExtent(this.mImageExtent),this.layerSource.on("tileloadstart",(function(){})),this.layerSource.on("tileloadend",(function(){})),this.layerSource.on("tileloaderror",(function(){}))}},WmtsLayer:class extends aU{constructor(t,e){super(t,e),this.layertype="ImageWMSLayer",this.option=Object.assign({},{opacity:.7,attributions:"",layer:"",matrixSet:"GoogleMapsCompatible",format:"image/png"},e);const r=nr("EPSG:3857"),n=r.getExtent(),i=$t(n)/256,o=new Array(19),s=new Array(19);for(let a=0;a<19;++a)o[a]=i/Math.pow(2,a),s[a]=a;this.layerSource=new Jk({attributions:this.option.attributions,url:this.option.url,layer:this.option.layer,matrixSet:this.option.matrixSet,format:this.option.format,projection:r,tileGrid:new Xk({origin:Zt(n),resolutions:o,matrixIds:s}),style:"default",wrapX:!0}),this.layer=new Vf({zIndex:this.option.zIndex,opacity:this.option.opacity,source:this.layerSource}),this.layer.set("layerid",t),this.mImageExtent&&this.layer.setExtent(this.mImageExtent),this.layerSource.on("tileloadstart",(function(){})),this.layerSource.on("tileloadend",(function(){})),this.layerSource.on("tileloaderror",(function(){}))}},XWebGLPointsLayer:class extends Gm{constructor(t,e){super(t,e),this.layertype="XWebGLPointsLayer",this._source=new Aa({wrapX:!1}),this.Layer=new Qp({source:this._source,style:{symbol:{symbolType:"circle",size:["interpolate",["exponential",2.5],["zoom"],2,1,12,8,16,12],color:"#ffed02",offset:[0,0],opacity:.95}},disableHitDetection:!1,colorCallback:function(t,e,r){},attributes:[{name:"color",callback:function(t){}},{name:"size",callback:function(t){}},{name:"GraphicColor",callback:function(t){}}]}),this.Layer.on(Rm.onClick,(t=>{t.feature&&this.trigger(Rm.onClick,t.feature.getProperties())}))}appendTo(t){var e;this._map=t,null==(e=this._map)||e.addLayer(this.Layer)}addGeoJson(t,e){let r=this.formatJsonTo3857(e);this.addFeatures(t,r)}addFeatures(t,e){var r;let n=null==(r=this._map)?void 0:r.getView().getZoom();e.forEach((e=>{e.set("classname",t),e.get("featuretype")||e.set("featuretype",Kp.vector);let r=Xm.getFeaturesDefaultStyle(e,n,!1);e.setStyle(r)})),this._source.addFeatures(e)}},imageLayer:bD,kmlLayer:class extends IO{constructor(t,e){super(t,e),this.option={},Object.assign(this.option,e),this.layertype="KmlLayer",this._source=new Aa({url:e.url,format:new sAt({extractStyles:!1})}),this.layer=new Zs({source:this._source,zIndex:e.zIndex}),this.layer.set("layerid",t),this.layer.on(Rm.onClick,(t=>{t.feature&&this.trigger(Rm.onClick,t.feature.getProperties())}))}}},Symbol.toStringTag,{value:"Module"})),Kft=Object.freeze(Object.defineProperty({__proto__:null,getJSON:function(t){const e=new XMLHttpRequest;return e.open("get",t,!1),e.setRequestHeader("content-type","application/json"),e.send(),JSON.parse(e.response)}},Symbol.toStringTag,{value:"Module"}));class qft{constructor(t){e(this,"option"),this.option={key:"50da1a3686015849769f4a414bfdfb8f"},this.option=Object.assign({},this.option,t)}}const Wft=Object.freeze(Object.defineProperty({__proto__:null,GaodePOI:class extends qft{constructor(t){super(t)}query(t){let e=new wO,r={serverUrl:"",queryType:1,keywords:"",location:"",radius:"3000",city:"西安市",city_limit:!0,polygon:"",extensions:"base",offset:20,page:1,success:null,error:null};r=Object.assign({},r,t);let n=[{type:"周边搜索",url:r.serverUrl+"/v3/place/around",parameters:{key:this.option.key,keywords:r.keywords,location:r.location,radius:r.radius,offset:r.offset,page:r.page}},{type:"关键字搜索",url:r.serverUrl+"/v3/place/text",parameters:{key:this.option.key,keywords:r.keywords,city:t.city,city_limit:t.city_limit,offset:r.offset,page:r.page}},{type:"多边形区域搜索",url:r.serverUrl+"/v3/place/polygon",parameters:{key:this.option.key,keywords:t.keywords,polygon:t.polygon,offset:r.offset,page:r.page}}];r.keywords=r.keywords.replace("","|"),mO(n[r.queryType].url+gO(n[r.queryType].parameters)).then((function(r){r.pois.forEach((t=>{let r=t.location.split(","),n=e.gcj02ToWgs84(parseFloat(r[1]),parseFloat(r[0]));t.lnglat=[n.lontitude,n.latitude]})),t.success(r)})).catch((function(e){t.error&&t.error(e)}))}queryUrl(){}},GaodeRoute:class extends qft{constructor(t){super(t)}query(t){let e=new wO,r=[{type:"驾车",url:t.serverUrl+"/v3/direction/driving"},{type:"步行",url:t.serverUrl+"/v3/direction/walking"},{type:"公交",url:t.serverUrl+"/v3/direction/transit/integrated"}];t.params.key=this.option.key,mO(r[t.queryType].url+gO(t.params)).then((function(r){r.route.paths.forEach((t=>{t.points=[],t.steps.forEach((r=>{r.polyline.split(";").forEach((r=>{let n=r.split(","),i=e.gcj02ToWgs84(parseFloat(n[1]),parseFloat(n[0]));t.points.push([i.lontitude,i.latitude])}))}))})),t.success(r)})).catch((function(e){t.error&&t.error(e)}))}}},Symbol.toStringTag,{value:"Module"}));function Xft(t,e){let r=t.length-e,n=0;do{for(let r=e;r>0;r--)t[n+e]+=t[n],n++;r-=e}while(r>0)}function Yft(t,e,r){let n=0,i=t.length;const o=i/r;for(;i>e;){for(let r=e;r>0;--r)t[n+e]+=t[n],++n;i-=e}const s=t.slice();for(let a=0;a<o;++a)for(let e=0;e<r;++e)t[r*a+e]=s[(r-e-1)*o+a]}class Zft{async decode(t,e){const r=await this.decodeBlock(e),n=t.Predictor||1;if(1!==n){const e=!t.StripOffsets;return function(t,e,r,n,i,o){if(!e||1===e)return t;for(let l=0;l<i.length;++l){if(i[l]%8!=0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(i[l]!==i[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const s=i[0]/8,a=2===o?1:i.length;for(let l=0;l<n&&!(l*a*r*s>=t.byteLength);++l){let n;if(2===e){switch(i[0]){case 8:n=new Uint8Array(t,l*a*r*s,a*r*s);break;case 16:n=new Uint16Array(t,l*a*r*s,a*r*s/2);break;case 32:n=new Uint32Array(t,l*a*r*s,a*r*s/4);break;default:throw new Error(`Predictor 2 not allowed with ${i[0]} bits per sample.`)}Xft(n,a)}else 3===e&&(n=new Uint8Array(t,l*a*r*s,a*r*s),Yft(n,a,s))}return t}(r,n,e?t.TileWidth:t.ImageWidth,e?t.TileLength:t.RowsPerStrip||t.ImageLength,t.BitsPerSample,t.PlanarConfiguration)}return r}}const Jft=Object.freeze(Object.defineProperty({__proto__:null,default:class extends Zft{decodeBlock(t){return t}}},Symbol.toStringTag,{value:"Module"})),$ft=9,tpt=257;function ept(t,e){for(let r=e.length-1;r>=0;r--)t.push(e[r]);return t}const rpt=Object.freeze(Object.defineProperty({__proto__:null,default:class extends Zft{decodeBlock(t){return function(t){const e=new Uint16Array(4093),r=new Uint8Array(4093);for(let p=0;p<=257;p++)e[p]=4096,r[p]=p;let n=258,i=$ft,o=0;function s(){n=258,i=$ft}function a(t){const e=function(t,e,r){const n=e%8,i=Math.floor(e/8),o=8-n,s=e+r-8*(i+1);let a=8*(i+2)-(e+r);const l=8*(i+2)-e;if(a=Math.max(0,a),i>=t.length)return tpt;let u=t[i]&2**(8-n)-1;u<<=r-o;let h=u;if(i+1<t.length){let e=t[i+1]>>>a;e<<=Math.max(0,r-l),h+=e}if(s>8&&i+2<t.length){const n=8*(i+3)-(e+r);h+=t[i+2]>>>n}return h}(t,o,i);return o+=i,e}function l(t,i){return r[n]=i,e[n]=t,n++,n-1}function u(t){const n=[];for(let i=t;4096!==i;i=e[i])n.push(r[i]);return n}const h=[];s();const c=new Uint8Array(t);let A,f=a(c);for(;f!==tpt;){if(256===f){for(s(),f=a(c);256===f;)f=a(c);if(f===tpt)break;if(f>256)throw new Error(`corrupted code at scanline ${f}`);ept(h,u(f)),A=f}else if(f<n){const t=u(f);ept(h,t),l(A,t[t.length-1]),A=f}else{const t=u(A);if(!t)throw new Error(`Bogus entry. Not in dictionary, ${A} / ${n}, position: ${o}`);ept(h,t),h.push(t[t.length-1]),l(A,t[t.length-1]),A=f}n+1>=2**i&&(12===i?A=void 0:i++),f=a(c)}return new Uint8Array(h)}(t).buffer}}},Symbol.toStringTag,{value:"Module"})),npt=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),ipt=4017,opt=799,spt=3406,apt=2276,lpt=1567,upt=3784,hpt=5793,cpt=2896;function Apt(t,e){let r=0;const n=[];let i=16;for(;i>0&&!t[i-1];)--i;n.push({children:[],index:0});let o,s=n[0];for(let a=0;a<i;a++){for(let i=0;i<t[a];i++){for(s=n.pop(),s.children[s.index]=e[r];s.index>0;)s=n.pop();for(s.index++,n.push(s);n.length<=a;)n.push(o={children:[],index:0}),s.children[s.index]=o.children,s=o;r++}a+1<i&&(n.push(o={children:[],index:0}),s.children[s.index]=o.children,s=o)}return n[0].children}function fpt(t,e,r,n,i,o,s,a,l){const{mcusPerLine:u,progressive:h}=r,c=e;let A=e,f=0,p=0;function d(){if(p>0)return p--,f>>p&1;if(f=t[A++],255===f){const e=t[A++];if(e)throw new Error(`unexpected marker: ${(f<<8|e).toString(16)}`)}return p=7,f>>>7}function g(t){let e,r=t;for(;null!==(e=d());){if(r=r[e],"number"==typeof r)return r;if("object"!=typeof r)throw new Error("invalid huffman sequence")}return null}function y(t){let e=t,r=0;for(;e>0;){const t=d();if(null===t)return;r=r<<1|t,--e}return r}function m(t){const e=y(t);return e>=1<<t-1?e:e+(-1<<t)+1}let v,_=0,w=0;function b(t,e,r,n,i){const o=r%u,s=(r/u|0)*t.v+n,a=o*t.h+i;e(t,t.blocks[s][a])}function x(t,e,r){const n=r/t.blocksPerLine|0,i=r%t.blocksPerLine;e(t,t.blocks[n][i])}const E=n.length;let C,S,B,I,P,T;T=h?0===o?0===a?function(t,e){const r=g(t.huffmanTableDC),n=0===r?0:m(r)<<l;t.pred+=n,e[0]=t.pred}:function(t,e){e[0]|=d()<<l}:0===a?function(t,e){if(_>0)return void _--;let r=o;const n=s;for(;r<=n;){const n=g(t.huffmanTableAC),i=15&n,o=n>>4;if(0===i){if(o<15){_=y(o)+(1<<o)-1;break}r+=16}else r+=o,e[npt[r]]=m(i)*(1<<l),r++}}:function(t,e){let r=o;const n=s;let i=0;for(;r<=n;){const n=npt[r],o=e[n]<0?-1:1;switch(w){case 0:{const e=g(t.huffmanTableAC),r=15&e;if(i=e>>4,0===r)i<15?(_=y(i)+(1<<i),w=4):(i=16,w=1);else{if(1!==r)throw new Error("invalid ACn encoding");v=m(r),w=i?2:3}continue}case 1:case 2:e[n]?e[n]+=(d()<<l)*o:(i--,0===i&&(w=2===w?3:0));break;case 3:e[n]?e[n]+=(d()<<l)*o:(e[n]=v<<l,w=0);break;case 4:e[n]&&(e[n]+=(d()<<l)*o)}r++}4===w&&(_--,0===_&&(w=0))}:function(t,e){const r=g(t.huffmanTableDC),n=0===r?0:m(r);t.pred+=n,e[0]=t.pred;let i=1;for(;i<64;){const r=g(t.huffmanTableAC),n=15&r,o=r>>4;if(0===n){if(o<15)break;i+=16}else i+=o,e[npt[i]]=m(n),i++}};let F,M,L=0;M=1===E?n[0].blocksPerLine*n[0].blocksPerColumn:u*r.mcusPerColumn;const O=i||M;for(;L<M;){for(S=0;S<E;S++)n[S].pred=0;if(_=0,1===E)for(C=n[0],P=0;P<O;P++)x(C,T,L),L++;else for(P=0;P<O;P++){for(S=0;S<E;S++){C=n[S];const{h:t,v:e}=C;for(B=0;B<e;B++)for(I=0;I<t;I++)b(C,T,L,B,I)}if(L++,L===M)break}if(p=0,F=t[A]<<8|t[A+1],F<65280)throw new Error("marker was not found");if(!(F>=65488&&F<=65495))break;A+=2}return A-c}function ppt(t,e){const r=[],{blocksPerLine:n,blocksPerColumn:i}=e,o=n<<3,s=new Int32Array(64),a=new Uint8Array(64);function l(t,r,n){const i=e.quantizationTable;let o,s,a,l,u,h,c,A,f;const p=n;let d;for(d=0;d<64;d++)p[d]=t[d]*i[d];for(d=0;d<8;++d){const t=8*d;0!==p[1+t]||0!==p[2+t]||0!==p[3+t]||0!==p[4+t]||0!==p[5+t]||0!==p[6+t]||0!==p[7+t]?(o=hpt*p[0+t]+128>>8,s=hpt*p[4+t]+128>>8,a=p[2+t],l=p[6+t],u=cpt*(p[1+t]-p[7+t])+128>>8,A=cpt*(p[1+t]+p[7+t])+128>>8,h=p[3+t]<<4,c=p[5+t]<<4,f=o-s+1>>1,o=o+s+1>>1,s=f,f=a*upt+l*lpt+128>>8,a=a*lpt-l*upt+128>>8,l=f,f=u-c+1>>1,u=u+c+1>>1,c=f,f=A+h+1>>1,h=A-h+1>>1,A=f,f=o-l+1>>1,o=o+l+1>>1,l=f,f=s-a+1>>1,s=s+a+1>>1,a=f,f=u*apt+A*spt+2048>>12,u=u*spt-A*apt+2048>>12,A=f,f=h*opt+c*ipt+2048>>12,h=h*ipt-c*opt+2048>>12,c=f,p[0+t]=o+A,p[7+t]=o-A,p[1+t]=s+c,p[6+t]=s-c,p[2+t]=a+h,p[5+t]=a-h,p[3+t]=l+u,p[4+t]=l-u):(f=hpt*p[0+t]+512>>10,p[0+t]=f,p[1+t]=f,p[2+t]=f,p[3+t]=f,p[4+t]=f,p[5+t]=f,p[6+t]=f,p[7+t]=f)}for(d=0;d<8;++d){const t=d;0!==p[8+t]||0!==p[16+t]||0!==p[24+t]||0!==p[32+t]||0!==p[40+t]||0!==p[48+t]||0!==p[56+t]?(o=hpt*p[0+t]+2048>>12,s=hpt*p[32+t]+2048>>12,a=p[16+t],l=p[48+t],u=cpt*(p[8+t]-p[56+t])+2048>>12,A=cpt*(p[8+t]+p[56+t])+2048>>12,h=p[24+t],c=p[40+t],f=o-s+1>>1,o=o+s+1>>1,s=f,f=a*upt+l*lpt+2048>>12,a=a*lpt-l*upt+2048>>12,l=f,f=u-c+1>>1,u=u+c+1>>1,c=f,f=A+h+1>>1,h=A-h+1>>1,A=f,f=o-l+1>>1,o=o+l+1>>1,l=f,f=s-a+1>>1,s=s+a+1>>1,a=f,f=u*apt+A*spt+2048>>12,u=u*spt-A*apt+2048>>12,A=f,f=h*opt+c*ipt+2048>>12,h=h*ipt-c*opt+2048>>12,c=f,p[0+t]=o+A,p[56+t]=o-A,p[8+t]=s+c,p[48+t]=s-c,p[16+t]=a+h,p[40+t]=a-h,p[24+t]=l+u,p[32+t]=l-u):(f=hpt*n[d+0]+8192>>14,p[0+t]=f,p[8+t]=f,p[16+t]=f,p[24+t]=f,p[32+t]=f,p[40+t]=f,p[48+t]=f,p[56+t]=f)}for(d=0;d<64;++d){const t=128+(p[d]+8>>4);r[d]=t<0?0:t>255?255:t}}for(let u=0;u<i;u++){const t=u<<3;for(let e=0;e<8;e++)r.push(new Uint8Array(o));for(let i=0;i<n;i++){l(e.blocks[u][i],a,s);let n=0;const o=i<<3;for(let e=0;e<8;e++){const i=r[t+e];for(let t=0;t<8;t++)i[o+t]=a[n++]}}}return r}class dpt{constructor(){this.jfif=null,this.adobe=null,this.quantizationTables=[],this.huffmanTablesAC=[],this.huffmanTablesDC=[],this.resetFrames()}resetFrames(){this.frames=[]}parse(t){let e=0;function r(){const r=t[e]<<8|t[e+1];return e+=2,r}function n(){const n=r(),i=t.subarray(e,e+n-2);return e+=i.length,i}function i(t){let e,r,n=0,i=0;for(r in t.components)t.components.hasOwnProperty(r)&&(e=t.components[r],n<e.h&&(n=e.h),i<e.v&&(i=e.v));const o=Math.ceil(t.samplesPerLine/8/n),s=Math.ceil(t.scanLines/8/i);for(r in t.components)if(t.components.hasOwnProperty(r)){e=t.components[r];const a=Math.ceil(Math.ceil(t.samplesPerLine/8)*e.h/n),l=Math.ceil(Math.ceil(t.scanLines/8)*e.v/i),u=o*e.h,h=s*e.v,c=[];for(let t=0;t<h;t++){const t=[];for(let e=0;e<u;e++)t.push(new Int32Array(64));c.push(t)}e.blocksPerLine=a,e.blocksPerColumn=l,e.blocks=c}t.maxH=n,t.maxV=i,t.mcusPerLine=o,t.mcusPerColumn=s}let o=r();if(65496!==o)throw new Error("SOI not found");for(o=r();65497!==o;){switch(o){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:{const t=n();65504===o&&74===t[0]&&70===t[1]&&73===t[2]&&70===t[3]&&0===t[4]&&(this.jfif={version:{major:t[5],minor:t[6]},densityUnits:t[7],xDensity:t[8]<<8|t[9],yDensity:t[10]<<8|t[11],thumbWidth:t[12],thumbHeight:t[13],thumbData:t.subarray(14,14+3*t[12]*t[13])}),65518===o&&65===t[0]&&100===t[1]&&111===t[2]&&98===t[3]&&101===t[4]&&0===t[5]&&(this.adobe={version:t[6],flags0:t[7]<<8|t[8],flags1:t[9]<<8|t[10],transformCode:t[11]});break}case 65499:{const n=r()+e-2;for(;e<n;){const n=t[e++],i=new Int32Array(64);if(n>>4==0)for(let r=0;r<64;r++)i[npt[r]]=t[e++];else{if(n>>4!=1)throw new Error("DQT: invalid table spec");for(let t=0;t<64;t++)i[npt[t]]=r()}this.quantizationTables[15&n]=i}break}case 65472:case 65473:case 65474:{r();const n={extended:65473===o,progressive:65474===o,precision:t[e++],scanLines:r(),samplesPerLine:r(),components:{},componentsOrder:[]},s=t[e++];let a;for(let r=0;r<s;r++){a=t[e];const r=t[e+1]>>4,i=15&t[e+1],o=t[e+2];n.componentsOrder.push(a),n.components[a]={h:r,v:i,quantizationIdx:o},e+=3}i(n),this.frames.push(n);break}case 65476:{const n=r();for(let r=2;r<n;){const n=t[e++],i=new Uint8Array(16);let o=0;for(let r=0;r<16;r++,e++)i[r]=t[e],o+=i[r];const s=new Uint8Array(o);for(let r=0;r<o;r++,e++)s[r]=t[e];r+=17+o,n>>4==0?this.huffmanTablesDC[15&n]=Apt(i,s):this.huffmanTablesAC[15&n]=Apt(i,s)}break}case 65501:r(),this.resetInterval=r();break;case 65498:{r();const n=t[e++],i=[],o=this.frames[0];for(let r=0;r<n;r++){const r=o.components[t[e++]],n=t[e++];r.huffmanTableDC=this.huffmanTablesDC[n>>4],r.huffmanTableAC=this.huffmanTablesAC[15&n],i.push(r)}const s=t[e++],a=t[e++],l=t[e++],u=fpt(t,e,o,i,this.resetInterval,s,a,l>>4,15&l);e+=u;break}case 65535:255!==t[e]&&e--;break;default:if(255===t[e-3]&&t[e-2]>=192&&t[e-2]<=254){e-=3;break}throw new Error(`unknown JPEG marker ${o.toString(16)}`)}o=r()}}getResult(){const{frames:t}=this;if(0===this.frames.length)throw new Error("no frames were decoded");this.frames.length;for(let u=0;u<this.frames.length;u++){const t=this.frames[u].components;for(const e of Object.keys(t))t[e].quantizationTable=this.quantizationTables[t[e].quantizationIdx],delete t[e].quantizationIdx}const e=t[0],{components:r,componentsOrder:n}=e,i=[],o=e.samplesPerLine,s=e.scanLines;for(let u=0;u<n.length;u++){const t=r[n[u]];i.push({lines:ppt(0,t),scaleX:t.h/e.maxH,scaleY:t.v/e.maxV})}const a=new Uint8Array(o*s*i.length);let l=0;for(let u=0;u<s;++u)for(let t=0;t<o;++t)for(let e=0;e<i.length;++e){const r=i[e];a[l]=r.lines[0|u*r.scaleY][0|t*r.scaleX],++l}return a}}const gpt=Object.freeze(Object.defineProperty({__proto__:null,default:class extends Zft{constructor(t){super(),this.reader=new dpt,t.JPEGTables&&this.reader.parse(t.JPEGTables)}decodeBlock(t){return this.reader.resetFrames(),this.reader.parse(new Uint8Array(t)),this.reader.getResult().buffer}}},Symbol.toStringTag,{value:"Module"}));
469
+ */vlt.URL=vlt.URL||vlt.webkitURL||function(t,e){return(e=document.createElement("a")).href=t,e};var wlt=vlt.Blob,blt=URL.createObjectURL,xlt=URL.revokeObjectURL,Elt=vlt.Symbol&&vlt.Symbol.toStringTag,Clt=!1,Slt=!1,Blt=!!vlt.ArrayBuffer,Ilt=_lt&&_lt.prototype.append&&_lt.prototype.getBlob;try{Clt=2===new Blob(["ä"]).size,Slt=2===new Blob([new Uint8Array([1,2])]).size}catch(dX){}function Plt(t){return t.map((function(t){if(t.buffer instanceof ArrayBuffer){var e=t.buffer;if(t.byteLength!==e.byteLength){var r=new Uint8Array(t.byteLength);r.set(new Uint8Array(e,t.byteOffset,t.byteLength)),e=r.buffer}return e}return t}))}function Tlt(t,e){e=e||{};var r=new _lt;return Plt(t).forEach((function(t){r.append(t)})),e.type?r.getBlob(e.type):r.getBlob()}function Flt(t,e){return new wlt(Plt(t),e||{})}if(vlt.Blob&&(Tlt.prototype=Blob.prototype,Flt.prototype=Blob.prototype),Elt)try{File.prototype[Elt]="File",Blob.prototype[Elt]="Blob",FileReader.prototype[Elt]="FileReader"}catch(dX){}function Mlt(){var t=!!vlt.ActiveXObject||"-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,e=vlt.XMLHttpRequest&&vlt.XMLHttpRequest.prototype.send;t&&e&&(XMLHttpRequest.prototype.send=function(t){t instanceof Blob?(this.setRequestHeader("Content-Type",t.type),e.call(this,t)):e.call(this,t)});try{new File([],"")}catch(n){try{var r=new Function('class File extends Blob {constructor(chunks, name, opts) {opts = opts || {};super(chunks, opts || {});this.name = name;this.lastModifiedDate = opts.lastModified ? new Date(opts.lastModified) : new Date;this.lastModified = +this.lastModifiedDate;}};return new File([], ""), File')();vlt.File=r}catch(i){r=function(t,e,r){var n=new Blob(t,r),i=r&&void 0!==r.lastModified?new Date(r.lastModified):new Date;return n.name=e,n.lastModifiedDate=i,n.lastModified=+i,n.toString=function(){return"[object File]"},Elt&&(n[Elt]="File"),n},vlt.File=r}}}Clt?(Mlt(),vlt.Blob=Slt?vlt.Blob:Flt):Ilt?(Mlt(),vlt.Blob=Tlt):function(){function t(t){for(var e=[],r=0;r<t.length;r++){var n=t.charCodeAt(r);n<128?e.push(n):n<2048?e.push(192|n>>6,128|63&n):n<55296||n>=57344?e.push(224|n>>12,128|n>>6&63,128|63&n):(r++,n=65536+((1023&n)<<10|1023&t.charCodeAt(r)),e.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}return e}function e(t){var e,r,n,i,o,s;for(e="",n=t.length,r=0;r<n;)switch((i=t[r++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:e+=String.fromCharCode(i);break;case 12:case 13:o=t[r++],e+=String.fromCharCode((31&i)<<6|63&o);break;case 14:o=t[r++],s=t[r++],e+=String.fromCharCode((15&i)<<12|(63&o)<<6|(63&s)<<0)}return e}function r(t){for(var e=new Array(t.byteLength),r=new Uint8Array(t),n=e.length;n--;)e[n]=r[n];return e}function n(t){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r=[],n=0;n<t.length;n+=3){var i=t[n],o=n+1<t.length,s=o?t[n+1]:0,a=n+2<t.length,l=a?t[n+2]:0,u=i>>2,h=(3&i)<<4|s>>4,c=(15&s)<<2|l>>6,A=63&l;a||(A=64,o||(c=64)),r.push(e[u],e[h],e[c],e[A])}return r.join("")}var i=Object.create||function(t){function e(){}return e.prototype=t,new e};if(Blt)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],s=ArrayBuffer.isView||function(t){return t&&o.indexOf(Object.prototype.toString.call(t))>-1};function a(e,n){for(var i=0,o=(e=e||[]).length;i<o;i++){var l=e[i];l instanceof a?e[i]=l._buffer:"string"==typeof l?e[i]=t(l):Blt&&(ArrayBuffer.prototype.isPrototypeOf(l)||s(l))?e[i]=r(l):Blt&&(u=l)&&DataView.prototype.isPrototypeOf(u)?e[i]=r(l.buffer):e[i]=t(String(l))}var u;this._buffer=[].concat.apply([],e),this.size=this._buffer.length,this.type=n&&n.type||""}function l(t,e,r){r=r||{};var n=a.call(this,t,r)||this;return n.name=e,n.lastModifiedDate=r.lastModified?new Date(r.lastModified):new Date,n.lastModified=+n.lastModifiedDate,n}if(a.prototype.slice=function(t,e,r){return new a([this._buffer.slice(t||0,e||this._buffer.length)],{type:r})},a.prototype.toString=function(){return"[object Blob]"},l.prototype=i(a.prototype),l.prototype.constructor=l,Object.setPrototypeOf)Object.setPrototypeOf(l,a);else try{l.__proto__=a}catch(dX){}function u(){if(!(this instanceof u))throw new TypeError("Failed to construct 'FileReader': Please use the 'new' operator, this DOM object constructor cannot be called as a function.");var t=document.createDocumentFragment();this.addEventListener=t.addEventListener,this.dispatchEvent=function(e){var r=this["on"+e.type];"function"==typeof r&&r(e),t.dispatchEvent(e)},this.removeEventListener=t.removeEventListener}function h(t,e,r){if(!(e instanceof a))throw new TypeError("Failed to execute '"+r+"' on 'FileReader': parameter 1 is not of type 'Blob'.");t.result="",setTimeout((function(){this.readyState=u.LOADING,t.dispatchEvent(new Event("load")),t.dispatchEvent(new Event("loadend"))}))}l.prototype.toString=function(){return"[object File]"},u.EMPTY=0,u.LOADING=1,u.DONE=2,u.prototype.error=null,u.prototype.onabort=null,u.prototype.onerror=null,u.prototype.onload=null,u.prototype.onloadend=null,u.prototype.onloadstart=null,u.prototype.onprogress=null,u.prototype.readAsDataURL=function(t){h(this,t,"readAsDataURL"),this.result="data:"+t.type+";base64,"+n(t._buffer)},u.prototype.readAsText=function(t){h(this,t,"readAsText"),this.result=e(t._buffer)},u.prototype.readAsArrayBuffer=function(t){h(this,t,"readAsText"),this.result=t._buffer.slice()},u.prototype.abort=function(){},URL.createObjectURL=function(t){return t instanceof a?"data:"+t.type+";base64,"+n(t._buffer):blt.call(URL,t)},URL.revokeObjectURL=function(t){xlt&&xlt.call(URL,t)};var c=vlt.XMLHttpRequest&&vlt.XMLHttpRequest.prototype.send;c&&(XMLHttpRequest.prototype.send=function(t){t instanceof a?(this.setRequestHeader("Content-Type",t.type),c.call(this,e(t._buffer))):c.call(this,t)}),vlt.FileReader=u,vlt.File=l,vlt.Blob=a}();var Llt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";void 0===vlt.btoa&&(vlt.btoa=function(t){var e,r,n,i,o,s=0,a=0,l="",u=[];if(!t)return t;do{e=(o=t.charCodeAt(s++)<<16|t.charCodeAt(s++)<<8|t.charCodeAt(s++))>>18&63,r=o>>12&63,n=o>>6&63,i=63&o,u[a++]=Llt.charAt(e)+Llt.charAt(r)+Llt.charAt(n)+Llt.charAt(i)}while(s<t.length);l=u.join("");var h=t.length%3;return(h?l.slice(0,h-3):l)+"===".slice(h||3)}),void 0===vlt.atob&&(vlt.atob=function(t){var e,r,n,i,o,s,a=0,l=0,u=[];if(!t)return t;t+="";do{e=(s=Llt.indexOf(t.charAt(a++))<<18|Llt.indexOf(t.charAt(a++))<<12|(i=Llt.indexOf(t.charAt(a++)))<<6|(o=Llt.indexOf(t.charAt(a++))))>>16&255,r=s>>8&255,n=255&s,u[l++]=64==i?String.fromCharCode(e):64==o?String.fromCharCode(e,r):String.fromCharCode(e,r,n)}while(a<t.length);return u.join("")});class Olt extends Cl{constructor(t){const r=t||{};let n=document.createElement("div");n.setAttribute("id","mouse-position"),n.innerHTML="",n.style.float="right",n.style.left=" 0px",n.style.right="0px",n.style.bottom="0px";var i=document.createElement("div");i.setAttribute("id","locationbar"),i.style.position="absolute",i.style.zIndex="991",i.style.padding=" 3px 10px",i.style.fontSize=" 13px",i.style.color="#e9e9e9",i.style.textShadow="2px 2px 2px #000",i.style.backgroundColor="rgba(0,0,0,.4)",i.style.minHeight="26px",i.style.left=" 0px",i.style.right="0px",i.style.bottom="0px",i.appendChild(n),super({element:i,target:r.target}),e(this,"_mouseposition"),this._mouseposition=n}show(){this.element.style.display="block"}hide(){this.element.style.display="none"}updateMousePosition(t){this._mouseposition.innerHTML=t}}class Nlt extends Cl{constructor(t,r,n,i){const o=t||{};let s=n.find((t=>t.name===r));const a=new Image;a.src=s.icon,a.className="mirage-mapswitch-image";const l=document.createElement("div");l.className="mirage-mapswitch-button-itemLabel",l.innerHTML=r;const u=document.createElement("div");u.className="mirage-mapswitch-button mirage-mapswitch-toolbar-button",u.appendChild(a),u.appendChild(l);const h=document.createElement("div");h.className="mirage-mapswitch-box";const c=document.createElement("div");c.className="mirage-mapswitch-baseLayerPicker-dropDown",c.style.maxHeight="300px",n.forEach((t=>{const e=new Image;e.src=t.icon,e.className="mirage-mapswitch-baseLayerPicker-itemIcon";const r=document.createElement("div");r.className="mirage-mapswitch-baseLayerPicker-itemLabel",r.innerHTML=t.name;const n=document.createElement("div");n.className="mirage-mapswitch-baseLayerPicker-item mirage-mapswitch-baseLayerPicker-selectedItem",n.appendChild(e),n.appendChild(r),n.addEventListener("click",(t=>{this._isshow=!1,c.className="mirage-mapswitch-baseLayerPicker-dropDown",a.src=t.currentTarget.children[0].src,l.innerHTML=t.currentTarget.innerText,i(t.currentTarget.innerText)}),!1),c.appendChild(n)})),h.appendChild(u),h.appendChild(c),super({element:h,target:o.target}),e(this,"_isshow"),e(this,"baseLayerList"),e(this,"mianImage"),e(this,"mianLabel"),this.mianImage=a,this.mianLabel=l,this.baseLayerList=n,this._isshow=!1,u.addEventListener("click",this.showSwitch.bind(this),!1)}changeBaseLayer(t){this.baseLayerList.forEach((e=>{if(e.name===t)return this.mianImage.src=e.icon,void(this.mianLabel.innerHTML=e.name)}))}showSwitch(t){this._isshow=!this._isshow;let e=document.getElementsByClassName("mirage-mapswitch-baseLayerPicker-dropDown");this._isshow?e[0].className="mirage-mapswitch-baseLayerPicker-dropDown mirage-mapswitch-baseLayerPicker-dropDown-visible":e[0].className="mirage-mapswitch-baseLayerPicker-dropDown"}show(){this.element.style.display="block"}hide(){this.element.style.display="none"}}var Rlt=function(t){t=t||{};var e=document.createElement("button"),r=document.createElement("div");r.className=(t.className||"ol-swipe")+" ol-unselectable ol-control",r.appendChild(e),r.addEventListener("mousedown",this.move.bind(this)),r.addEventListener("touchstart",this.move.bind(this)),Cl.call(this,{element:r}),this.precomposeRight_=this.precomposeRight.bind(this),this.precomposeLeft_=this.precomposeLeft.bind(this),this.postcompose_=this.postcompose.bind(this),this.layers=[],t.layers&&this.addLayer(t.layers,!1),t.rightLayers&&this.addLayer(t.rightLayers,!0),this.on("propertychange",function(t){if(this.getMap())try{this.getMap().renderSync()}catch(e){}"horizontal"===this.get("orientation")?(this.element.style.top=100*this.get("position")+"%",this.element.style.left=""):("vertical"!==this.get("orientation")&&this.set("orientation","vertical"),this.element.style.left=100*this.get("position")+"%",this.element.style.top=""),"orientation"===t.key&&(this.element.classList.remove("horizontal","vertical"),this.element.classList.add(this.get("orientation"))),this.isMoving||this.layers.forEach((function(t){t.layer.getImageRatio&&t.layer.changed()}))}.bind(this)),this.set("position",t.position||.5),this.set("orientation",t.orientation||"vertical")};Vm(Rlt,Cl),Rlt.prototype.setMap=function(t){var e,r;if(this.getMap()){for(e=0;e<this.layers.length;e++)(r=this.layers[e]).right?r.layer.un(["precompose","prerender"],this.precomposeRight_):r.layer.un(["precompose","prerender"],this.precomposeLeft_),r.layer.un(["postcompose","postrender"],this.postcompose_);try{this.getMap().renderSync()}catch(dX){}}if(Cl.prototype.setMap.call(this,t),t){for(this._listener=[],e=0;e<this.layers.length;e++)(r=this.layers[e]).right?r.layer.on(["precompose","prerender"],this.precomposeRight_):r.layer.on(["precompose","prerender"],this.precomposeLeft_),r.layer.on(["postcompose","postrender"],this.postcompose_);try{t.renderSync()}catch(dX){}}},Rlt.prototype.isLayer_=function(t){for(var e=0;e<this.layers.length;e++)if(this.layers[e].layer===t)return e;return-1},Rlt.prototype.addLayer=function(t,e){t instanceof Array||(t=[t]);for(var r=0;r<t.length;r++){var n=t[r];if(this.isLayer_(n)<0&&(this.layers.push({layer:n,right:e}),this.getMap())){e?n.on(["precompose","prerender"],this.precomposeRight_):n.on(["precompose","prerender"],this.precomposeLeft_),n.on(["postcompose","postrender"],this.postcompose_);try{this.getMap().renderSync()}catch(dX){}}}},Rlt.prototype.removeLayers=function(){var t=[];this.layers.forEach((function(e){t.push(e.layer)})),this.removeLayer(t)},Rlt.prototype.removeLayer=function(t){t instanceof Array||(t=[t]);for(var e=0;e<t.length;e++){var r=this.isLayer_(t[e]);r>=0&&this.getMap()&&(this.layers[r].right?t[e].un(["precompose","prerender"],this.precomposeRight_):t[e].un(["precompose","prerender"],this.precomposeLeft_),t[e].un(["postcompose","postrender"],this.postcompose_),this.layers.splice(r,1))}if(this.getMap())try{this.getMap().renderSync()}catch(dX){}},Rlt.prototype.getRectangle=function(){var t;return"vertical"===this.get("orientation")?[0,0,(t=this.getMap().getSize())[0]*this.get("position"),t[1]]:[0,0,(t=this.getMap().getSize())[0],t[1]*this.get("position")]},Rlt.prototype.move=function(t){var e,r=this;switch(this._movefn||(this._movefn=this.move.bind(this)),t.type){case"touchcancel":case"touchend":case"mouseup":r.isMoving=!1,["mouseup","mousemove","touchend","touchcancel","touchmove"].forEach((function(t){document.removeEventListener(t,r._movefn)})),this.layers.forEach((function(t){t.layer.getImageRatio&&t.layer.changed()}));break;case"mousedown":case"touchstart":r.isMoving=!0,["mouseup","mousemove","touchend","touchcancel","touchmove"].forEach((function(t){document.addEventListener(t,r._movefn)}));case"mousemove":case"touchmove":if(r.isMoving)if("vertical"===r.get("orientation")){var n=t.pageX||t.touches&&t.touches.length&&t.touches[0].pageX||t.changedTouches&&t.changedTouches.length&&t.changedTouches[0].pageX;if(!n)break;n-=r.getMap().getTargetElement().getBoundingClientRect().left+window.pageXOffset-document.documentElement.clientLeft;var i=(e=r.getMap().getSize()[0])-Math.min(Math.max(0,e-n),e);e=i/e,r.set("position",e),r.dispatchEvent({type:"moving",size:[i,r.getMap().getSize()[1]],position:[e,0]})}else{var o=t.pageY||t.touches&&t.touches.length&&t.touches[0].pageY||t.changedTouches&&t.changedTouches.length&&t.changedTouches[0].pageY;if(!o)break;o-=r.getMap().getTargetElement().getBoundingClientRect().top+window.pageYOffset-document.documentElement.clientTop;var s=(e=r.getMap().getSize()[1])-Math.min(Math.max(0,e-o),e);e=s/e,r.set("position",e),r.dispatchEvent({type:"moving",size:[r.getMap().getSize()[0],s],position:[0,e]})}}},Rlt.prototype._transformPt=function(t,e){var r=t.inversePixelTransform,n=e[0],i=e[1];return e[0]=r[0]*n+r[2]*i+r[4],e[1]=r[1]*n+r[3]*i+r[5],e},Rlt.prototype._drawRect=function(t,e){var r=t.inversePixelTransform;if(r){var n=[[e[0][0],e[0][1]],[e[0][0],e[1][1]],[e[1][0],e[1][1]],[e[1][0],e[0][1]],[e[0][0],e[0][1]]];if(t.context.save(),t.target.getImageRatio){var i=-Math.atan2(t.frameState.pixelToCoordinateTransform[1],t.frameState.pixelToCoordinateTransform[0]);t.context.translate(t.frameState.size[0]/2,t.frameState.size[1]/2),t.context.rotate(i),t.context.translate(-t.frameState.size[0]/2,-t.frameState.size[1]/2)}n.forEach((function(e,n){e=[e[0]*r[0]-e[1]*r[1]+r[4],-e[0]*r[2]+e[1]*r[3]+r[5]],n?t.context.lineTo(e[0],e[1]):t.context.moveTo(e[0],e[1])})),t.context.restore()}else{var o=t.frameState.pixelRatio;t.context.rect(e[0][0]*o,e[0][1]*o,e[1][0]*o,e[1][1]*o)}},Rlt.prototype.precomposeLeft=function(t){var e=t.context;if(e instanceof WebGLRenderingContext){if("prerender"===t.type){e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.enable(e.SCISSOR_TEST);var r,n,i=this.getMap().getSize(),o=this._transformPt(t,[0,i[1]]),s=this._transformPt(t,[i[0],0]),a=s[0]-o[0],l=s[1]-o[1];"vertical"===this.get("orientation")?(r=Math.round(a*this.get("position")),n=l):(r=a,n=Math.round(l*this.get("position")),o[1]+=l-n),e.scissor(o[0],o[1],r,n)}}else{var u=t.frameState.size;e.save(),e.beginPath();var h=[[0,0],[u[0],u[1]]];"vertical"===this.get("orientation")?h[1]=[.5*u[0]+this.getMap().getSize()[0]*(this.get("position")-.5),u[1]]:h[1]=[u[0],.5*u[1]+this.getMap().getSize()[1]*(this.get("position")-.5)],this._drawRect(t,h),e.clip()}},Rlt.prototype.precomposeRight=function(t){var e=t.context;if(e instanceof WebGLRenderingContext){if("prerender"===t.type){e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.enable(e.SCISSOR_TEST);var r,n,i=this.getMap().getSize(),o=this._transformPt(t,[0,i[1]]),s=this._transformPt(t,[i[0],0]),a=s[0]-o[0],l=s[1]-o[1];"vertical"===this.get("orientation")?(n=l,r=Math.round(a*(1-this.get("position"))),o[0]+=a-r):(r=a,n=Math.round(l*(1-this.get("position")))),e.scissor(o[0],o[1],r,n)}}else{var u=t.frameState.size;e.save(),e.beginPath();var h=[[0,0],[u[0],u[1]]];"vertical"===this.get("orientation")?h[0]=[.5*u[0]+this.getMap().getSize()[0]*(this.get("position")-.5),0]:h[0]=[0,.5*u[1]+this.getMap().getSize()[1]*(this.get("position")-.5)],this._drawRect(t,h),e.clip()}},Rlt.prototype.postcompose=function(t){if(t.context instanceof WebGLRenderingContext){if("postrender"===t.type){var e=t.context;e.disable(e.SCISSOR_TEST)}}else t.target.getClassName&&"ol-layer"!==t.target.getClassName()&&t.target.get("declutter")?setTimeout((function(){t.context.restore()}),0):t.context.restore()};class klt{constructor(){e(this,"events",new Map)}on(t,e,r){return this.events.has(t)||this.events.set(t,[]),(this.events.get(t)||[]).push({handler:e,once:r}),()=>{this.off(t,e)}}once(t,e){return this.on(t,e,!0)}fire(t,...e){let r=0;for(;r<(this.events.get(t)||[]).length;){const n=this.events.get(t)||[],{handler:i,once:o}=n[r];o&&n.splice(r--,1),r++,i(...e)}}off(t,e){t&&(e?this.events.set(t,(this.events.get(t)||[]).filter((t=>t.handler!==e))):this.events.set(t,[]))}}class Ult extends klt{constructor(){super(),e(this,"_swipe"),this._swipe=new Rlt}show(t,e,r="vertical"){this.fire("show",{swipe:this._swipe,leftlayerID:t,rightlayerID:e}),this._swipe.set("orientation",r)}hide(){this.fire("hide",this._swipe)}}class Dlt extends Cl{constructor(t){const r=t||{};var n=document.createElement("div");n.style.zIndex="999",n.style.width="200px",n.className="huitudiv",n.setAttribute("id","huitutext1"),n.style.position="absolute",n.style.zIndex="991",n.style.padding=" 3px 10px",n.style.fontSize=" 25px",n.style.color="#000",n.style.textShadow="2px 2px 2px #fff",n.style.backgroundColor="rgba(0,0,0,.4)",n.style.minHeight="26px",n.style.right="100px",n.style.bottom="50px",n.innerHTML="",super({element:n,target:r.target}),e(this,"_mouseposition"),this._mouseposition=n}show(){this.element.style.display="block"}getElement(){return this._mouseposition}hide(){this.element.style.display="none"}updateHtml(t){this._mouseposition.innerHTML=t}updateElementStyle(t,e){this._mouseposition.style[t]=e}}const Glt=Object.freeze(Object.defineProperty({__proto__:null,Locationbar:Olt,baseLayerSwitch:Nlt,drawTextControl:Dlt,swipeControl:Ult},Symbol.toStringTag,{value:"Module"}));var Qlt=function(t){t||(t={});var e=this;this.selection_=new V,this.handles_=new V,this.overlayLayer_=new Zs({source:new Aa({features:this.handles_,useSpatialIndex:!1,wrapX:!1}),name:"Transform overlay",displayInLayerSwitcher:!1,style:function(t){return e.style[(t.get("handle")||"default")+(t.get("constraint")||"")+(t.get("option")||"")]}}),nu.call(this,{handleDownEvent:this.handleDownEvent_,handleDragEvent:this.handleDragEvent_,handleMoveEvent:this.handleMoveEvent_,handleUpEvent:this.handleUpEvent_}),this.features_=t.features,"function"==typeof t.filter&&(this._filter=t.filter),this.layers_=t.layers?t.layers instanceof Array?t.layers:[t.layers]:null,this._handleEvent=t.condition||function(){return!0},this.addFn_=t.addCondition||function(){return!1},this.setPointRadius(t.pointRadius),this.set("translateFeature",!1!==t.translateFeature),this.set("translate",!1!==t.translate),this.set("translateBBox",!0===t.translateBBox),this.set("stretch",!1!==t.stretch),this.set("scale",!1!==t.scale),this.set("rotate",!1!==t.rotate),this.set("keepAspectRatio",t.keepAspectRatio||function(t){return t.originalEvent.shiftKey}),this.set("modifyCenter",t.modifyCenter||function(t){return t.originalEvent.metaKey||t.originalEvent.ctrlKey}),this.set("noFlip",t.noFlip||!1),this.set("selection",!1!==t.selection),this.set("hitTolerance",t.hitTolerance||0),this.set("enableRotatedTransform",t.enableRotatedTransform||!1),this.set("keepRectangle",t.keepRectangle||!1),this.on("propertychange",(function(){this.drawSketch_()})),this.setDefaultStyle()};function jlt(t,e){var r=(t[0]*e[0]+t[1]*e[1])/(e[0]*e[0]+e[1]*e[1]);return[e[0]*r,e[1]*r]}function Hlt(t,e){return[e[0]-t[0],e[1]-t[1]]}function zlt(t,e){return[t[0]+e[0],t[1]+e[1]]}Vm(Qlt,nu),Qlt.prototype.Cursors={default:"auto",select:"pointer",translate:"move",rotate:"move",rotate0:"move",scale:"nesw-resize",scale1:"nwse-resize",scale2:"nesw-resize",scale3:"nwse-resize",scalev:"ew-resize",scaleh1:"ns-resize",scalev2:"ew-resize",scaleh3:"ns-resize"},Qlt.prototype.setMap=function(t){var e=this.getMap();if(e){var r=e.getTargetElement();e.removeLayer(this.overlayLayer_),this.previousCursor_&&r&&(r.style.cursor=this.previousCursor_),this.previousCursor_=void 0}nu.prototype.setMap.call(this,t),this.overlayLayer_.setMap(t),null===t&&this.select(null),null!==t&&(this.isTouch=/touch/.test(t.getViewport().className),this.setDefaultStyle())},Qlt.prototype.setActive=function(t){this.select(null),this.overlayLayer_.setVisible(t),nu.prototype.setActive.call(this,t)},Qlt.prototype.setDefaultStyle=function(t){var e=(t=t||{}).pointStroke||new Rn({color:[255,0,0,1],width:1}),r=t.stroke||new Rn({color:[255,0,0,1],width:1,lineDash:[4,4]}),n=t.fill||new Tn({color:[255,0,0,.01]}),i=t.pointFill||new Tn({color:[255,255,255,.8]}),o=new Oi({fill:i,stroke:e,radius:this.isTouch?12:6,displacement:this.isTouch?[24,-24]:[12,-12],points:15});o.setDisplacement||(o.getAnchor()[0]=this.isTouch?-10:-5);var s=new Oi({fill:i,stroke:e,radius:this.isTouch?16:8,points:4,angle:Math.PI/4}),a=new Oi({fill:i,stroke:e,radius:this.isTouch?12:6,points:4,angle:Math.PI/4});function l(t,e,r){return[new ji({image:t,stroke:e,fill:r})]}this.style={default:l(s,r,n),translate:l(s,e,i),rotate:l(o,e,i),rotate0:l(s,e,i),scale:l(s,e,i),scale1:l(s,e,i),scale2:l(s,e,i),scale3:l(s,e,i),scalev:l(a,e,i),scaleh1:l(a,e,i),scalev2:l(a,e,i),scaleh3:l(a,e,i)},this.drawSketch_()},Qlt.prototype.setStyle=function(t,e){if(e){this.style[t]=e instanceof Array?e:[e];for(var r=0;r<this.style[t].length;r++){var n=this.style[t][r].getImage();n&&("rotate"==t&&(n.getAnchor()[0]=-5),this.isTouch&&n.setScale(1.8));var i=this.style[t][r].getText();i&&("rotate"==t&&i.setOffsetX(this.isTouch?14:7),this.isTouch&&i.setScale(1.8))}this.drawSketch_()}},Qlt.prototype.getFeatureAtPixel_=function(t){var e=this;return this.getMap().forEachFeatureAtPixel(t,(function(t,r){var n=!1;if(!r){if(t===e.bbox_)return!!e.get("translateBBox")&&{feature:t,handle:"translate",constraint:"",option:""};if(e.handles_.forEach((function(e){e===t&&(n=!0)})),n)return{feature:t,handle:t.get("handle"),constraint:t.get("constraint"),option:t.get("option")}}if(!e.get("selection"))return e.selection_.getArray().some((function(e){return t===e}))?{feature:t}:null;if(e._filter)return e._filter(t,r)?{feature:t}:null;if(e.layers_){for(var i=0;i<e.layers_.length;i++)if(e.layers_[i]===r)return{feature:t};return null}return e.features_?(e.features_.forEach((function(e){e===t&&(n=!0)})),n?{feature:t}:null):{feature:t}}),{hitTolerance:this.get("hitTolerance")})||{}},Qlt.prototype.getGeometryRotateToZero_=function(t,e){var r=t.getGeometry(),n=this.getMap().getView().getRotation();if(0===n||!this.get("enableRotatedTransform"))return e?r.clone():r;var i=r.clone();return i.rotate(-1*n,this.getMap().getView().getCenter()),i},Qlt.prototype._isRectangle=function(t){return!(!this.get("keepRectangle")||"Polygon"!==t.getType())&&5===t.getCoordinates()[0].length},Qlt.prototype.drawSketch_=function(t){var e,r,n,i=this.selection_.item(0)&&this._isRectangle(this.selection_.item(0).getGeometry());if(this.overlayLayer_.getSource().clear(),this.selection_.getLength()){var o,s=this.getMap().getView().getRotation(),a=this.getGeometryRotateToZero_(this.selection_.item(0)).getExtent();i&&(o=this.getGeometryRotateToZero_(this.selection_.item(0)).getCoordinates()[0].slice(0,4)).unshift(o[3]),a=Ct(a,0),this.selection_.forEach(function(t){var e=this.getGeometryRotateToZero_(t).getExtent();kt(a,e)}.bind(this));var l=1===this.selection_.getLength()?this._pointRadius(this.selection_.item(0)):0;if(!l||l instanceof Array||(l=[l,l]),!0===t)this.ispt_||(this.overlayLayer_.getSource().addFeature(new X({geometry:new nn(this.center_),handle:"rotate0"})),n=xn(a),this.get("enableRotatedTransform")&&0!==s&&n.rotate(s,this.getMap().getView().getCenter()),r=this.bbox_=new X(n),this.overlayLayer_.getSource().addFeature(r));else{if(this.ispt_){var u=this.getMap().getPixelFromCoordinate([a[0],a[1]]);if(u){var h=l&&l[0]||10,c=l&&l[1]||10;a=Et([this.getMap().getCoordinateFromPixel([u[0]-h,u[1]-c]),this.getMap().getCoordinateFromPixel([u[0]+h,u[1]+c])])}}n=i?new bn([o]):xn(a),this.get("enableRotatedTransform")&&0!==s&&n.rotate(s,this.getMap().getView().getCenter()),r=this.bbox_=new X(n);var A=[],f=n.getCoordinates()[0];if(!this.ispt_||l){if(A.push(r),!this.iscircle_&&!this.ispt_&&this.get("stretch")&&this.get("scale"))for(e=0;e<f.length-1;e++)r=new X({geometry:new nn([(f[e][0]+f[e+1][0])/2,(f[e][1]+f[e+1][1])/2]),handle:"scale",constraint:e%2?"h":"v",option:e}),A.push(r);if(this.get("scale"))for(e=0;e<f.length-1;e++)r=new X({geometry:new nn(f[e]),handle:"scale",option:e}),A.push(r);this.get("translate")&&!this.get("translateFeature")&&(r=new X({geometry:new nn([(f[0][0]+f[2][0])/2,(f[0][1]+f[2][1])/2]),handle:"translate"}),A.push(r))}!this.iscircle_&&this.get("rotate")&&(r=new X({geometry:new nn(f[3]),handle:"rotate"}),A.push(r)),this.overlayLayer_.getSource().addFeatures(A)}}},Qlt.prototype.select=function(t,e){if(!t)return this.selection_.clear(),void this.drawSketch_();if(t.getGeometry&&t.getGeometry()){if(e)this.selection_.push(t);else{var r=this.selection_.getArray().indexOf(t);this.selection_.removeAt(r)}this.ispt_=1===this.selection_.getLength()&&"Point"==this.selection_.item(0).getGeometry().getType(),this.iscircle_=1===this.selection_.getLength()&&"Circle"==this.selection_.item(0).getGeometry().getType(),this.drawSketch_(),this.watchFeatures_(),this.dispatchEvent({type:"select",feature:t,features:this.selection_})}},Qlt.prototype.setSelection=function(t){this.selection_.clear(),t.forEach(function(t){this.selection_.push(t)}.bind(this)),this.ispt_=1===this.selection_.getLength()&&"Point"==this.selection_.item(0).getGeometry().getType(),this.iscircle_=1===this.selection_.getLength()&&"Circle"==this.selection_.item(0).getGeometry().getType(),this.drawSketch_(),this.watchFeatures_(),this.dispatchEvent({type:"select",features:this.selection_})},Qlt.prototype.watchFeatures_=function(){this._featureListeners&&this._featureListeners.forEach((function(t){N(t)})),this._featureListeners=[],this.selection_.forEach(function(t){this._featureListeners.push(t.on("change",function(){this.isUpdating_||this.drawSketch_()}.bind(this)))}.bind(this))},Qlt.prototype.handleDownEvent_=function(t){if(this._handleEvent(t,this.selection_)){var e=this.getFeatureAtPixel_(t.pixel),r=e.feature;if(this.selection_.getLength()&&this.selection_.getArray().indexOf(r)>=0&&(this.ispt_&&this.get("translate")||this.get("translateFeature"))&&(e.handle="translate"),e.handle){this.mode_=e.handle,this.opt_=e.option,this.constraint_=e.constraint;var n=this.getMap().getView().getRotation();this.coordinate_=t.coordinate,this.pixel_=t.pixel,this.geoms_=[],this.rotatedGeoms_=[];for(var i,o=[1/0,1/0,-1/0,-1/0],s=[1/0,1/0,-1/0,-1/0],a=0;i=this.selection_.item(a);a++)if(this.geoms_.push(i.getGeometry().clone()),o=kt(o,i.getGeometry().getExtent()),this.get("enableRotatedTransform")&&0!==n){var l=this.getGeometryRotateToZero_(i,!0);this.rotatedGeoms_.push(l),s=kt(s,l.getExtent())}if(this.extent_=xn(o).getCoordinates()[0],this.get("enableRotatedTransform")&&0!==n&&(this.rotatedExtent_=xn(s).getCoordinates()[0]),"rotate"===this.mode_){this.center_=this.getCenter()||Vt(o);var u=t.map.getTargetElement();u.style.cursor=this.Cursors.rotate0,this.previousCursor_=u.style.cursor}else this.center_=Vt(o);return this.angle_=Math.atan2(this.center_[1]-t.coordinate[1],this.center_[0]-t.coordinate[0]),this.dispatchEvent({type:this.mode_+"start",feature:this.selection_.item(0),features:this.selection_,pixel:t.pixel,coordinate:t.coordinate}),!0}if(this.get("selection")){if(r){this.addFn_(t)||this.selection_.clear();var h=this.selection_.getArray().indexOf(r);h<0?this.selection_.push(r):this.selection_.removeAt(h)}else this.selection_.clear();return this.ispt_=1===this.selection_.getLength()&&"Point"==this.selection_.item(0).getGeometry().getType(),this.iscircle_=1===this.selection_.getLength()&&"Circle"==this.selection_.item(0).getGeometry().getType(),this.drawSketch_(),this.watchFeatures_(),this.dispatchEvent({type:"select",feature:r,features:this.selection_,pixel:t.pixel,coordinate:t.coordinate}),!1}}},Qlt.prototype.getFeatures=function(){return this.selection_},Qlt.prototype.getCenter=function(){return this.get("center")},Qlt.prototype.setCenter=function(t){return this.set("center",t)},Qlt.prototype.handleDragEvent_=function(t){if(this._handleEvent(t,this.features_)){var e,r,n,i,o=this.getMap().getView().getRotation(),s=[this.coordinate_[0],this.coordinate_[1]],a=[t.coordinate[0],t.coordinate[1]];switch(this.isUpdating_=!0,this.mode_){case"rotate":var l=Math.atan2(this.center_[1]-a[1],this.center_[0]-a[0]);if(!this.ispt)for(e=0;n=this.selection_.item(e);e++)(i=this.geoms_[e].clone()).rotate(l-this.angle_,this.center_),"Circle"==i.getType()&&i.setCenterAndRadius(i.getCenter(),i.getRadius()),n.setGeometry(i);this.drawSketch_(!0),this.dispatchEvent({type:"rotating",feature:this.selection_.item(0),features:this.selection_,angle:l-this.angle_,pixel:t.pixel,coordinate:t.coordinate});break;case"translate":var u=a[0]-s[0],h=a[1]-s[1];for(e=0;n=this.selection_.item(e);e++)n.getGeometry().translate(u,h);this.handles_.forEach((function(t){t.getGeometry().translate(u,h)})),this.coordinate_=t.coordinate,this.dispatchEvent({type:"translating",feature:this.selection_.item(0),features:this.selection_,delta:[u,h],pixel:t.pixel,coordinate:t.coordinate});break;case"scale":var c=this.center_;if(this.get("modifyCenter")(t)){var A=this.extent_;this.get("enableRotatedTransform")&&0!==o&&(A=this.rotatedExtent_),c=A[(Number(this.opt_)+2)%4]}var f=1==this.geoms_.length&&this._isRectangle(this.geoms_[0]),p=this.constraint_,d=this.opt_,g=this.coordinate_,y=t.coordinate;if(this.get("enableRotatedTransform")&&0!==o){var m=new nn(this.coordinate_);m.rotate(-1*o,c),g=m.getCoordinates();var v=new nn(t.coordinate);v.rotate(-1*o,c),y=v.getCoordinates()}var _=(y[0]-c[0])/(g[0]-c[0]),w=(y[1]-c[1])/(g[1]-c[1]),b=[y[0]-g[0],y[1]-g[1]];if(this.get("enableRotatedTransform")&&0!==o){var x=new nn(c);x.rotate(-1*o,this.getMap().getView().getCenter()),c=x.getCoordinates()}for(this.get("noFlip")&&(_<0&&(_=-_),w<0&&(w=-w)),this.constraint_?"h"==this.constraint_?_=1:w=1:this.get("keepAspectRatio")(t)&&(_=w=Math.min(_,w)),e=0;n=this.selection_.item(e);e++)(i=0!==o&&this.get("enableRotatedTransform")?this.rotatedGeoms_[e].clone():this.geoms_[e].clone()).applyTransform((function(t,e,n){if(n<2)return e;if(f){var o=[[6],[0,8],[2],[4]],s=[t[0],t[1]],a=[t[2],t[3]],l=[t[4],t[5]],u=[t[6],t[7]],h=[t[8],t[9]];if(p){var A=d%2==0?Hlt(s,a):Hlt(u,s),g=jlt(b,A),m=[...o[d],...o[d+1<o.length?d+1:0]];for(r=0;r<t.length;r+=n)e[r]=m.includes(r)?t[r]+g[0]:t[r],e[r+1]=m.includes(r)?t[r+1]+g[1]:t[r+1]}else{var v,x;switch(d){case 0:v=jlt(b=Hlt(u,y),Hlt(l,u)),x=jlt(b,Hlt(s,u)),[e[0],e[1]]=zlt(s,v),[e[4],e[5]]=zlt(l,x),[e[6],e[7]]=zlt(u,b),[e[8],e[9]]=zlt(h,v);break;case 1:v=jlt(b=Hlt(s,y),Hlt(u,s)),x=jlt(b,Hlt(a,s)),[e[0],e[1]]=zlt(s,b),[e[2],e[3]]=zlt(a,v),[e[6],e[7]]=zlt(u,x),[e[8],e[9]]=zlt(h,b);break;case 2:v=jlt(b=Hlt(a,y),Hlt(s,a)),x=jlt(b,Hlt(l,a)),[e[0],e[1]]=zlt(s,x),[e[2],e[3]]=zlt(a,b),[e[4],e[5]]=zlt(l,v),[e[8],e[9]]=zlt(h,x);break;case 3:v=jlt(b=Hlt(l,y),Hlt(a,l)),x=jlt(b,Hlt(u,l)),[e[2],e[3]]=zlt(a,x),[e[4],e[5]]=zlt(l,b),[e[6],e[7]]=zlt(u,v)}}}else for(r=0;r<t.length;r+=n)1!=_&&(e[r]=c[0]+(t[r]-c[0])*_),1!=w&&(e[r+1]=c[1]+(t[r+1]-c[1])*w);return"Circle"==i.getType()&&i.setCenterAndRadius(i.getCenter(),i.getRadius()),e})),this.get("enableRotatedTransform")&&0!==o&&i.rotate(o,this.getMap().getView().getCenter()),n.setGeometry(i);this.drawSketch_(),this.dispatchEvent({type:"scaling",feature:this.selection_.item(0),features:this.selection_,scale:[_,w],pixel:t.pixel,coordinate:t.coordinate})}this.isUpdating_=!1}},Qlt.prototype.handleMoveEvent_=function(t){if(this._handleEvent(t,this.features_)&&!this.mode_){var e=this.getFeatureAtPixel_(t.pixel),r=t.map.getTargetElement();if(e.feature){var n=e.handle?this.Cursors[(e.handle||"default")+(e.constraint||"")+(e.option||"")]:this.Cursors.select;void 0===this.previousCursor_&&(this.previousCursor_=r.style.cursor),r.style.cursor=n}else void 0!==this.previousCursor_&&(r.style.cursor=this.previousCursor_),this.previousCursor_=void 0}},Qlt.prototype.handleUpEvent_=function(t){return"rotate"===this.mode_&&(t.map.getTargetElement().style.cursor=this.Cursors.default,this.previousCursor_=void 0),this.dispatchEvent({type:this.mode_+"end",feature:this.selection_.item(0),features:this.selection_,oldgeom:this.geoms_[0],oldgeoms:this.geoms_}),this.drawSketch_(),this.mode_=null,!1},Qlt.prototype.getFeatures=function(){return this.selection_},Qlt.prototype.setPointRadius=function(t){this._pointRadius="function"==typeof t?t:function(){return t}};class Vlt{constructor(t){e(this,"transformInteraction"),this.transformInteraction=new Qlt({enableRotatedTransform:!1,hitTolerance:2,translateFeature:!0,scale:!0,rotate:!0,keepAspectRatio:!1,keepRectangle:!1,translate:!0,stretch:!0,pointRadius:function(t){let e=t.get("radius")||10;return[e,e]}}),this.transformInteraction.setActive(!1),this.transformInteraction.on(["select"],(t=>{s&&t.features&&t.features.getLength()&&this.transformInteraction.setCenter(t.features.getArray()[0].getGeometry().getFirstCoordinate())}));let r=0,n=10,i=[1,1],o=[0,0],s=!1;this.transformInteraction.on(["rotatestart","translatestart","scalestart"],(function(t){r=t.feature.get("angle")||0,n=t.feature.get("radius")||10,i=t.feature.get("Scale")||[1,1],o=[0,0]})),this.transformInteraction.on("rotating",(t=>{t.feature.set("angle",r-t.angle),t.feature.dispatchEvent({type:"onRotating",data:r-t.angle})})),this.transformInteraction.on("translating",(t=>{o[0]+=t.delta[0],o[1]+=t.delta[1],t.feature.dispatchEvent({type:"onMoveing",data:Vt(t.features.getArray()[0].getGeometry().getExtent())})})),this.transformInteraction.on("scaling",(t=>{if(1===t.features.getLength()){let e=t.features.item(0);e.set("radius",n*Math.abs(t.scale[0])),e.set("Scale",[i[0]*Math.abs(t.scale[0]),i[1]*Math.abs(t.scale[1])]),t.feature.dispatchEvent({type:"onScaling",data:[i[0]*Math.abs(t.scale[0]),i[1]*Math.abs(t.scale[1])]})}})),this.transformInteraction.on(["rotateend","translateend","scaleend"],(t=>{}))}setHandleStyle(){{let t=new Oi({fill:new Tn({color:[255,255,255,.01]}),stroke:new Rn({width:1,color:[0,0,0,.01]}),radius:8,points:10});this.transformInteraction.setStyle("rotate",new ji({text:new Vi({text:"",font:"16px Fontawesome",textAlign:"left",fill:new Tn({color:"red"})}),image:t})),this.transformInteraction.setStyle("rotate0",new ji({text:new Vi({text:"",font:"20px Fontawesome",fill:new Tn({color:[255,255,255,.8]}),stroke:new Rn({width:2,color:"red"})})})),this.transformInteraction.setStyle("translate",new ji({text:new Vi({text:"",font:"20px Fontawesome",fill:new Tn({color:[255,255,255,.8]}),stroke:new Rn({width:2,color:"red"})})}))}this.transformInteraction.set("translate",this.transformInteraction.get("translate"))}appendTo(t){t.addInteraction(this.transformInteraction)}setActive(t){this.transformInteraction.setActive(t)}}var Klt,qlt=function(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)},Wlt=function(t,e){return t[0]==e[0]&&t[1]==e[1]};!function(){function t(t,e){var r;for(let n=t.length-1;n>0;n--)(t[n][0]>e&&t[n-1][0]<e||t[n][0]<e&&t[n-1][0]>e)&&(r=[e,(e-t[n][0])/(t[n-1][0]-t[n][0])*(t[n-1][1]-t[n][1])+t[n][1]],t.splice(n,0,r))}function e(t,e){var r;for(let n=t.length-1;n>0;n--)(t[n][1]>e&&t[n-1][1]<e||t[n][1]<e&&t[n-1][1]>e)&&(r=[(e-t[n][1])/(t[n-1][1]-t[n][1])*(t[n-1][0]-t[n][0])+t[n][0],e],t.splice(n,0,r))}Klt=function(r,n){var i="Polygon"===n.getType();if(!i&&"MultiPolygon"!==n.getType())return null;var o=n.getCoordinates();return i&&(o=[o]),o.forEach((function(n){n.forEach((function(n){t(n,r[0]),t(n,r[2]),e(n,r[1]),e(n,r[3])}))})),o.forEach((function(t){t.forEach((function(t){t.forEach((function(t){t[0]<r[0]?t[0]=r[0]:t[0]>r[2]&&(t[0]=r[2]),t[1]<r[1]?t[1]=r[1]:t[1]>r[3]&&(t[1]=r[3])}))}))})),i?new bn(o[0]):new oh(o)}}();var Xlt=function(t,e,r,n){var i=[];!1!==n&&i.push(t);var o=qlt(t,e);if(o){var s=Math.round(o/r);if(s>1)for(var a=(e[0]-t[0])/s,l=(e[1]-t[1])/s,u=1;u<s;u++)i.push([t[0]+a*u,t[1]+l*u])}return i.push(e),i};Nn.prototype.sampleAt=function(t){for(var e=this.getCoordinates(),r=[],n=1;n<e.length;n++)r=r.concat(Xlt(e[n-1],e[n],t,1===n));return new Nn(r)},Ju.prototype.sampleAt=function(t){var e=this.getCoordinates(),r=[];return e.forEach((function(e){for(var n=[],i=1;i<e.length;i++)n=n.concat(Xlt(e[i-1],e[i],t,1===i));r.push(n)})),new Ju(r)},bn.prototype.sampleAt=function(t){var e=this.getCoordinates(),r=[];return e.forEach((function(e){for(var n=[],i=1;i<e.length;i++)n=n.concat(Xlt(e[i-1],e[i],t,1===i));r.push(n)})),new bn(r)},oh.prototype.sampleAt=function(t){var e=this.getCoordinates(),r=[];return e.forEach((function(e){var n=[];r.push(n),e.forEach((function(e){for(var r=[],i=1;i<e.length;i++)r=r.concat(Xlt(e[i-1],e[i],t,1===i));n.push(r)}))})),new oh(r)},Xu.prototype.intersection=function(t,e){if(t.sampleAt){var r=Ct(this.getCenter().concat(this.getCenter()),this.getRadius());t=(t=Klt(r,t)).simplify(e);var n=this.getCenter(),i=this.getRadius(),o=t.sampleAt(e).getCoordinates();switch(t.getType()){case"Polygon":o=[o];case"MultiPolygon":var s=!1,a=[];return o.forEach((function(t){var e=[];a.push(e),t.forEach((function(t){var r=[];e.push(r),t.forEach((function(t){var e=qlt(n,t);e>i?(s=!0,r.push([n[0]+i/e*(t[0]-n[0]),n[1]+i/e*(t[1]-n[1])])):r.push(t)}))}))})),s?"Polygon"===t.getType()?new bn(a[0]):new oh(a):t}}return t},Nn.prototype.splitAt=function(t,e){var r;if(!t)return[this];if(e||(e=1e-10),t.length&&t[0].length){var n=[this];for(r=0;r<t.length;r++){for(var i=[],o=0;o<n.length;o++){var s=n[o].splitAt(t[r],e);i=i.concat(s)}n=i}return n}if(Wlt(t,this.getFirstCoordinate())||Wlt(t,this.getLastCoordinate()))return[this];var a=this.getCoordinates(),l=[a[0]],u=[];for(r=0;r<a.length-1;r++)if(!Wlt(a[r],a[r+1])){if(Wlt(t,a[r+1]))l.push(a[r+1]),u.push(new Nn(l)),l=[];else if(!Wlt(t,a[r])){var h,c,A=!1;a[r][0]==a[r+1][0]?(h=(a[r][1]-t[1])/(a[r][1]-a[r+1][1]),A=a[r][0]==t[0]&&0<h&&h<=1):a[r][1]==a[r+1][1]?(h=(a[r][0]-t[0])/(a[r][0]-a[r+1][0]),A=a[r][1]==t[1]&&0<h&&h<=1):(h=(a[r][0]-t[0])/(a[r][0]-a[r+1][0]),c=(a[r][1]-t[1])/(a[r][1]-a[r+1][1]),A=Math.abs(h-c)<=e&&0<h&&h<=1),A&&(l.push(t),u.push(new Nn(l)),l=[t])}l.push(a[r+1])}return l.length>1&&u.push(new Nn(l)),u.length?u:[this]};var Ylt=function(t){t||(t={}),Jl.call(this,{handleEvent:function(t){switch(t.type){case"singleclick":return this.handleDownEvent(t);case"pointermove":return this.handleMoveEvent(t);default:return!0}}}),this.snapDistance_=t.snapDistance||25,this.tolerance_=t.tolerance||1e-10,this.cursor_=t.cursor,this.setSources(t.sources),t.features&&this.sources_.push(new Aa({features:t.features})),this.filterSplit_=t.filter||function(){return!0};var e=[255,255,255,1],r=[0,153,255,1],n=new Tn({color:"rgba(255,255,255,0.4)"}),i=new Rn({color:"#3399CC",width:1.25}),o=[new ji({image:new Ri({fill:n,stroke:i,radius:5}),fill:n,stroke:i})],s=[new ji({stroke:new Rn({color:e,width:5})}),new ji({image:new Ri({radius:6,fill:new Tn({color:r}),stroke:new Rn({color:e,width:1.5})}),stroke:new Rn({color:r,width:3})})];t.sketchStyle&&(o=t.sketchStyle instanceof Array?t.sketchStyle:[t.sketchStyle]),t.featureStyle&&(s=t.featureStyle instanceof Array?t.featureStyle:[t.featureStyle]),this.overlayLayer_=new Zs({source:new Aa({useSpatialIndex:!1}),name:"Split overlay",displayInLayerSwitcher:!1,style:function(t){return t._sketch_?o:s}})};function Zlt(t){const e=t.frameState,r=pt(t.inversePixelTransform.slice(),e.coordinateToPixelTransform);return new vs(t.context,e.pixelRatio,e.extent,r,e.viewState.rotation)}Vm(Ylt,Jl),Ylt.prototype.setMap=function(t){this.getMap()&&this.getMap().removeLayer(this.overlayLayer_),Jl.prototype.setMap.call(this,t),this.overlayLayer_.setMap(t)},Ylt.prototype.getSources=function(){if(!this.sources_&&this.getMap()){var t=[],e=function(r){r.forEach((function(r){r.getVisible()&&(r.getSource&&r.getSource()instanceof Aa?t.unshift(r.getSource()):r.getLayers&&e(r.getLayers()))}))};return e(this.getMap().getLayers()),t}return this.sources_||[]},Ylt.prototype.setSources=function(t){this.sources_=!!t&&(t instanceof Array?t||!1:[t])},Ylt.prototype.getClosestFeature=function(t){var e,r,n,i,o=this.snapDistance_+1;if(this.getSources().forEach((function(s){var a=s.getClosestFeatureToCoordinate(t.coordinate);if(a&&a.getGeometry().splitAt){var l=a.getGeometry().getClosestPoint(t.coordinate),u=new Nn([t.coordinate,l]),h=u.getLength()/t.frameState.viewState.resolution;h<o&&(e=s,o=h,r=a,i=u,n=l)}})),o>this.snapDistance_)return!1;var s=this.getNearestCoord(n,r.getGeometry().getCoordinates()),a=this.getMap().getPixelFromCoordinate(s);return qlt(t.pixel,a)<this.snapDistance_&&(n=s),{source:e,feature:r,coord:n,link:i}},Ylt.prototype.getNearestCoord=function(t,e){for(var r,n,i=Number.MAX_VALUE,o=0;o<e.length;o++)(r=qlt(t,e[o]))<i&&(i=r,n=e[o]);return n},Ylt.prototype.handleDownEvent=function(t){var e=this.getClosestFeature(t);if(e){var r=this;r.overlayLayer_.getSource().clear();var n,i=e.feature.getGeometry().splitAt(e.coord,this.tolerance_);if(i.length>1){var o=[];for(n=0;n<i.length;n++){var s=e.feature.clone();s.setGeometry(i[n]),o.push(s)}for(r.dispatchEvent({type:"beforesplit",original:e.feature,features:o}),e.source.dispatchEvent({type:"beforesplit",original:e.feature,features:o}),e.source.removeFeature(e.feature),n=0;n<o.length;n++)e.source.addFeature(o[n]);r.dispatchEvent({type:"aftersplit",original:e.feature,features:o}),e.source.dispatchEvent({type:"aftersplit",original:e.feature,features:o})}}return!1},Ylt.prototype.handleMoveEvent=function(t){var e=t.map;this.overlayLayer_.getSource().clear();var r,n,i=this.getClosestFeature(t);i&&this.filterSplit_(i.feature)?(this.overlayLayer_.getSource().addFeature(i.feature),(r=new X(new nn(i.coord)))._sketch_=!0,this.overlayLayer_.getSource().addFeature(r),(n=new X(i.link))._sketch_=!0,this.overlayLayer_.getSource().addFeature(n),this.dispatchEvent({type:"pointermove",coordinate:t.coordinate,frameState:t.frameState,originalEvent:t.originalEvent,map:t.map,pixel:t.pixel,feature:i.feature,linkGeometry:i.link})):this.dispatchEvent(t);var o=e.getTargetElement();this.cursor_&&(i?o.style.cursor!=this.cursor_&&(this.previousCursor_=o.style.cursor,o.style.cursor=this.cursor_):void 0!==this.previousCursor_&&(o.style.cursor=this.previousCursor_,this.previousCursor_=void 0))},window.ol&&(ol.util?ol.util.VERSION||(ol.util.VERSION=ol.VERSION||"6.1.0"):ol.util={VERSION:ol.VERSION||"5.3.0"});var Jlt=a.split(".");Jlt=100*parseInt(Jlt[0])+parseInt(Jlt[1]);var $lt=function(t,e){var r=t.frameState.pixelRatio;if(Jlt>605&&1!==r&&e.getImage()instanceof Ns){var n=(e=e.clone()).getImage();n.setScale(n.getScale()*r);var i=n.getAnchor();if(n.setDisplacement){var o=n.getDisplacement();o&&(o[0]-=i[0]/r,o[1]+=i[1]/r,n.setAnchor([0,0]))}else i&&(i[0]/=r,i[1]/=r)}return e},tut=function(t){var e=t||{};Zs.call(this,e),this.oldcluster=new Aa,this.clusters=[],this.animation={start:!1},this.set("animationDuration","number"==typeof e.animationDuration?e.animationDuration:700),this.set("animationMethod",e.animationMethod||ya),this.getSource().on("change",this.saveCluster.bind(this)),this.on(["precompose","prerender"],this.animate.bind(this)),this.on(["postcompose","postrender"],this.postanimate.bind(this))};Vm(tut,Zs),tut.prototype.saveCluster=function(){if(this.oldcluster){if(this.oldcluster.clear(),!this.get("animationDuration"))return;var t=this.getSource().getFeatures();t.length&&t[0].get("features")&&(this.oldcluster.addFeatures(this.clusters),this.clusters=t.slice(0),this.sourceChanged=!0)}},tut.prototype.getClusterForFeature=function(t,e){for(var r,n=0;r=e[n];n++){var i=r.get("features");if(i&&i.length)for(var o,s=0;o=i[s];s++)if(t===o)return r}return!1},tut.prototype.stopAnimation=function(){this.animation.start=!1,this.animation.cA=[],this.animation.cB=[]},tut.prototype.animate=function(t){var e=this.get("animationDuration");if(e){var r,n,i=t.frameState.viewState.resolution,o=this.animation,s=t.frameState.time;if(o.resolution!=i&&this.sourceChanged){var a=t.frameState.extent;for(o.resolution<i?(a=Ct(a,100*i),o.cA=this.oldcluster.getFeaturesInExtent(a),o.cB=this.getSource().getFeaturesInExtent(a),o.revers=!1):(a=Ct(a,100*i),o.cA=this.getSource().getFeaturesInExtent(a),o.cB=this.oldcluster.getFeaturesInExtent(a),o.revers=!0),o.clusters=[],r=0;n=o.cA[r];r++){var l=n.get("features");if(l&&l.length){var u=this.getClusterForFeature(l[0],o.cB);u&&o.clusters.push({f:n,pt:u.getGeometry().getCoordinates()})}}if(o.resolution=i,this.sourceChanged=!1,!o.clusters.length||o.clusters.length>1e3)return void this.stopAnimation();s=o.start=(new Date).getTime()}if(o.start){var h=t.vectorContext||Zlt(t),c=(s-o.start)/e;c>1&&(this.stopAnimation(),c=1),c=this.get("animationMethod")(c);var A=this.getStyle(),f="function"==typeof A?A:A.length?function(){return A}:function(){return[A]};for(t.context.save(),t.context.globalAlpha=this.getOpacity(),r=0;u=o.clusters[r];r++){var p=u.f.getGeometry().getCoordinates(),d=p[0]-u.pt[0],g=p[1]-u.pt[1];o.revers?(p[0]=u.pt[0]+c*d,p[1]=u.pt[1]+c*g):(p[0]=p[0]-c*d,p[1]=p[1]-c*g);var y=f(u.f,i,!0);if(y.length||(y=[y]),1!==u.f.get("features").length||d||g){var m=new nn(p);l=new X(m)}else l=u.f.get("features")[0];for(var v,_=0;v=y[_];_++)if(v.getText()&&/\n/.test(v.getText().getText())){var w,b=v.getText().getOffsetX(),x=v.getText().getOffsetY(),E=v.getText().getRotation()||0,C=1.2*Number((v.getText().getFont()||"10px").match(/\d+/)),S=v.getText().getText().split("\n"),B=S.length-1,I=v.clone();S.forEach((function(e,r){switch(1==r&&(I.setImage(),I.setFill(),I.setStroke()),v.getText().getTextBaseline()){case"alphabetic":case"ideographic":case"bottom":w=B;break;case"hanging":case"top":w=0;break;default:w=B/2}I.getText().setOffsetX(b-Math.sin(E)*C*(r-w)),I.getText().setOffsetY(x+Math.cos(E)*C*(r-w)),I.getText().setText(e),h.drawFeature(l,$lt(t,I))}))}else h.drawFeature(l,$lt(t,v))}t.context.restore(),t.frameState.animate=!0,t.context.save(),t.context.beginPath(),t.context.rect(0,0,0,0),t.context.clip(),this.clip_=!0}}},tut.prototype.postanimate=function(t){this.clip_&&(t.context.restore(),this.clip_=!1)};var eut,rut=function(t){t=t||{},this.pointRadius=t.pointRadius||12,this.circleMaxObjects=t.circleMaxObjects||10,this.maxObjects=t.maxObjects||60,this.spiral=!1!==t.spiral,this.animate=t.animate,this.animationDuration=t.animationDuration||500,this.selectCluster_=!1!==t.selectCluster,this._autoClose=!1!==t.autoClose;var e=this.overlayLayer_=new Zs({source:new Aa({features:new V,wrapX:t.wrapX,useSpatialIndex:!0}),name:"Cluster overlay",updateWhileAnimating:!0,updateWhileInteracting:!0,displayInLayerSwitcher:!1,style:t.featureStyle});if(t.layers)if("function"==typeof t.layers){var r=t.layers;t.layers=function(t){return t===e||r(t)}}else t.layers.push&&t.layers.push(this.overlayLayer_);if(t.filter){var n=t.filter;t.filter=function(t,e){return!(!e&&t.get("selectclusterlink"))&&n(t,e)}}else t.filter=function(t,e){return!(!e&&t.get("selectclusterlink"))};this.filter_=t.filter,this._autoClose||t.toggleCondition||(t.toggleCondition=Au),Bh.call(this,t),this.on("select",this.selectCluster.bind(this))};Vm(rut,Bh),rut.prototype.setMap=function(t){this.getMap()&&this.getMap().removeLayer(this.overlayLayer_),this._listener&&N(this._listener),this._listener=null,Bh.prototype.setMap.call(this,t),this.overlayLayer_.setMap(t),t&&t.getView()&&(this._listener=t.getView().on("change:resolution",this.clear.bind(this)))},rut.prototype.clear=function(){this.getFeatures().clear(),this.overlayLayer_.getSource().clear()},rut.prototype.getLayer=function(){return this.overlayLayer_},rut.prototype.selectCluster=function(t){if(t instanceof X&&(t={selected:[t]}),t.selected.length){var e=t.selected[0];if(!e.get("selectclusterfeature")){var r=this.overlayLayer_.getSource();this._autoClose&&r.clear();var n=e.get("features");if(n&&1!=n.length){this.selectCluster_||this.getFeatures().clear();var i,o,s,a,l,u,h,c=e.getGeometry().getCoordinates(),A=this.getMap().getView().getResolution(),f=[];if(!this.spiral||n.length<=this.circleMaxObjects)for(a=Math.min(n.length,this.circleMaxObjects),i=A*this.pointRadius*(.5+a/4),s=0;s<a;s++)o=2*Math.PI*s/a,2!=a&&4!=a||(o+=Math.PI/4),l=[c[0]+i*Math.sin(o),c[1]+i*Math.cos(o)],(u=new X({selectclusterfeature:!0,features:[n[s]],geometry:new nn(l)})).setStyle(n[s].getStyle()),f.push(u),h=new X({selectclusterlink:!0,geometry:new Nn([c,l])}),f.push(h);else{o=0;var p=2*this.pointRadius;for(a=Math.min(this.maxObjects,n.length),s=0;s<a;s++){o+=(p+.1)/(i=p/2+p*o/(2*Math.PI));var d=A*i*Math.sin(o),g=A*i*Math.cos(o);l=[c[0]+d,c[1]+g],(u=new X({selectclusterfeature:!0,features:[n[s]],geometry:new nn(l)})).setStyle(n[s].getStyle()),f.push(u),h=new X({selectclusterlink:!0,geometry:new Nn([c,l])}),f.push(h)}}e.set("selectcluserfeatures",f),this.animate?this.animateCluster_(c,f):r.addFeatures(f)}}}else this._autoClose?this.clear():t.deselected.forEach((t=>{var e=t.get("selectcluserfeatures");e&&e.forEach((t=>{this.overlayLayer_.getSource().removeFeature(t)}))}))},rut.prototype.animateCluster_=function(t,e){if(this.listenerKey_&&N(this.listenerKey_),e.length){var r=this.overlayLayer_.getStyle(),n="function"==typeof r?r:r.length?function(){return r}:function(){return[r]},i=this.animationDuration||500,o=(new Date).getTime();this.listenerKey_=this.overlayLayer_.on(["postcompose","postrender"],function(r){for(var s,a=r.vectorContext||Zlt(r),l=r.frameState.pixelRatio,u=this.getMap().getView().getResolution(),h=ya((r.frameState.time-o)/i),c=0;s=e[c];c++)if(s.get("features")){var A=s.getGeometry().getCoordinates();A[0]=t[0]+h*(A[0]-t[0]),A[1]=t[1]+h*(A[1]-t[1]);for(var f=new nn(A),p=n(s,u),d=0;d<p.length;d++){var g,y=!Uh.prototype.getFeaturesAtPixel&&p[d].getImage();y&&(g=y.getScale(),y.setScale(l)),a.setStyle?(a.setStyle(p[d]),a.drawGeometry(f)):(a.setImageStyle(y),a.drawPointGeometry(f)),y&&y.setScale(g)}}if(h>1)return N(this.listenerKey_),this.overlayLayer_.getSource().addFeatures(e),void this.overlayLayer_.changed();r.frameState.animate=!0}.bind(this));var s=new X(new nn(this.getMap().getView().getCenter()));s.setStyle(new ji({image:new Ri({})})),this.overlayLayer_.getSource().addFeature(s)}},rut.prototype.getClusterExtent=function(t){if(!t.get("features"))return null;var e=[1/0,1/0,-1/0,-1/0];return t.get("features").forEach((function(t){e=kt(e,t.getGeometry().getExtent())})),e[0]===e[2]&&e[1]===e[3]?null:e},function(){var t=function(t,e,r){return(t[0]-r[0])*(e[1]-r[1])-(t[1]-r[1])*(e[0]-r[0])<=0};eut=function(e){var r;e.sort((function(t,e){return t[0]==e[0]?t[1]-e[1]:t[0]-e[0]}));var n=[];for(r=0;r<e.length;r++){for(;n.length>=2&&t(n[n.length-2],n[n.length-1],e[r]);)n.pop();n.push(e[r])}var i=[];for(r=e.length-1;r>=0;r--){for(;i.length>=2&&t(i[i.length-2],i[i.length-1],e[r]);)i.pop();i.push(e[r])}return i.pop(),n.pop(),n.concat(i)};var e=function(t){var r,n,i=[];switch(t.getType()){case"Point":i.push(t.getCoordinates());break;case"LineString":case"LinearRing":case"MultiPoint":i=t.getCoordinates();break;case"MultiLineString":for(n=t.getLineStrings(),r=0;r<n.length;r++)i.concat(e(n[r]));break;case"Polygon":i=e(t.getLinearRing(0));break;case"MultiPolygon":for(n=t.getPolygons(),r=0;r<n.length;r++)i.concat(e(n[r]));break;case"GeometryCollection":for(n=t.getGeometries(),r=0;r<n.length;r++)i.concat(e(n[r]))}return i};Mr.prototype.convexHull=function(){return eut(e(this))}}();const nut=eut;var iut=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),out={Point:function(t){return void 0!==t.m&&void 0!==t.z?new nn([t.x,t.y,t.z,t.m],Y.XYZM):void 0!==t.z?new nn([t.x,t.y,t.z],Y.XYZ):void 0!==t.m?new nn([t.x,t.y,t.m],Y.XYM):new nn([t.x,t.y])},LineString:function(t){var e=uut(t);return new Nn(t.paths[0],e)},Polygon:function(t){var e=uut(t);return new bn(t.rings,e)},MultiPoint:function(t){var e=uut(t);return new eh(t.points,e)},MultiLineString:function(t){var e=uut(t);return new Ju(t.paths,e)},MultiPolygon:function(t){var e=uut(t);return new oh(t.rings,e)}},sut={Point:function(t,e){var r,n=t.getCoordinates(),i=t.getLayout();return i===Y.XYZ?r={x:n[0],y:n[1],z:n[2]}:i===Y.XYM?r={x:n[0],y:n[1],m:n[2]}:i===Y.XYZM?r={x:n[0],y:n[1],z:n[2],m:n[3]}:i===Y.XY?r={x:n[0],y:n[1]}:K(!1,34),r},LineString:function(t,e){var r=hut(t);return{hasZ:r.hasZ,hasM:r.hasM,paths:[t.getCoordinates()]}},Polygon:function(t,e){var r=hut(t);return{hasZ:r.hasZ,hasM:r.hasM,rings:t.getCoordinates(!1)}},MultiPoint:function(t,e){var r=hut(t);return{hasZ:r.hasZ,hasM:r.hasM,points:t.getCoordinates()}},MultiLineString:function(t,e){var r=hut(t);return{hasZ:r.hasZ,hasM:r.hasM,paths:t.getCoordinates()}},MultiPolygon:function(t,e){for(var r=hut(t),n=t.getCoordinates(!1),i=[],o=0;o<n.length;o++)for(var s=n[o].length-1;s>=0;s--)i.push(n[o][s]);return{hasZ:r.hasZ,hasM:r.hasM,rings:i}}},aut=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this)||this).geometryName_=n.geometryName,r}return iut(e,t),e.prototype.readFeatureFromObject=function(t,e,r){var n=t,i=lut(n.geometry,e),o=new X;if(this.geometryName_&&o.setGeometryName(this.geometryName_),o.setGeometry(i),n.attributes){o.setProperties(n.attributes,!0);var s=n.attributes[r];void 0!==s&&o.setId(s)}return o},e.prototype.readFeaturesFromObject=function(t,e){var r=e||{};if(t.features){for(var n=[],i=t.features,o=0,s=i.length;o<s;++o)n.push(this.readFeatureFromObject(i[o],r,t.objectIdFieldName));return n}return[this.readFeatureFromObject(t,r)]},e.prototype.readGeometryFromObject=function(t,e){return lut(t,e)},e.prototype.readProjectionFromObject=function(t){return t.spatialReference&&void 0!==t.spatialReference.wkid?nr("EPSG:"+t.spatialReference.wkid):null},e.prototype.writeGeometryObject=function(t,e){return cut(t,this.adaptOptions(e))},e.prototype.writeFeatureObject=function(t,e){e=this.adaptOptions(e);var r={};if(!t.hasProperties())return r.attributes={},r;var n=t.getProperties(),i=t.getGeometry();if(i){r.geometry=cut(i,e);var o=e&&(e.dataProjection||e.featureProjection);o&&(r.geometry.spatialReference={wkid:Number(nr(o).getCode().split(":").pop())}),delete n[t.getGeometryName()]}return C(n)?r.attributes={}:r.attributes=n,r},e.prototype.writeFeaturesObject=function(t,e){e=this.adaptOptions(e);for(var r=[],n=0,i=t.length;n<i;++n)r.push(this.writeFeatureObject(t[n],e));return{features:r}},e}(Mf);function lut(t,e){var r,n,i;if(!t)return null;if("number"==typeof t.x&&"number"==typeof t.y)i="Point";else if(t.points)i="MultiPoint";else if(t.paths)i=1===t.paths.length?"LineString":"MultiLineString";else if(t.rings){var o=t,s=uut(o),a=function(t,e){var r,n,i=[],o=[],s=[];for(r=0,n=t.length;r<n;++r)i.length=0,Hr(i,0,t[r],e.length),dn(i,0,i.length,e.length)?o.push([t[r]]):s.push(t[r]);for(;s.length;){var a=s.shift(),l=!1;for(r=o.length-1;r>=0;r--){var u=o[r][0];if(Pt(new en(u).getExtent(),new en(a).getExtent())){o[r].push(a),l=!0;break}}l||o.push([a.reverse()])}return o}(o.rings,s);1===a.length?(i="Polygon",t=b({},t,((r={}).rings=a[0],r))):(i="MultiPolygon",t=b({},t,((n={}).rings=a,n)))}return Yc((0,out[i])(t),!1,e)}function uut(t){var e=Y.XY;return!0===t.hasZ&&!0===t.hasM?e=Y.XYZM:!0===t.hasZ?e=Y.XYZ:!0===t.hasM&&(e=Y.XYM),e}function hut(t){var e=t.getLayout();return{hasZ:e===Y.XYZ||e===Y.XYZM,hasM:e===Y.XYM||e===Y.XYZM}}function cut(t,e){return(0,sut[t.getType()])(Yc(t,!0,e),e)}const Aut=aut;var fut="http://www.w3.org/2001/XMLSchema-instance";function put(t,e){return Lut().createElementNS(t,e)}function dut(t,e){return gut(t,e,[]).join("")}function gut(t,e,r){if(t.nodeType==Node.CDATA_SECTION_NODE||t.nodeType==Node.TEXT_NODE)e?r.push(String(t.nodeValue).replace(/(\r\n|\r|\n)/g,"")):r.push(t.nodeValue);else{var n=void 0;for(n=t.firstChild;n;n=n.nextSibling)gut(n,e,r)}return r}function yut(t){return"documentElement"in t}function mut(t){return(new DOMParser).parseFromString(t,"application/xml")}function vut(t,e){return function(r,n){var i=t.call(void 0!==e?e:this,r,n);void 0!==i&&y(n[n.length-1],i)}}function _ut(t,e){return function(r,n){var i=t.call(void 0!==e?e:this,r,n);void 0!==i&&n[n.length-1].push(i)}}function wut(t,e){return function(r,n){var i=t.call(void 0!==e?e:this,r,n);void 0!==i&&(n[n.length-1]=i)}}function but(t,e,r){return function(n,i){var o=t.call(void 0!==r?r:this,n,i);void 0!==o&&(i[i.length-1][void 0!==e?e:n.localName]=o)}}function xut(t,e){return function(r,n,i){t.call(void 0!==e?e:this,r,n,i),i[i.length-1].node.appendChild(r)}}function Eut(t,e){var r=t;return function(t,n,i){var o=n[n.length-1].node,s=r;return void 0===s&&(s=i),put(void 0!==e?e:o.namespaceURI,s)}}var Cut=Eut();function Sut(t,e){for(var r=e.length,n=new Array(r),i=0;i<r;++i)n[i]=t[e[i]];return n}function But(t,e,r){var n,i,o=void 0!==r?r:{};for(n=0,i=t.length;n<i;++n)o[t[n]]=e;return o}function Iut(t,e,r,n){var i;for(i=e.firstElementChild;i;i=i.nextElementSibling){var o=t[i.namespaceURI];if(void 0!==o){var s=o[i.localName];void 0!==s&&s.call(n,i,r)}}}function Put(t,e,r,n,i){return n.push(t),Iut(e,r,n,i),n.pop()}function Tut(t,e,r,n,i,o,s){return i.push(t),function(t,e,r,n,i,o){for(var s,a,l=(void 0!==i?i:r).length,u=0;u<l;++u)void 0!==(s=r[u])&&void 0!==(a=e.call(void 0!==o?o:this,s,n,void 0!==i?i[u]:void 0))&&t[a.namespaceURI][a.localName].call(o,a,s,n)}(e,r,n,i,o,s),i.pop()}var Fut=void 0,Mut=void 0;function Lut(){return void 0===Mut&&"undefined"!=typeof document&&(Mut=document.implementation.createDocument("","",null)),Mut}var Out=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const Nut=function(t){function e(){var e=t.call(this)||this;return e.xmlSerializer_=(void 0===Fut&&"undefined"!=typeof XMLSerializer&&(Fut=new XMLSerializer),Fut),e}return Out(e,t),e.prototype.getType=function(){return"xml"},e.prototype.readFeature=function(t,e){if(t){if("string"==typeof t){var r=mut(t);return this.readFeatureFromDocument(r,e)}return yut(t)?this.readFeatureFromDocument(t,e):this.readFeatureFromNode(t,e)}return null},e.prototype.readFeatureFromDocument=function(t,e){var r=this.readFeaturesFromDocument(t,e);return r.length>0?r[0]:null},e.prototype.readFeatureFromNode=function(t,e){return null},e.prototype.readFeatures=function(t,e){if(t){if("string"==typeof t){var r=mut(t);return this.readFeaturesFromDocument(r,e)}return yut(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}return[]},e.prototype.readFeaturesFromDocument=function(t,e){for(var r=[],n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&y(r,this.readFeaturesFromNode(n,e));return r},e.prototype.readFeaturesFromNode=function(t,e){return n()},e.prototype.readGeometry=function(t,e){if(t){if("string"==typeof t){var r=mut(t);return this.readGeometryFromDocument(r,e)}return yut(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}return null},e.prototype.readGeometryFromDocument=function(t,e){return null},e.prototype.readGeometryFromNode=function(t,e){return null},e.prototype.readProjection=function(t){if(t){if("string"==typeof t){var e=mut(t);return this.readProjectionFromDocument(e)}return yut(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}return null},e.prototype.readProjectionFromDocument=function(t){return this.dataProjection},e.prototype.readProjectionFromNode=function(t){return this.dataProjection},e.prototype.writeFeature=function(t,e){var r=this.writeFeatureNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeFeatureNode=function(t,e){return null},e.prototype.writeFeatures=function(t,e){var r=this.writeFeaturesNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeFeaturesNode=function(t,e){return null},e.prototype.writeGeometry=function(t,e){var r=this.writeGeometryNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeGeometryNode=function(t,e){return null},e}(Xc);var Rut=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),kut="http://www.opengis.net/gml",Uut=/^[\s\xa0]*$/,Dut=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.featureType=n.featureType,r.featureNS=n.featureNS,r.srsName=n.srsName,r.schemaLocation="",r.FEATURE_COLLECTION_PARSERS={},r.FEATURE_COLLECTION_PARSERS[r.namespace]={featureMember:_ut(r.readFeaturesInternal),featureMembers:wut(r.readFeaturesInternal)},r.supportedMediaTypes=["application/gml+xml"],r}return Rut(e,t),e.prototype.readFeaturesInternal=function(t,e){var r=t.localName,n=null;if("FeatureCollection"==r)n=Put([],this.FEATURE_COLLECTION_PARSERS,t,e,this);else if("featureMembers"==r||"featureMember"==r||"member"==r){var i=e[0],o=i.featureType,s=i.featureNS;if(!o&&t.childNodes){o=[],s={};for(var a=0,l=t.childNodes.length;a<l;++a){var u=t.childNodes[a];if(1===u.nodeType){var h=u.nodeName.split(":").pop();if(-1===o.indexOf(h)){var c="",A=0,f=u.namespaceURI;for(var p in s){if(s[p]===f){c=p;break}++A}c||(s[c="p"+A]=f),o.push(c+":"+h)}}}"featureMember"!=r&&(i.featureType=o,i.featureNS=s)}if("string"==typeof s){var d=s;(s={}).p0=d}var g={},y=Array.isArray(o)?o:[o];for(var m in s){var v={};for(a=0,l=y.length;a<l;++a)(-1===y[a].indexOf(":")?"p0":y[a].split(":")[0])===m&&(v[y[a].split(":").pop()]="featureMembers"==r?_ut(this.readFeatureElement,this):wut(this.readFeatureElement,this));g[s[m]]=v}n=Put("featureMember"==r||"member"==r?void 0:[],g,t,e)}return null===n&&(n=[]),n},e.prototype.readGeometryOrExtent=function(t,e){var r=e[0];return r.srsName=t.firstElementChild.getAttribute("srsName"),r.srsDimension=t.firstElementChild.getAttribute("srsDimension"),Put(null,this.GEOMETRY_PARSERS,t,e,this)},e.prototype.readExtentElement=function(t,e){var r=e[0],n=this.readGeometryOrExtent(t,e);return n?Zc(n,r):void 0},e.prototype.readGeometryElement=function(t,e){var r=e[0],n=this.readGeometryOrExtent(t,e);return n?Yc(n,!1,r):void 0},e.prototype.readFeatureElementInternal=function(t,e,r){for(var n,i={},o=t.firstElementChild;o;o=o.nextElementSibling){var s=void 0,a=o.localName;0===o.childNodes.length||1===o.childNodes.length&&(3===o.firstChild.nodeType||4===o.firstChild.nodeType)?(s=dut(o,!1),Uut.test(s)&&(s=void 0)):(r&&(s="boundedBy"===a?this.readExtentElement(o,e):this.readGeometryElement(o,e)),s?"boundedBy"!==a&&(n=a):s=this.readFeatureElementInternal(o,e,!1));var l=o.attributes.length;if(l>0){s={_content_:s};for(var u=0;u<l;u++)s[o.attributes[u].name]=o.attributes[u].value}i[a]?(i[a]instanceof Array||(i[a]=[i[a]]),i[a].push(s)):i[a]=s}if(r){var h=new X(i);n&&h.setGeometryName(n);var c=t.getAttribute("fid")||function(t,e,r){return t.getAttributeNS(e,"id")||""}(t,this.namespace);return c&&h.setId(c),h}return i},e.prototype.readFeatureElement=function(t,e){return this.readFeatureElementInternal(t,e,!0)},e.prototype.readPoint=function(t,e){var r=this.readFlatCoordinatesFromNode(t,e);if(r)return new nn(r,Y.XYZ)},e.prototype.readMultiPoint=function(t,e){var r=Put([],this.MULTIPOINT_PARSERS,t,e,this);return r?new eh(r):void 0},e.prototype.readMultiLineString=function(t,e){var r=Put([],this.MULTILINESTRING_PARSERS,t,e,this);if(r)return new Ju(r)},e.prototype.readMultiPolygon=function(t,e){var r=Put([],this.MULTIPOLYGON_PARSERS,t,e,this);if(r)return new oh(r)},e.prototype.pointMemberParser=function(t,e){Iut(this.POINTMEMBER_PARSERS,t,e,this)},e.prototype.lineStringMemberParser=function(t,e){Iut(this.LINESTRINGMEMBER_PARSERS,t,e,this)},e.prototype.polygonMemberParser=function(t,e){Iut(this.POLYGONMEMBER_PARSERS,t,e,this)},e.prototype.readLineString=function(t,e){var r=this.readFlatCoordinatesFromNode(t,e);return r?new Nn(r,Y.XYZ):void 0},e.prototype.readFlatLinearRing=function(t,e){return Put(null,this.GEOMETRY_FLAT_COORDINATES_PARSERS,t,e,this)||void 0},e.prototype.readLinearRing=function(t,e){var r=this.readFlatCoordinatesFromNode(t,e);if(r)return new en(r,Y.XYZ)},e.prototype.readPolygon=function(t,e){var r=Put([null],this.FLAT_LINEAR_RINGS_PARSERS,t,e,this);if(r&&r[0]){var n,i=r[0],o=[i.length],s=void 0;for(s=1,n=r.length;s<n;++s)y(i,r[s]),o.push(i.length);return new bn(i,Y.XYZ,o)}},e.prototype.readFlatCoordinatesFromNode=function(t,e){return Put(null,this.GEOMETRY_FLAT_COORDINATES_PARSERS,t,e,this)},e.prototype.readGeometryFromNode=function(t,e){return this.readGeometryElement(t,[this.getReadOptions(t,e||{})])||null},e.prototype.readFeaturesFromNode=function(t,e){var r={featureType:this.featureType,featureNS:this.featureNS};return e&&b(r,this.getReadOptions(t,e)),this.readFeaturesInternal(t,[r])||[]},e.prototype.readProjectionFromNode=function(t){return nr(this.srsName?this.srsName:t.firstElementChild.getAttribute("srsName"))},e}(Nut);Dut.prototype.namespace=kut,Dut.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{}},Dut.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{}},Dut.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{}},Dut.prototype.MULTIPOINT_PARSERS={"http://www.opengis.net/gml":{pointMember:_ut(Dut.prototype.pointMemberParser),pointMembers:_ut(Dut.prototype.pointMemberParser)}},Dut.prototype.MULTILINESTRING_PARSERS={"http://www.opengis.net/gml":{lineStringMember:_ut(Dut.prototype.lineStringMemberParser),lineStringMembers:_ut(Dut.prototype.lineStringMemberParser)}},Dut.prototype.MULTIPOLYGON_PARSERS={"http://www.opengis.net/gml":{polygonMember:_ut(Dut.prototype.polygonMemberParser),polygonMembers:_ut(Dut.prototype.polygonMemberParser)}},Dut.prototype.POINTMEMBER_PARSERS={"http://www.opengis.net/gml":{Point:_ut(Dut.prototype.readFlatCoordinatesFromNode)}},Dut.prototype.LINESTRINGMEMBER_PARSERS={"http://www.opengis.net/gml":{LineString:_ut(Dut.prototype.readLineString)}},Dut.prototype.POLYGONMEMBER_PARSERS={"http://www.opengis.net/gml":{Polygon:_ut(Dut.prototype.readPolygon)}},Dut.prototype.RING_PARSERS={"http://www.opengis.net/gml":{LinearRing:wut(Dut.prototype.readFlatLinearRing)}};const Gut=Dut;function Qut(t){var e,r=dut(t,!1);return(e=/^\s*(true|1)|(false|0)\s*$/.exec(r))?void 0!==e[1]||!1:void 0}function jut(t){var e,r=dut(t,!1);return(e=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(r))?parseFloat(e[1]):void 0}function Hut(t){return zut(dut(t,!1))}function zut(t){var e=/^\s*(\d+)\s*$/.exec(t);return e?parseInt(e[1],10):void 0}function Vut(t){return dut(t,!1).trim()}function Kut(t,e){Wut(t,e?"1":"0")}function qut(t,e){var r=e.toPrecision();t.appendChild(Lut().createTextNode(r))}function Wut(t,e){t.appendChild(Lut().createTextNode(e))}var Xut=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Yut=kut+" http://schemas.opengis.net/gml/2.1.2/feature.xsd",Zut={MultiLineString:"lineStringMember",MultiCurve:"curveMember",MultiPolygon:"polygonMember",MultiSurface:"surfaceMember"},Jut=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,n)||this).FEATURE_COLLECTION_PARSERS[kut].featureMember=_ut(r.readFeaturesInternal),r.schemaLocation=n.schemaLocation?n.schemaLocation:Yut,r}return Xut(e,t),e.prototype.readFlatCoordinates=function(t,e){var r=dut(t,!1).replace(/^\s*|\s*$/g,""),n=e[0].srsName,i="enu";if(n){var o=nr(n);o&&(i=o.getAxisOrientation())}for(var s=r.trim().split(/\s+/),a=[],l=0,u=s.length;l<u;l++){var h=s[l].split(/,+/),c=parseFloat(h[0]),A=parseFloat(h[1]),f=3===h.length?parseFloat(h[2]):0;"en"===i.substr(0,2)?a.push(c,A,f):a.push(A,c,f)}return a},e.prototype.readBox=function(t,e){var r=Put([null],this.BOX_PARSERS_,t,e,this);return Mt(r[1][0],r[1][1],r[1][3],r[1][4])},e.prototype.innerBoundaryIsParser=function(t,e){var r=Put(void 0,this.RING_PARSERS,t,e,this);r&&e[e.length-1].push(r)},e.prototype.outerBoundaryIsParser=function(t,e){var r=Put(void 0,this.RING_PARSERS,t,e,this);r&&(e[e.length-1][0]=r)},e.prototype.GEOMETRY_NODE_FACTORY_=function(t,e,r){var n,i=e[e.length-1],o=i.multiSurface,s=i.surface,a=i.multiCurve;return Array.isArray(t)?n="Envelope":"MultiPolygon"===(n=t.getType())&&!0===o?n="MultiSurface":"Polygon"===n&&!0===s?n="Surface":"MultiLineString"===n&&!0===a&&(n="MultiCurve"),put("http://www.opengis.net/gml",n)},e.prototype.writeFeatureElement=function(t,e,r){var n=e.getId();n&&t.setAttribute("fid",n);var i=r[r.length-1],o=i.featureNS,s=e.getGeometryName();i.serializers||(i.serializers={},i.serializers[o]={});var a=[],l=[];if(e.hasProperties()){var u=e.getProperties();for(var h in u){var c=u[h];null!==c&&(a.push(h),l.push(c),h==s||"function"==typeof c.getSimplifiedGeometry?h in i.serializers[o]||(i.serializers[o][h]=xut(this.writeGeometryElement,this)):h in i.serializers[o]||(i.serializers[o][h]=xut(Wut)))}}var A=b({},i);A.node=t,Tut(A,i.serializers,Eut(void 0,o),l,r,a)},e.prototype.writeCurveOrLineString=function(t,e,r){var n=r[r.length-1].srsName;if("LineStringSegment"!==t.nodeName&&n&&t.setAttribute("srsName",n),"LineString"===t.nodeName||"LineStringSegment"===t.nodeName){var i=this.createCoordinatesNode_(t.namespaceURI);t.appendChild(i),this.writeCoordinates_(i,e,r)}else if("Curve"===t.nodeName){var o=put(t.namespaceURI,"segments");t.appendChild(o),this.writeCurveSegments_(o,e,r)}},e.prototype.writeLineStringOrCurveMember=function(t,e,r){var n=this.GEOMETRY_NODE_FACTORY_(e,r);n&&(t.appendChild(n),this.writeCurveOrLineString(n,e,r))},e.prototype.writeMultiCurveOrLineString=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName,s=n.curve;o&&t.setAttribute("srsName",o);var a=e.getLineStrings();Tut({node:t,hasZ:i,srsName:o,curve:s},this.LINESTRINGORCURVEMEMBER_SERIALIZERS,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,a,r,void 0,this)},e.prototype.writeGeometryElement=function(t,e,r){var n,i=r[r.length-1],o=b({},i);o.node=t,n=Array.isArray(e)?Zc(e,i):Yc(e,!0,i),Tut(o,this.GEOMETRY_SERIALIZERS,this.GEOMETRY_NODE_FACTORY_,[n],r,void 0,this)},e.prototype.createCoordinatesNode_=function(t){var e=put(t,"coordinates");return e.setAttribute("decimal","."),e.setAttribute("cs",","),e.setAttribute("ts"," "),e},e.prototype.writeCoordinates_=function(t,e,r){for(var n=r[r.length-1],i=n.hasZ,o=n.srsName,s=e.getCoordinates(),a=s.length,l=new Array(a),u=0;u<a;++u){var h=s[u];l[u]=this.getCoords_(h,o,i)}Wut(t,l.join(" "))},e.prototype.writeCurveSegments_=function(t,e,r){var n=put(t.namespaceURI,"LineStringSegment");t.appendChild(n),this.writeCurveOrLineString(n,e,r)},e.prototype.writeSurfaceOrPolygon=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName;if("PolygonPatch"!==t.nodeName&&o&&t.setAttribute("srsName",o),"Polygon"===t.nodeName||"PolygonPatch"===t.nodeName){var s=e.getLinearRings();Tut({node:t,hasZ:i,srsName:o},this.RING_SERIALIZERS,this.RING_NODE_FACTORY_,s,r,void 0,this)}else if("Surface"===t.nodeName){var a=put(t.namespaceURI,"patches");t.appendChild(a),this.writeSurfacePatches_(a,e,r)}},e.prototype.RING_NODE_FACTORY_=function(t,e,r){var n=e[e.length-1],i=n.node,o=n.exteriorWritten;return void 0===o&&(n.exteriorWritten=!0),put(i.namespaceURI,void 0!==o?"innerBoundaryIs":"outerBoundaryIs")},e.prototype.writeSurfacePatches_=function(t,e,r){var n=put(t.namespaceURI,"PolygonPatch");t.appendChild(n),this.writeSurfaceOrPolygon(n,e,r)},e.prototype.writeRing=function(t,e,r){var n=put(t.namespaceURI,"LinearRing");t.appendChild(n),this.writeLinearRing(n,e,r)},e.prototype.getCoords_=function(t,e,r){var n="enu";e&&(n=nr(e).getAxisOrientation());var i="en"===n.substr(0,2)?t[0]+","+t[1]:t[1]+","+t[0];return r&&(i+=","+(t[2]||0)),i},e.prototype.writePoint=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName;o&&t.setAttribute("srsName",o);var s=this.createCoordinatesNode_(t.namespaceURI);t.appendChild(s);var a=e.getCoordinates();Wut(s,this.getCoords_(a,o,i))},e.prototype.writeMultiPoint=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName;o&&t.setAttribute("srsName",o);var s=e.getPoints();Tut({node:t,hasZ:i,srsName:o},this.POINTMEMBER_SERIALIZERS,Eut("pointMember"),s,r,void 0,this)},e.prototype.writePointMember=function(t,e,r){var n=put(t.namespaceURI,"Point");t.appendChild(n),this.writePoint(n,e,r)},e.prototype.writeLinearRing=function(t,e,r){var n=r[r.length-1].srsName;n&&t.setAttribute("srsName",n);var i=this.createCoordinatesNode_(t.namespaceURI);t.appendChild(i),this.writeCoordinates_(i,e,r)},e.prototype.writeMultiSurfaceOrPolygon=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName,s=n.surface;o&&t.setAttribute("srsName",o);var a=e.getPolygons();Tut({node:t,hasZ:i,srsName:o,surface:s},this.SURFACEORPOLYGONMEMBER_SERIALIZERS,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,a,r,void 0,this)},e.prototype.writeSurfaceOrPolygonMember=function(t,e,r){var n=this.GEOMETRY_NODE_FACTORY_(e,r);n&&(t.appendChild(n),this.writeSurfaceOrPolygon(n,e,r))},e.prototype.writeEnvelope=function(t,e,r){var n=r[r.length-1].srsName;n&&t.setAttribute("srsName",n);var i=[e[0]+" "+e[1],e[2]+" "+e[3]];Tut({node:t},this.ENVELOPE_SERIALIZERS,Cut,i,r,["lowerCorner","upperCorner"],this)},e.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_=function(t,e,r){var n=e[e.length-1].node;return put("http://www.opengis.net/gml",Zut[n.nodeName])},e}(Gut);Jut.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{coordinates:wut(Jut.prototype.readFlatCoordinates)}},Jut.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{innerBoundaryIs:Jut.prototype.innerBoundaryIsParser,outerBoundaryIs:Jut.prototype.outerBoundaryIsParser}},Jut.prototype.BOX_PARSERS_={"http://www.opengis.net/gml":{coordinates:_ut(Jut.prototype.readFlatCoordinates)}},Jut.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{Point:wut(Gut.prototype.readPoint),MultiPoint:wut(Gut.prototype.readMultiPoint),LineString:wut(Gut.prototype.readLineString),MultiLineString:wut(Gut.prototype.readMultiLineString),LinearRing:wut(Gut.prototype.readLinearRing),Polygon:wut(Gut.prototype.readPolygon),MultiPolygon:wut(Gut.prototype.readMultiPolygon),Box:wut(Jut.prototype.readBox)}},Jut.prototype.GEOMETRY_SERIALIZERS={"http://www.opengis.net/gml":{Curve:xut(Jut.prototype.writeCurveOrLineString),MultiCurve:xut(Jut.prototype.writeMultiCurveOrLineString),Point:xut(Jut.prototype.writePoint),MultiPoint:xut(Jut.prototype.writeMultiPoint),LineString:xut(Jut.prototype.writeCurveOrLineString),MultiLineString:xut(Jut.prototype.writeMultiCurveOrLineString),LinearRing:xut(Jut.prototype.writeLinearRing),Polygon:xut(Jut.prototype.writeSurfaceOrPolygon),MultiPolygon:xut(Jut.prototype.writeMultiSurfaceOrPolygon),Surface:xut(Jut.prototype.writeSurfaceOrPolygon),MultiSurface:xut(Jut.prototype.writeMultiSurfaceOrPolygon),Envelope:xut(Jut.prototype.writeEnvelope)}},Jut.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{lineStringMember:xut(Jut.prototype.writeLineStringOrCurveMember),curveMember:xut(Jut.prototype.writeLineStringOrCurveMember)}},Jut.prototype.RING_SERIALIZERS={"http://www.opengis.net/gml":{outerBoundaryIs:xut(Jut.prototype.writeRing),innerBoundaryIs:xut(Jut.prototype.writeRing)}},Jut.prototype.POINTMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{pointMember:xut(Jut.prototype.writePointMember)}},Jut.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{surfaceMember:xut(Jut.prototype.writeSurfaceOrPolygonMember),polygonMember:xut(Jut.prototype.writeSurfaceOrPolygonMember)}},Jut.prototype.ENVELOPE_SERIALIZERS={"http://www.opengis.net/gml":{lowerCorner:xut(Wut),upperCorner:xut(Wut)}};const $ut=Jut;var tht=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),eht=kut+" http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd",rht={MultiLineString:"lineStringMember",MultiCurve:"curveMember",MultiPolygon:"polygonMember",MultiSurface:"surfaceMember"},nht=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,n)||this).surface_=void 0!==n.surface&&n.surface,r.curve_=void 0!==n.curve&&n.curve,r.multiCurve_=void 0===n.multiCurve||n.multiCurve,r.multiSurface_=void 0===n.multiSurface||n.multiSurface,r.schemaLocation=n.schemaLocation?n.schemaLocation:eht,r.hasZ=void 0!==n.hasZ&&n.hasZ,r}return tht(e,t),e.prototype.readMultiCurve=function(t,e){var r=Put([],this.MULTICURVE_PARSERS,t,e,this);return r?new Ju(r):void 0},e.prototype.readFlatCurveRing=function(t,e){for(var r=Put([],this.MULTICURVE_PARSERS,t,e,this),n=[],i=0,o=r.length;i<o;++i)y(n,r[i].getFlatCoordinates());return n},e.prototype.readMultiSurface=function(t,e){var r=Put([],this.MULTISURFACE_PARSERS,t,e,this);if(r)return new oh(r)},e.prototype.curveMemberParser=function(t,e){Iut(this.CURVEMEMBER_PARSERS,t,e,this)},e.prototype.surfaceMemberParser=function(t,e){Iut(this.SURFACEMEMBER_PARSERS,t,e,this)},e.prototype.readPatch=function(t,e){return Put([null],this.PATCHES_PARSERS,t,e,this)},e.prototype.readSegment=function(t,e){return Put([],this.SEGMENTS_PARSERS,t,e,this)},e.prototype.readPolygonPatch=function(t,e){return Put([null],this.FLAT_LINEAR_RINGS_PARSERS,t,e,this)},e.prototype.readLineStringSegment=function(t,e){return Put([null],this.GEOMETRY_FLAT_COORDINATES_PARSERS,t,e,this)},e.prototype.interiorParser=function(t,e){var r=Put(void 0,this.RING_PARSERS,t,e,this);r&&e[e.length-1].push(r)},e.prototype.exteriorParser=function(t,e){var r=Put(void 0,this.RING_PARSERS,t,e,this);r&&(e[e.length-1][0]=r)},e.prototype.readSurface=function(t,e){var r=Put([null],this.SURFACE_PARSERS,t,e,this);if(r&&r[0]){var n,i=r[0],o=[i.length],s=void 0;for(s=1,n=r.length;s<n;++s)y(i,r[s]),o.push(i.length);return new bn(i,Y.XYZ,o)}},e.prototype.readCurve=function(t,e){var r=Put([null],this.CURVE_PARSERS,t,e,this);return r?new Nn(r,Y.XYZ):void 0},e.prototype.readEnvelope=function(t,e){var r=Put([null],this.ENVELOPE_PARSERS,t,e,this);return Mt(r[1][0],r[1][1],r[2][0],r[2][1])},e.prototype.readFlatPos=function(t,e){for(var r,n=dut(t,!1),i=/^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/,o=[];r=i.exec(n);)o.push(parseFloat(r[1])),n=n.substr(r[0].length);if(""===n){var s=e[0].srsName,a="enu";if(s&&(a=nr(s).getAxisOrientation()),"neu"===a){var l,u=void 0;for(u=0,l=o.length;u<l;u+=3){var h=o[u],c=o[u+1];o[u]=c,o[u+1]=h}}var A=o.length;if(2==A&&o.push(0),0!==A)return o}},e.prototype.readFlatPosList=function(t,e){var r=dut(t,!1).replace(/^\s*|\s*$/g,""),n=e[0],i=n.srsName,o=n.srsDimension,s="enu";i&&(s=nr(i).getAxisOrientation());var a,l,u,h=r.split(/\s+/),c=2;t.getAttribute("srsDimension")?c=zut(t.getAttribute("srsDimension")):t.getAttribute("dimension")?c=zut(t.getAttribute("dimension")):t.parentNode.getAttribute("srsDimension")?c=zut(t.parentNode.getAttribute("srsDimension")):o&&(c=zut(o));for(var A=[],f=0,p=h.length;f<p;f+=c)a=parseFloat(h[f]),l=parseFloat(h[f+1]),u=3===c?parseFloat(h[f+2]):0,"en"===s.substr(0,2)?A.push(a,l,u):A.push(l,a,u);return A},e.prototype.writePos_=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=i?"3":"2";t.setAttribute("srsDimension",o);var s=n.srsName,a="enu";s&&(a=nr(s).getAxisOrientation());var l,u=e.getCoordinates();l="en"===a.substr(0,2)?u[0]+" "+u[1]:u[1]+" "+u[0],i&&(l+=" "+(u[2]||0)),Wut(t,l)},e.prototype.getCoords_=function(t,e,r){var n="enu";e&&(n=nr(e).getAxisOrientation());var i="en"===n.substr(0,2)?t[0]+" "+t[1]:t[1]+" "+t[0];return r&&(i+=" "+(t[2]||0)),i},e.prototype.writePosList_=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=i?"3":"2";t.setAttribute("srsDimension",o);for(var s,a=n.srsName,l=e.getCoordinates(),u=l.length,h=new Array(u),c=0;c<u;++c)s=l[c],h[c]=this.getCoords_(s,a,i);Wut(t,h.join(" "))},e.prototype.writePoint=function(t,e,r){var n=r[r.length-1].srsName;n&&t.setAttribute("srsName",n);var i=put(t.namespaceURI,"pos");t.appendChild(i),this.writePos_(i,e,r)},e.prototype.writeEnvelope=function(t,e,r){var n=r[r.length-1].srsName;n&&t.setAttribute("srsName",n);var i=[e[0]+" "+e[1],e[2]+" "+e[3]];Tut({node:t},this.ENVELOPE_SERIALIZERS,Cut,i,r,["lowerCorner","upperCorner"],this)},e.prototype.writeLinearRing=function(t,e,r){var n=r[r.length-1].srsName;n&&t.setAttribute("srsName",n);var i=put(t.namespaceURI,"posList");t.appendChild(i),this.writePosList_(i,e,r)},e.prototype.RING_NODE_FACTORY_=function(t,e,r){var n=e[e.length-1],i=n.node,o=n.exteriorWritten;return void 0===o&&(n.exteriorWritten=!0),put(i.namespaceURI,void 0!==o?"interior":"exterior")},e.prototype.writeSurfaceOrPolygon=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName;if("PolygonPatch"!==t.nodeName&&o&&t.setAttribute("srsName",o),"Polygon"===t.nodeName||"PolygonPatch"===t.nodeName){var s=e.getLinearRings();Tut({node:t,hasZ:i,srsName:o},this.RING_SERIALIZERS,this.RING_NODE_FACTORY_,s,r,void 0,this)}else if("Surface"===t.nodeName){var a=put(t.namespaceURI,"patches");t.appendChild(a),this.writeSurfacePatches_(a,e,r)}},e.prototype.writeCurveOrLineString=function(t,e,r){var n=r[r.length-1].srsName;if("LineStringSegment"!==t.nodeName&&n&&t.setAttribute("srsName",n),"LineString"===t.nodeName||"LineStringSegment"===t.nodeName){var i=put(t.namespaceURI,"posList");t.appendChild(i),this.writePosList_(i,e,r)}else if("Curve"===t.nodeName){var o=put(t.namespaceURI,"segments");t.appendChild(o),this.writeCurveSegments_(o,e,r)}},e.prototype.writeMultiSurfaceOrPolygon=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName,s=n.surface;o&&t.setAttribute("srsName",o);var a=e.getPolygons();Tut({node:t,hasZ:i,srsName:o,surface:s},this.SURFACEORPOLYGONMEMBER_SERIALIZERS,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,a,r,void 0,this)},e.prototype.writeMultiPoint=function(t,e,r){var n=r[r.length-1],i=n.srsName,o=n.hasZ;i&&t.setAttribute("srsName",i);var s=e.getPoints();Tut({node:t,hasZ:o,srsName:i},this.POINTMEMBER_SERIALIZERS,Eut("pointMember"),s,r,void 0,this)},e.prototype.writeMultiCurveOrLineString=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName,s=n.curve;o&&t.setAttribute("srsName",o);var a=e.getLineStrings();Tut({node:t,hasZ:i,srsName:o,curve:s},this.LINESTRINGORCURVEMEMBER_SERIALIZERS,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,a,r,void 0,this)},e.prototype.writeRing=function(t,e,r){var n=put(t.namespaceURI,"LinearRing");t.appendChild(n),this.writeLinearRing(n,e,r)},e.prototype.writeSurfaceOrPolygonMember=function(t,e,r){var n=this.GEOMETRY_NODE_FACTORY_(e,r);n&&(t.appendChild(n),this.writeSurfaceOrPolygon(n,e,r))},e.prototype.writePointMember=function(t,e,r){var n=put(t.namespaceURI,"Point");t.appendChild(n),this.writePoint(n,e,r)},e.prototype.writeLineStringOrCurveMember=function(t,e,r){var n=this.GEOMETRY_NODE_FACTORY_(e,r);n&&(t.appendChild(n),this.writeCurveOrLineString(n,e,r))},e.prototype.writeSurfacePatches_=function(t,e,r){var n=put(t.namespaceURI,"PolygonPatch");t.appendChild(n),this.writeSurfaceOrPolygon(n,e,r)},e.prototype.writeCurveSegments_=function(t,e,r){var n=put(t.namespaceURI,"LineStringSegment");t.appendChild(n),this.writeCurveOrLineString(n,e,r)},e.prototype.writeGeometryElement=function(t,e,r){var n,i=r[r.length-1],o=b({},i);o.node=t,n=Array.isArray(e)?Zc(e,i):Yc(e,!0,i),Tut(o,this.GEOMETRY_SERIALIZERS,this.GEOMETRY_NODE_FACTORY_,[n],r,void 0,this)},e.prototype.writeFeatureElement=function(t,e,r){var n=e.getId();n&&t.setAttribute("fid",n);var i=r[r.length-1],o=i.featureNS,s=e.getGeometryName();i.serializers||(i.serializers={},i.serializers[o]={});var a=[],l=[];if(e.hasProperties()){var u=e.getProperties();for(var h in u){var c=u[h];null!==c&&(a.push(h),l.push(c),h==s||"function"==typeof c.getSimplifiedGeometry?h in i.serializers[o]||(i.serializers[o][h]=xut(this.writeGeometryElement,this)):h in i.serializers[o]||(i.serializers[o][h]=xut(Wut)))}}var A=b({},i);A.node=t,Tut(A,i.serializers,Eut(void 0,o),l,r,a)},e.prototype.writeFeatureMembers_=function(t,e,r){var n=r[r.length-1],i=n.featureType,o=n.featureNS,s={};s[o]={},s[o][i]=xut(this.writeFeatureElement,this);var a=b({},n);a.node=t,Tut(a,s,Eut(i,o),e,r)},e.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_=function(t,e,r){var n=e[e.length-1].node;return put(this.namespace,rht[n.nodeName])},e.prototype.GEOMETRY_NODE_FACTORY_=function(t,e,r){var n,i=e[e.length-1],o=i.multiSurface,s=i.surface,a=i.curve,l=i.multiCurve;return Array.isArray(t)?n="Envelope":"MultiPolygon"===(n=t.getType())&&!0===o?n="MultiSurface":"Polygon"===n&&!0===s?n="Surface":"LineString"===n&&!0===a?n="Curve":"MultiLineString"===n&&!0===l&&(n="MultiCurve"),put(this.namespace,n)},e.prototype.writeGeometryNode=function(t,e){e=this.adaptOptions(e);var r=put(this.namespace,"geom"),n={node:r,hasZ:this.hasZ,srsName:this.srsName,curve:this.curve_,surface:this.surface_,multiSurface:this.multiSurface_,multiCurve:this.multiCurve_};return e&&b(n,e),this.writeGeometryElement(r,t,[n]),r},e.prototype.writeFeaturesNode=function(t,e){e=this.adaptOptions(e);var r=put(this.namespace,"featureMembers");r.setAttributeNS(fut,"xsi:schemaLocation",this.schemaLocation);var n={srsName:this.srsName,hasZ:this.hasZ,curve:this.curve_,surface:this.surface_,multiSurface:this.multiSurface_,multiCurve:this.multiCurve_,featureNS:this.featureNS,featureType:this.featureType};return e&&b(n,e),this.writeFeatureMembers_(r,t,[n]),r},e}(Gut);nht.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{pos:wut(nht.prototype.readFlatPos),posList:wut(nht.prototype.readFlatPosList),coordinates:wut($ut.prototype.readFlatCoordinates)}},nht.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{interior:nht.prototype.interiorParser,exterior:nht.prototype.exteriorParser}},nht.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{Point:wut(Gut.prototype.readPoint),MultiPoint:wut(Gut.prototype.readMultiPoint),LineString:wut(Gut.prototype.readLineString),MultiLineString:wut(Gut.prototype.readMultiLineString),LinearRing:wut(Gut.prototype.readLinearRing),Polygon:wut(Gut.prototype.readPolygon),MultiPolygon:wut(Gut.prototype.readMultiPolygon),Surface:wut(nht.prototype.readSurface),MultiSurface:wut(nht.prototype.readMultiSurface),Curve:wut(nht.prototype.readCurve),MultiCurve:wut(nht.prototype.readMultiCurve),Envelope:wut(nht.prototype.readEnvelope)}},nht.prototype.MULTICURVE_PARSERS={"http://www.opengis.net/gml":{curveMember:_ut(nht.prototype.curveMemberParser),curveMembers:_ut(nht.prototype.curveMemberParser)}},nht.prototype.MULTISURFACE_PARSERS={"http://www.opengis.net/gml":{surfaceMember:_ut(nht.prototype.surfaceMemberParser),surfaceMembers:_ut(nht.prototype.surfaceMemberParser)}},nht.prototype.CURVEMEMBER_PARSERS={"http://www.opengis.net/gml":{LineString:_ut(Gut.prototype.readLineString),Curve:_ut(nht.prototype.readCurve)}},nht.prototype.SURFACEMEMBER_PARSERS={"http://www.opengis.net/gml":{Polygon:_ut(Gut.prototype.readPolygon),Surface:_ut(nht.prototype.readSurface)}},nht.prototype.SURFACE_PARSERS={"http://www.opengis.net/gml":{patches:wut(nht.prototype.readPatch)}},nht.prototype.CURVE_PARSERS={"http://www.opengis.net/gml":{segments:wut(nht.prototype.readSegment)}},nht.prototype.ENVELOPE_PARSERS={"http://www.opengis.net/gml":{lowerCorner:_ut(nht.prototype.readFlatPosList),upperCorner:_ut(nht.prototype.readFlatPosList)}},nht.prototype.PATCHES_PARSERS={"http://www.opengis.net/gml":{PolygonPatch:wut(nht.prototype.readPolygonPatch)}},nht.prototype.SEGMENTS_PARSERS={"http://www.opengis.net/gml":{LineStringSegment:vut(nht.prototype.readLineStringSegment)}},Gut.prototype.RING_PARSERS={"http://www.opengis.net/gml":{LinearRing:wut(Gut.prototype.readFlatLinearRing),Ring:wut(nht.prototype.readFlatCurveRing)}},nht.prototype.writeFeatures,nht.prototype.RING_SERIALIZERS={"http://www.opengis.net/gml":{exterior:xut(nht.prototype.writeRing),interior:xut(nht.prototype.writeRing)}},nht.prototype.ENVELOPE_SERIALIZERS={"http://www.opengis.net/gml":{lowerCorner:xut(Wut),upperCorner:xut(Wut)}},nht.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{surfaceMember:xut(nht.prototype.writeSurfaceOrPolygonMember),polygonMember:xut(nht.prototype.writeSurfaceOrPolygonMember)}},nht.prototype.POINTMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{pointMember:xut(nht.prototype.writePointMember)}},nht.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{lineStringMember:xut(nht.prototype.writeLineStringOrCurveMember),curveMember:xut(nht.prototype.writeLineStringOrCurveMember)}},nht.prototype.GEOMETRY_SERIALIZERS={"http://www.opengis.net/gml":{Curve:xut(nht.prototype.writeCurveOrLineString),MultiCurve:xut(nht.prototype.writeMultiCurveOrLineString),Point:xut(nht.prototype.writePoint),MultiPoint:xut(nht.prototype.writeMultiPoint),LineString:xut(nht.prototype.writeCurveOrLineString),MultiLineString:xut(nht.prototype.writeMultiCurveOrLineString),LinearRing:xut(nht.prototype.writeLinearRing),Polygon:xut(nht.prototype.writeSurfaceOrPolygon),MultiPolygon:xut(nht.prototype.writeMultiSurfaceOrPolygon),Surface:xut(nht.prototype.writeSurfaceOrPolygon),MultiSurface:xut(nht.prototype.writeMultiSurfaceOrPolygon),Envelope:xut(nht.prototype.writeEnvelope)}};const iht=nht;var oht,sht,aht,lht,uht,hht,cht,Aht,fht,pht=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),dht=["http://www.google.com/kml/ext/2.2"],ght=[null,"http://earth.google.com/kml/2.0","http://earth.google.com/kml/2.1","http://earth.google.com/kml/2.2","http://www.opengis.net/kml/2.2"],yht={fraction:_s.FRACTION,pixels:_s.PIXELS,insetPixels:_s.PIXELS},mht=But(ght,{ExtendedData:Act,Region:fct,MultiGeometry:but(nct,"geometry"),LineString:but(tct,"geometry"),LinearRing:but(ect,"geometry"),Point:but(ict,"geometry"),Polygon:but(sct,"geometry"),Style:but(lct),StyleMap:function(t,e){var r=Ght.call(this,t,e);if(r){var n=e[e.length-1];Array.isArray(r)?n.Style=r:"string"==typeof r?n.styleUrl=r:K(!1,38)}},address:but(Vut),description:but(Vut),name:but(Vut),open:but(Qut),phoneNumber:but(Vut),styleUrl:but(kht),visibility:but(Qut)},But(dht,{MultiTrack:but((function(t,e){var r=Put([],qht,t,e);if(r)return new Ju(r)}),"geometry"),Track:but(Xht,"geometry")})),vht=But(ght,{ExtendedData:Act,Region:fct,Link:function(t,e){Iut(_ht,t,e)},address:but(Vut),description:but(Vut),name:but(Vut),open:but(Qut),phoneNumber:but(Vut),visibility:but(Qut)}),_ht=But(ght,{href:but(Rht)}),wht=But(ght,{LatLonAltBox:function(t,e){var r=Put({},gct,t,e);if(r){var n=e[e.length-1],i=[parseFloat(r.west),parseFloat(r.south),parseFloat(r.east),parseFloat(r.north)];n.extent=i,n.altitudeMode=r.altitudeMode,n.minAltitude=parseFloat(r.minAltitude),n.maxAltitude=parseFloat(r.maxAltitude)}},Lod:function(t,e){var r=Put({},yct,t,e);if(r){var n=e[e.length-1];n.minLodPixels=parseFloat(r.minLodPixels),n.maxLodPixels=parseFloat(r.maxLodPixels),n.minFadeExtent=parseFloat(r.minFadeExtent),n.maxFadeExtent=parseFloat(r.maxFadeExtent)}}}),bht=But(ght,["Document","Placemark"]),xht=But(ght,{Document:xut((function(t,e,r){Tut({node:t},bct,xct,e,r,void 0,this)})),Placemark:xut(qct)}),Eht=null,Cht=null,Sht=null,Bht=null,Iht=null,Pht=null;function Tht(t){return 32/Math.min(t[0],t[1])}function Fht(t){return t}var Mht=function(t){function e(e){var r=t.call(this)||this,n=e||{};return Pht||(Eht=new Tn({color:oht=[255,255,255,1]}),sht=[20,2],aht=_s.PIXELS,lht=_s.PIXELS,uht=[64,64],hht="https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png",Cht=new Ns({anchor:sht,anchorOrigin:ws.BOTTOM_LEFT,anchorXUnits:aht,anchorYUnits:lht,crossOrigin:"anonymous",rotation:0,scale:Tht(uht),size:uht,src:hht}),cht="NO_IMAGE",Sht=new Rn({color:oht,width:1}),Aht=new Rn({color:[51,51,51,1],width:2}),Bht=new Vi({font:"bold 16px Helvetica",fill:Eht,stroke:Aht,scale:.8}),Iht=new ji({fill:Eht,image:Cht,text:Bht,stroke:Sht,zIndex:0}),Pht=[Iht]),r.dataProjection=nr("EPSG:4326"),r.defaultStyle_=n.defaultStyle?n.defaultStyle:Pht,r.extractStyles_=void 0===n.extractStyles||n.extractStyles,r.writeStyles_=void 0===n.writeStyles||n.writeStyles,r.sharedStyles_={},r.showPointNames_=void 0===n.showPointNames||n.showPointNames,r.crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:"anonymous",r.iconUrlFunction_=n.iconUrlFunction?n.iconUrlFunction:Fht,r.supportedMediaTypes=["application/vnd.google-earth.kml+xml"],r}return pht(e,t),e.prototype.readDocumentOrFolder_=function(t,e){return Put([],But(ght,{Document:vut(this.readDocumentOrFolder_,this),Folder:vut(this.readDocumentOrFolder_,this),Placemark:_ut(this.readPlacemark_,this),Style:this.readSharedStyle_.bind(this),StyleMap:this.readSharedStyleMap_.bind(this)}),t,e,this)||void 0},e.prototype.readPlacemark_=function(t,e){var r,n,i,o,s,a=Put({geometry:null},mht,t,e,this);if(a){var l=new X,u=t.getAttribute("id");null!==u&&l.setId(u);var h=e[0],c=a.geometry;if(c&&Yc(c,!1,h),l.setGeometry(c),delete a.geometry,this.extractStyles_){var A=(r=a.Style,n=a.styleUrl,i=this.defaultStyle_,o=this.sharedStyles_,s=this.showPointNames_,function(t,e){var a=s,l="",u=[];if(a){var h=t.getGeometry();if(h)if(h instanceof EA)a=(u=h.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return"Point"===e||"MultiPoint"===e}))).length>0;else{var c=h.getType();a="Point"===c||"MultiPoint"===c}}a&&(l=t.get("name"),(a=a&&!!l)&&l.search(/&[^&]+;/)>-1&&(fht||(fht=document.createElement("textarea")),fht.innerHTML=l,l=fht.value));var A=i;if(r?A=r:n&&(A=Lht(n,i,o)),a){var f=function(t,e){var r=[0,0],n="start",i=t.getImage();if(i){var o=i.getSize();if(o&&2==o.length){var s=i.getScaleArray(),a=i.getAnchor();r[0]=s[0]*(o[0]-a[0]),r[1]=s[1]*(o[1]/2-a[1]),n="left"}}var l=t.getText();return l?((l=l.clone()).setFont(l.getFont()||Bht.getFont()),l.setScale(l.getScale()||Bht.getScale()),l.setFill(l.getFill()||Bht.getFill()),l.setStroke(l.getStroke()||Aht)):l=Bht.clone(),l.setText(e),l.setOffsetX(r[0]),l.setOffsetY(r[1]),l.setTextAlign(n),new ji({image:i,text:l})}(A[0],l);return u.length>0?(f.setGeometry(new EA(u)),[f,new ji({geometry:A[0].getGeometry(),image:null,fill:A[0].getFill(),stroke:A[0].getStroke(),text:null})].concat(A.slice(1))):f}return A});l.setStyle(A)}return delete a.Style,l.setProperties(a,!0),l}},e.prototype.readSharedStyle_=function(t,e){var r=t.getAttribute("id");if(null!==r){var n=lct.call(this,t,e);if(n){var i,o=t.baseURI;o&&"about:blank"!=o||(o=window.location.href),i=o?new URL("#"+r,o).href:"#"+r,this.sharedStyles_[i]=n}}},e.prototype.readSharedStyleMap_=function(t,e){var r=t.getAttribute("id");if(null!==r){var n=Ght.call(this,t,e);if(n){var i,o=t.baseURI;o&&"about:blank"!=o||(o=window.location.href),i=o?new URL("#"+r,o).href:"#"+r,this.sharedStyles_[i]=n}}},e.prototype.readFeatureFromNode=function(t,e){return p(ght,t.namespaceURI)&&this.readPlacemark_(t,[this.getReadOptions(t,e)])||null},e.prototype.readFeaturesFromNode=function(t,e){if(!p(ght,t.namespaceURI))return[];var r,n=t.localName;if("Document"==n||"Folder"==n)return(r=this.readDocumentOrFolder_(t,[this.getReadOptions(t,e)]))||[];if("Placemark"==n){var i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i?[i]:[]}if("kml"==n){r=[];for(var o=t.firstElementChild;o;o=o.nextElementSibling){var s=this.readFeaturesFromNode(o,e);s&&y(r,s)}return r}return[]},e.prototype.readName=function(t){if(t){if("string"==typeof t){var e=mut(t);return this.readNameFromDocument(e)}return yut(t)?this.readNameFromDocument(t):this.readNameFromNode(t)}},e.prototype.readNameFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE){var r=this.readNameFromNode(e);if(r)return r}},e.prototype.readNameFromNode=function(t){for(var e=t.firstElementChild;e;e=e.nextElementSibling)if(p(ght,e.namespaceURI)&&"name"==e.localName)return Vut(e);for(e=t.firstElementChild;e;e=e.nextElementSibling){var r=e.localName;if(p(ght,e.namespaceURI)&&("Document"==r||"Folder"==r||"Placemark"==r||"kml"==r)){var n=this.readNameFromNode(e);if(n)return n}}},e.prototype.readNetworkLinks=function(t){var e=[];if("string"==typeof t){var r=mut(t);y(e,this.readNetworkLinksFromDocument(r))}else yut(t)?y(e,this.readNetworkLinksFromDocument(t)):y(e,this.readNetworkLinksFromNode(t));return e},e.prototype.readNetworkLinksFromDocument=function(t){for(var e=[],r=t.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&y(e,this.readNetworkLinksFromNode(r));return e},e.prototype.readNetworkLinksFromNode=function(t){for(var e=[],r=t.firstElementChild;r;r=r.nextElementSibling)if(p(ght,r.namespaceURI)&&"NetworkLink"==r.localName){var n=Put({},vht,r,[]);e.push(n)}for(r=t.firstElementChild;r;r=r.nextElementSibling){var i=r.localName;!p(ght,r.namespaceURI)||"Document"!=i&&"Folder"!=i&&"kml"!=i||y(e,this.readNetworkLinksFromNode(r))}return e},e.prototype.readRegion=function(t){var e=[];if("string"==typeof t){var r=mut(t);y(e,this.readRegionFromDocument(r))}else yut(t)?y(e,this.readRegionFromDocument(t)):y(e,this.readRegionFromNode(t));return e},e.prototype.readRegionFromDocument=function(t){for(var e=[],r=t.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&y(e,this.readRegionFromNode(r));return e},e.prototype.readRegionFromNode=function(t){for(var e=[],r=t.firstElementChild;r;r=r.nextElementSibling)if(p(ght,r.namespaceURI)&&"Region"==r.localName){var n=Put({},wht,r,[]);e.push(n)}for(r=t.firstElementChild;r;r=r.nextElementSibling){var i=r.localName;!p(ght,r.namespaceURI)||"Document"!=i&&"Folder"!=i&&"kml"!=i||y(e,this.readRegionFromNode(r))}return e},e.prototype.writeFeaturesNode=function(t,e){e=this.adaptOptions(e);var r=put(ght[4],"kml"),n="http://www.w3.org/2000/xmlns/";r.setAttributeNS(n,"xmlns:gx",dht[0]),r.setAttributeNS(n,"xmlns:xsi",fut),r.setAttributeNS(fut,"xsi:schemaLocation","http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd");var i={node:r},o={};t.length>1?o.Document=t:1==t.length&&(o.Placemark=t[0]);var s=bht[r.namespaceURI],a=Sut(o,s);return Tut(i,xht,Cut,a,[e],s,this),r},e}(Nut);function Lht(t,e,r){return Array.isArray(t)?t:"string"==typeof t?Lht(r[t],e,r):e}function Oht(t){var e=dut(t,!1),r=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e);if(r){var n=r[1];return[parseInt(n.substr(6,2),16),parseInt(n.substr(4,2),16),parseInt(n.substr(2,2),16),parseInt(n.substr(0,2),16)/255]}}function Nht(t){var e=dut(t,!1),r=[];e=e.replace(/\s*,\s*/g,",");for(var n,i=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?),([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|,|$)(?:([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|$))?\s*/i;n=i.exec(e);){var o=parseFloat(n[1]),s=parseFloat(n[2]),a=n[3]?parseFloat(n[3]):0;r.push(o,s,a),e=e.substr(n[0].length)}if(""===e)return r}function Rht(t){var e=dut(t,!1).trim(),r=t.baseURI;return r&&"about:blank"!=r||(r=window.location.href),r?new URL(e,r).href:e}function kht(t){var e=dut(t,!1).trim().replace(/^(?!.*#)/,"#"),r=t.baseURI;return r&&"about:blank"!=r||(r=window.location.href),r?new URL(e,r).href:e}function Uht(t){return jut(t)}var Dht=But(ght,{Pair:function(t,e){var r=Put({},pct,t,e,this);if(r){var n=r.key;if(n&&"normal"==n){var i=r.styleUrl;i&&(e[e.length-1]=i);var o=r.Style;o&&(e[e.length-1]=o)}}}});function Ght(t,e){return Put(void 0,Dht,t,e,this)}var Qht=But(ght,{Icon:but((function(t,e){return Put({},Yht,t,e)||null})),color:but(Oht),heading:but(jut),hotSpot:but((function(t){var e,r=t.getAttribute("xunits"),n=t.getAttribute("yunits");return e="insetPixels"!==r?"insetPixels"!==n?ws.BOTTOM_LEFT:ws.TOP_LEFT:"insetPixels"!==n?ws.BOTTOM_RIGHT:ws.TOP_RIGHT,{x:parseFloat(t.getAttribute("x")),xunits:yht[r],y:parseFloat(t.getAttribute("y")),yunits:yht[n],origin:e}})),scale:but(Uht)}),jht=But(ght,{color:but(Oht),scale:but(Uht)}),Hht=But(ght,{color:but(Oht),width:but(jut)}),zht=But(ght,{color:but(Oht),fill:but(Qut),outline:but(Qut)}),Vht=But(ght,{coordinates:wut(Nht)});function Kht(t,e){return Put(null,Vht,t,e)}var qht=But(dht,{Track:_ut(Xht)}),Wht=But(ght,{when:function(t,e){var r=e[e.length-1].whens,n=dut(t,!1),i=Date.parse(n);r.push(isNaN(i)?0:i)}},But(dht,{coord:function(t,e){var r=e[e.length-1].coordinates,n=dut(t,!1),i=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(n);if(i){var o=parseFloat(i[1]),s=parseFloat(i[2]),a=parseFloat(i[3]);r.push([o,s,a])}else r.push([])}}));function Xht(t,e){var r=Put({coordinates:[],whens:[]},Wht,t,e);if(r){for(var n=[],i=r.coordinates,o=r.whens,s=0,a=Math.min(i.length,o.length);s<a;++s)3==i[s].length&&n.push(i[s][0],i[s][1],i[s][2],o[s]);return new Nn(n,Y.XYZM)}}var Yht=But(ght,{href:but(Rht)},But(dht,{x:but(jut),y:but(jut),w:but(jut),h:but(jut)})),Zht=But(ght,{coordinates:wut(Nht)});function Jht(t,e){return Put(null,Zht,t,e)}var $ht=But(ght,{extrude:but(Qut),tessellate:but(Qut),altitudeMode:but(Vut)});function tct(t,e){var r=Put({},$ht,t,e),n=Jht(t,e);if(n){var i=new Nn(n,Y.XYZ);return i.setProperties(r,!0),i}}function ect(t,e){var r=Put({},$ht,t,e),n=Jht(t,e);if(n){var i=new bn(n,Y.XYZ,[n.length]);return i.setProperties(r,!0),i}}var rct=But(ght,{LineString:_ut(tct),LinearRing:_ut(ect),MultiGeometry:_ut(nct),Point:_ut(ict),Polygon:_ut(sct)});function nct(t,e){var r,n=Put([],rct,t,e);if(!n)return null;if(0===n.length)return new EA(n);for(var i=!0,o=n[0].getType(),s=1,a=n.length;s<a;++s)if(n[s].getType()!=o){i=!1;break}if(i){var l=void 0,u=void 0;if("Point"==o){var h=n[0];for(l=h.getLayout(),u=h.getFlatCoordinates(),s=1,a=n.length;s<a;++s)y(u,n[s].getFlatCoordinates());uct(r=new eh(u,l),n)}else"LineString"==o?uct(r=new Ju(n),n):"Polygon"==o?uct(r=new oh(n),n):"GeometryCollection"==o?r=new EA(n):K(!1,37)}else r=new EA(n);return r}function ict(t,e){var r=Put({},$ht,t,e),n=Jht(t,e);if(n){var i=new nn(n,Y.XYZ);return i.setProperties(r,!0),i}}var oct=But(ght,{innerBoundaryIs:function(t,e){var r=Put([],mct,t,e);if(r.length>0){var n=e[e.length-1];n.push.apply(n,r)}},outerBoundaryIs:function(t,e){var r=Put(void 0,vct,t,e);r&&(e[e.length-1][0]=r)}});function sct(t,e){var r=Put({},$ht,t,e),n=Put([null],oct,t,e);if(n&&n[0]){for(var i=n[0],o=[i.length],s=1,a=n.length;s<a;++s)y(i,n[s]),o.push(i.length);var l=new bn(i,Y.XYZ,o);return l.setProperties(r,!0),l}}var act=But(ght,{IconStyle:function(t,e){var r=Put({},Qht,t,e);if(r){var n,i,o,s,a=e[e.length-1],l="Icon"in r?r.Icon:{},u=!("Icon"in r)||Object.keys(l).length>0,h=l.href;h?n=h:u&&(n=hht);var c,A=ws.BOTTOM_LEFT,f=r.hotSpot;f?(i=[f.x,f.y],o=f.xunits,s=f.yunits,A=f.origin):/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(n)&&(/pushpin/.test(n)?(i=sht,o=aht,s=lht):/arrow-reverse/.test(n)?(i=[54,42],o=aht,s=lht):/paddle/.test(n)&&(i=[32,1],o=aht,s=lht));var p,d=l.x,g=l.y;void 0!==d&&void 0!==g&&(c=[d,g]);var y,m=l.w,v=l.h;void 0!==m&&void 0!==v&&(p=[m,v]);var _=r.heading;void 0!==_&&(y=Ae(_));var w=r.scale,b=r.color;if(u){n==hht&&(p=uht);var x=new Ns({anchor:i,anchorOrigin:A,anchorXUnits:o,anchorYUnits:s,crossOrigin:this.crossOrigin_,offset:c,offsetOrigin:ws.BOTTOM_LEFT,rotation:y,scale:w,size:p,src:this.iconUrlFunction_(n),color:b}),E=x.getScaleArray()[0],C=x.getSize();if(null===C){var S=x.getImageState();if(S===kn.IDLE||S===kn.LOADING){var B=function(){var t=x.getImageState();if(t!==kn.IDLE&&t!==kn.LOADING){var e=x.getSize();if(e&&2==e.length){var r=Tht(e);x.setScale(E*r)}x.unlistenImageChange(B)}};x.listenImageChange(B),S===kn.IDLE&&x.load()}}else if(2==C.length){var I=Tht(C);x.setScale(E*I)}a.imageStyle=x}else a.imageStyle=cht}},LabelStyle:function(t,e){var r=Put({},jht,t,e);if(r){var n=e[e.length-1],i=new Vi({fill:new Tn({color:"color"in r?r.color:oht}),scale:r.scale});n.textStyle=i}},LineStyle:function(t,e){var r=Put({},Hht,t,e);if(r){var n=e[e.length-1],i=new Rn({color:"color"in r?r.color:oht,width:"width"in r?r.width:1});n.strokeStyle=i}},PolyStyle:function(t,e){var r=Put({},zht,t,e);if(r){var n=e[e.length-1],i=new Tn({color:"color"in r?r.color:oht});n.fillStyle=i;var o=r.fill;void 0!==o&&(n.fill=o);var s=r.outline;void 0!==s&&(n.outline=s)}}});function lct(t,e){var r=Put({},act,t,e,this);if(!r)return null;var n,i="fillStyle"in r?r.fillStyle:Eht,o=r.fill;void 0===o||o||(i=null),"imageStyle"in r?r.imageStyle!=cht&&(n=r.imageStyle):n=Cht;var s="textStyle"in r?r.textStyle:Bht,a="strokeStyle"in r?r.strokeStyle:Sht,l=r.outline;return void 0===l||l?[new ji({fill:i,image:n,stroke:a,text:s,zIndex:void 0})]:[new ji({geometry:function(t){var e=t.getGeometry(),r=e.getType();return"GeometryCollection"===r?new EA(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return"Polygon"!==e&&"MultiPolygon"!==e}))):"Polygon"!==r&&"MultiPolygon"!==r?e:void 0},fill:i,image:n,stroke:a,text:s,zIndex:void 0}),new ji({geometry:function(t){var e=t.getGeometry(),r=e.getType();return"GeometryCollection"===r?new EA(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return"Polygon"===e||"MultiPolygon"===e}))):"Polygon"===r||"MultiPolygon"===r?e:void 0},fill:i,stroke:null,zIndex:void 0})]}function uct(t,e){var r,n,i,o=e.length,s=new Array(e.length),a=new Array(e.length),l=new Array(e.length);r=!1,n=!1,i=!1;for(var u=0;u<o;++u){var h=e[u];s[u]=h.get("extrude"),a[u]=h.get("tessellate"),l[u]=h.get("altitudeMode"),r=r||void 0!==s[u],n=n||void 0!==a[u],i=i||l[u]}r&&t.set("extrude",s),n&&t.set("tessellate",a),i&&t.set("altitudeMode",l)}var hct=But(ght,{displayName:but(Vut),value:but(Vut)}),cct=But(ght,{Data:function(t,e){var r=t.getAttribute("name");Iut(hct,t,e);var n=e[e.length-1];r&&n.displayName?n[r]={value:n.value,displayName:n.displayName,toString:function(){return n.value}}:null!==r?n[r]=n.value:null!==n.displayName&&(n[n.displayName]=n.value),delete n.value},SchemaData:function(t,e){Iut(dct,t,e)}});function Act(t,e){Iut(cct,t,e)}function fct(t,e){Iut(wht,t,e)}var pct=But(ght,{Style:but(lct),key:but(Vut),styleUrl:but(kht)}),dct=But(ght,{SimpleData:function(t,e){var r=t.getAttribute("name");if(null!==r){var n=Vut(t);e[e.length-1][r]=n}}}),gct=But(ght,{altitudeMode:but(Vut),minAltitude:but(jut),maxAltitude:but(jut),north:but(jut),south:but(jut),east:but(jut),west:but(jut)}),yct=But(ght,{minLodPixels:but(jut),maxLodPixels:but(jut),minFadeExtent:but(jut),maxFadeExtent:but(jut)}),mct=But(ght,{LinearRing:_ut(Kht)}),vct=But(ght,{LinearRing:wut(Kht)});function _ct(t,e){for(var r=Wn(e),n=[255*(4==r.length?r[3]:1),r[2],r[1],r[0]],i=0;i<4;++i){var o=Math.floor(n[i]).toString(16);n[i]=1==o.length?"0"+o:o}Wut(t,n.join(""))}var wct=But(ght,{Data:xut((function(t,e,r){t.setAttribute("name",e.name);var n={node:t},i=e.value;"object"==typeof i?(null!==i&&i.displayName&&Tut(n,wct,Cut,[i.displayName],r,["displayName"]),null!==i&&i.value&&Tut(n,wct,Cut,[i.value],r,["value"])):Tut(n,wct,Cut,[i],r,["value"])})),value:xut((function(t,e){Wut(t,e)})),displayName:xut((function(t,e){!function(t,e){t.appendChild(Lut().createCDATASection(e))}(t,e)}))}),bct=But(ght,{Placemark:xut(qct)}),xct=function(t,e,r){return put(e[e.length-1].node.namespaceURI,"Placemark")},Ect=Eut("Data"),Cct=But(ght,["href"],But(dht,["x","y","w","h"])),Sct=But(ght,{href:xut(Wut)},But(dht,{x:xut(qut),y:xut(qut),w:xut(qut),h:xut(qut)})),Bct=function(t,e,r){return put(dht[0],"gx:"+r)},Ict=But(ght,["scale","heading","Icon","color","hotSpot"]),Pct=But(ght,{Icon:xut((function(t,e,r){var n={node:t},i=r[r.length-1].node,o=Cct[i.namespaceURI],s=Sut(e,o);Tut(n,Sct,Cut,s,r,o),s=Sut(e,o=Cct[dht[0]]),Tut(n,Sct,Bct,s,r,o)})),color:xut(_ct),heading:xut(qut),hotSpot:xut((function(t,e){t.setAttribute("x",String(e.x)),t.setAttribute("y",String(e.y)),t.setAttribute("xunits",e.xunits),t.setAttribute("yunits",e.yunits)})),scale:xut(nAt)}),Tct=But(ght,["color","scale"]),Fct=But(ght,{color:xut(_ct),scale:xut(nAt)}),Mct=But(ght,["color","width"]),Lct=But(ght,{color:xut(_ct),width:xut(qut)}),Oct={Point:"Point",LineString:"LineString",LinearRing:"LinearRing",Polygon:"Polygon",MultiPoint:"MultiGeometry",MultiLineString:"MultiGeometry",MultiPolygon:"MultiGeometry",GeometryCollection:"MultiGeometry"},Nct=function(t,e,r){if(t)return put(e[e.length-1].node.namespaceURI,Oct[t.getType()])},Rct=Eut("Point"),kct=Eut("LineString"),Uct=Eut("LinearRing"),Dct=Eut("Polygon"),Gct=But(ght,{LineString:xut(Yct),Point:xut(Yct),Polygon:xut(eAt),GeometryCollection:xut(Qct)});function Qct(t,e,r){var n,i={node:t},o=e.getType(),s=[];"GeometryCollection"===o?(e.getGeometriesArrayRecursive().forEach((function(t){var e=t.getType();"MultiPoint"===e?s=s.concat(t.getPoints()):"MultiLineString"===e?s=s.concat(t.getLineStrings()):"MultiPolygon"===e?s=s.concat(t.getPolygons()):"Point"===e||"LineString"===e||"Polygon"===e?s.push(t):K(!1,39)})),n=Nct):"MultiPoint"===o?(s=e.getPoints(),n=Rct):"MultiLineString"===o?(s=e.getLineStrings(),n=kct):"MultiPolygon"===o?(s=e.getPolygons(),n=Dct):K(!1,39),Tut(i,Gct,n,s,r)}var jct=But(ght,{LinearRing:xut(Yct)});function Hct(t,e,r){Tut({node:t},jct,Uct,[e],r)}var zct=But(ght,{ExtendedData:xut((function(t,e,r){for(var n={node:t},i=e.names,o=e.values,s=i.length,a=0;a<s;a++)Tut(n,wct,Ect,[{name:i[a],value:o[a]}],r)})),MultiGeometry:xut(Qct),LineString:xut(Yct),LinearRing:xut(Yct),Point:xut(Yct),Polygon:xut(eAt),Style:xut((function(t,e,r){var n,i={node:t},o={};if(e.pointStyles.length){var s=e.pointStyles[0].getText();s&&(o.LabelStyle=s);var a=e.pointStyles[0].getImage();a&&"function"==typeof a.getSrc&&(o.IconStyle=a)}e.lineStyles.length&&(n=e.lineStyles[0].getStroke())&&(o.LineStyle=n),e.polyStyles.length&&((n=e.polyStyles[0].getStroke())&&!o.LineStyle&&(o.LineStyle=n),o.PolyStyle=e.polyStyles[0]);var l=r[r.length-1].node,u=iAt[l.namespaceURI],h=Sut(o,u);Tut(i,oAt,Cut,h,r,u)})),address:xut(Wut),description:xut(Wut),name:xut(Wut),open:xut(Kut),phoneNumber:xut(Wut),styleUrl:xut(Wut),visibility:xut(Kut)}),Vct=But(ght,["name","open","visibility","address","phoneNumber","description","styleUrl","Style"]),Kct=Eut("ExtendedData");function qct(t,e,r){var n={node:t};e.getId()&&t.setAttribute("id",e.getId());var i=e.getProperties(),o={address:1,description:1,name:1,open:1,phoneNumber:1,styleUrl:1,visibility:1};o[e.getGeometryName()]=1;var s=Object.keys(i||{}).sort().filter((function(t){return!o[t]})),a=e.getStyleFunction();if(a){var l=a(e,0);if(l){var u=Array.isArray(l)?l:[l],h=u;if(e.getGeometry()&&(h=u.filter((function(t){var r=t.getGeometryFunction()(e);if(r){var n=r.getType();return"GeometryCollection"===n?r.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return"Point"===e||"MultiPoint"===e})).length:"Point"===n||"MultiPoint"===n}}))),this.writeStyles_){var c=u,A=u;e.getGeometry()&&(c=u.filter((function(t){var r=t.getGeometryFunction()(e);if(r){var n=r.getType();return"GeometryCollection"===n?r.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return"LineString"===e||"MultiLineString"===e})).length:"LineString"===n||"MultiLineString"===n}})),A=u.filter((function(t){var r=t.getGeometryFunction()(e);if(r){var n=r.getType();return"GeometryCollection"===n?r.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return"Polygon"===e||"MultiPolygon"===e})).length:"Polygon"===n||"MultiPolygon"===n}}))),i.Style={pointStyles:h,lineStyles:c,polyStyles:A}}if(h.length&&void 0===i.name){var f=h[0].getText();f&&(i.name=f.getText())}}}var p=r[r.length-1].node,d=Vct[p.namespaceURI],g=Sut(i,d);if(Tut(n,zct,Cut,g,r,d),s.length>0){var y=Sut(i,s);Tut(n,zct,Kct,[{names:s,values:y}],r)}var m=r[0],v=e.getGeometry();v&&(v=Yc(v,!0,m)),Tut(n,zct,Nct,[v],r)}var Wct=But(ght,["extrude","tessellate","altitudeMode","coordinates"]),Xct=But(ght,{extrude:xut(Kut),tessellate:xut(Kut),altitudeMode:xut(Wut),coordinates:xut((function(t,e,r){var n,i=r[r.length-1],o=i.layout,s=i.stride;o==Y.XY||o==Y.XYM?n=2:o==Y.XYZ||o==Y.XYZM?n=3:K(!1,34);var a=e.length,l="";if(a>0){l+=e[0];for(var u=1;u<n;++u)l+=","+e[u];for(var h=s;h<a;h+=s)for(l+=" "+e[h],u=1;u<n;++u)l+=","+e[h+u]}Wut(t,l)}))});function Yct(t,e,r){var n=e.getFlatCoordinates(),i={node:t};i.layout=e.getLayout(),i.stride=e.getStride();var o=e.getProperties();o.coordinates=n;var s=r[r.length-1].node,a=Wct[s.namespaceURI],l=Sut(o,a);Tut(i,Xct,Cut,l,r,a)}var Zct=But(ght,["color","fill","outline"]),Jct=But(ght,{outerBoundaryIs:xut(Hct),innerBoundaryIs:xut(Hct)}),$ct=Eut("innerBoundaryIs"),tAt=Eut("outerBoundaryIs");function eAt(t,e,r){var n=e.getLinearRings(),i=n.shift(),o={node:t};Tut(o,Jct,$ct,n,r),Tut(o,Jct,tAt,[i],r)}var rAt=But(ght,{color:xut(_ct),fill:xut(Kut),outline:xut(Kut)});function nAt(t,e){qut(t,Math.round(1e6*e)/1e6)}var iAt=But(ght,["IconStyle","LabelStyle","LineStyle","PolyStyle"]),oAt=But(ght,{IconStyle:xut((function(t,e,r){var n={node:t},i={},o=e.getSrc(),s=e.getSize(),a=e.getImageSize(),l={href:o};if(s){l.w=s[0],l.h=s[1];var u=e.getAnchor(),h=e.getOrigin();if(h&&a&&0!==h[0]&&h[1]!==s[1]&&(l.x=h[0],l.y=a[1]-(h[1]+s[1])),u&&(u[0]!==s[0]/2||u[1]!==s[1]/2)){var c={x:u[0],xunits:_s.PIXELS,y:s[1]-u[1],yunits:_s.PIXELS};i.hotSpot=c}}i.Icon=l;var A=e.getScaleArray()[0],f=s;null===f&&(f=uht),2==f.length&&(A/=Tht(f)),1!==A&&(i.scale=A);var p=e.getRotation();0!==p&&(i.heading=p);var d=e.getColor();d&&(i.color=d);var g=r[r.length-1].node,y=Ict[g.namespaceURI],m=Sut(i,y);Tut(n,Pct,Cut,m,r,y)})),LabelStyle:xut((function(t,e,r){var n={node:t},i={},o=e.getFill();o&&(i.color=o.getColor());var s=e.getScale();s&&1!==s&&(i.scale=s);var a=r[r.length-1].node,l=Tct[a.namespaceURI],u=Sut(i,l);Tut(n,Fct,Cut,u,r,l)})),LineStyle:xut((function(t,e,r){var n={node:t},i={color:e.getColor(),width:Number(e.getWidth())||1},o=r[r.length-1].node,s=Mct[o.namespaceURI],a=Sut(i,s);Tut(n,Lct,Cut,a,r,s)})),PolyStyle:xut((function(t,e,r){var n={node:t},i=e.getFill(),o=e.getStroke(),s={color:i?i.getColor():void 0,fill:!!i&&void 0,outline:!!o&&void 0},a=r[r.length-1].node,l=Zct[a.namespaceURI],u=Sut(s,l);Tut(n,rAt,Cut,u,r,l)}))});const sAt=Mht;var aAt=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),lAt=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,n)||this).schemaLocation=n.schemaLocation?n.schemaLocation:r.namespace+" http://schemas.opengis.net/gml/3.2.1/gml.xsd",r}return aAt(e,t),e}(iht);lAt.prototype.namespace="http://www.opengis.net/gml/3.2",lAt.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml/3.2":{pos:wut(iht.prototype.readFlatPos),posList:wut(iht.prototype.readFlatPosList),coordinates:wut($ut.prototype.readFlatCoordinates)}},lAt.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml/3.2":{interior:iht.prototype.interiorParser,exterior:iht.prototype.exteriorParser}},lAt.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml/3.2":{Point:wut(Gut.prototype.readPoint),MultiPoint:wut(Gut.prototype.readMultiPoint),LineString:wut(Gut.prototype.readLineString),MultiLineString:wut(Gut.prototype.readMultiLineString),LinearRing:wut(Gut.prototype.readLinearRing),Polygon:wut(Gut.prototype.readPolygon),MultiPolygon:wut(Gut.prototype.readMultiPolygon),Surface:wut(lAt.prototype.readSurface),MultiSurface:wut(iht.prototype.readMultiSurface),Curve:wut(lAt.prototype.readCurve),MultiCurve:wut(iht.prototype.readMultiCurve),Envelope:wut(lAt.prototype.readEnvelope)}},lAt.prototype.MULTICURVE_PARSERS={"http://www.opengis.net/gml/3.2":{curveMember:_ut(iht.prototype.curveMemberParser),curveMembers:_ut(iht.prototype.curveMemberParser)}},lAt.prototype.MULTISURFACE_PARSERS={"http://www.opengis.net/gml/3.2":{surfaceMember:_ut(iht.prototype.surfaceMemberParser),surfaceMembers:_ut(iht.prototype.surfaceMemberParser)}},lAt.prototype.CURVEMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{LineString:_ut(Gut.prototype.readLineString),Curve:_ut(iht.prototype.readCurve)}},lAt.prototype.SURFACEMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{Polygon:_ut(Gut.prototype.readPolygon),Surface:_ut(iht.prototype.readSurface)}},lAt.prototype.SURFACE_PARSERS={"http://www.opengis.net/gml/3.2":{patches:wut(iht.prototype.readPatch)}},lAt.prototype.CURVE_PARSERS={"http://www.opengis.net/gml/3.2":{segments:wut(iht.prototype.readSegment)}},lAt.prototype.ENVELOPE_PARSERS={"http://www.opengis.net/gml/3.2":{lowerCorner:_ut(iht.prototype.readFlatPosList),upperCorner:_ut(iht.prototype.readFlatPosList)}},lAt.prototype.PATCHES_PARSERS={"http://www.opengis.net/gml/3.2":{PolygonPatch:wut(iht.prototype.readPolygonPatch)}},lAt.prototype.SEGMENTS_PARSERS={"http://www.opengis.net/gml/3.2":{LineStringSegment:vut(iht.prototype.readLineStringSegment)}},lAt.prototype.MULTIPOINT_PARSERS={"http://www.opengis.net/gml/3.2":{pointMember:_ut(Gut.prototype.pointMemberParser),pointMembers:_ut(Gut.prototype.pointMemberParser)}},lAt.prototype.MULTILINESTRING_PARSERS={"http://www.opengis.net/gml/3.2":{lineStringMember:_ut(Gut.prototype.lineStringMemberParser),lineStringMembers:_ut(Gut.prototype.lineStringMemberParser)}},lAt.prototype.MULTIPOLYGON_PARSERS={"http://www.opengis.net/gml/3.2":{polygonMember:_ut(Gut.prototype.polygonMemberParser),polygonMembers:_ut(Gut.prototype.polygonMemberParser)}},lAt.prototype.POINTMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{Point:_ut(Gut.prototype.readFlatCoordinatesFromNode)}},lAt.prototype.LINESTRINGMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{LineString:_ut(Gut.prototype.readLineString)}},lAt.prototype.POLYGONMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{Polygon:_ut(Gut.prototype.readPolygon)}},lAt.prototype.RING_PARSERS={"http://www.opengis.net/gml/3.2":{LinearRing:wut(Gut.prototype.readFlatLinearRing),Ring:wut(lAt.prototype.readFlatCurveRing)}},lAt.prototype.RING_SERIALIZERS={"http://www.opengis.net/gml/3.2":{exterior:xut(iht.prototype.writeRing),interior:xut(iht.prototype.writeRing)}},lAt.prototype.ENVELOPE_SERIALIZERS={"http://www.opengis.net/gml/3.2":{lowerCorner:xut(Wut),upperCorner:xut(Wut)}},lAt.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS={"http://www.opengis.net/gml/3.2":{surfaceMember:xut(iht.prototype.writeSurfaceOrPolygonMember),polygonMember:xut(iht.prototype.writeSurfaceOrPolygonMember)}},lAt.prototype.POINTMEMBER_SERIALIZERS={"http://www.opengis.net/gml/3.2":{pointMember:xut(iht.prototype.writePointMember)}},lAt.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS={"http://www.opengis.net/gml/3.2":{lineStringMember:xut(iht.prototype.writeLineStringOrCurveMember),curveMember:xut(iht.prototype.writeLineStringOrCurveMember)}},lAt.prototype.GEOMETRY_SERIALIZERS={"http://www.opengis.net/gml/3.2":{Curve:xut(iht.prototype.writeCurveOrLineString),MultiCurve:xut(iht.prototype.writeMultiCurveOrLineString),Point:xut(lAt.prototype.writePoint),MultiPoint:xut(iht.prototype.writeMultiPoint),LineString:xut(iht.prototype.writeCurveOrLineString),MultiLineString:xut(iht.prototype.writeMultiCurveOrLineString),LinearRing:xut(iht.prototype.writeLinearRing),Polygon:xut(iht.prototype.writeSurfaceOrPolygon),MultiPolygon:xut(iht.prototype.writeMultiSurfaceOrPolygon),Surface:xut(iht.prototype.writeSurfaceOrPolygon),MultiSurface:xut(iht.prototype.writeMultiSurfaceOrPolygon),Envelope:xut(iht.prototype.writeEnvelope)}};const uAt=lAt,hAt=function(){function t(t){this.tagName_=t}return t.prototype.getTagName=function(){return this.tagName_},t}();var cAt=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const AAt=function(t){function e(e,r){var n=t.call(this,e)||this;return n.conditions=r,K(n.conditions.length>=2,57),n}return cAt(e,t),e}(hAt);var fAt=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const pAt=function(t){function e(e){return t.call(this,"And",Array.prototype.slice.call(arguments))||this}return fAt(e,t),e}(AAt);var dAt=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();const gAt=function(t){function e(e,r,n){var i=t.call(this,"BBOX")||this;if(i.geometryName=e,i.extent=r,4!==r.length)throw new Error("Expected an extent with four values ([minX, minY, maxX, maxY])");return i.srsName=n,i}return dAt(e,t),e}(hAt);var yAt=globalThis&&globalThis.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),mAt={"http://www.opengis.net/gml":{boundedBy:but(Gut.prototype.readExtentElement,"bounds")},"http://www.opengis.net/wfs/2.0":{member:_ut(Gut.prototype.readFeaturesInternal)}},vAt={"http://www.opengis.net/wfs":{totalInserted:but(Hut),totalUpdated:but(Hut),totalDeleted:but(Hut)},"http://www.opengis.net/wfs/2.0":{totalInserted:but(Hut),totalUpdated:but(Hut),totalDeleted:but(Hut)}},_At={"http://www.opengis.net/wfs":{TransactionSummary:but(LAt,"transactionSummary"),InsertResults:but(kAt,"insertIds")},"http://www.opengis.net/wfs/2.0":{TransactionSummary:but(LAt,"transactionSummary"),InsertResults:but(kAt,"insertIds")}},wAt={"http://www.opengis.net/wfs":{PropertyName:xut(Wut)},"http://www.opengis.net/wfs/2.0":{PropertyName:xut(Wut)}},bAt={"http://www.opengis.net/wfs":{Insert:xut(UAt),Update:xut(jAt),Delete:xut(QAt),Property:xut(HAt),Native:xut(zAt)},"http://www.opengis.net/wfs/2.0":{Insert:xut(UAt),Update:xut(jAt),Delete:xut(QAt),Property:xut(HAt),Native:xut(zAt)}},xAt="feature",EAt="http://www.w3.org/2000/xmlns/",CAt={"2.0.0":"http://www.opengis.net/ogc/1.1","1.1.0":"http://www.opengis.net/ogc","1.0.0":"http://www.opengis.net/ogc"},SAt={"2.0.0":"http://www.opengis.net/wfs/2.0","1.1.0":"http://www.opengis.net/wfs","1.0.0":"http://www.opengis.net/wfs"},BAt={"2.0.0":"http://www.opengis.net/fes/2.0","1.1.0":"http://www.opengis.net/fes","1.0.0":"http://www.opengis.net/fes"},IAt={"2.0.0":"http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd","1.1.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd","1.0.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd"},PAt={"2.0.0":uAt,"1.1.0":iht,"1.0.0":$ut},TAt="1.1.0",FAt=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.version_=n.version?n.version:TAt,r.featureType_=n.featureType,r.featureNS_=n.featureNS,r.gmlFormat_=n.gmlFormat?n.gmlFormat:new PAt[r.version_],r.schemaLocation_=n.schemaLocation?n.schemaLocation:IAt[r.version_],r}return yAt(e,t),e.prototype.getFeatureType=function(){return this.featureType_},e.prototype.setFeatureType=function(t){this.featureType_=t},e.prototype.readFeaturesFromNode=function(t,e){var r={node:t};b(r,{featureType:this.featureType_,featureNS:this.featureNS_}),b(r,this.getReadOptions(t,e||{}));var n=[r],i=Put([],"2.0.0"===this.version_?mAt:this.gmlFormat_.FEATURE_COLLECTION_PARSERS,t,n,this.gmlFormat_);return i||(i=[]),i},e.prototype.readTransactionResponse=function(t){if(t){if("string"==typeof t){var e=mut(t);return this.readTransactionResponseFromDocument(e)}return yut(t)?this.readTransactionResponseFromDocument(t):this.readTransactionResponseFromNode(t)}},e.prototype.readFeatureCollectionMetadata=function(t){if(t){if("string"==typeof t){var e=mut(t);return this.readFeatureCollectionMetadataFromDocument(e)}return yut(t)?this.readFeatureCollectionMetadataFromDocument(t):this.readFeatureCollectionMetadataFromNode(t)}},e.prototype.readFeatureCollectionMetadataFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readFeatureCollectionMetadataFromNode(e)},e.prototype.readFeatureCollectionMetadataFromNode=function(t){var e={},r=zut(t.getAttribute("numberOfFeatures"));return e.numberOfFeatures=r,Put(e,mAt,t,[],this.gmlFormat_)},e.prototype.readTransactionResponseFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readTransactionResponseFromNode(e)},e.prototype.readTransactionResponseFromNode=function(t){return Put({},_At,t,[])},e.prototype.writeGetFeature=function(t){var e=this,r=put(SAt[this.version_],"GetFeature");r.setAttribute("service","WFS"),r.setAttribute("version",this.version_),t.handle&&r.setAttribute("handle",t.handle),t.outputFormat&&r.setAttribute("outputFormat",t.outputFormat),void 0!==t.maxFeatures&&r.setAttribute("maxFeatures",String(t.maxFeatures)),t.resultType&&r.setAttribute("resultType",t.resultType),void 0!==t.startIndex&&r.setAttribute("startIndex",String(t.startIndex)),void 0!==t.count&&r.setAttribute("count",String(t.count)),void 0!==t.viewParams&&r.setAttribute("viewParams",t.viewParams),r.setAttributeNS(fut,"xsi:schemaLocation",this.schemaLocation_);var n={node:r};if(b(n,{version:this.version_,srsName:t.srsName,featureNS:t.featureNS?t.featureNS:this.featureNS_,featurePrefix:t.featurePrefix,propertyNames:t.propertyNames?t.propertyNames:[]}),K(Array.isArray(t.featureTypes),11),"string"==typeof t.featureTypes[0]){var i=t.filter;t.bbox&&(K(t.geometryName,12),i=this.combineBboxAndFilter(t.geometryName,t.bbox,t.srsName,i)),b(n,{geometryName:t.geometryName,filter:i}),aft(r,t.featureTypes,[n])}else t.featureTypes.forEach((function(i){var o=e.combineBboxAndFilter(i.geometryName,i.bbox,t.srsName,t.filter);b(n,{geometryName:i.geometryName,filter:o}),aft(r,[i.name],[n])}));return r},e.prototype.combineBboxAndFilter=function(t,e,r,n){var i=function(t,e,r){return new gAt(t,e,r)}(t,e,r);return n?function(t){var e=[null].concat(Array.prototype.slice.call(arguments));return new(Function.prototype.bind.apply(pAt,e))}(n,i):i},e.prototype.writeTransaction=function(t,e,r,n){var i,o=[],s=n.version?n.version:this.version_,a=put(SAt[s],"Transaction");a.setAttribute("service","WFS"),a.setAttribute("version",s),n&&(i=n.gmlOptions?n.gmlOptions:{},n.handle&&a.setAttribute("handle",n.handle)),a.setAttributeNS(fut,"xsi:schemaLocation",IAt[s]);var l=function(t,e,r,n){var i,o=n.featurePrefix?n.featurePrefix:xAt;return"1.0.0"===r?i=2:"1.1.0"===r?i=3:"2.0.0"===r&&(i=3.2),b({node:t},{version:r,featureNS:n.featureNS,featureType:n.featureType,featurePrefix:o,gmlVersion:i,hasZ:n.hasZ,srsName:n.srsName},e)}(a,i,s,n);return t&&MAt("Insert",t,o,l),e&&MAt("Update",e,o,l),r&&MAt("Delete",r,o,l),n.nativeElements&&MAt("Native",n.nativeElements,o,l),a},e.prototype.readProjectionFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readProjectionFromNode(e);return null},e.prototype.readProjectionFromNode=function(t){if(t.firstElementChild&&t.firstElementChild.firstElementChild)for(var e=(t=t.firstElementChild.firstElementChild).firstElementChild;e;e=e.nextElementSibling)if(0!==e.childNodes.length&&(1!==e.childNodes.length||3!==e.firstChild.nodeType)){var r=[{}];return this.gmlFormat_.readGeometryElement(e,r),nr(r.pop().srsName)}return null},e}(Nut);function MAt(t,e,r,n){Tut(n,bAt,Eut(t),e,r)}function LAt(t,e){return Put({},vAt,t,e)}var OAt={"http://www.opengis.net/ogc":{FeatureId:_ut((function(t,e){return t.getAttribute("fid")}))},"http://www.opengis.net/ogc/1.1":{FeatureId:_ut((function(t,e){return t.getAttribute("fid")}))}};function NAt(t,e){Iut(OAt,t,e)}var RAt={"http://www.opengis.net/wfs":{Feature:NAt},"http://www.opengis.net/wfs/2.0":{Feature:NAt}};function kAt(t,e){return Put([],RAt,t,e)}function UAt(t,e,r){var n=r[r.length-1],i=n.featureType,o=n.featureNS,s=n.gmlVersion,a=put(o,i);t.appendChild(a),2===s?$ut.prototype.writeFeatureElement(a,e,r):3===s?iht.prototype.writeFeatureElement(a,e,r):uAt.prototype.writeFeatureElement(a,e,r)}function DAt(t,e,r){var n=r[r.length-1].version,i=CAt[n],o=put(i,"Filter"),s=put(i,"FeatureId");o.appendChild(s),s.setAttribute("fid",e),t.appendChild(o)}function GAt(t,e){var r=(t=t||xAt)+":";return 0===e.indexOf(r)?e:r+e}function QAt(t,e,r){var n=r[r.length-1];K(void 0!==e.getId(),26);var i=n.featureType,o=n.featurePrefix,s=n.featureNS,a=GAt(o,i);t.setAttribute("typeName",a),t.setAttributeNS(EAt,"xmlns:"+o,s);var l=e.getId();void 0!==l&&DAt(t,l,r)}function jAt(t,e,r){var n=r[r.length-1];K(void 0!==e.getId(),27);var i=n.version,o=n.featureType,s=n.featurePrefix,a=n.featureNS,l=GAt(s,o),u=e.getGeometryName();t.setAttribute("typeName",l),t.setAttributeNS(EAt,"xmlns:"+s,a);var h=e.getId();if(void 0!==h){for(var c=e.getKeys(),A=[],f=0,p=c.length;f<p;f++){var d=e.get(c[f]);if(void 0!==d){var g=c[f];d&&"function"==typeof d.getSimplifiedGeometry&&(g=u),A.push({name:g,value:d})}}Tut({version:i,gmlVersion:n.gmlVersion,node:t,hasZ:n.hasZ,srsName:n.srsName},bAt,Eut("Property"),A,r),DAt(t,h,r)}}function HAt(t,e,r){var n=r[r.length-1],i=n.version,o=SAt[i],s=put(o,"Name"),a=n.gmlVersion;if(t.appendChild(s),Wut(s,e.name),void 0!==e.value&&null!==e.value){var l=put(o,"Value");t.appendChild(l),e.value&&"function"==typeof e.value.getSimplifiedGeometry?2===a?$ut.prototype.writeGeometryElement(l,e.value,r):3===a?iht.prototype.writeGeometryElement(l,e.value,r):uAt.prototype.writeGeometryElement(l,e.value,r):Wut(l,e.value)}}function zAt(t,e,r){e.vendorId&&t.setAttribute("vendorId",e.vendorId),void 0!==e.safeToIgnore&&t.setAttribute("safeToIgnore",String(e.safeToIgnore)),void 0!==e.value&&Wut(t,e.value)}var VAt={"http://www.opengis.net/wfs":{Query:xut(KAt)},"http://www.opengis.net/wfs/2.0":{Query:xut(KAt)},"http://www.opengis.net/ogc":{During:xut(YAt),And:xut(ZAt),Or:xut(ZAt),Not:xut(JAt),BBOX:xut(qAt),Contains:xut(WAt),Intersects:xut(WAt),Within:xut(WAt),DWithin:xut(XAt),PropertyIsEqualTo:xut($At),PropertyIsNotEqualTo:xut($At),PropertyIsLessThan:xut($At),PropertyIsLessThanOrEqualTo:xut($At),PropertyIsGreaterThan:xut($At),PropertyIsGreaterThanOrEqualTo:xut($At),PropertyIsNull:xut(tft),PropertyIsBetween:xut(eft),PropertyIsLike:xut(rft)},"http://www.opengis.net/fes/2.0":{During:xut(YAt),And:xut(ZAt),Or:xut(ZAt),Not:xut(JAt),BBOX:xut(qAt),Contains:xut(WAt),Disjoint:xut(WAt),Intersects:xut(WAt),ResourceId:xut((function(t,e,r){t.setAttribute("rid",e.rid)})),Within:xut(WAt),DWithin:xut(XAt),PropertyIsEqualTo:xut($At),PropertyIsNotEqualTo:xut($At),PropertyIsLessThan:xut($At),PropertyIsLessThanOrEqualTo:xut($At),PropertyIsGreaterThan:xut($At),PropertyIsGreaterThanOrEqualTo:xut($At),PropertyIsNull:xut(tft),PropertyIsBetween:xut(eft),PropertyIsLike:xut(rft)}};function KAt(t,e,r){var n,i,o=r[r.length-1],s=o.version,a=o.featurePrefix,l=o.featureNS,u=o.propertyNames,h=o.srsName;n=a?GAt(a,e):e,i="2.0.0"===s?"typeNames":"typeName",t.setAttribute(i,n),h&&t.setAttribute("srsName",h),l&&t.setAttributeNS(EAt,"xmlns:"+a,l);var c=b({},o);c.node=t,Tut(c,wAt,Eut("PropertyName"),u,r);var A=o.filter;if(A){var f=put(lft(s),"Filter");t.appendChild(f),function(t,e,r){var n=r[r.length-1],i={node:t};b(i,{context:n}),Tut(i,VAt,Eut(e.getTagName()),[e],r)}(f,A,r)}}function qAt(t,e,r){var n=r[r.length-1],i=n.context.version;n.srsName=e.srsName;var o=PAt[i];oft(i,t,e.geometryName),o.prototype.writeGeometryElement(t,e.extent,r)}function WAt(t,e,r){var n=r[r.length-1],i=n.context.version;n.srsName=e.srsName;var o=PAt[i];oft(i,t,e.geometryName),o.prototype.writeGeometryElement(t,e.geometry,r)}function XAt(t,e,r){var n=r[r.length-1].context.version;WAt(t,e,r);var i=put(lft(n),"Distance");Wut(i,e.distance.toString()),"2.0.0"===n?i.setAttribute("uom",e.unit):i.setAttribute("units",e.unit),t.appendChild(i)}function YAt(t,e,r){var n=r[r.length-1].context.version;nft(BAt[n],"ValueReference",t,e.propertyName);var i=put(kut,"TimePeriod");t.appendChild(i);var o=put(kut,"begin");i.appendChild(o),sft(o,e.begin);var s=put(kut,"end");i.appendChild(s),sft(s,e.end)}function ZAt(t,e,r){var n=r[r.length-1].context,i={node:t};b(i,{context:n});for(var o=e.conditions,s=0,a=o.length;s<a;++s){var l=o[s];Tut(i,VAt,Eut(l.getTagName()),[l],r)}}function JAt(t,e,r){var n=r[r.length-1].context,i={node:t};b(i,{context:n});var o=e.condition;Tut(i,VAt,Eut(o.getTagName()),[o],r)}function $At(t,e,r){var n=r[r.length-1].context.version;void 0!==e.matchCase&&t.setAttribute("matchCase",e.matchCase.toString()),oft(n,t,e.propertyName),ift(n,t,""+e.expression)}function tft(t,e,r){oft(r[r.length-1].context.version,t,e.propertyName)}function eft(t,e,r){var n=r[r.length-1].context.version,i=lft(n);oft(n,t,e.propertyName);var o=put(i,"LowerBoundary");t.appendChild(o),ift(n,o,""+e.lowerBoundary);var s=put(i,"UpperBoundary");t.appendChild(s),ift(n,s,""+e.upperBoundary)}function rft(t,e,r){var n=r[r.length-1].context.version;t.setAttribute("wildCard",e.wildCard),t.setAttribute("singleChar",e.singleChar),t.setAttribute("escapeChar",e.escapeChar),void 0!==e.matchCase&&t.setAttribute("matchCase",e.matchCase.toString()),oft(n,t,e.propertyName),ift(n,t,""+e.pattern)}function nft(t,e,r,n){var i=put(t,e);Wut(i,n),r.appendChild(i)}function ift(t,e,r){nft(lft(t),"Literal",e,r)}function oft(t,e,r){"2.0.0"===t?nft(BAt[t],"ValueReference",e,r):nft(CAt[t],"PropertyName",e,r)}function sft(t,e){var r=put(kut,"TimeInstant");t.appendChild(r);var n=put(kut,"timePosition");r.appendChild(n),Wut(n,e)}function aft(t,e,r){var n=r[r.length-1],i=b({},n);i.node=t,Tut(i,VAt,Eut("Query"),e,r)}function lft(t){return"2.0.0"===t?BAt[t]:CAt[t]}const uft=FAt;var hft=function(t){(t=t||{}).displacement||(t.displacement=[t.offsetX||0,-t.offsetY||0]),this.sanchor_="anchored"===t.kind?8:0,this._shadow=Number(t.shadow)||0,t.stroke||(t.stroke=new Rn({width:0,color:"#000"}));var e=t.stroke.getWidth();if(e<0&&(e=0),"folio"==t.kind&&(e+=6),t.stroke.setWidth(e),Oi.call(this,{radius:t.radius+e+this.sanchor_/2+this._shadow/2,points:0,displacement:[t.displacement[0]||0,(t.displacement[1]||0)+this.sanchor_],fill:Oi.prototype.render?new Tn({color:[0,0,0,0]}):null}),!this.getHitDetectionImage){var r=Oi.prototype.getImage.call(this);if(!this.hitDetectionCanvas_)for(var n in this)if(this[n]&&this[n].getContext&&this[n]!==r){this.hitDetectionCanvas_=this[n];break}this.hitDetectionCanvas_=document.createElement("canvas"),this.hitDetectionCanvas_.width=r.width,this.hitDetectionCanvas_.height=r.height;var i=this.hitDetectionCanvas_;this.getHitDetectionImage=function(){return i}}this._stroke=t.stroke,this._fill=t.fill,this._crop=t.crop,this._crossOrigin=t.crossOrigin,this._kind=t.kind||"default",this._radius=t.radius,this._src=t.src,this._offset=[t.offsetX?t.offsetX:0,t.offsetY?t.offsetY:0],this._onload=t.onload,"number"==typeof t.opacity&&this.setOpacity(t.opacity),"number"==typeof t.rotation&&this.setRotation(t.rotation),this.getImage()};Vm(hft,Oi),hft.prototype.setOffset=function(t){this._offset=[t[0]||0,t[1]||0],this.getImage()},hft.prototype.clone=function(){var t=new hft({stroke:this._stroke,fill:this._fill,shadow:this._shadow,crop:this._crop,crossOrigin:this._crossOrigin,kind:this._kind,radius:this._radius,src:this._src,offsetX:this._offset[0],offsetY:this._offset[1],opacity:this.getOpacity(),rotation:this.getRotation()});return t.getImage(),t},CanvasRenderingContext2D.prototype.roundRect=function(t,e,r,n,i){return i?(r<2*i&&(i=r/2),n<2*i&&(i=n/2),this.beginPath(),this.moveTo(t+i,e),this.arcTo(t+r,e,t+r,e+n,i),this.arcTo(t+r,e+n,t,e+n,i),this.arcTo(t,e+n,t,e,i),this.arcTo(t,e,t+r,e,i),this.closePath()):this.rect(t,e,r,n),this},hft.prototype.drawBack_=function(t,e,r,n){var i=this._shadow,o=t.canvas;t.beginPath(),t.fillStyle=e,t.clearRect(0,0,o.width,o.height);var s=o.width/n,a=o.height/n;switch(this._kind){case"square":t.rect(0,0,s-i,a-i);break;case"circle":t.arc(this._radius+r,this._radius+r,this._radius+r,0,2*Math.PI,!1);break;case"folio":r-=6,t.strokeStyle="rgba(0,0,0,0.5)",t.lineWidth=1;var l=s-i-12,u=Math.atan(6/l);t.save(),t.rotate(-u),t.translate(-6,2),t.beginPath(),t.rect(6,6,l,l),t.stroke(),t.fill(),t.restore(),t.save(),t.translate(6,-1),t.rotate(u),t.beginPath(),t.rect(6,6,l,l),t.stroke(),t.fill(),t.restore(),t.beginPath(),t.rect(6,6,l,l),t.stroke();break;case"anchored":t.roundRect(this.sanchor_/2,0,s-this.sanchor_-i,a-this.sanchor_-i,r),t.moveTo(s/2-this.sanchor_-i/2,a-this.sanchor_-i),t.lineTo(s/2+this.sanchor_-i/2,a-this.sanchor_-i),t.lineTo(s/2-i/2,a-i);break;default:t.roundRect(0,0,s-i,a-i,r)}t.closePath()},hft.prototype.getImage=function(t){t=t||1;var e,r=Oi.prototype.getImage.call(this,t);if(this._gethit)return r;var n=0;this._stroke&&(e=Hn(this._stroke.getColor()),n=this._stroke.getWidth()),this._gethit=!0;var i=this.getHitDetectionImage().getContext("2d");i.save(),i.setTransform(1,0,0,1,0,0),this.drawBack_(i,"#000",n,1),i.fill(),i.restore(),this._gethit=!1,(i=r.getContext("2d")).save(),i.setTransform(t,0,0,t,0,0),this.drawBack_(i,e,n,t),this._shadow&&(i.shadowColor="rgba(0,0,0,0.5)",i.shadowBlur=t*this._shadow/2,i.shadowOffsetX=t*this._shadow/2,i.shadowOffsetY=t*this._shadow/2),i.fill(),i.restore();var o=this,s=this.img_=new Image;if(this._crossOrigin&&(s.crossOrigin=this._crossOrigin),s.src=this._src,s.width?o.drawImage_(r,s,t):s.onload=function(){o.drawImage_(r,s,t),o._onload&&o._onload()},!this.getDisplacement){var a=this.getAnchor();a[0]=(r.width/t-this._shadow)/2-this._offset[0],this.sanchor_?a[1]=r.height/t-this._shadow-this._offset[1]:a[1]=(r.height/t-this._shadow)/2-this._offset[1]}return r},hft.prototype.getPhoto=function(){return this.img_},hft.prototype.drawImage_=function(t,e,r){var n=t.getContext("2d"),i=0;this._stroke&&(i=this._stroke.getWidth());var o,s,a,l,u,h,c,A,f,p=2*this._radius;n.save(),Oi.prototype.render&&n.setTransform(r,0,0,r,0,0),"circle"==this._kind&&(n.beginPath(),n.arc(this._radius+i,this._radius+i,this._radius,0,2*Math.PI,!1),n.clip()),this._crop?(A=f=(o=Math.min(e.width/p,e.height/p))*p,h=(e.width-A)/2,c=(e.height-f)/2,s=a=0,l=u=p+1):(h=c=0,s=(p-(l=(o=Math.min(p/e.width,p/e.height))*(A=e.width)))/2,a=(p-(u=o*(f=e.height)))/2),s+=i+this.sanchor_/2,a+=i,n.drawImage(e,h,c,A,f,s,a,l,u),"circle"==this._kind&&i&&(n.beginPath(),n.strokeStyle=Hn(this._stroke.getColor()),n.lineWidth=i/4,n.arc(this._radius+i,this._radius+i,this._radius,0,2*Math.PI,!1),n.stroke()),n.restore()};var cft=function(t){t=t||{},this.duration_="number"==typeof t.duration?t.duration>=0?t.duration:0:1e3,this.fade_="function"==typeof t.fade?t.fade:null,this.repeat_=Number(t.repeat);var e="function"==typeof t.easing?t.easing:va;t.revers?this.easing_=function(t){return 1-e(t)}:this.easing_=e,this.hiddenStyle=t.hiddenStyle,D.call(this)};Vm(cft,D),cft.hiddenStyle=new ji({image:new Ri({}),stroke:new Rn({color:"transparent"})}),cft.prototype.drawGeom_=function(t,e,r){this.fade_&&(t.context.globalAlpha=this.fade_(1-t.elapsed));for(var n=t.style,i=0;i<n.length;i++)try{var o=t.vectorContext||Zlt(t),s=$lt(t,n[i]);o.setStyle(s),s.getZIndex()<0?o.drawGeometry(r||e):o.drawGeometry(e)}catch(a){}},cft.prototype.animate=function(){return!1},Uh.prototype.animateFeature=function(t,e){var r=this._featureAnimationLayer;r||(r=this._featureAnimationLayer=new Zs({source:new Aa})).setMap(this),r.getSource().addFeature(t);var n=e.on("animationend",(function(e){e.feature===t&&(r.getSource().removeFeature(t),N(n))}));r.animateFeature(t,e)},Wi.prototype.animateFeature=function(t,e,r){var n,i=this,o=t.getStyle(),s=o||(this.getStyleFunction?this.getStyleFunction()(t):null);s||(s=[]),s instanceof Array||(s=[s]);var a={vectorContext:null,frameState:null,start:0,time:0,elapsed:0,extent:!1,feature:t,geom:t.getGeometry(),typeGeom:t.getGeometry().getType(),bbox:t.getGeometry().getExtent(),coord:Vt(t.getGeometry().getExtent()),style:s};e instanceof Array||(e=[e]);for(var l=e.length-1;l>=0;l--)0===e[l].duration_&&e.splice(l,1);var u=0,h=0,c=r&&this.getFilters?this.getFilters():[];function A(r){a.type=r.type;try{a.vectorContext=r.vectorContext||Zlt(r)}catch(o){}if(a.frameState=r.frameState,a.inversePixelTransform=r.inversePixelTransform,a.extent||(a.extent=r.frameState.extent,a.start=r.frameState.time,a.context=r.context),a.time=r.frameState.time-a.start,a.elapsed=a.time/e[h].duration_,a.elapsed>1&&(a.elapsed=1),r.context.save(),c.forEach((function(t){t.get("active")&&t.precompose(r)})),this.getOpacity&&(r.context.globalAlpha=this.getOpacity()),e[h].animate(a)){var n={type:"animating",step:h,start:a.start,time:a.time,elapsed:a.elapsed,rotation:a.rotation||0,geom:a.geom,coordinate:a.coord,feature:t};e[h].dispatchEvent(n),i.dispatchEvent(n)}else++u<e[h].repeat_?a.extent=!1:h<e.length-1?(e[h].dispatchEvent({type:"animationend",feature:t}),h++,u=0,a.extent=!1):f();c.forEach((function(t){t.get("active")&&t.postcompose(r)})),r.context.restore(),r.frameState.animate=!0}function f(r){N(n),n=null,t.setStyle(o);var s={type:"animationend",feature:t};if(r)for(var a in r)r.hasOwnProperty(a)&&(s[a]=r[a]);e[h].dispatchEvent(s),i.dispatchEvent(s)}function p(r){if(e.length&&!n){if(n=i.on(["postcompose","postrender"],A.bind(i)),i.renderSync)try{i.renderSync()}catch(dX){}else i.changed();t.setStyle(e[h].hiddenStyle||cft.hiddenStyle);var o={type:"animationstart",feature:t};if(r)for(var s in r)r.hasOwnProperty(s)&&(o[s]=r[s]);e[h].dispatchEvent(o),i.dispatchEvent(o)}}return p(),{start:p,stop:f,isPlaying:function(){return!!n}}};var Aft=function(t){t=t||{},cft.call(this,t),this.amplitude_=t.amplitude||40,this.bounce_=-Math.PI*(t.bounce||3)};Vm(Aft,cft),Aft.prototype.animate=function(t){var e=t.geom.clone(),r=Math.abs(Math.sin(this.bounce_*t.elapsed))*this.amplitude_*(1-this.easing_(t.elapsed))*t.frameState.viewState.resolution;return e.translate(0,r),this.drawGeom_(t,e,t.geom),t.time<=this.duration_};var fft=function(t){cft.call(this,t),this.set("nb",t.nb||10)};Vm(fft,cft),fft.prototype.animate=function(t){return Math.round(this.easing_(t.elapsed)*this.get("nb"))%2||this.drawGeom_(t,t.geom),t.time<=this.duration_};var pft=function(t){t=t||{},this.speed_=t.speed||0,cft.call(this,t),this.side_=t.side||"top"};Vm(pft,cft),pft.prototype.animate=function(t){if(!t.time){var e=t.frameState.viewState.rotation,r=t.frameState.size[1]*t.frameState.viewState.resolution;"top"!=this.side_&&(r*=-1),this.dx=-Math.sin(e)*r,this.dy=Math.cos(e)*r,this.speed_&&(this.duration_=r/this.speed_/t.frameState.viewState.resolution)}var n=t.geom.clone();return n.translate(this.dx*(1-this.easing_(t.elapsed)),this.dy*(1-this.easing_(t.elapsed))),this.drawGeom_(t,n,t.geom),t.time<=this.duration_};var dft=function(t){t=t||{},this.speed_=t.speed||0,cft.call(this,t)};Vm(dft,cft),dft.prototype.animate=function(t){return t.context.globalAlpha=this.easing_(t.elapsed),this.drawGeom_(t,t.geom),t.time<=this.duration_};var gft=function(t){switch(t=t||{},cft.call(this,t),this.speed_=t.speed||0,this.path_=t.path,t.rotate){case!0:case 0:this.rotate_=0;break;default:this.rotate_=t.rotate||!1}this.path_&&this.path_.getGeometry&&(this.path_=this.path_.getGeometry()),this.path_&&this.path_.getLineString&&(this.path_=this.path_.getLineString()),this.path_.getLength?(this.dist_=this.path_.getLength(),this.path_&&this.path_.getCoordinates&&(this.path_=this.path_.getCoordinates())):this.dist_=0,this.speed_>0&&(this.duration_=this.dist_/this.speed_)};Vm(gft,cft),gft.prototype.animate=function(t){if(!t.time&&!this.dist_)return!1;var e,r,n,i,o,s,a=this.dist_*this.easing_(t.elapsed),l=0;r=this.path_[0];for(var u=1;u<this.path_.length;u++){if(e=r,i=(r=this.path_[u])[0]-e[0],o=r[1]-e[1],(s=Math.sqrt(i*i+o*o))&&l+s>=a){n=(a-l)/s,r=[e[0]+(r[0]-e[0])*n,e[1]+(r[1]-e[1])*n];break}l+=s}var h=t.style;if(t.rotation=Math.PI/2+Math.atan2(e[1]-r[1],e[0]-r[0]),!1!==this.rotate_){var c=[],A=this.rotate_-t.rotation+t.frameState.viewState.rotation;t.rotation=Math.PI/2+Math.atan2(e[1]-r[1],e[0]-r[0]);for(var f=0;n=t.style[f];f++)n.getImage()&&n.getImage().setRotation(A),c.push(n);t.style=c}return t.geom.setCoordinates(r),this.drawGeom_(t,t.geom),t.style=h,t.time<=this.duration_};var yft=function(t){t=t||{},cft.call(this,t),this.amplitude_=t.amplitude||40,this.bounce_=-Math.PI*(t.bounce||6),this.horizontal_=t.horizontal};Vm(yft,cft),yft.prototype.animate=function(t){var e=t.geom.clone(),r=t.geom.clone(),n=this.easing_(t.elapsed);return n=Math.sin(this.bounce_*n)*this.amplitude_*(1-n)*t.frameState.viewState.resolution,this.horizontal_?(e.translate(n,0),r.translate(n,0)):e.translate(0,n),this.drawGeom_(t,e,r),t.time<=this.duration_};var mft=function(t){cft.call(this,t)};Vm(mft,cft),mft.prototype.animate=function(t){return this.drawGeom_(t,t.geom),t.time<=this.duration_};var vft=function(t){t=t||{},this.speed_=t.speed||0,cft.call(this,t),this.side_=t.side||"left"};Vm(vft,cft),vft.prototype.animate=function(t){t.time||("left"==this.side_?this.dx=t.extent[0]-t.bbox[2]:this.dx=t.extent[2]-t.bbox[0],this.speed_&&(this.duration_=Math.abs(this.dx)/this.speed_/t.frameState.viewState.resolution));var e=t.geom.clone();return e.translate(this.dx*(1-this.easing_(t.elapsed)),0),this.drawGeom_(t,e),t.time<=this.duration_};var _ft=function(t){cft.call(this,t)};Vm(_ft,cft),_ft.prototype.animate=function(t){var e=this.easing_(t.elapsed);if(e){t.context.save();var r=t.frameState.pixelRatio;t.context.globalAlpha=e,t.context.scale(e,1/e);var n=t.frameState.coordinateToPixelTransform,i=(1/e-1)*r*(n[0]*t.coord[0]+n[1]*t.coord[1]+n[4]),o=(e-1)*r*(n[2]*t.coord[0]+n[3]*t.coord[1]+n[5]);t.context.translate(i,o),this.drawGeom_(t,t.geom),t.context.restore()}return t.time<=this.duration_};var wft=function(t){t=t||{},cft.call(this,t),this.speed_=t.speed||0,this.side_=t.side||"left"};Vm(wft,cft),wft.prototype.animate=function(t){var e,r;!t.time&&this.speed_&&("left"==this.side_?(e=this.dx=t.extent[0]-t.bbox[2],r=this.dy=t.extent[3]-t.bbox[1]):(e=this.dx=t.extent[2]-t.bbox[0],r=this.dy=t.extent[3]-t.bbox[1]),this.duration_=Math.sqrt(e*e+r*r)/this.speed_/t.frameState.viewState.resolution);var n=t.geom.clone(),i=t.geom.clone();return n.translate(this.dx*(1-this.easing_(t.elapsed)),this.dy*Math.cos(Math.PI/2*this.easing_(t.elapsed))),i.translate(this.dx*(1-this.easing_(t.elapsed)),0),this.drawGeom_(t,n,i),t.time<=this.duration_};var bft=function(t){t=t||{},cft.call(this,t),this.set("zoomout",t.zoomOut)};Vm(bft,cft),Vm((function(t){(t=t||{}).zoomOut=!0,bft.call(this,t)}),bft),bft.prototype.animate=function(t){var e=this.easing_(t.elapsed);if(e){this.get("zoomout")&&(e=1/e);var r,n,i=t.style,o=[];for(r=0;r<i.length;r++)(n=i[r].getImage())&&(o[r]=n.getScale(),"postrender"===t.type?n.setScale(o[r]*e/t.frameState.pixelRatio):n.setScale(o[r]*e));for(this.drawGeom_(t,t.geom),r=0;r<i.length;r++)(n=i[r].getImage())&&n.setScale(o[r])}return t.time<=this.duration_};var xft=function(t){(t=t||{}).loader=this._loader,t.strategy=ia,Aa.call(this,t),this.set("time",t.time||new Date),this.set("step",t.step||1)};Vm(xft,Aa),function(){function t(t){var e=Math.PI/180,r=t-2451545,n=280.46+.9856474*r,i=357.528+.9856003*r;return i%=360,{lambda:(n%=360)+1.915*Math.sin(i*e)+.02*Math.sin(2*i*e),R:1.00014-.01671*Math.cos(i*e)-.0014*Math.cos(2*i*e)}}function e(t){var e=(t-2451545)/36525;return 23.43929111-e*(46.836769/3600-e*(1831e-7/3600+e*(5.565e-7-e*(1.6e-10-4.34e-8*e/3600))))}function r(t,e){var r=180/Math.PI,n=Math.PI/180,i=Math.atan(Math.cos(e*n)*Math.tan(t*n))*r,o=Math.asin(Math.sin(e*n)*Math.sin(t*n))*r;return{alpha:i+=90*Math.floor(t/90)-90*Math.floor(i/90),delta:o}}xft.prototype._loader=function(t,e,r){var n=this.getCoordinates(this.get("time")),i=new bn([n]);i.transform("EPSG:4326",r),this.addFeature(new X(i))},xft.prototype.setTime=function(t){this.set("time",t),this.refresh()},xft.prototype.getSunPosition=function(n){var i=(n?new Date(n):new Date)/864e5+2440587.5,o=(18.697374558+24.06570982441908*(i-2451545))%24,s=t(i),a=e(i),l=r(s.lambda,a);return[l.alpha-15*o,l.delta]},xft.getNightLat=function(n,i){var o=180/Math.PI,s=Math.PI/180,a=(i?new Date(i):new Date)/864e5+2440587.5,l=(18.697374558+24.06570982441908*(a-2451545))%24,u=t(a),h=e(a),c=r(u.lambda,h),A=15*l+n-c.alpha;return Math.atan(-Math.cos(A*s)/Math.tan(c.delta*s))*o},xft.prototype.getCoordinates=function(n,i){for(var o=180/Math.PI,s=Math.PI/180,a=(n?new Date(n):new Date)/864e5+2440587.5,l=(18.697374558+24.06570982441908*(a-2451545))%24,u=[],h=t(a),c=e(a),A=r(h.lambda,c),f=this.get("step")||1,p=-180;p<=180;p+=f){var d=p,g=15*l+d-A.alpha,y=Math.atan(-Math.cos(g*s)/Math.tan(A.delta*s))*o;u.push([d,y])}switch(i){case"line":break;case"day":A.delta*=-1;default:y=A.delta<0?90:-90;for(var m=180;m>=-180;m-=f)u.push([m,y]);u.push(u[0])}if("daynight"===i){var v=[];u.forEach((function(t){v.push(t.slice())})),v[0][1]=-v[0][1],v[v.length-1][1]=-v[0][1],v[v.length-1][1]=-v[0][1],u=[u,v]}return u}}();var Eft=function(t){t=t||{},this.source=t.source,this.nodes=new Aa,this.maxIteration=t.maxIteration||2e4,this.stepIteration=t.stepIteration||2e3,this.astar=!0,this.candidat=[],D.call(this),this.set("epsilon",t.epsilon||1e-6)};Vm(Eft,D),Eft.prototype.weight=function(){return 1},Eft.prototype.direction=function(){return 2},Eft.prototype.getLength=function(t){return t.getGeometry&&(t=t.getGeometry()),t.getLength()},Eft.prototype.getNodeSource=function(){return this.nodes},Eft.prototype.getEdges=function(t){var e=Ct(Et([t]),this.get("epsilon")),r=[];return this.source.forEachFeatureIntersectingExtent(e,(function(t){r.push(t)})),r},Eft.prototype.getNode=function(t){var e=Ct(Et([t]),this.get("epsilon")),r=[];return this.nodes.forEachFeatureIntersectingExtent(e,(function(t){r.push(t)})),r[0]},Eft.prototype.addNode=function(t,e,r,n,i){if(this.wdist&&e>this.wdist)return!1;var o=this.getNode(t),s=e+this.getLength(new Nn([this.end,t]))*this.weight();if(this.astar&&this.wdist&&s>this.wdist)return!1;if(o){if(o!==this.arrival&&o.get("wdist")<=e)return o;o.set("dist",r),o.set("wdist",e),o.set("dtotal",s),o.set("from",n),o.set("prev",i),o===this.arrival&&(this.wdist=e),this.candidat.push(o)}else o=new X({geometry:new nn(t),from:n,prev:i,dist:r||0,wdist:e,dtotal:s}),e<0?o.set("wdist",!1):this.candidat.push(o),this.nodes.addFeature(o);return o},Eft.prototype.closestCoordinate=function(t){var e=this.source.getClosestFeatureToCoordinate(t),r=e.getGeometry().getFirstCoordinate(),n=e.getGeometry().getLastCoordinate();return qlt(t,r)<qlt(t,n)?r:n},Eft.prototype.path=function(t,e){if(this.running)return!1;if(t=this.closestCoordinate(t),this.end=this.closestCoordinate(e),t[0]===this.end[0]&&t[1]===this.end[1])return this.dispatchEvent({type:"finish",route:[],wDistance:-1,distance:this.wdist}),!1;var r=this;return this.nodes.clear(),this.candidat=[],this.wdist=0,this.running=!0,this.addNode(t,0),this.arrival=this.addNode(this.end,-1),this.nb=0,this.dispatchEvent({type:"start"}),setTimeout((function(){r._resume()})),[t,this.end]},Eft.prototype.resume=function(){this.running||this.candidat.length&&(this.running=!0,this.nb=0,this._resume())},Eft.prototype.pause=function(){this.running&&(this.nb=-1)},Eft.prototype.getBestWay=function(){for(var t,e,r=-1,n=0;e=this.candidat[n];n++)e.get("wdist")>r&&(t=e,r=e.get("wdist"));return this.getRoute(t)},Eft.prototype._resume=function(){if(this.running){for(;this.candidat.length;){this.candidat.sort((function(t,e){return t.get("dtotal")<e.get("dtotal")?1:t.get("dtotal")===e.get("dtotal")?0:-1}));for(var t,e=this.candidat.pop(),r=e.getGeometry().getCoordinates(),n=this.getEdges(r),i=0;t=n[i];i++){if(e.get("from")!==t){var o=this.getLength(t),s=e.get("wdist")+o*this.weight(t);o=e.get("dist")+o;var a=t.getGeometry().getFirstCoordinate(),l=t.getGeometry().getLastCoordinate(),u=this.direction(t);0!==u&&(r[0]===a[0]&&r[1]===a[1]&&-1!==u&&this.addNode(l,s,o,t,e),r[0]===l[0]&&r[0]===l[0]&&1!==u&&this.addNode(a,s,o,t,e))}if(-1===this.nb||this.nb++>this.maxIteration)return this.running=!1,void this.dispatchEvent({type:"pause",overflow:-1!==this.nb});if(!(this.nb%this.stepIteration)){var h=this;return window.setTimeout((function(){h._resume()}),5),void this.dispatchEvent({type:"calculating"})}}}this.nodes.clear(),this.running=!1,this.dispatchEvent({type:"finish",route:this.getRoute(this.arrival),wDistance:this.wdist,distance:this.arrival.get("dist")})}},Eft.prototype.getRoute=function(t){for(var e=[];t;)e.unshift(t.get("from")),t=t.get("prev");return e.shift(),e};var Cft=Vv,Sft=function(t,e){return[Math.round(t[0]/e)*e,Math.round(t[1]/e)*e]},Bft=$c(N_),Ift=Sft;function Pft(t,e,r){return"FeatureCollection"===t.type?t.features.reduce((function(t,r){return Pft(r,e,t)}),r):e(r,t)}function Tft(t){return"LineString"===t.geometry.type}var Fft={compactNode:Mft,compactGraph:function(t,e,r,n){var i=(n=n||{}).progress,o=Object.keys(t).reduce((function(e,r,o,s){var a=t[r],l=Object.keys(a),u=l.length;return!(void 0!==n.compact&&!n.compact)&&(1===u?!t[l[0]][r]:2===u&&l.filter((function(e){return t[e][r]})).length===u)||(e[r]=a),o%1e3==0&&i&&i("compact:ends",o,s.length),e}),{});return Object.keys(o).reduce((function(s,a,l,u){var h=Mft(a,t,o,e,r,!1,n);return s.graph[a]=h.edges,s.coordinates[a]=h.coordinates,n.edgeDataReduceFn&&(s.reducedEdges[a]=h.reducedEdges),l%1e3==0&&i&&i("compact:nodes",l,u.length),s}),{graph:{},coordinates:{},reducedEdges:{}})}};function Mft(t,e,r,n,i,o,s){s=s||{};var a=e[t];return Object.keys(a).reduce((function(a,l){var u=function(t,e,r,n,i,o,s,a){var l=r[t][e],u=r[e][t],h=[],c=[],A=a.edgeDataSeed;for(a.edgeDataReduceFn&&(A=a.edgeDataReduceFn(A,o[e][t]));!n[e];){var f=r[e];if(!f)break;var p=Object.keys(f).filter((function(e){return e!==t}))[0];if(l+=f[p],s){if(u+=r[p][e],c.indexOf(e)>=0){n[e]=r[e];break}c.push(e)}a.edgeDataReduceFn&&(A=a.edgeDataReduceFn(A,o[e][p])),h.push(i[e]),t=e,e=p}return{vertex:e,weight:l,reverseWeight:u,coordinates:h,reducedEdge:A}}(t,l,e,r,n,i,o,s),h=u.weight,c=u.reverseWeight;if(u.vertex!==t&&((!a.edges[u.vertex]||a.edges[u.vertex]>h)&&(a.edges[u.vertex]=h,a.coordinates[u.vertex]=[n[t]].concat(u.coordinates),a.reducedEdges[u.vertex]=u.reducedEdge),o&&!isNaN(c)&&(!a.incomingEdges[u.vertex]||a.incomingEdges[u.vertex]>c))){a.incomingEdges[u.vertex]=c;var A=[n[t]].concat(u.coordinates);A.reverse(),a.incomingCoordinates[u.vertex]=A}return a}),{edges:{},incomingEdges:{},coordinates:{},incomingCoordinates:{},reducedEdges:{}})}var Lft=function(t,e){var r=(e=e||{}).keyFn||function(t){return t.join(",")},n=e.precision||1e-5,i=function(t,e){var r=[];return"FeatureCollection"===t.type&&(r=r.concat(t.features.filter(e))),{type:"FeatureCollection",features:r}}(t,Tft),o=Bft(i).features.reduce((function(t,i,o,s){var a=Ift(i.geometry.coordinates,n);return t[r(a)]=i.geometry.coordinates,o%1e3==0&&e.progress&&e.progress("topo:vertices",o,s.length),t}),{}),s=Pft(i,(function(t,i,o,s){return i.geometry.coordinates.forEach((function(e,o,s){if(o>0){var a=r(Ift(s[o-1],n)),l=r(Ift(e,n));t.push([a,l,i.properties])}})),o%1e3==0&&e.progress&&e.progress("topo:edges",o,s.length),t}),[]);return{vertices:o,edges:s}},Oft=Fft,Nft=$c(Xv).default,{point:Rft}=D_,kft=function(t,e){var r,n=(e=e||{}).weightFn||function(t,e){return Nft(Rft(t),Rft(e))};"FeatureCollection"===t.type?r=Lft(t,e):t.edges&&(r=t),t=r.edges.reduce((function(t,i,o,s){var a=i[0],l=i[1],u=i[2],h=n(r.vertices[a],r.vertices[l],u),c=function(r){t.vertices[r]||(t.vertices[r]={},e.edgeDataReduceFn&&(t.edgeData[r]={}))},A=function(r,n,i){t.vertices[r][n]=i,e.edgeDataReduceFn&&(t.edgeData[r][n]=e.edgeDataReduceFn(e.edgeDataSeed,u))};return h&&(c(a),c(l),h instanceof Object?(h.forward&&A(a,l,h.forward),h.backward&&A(l,a,h.backward)):(A(a,l,h),A(l,a,h))),o%1e3==0&&e.progress&&e.progress("edgeweights",o,s.length),t}),{edgeData:{},vertices:{}});var i=Oft.compactGraph(t.vertices,r.vertices,t.edgeData,e);return{vertices:t.vertices,edgeData:t.edgeData,sourceVertices:r.vertices,compactedVertices:i.graph,compactedCoordinates:i.coordinates,compactedEdges:e.edgeDataReduceFn?i.reducedEdges:null}},Uft=Fft,Dft=Sft,Gft=Qft;function Qft(t,e){if(e=e||{},t.compactedVertices||(t=kft(t,e)),this._graph=t,this._keyFn=e.keyFn||function(t){return t.join(",")},this._precision=e.precision||1e-5,this._options=e,0===Object.keys(this._graph.compactedVertices).filter((function(t){return"edgeData"!==t})).length)throw new Error("Compacted graph contains no forks (topology has no intersections).")}Qft.prototype={findPath:function(t,e){var r=this._keyFn(Dft(t.geometry.coordinates,this._precision)),n=this._keyFn(Dft(e.geometry.coordinates,this._precision));if(!this._graph.vertices[r]||!this._graph.vertices[n])return null;this._createPhantom(r),this._createPhantom(n);var i=function(t,e,r){var n={};n[e]=0;for(var i=new Cft([[0,[e],e]],(function(t,e){return t[0]-e[0]}));i.length;){var o=i.pop(),s=o[0],a=o[2];if(a===r)return o.slice(0,2);var l=t[a];Object.keys(l).forEach((function(t){var e=s+l[t];if(!(t in n)||e<n[t]){n[t]=e;var r=[e,o[1].concat([t]),t];i.push(r)}}))}return null}(this._graph.compactedVertices,r,n);if(i){var o=i[0];return{path:(i=i[1]).reduce(function(t,e,r,n){return r>0&&(t=t.concat(this._graph.compactedCoordinates[n[r-1]][e])),t}.bind(this),[]).concat([this._graph.sourceVertices[n]]),weight:o,edgeDatas:this._graph.compactedEdges?i.reduce(function(t,e,r,n){return r>0&&t.push({reducedEdge:this._graph.compactedEdges[n[r-1]][e]}),t}.bind(this),[]):void 0}}return null},serialize:function(){return this._graph},_createPhantom:function(t){if(this._graph.compactedVertices[t])return null;var e=Uft.compactNode(t,this._graph.vertices,this._graph.compactedVertices,this._graph.sourceVertices,this._graph.edgeData,!0,this._options);return this._graph.compactedVertices[t]=e.edges,this._graph.compactedCoordinates[t]=e.coordinates,this._graph.compactedEdges&&(this._graph.compactedEdges[t]=e.reducedEdges),Object.keys(e.incomingEdges).forEach(function(r){this._graph.compactedVertices[r][t]=e.incomingEdges[r],this._graph.compactedCoordinates[r][t]=[this._graph.sourceVertices[r]].concat(e.incomingCoordinates[r].slice(0,-1)),this._graph.compactedEdges&&(this._graph.compactedEdges[r][t]=e.reducedEdges[r])}.bind(this)),t},_removePhantom:function(t){t&&(Object.keys(this._graph.compactedVertices[t]).forEach(function(e){delete this._graph.compactedVertices[e][t]}.bind(this)),Object.keys(this._graph.compactedCoordinates[t]).forEach(function(e){delete this._graph.compactedCoordinates[e][t]}.bind(this)),this._graph.compactedEdges&&Object.keys(this._graph.compactedEdges[t]).forEach(function(e){delete this._graph.compactedEdges[e][t]}.bind(this)),delete this._graph.compactedVertices[t],delete this._graph.compactedCoordinates[t],this._graph.compactedEdges&&delete this._graph.compactedEdges[t])}};var jft=function(t){t||(t={}),null==t.typing&&(t.typing=300);var e=document.createElement("DIV"),r=(t.className||"")+" ol-scale";t.target||(r+=" ol-unselectable ol-control"),this._input=document.createElement("INPUT"),this._input.value="-",e.setAttribute("class",r),!1===t.editable&&(this._input.readOnly=!0),e.appendChild(this._input),Cl.call(this,{element:e,target:t.target}),this._input.addEventListener("change",this.setScale.bind(this)),this.set("ppi",t.ppi||96)};Vm(jft,Cl),jft.prototype.setMap=function(t){this._listener&&N(this._listener),this._listener=null,Cl.prototype.setMap.call(this,t),t&&(this._listener=t.on("moveend",this.getScale.bind(this)))},jft.prototype.getScale=function(){var t=this.getMap();if(t){var e=function(t,e){var r=t.getView(),n=r.getProjection(),i=r.getCenter(),o=t.getPixelFromCoordinate(i);o[1]+=1;var s=t.getCoordinateFromPixel(o);return qe(pr(i,n,"EPSG:4326"),pr(s,n,"EPSG:4326"))*((e||96)/.0254)}(t,this.get("ppi"));return this._input.value=this.formatScale(e),e}},jft.prototype.formatScale=function(t){return"1 / "+(t=t>100?100*Math.round(t/100):Math.round(t)).toLocaleString()},jft.prototype.setScale=function(t){var e=this.getMap();e&&t&&(t.target&&(t=t.target.value),function(t,e,r){if(t&&e){var n=e;if("string"==typeof e&&((n=e.split("/")[1])||(n=e),n=n.replace(/[^\d]/g,""),n=parseInt(n)),!n)return;var i=t.getView(),o=i.getProjection(),s=i.getCenter(),a=t.getPixelFromCoordinate(s);a[1]+=1;var l=t.getCoordinateFromPixel(a),u=qe(pr(s,o,"EPSG:4326"),pr(l,o,"EPSG:4326"));u*=(r||96)/.0254,i.setResolution(i.getResolution()*n/u)}}(e,t,this.get("ppi"))),this.getScale()};var Hft=function(t){Wc.call(this,t)};Vm(Hft,Wc),Hft.prototype.getExtent=function(){return this.getSource().getExtent()};var zft=function(t){var e={attributions:t.attributions,logo:t.logo,projection:t.projection};this._image=t.image?t.image:new Image,this._image.crossOrigin=t.crossOrigin;var r=this;this._image.onload=function(){r.setCrop(r.crop),r.changed()},t.image||(this._image.src=t.url),e.canvasFunction=this.calculateImage,Qk.call(this,e),this.center=t.imageCenter,this.setScale(t.imageScale),this.rotate=t.imageRotate?t.imageRotate:0,this.crop=t.imageCrop,this.mask=t.imageMask,this.setCrop(this.crop),this.on("change",function(){this.set("extent",this.calculateExtent())}.bind(this))};Vm(zft,Qk),zft.prototype.calculateImage=function(t,e,r,n){if(this.center){var i=document.createElement("canvas");i.width=n[0],i.height=n[1];var o=i.getContext("2d");if(!this._imageSize)return i;if(this.mask){o.beginPath();var s=f(this.mask[0]);o.moveTo(s[0],s[1]);for(var a=1;a<this.mask.length;a++)s=f(this.mask[a]),o.lineTo(s[0],s[1]);o.clip()}var l=f(this.center),u=(this._image.naturalWidth/2-this.crop[0])*this.scale[0]/e*r,h=(this._image.naturalHeight/2-this.crop[1])*this.scale[1]/e*r,c=this._imageSize[0]*this.scale[0]/e*r,A=this._imageSize[1]*this.scale[1]/e*r;return o.translate(l[0],l[1]),this.rotate&&o.rotate(this.rotate),o.drawImage(this._image,this.crop[0],this.crop[1],this._imageSize[0],this._imageSize[1],-u,-h,c,A),i}function f(e){return[(e[0]-t[0])/(t[2]-t[0])*n[0],(e[1]-t[3])/(t[1]-t[3])*n[1]]}},zft.prototype.getCenter=function(){return this.center},zft.prototype.setCenter=function(t){this.center=t,this.changed()},zft.prototype.getScale=function(){return this.scale},zft.prototype.setScale=function(t){switch(typeof t){case"number":t=[t,t];break;case"object":if(2!=t.length)return;break;default:return}this.scale=t,this.changed()},zft.prototype.getRotation=function(){return this.rotate},zft.prototype.setRotation=function(t){this.rotate=t,this.changed()},zft.prototype.getGeoImage=function(){return this._image},zft.prototype.getCrop=function(){return this.crop},zft.prototype.setMask=function(t){this.mask=t,this.changed()},zft.prototype.getMask=function(){return this.mask},zft.prototype.setCrop=function(t){if(this._image.naturalWidth){if(t){switch(typeof t){case"number":t=[t,t,this._image.naturalWidth-t,this._image.naturalHeight-t];break;case"object":if(4!=t.length)return;break;default:return}t=Et([[t[0],t[1]],[t[2],t[3]]]),this.crop=[Math.max(0,t[0]),Math.max(0,t[1]),Math.min(this._image.naturalWidth,t[2]),Math.min(this._image.naturalHeight,t[3])]}else this.crop=[0,0,this._image.naturalWidth,this._image.naturalHeight];this.crop[2]<=this.crop[0]&&(this.crop[2]=this.crop[0]+1),this.crop[3]<=this.crop[1]&&(this.crop[3]=this.crop[1]+1),this._imageSize=[this.crop[2]-this.crop[0],this.crop[3]-this.crop[1]],this.changed()}else this.crop=t},zft.prototype.getExtent=function(t){var e=this.get("extent");if(e||(e=this.calculateExtent()),t)for(var r=0;r<t.length;r++)t[r]=e[r];return e},zft.prototype.calculateExtent=function(t){var e;if(!1!==t&&this.getMask())e=new bn([this.getMask()]);else{var r=this.getCenter(),n=this.getScale(),i=this.getGeoImage().width*n[0],o=this.getGeoImage().height*n[1];(e=xn(Et([[r[0]-i/2,r[1]-o/2],[r[0]+i/2,r[1]+o/2]]))).rotate(-this.getRotation(),r)}return e.getExtent()};const Vft=Object.freeze(Object.defineProperty({__proto__:null,ArcGisFeatureServiceLayer:class extends IO{constructor(t,e){super(t,e),this.layertype="ArcGisFeatureServiceLayer";const r=this.option.url,n=new Aut;let i=this;var o;this._source=new Aa({loader:function(t,e,o,s,a){const l=r+"/query/?f=json&returnGeometry=true&spatialRel=esriSpatialRelIntersects&geometry="+encodeURIComponent('{"xmin":'+t[0]+',"ymin":'+t[1]+',"xmax":'+t[2]+',"ymax":'+t[3]+',"spatialReference":{"wkid":102100}}')+"&geometryType=esriGeometryEnvelope&inSR=102100&outFields=*&outSR=102100";fetch(l,{method:"GET"}).then((function(t){return t.json()})).then((t=>{const e=n.readFeatures(t,{featureProjection:o});e.length>0&&(i.addFeatures("",e),s(e))}))},strategy:(o=ff({tileSize:512}),function(t,e,r){var n=o.getZForResolution(function(t,e){return t}(e)),i=o.getTileRangeForExtentAndZ(Er(t),n),s=[],a=[n,0,0];for(a[1]=i.minX;a[1]<=i.maxX;++a[1])for(a[2]=i.minY;a[2]<=i.maxY;++a[2])s.push(xr(o.getTileCoordExtent(a)));return s})}),this._source.on("featuresloadend",(t=>{this.trigger(Rm.onLoadEnd,t)})),this.layer=new Zs({source:this._source}),this.layer.set("layerid",t),this.layer.set("hashMove",this.option.hashMove)}},ArcGisMapServerLayer:uU,ArcGisTileXyzLayer:lU,ClusterImageLayer:class extends IO{constructor(t,r){super(t,r),e(this,"styleCache"),e(this,"clusterSource"),e(this,"selectCluster"),this.styleCache={},this.layertype="ClusterImageLayer",this.option={distance:40,imageFieldName:"主照片地址",animationDuration:600,maxResolution:40},this.option=Object.assign({},this.option,r),this._source=new Aa,this.clusterSource=new LO({distance:this.option.distance,source:this._source}),this.layer=new tut({source:this.clusterSource,animationDuration:this.option.animationDuration,maxResolution:this.option.maxResolution,renderOrder:function(t,e){return e.getGeometry().getExtent()[1]-t.getGeometry().getExtent()[1]},style:(t,e)=>this.getFeatureStyle(t,e,"")}),this.layer.set("layerid",t),this.layer.set("layertype",this.layertype),this.selectCluster=new Bh({layers:[this.layer],condition:Au,style:(t,e)=>this.getFeatureStyle(t,e,"sel")}),this.selectCluster.setActive(!0),this.selectCluster.getFeatures().on(["add"],(t=>{var e=t.target.getArray()[0].get("features");e&&this.trigger(Rm.onFeatureSelected,e)})),this.selectCluster.getFeatures().on(["remove"],(function(t){}))}addFeaturesMN(t,e){for(var r,n,i,o,s=t.getView().calculateExtent(t.getSize()),a=[],l=0;l<e;++l)a[l]=new X(new nn([s[0]+(s[2]-s[0])*Math.random(),s[1]+(s[3]-s[1])*Math.random()])),a[l].set("id",l),a[l].set("name","123123"),a[l].set("classname",l),a[l].set("thumbnail","");null==(n=null==(r=this.clusterSource)?void 0:r.getSource())||n.clear(),null==(o=null==(i=this.clusterSource)?void 0:i.getSource())||o.addFeatures(a)}getFeatureStyle(t,e,r){let n,i=t.get("features")[0].get("uuid"),o=t.get("features")[0],s=t.get("features").length,a=o.get(this.option.imageFieldName);if(a=a.replace("_sss","_s"),n||(this.styleCache[i]=n=new ji({image:new hft({src:a,radius:20,crop:!0,kind:s>1?"folio":"square",shadow:!0,onload:function(){try{t.changed()}catch{}},stroke:new Rn({width:2,color:"sel"===r?"rgba(0, 255, 0,1)":"#fff"})})})),s>1){let t=new ji({image:new Oi({points:12,radius:9,fill:new Tn({color:"rgba(0, 255, 0,0.3)"})}),text:new Vi({text:s.toString(),font:"bold 12px helvetica,sans-serif",fill:new Tn({color:"#000"})})});var l=t.getImage().getAnchor();return l[0]-=20,l[1]+=20,[n,t]}return[n]}appendTo(t){var e,r;this._map=t,this.selectCluster&&(null==(e=this._map)||e.addInteraction(this.selectCluster)),this.layer&&(null==(r=this._map)||r.addLayer(this.layer))}},ClusterLayer:class extends IO{constructor(t,r){super(t,r),e(this,"styleCache"),e(this,"clusterSource"),e(this,"selectCluster"),this.option={convexhull:!0,animatesel:!0,haslink:!0,distance:40,levelColor:[{maxnum:5e3,strokecolor:"rgba(192,0,0,0.5)",strokewidth:15,fillcolor:"rgba(192,0,0,1)"},{maxnum:1e3,strokecolor:"rgba(255,165,0,0.5)",strokewidth:15,fillcolor:"rgba(255,165,0,1)"},{maxnum:500,strokecolor:"rgba(255,128,0,0.5)",strokewidth:15,fillcolor:"rgba(255,128,0,1)"},{maxnum:100,strokecolor:"rgba(0,191,255,0.5)",strokewidth:15,fillcolor:"rgba(0,191,255,1)"},{maxnum:50,strokecolor:"rgba(139,0,139,0.5)",strokewidth:15,fillcolor:"rgba(139,0,139,1)"},{maxnum:2,strokecolor:"rgba(255,165,0,0.5)",strokewidth:15,fillcolor:"rgba(\t255,165,0,1)"}]},this.option=Object.assign({},this.option,r),this.styleCache={},this.layertype="ClusterLayer",this.clusterSource=new LO({distance:this.option.distance,source:this._source}),this.layer=new tut({zIndex:this.option.zIndex,source:this.clusterSource,style:this.getStyle.bind(this)}),this.layer.set("layerid",t);var n=new Ri({radius:5,stroke:new Rn({color:"rgba(0,255,255,1)",width:1}),fill:new Tn({color:"rgba(0,255,255,0.3)"})}),i=new ji({image:n}),o=new ji({image:n,stroke:new Rn({color:"#fff",width:1})});this.selectCluster=new rut({layers:[this.layer],condition:Au,pointRadius:7,animate:this.option.animatesel,featureStyle:()=>[this.option.haslink?o:i],style:(t,e)=>{let r=t.get("features");if(r){if(r.length>1){var n=[this.getStyle(t,e)];if(this.option.convexhull&&nut){var i=[];for(let t=0;t<r.length;t++)i.push(r[t].getGeometry().getFirstCoordinate());var o=nut(i);n.push(new ji({stroke:new Rn({color:"rgba(0,0,192,0.5)",width:2}),fill:new Tn({color:"rgba(0,0,192,0.3)"}),geometry:new bn([o]),zIndex:100}))}return n}return[new ji({image:new Ri({radius:5,stroke:new Rn({color:"rgba(255,0,0,0.5)",width:10}),fill:new Tn({color:"rgba(255,0,0,1)"})}),text:new Vi({text:r[0].getProperties().name,font:"13px Microsoft YaHei",offsetY:-15,fill:new Tn({color:"#8B4513"}),stroke:new Rn({color:"#fff",width:2})})})]}}}),this.selectCluster.getFeatures().on(["add"],(t=>{t.target.getArray()[0].get("features")})),this.selectCluster.getFeatures().on(["remove"],(function(t){}))}appendTo(t){var e;this._map=t,this._map.addInteraction(this.selectCluster),this.layer&&(null==(e=this._map)||e.addLayer(this.layer))}showTitle(t,e){new Promise(((r,n)=>{this._source.getFeatures().forEach((r=>{let n=r.getProperties();if(t==n.dataType)try{r.getStyle().getText().setText(e?r.get("name"):"")}catch(dX){}})),this.layer.changed()}))}addFeaturesMN(t,e){for(var r,n,i=t.getView().calculateExtent(t.getSize()),o=[],s=0;s<e;++s)o[s]=new X(new nn([i[0]+(i[2]-i[0])*Math.random(),i[1]+(i[3]-i[1])*Math.random()])),o[s].set("id",s),o[s].set("name","123123"),o[s].set("classname",s);null==(n=null==(r=this.clusterSource)?void 0:r.getSource())||n.addFeatures(o)}getStyle(t,e){var r=t.get("features").length,n=this.styleCache[r];return 1==r?n=this.styleCache[r]=t.get("features")[0].getStyle():n||(this.option.levelColor.sort((function(t,e){return t.maxnum-e.maxnum})),this.option.levelColor.forEach((t=>{var e=Math.max(8,Math.min(.75*r,20));r>=t.maxnum&&(n=this.styleCache[r]=new ji({image:new Ri({radius:e,stroke:new Rn({color:t.strokecolor,width:t.strokewidth,lineCap:"butt"}),fill:new Tn({color:t.fillcolor})}),text:new Vi({text:r.toString(),fill:new Tn({color:"#fff"})})}))}))),n}},DayNightLayer:class extends IO{constructor(t,e){super(t,e),this.layertype="DayNightLayer",this._source=new xft({}),this.layer=new Zs({source:this._source,zIndex:500,style:new ji({image:new Ri({radius:5,fill:new Tn({color:"red"})}),fill:new Tn({color:[0,0,50,.5]})})}),this.layer.set("layerid",t),this._source.on("addfeature",(t=>{}))}setDataTime(t){this._source.setTime(t)}},DivLayer:class extends Gm{constructor(t,r){super(t,r),e(this,"DivGraphicList"),this.layertype="DivLayer",this.layerid=t,this.DivGraphicList=[],this._on(this.EventType.XMapEventType.onRemoveLayer,(t=>{this.layerid==t&&this.DivGraphicList.length>0&&this.removeAll()}))}getDivList(){return this.DivGraphicList}addDiv(t){this.DivGraphicList.push(t),this._map.addOverlay(t)}removeDiv(t){this._map.removeOverlay(t),this.DivGraphicList.forEach(((e,r,n)=>{if(e===t)return this.DivGraphicList.slice(r,1),void this.trigger(Rm.onFeatureDeleted,{value:e})}))}removeAll(){this.DivGraphicList.forEach((t=>{this._map.removeOverlay(t),this.trigger(Rm.onFeatureDeleted,{element:t})})),this.DivGraphicList=[]}appendTo(t){this._map=t}},GeoImageLayer:class extends aU{constructor(t,r){super(t,r),e(this,"GraphicLayer"),e(this,"graphic");let n={imageCenter:[0,0],imageScale:[1,1],imageRotate:0,imageMask:null,ImageExtentWKID:Xp.EPSG3857,opacity:1,hashEdit:!1};this.option=Object.assign({},n,this.option),this.GraphicLayer=null,this.graphic=null,this.option.ImageExtentWKID==Xp.EPSG4326&&(this.option.imageCenter=ur(this.option.imageCenter)),this.layertype="GeoImageLayer",this.layerSource=new zft({url:this.option.url,imageMask:this.option.imageMask,imageCenter:this.option.imageCenter,imageScale:this.option.imageScale,imageRotate:Number(this.option.imageRotate*Math.PI/180)}),this.layer=new Hft({source:this.layerSource,opacity:this.option.opacity}),this.layer.set("layerid",t),this.layerSource.on("imageloadend",(t=>{this.graphic&&this.graphic.setGeometryFromExtent(this.layerSource.getExtent()),this.layerSource._image.setAttribute("crossOrigin","Anonymous"),this.trigger(this.EventType.LayerEventType.tileloadend,t)})),this.layerSource.on("change",(t=>{this.layerSource._image.setAttribute("crossOrigin","Anonymous"),this.graphic&&this.graphic.setGeometryFromExtent(this.layerSource.getExtent())})),this.layerSource.on("tileloaderror",(function(){})),this._on(this.EventType.XMapEventType.onRemoveLayer,(t=>{this.GraphicLayer&&this.graphic&&this.GraphicLayer.removeFeature(this.graphic)}))}getAttribute(){return this.option}startEdit(t){this.option.hashEdit=!0,this.GraphicLayer=t,this.graphic?this.GraphicLayer.addFeature("GeoImageLayerGraphicTemp",this.graphic):this.setExtent()}endEdit(){this.option.hashEdit=!1,this.graphic&&this.GraphicLayer.removeFeature(this.graphic)}setExtent(){this.graphic||(this.graphic=new SO({graphicType:"PolygonGraphic",style:{stroke:{color:"rgba(255, 0, 0,0)",width:0},fill:{color:"rgba(255, 0, 0,0)"},zIndex:800},attribute:{name:this.layerid+"_graphic",movestate:!1,editallows:!1}}),this.graphic.setGeometryFromExtent(this.layerSource.getExtent()),this.GraphicLayer.addFeature("GeoImageLayerGraphicTemp",this.graphic),this.graphic.set("Scale",this.option.imageScale),this.graphic.on("onRotating",(t=>{this.option.imageRotate=t.data,this.layerSource.setRotation(t.data)})),this.graphic.on("onScaling",(t=>{this.option.imageScale=[t.data,t.data],this.layerSource.setScale(t.data)})),this.graphic.on("onMoveing",(t=>{this.option.imageCenter=t.data,this.layerSource.setCenter(t.data)})))}setScale(t){this.graphic.set("Scale",t),this.layerSource.setScale(t)}computeAutoScale(t){let e=jt(t)/jt(this.layerSource.getExtent());this.graphic.set("Scale",[e,e]),this.layerSource.setScale([e,e])}getGraphic(){return this.graphic}},GraphicImageLayer:PO,GraphicLayer:class extends IO{constructor(t,r){super(t,r),e(this,"animList"),this.animList=[],this.layertype="GraphicLayer",this.layer=new Zs({source:this._source,zIndex:this.option.zIndex}),this.layer.set("layerid",t),this._source.on("addfeature",(t=>{t.feature.get("loadAnimation")&&setTimeout((()=>{this.animateFeature(t.feature,t.feature.get("loadAnimation"))}),1),t.feature.get("pulseAnimate")&&setTimeout((()=>{this.pulseAnimate(t.feature,t.feature.get("pulseAnimate"))}),1)})),this._source.on("removefeature",(t=>{t.feature.get("pulseAnimate")&&this.animList.forEach(((e,r)=>{t.feature.get("uuid")==e.uuid&&e.anim.stop({user:!0})}))})),this.layer.on(this.EventType.featureType.onFeatureContextmenu,(t=>{this._setFeatureContextmenu(t.data.feature,t.data.contextmenu)})),this._on("onClickTolayer",(t=>{"function"==typeof t.isPopupBind&&t.isPopupBind()?t.openPopup():this.option.enabledPopup&&this.openPopup(t,this.option.popupInfo,this.option.popupOption)}))}pathAnimate(t,e,r){let n={rotate:!0,speed:1,revers:!0,repeat:1/0,easing:va};r=Object.assign({},n,r);let i=new gft({path:e,rotate:r.rotate,speed:r.speed,repeat:r.repeat,revers:r.revers});return this.trigger(Rm.onPathAnimateStart,{data:t}),i.on("animationend",(t=>{this.trigger(Rm.onPathAnimateEnd,{data:t.feature})})),i.on("animating",(t=>{this.trigger(Rm.onPathAnimateRunning,{data:t})})),this.layer.animateFeature(t,i)}pulseAnimate(t,e){let r={fade:ya,duration:2e3,revers:!1,repeat:1/0,easing:ya,radius:30,fillcolor:"rgba(255,0,0,0.2)",strokecolor:"red",strokewidth:1};e=Object.assign({},r,e);let n=new xO({graphicType:"PointGraphic",lnglat:t.getGeometry().getCoordinates(),style:{image:{radius:e.radius,scale:1,fill:{color:e.fillcolor},stroke:{color:e.strokecolor,width:e.strokewidth}},zIndex:990},attribute:{uuid:t.get("uuid")}}),i=new bft(e);this.animList.push({uuid:t.get("uuid"),anim:this.layer.animateFeature(n,i)}),i.on("animationend",(t=>{this.animList.forEach(((e,r)=>{t.feature.get("uuid")==e.uuid&&this.animList.splice(r,1)}))}))}animateFeatures(t,e){t.forEach(((t,r)=>{this.animateFeature(t,e)}))}animateFeature(t,e){let r,n={duration:3e3,animateType:Jp.Bounce,repeat:1,speed:.8,revers:!1,zoomOut:!1,side:!1};switch((e=Object.assign({},n,e)).animateType){case Jp.Blink:r=new fft(e);break;case Jp.Drop:r=new pft(e);break;case Jp.Fade:r=new dft(e);break;case Jp.Path:r=new gft(e);break;case Jp.Shake:r=new yft(e);break;case Jp.Show:r=new mft(e);break;case Jp.Slide:r=new vft(e);break;case Jp.Teleport:r=new _ft(e);break;case Jp.Throw:r=new wft(e);break;case Jp.Zoom:r=new bft(e);break;case Jp.ZoomOut:e.zoomOut=!0,r=new bft(e);break;default:r=new Aft(e)}this.layer.animateFeature(t,r)}},HeatmapLayer:class extends IO{constructor(t,e){super(t,e),this.layertype="HeatmapLayer",this._source=new Aa({wrapX:!1}),this.option={blur:25,radius:8,gradient:["#00f","#0ff","#0f0","#ff0","#f00"]},this.option=Object.assign({},this.option,e),this.layer=new Dc({source:this._source,zIndex:this.option.zIndex,gradient:this.option.gradient,blur:this.option.blur,radius:this.option.radius}),this.layer.set("layerid",t)}setBlur(t){this.layer.setBlur(parseInt(t,10))}setRadius(t){this.layer.setRadius(parseInt(t,10))}},ImageCanvasLayer:class extends Gm{constructor(t,r){if(super(t,r),e(this,"scale"),e(this,"ppi"),e(this,"layerOption"),e(this,"drawText"),this.option={},this.layerOption={line1Style:"rgba(255,0,0, 0.1)",line1Width:.5,line5Style:"rgba(255,0,0, 0.3)",line5Width:1,line10Style:"rgba(255,0,0, 0.5)",line10Width:2,lineRectStyle:"rgba(255, 0, 0, 1)",lineRectWidth:5},this.layerOption=Object.assign({},this.layerOption,r),this.layertype="ImageCanvasLayer",this.layer=new Wc({zIndex:r.zIndex}),!document.getElementById("hutia")){let t=document.createElement("div");t.setAttribute("id","hutia"),t.style.width="1cm",document.body.appendChild(t)}this.layer.setSource(new Qk({canvasFunction:(t,e,r,n,i)=>{var o=document.createElement("canvas");this.trigger(Rm.onScaleChange,{Scale:Math.round(this.scale.getScale())});var s=this._map.getSize(),a=new Array(2);a[0]=n[0]-s[0],a[1]=n[1]-s[1],o.width=n[0],o.height=n[1],a[0]=0,a[1]=0;const l=this.ppi/2.54/10;let u=a[0]/2,h=a[1]/2,c=o.width-a[0],A=o.height-a[1],f=o.getContext("2d");f.clearRect(u,h,c,A);let p=0;for(let d=h;d<o.height-h;d+=l)f.beginPath(),f.moveTo(u,d),f.lineTo(o.width-u,d),f.closePath(),p%10==0?(f.lineWidth=this.layerOption.line10Width,f.strokeStyle=this.layerOption.line10Style):p%5==0?(f.lineWidth=this.layerOption.line5Width,f.strokeStyle=this.layerOption.line5Style):(f.lineWidth=this.layerOption.line1Width,f.strokeStyle=this.layerOption.line1Style),f.stroke(),p++;p=0;for(let d=u;d<o.width-u;d+=l)f.beginPath(),f.moveTo(d,h),f.lineTo(d,o.height-h),f.closePath(),p%10==0?(f.lineWidth=this.layerOption.line10Width,f.strokeStyle=this.layerOption.line10Style):p%5==0?(f.lineWidth=this.layerOption.line5Width,f.strokeStyle=this.layerOption.line5Style):(f.lineWidth=this.layerOption.line1Width,f.strokeStyle=this.layerOption.line1Style),f.stroke(),p++;return f.lineWidth=this.layerOption.lineRectWidth,f.strokeStyle=this.layerOption.lineRectStyle,f.strokeRect(u,h,c,A),o}})),this.layer.set("layerid",t),this.layer.on(Rm.onClick,(t=>{t.feature&&this.trigger(Rm.onClick,t.feature.getProperties())}))}setScale(t){this.scale.setScale(t)}setText(t){this.drawText.updateHtml(t)}setElementStyle(t,e){this.drawText.updateElementStyle(t,e)}appendTo(t){var e;this._map=t,this.layer&&(null==(e=this._map)||e.addLayer(this.layer),this.isAdded=!0);var r=document.getElementById("hutia").offsetWidth,n=screen.width/r,i=screen.height/r,o=Math.round(Math.sqrt(n*n+i*i)/2.54);this.ppi=Math.sqrt(window.screen.width*window.screen.width+window.screen.height*window.screen.height)/o,this.ppi=Math.round(this.ppi),this.scale=new jft({}),this.scale.set("ppi",this.ppi),this.scale.set("Visible",!1),this._map.addControl(this.scale),this.drawText=new Dlt({}),this._map.addControl(this.drawText),this._map.getView().on("change",(t=>{this.layer.getSource().changed()})),document.querySelector(".ol-scale").style.display="none"}setMouseLock(t=!1){let e,r;this._map.getInteractions().forEach((function(n){n instanceof _u&&(e=n),n instanceof Gu&&(r=n),e&&e.setActive(t),r&&r.setActive(t)}))}},PathLayer:class extends Gm{constructor(t,r){super(t,r),e(this,"autoPointSize"),e(this,"result"),e(this,"resultlayer"),e(this,"resultSource"),e(this,"nodesLayer"),e(this,"dijkstra"),e(this,"pathDatalayer"),e(this,"animating"),e(this,"distance"),e(this,"lastTime"),e(this,"pathLine"),e(this,"position"),e(this,"geoMarker"),e(this,"styles"),e(this,"vueThis"),e(this,"pathLineFeature"),e(this,"lastAngle"),e(this,"pathIndex"),e(this,"timer"),e(this,"pathNodeInfo"),e(this,"geoMarkerCircle"),e(this,"moveNodeInfo"),e(this,"FeatureMoveProgressInfo"),e(this,"oldPathLineFeature"),e(this,"routeFeatures"),e(this,"_source"),e(this,"multiLinePathData"),e(this,"fun",(t=>{this.vueThis.moveFeature(t)})),this.option=dO.merge({roadNetworkData:"",pathDefaultStyle:{color:"rgba(255, 255, 255, 0.1)",width:1},pathStyle:{color:"#089519",width:10,imageUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACISURBVDhP3Yy9CYAwFIQzg+ASTuFmuokjuIaFpb2Vc8S7vEswKFE78YOD5H6e+zne+xqq9H0Hhj0U6WU/gwPbZTw7gmJn/UvKR1iwXmKRjlwfYWB5gsNGKh+hYX4ijBUzLx/BZzUvkI0j9JRFNkUhHM3zE3QaR5hBM4tgkG3AaPW85U338zi3A+g3FErF6/qjAAAAAElFTkSuQmCC"},trackPathStyle:{color:"rgba(180,205,205, 1)",width:10},geoMarkerStyle:{url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAlCAYAAABGWhk4AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAABYgAAAWIBXyfQUwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAYGSURBVEiJlZdvaFvXFcB/7+mPI8lvjmxHil0vKkuq1bCuYbVsQrDxFup9aSAezA5pExpGRh26hdF0FOIv+9CyrLCh7dvABARmyIWB6Qad69Ik1PH8h67E0C6anbqTI8myZUeWZE1/nu4+6D7n2VZpcuCgq/vu/d37zjvn3HMVIQS1RFEUxWiaFECYFPE1AGtN6iNRAYv8VWVfRaouf2tKTbDcrQG1AXbZRgKLprGVWrtW93ZIqCJBdsAB1Mfj8d/H4/F3gXrZZyymmMz2SIQQu1RCrYATaAKeDoVC54WUUCh0HnhaPnPKscpejmJ+C5MJrMABQAMOpjY2xgpW13cB6sq5e02NjQPAQyAD/A8oA7tMstcUe8Gu8fHxM41ud/u1Ww/Ua7ceqI1ud/v4+PgZwCXHWOWc3ebYYwKLHOwGfG1tbV2ZbG51IZnT1bdnhfr2rFhI5vRMNrfa1tbWBfjk2AOGvQ2eecfm3dYBznA4fKHe5fS8MbmiVgRUBLwxuaLWu5yecDh8Qdq4rtauVZNtjY9mBxx9fX0tL3QEXv3wyy0xcT+9s/rE/TQffrklXugIvNrX19fCIw+xYvIQ1QRVzeBgMPia3W5zvPlRdJ8rvflRVLHbbY5gMPjaHrBqwC01TOC6evVq++DZs78JLaTUqWiWn//Aw7s/ahOXjh/icL1d+WI9j9OmKj9sb3t2e3t74s6dOymgxKNo3Oe3h4BjiURiUgghbi5vGe4r1lOp5fVUatn4bzxLJBKTwDE5d8evDTvbqEaUd2xsbNCYXNb10szMzGh/f//LwIvAi/39/S/PzMyMlnW9ZIwbGxsbBLySYTO+3S7ww4dbt4QQIrm29unQ0NArQC/QA3RL7QF6h4aGXkmurX0qhBDp9NYne8H7XGx+fv58Op22njp16pb8KCpAIBCoB5ibm8vKb1gBihMTEz1ut7sQCAT+AuSoJqiyERRGYLiohrHW0NDQEA6Hf+L3+497PJ5jLpfLC5DL5VaTyeRiJBL5bHBw8K/pdDpNNbS3gG2qIa4jd+sAGoEjwPeHh4cvbm5uLgqTFPWKKOoVc5fY3NxcHB4evgg8J+c2SpZVka9bJ+1z8ObNmxd7enp+pSiK9at0kd9Nx5mN5VhIbgPwnMdJZ6uLX59owddgRwhRvn379h96e3tvUE1MWaBgkVAHoF2/fr3r3Llzv1UUxfrnf63R/94iUytZYtkSugBdQCxbYi6eY+SzdZqcVjpaXKrP5+tyOp1zk5OTCaqZTleAbwGa3+9vnZ+ff0/TNN+f5lb55cR/9wZcTflj3xF+EfCSyWS+6ujo+GkkEokBmZ0UOTo6ekHTNN/iZoG3Pl55LCjAWx+vsLhZQNM03+jo6AXpBNad/NDa2noc4J2pGNulrz0j98l2qcI7UzEAJMNugC2A1e12Pwvwzwe5x4YaYsyRDCtgUQF1YGCg2eFwNGeKOvdS+ScG30vlyRR1HA5H88DAQDOgqoCIRqMFIYSos6jY1P0H7jeJTVWos6gIIUQ0Gi0AQgUq09PTW7lcbsVuUXje63xi8PNeJ3aLQi6XW5ment4CKirV8CttbGz8G6DniPbEYGOOZJQAXaXq0MVIJDIFcO1kC09p9seGPqXZuXayBQDJ2ElCGtVwbkwkEiNer7frH/fTvBT+D+VK7YLREKuq8LfBZ/jxdxpYXV2dOXz48M+ADSBrLvjUeDx+9/Tp02f8zc66l545yJ2VLMntck3o9w45+PtZP93f1iiVSpnLly8PLSwsJKhmuAJUE7OL6tFydGRk5FI+n08KIUShrIvQ3XXx+gfL4sSNz8WJG5+L1z9YFqG766JQ1oUQQuTz+eTIyMgl4KhkuCRzp/jTAA9wtLu7++TS0tL74htkaWnp/e7u7pMS6pEMO2CpdfQfoJrtXMFgsKOzs7OztbW1vampyQ+QSqUisVjsi9nZ2dkrV67MUz018lQTfBFZxylCiFr1sI1qOq1jd80A1SOpLCEFqSVMx78QQuxUmya4sYBFAo22+aqgSy2b2hVMFWetMtasxkK17iDGlWHnTmIuY/8P3C0FYo4OztIAAAAASUVORK5CYII="},navigationOption:{defaultZoom:15,turnToZoom:17,speed:1,tracking:!0,trackingDirection:!0,showNode:!0,showStartEndNode:!0,showPathLine:!0,scale:1,pointDistance:.5}},r,!0),this.layertype="PathLayer",this._source=new Aa({wrapX:!1,url:this.option.roadNetworkData,format:new kf}),this._source.on("featuresloadend",(t=>{let e=[];t.features.forEach((t=>{let r=t.getGeometry();e.push(r.getCoordinates())})),this.multiLinePathData=new X({geometry:new Ju(e)})}));let n=[];this.pathDatalayer=new Zs({source:this._source,zIndex:900,style:new ji({stroke:new Rn({width:this.option.pathDefaultStyle.width,color:this.option.pathDefaultStyle.color}),fill:new Tn({color:this.option.pathDefaultStyle.color})})}),this.vueThis=this,this.styles={route:new ji({stroke:new Rn({width:6,color:[237,212,0,.8]})}),icon:new ji({image:new Ns({anchor:[.5,1],src:"data/icon.png"})}),geoMarker:new ji({zIndex:999,image:new Ns({src:this.option.geoMarkerStyle.url,rotation:0,rotateWithView:!1})})},this.resultSource=new Aa,this.resultlayer=new Zs({source:this.resultSource,zIndex:200,updateWhileAnimating:!0,updateWhileInteracting:!0}),this.position=new nn([0,0]),this.geoMarker=new X({geometry:this.position}),this.geoMarker.setStyle(this.styles.geoMarker),this.resultSource.addFeature(this.geoMarker),this.resultlayer.on("change",(t=>{})),this.dijkstra=new Eft({source:this._source}),this.dijkstra.on("start",(t=>{this.resultSource.clear()})),this.dijkstra.on("finish",(t=>{if(this.resultSource.clear(),!t.route.length)return void this.trigger(Rm.onPathComputerComplete,{pathLine:null,distance:0});if(this.routeFeatures=t.route,this.pathNodeInfo=cO.lineMerger(t.route,this.option.navigationOption.pointDistance),this.pathLineFeature=this.pathNodeInfo.line,this.pathLine=this.pathLineFeature.getGeometry(),this.option.navigationOption.totalDistance=Xe(this.pathLine)*this.option.navigationOption.scale,this.option.navigationOption.showNode){let t=0;this.pathLine.forEachSegment(((e,r)=>{let n=new X({geometry:new nn(e)});n.setStyle(new ji({image:new Ri({radius:12,fill:new Tn({color:"#bb1422"})}),text:new Vi({offsetX:0,offsetY:0,textAlign:"center",textBaseline:"middle",text:t.toString(),font:"12px sans-serif",fill:new Tn({color:"white"})})})),t++,this.resultSource.addFeature(n)}))}this.position.setCoordinates(this.pathLine.getFirstCoordinate()),this.setNavigationMarker(this.pathLine.getFirstCoordinate(),0),this.option.navigationOption.tracking&&(this._map.getView().setCenter(this.pathLine.getFirstCoordinate()),this._map.getView().setZoom(this.option.navigationOption.defaultZoom)),this.geoMarkerCircle=new X({geometry:new Xu(this.pathLine.getFirstCoordinate(),50)}),this.oldPathLineFeature=new X({geometry:new Nn([this.pathLine.getFirstCoordinate()])}),this.oldPathLineFeature.setStyle(new ji({stroke:new Rn({color:this.option.trackPathStyle.color,width:this.option.trackPathStyle.width})})),this.pathLineFeature.setStyle(this.styleFunc.bind(this)),this.geoMarkerCircle.setStyle(new ji({stroke:new Rn({width:6,color:[237,212,0,.8]}),fill:new Tn({color:"rgba(255, 255, 255, 0.1)"})})),this.option.navigationOption.showPathLine&&(this.resultSource.addFeature(this.geoMarker),this.resultSource.addFeature(this.oldPathLineFeature),this.resultSource.addFeature(this.pathLineFeature));let e=Xe(this.pathLineFeature.getGeometry());this.trigger(Rm.onPathComputerComplete,{pathLine:this.pathLineFeature,distance:e})})),this.dijkstra.on("pause",(t=>{t.overflow&&this.dijkstra.resume()})),this.dijkstra.on("calculating",(t=>{var e=this.dijkstra.getBestWay();this.resultSource.clear(),this.resultSource.addFeatures(e)})),this.nodesLayer=new Zs({source:this.dijkstra.getNodeSource(),style:new ji({image:new Ri({radius:5,fill:new Tn({color:[255,0,0,.1]})})})}),n.push(this.nodesLayer),n.push(this.resultlayer),n.push(this.pathDatalayer),this.layer=new ka({layers:n}),this.layer.set("layerid",t),this.animating=!1,this.distance=0,this.lastTime}styleFunc(t,e){let r=[];r.push(new ji({stroke:new Rn({color:this.option.pathStyle.color,width:this.option.pathStyle.width})}));const n=t.get("geometry");if("linestring"===n.getType().toLowerCase()){const t=n.getCoordinates(),i=n.getLength(),o=80*e,s=Math.ceil(i/o);for(let e=1;e<s;e++){const t=e/s,i=n.getCoordinateAt(t),o=n.getCoordinateAt(t+.05*t),a=o[0]-i[0],l=o[1]-i[1],u=Math.atan2(l,a);r.push(new ji({geometry:new nn(i),image:new Ns({scale:.8,rotateWithView:!0,rotation:-u,src:this.option.pathStyle.imageUrl})}))}this.option.navigationOption.showStartEndNode&&(r.push(new ji({geometry:new nn(t[0]),image:new Ri({radius:12,fill:new Tn({color:"green"})}),text:new Vi({offsetX:0,offsetY:0,textAlign:"center",textBaseline:"middle",text:"起",font:"12px sans-serif",fill:new Tn({color:"white"})})})),r.push(new ji({geometry:new nn(t[t.length-1]),image:new Ri({radius:12,fill:new Tn({color:"#bb1422"})}),text:new Vi({offsetX:0,offsetY:0,textAlign:"center",textBaseline:"middle",text:"终",font:"12px sans-serif",fill:new Tn({color:"white"})})})))}return r}moveFeature(t){this.resultlayer.changed();const e=t.frameState.time,r=e-this.lastTime;if(this.distance=(this.distance+this.option.navigationOption.speed*r/1e6)%2,this.lastTime=e,this.trigger(Rm.onFeatureMoveProgress,{progress:this.distance,distance:this.distance,elapsedTime:r}),this.distance>=1)this.stopAnimation();else{const e=this.pathLine.getCoordinateAt(this.distance);let n,i=(this.distance+this.option.navigationOption.speed*r/1e6)%2;n=i>=1?this.pathLine.getLastCoordinate():this.pathLine.getCoordinateAt(i);let o=this.setAngle(e,n);this.position.setCoordinates(e),this.option.navigationOption.tracking?(this._map.getView().setCenter(e),this._map.getView().setRotation(o.viewAngle)):this.styles.geoMarker.getImage().setRotation(o.markAngle);const s=function(t){if(!(t.context instanceof CanvasRenderingContext2D))throw new Error("Only works for render events from Canvas 2D layers");var e=t.inversePixelTransform[0],r=t.frameState,n=pt(t.inversePixelTransform.slice(),r.coordinateToPixelTransform),i=Hs(r.viewState.resolution,e);return new vs(t.context,e,r.extent,n,r.viewState.rotation,i,void 0)}(t);s.setStyle(this.styles.geoMarker),s.drawGeometry(this.position),this._map.render()}}setAngle(t,e){let r=e[1]-t[1],n=e[0]-t[0],i=1,o=Math.atan(r/n);r<=0&&n>=0?(i=2,o=-o):n>=0&&r>=0?(o=-o,i=1):n<=0&&r>=0?(o=Math.PI-o,i=4):n<=0&&r<=0&&(o=Math.PI-o,i=3);var s=Math.atan2(1,0);return{viewAngle:-s-o,markAngle:s+o,Angle:s-Math.atan2(r,n),xx:i}}startAnimation(t=!0,e=!0,r=10){this.lastAngle=0,this.distance=0,this.animating=!0,this.lastTime=Date.now(),this._map.getView().setCenter(this.pathLine.getFirstCoordinate()),this._map.getView().setZoom(15),this.resultlayer.addEventListener("postrender",this.fun)}pauseAnimation(){this.resultlayer.removeEventListener("postrender",this.fun)}resumeAnimation(){this.resultlayer.addEventListener("postrender",this.fun)}stopAnimation(){this.animating=!1,this.position.setCoordinates(this.pathLine.getLastCoordinate()),this.geoMarker.setGeometry(this.position),this._map.getView().setRotation(0),this._map.getView().setCenter(this.pathLine.getLastCoordinate()),this.resultlayer.removeEventListener("postrender",this.fun)}startAnimation2(t){clearInterval(this.timer),t&&(this.option.navigationOption=Object.assign({},this.option.navigationOption,t)),this.distance=0,this.animating=!0,this.lastTime=Date.now(),this.pathNodeInfo.nodeData.length>3?this.moveNodeInfo={currentNode:this.pathNodeInfo.nodeData[0],nextNode:this.pathNodeInfo.nodeData[1],threeNode:this.pathNodeInfo.nodeData[2]}:this.moveNodeInfo={currentNode:this.pathNodeInfo.nodeData[0],nextNode:this.pathNodeInfo.nodeData[1],threeNode:this.pathNodeInfo.nodeData[1]},this.option.navigationOption.tracking&&(this._map.getView().setCenter(this.pathLine.getFirstCoordinate()),this._map.getView().setZoom(this.option.navigationOption.defaultZoom),this._map.getView().setRotation(this.setAngle(ur(this.moveNodeInfo.currentNode.coords),ur(this.moveNodeInfo.nextNode.coords)).viewAngle)),this.oldPathLineFeature.getGeometry().setCoordinates([this.pathLine.getFirstCoordinate()]),this.pathIndex=0,this.FeatureMoveProgressInfo={nodeNum:this.moveNodeInfo.currentNode.coordIndex,progress:this.pathIndex/this.pathNodeInfo.coordinates.length,remainingDistance:this.option.navigationOption.totalDistance-this.option.navigationOption.totalDistance*(this.pathIndex/this.pathNodeInfo.coordinates.length),nextNodeDistance:this.moveNodeInfo.currentNode.distance*this.option.navigationOption.scale,totalDistance:this.option.navigationOption.totalDistance,angle:this.ComputDirection()},this.timer=setInterval((()=>{this.moveFeature3(this.pathIndex),this.pathIndex=this.pathIndex+this.option.navigationOption.speed}),1)}stopAnimation2(){this.animating=!1,this.position.setCoordinates(this.pathLine.getLastCoordinate()),this.geoMarker.setGeometry(this.position),this._map.getView().setRotation(0),this._map.getView().setCenter(this.pathLine.getLastCoordinate()),clearInterval(this.timer)}pauseAnimation2(){clearInterval(this.timer)}resumeAnimation2(){this.timer=setInterval((()=>{this.moveFeature3(this.pathIndex),this.pathIndex=this.pathIndex+this.option.navigationOption.speed}),100)}moveFeature3(t){const e=(new Date).getTime(),r=e-this.lastTime;if(this.distance=(this.distance+this.option.navigationOption.speed*r/1e6)%2,this.lastTime=e,t>=this.pathNodeInfo.coordinates.length)this.stopAnimation2();else{const e=ur(this.pathNodeInfo.coordinates[t]);this.oldPathLineFeature.getGeometry().appendCoordinate(e),this.oldPathLineFeature.getGeometry().changed();let r=Xe(new Nn([e,ur(this.moveNodeInfo.nextNode.coords)]))*this.option.navigationOption.scale;if(this.position.setCoordinates(e),this.geoMarker.getGeometry().setCoordinates(e),this.geoMarkerCircle.getGeometry().setCenter(e),this.FeatureMoveProgressInfo.nodeNum=this.moveNodeInfo.currentNode.coordIndex,this.FeatureMoveProgressInfo.nextNodeDistance=r,this.FeatureMoveProgressInfo.progress=t/this.pathNodeInfo.coordinates.length,this.FeatureMoveProgressInfo.remainingDistance=this.option.navigationOption.totalDistance-this.option.navigationOption.totalDistance*this.FeatureMoveProgressInfo.progress,r<=1*this.option.navigationOption.speed){let t=this.moveNodeInfo.currentNode.coordIndex+1;if(t<this.pathNodeInfo.nodeData.length-1){this.moveNodeInfo.currentNode=this.pathNodeInfo.nodeData[t],this.moveNodeInfo.nextNode=this.pathNodeInfo.nodeData[t+1],t<this.pathNodeInfo.nodeData.length-2?(this.moveNodeInfo.threeNode=this.pathNodeInfo.nodeData[t+2],this.FeatureMoveProgressInfo.angle=this.ComputDirection()):this.FeatureMoveProgressInfo.angle="直行";let e=this.setAngle(ur(this.moveNodeInfo.currentNode.coords),ur(this.moveNodeInfo.nextNode.coords));this.option.navigationOption.tracking?this._map.getView().setRotation(e.viewAngle):this.styles.geoMarker.getImage().setRotation(e.markAngle)}}this.trigger(Rm.onFeatureMoveProgress,this.FeatureMoveProgressInfo),this.option.navigationOption.tracking&&this._map.getView().setCenter(e)}}moveFeature2(){const t=(new Date).getTime(),e=t-this.lastTime;if(this.distance=(this.distance+this.option.navigationOption.speed*e/1e6)%2,this.lastTime=t,this.distance>=1)this.stopAnimation2();else{const t=this.pathLine.getCoordinateAt(this.distance);let r,n=Xe(new Nn([t,ur(this.moveNodeInfo.nextNode.coords)]));if(this.position.setCoordinates(t),this.geoMarker.getGeometry().setCoordinates(t),this.geoMarkerCircle.getGeometry().setCenter(t),n<100){let t=cO.movePointContain(this.geoMarkerCircle,this.pathNodeInfo.nodeData);if(-1!=t.coordIndex&&t.coordIndex!=this.moveNodeInfo.currentNode.coordIndex&&t.coordIndex<=this.moveNodeInfo.currentNode.coordIndex+2){this.moveNodeInfo={currentNode:this.pathNodeInfo.nodeData[t.coordIndex],nextNode:this.pathNodeInfo.nodeData[t.coordIndex+1],threeNode:this.pathNodeInfo.nodeData[t.coordIndex+2]};let n=this._map.getPixelFromCoordinate(ur(this.moveNodeInfo.currentNode.coords)),i=this._map.getPixelFromCoordinate(ur(this.moveNodeInfo.nextNode.coords)),o=this._map.getPixelFromCoordinate(ur(this.moveNodeInfo.threeNode.coords)),s=(i[0]-n[0])*(o[1]-i[1])-(i[1]-n[1])*(o[0]-i[0]),a=this.setAngle(ur(this.moveNodeInfo.nextNode.coords),ur(this.moveNodeInfo.threeNode.coords));this.trigger(Rm.onFeatureMoveProgress,{nodeNum:this.moveNodeInfo.currentNode.coordIndex,progress:this.distance,distance:this.option.navigationOption.totalDistance-this.option.navigationOption.totalDistance*this.distance,elapsedTime:e,nextNodeDistance:this.moveNodeInfo.currentNode.distance,nextNodeDirection:a.markAngle,angle:s>0?"右":"左",xx:a.xx}),r=this.setAngle(ur(this.moveNodeInfo.currentNode.coords),ur(this.moveNodeInfo.nextNode.coords)),this.option.navigationOption.tracking?this._map.getView().setRotation(r.viewAngle):this.styles.geoMarker.getImage().setRotation(r.markAngle)}}this.option.navigationOption.tracking?this._map.getView().setCenter(t):this.styles.geoMarker.getImage().setRotation(r.markAngle)}}ComputDirection(){let t=this._map.getPixelFromCoordinate(ur(this.moveNodeInfo.currentNode.coords)),e=this._map.getPixelFromCoordinate(ur(this.moveNodeInfo.nextNode.coords)),r=this._map.getPixelFromCoordinate(ur(this.moveNodeInfo.threeNode.coords)),n=(e[0]-t[0])*(r[1]-e[1])-(e[1]-t[1])*(r[0]-e[0]);return 0==n?"直行":n>0?"右":"左"}getNearestPointOnPathNetWork(t){let e;return e=t instanceof X?t:new X({geometry:new nn(t)}),cO.nearestPointOnLine(e,this.multiLinePathData)}addNavigationMarker(){this.resultSource.addFeature(this.geoMarker)}setNavigationMarker(t,e=0){let r;r=t instanceof X?t:new X({geometry:new nn(t)}),this.position.setCoordinates(r.getGeometry().getCoordinates());let n=cO.nearestPointOnLine(r,this.multiLinePathData);this.geoMarker.setGeometry(n.getGeometry()),this.styles.geoMarker.getImage().setRotation(e),this.pathLineFeature&&this.resultSource.hasFeature(this.pathLineFeature)&&this.updateNavigationMarker(n)}updateNavigationMarker(t){let e=new X({geometry:new nn(this.pathLine.getFirstCoordinate())});new X({geometry:new nn(this.pathLine.getLastCoordinate())});let r=cO.lineSlice(e,t,this.pathLineFeature);this.pathIndex=t.get("index"),this.moveNodeInfo={currentNode:this.pathNodeInfo.nodeData[this.pathIndex],nextNode:this.pathNodeInfo.nodeData[this.pathIndex+1]};let n=Xe(r.getGeometry())*this.option.navigationOption.scale;this.FeatureMoveProgressInfo={nodeNum:this.moveNodeInfo.currentNode.coordIndex,progress:n/this.option.navigationOption.totalDistance,remainingDistance:this.option.navigationOption.totalDistance-n,nextNodeDistance:Xe(new Nn([t.getGeometry().getCoordinates(),ur(this.moveNodeInfo.nextNode.coords)]))*this.option.navigationOption.scale,totalDistance:this.option.navigationOption.totalDistance,angle:""},this.pathIndex<this.pathNodeInfo.nodeData.length-2?(this.moveNodeInfo.threeNode=this.pathNodeInfo.nodeData[this.pathIndex+2],this.FeatureMoveProgressInfo.angle=this.ComputDirection()):(this.moveNodeInfo.threeNode=this.pathNodeInfo.nodeData[this.pathIndex+1],this.FeatureMoveProgressInfo.angle="直行"),this.trigger(Rm.onFeatureMoveProgress,this.FeatureMoveProgressInfo),this.oldPathLineFeature.setGeometry(r.getGeometry()),this.oldPathLineFeature.getGeometry().changed();let i=this.setAngle(ur(this.moveNodeInfo.currentNode.coords),ur(this.moveNodeInfo.nextNode.coords));this.option.navigationOption.tracking?this._map.getView().setRotation(i.viewAngle):this.styles.geoMarker.getImage().setRotation(i.markAngle),this.option.navigationOption.tracking&&this._map.getView().setCenter(t.getGeometry().getCoordinates())}getPathLine(){return this.pathLine}computerPath(t,e){let r,n;r=t instanceof X?t.getGeometry().getCoordinates():t,n=e instanceof X?e.getGeometry().getCoordinates():e,clearInterval(this.timer),this.resultSource.clear(),this.dijkstra.path(r,n)}computerPath2(t,e){let r=this.getFile("../public/tempData/铁路_简版.json","text/json"),n=this.formatJsonTo4326Json(JSON.parse(r));var i=new Gft(n,{weightFn:function(t,e,r){var n=t[0]-e[0],i=t[1]-e[1];return Math.sqrt(n*n+i*i)}});let o=cO.featureTo4326(t),s=cO.featureTo4326(e);i.findPath(o,s)}addGeoJsonUrl(t,e){let r=this.getFile(e,"text/json"),n=this.formatJsonTo3857(JSON.parse(r));this.addFeatures(t,n)}addGeoJson(t,e){this.addFeatures(t,this.formatJsonTo3857(e))}convertGeoJsontoFeatures(t){return this.formatJsonTo3857(t)}addFeatures(t,e){var r;null==(r=this._map)||r.getView().getZoom(),e.forEach((e=>{e.set("classname",t),e.get("featuretype")||e.set("featuretype",Kp.vector),Xm.getFeaturesDefaultStyle(e,25,this.autoPointSize);let r=Xm.getStyle(e.getGeometry().getType(),e.get("style"));e.setStyle(r)})),this._source.addFeatures(e)}addFeature(t,e){e.set("classname",t),this._source.addFeature(e)}getFeaturesByClassName(t){let e=[];return this._source.getFeatures().forEach((r=>{r.get("classname")==t&&e.push(r)})),e}getFeatures(t){let e=[];return this._source.getFeatures().forEach((r=>{r.get("name")==t&&e.push(r)})),e}getFeature(t){let e=null;return this._source.getFeatures().forEach((r=>{r.get("name")!=t||(e=r)})),e}removeFeatures(t){this._source.getFeatures().forEach((e=>{e.get("classname")==t&&this._source.removeFeature(e)}))}removeNavigationPath(){this.resultSource.forEachFeature((t=>{t!=this.geoMarker&&this.resultSource.removeFeature(t)}))}removeNavigationMarker(){this.resultSource.removeFeature(this.geoMarker)}removeNavigationAll(){this.resultSource.clear()}pathToGeoJSON(){return(new kf).writeFeaturesObject(this.routeFeatures,{dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})}appendTo(t){var e;this._map=t,this.layer&&(null==(e=this._map)||e.addLayer(this.layer),this.isAdded=!0)}},PbfLayer:class extends Gm{constructor(t,r){super(t,r),e(this,"_source"),this.layertype="PbfLayer",this.layerid=t,this._source=new If({format:new NA,url:r.url,tileLoadFunction:function(t,e){t.setLoader((function(r,n,i){fetch(e).then((function(e){e.arrayBuffer().then((function(e){const n=t.getFormat().readFeatures(e,{extent:r,featureProjection:i});let o=[];n.forEach((t=>{let e=BA(t);e.set("movestate",!0),e.set("editstate",!0),o.push(BA(t))})),t.setFeatures(o)}))}))}))}});const n=new ji({fill:new Tn({color:"#eeeeee"}),stroke:new Rn({color:"#eeeeee",width:1})});this.layer=new of({zIndex:r.zIndex,source:this._source,style:function(t){return r.featureStyle&&r.featureStyle.forEach((e=>{if(t.get(e.propertiesName)==e.propertiesValue)return n.getFill().setColor(e.fillColor),n.getStroke().setColor(e.strokeColor),void n.getStroke().setWidth(e.strokeWidth)})),n}}),this.layer.set("layerid",t)}},TifLayer:class extends aU{constructor(t,e){super(t,e),this.layertype="GeoTIFFLayer",this.layerSource=new Tk({sources:[{url:this.option.url}]}),this.layer=new Vp({source:this.layerSource}),this.layer.set("layerid",t),this.mImageExtent&&this.layer.setExtent(this.mImageExtent),this.layerSource.on("tileloadstart",(t=>{this.trigger(Um.tileloadstart,t)})),this.layerSource.on("tileloadend",(t=>{this.trigger(Um.tileloadend,t)})),this.layerSource.on("tileloaderror",(t=>{this.trigger(Um.tileloaderror,t)}))}padLeft(t,e,r){let n=t.toString(r||10);return(new Array(e).join("0")+n).slice(-e)}},TileTencentLayer:jU,TileXyzLayer:QU,WfsLayer:class extends IO{constructor(t,r){super(t,r),e(this,"geoserverData"),this.layertype="WfsLayer";const n=this.option.url;this._source=new Aa({format:new kf,url:function(t){return n+"&version=1.1.0&request=GetFeature&typename=xianjie1:2020年初县级矢量3857&outputFormat=application/json&srsname=EPSG:3857&NaN"+t.join(",")+",EPSG:3857"},strategy:oa}),this.layer=new Zs({source:this._source,style:new ji({stroke:new Rn({color:"rgba(0, 0, 255, 1.0)",width:2})})}),this.layer.set("layerid",t),this.geoserverData={wsName:"",uri:"mars",wfsURL:this.option.url,layer:"hfty"}}loadData(){var t={srcName:"EPSG:3857",featureNS:this.geoserverData.uri,featurePrefix:this.geoserverData.wsName,featureTypes:[this.geoserverData.layer],outputFormat:"application/json"},e=(new uft).writeGetFeature(t);fetch(this.geoserverData.wfsURL,{method:"POST",body:(new XMLSerializer).serializeToString(e)}).then((function(t){return t.json()})).then((t=>{var e=new kf({geometryName:"geom"}).readFeatures(t);this._source&&this.addFeatures("wms",e)}))}},WmsLayer:class extends aU{constructor(t,e){super(t,e),this.layertype="ImageWMSLayer",this.layerSource=new qk(e),this.layer=new Wc({source:this.layerSource}),this.layer.set("layerid",t),this.mImageExtent&&this.layer.setExtent(this.mImageExtent),this.layerSource.on("tileloadstart",(function(){})),this.layerSource.on("tileloadend",(function(){})),this.layerSource.on("tileloaderror",(function(){}))}},WmtsLayer:class extends aU{constructor(t,e){super(t,e),this.layertype="ImageWMSLayer",this.option=Object.assign({},{opacity:.7,attributions:"",layer:"",matrixSet:"GoogleMapsCompatible",format:"image/png"},e);const r=nr("EPSG:3857"),n=r.getExtent(),i=$t(n)/256,o=new Array(19),s=new Array(19);for(let a=0;a<19;++a)o[a]=i/Math.pow(2,a),s[a]=a;this.layerSource=new Jk({attributions:this.option.attributions,url:this.option.url,layer:this.option.layer,matrixSet:this.option.matrixSet,format:this.option.format,projection:r,tileGrid:new Xk({origin:Zt(n),resolutions:o,matrixIds:s}),style:"default",wrapX:!0}),this.layer=new Vf({zIndex:this.option.zIndex,opacity:this.option.opacity,source:this.layerSource}),this.layer.set("layerid",t),this.mImageExtent&&this.layer.setExtent(this.mImageExtent),this.layerSource.on("tileloadstart",(function(){})),this.layerSource.on("tileloadend",(function(){})),this.layerSource.on("tileloaderror",(function(){}))}},XWebGLPointsLayer:class extends Gm{constructor(t,e){super(t,e),this.layertype="XWebGLPointsLayer",this._source=new Aa({wrapX:!1}),this.Layer=new Qp({source:this._source,style:{symbol:{symbolType:"circle",size:["interpolate",["exponential",2.5],["zoom"],2,1,12,8,16,12],color:"#ffed02",offset:[0,0],opacity:.95}},disableHitDetection:!1,colorCallback:function(t,e,r){},attributes:[{name:"color",callback:function(t){}},{name:"size",callback:function(t){}},{name:"GraphicColor",callback:function(t){}}]}),this.Layer.on(Rm.onClick,(t=>{t.feature&&this.trigger(Rm.onClick,t.feature.getProperties())}))}appendTo(t){var e;this._map=t,null==(e=this._map)||e.addLayer(this.Layer)}addGeoJson(t,e){let r=this.formatJsonTo3857(e);this.addFeatures(t,r)}addFeatures(t,e){var r;let n=null==(r=this._map)?void 0:r.getView().getZoom();e.forEach((e=>{e.set("classname",t),e.get("featuretype")||e.set("featuretype",Kp.vector);let r=Xm.getFeaturesDefaultStyle(e,n,!1);e.setStyle(r)})),this._source.addFeatures(e)}},imageLayer:bD,kmlLayer:class extends IO{constructor(t,e){super(t,e),this.option={},Object.assign(this.option,e),this.layertype="KmlLayer",this._source=new Aa({url:e.url,format:new sAt({extractStyles:!1})}),this.layer=new Zs({source:this._source,zIndex:e.zIndex}),this.layer.set("layerid",t),this.layer.on(Rm.onClick,(t=>{t.feature&&this.trigger(Rm.onClick,t.feature.getProperties())}))}}},Symbol.toStringTag,{value:"Module"})),Kft=Object.freeze(Object.defineProperty({__proto__:null,getJSON:function(t){const e=new XMLHttpRequest;return e.open("get",t,!1),e.setRequestHeader("content-type","application/json"),e.send(),JSON.parse(e.response)}},Symbol.toStringTag,{value:"Module"}));class qft{constructor(t){e(this,"option"),this.option={key:"50da1a3686015849769f4a414bfdfb8f"},this.option=Object.assign({},this.option,t)}}const Wft=Object.freeze(Object.defineProperty({__proto__:null,GaodePOI:class extends qft{constructor(t){super(t)}query(t){let e=new wO,r={serverUrl:"",queryType:1,keywords:"",location:"",radius:"3000",city:"西安市",city_limit:!0,polygon:"",extensions:"base",offset:20,page:1,success:null,error:null};r=Object.assign({},r,t);let n=[{type:"周边搜索",url:r.serverUrl+"/v3/place/around",parameters:{key:this.option.key,keywords:r.keywords,location:r.location,radius:r.radius,offset:r.offset,page:r.page}},{type:"关键字搜索",url:r.serverUrl+"/v3/place/text",parameters:{key:this.option.key,keywords:r.keywords,city:t.city,city_limit:t.city_limit,offset:r.offset,page:r.page}},{type:"多边形区域搜索",url:r.serverUrl+"/v3/place/polygon",parameters:{key:this.option.key,keywords:t.keywords,polygon:t.polygon,offset:r.offset,page:r.page}}];r.keywords=r.keywords.replace("","|"),mO(n[r.queryType].url+gO(n[r.queryType].parameters)).then((function(r){r.pois.forEach((t=>{let r=t.location.split(","),n=e.gcj02ToWgs84(parseFloat(r[1]),parseFloat(r[0]));t.lnglat=[n.lontitude,n.latitude]})),t.success(r)})).catch((function(e){t.error&&t.error(e)}))}queryUrl(){}},GaodeRoute:class extends qft{constructor(t){super(t)}query(t){let e=new wO,r=[{type:"驾车",url:t.serverUrl+"/v3/direction/driving"},{type:"步行",url:t.serverUrl+"/v3/direction/walking"},{type:"公交",url:t.serverUrl+"/v3/direction/transit/integrated"}];t.params.key=this.option.key,mO(r[t.queryType].url+gO(t.params)).then((function(r){r.route.paths.forEach((t=>{t.points=[],t.steps.forEach((r=>{r.polyline.split(";").forEach((r=>{let n=r.split(","),i=e.gcj02ToWgs84(parseFloat(n[1]),parseFloat(n[0]));t.points.push([i.lontitude,i.latitude])}))}))})),t.success(r)})).catch((function(e){t.error&&t.error(e)}))}}},Symbol.toStringTag,{value:"Module"}));function Xft(t,e){let r=t.length-e,n=0;do{for(let r=e;r>0;r--)t[n+e]+=t[n],n++;r-=e}while(r>0)}function Yft(t,e,r){let n=0,i=t.length;const o=i/r;for(;i>e;){for(let r=e;r>0;--r)t[n+e]+=t[n],++n;i-=e}const s=t.slice();for(let a=0;a<o;++a)for(let e=0;e<r;++e)t[r*a+e]=s[(r-e-1)*o+a]}class Zft{async decode(t,e){const r=await this.decodeBlock(e),n=t.Predictor||1;if(1!==n){const e=!t.StripOffsets;return function(t,e,r,n,i,o){if(!e||1===e)return t;for(let l=0;l<i.length;++l){if(i[l]%8!=0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(i[l]!==i[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const s=i[0]/8,a=2===o?1:i.length;for(let l=0;l<n&&!(l*a*r*s>=t.byteLength);++l){let n;if(2===e){switch(i[0]){case 8:n=new Uint8Array(t,l*a*r*s,a*r*s);break;case 16:n=new Uint16Array(t,l*a*r*s,a*r*s/2);break;case 32:n=new Uint32Array(t,l*a*r*s,a*r*s/4);break;default:throw new Error(`Predictor 2 not allowed with ${i[0]} bits per sample.`)}Xft(n,a)}else 3===e&&(n=new Uint8Array(t,l*a*r*s,a*r*s),Yft(n,a,s))}return t}(r,n,e?t.TileWidth:t.ImageWidth,e?t.TileLength:t.RowsPerStrip||t.ImageLength,t.BitsPerSample,t.PlanarConfiguration)}return r}}const Jft=Object.freeze(Object.defineProperty({__proto__:null,default:class extends Zft{decodeBlock(t){return t}}},Symbol.toStringTag,{value:"Module"})),$ft=9,tpt=257;function ept(t,e){for(let r=e.length-1;r>=0;r--)t.push(e[r]);return t}const rpt=Object.freeze(Object.defineProperty({__proto__:null,default:class extends Zft{decodeBlock(t){return function(t){const e=new Uint16Array(4093),r=new Uint8Array(4093);for(let p=0;p<=257;p++)e[p]=4096,r[p]=p;let n=258,i=$ft,o=0;function s(){n=258,i=$ft}function a(t){const e=function(t,e,r){const n=e%8,i=Math.floor(e/8),o=8-n,s=e+r-8*(i+1);let a=8*(i+2)-(e+r);const l=8*(i+2)-e;if(a=Math.max(0,a),i>=t.length)return tpt;let u=t[i]&2**(8-n)-1;u<<=r-o;let h=u;if(i+1<t.length){let e=t[i+1]>>>a;e<<=Math.max(0,r-l),h+=e}if(s>8&&i+2<t.length){const n=8*(i+3)-(e+r);h+=t[i+2]>>>n}return h}(t,o,i);return o+=i,e}function l(t,i){return r[n]=i,e[n]=t,n++,n-1}function u(t){const n=[];for(let i=t;4096!==i;i=e[i])n.push(r[i]);return n}const h=[];s();const c=new Uint8Array(t);let A,f=a(c);for(;f!==tpt;){if(256===f){for(s(),f=a(c);256===f;)f=a(c);if(f===tpt)break;if(f>256)throw new Error(`corrupted code at scanline ${f}`);ept(h,u(f)),A=f}else if(f<n){const t=u(f);ept(h,t),l(A,t[t.length-1]),A=f}else{const t=u(A);if(!t)throw new Error(`Bogus entry. Not in dictionary, ${A} / ${n}, position: ${o}`);ept(h,t),h.push(t[t.length-1]),l(A,t[t.length-1]),A=f}n+1>=2**i&&(12===i?A=void 0:i++),f=a(c)}return new Uint8Array(h)}(t).buffer}}},Symbol.toStringTag,{value:"Module"})),npt=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),ipt=4017,opt=799,spt=3406,apt=2276,lpt=1567,upt=3784,hpt=5793,cpt=2896;function Apt(t,e){let r=0;const n=[];let i=16;for(;i>0&&!t[i-1];)--i;n.push({children:[],index:0});let o,s=n[0];for(let a=0;a<i;a++){for(let i=0;i<t[a];i++){for(s=n.pop(),s.children[s.index]=e[r];s.index>0;)s=n.pop();for(s.index++,n.push(s);n.length<=a;)n.push(o={children:[],index:0}),s.children[s.index]=o.children,s=o;r++}a+1<i&&(n.push(o={children:[],index:0}),s.children[s.index]=o.children,s=o)}return n[0].children}function fpt(t,e,r,n,i,o,s,a,l){const{mcusPerLine:u,progressive:h}=r,c=e;let A=e,f=0,p=0;function d(){if(p>0)return p--,f>>p&1;if(f=t[A++],255===f){const e=t[A++];if(e)throw new Error(`unexpected marker: ${(f<<8|e).toString(16)}`)}return p=7,f>>>7}function g(t){let e,r=t;for(;null!==(e=d());){if(r=r[e],"number"==typeof r)return r;if("object"!=typeof r)throw new Error("invalid huffman sequence")}return null}function y(t){let e=t,r=0;for(;e>0;){const t=d();if(null===t)return;r=r<<1|t,--e}return r}function m(t){const e=y(t);return e>=1<<t-1?e:e+(-1<<t)+1}let v,_=0,w=0;function b(t,e,r,n,i){const o=r%u,s=(r/u|0)*t.v+n,a=o*t.h+i;e(t,t.blocks[s][a])}function x(t,e,r){const n=r/t.blocksPerLine|0,i=r%t.blocksPerLine;e(t,t.blocks[n][i])}const E=n.length;let C,S,B,I,P,T;T=h?0===o?0===a?function(t,e){const r=g(t.huffmanTableDC),n=0===r?0:m(r)<<l;t.pred+=n,e[0]=t.pred}:function(t,e){e[0]|=d()<<l}:0===a?function(t,e){if(_>0)return void _--;let r=o;const n=s;for(;r<=n;){const n=g(t.huffmanTableAC),i=15&n,o=n>>4;if(0===i){if(o<15){_=y(o)+(1<<o)-1;break}r+=16}else r+=o,e[npt[r]]=m(i)*(1<<l),r++}}:function(t,e){let r=o;const n=s;let i=0;for(;r<=n;){const n=npt[r],o=e[n]<0?-1:1;switch(w){case 0:{const e=g(t.huffmanTableAC),r=15&e;if(i=e>>4,0===r)i<15?(_=y(i)+(1<<i),w=4):(i=16,w=1);else{if(1!==r)throw new Error("invalid ACn encoding");v=m(r),w=i?2:3}continue}case 1:case 2:e[n]?e[n]+=(d()<<l)*o:(i--,0===i&&(w=2===w?3:0));break;case 3:e[n]?e[n]+=(d()<<l)*o:(e[n]=v<<l,w=0);break;case 4:e[n]&&(e[n]+=(d()<<l)*o)}r++}4===w&&(_--,0===_&&(w=0))}:function(t,e){const r=g(t.huffmanTableDC),n=0===r?0:m(r);t.pred+=n,e[0]=t.pred;let i=1;for(;i<64;){const r=g(t.huffmanTableAC),n=15&r,o=r>>4;if(0===n){if(o<15)break;i+=16}else i+=o,e[npt[i]]=m(n),i++}};let F,M,L=0;M=1===E?n[0].blocksPerLine*n[0].blocksPerColumn:u*r.mcusPerColumn;const O=i||M;for(;L<M;){for(S=0;S<E;S++)n[S].pred=0;if(_=0,1===E)for(C=n[0],P=0;P<O;P++)x(C,T,L),L++;else for(P=0;P<O;P++){for(S=0;S<E;S++){C=n[S];const{h:t,v:e}=C;for(B=0;B<e;B++)for(I=0;I<t;I++)b(C,T,L,B,I)}if(L++,L===M)break}if(p=0,F=t[A]<<8|t[A+1],F<65280)throw new Error("marker was not found");if(!(F>=65488&&F<=65495))break;A+=2}return A-c}function ppt(t,e){const r=[],{blocksPerLine:n,blocksPerColumn:i}=e,o=n<<3,s=new Int32Array(64),a=new Uint8Array(64);function l(t,r,n){const i=e.quantizationTable;let o,s,a,l,u,h,c,A,f;const p=n;let d;for(d=0;d<64;d++)p[d]=t[d]*i[d];for(d=0;d<8;++d){const t=8*d;0!==p[1+t]||0!==p[2+t]||0!==p[3+t]||0!==p[4+t]||0!==p[5+t]||0!==p[6+t]||0!==p[7+t]?(o=hpt*p[0+t]+128>>8,s=hpt*p[4+t]+128>>8,a=p[2+t],l=p[6+t],u=cpt*(p[1+t]-p[7+t])+128>>8,A=cpt*(p[1+t]+p[7+t])+128>>8,h=p[3+t]<<4,c=p[5+t]<<4,f=o-s+1>>1,o=o+s+1>>1,s=f,f=a*upt+l*lpt+128>>8,a=a*lpt-l*upt+128>>8,l=f,f=u-c+1>>1,u=u+c+1>>1,c=f,f=A+h+1>>1,h=A-h+1>>1,A=f,f=o-l+1>>1,o=o+l+1>>1,l=f,f=s-a+1>>1,s=s+a+1>>1,a=f,f=u*apt+A*spt+2048>>12,u=u*spt-A*apt+2048>>12,A=f,f=h*opt+c*ipt+2048>>12,h=h*ipt-c*opt+2048>>12,c=f,p[0+t]=o+A,p[7+t]=o-A,p[1+t]=s+c,p[6+t]=s-c,p[2+t]=a+h,p[5+t]=a-h,p[3+t]=l+u,p[4+t]=l-u):(f=hpt*p[0+t]+512>>10,p[0+t]=f,p[1+t]=f,p[2+t]=f,p[3+t]=f,p[4+t]=f,p[5+t]=f,p[6+t]=f,p[7+t]=f)}for(d=0;d<8;++d){const t=d;0!==p[8+t]||0!==p[16+t]||0!==p[24+t]||0!==p[32+t]||0!==p[40+t]||0!==p[48+t]||0!==p[56+t]?(o=hpt*p[0+t]+2048>>12,s=hpt*p[32+t]+2048>>12,a=p[16+t],l=p[48+t],u=cpt*(p[8+t]-p[56+t])+2048>>12,A=cpt*(p[8+t]+p[56+t])+2048>>12,h=p[24+t],c=p[40+t],f=o-s+1>>1,o=o+s+1>>1,s=f,f=a*upt+l*lpt+2048>>12,a=a*lpt-l*upt+2048>>12,l=f,f=u-c+1>>1,u=u+c+1>>1,c=f,f=A+h+1>>1,h=A-h+1>>1,A=f,f=o-l+1>>1,o=o+l+1>>1,l=f,f=s-a+1>>1,s=s+a+1>>1,a=f,f=u*apt+A*spt+2048>>12,u=u*spt-A*apt+2048>>12,A=f,f=h*opt+c*ipt+2048>>12,h=h*ipt-c*opt+2048>>12,c=f,p[0+t]=o+A,p[56+t]=o-A,p[8+t]=s+c,p[48+t]=s-c,p[16+t]=a+h,p[40+t]=a-h,p[24+t]=l+u,p[32+t]=l-u):(f=hpt*n[d+0]+8192>>14,p[0+t]=f,p[8+t]=f,p[16+t]=f,p[24+t]=f,p[32+t]=f,p[40+t]=f,p[48+t]=f,p[56+t]=f)}for(d=0;d<64;++d){const t=128+(p[d]+8>>4);r[d]=t<0?0:t>255?255:t}}for(let u=0;u<i;u++){const t=u<<3;for(let e=0;e<8;e++)r.push(new Uint8Array(o));for(let i=0;i<n;i++){l(e.blocks[u][i],a,s);let n=0;const o=i<<3;for(let e=0;e<8;e++){const i=r[t+e];for(let t=0;t<8;t++)i[o+t]=a[n++]}}}return r}class dpt{constructor(){this.jfif=null,this.adobe=null,this.quantizationTables=[],this.huffmanTablesAC=[],this.huffmanTablesDC=[],this.resetFrames()}resetFrames(){this.frames=[]}parse(t){let e=0;function r(){const r=t[e]<<8|t[e+1];return e+=2,r}function n(){const n=r(),i=t.subarray(e,e+n-2);return e+=i.length,i}function i(t){let e,r,n=0,i=0;for(r in t.components)t.components.hasOwnProperty(r)&&(e=t.components[r],n<e.h&&(n=e.h),i<e.v&&(i=e.v));const o=Math.ceil(t.samplesPerLine/8/n),s=Math.ceil(t.scanLines/8/i);for(r in t.components)if(t.components.hasOwnProperty(r)){e=t.components[r];const a=Math.ceil(Math.ceil(t.samplesPerLine/8)*e.h/n),l=Math.ceil(Math.ceil(t.scanLines/8)*e.v/i),u=o*e.h,h=s*e.v,c=[];for(let t=0;t<h;t++){const t=[];for(let e=0;e<u;e++)t.push(new Int32Array(64));c.push(t)}e.blocksPerLine=a,e.blocksPerColumn=l,e.blocks=c}t.maxH=n,t.maxV=i,t.mcusPerLine=o,t.mcusPerColumn=s}let o=r();if(65496!==o)throw new Error("SOI not found");for(o=r();65497!==o;){switch(o){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:{const t=n();65504===o&&74===t[0]&&70===t[1]&&73===t[2]&&70===t[3]&&0===t[4]&&(this.jfif={version:{major:t[5],minor:t[6]},densityUnits:t[7],xDensity:t[8]<<8|t[9],yDensity:t[10]<<8|t[11],thumbWidth:t[12],thumbHeight:t[13],thumbData:t.subarray(14,14+3*t[12]*t[13])}),65518===o&&65===t[0]&&100===t[1]&&111===t[2]&&98===t[3]&&101===t[4]&&0===t[5]&&(this.adobe={version:t[6],flags0:t[7]<<8|t[8],flags1:t[9]<<8|t[10],transformCode:t[11]});break}case 65499:{const n=r()+e-2;for(;e<n;){const n=t[e++],i=new Int32Array(64);if(n>>4==0)for(let r=0;r<64;r++)i[npt[r]]=t[e++];else{if(n>>4!=1)throw new Error("DQT: invalid table spec");for(let t=0;t<64;t++)i[npt[t]]=r()}this.quantizationTables[15&n]=i}break}case 65472:case 65473:case 65474:{r();const n={extended:65473===o,progressive:65474===o,precision:t[e++],scanLines:r(),samplesPerLine:r(),components:{},componentsOrder:[]},s=t[e++];let a;for(let r=0;r<s;r++){a=t[e];const r=t[e+1]>>4,i=15&t[e+1],o=t[e+2];n.componentsOrder.push(a),n.components[a]={h:r,v:i,quantizationIdx:o},e+=3}i(n),this.frames.push(n);break}case 65476:{const n=r();for(let r=2;r<n;){const n=t[e++],i=new Uint8Array(16);let o=0;for(let r=0;r<16;r++,e++)i[r]=t[e],o+=i[r];const s=new Uint8Array(o);for(let r=0;r<o;r++,e++)s[r]=t[e];r+=17+o,n>>4==0?this.huffmanTablesDC[15&n]=Apt(i,s):this.huffmanTablesAC[15&n]=Apt(i,s)}break}case 65501:r(),this.resetInterval=r();break;case 65498:{r();const n=t[e++],i=[],o=this.frames[0];for(let r=0;r<n;r++){const r=o.components[t[e++]],n=t[e++];r.huffmanTableDC=this.huffmanTablesDC[n>>4],r.huffmanTableAC=this.huffmanTablesAC[15&n],i.push(r)}const s=t[e++],a=t[e++],l=t[e++],u=fpt(t,e,o,i,this.resetInterval,s,a,l>>4,15&l);e+=u;break}case 65535:255!==t[e]&&e--;break;default:if(255===t[e-3]&&t[e-2]>=192&&t[e-2]<=254){e-=3;break}throw new Error(`unknown JPEG marker ${o.toString(16)}`)}o=r()}}getResult(){const{frames:t}=this;if(0===this.frames.length)throw new Error("no frames were decoded");this.frames.length;for(let u=0;u<this.frames.length;u++){const t=this.frames[u].components;for(const e of Object.keys(t))t[e].quantizationTable=this.quantizationTables[t[e].quantizationIdx],delete t[e].quantizationIdx}const e=t[0],{components:r,componentsOrder:n}=e,i=[],o=e.samplesPerLine,s=e.scanLines;for(let u=0;u<n.length;u++){const t=r[n[u]];i.push({lines:ppt(0,t),scaleX:t.h/e.maxH,scaleY:t.v/e.maxV})}const a=new Uint8Array(o*s*i.length);let l=0;for(let u=0;u<s;++u)for(let t=0;t<o;++t)for(let e=0;e<i.length;++e){const r=i[e];a[l]=r.lines[0|u*r.scaleY][0|t*r.scaleX],++l}return a}}const gpt=Object.freeze(Object.defineProperty({__proto__:null,default:class extends Zft{constructor(t){super(),this.reader=new dpt,t.JPEGTables&&this.reader.parse(t.JPEGTables)}decodeBlock(t){return this.reader.resetFrames(),this.reader.parse(new Uint8Array(t)),this.reader.getResult().buffer}}},Symbol.toStringTag,{value:"Module"}));
470
470
  /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function ypt(t){let e=t.length;for(;--e>=0;)t[e]=0}const mpt=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),vpt=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),_pt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),wpt=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bpt=new Array(576);ypt(bpt);const xpt=new Array(60);ypt(xpt);const Ept=new Array(512);ypt(Ept);const Cpt=new Array(256);ypt(Cpt);const Spt=new Array(29);ypt(Spt);const Bpt=new Array(30);function Ipt(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}let Ppt,Tpt,Fpt;function Mpt(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}ypt(Bpt);const Lpt=t=>t<256?Ept[t]:Ept[256+(t>>>7)],Opt=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},Npt=(t,e,r)=>{t.bi_valid>16-r?(t.bi_buf|=e<<t.bi_valid&65535,Opt(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=r-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)},Rpt=(t,e,r)=>{Npt(t,r[2*e],r[2*e+1])},kpt=(t,e)=>{let r=0;do{r|=1&t,t>>>=1,r<<=1}while(--e>0);return r>>>1},Upt=(t,e,r)=>{const n=new Array(16);let i,o,s=0;for(i=1;i<=15;i++)s=s+r[i-1]<<1,n[i]=s;for(o=0;o<=e;o++){let e=t[2*o+1];0!==e&&(t[2*o]=kpt(n[e]++,e))}},Dpt=t=>{let e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},Gpt=t=>{t.bi_valid>8?Opt(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Qpt=(t,e,r,n)=>{const i=2*e,o=2*r;return t[i]<t[o]||t[i]===t[o]&&n[e]<=n[r]},jpt=(t,e,r)=>{const n=t.heap[r];let i=r<<1;for(;i<=t.heap_len&&(i<t.heap_len&&Qpt(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!Qpt(e,n,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=n},Hpt=(t,e,r)=>{let n,i,o,s,a=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+a++],n+=(255&t.pending_buf[t.sym_buf+a++])<<8,i=t.pending_buf[t.sym_buf+a++],0===n?Rpt(t,i,e):(o=Cpt[i],Rpt(t,o+256+1,e),s=mpt[o],0!==s&&(i-=Spt[o],Npt(t,i,s)),n--,o=Lpt(n),Rpt(t,o,r),s=vpt[o],0!==s&&(n-=Bpt[o],Npt(t,n,s)))}while(a<t.sym_next);Rpt(t,256,e)},zpt=(t,e)=>{const r=e.dyn_tree,n=e.stat_desc.static_tree,i=e.stat_desc.has_stree,o=e.stat_desc.elems;let s,a,l,u=-1;for(t.heap_len=0,t.heap_max=573,s=0;s<o;s++)0!==r[2*s]?(t.heap[++t.heap_len]=u=s,t.depth[s]=0):r[2*s+1]=0;for(;t.heap_len<2;)l=t.heap[++t.heap_len]=u<2?++u:0,r[2*l]=1,t.depth[l]=0,t.opt_len--,i&&(t.static_len-=n[2*l+1]);for(e.max_code=u,s=t.heap_len>>1;s>=1;s--)jpt(t,r,s);l=o;do{s=t.heap[1],t.heap[1]=t.heap[t.heap_len--],jpt(t,r,1),a=t.heap[1],t.heap[--t.heap_max]=s,t.heap[--t.heap_max]=a,r[2*l]=r[2*s]+r[2*a],t.depth[l]=(t.depth[s]>=t.depth[a]?t.depth[s]:t.depth[a])+1,r[2*s+1]=r[2*a+1]=l,t.heap[1]=l++,jpt(t,r,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const r=e.dyn_tree,n=e.max_code,i=e.stat_desc.static_tree,o=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let u,h,c,A,f,p,d=0;for(A=0;A<=15;A++)t.bl_count[A]=0;for(r[2*t.heap[t.heap_max]+1]=0,u=t.heap_max+1;u<573;u++)h=t.heap[u],A=r[2*r[2*h+1]+1]+1,A>l&&(A=l,d++),r[2*h+1]=A,h>n||(t.bl_count[A]++,f=0,h>=a&&(f=s[h-a]),p=r[2*h],t.opt_len+=p*(A+f),o&&(t.static_len+=p*(i[2*h+1]+f)));if(0!==d){do{for(A=l-1;0===t.bl_count[A];)A--;t.bl_count[A]--,t.bl_count[A+1]+=2,t.bl_count[l]--,d-=2}while(d>0);for(A=l;0!==A;A--)for(h=t.bl_count[A];0!==h;)c=t.heap[--u],c>n||(r[2*c+1]!==A&&(t.opt_len+=(A-r[2*c+1])*r[2*c],r[2*c+1]=A),h--)}})(t,e),Upt(r,u,t.bl_count)},Vpt=(t,e,r)=>{let n,i,o=-1,s=e[1],a=0,l=7,u=4;for(0===s&&(l=138,u=3),e[2*(r+1)+1]=65535,n=0;n<=r;n++)i=s,s=e[2*(n+1)+1],++a<l&&i===s||(a<u?t.bl_tree[2*i]+=a:0!==i?(i!==o&&t.bl_tree[2*i]++,t.bl_tree[32]++):a<=10?t.bl_tree[34]++:t.bl_tree[36]++,a=0,o=i,0===s?(l=138,u=3):i===s?(l=6,u=3):(l=7,u=4))},Kpt=(t,e,r)=>{let n,i,o=-1,s=e[1],a=0,l=7,u=4;for(0===s&&(l=138,u=3),n=0;n<=r;n++)if(i=s,s=e[2*(n+1)+1],!(++a<l&&i===s)){if(a<u)do{Rpt(t,i,t.bl_tree)}while(0!=--a);else 0!==i?(i!==o&&(Rpt(t,i,t.bl_tree),a--),Rpt(t,16,t.bl_tree),Npt(t,a-3,2)):a<=10?(Rpt(t,17,t.bl_tree),Npt(t,a-3,3)):(Rpt(t,18,t.bl_tree),Npt(t,a-11,7));a=0,o=i,0===s?(l=138,u=3):i===s?(l=6,u=3):(l=7,u=4)}};let qpt=!1;const Wpt=(t,e,r,n)=>{Npt(t,0+(n?1:0),3),Gpt(t),Opt(t,r),Opt(t,~r),r&&t.pending_buf.set(t.window.subarray(e,e+r),t.pending),t.pending+=r};var Xpt={_tr_init:t=>{qpt||((()=>{let t,e,r,n,i;const o=new Array(16);for(r=0,n=0;n<28;n++)for(Spt[n]=r,t=0;t<1<<mpt[n];t++)Cpt[r++]=n;for(Cpt[r-1]=n,i=0,n=0;n<16;n++)for(Bpt[n]=i,t=0;t<1<<vpt[n];t++)Ept[i++]=n;for(i>>=7;n<30;n++)for(Bpt[n]=i<<7,t=0;t<1<<vpt[n]-7;t++)Ept[256+i++]=n;for(e=0;e<=15;e++)o[e]=0;for(t=0;t<=143;)bpt[2*t+1]=8,t++,o[8]++;for(;t<=255;)bpt[2*t+1]=9,t++,o[9]++;for(;t<=279;)bpt[2*t+1]=7,t++,o[7]++;for(;t<=287;)bpt[2*t+1]=8,t++,o[8]++;for(Upt(bpt,287,o),t=0;t<30;t++)xpt[2*t+1]=5,xpt[2*t]=kpt(t,5);Ppt=new Ipt(bpt,mpt,257,286,15),Tpt=new Ipt(xpt,vpt,0,30,15),Fpt=new Ipt(new Array(0),_pt,0,19,7)})(),qpt=!0),t.l_desc=new Mpt(t.dyn_ltree,Ppt),t.d_desc=new Mpt(t.dyn_dtree,Tpt),t.bl_desc=new Mpt(t.bl_tree,Fpt),t.bi_buf=0,t.bi_valid=0,Dpt(t)},_tr_stored_block:Wpt,_tr_flush_block:(t,e,r,n)=>{let i,o,s=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),zpt(t,t.l_desc),zpt(t,t.d_desc),s=(t=>{let e;for(Vpt(t,t.dyn_ltree,t.l_desc.max_code),Vpt(t,t.dyn_dtree,t.d_desc.max_code),zpt(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*wpt[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),i=t.opt_len+3+7>>>3,o=t.static_len+3+7>>>3,o<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==e?Wpt(t,e,r,n):4===t.strategy||o===i?(Npt(t,2+(n?1:0),3),Hpt(t,bpt,xpt)):(Npt(t,4+(n?1:0),3),((t,e,r,n)=>{let i;for(Npt(t,e-257,5),Npt(t,r-1,5),Npt(t,n-4,4),i=0;i<n;i++)Npt(t,t.bl_tree[2*wpt[i]+1],3);Kpt(t,t.dyn_ltree,e-1),Kpt(t,t.dyn_dtree,r-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),Hpt(t,t.dyn_ltree,t.dyn_dtree)),Dpt(t),n&&Gpt(t)},_tr_tally:(t,e,r)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=r,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(Cpt[r]+256+1)]++,t.dyn_dtree[2*Lpt(e)]++),t.sym_next===t.sym_end),_tr_align:t=>{Npt(t,2,3),Rpt(t,256,bpt),(t=>{16===t.bi_valid?(Opt(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}},Ypt=(t,e,r,n)=>{let i=65535&t|0,o=t>>>16&65535|0,s=0;for(;0!==r;){s=r>2e3?2e3:r,r-=s;do{i=i+e[n++]|0,o=o+i|0}while(--s);i%=65521,o%=65521}return i|o<<16|0};const Zpt=new Uint32Array((()=>{let t,e=[];for(var r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e})());var Jpt=(t,e,r,n)=>{const i=Zpt,o=n+r;t^=-1;for(let s=n;s<o;s++)t=t>>>8^i[255&(t^e[s])];return-1^t},$pt={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},tdt={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:edt,_tr_stored_block:rdt,_tr_flush_block:ndt,_tr_tally:idt,_tr_align:odt}=Xpt,{Z_NO_FLUSH:sdt,Z_PARTIAL_FLUSH:adt,Z_FULL_FLUSH:ldt,Z_FINISH:udt,Z_BLOCK:hdt,Z_OK:cdt,Z_STREAM_END:Adt,Z_STREAM_ERROR:fdt,Z_DATA_ERROR:pdt,Z_BUF_ERROR:ddt,Z_DEFAULT_COMPRESSION:gdt,Z_FILTERED:ydt,Z_HUFFMAN_ONLY:mdt,Z_RLE:vdt,Z_FIXED:_dt,Z_DEFAULT_STRATEGY:wdt,Z_UNKNOWN:bdt,Z_DEFLATED:xdt}=tdt,Edt=286,Cdt=30,Sdt=19,Bdt=2*Edt+1,Idt=15,Pdt=258,Tdt=262,Fdt=42,Mdt=113,Ldt=666,Odt=(t,e)=>(t.msg=$pt[e],e),Ndt=t=>2*t-(t>4?9:0),Rdt=t=>{let e=t.length;for(;--e>=0;)t[e]=0},kdt=t=>{let e,r,n,i=t.w_size;e=t.hash_size,n=e;do{r=t.head[--n],t.head[n]=r>=i?r-i:0}while(--e);e=i,n=e;do{r=t.prev[--n],t.prev[n]=r>=i?r-i:0}while(--e)};let Udt=(t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask;const Ddt=t=>{const e=t.state;let r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+r),t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))},Gdt=(t,e)=>{ndt(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Ddt(t.strm)},Qdt=(t,e)=>{t.pending_buf[t.pending++]=e},jdt=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},Hdt=(t,e,r,n)=>{let i=t.avail_in;return i>n&&(i=n),0===i?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),r),1===t.state.wrap?t.adler=Ypt(t.adler,e,i,r):2===t.state.wrap&&(t.adler=Jpt(t.adler,e,i,r)),t.next_in+=i,t.total_in+=i,i)},zdt=(t,e)=>{let r,n,i=t.max_chain_length,o=t.strstart,s=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Tdt?t.strstart-(t.w_size-Tdt):0,u=t.window,h=t.w_mask,c=t.prev,A=t.strstart+Pdt;let f=u[o+s-1],p=u[o+s];t.prev_length>=t.good_match&&(i>>=2),a>t.lookahead&&(a=t.lookahead);do{if(r=e,u[r+s]===p&&u[r+s-1]===f&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<A);if(n=Pdt-(A-o),o=A-Pdt,n>s){if(t.match_start=e,s=n,n>=a)break;f=u[o+s-1],p=u[o+s]}}}while((e=c[e&h])>l&&0!=--i);return s<=t.lookahead?s:t.lookahead},Vdt=t=>{const e=t.w_size;let r,n,i;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Tdt)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),kdt(t),n+=e),0===t.strm.avail_in)break;if(r=Hdt(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=r,t.lookahead+t.insert>=3)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=Udt(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=Udt(t,t.ins_h,t.window[i+3-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<Tdt&&0!==t.strm.avail_in)},Kdt=(t,e)=>{let r,n,i,o=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,s=0,a=t.strm.avail_in;do{if(r=65535,i=t.bi_valid+42>>3,t.strm.avail_out<i)break;if(i=t.strm.avail_out-i,n=t.strstart-t.block_start,r>n+t.strm.avail_in&&(r=n+t.strm.avail_in),r>i&&(r=i),r<o&&(0===r&&e!==udt||e===sdt||r!==n+t.strm.avail_in))break;s=e===udt&&r===n+t.strm.avail_in?1:0,rdt(t,0,0,s),t.pending_buf[t.pending-4]=r,t.pending_buf[t.pending-3]=r>>8,t.pending_buf[t.pending-2]=~r,t.pending_buf[t.pending-1]=~r>>8,Ddt(t.strm),n&&(n>r&&(n=r),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,r-=n),r&&(Hdt(t.strm,t.strm.output,t.strm.next_out,r),t.strm.next_out+=r,t.strm.avail_out-=r,t.strm.total_out+=r)}while(0===s);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),s?4:e!==sdt&&e!==udt&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(i=t.window_size-t.strstart,t.strm.avail_in>i&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,i+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),i>t.strm.avail_in&&(i=t.strm.avail_in),i&&(Hdt(t.strm,t.window,t.strstart,i),t.strstart+=i,t.insert+=i>t.w_size-t.insert?t.w_size-t.insert:i),t.high_water<t.strstart&&(t.high_water=t.strstart),i=t.bi_valid+42>>3,i=t.pending_buf_size-i>65535?65535:t.pending_buf_size-i,o=i>t.w_size?t.w_size:i,n=t.strstart-t.block_start,(n>=o||(n||e===udt)&&e!==sdt&&0===t.strm.avail_in&&n<=i)&&(r=n>i?i:n,s=e===udt&&0===t.strm.avail_in&&r===n?1:0,rdt(t,t.block_start,r,s),t.block_start+=r,Ddt(t.strm)),s?3:1)},qdt=(t,e)=>{let r,n;for(;;){if(t.lookahead<Tdt){if(Vdt(t),t.lookahead<Tdt&&e===sdt)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=Udt(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-Tdt&&(t.match_length=zdt(t,r)),t.match_length>=3)if(n=idt(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=Udt(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=Udt(t,t.ins_h,t.window[t.strstart+1]);else n=idt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(Gdt(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===udt?(Gdt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Gdt(t,!1),0===t.strm.avail_out)?1:2},Wdt=(t,e)=>{let r,n,i;for(;;){if(t.lookahead<Tdt){if(Vdt(t),t.lookahead<Tdt&&e===sdt)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=Udt(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-Tdt&&(t.match_length=zdt(t,r),t.match_length<=5&&(t.strategy===ydt||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-3,n=idt(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=Udt(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(Gdt(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=idt(t,0,t.window[t.strstart-1]),n&&Gdt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=idt(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===udt?(Gdt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Gdt(t,!1),0===t.strm.avail_out)?1:2};function Xdt(t,e,r,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=i}const Ydt=[new Xdt(0,0,0,0,Kdt),new Xdt(4,4,8,4,qdt),new Xdt(4,5,16,8,qdt),new Xdt(4,6,32,32,qdt),new Xdt(4,4,16,16,Wdt),new Xdt(8,16,32,32,Wdt),new Xdt(8,16,128,128,Wdt),new Xdt(8,32,128,256,Wdt),new Xdt(32,128,258,1024,Wdt),new Xdt(32,258,258,4096,Wdt)];function Zdt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=xdt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(2*Bdt),this.dyn_dtree=new Uint16Array(2*(2*Cdt+1)),this.bl_tree=new Uint16Array(2*(2*Sdt+1)),Rdt(this.dyn_ltree),Rdt(this.dyn_dtree),Rdt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Idt+1),this.heap=new Uint16Array(2*Edt+1),Rdt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Edt+1),Rdt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Jdt=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Fdt&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Mdt&&e.status!==Ldt?1:0},$dt=t=>{if(Jdt(t))return Odt(t,fdt);t.total_in=t.total_out=0,t.data_type=bdt;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?Fdt:Mdt,t.adler=2===e.wrap?0:1,e.last_flush=-2,edt(e),cdt},tgt=t=>{const e=$dt(t);var r;return e===cdt&&((r=t.state).window_size=2*r.w_size,Rdt(r.head),r.max_lazy_match=Ydt[r.level].max_lazy,r.good_match=Ydt[r.level].good_length,r.nice_match=Ydt[r.level].nice_length,r.max_chain_length=Ydt[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),e},egt=(t,e,r,n,i,o)=>{if(!t)return fdt;let s=1;if(e===gdt&&(e=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),i<1||i>9||r!==xdt||n<8||n>15||e<0||e>9||o<0||o>_dt||8===n&&1!==s)return Odt(t,fdt);8===n&&(n=9);const a=new Zdt;return t.state=a,a.strm=t,a.status=Fdt,a.wrap=s,a.gzhead=null,a.w_bits=n,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=i+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+3-1)/3),a.window=new Uint8Array(2*a.w_size),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<i+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new Uint8Array(a.pending_buf_size),a.sym_buf=a.lit_bufsize,a.sym_end=3*(a.lit_bufsize-1),a.level=e,a.strategy=o,a.method=r,tgt(t)};var rgt={deflateInit:(t,e)=>egt(t,e,xdt,15,8,wdt),deflateInit2:egt,deflateReset:tgt,deflateResetKeep:$dt,deflateSetHeader:(t,e)=>Jdt(t)||2!==t.state.wrap?fdt:(t.state.gzhead=e,cdt),deflate:(t,e)=>{if(Jdt(t)||e>hdt||e<0)return t?Odt(t,fdt):fdt;const r=t.state;if(!t.output||0!==t.avail_in&&!t.input||r.status===Ldt&&e!==udt)return Odt(t,0===t.avail_out?ddt:fdt);const n=r.last_flush;if(r.last_flush=e,0!==r.pending){if(Ddt(t),0===t.avail_out)return r.last_flush=-1,cdt}else if(0===t.avail_in&&Ndt(e)<=Ndt(n)&&e!==udt)return Odt(t,ddt);if(r.status===Ldt&&0!==t.avail_in)return Odt(t,ddt);if(r.status===Fdt&&0===r.wrap&&(r.status=Mdt),r.status===Fdt){let e=xdt+(r.w_bits-8<<4)<<8,n=-1;if(n=r.strategy>=mdt||r.level<2?0:r.level<6?1:6===r.level?2:3,e|=n<<6,0!==r.strstart&&(e|=32),e+=31-e%31,jdt(r,e),0!==r.strstart&&(jdt(r,t.adler>>>16),jdt(r,65535&t.adler)),t.adler=1,r.status=Mdt,Ddt(t),0!==r.pending)return r.last_flush=-1,cdt}if(57===r.status)if(t.adler=0,Qdt(r,31),Qdt(r,139),Qdt(r,8),r.gzhead)Qdt(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Qdt(r,255&r.gzhead.time),Qdt(r,r.gzhead.time>>8&255),Qdt(r,r.gzhead.time>>16&255),Qdt(r,r.gzhead.time>>24&255),Qdt(r,9===r.level?2:r.strategy>=mdt||r.level<2?4:0),Qdt(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Qdt(r,255&r.gzhead.extra.length),Qdt(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Jpt(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(Qdt(r,0),Qdt(r,0),Qdt(r,0),Qdt(r,0),Qdt(r,0),Qdt(r,9===r.level?2:r.strategy>=mdt||r.level<2?4:0),Qdt(r,3),r.status=Mdt,Ddt(t),0!==r.pending)return r.last_flush=-1,cdt;if(69===r.status){if(r.gzhead.extra){let e=r.pending,n=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+n>r.pending_buf_size;){let i=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+i),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>e&&(t.adler=Jpt(t.adler,r.pending_buf,r.pending-e,e)),r.gzindex+=i,Ddt(t),0!==r.pending)return r.last_flush=-1,cdt;e=0,n-=i}let i=new Uint8Array(r.gzhead.extra);r.pending_buf.set(i.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending+=n,r.gzhead.hcrc&&r.pending>e&&(t.adler=Jpt(t.adler,r.pending_buf,r.pending-e,e)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let e,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(t.adler=Jpt(t.adler,r.pending_buf,r.pending-n,n)),Ddt(t),0!==r.pending)return r.last_flush=-1,cdt;n=0}e=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,Qdt(r,e)}while(0!==e);r.gzhead.hcrc&&r.pending>n&&(t.adler=Jpt(t.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let e,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(t.adler=Jpt(t.adler,r.pending_buf,r.pending-n,n)),Ddt(t),0!==r.pending)return r.last_flush=-1,cdt;n=0}e=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,Qdt(r,e)}while(0!==e);r.gzhead.hcrc&&r.pending>n&&(t.adler=Jpt(t.adler,r.pending_buf,r.pending-n,n))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(Ddt(t),0!==r.pending))return r.last_flush=-1,cdt;Qdt(r,255&t.adler),Qdt(r,t.adler>>8&255),t.adler=0}if(r.status=Mdt,Ddt(t),0!==r.pending)return r.last_flush=-1,cdt}if(0!==t.avail_in||0!==r.lookahead||e!==sdt&&r.status!==Ldt){let n=0===r.level?Kdt(r,e):r.strategy===mdt?((t,e)=>{let r;for(;;){if(0===t.lookahead&&(Vdt(t),0===t.lookahead)){if(e===sdt)return 1;break}if(t.match_length=0,r=idt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(Gdt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===udt?(Gdt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Gdt(t,!1),0===t.strm.avail_out)?1:2})(r,e):r.strategy===vdt?((t,e)=>{let r,n,i,o;const s=t.window;for(;;){if(t.lookahead<=Pdt){if(Vdt(t),t.lookahead<=Pdt&&e===sdt)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(i=t.strstart-1,n=s[i],n===s[++i]&&n===s[++i]&&n===s[++i])){o=t.strstart+Pdt;do{}while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&i<o);t.match_length=Pdt-(o-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(r=idt(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=idt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(Gdt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===udt?(Gdt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Gdt(t,!1),0===t.strm.avail_out)?1:2})(r,e):Ydt[r.level].func(r,e);if(3!==n&&4!==n||(r.status=Ldt),1===n||3===n)return 0===t.avail_out&&(r.last_flush=-1),cdt;if(2===n&&(e===adt?odt(r):e!==hdt&&(rdt(r,0,0,!1),e===ldt&&(Rdt(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),Ddt(t),0===t.avail_out))return r.last_flush=-1,cdt}return e!==udt?cdt:r.wrap<=0?Adt:(2===r.wrap?(Qdt(r,255&t.adler),Qdt(r,t.adler>>8&255),Qdt(r,t.adler>>16&255),Qdt(r,t.adler>>24&255),Qdt(r,255&t.total_in),Qdt(r,t.total_in>>8&255),Qdt(r,t.total_in>>16&255),Qdt(r,t.total_in>>24&255)):(jdt(r,t.adler>>>16),jdt(r,65535&t.adler)),Ddt(t),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?cdt:Adt)},deflateEnd:t=>{if(Jdt(t))return fdt;const e=t.state.status;return t.state=null,e===Mdt?Odt(t,pdt):cdt},deflateSetDictionary:(t,e)=>{let r=e.length;if(Jdt(t))return fdt;const n=t.state,i=n.wrap;if(2===i||1===i&&n.status!==Fdt||n.lookahead)return fdt;if(1===i&&(t.adler=Ypt(t.adler,e,r,0)),n.wrap=0,r>=n.w_size){0===i&&(Rdt(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(r-n.w_size,r),0),e=t,r=n.w_size}const o=t.avail_in,s=t.next_in,a=t.input;for(t.avail_in=r,t.next_in=0,t.input=e,Vdt(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=Udt(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,Vdt(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=s,t.input=a,t.avail_in=o,n.wrap=i,cdt},deflateInfo:"pako deflate (from Nodeca project)"};const ngt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var igt={assign:function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const e in r)ngt(r,e)&&(t[e]=r[e])}}return t},flattenChunks:t=>{let e=0;for(let n=0,i=t.length;n<i;n++)e+=t[n].length;const r=new Uint8Array(e);for(let n=0,i=0,o=t.length;n<o;n++){let e=t[n];r.set(e,i),i+=e.length}return r}};let ogt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(dCt){ogt=!1}const sgt=new Uint8Array(256);for(let ol=0;ol<256;ol++)sgt[ol]=ol>=252?6:ol>=248?5:ol>=240?4:ol>=224?3:ol>=192?2:1;sgt[254]=sgt[254]=1;var agt={string2buf:t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,r,n,i,o,s=t.length,a=0;for(i=0;i<s;i++)r=t.charCodeAt(i),55296==(64512&r)&&i+1<s&&(n=t.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),a+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Uint8Array(a),o=0,i=0;o<a;i++)r=t.charCodeAt(i),55296==(64512&r)&&i+1<s&&(n=t.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?e[o++]=r:r<2048?(e[o++]=192|r>>>6,e[o++]=128|63&r):r<65536?(e[o++]=224|r>>>12,e[o++]=128|r>>>6&63,e[o++]=128|63&r):(e[o++]=240|r>>>18,e[o++]=128|r>>>12&63,e[o++]=128|r>>>6&63,e[o++]=128|63&r);return e},buf2string:(t,e)=>{const r=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let n,i;const o=new Array(2*r);for(i=0,n=0;n<r;){let e=t[n++];if(e<128){o[i++]=e;continue}let s=sgt[e];if(s>4)o[i++]=65533,n+=s-1;else{for(e&=2===s?31:3===s?15:7;s>1&&n<r;)e=e<<6|63&t[n++],s--;s>1?o[i++]=65533:e<65536?o[i++]=e:(e-=65536,o[i++]=55296|e>>10&1023,o[i++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&ogt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let r="";for(let n=0;n<e;n++)r+=String.fromCharCode(t[n]);return r})(o,i)},utf8border:(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let r=e-1;for(;r>=0&&128==(192&t[r]);)r--;return r<0||0===r?e:r+sgt[t[r]]>e?r:e}},lgt=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const ugt=Object.prototype.toString,{Z_NO_FLUSH:hgt,Z_SYNC_FLUSH:cgt,Z_FULL_FLUSH:Agt,Z_FINISH:fgt,Z_OK:pgt,Z_STREAM_END:dgt,Z_DEFAULT_COMPRESSION:ggt,Z_DEFAULT_STRATEGY:ygt,Z_DEFLATED:mgt}=tdt;function vgt(t){this.options=igt.assign({level:ggt,method:mgt,chunkSize:16384,windowBits:15,memLevel:8,strategy:ygt},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new lgt,this.strm.avail_out=0;let r=rgt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==pgt)throw new Error($pt[r]);if(e.header&&rgt.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?agt.string2buf(e.dictionary):"[object ArrayBuffer]"===ugt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,r=rgt.deflateSetDictionary(this.strm,t),r!==pgt)throw new Error($pt[r]);this._dict_set=!0}}vgt.prototype.push=function(t,e){const r=this.strm,n=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=e===~~e?e:!0===e?fgt:hgt,"string"==typeof t?r.input=agt.string2buf(t):"[object ArrayBuffer]"===ugt.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(o===cgt||o===Agt)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(i=rgt.deflate(r,o),i===dgt)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=rgt.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===pgt;if(0!==r.avail_out){if(o>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},vgt.prototype.onData=function(t){this.chunks.push(t)},vgt.prototype.onEnd=function(t){t===pgt&&(this.result=igt.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};const _gt=16209;var wgt=function(t,e){let r,n,i,o,s,a,l,u,h,c,A,f,p,d,g,y,m,v,_,w,b,x,E,C;const S=t.state;r=t.next_in,E=t.input,n=r+(t.avail_in-5),i=t.next_out,C=t.output,o=i-(e-t.avail_out),s=i+(t.avail_out-257),a=S.dmax,l=S.wsize,u=S.whave,h=S.wnext,c=S.window,A=S.hold,f=S.bits,p=S.lencode,d=S.distcode,g=(1<<S.lenbits)-1,y=(1<<S.distbits)-1;t:do{f<15&&(A+=E[r++]<<f,f+=8,A+=E[r++]<<f,f+=8),m=p[A&g];e:for(;;){if(v=m>>>24,A>>>=v,f-=v,v=m>>>16&255,0===v)C[i++]=65535&m;else{if(!(16&v)){if(0==(64&v)){m=p[(65535&m)+(A&(1<<v)-1)];continue e}if(32&v){S.mode=16191;break t}t.msg="invalid literal/length code",S.mode=_gt;break t}_=65535&m,v&=15,v&&(f<v&&(A+=E[r++]<<f,f+=8),_+=A&(1<<v)-1,A>>>=v,f-=v),f<15&&(A+=E[r++]<<f,f+=8,A+=E[r++]<<f,f+=8),m=d[A&y];r:for(;;){if(v=m>>>24,A>>>=v,f-=v,v=m>>>16&255,!(16&v)){if(0==(64&v)){m=d[(65535&m)+(A&(1<<v)-1)];continue r}t.msg="invalid distance code",S.mode=_gt;break t}if(w=65535&m,v&=15,f<v&&(A+=E[r++]<<f,f+=8,f<v&&(A+=E[r++]<<f,f+=8)),w+=A&(1<<v)-1,w>a){t.msg="invalid distance too far back",S.mode=_gt;break t}if(A>>>=v,f-=v,v=i-o,w>v){if(v=w-v,v>u&&S.sane){t.msg="invalid distance too far back",S.mode=_gt;break t}if(b=0,x=c,0===h){if(b+=l-v,v<_){_-=v;do{C[i++]=c[b++]}while(--v);b=i-w,x=C}}else if(h<v){if(b+=l+h-v,v-=h,v<_){_-=v;do{C[i++]=c[b++]}while(--v);if(b=0,h<_){v=h,_-=v;do{C[i++]=c[b++]}while(--v);b=i-w,x=C}}}else if(b+=h-v,v<_){_-=v;do{C[i++]=c[b++]}while(--v);b=i-w,x=C}for(;_>2;)C[i++]=x[b++],C[i++]=x[b++],C[i++]=x[b++],_-=3;_&&(C[i++]=x[b++],_>1&&(C[i++]=x[b++]))}else{b=i-w;do{C[i++]=C[b++],C[i++]=C[b++],C[i++]=C[b++],_-=3}while(_>2);_&&(C[i++]=C[b++],_>1&&(C[i++]=C[b++]))}break}}break}}while(r<n&&i<s);_=f>>3,r-=_,f-=_<<3,A&=(1<<f)-1,t.next_in=r,t.next_out=i,t.avail_in=r<n?n-r+5:5-(r-n),t.avail_out=i<s?s-i+257:257-(i-s),S.hold=A,S.bits=f};const bgt=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),xgt=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Egt=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Cgt=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Sgt=(t,e,r,n,i,o,s,a)=>{const l=a.bits;let u,h,c,A,f,p,d=0,g=0,y=0,m=0,v=0,_=0,w=0,b=0,x=0,E=0,C=null;const S=new Uint16Array(16),B=new Uint16Array(16);let I,P,T,F=null;for(d=0;d<=15;d++)S[d]=0;for(g=0;g<n;g++)S[e[r+g]]++;for(v=l,m=15;m>=1&&0===S[m];m--);if(v>m&&(v=m),0===m)return i[o++]=20971520,i[o++]=20971520,a.bits=1,0;for(y=1;y<m&&0===S[y];y++);for(v<y&&(v=y),b=1,d=1;d<=15;d++)if(b<<=1,b-=S[d],b<0)return-1;if(b>0&&(0===t||1!==m))return-1;for(B[1]=0,d=1;d<15;d++)B[d+1]=B[d]+S[d];for(g=0;g<n;g++)0!==e[r+g]&&(s[B[e[r+g]]++]=g);if(0===t?(C=F=s,p=20):1===t?(C=bgt,F=xgt,p=257):(C=Egt,F=Cgt,p=0),E=0,g=0,d=y,f=o,_=v,w=0,c=-1,x=1<<v,A=x-1,1===t&&x>852||2===t&&x>592)return 1;for(;;){I=d-w,s[g]+1<p?(P=0,T=s[g]):s[g]>=p?(P=F[s[g]-p],T=C[s[g]-p]):(P=96,T=0),u=1<<d-w,h=1<<_,y=h;do{h-=u,i[f+(E>>w)+h]=I<<24|P<<16|T|0}while(0!==h);for(u=1<<d-1;E&u;)u>>=1;if(0!==u?(E&=u-1,E+=u):E=0,g++,0==--S[d]){if(d===m)break;d=e[r+s[g]]}if(d>v&&(E&A)!==c){for(0===w&&(w=v),f+=y,_=d-w,b=1<<_;_+w<m&&(b-=S[_+w],!(b<=0));)_++,b<<=1;if(x+=1<<_,1===t&&x>852||2===t&&x>592)return 1;c=E&A,i[c]=v<<24|_<<16|f-o|0}}return 0!==E&&(i[f+E]=d-w<<24|64<<16|0),a.bits=v,0};const{Z_FINISH:Bgt,Z_BLOCK:Igt,Z_TREES:Pgt,Z_OK:Tgt,Z_STREAM_END:Fgt,Z_NEED_DICT:Mgt,Z_STREAM_ERROR:Lgt,Z_DATA_ERROR:Ogt,Z_MEM_ERROR:Ngt,Z_BUF_ERROR:Rgt,Z_DEFLATED:kgt}=tdt,Ugt=16180,Dgt=16190,Ggt=16191,Qgt=16192,jgt=16194,Hgt=16199,zgt=16200,Vgt=16206,Kgt=16209,qgt=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function Wgt(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Xgt=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<Ugt||e.mode>16211?1:0},Ygt=t=>{if(Xgt(t))return Lgt;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Ugt,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Tgt},Zgt=t=>{if(Xgt(t))return Lgt;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Ygt(t)},Jgt=(t,e)=>{let r;if(Xgt(t))return Lgt;const n=t.state;return e<0?(r=0,e=-e):(r=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Lgt:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,Zgt(t))},$gt=(t,e)=>{if(!t)return Lgt;const r=new Wgt;t.state=r,r.strm=t,r.window=null,r.mode=Ugt;const n=Jgt(t,e);return n!==Tgt&&(t.state=null),n};let tyt,eyt,ryt=!0;const nyt=t=>{if(ryt){tyt=new Int32Array(512),eyt=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Sgt(1,t.lens,0,288,tyt,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Sgt(2,t.lens,0,32,eyt,0,t.work,{bits:5}),ryt=!1}t.lencode=tyt,t.lenbits=9,t.distcode=eyt,t.distbits=5},iyt=(t,e,r,n)=>{let i;const o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),n>=o.wsize?(o.window.set(e.subarray(r-o.wsize,r),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),o.window.set(e.subarray(r-n,r-n+i),o.wnext),(n-=i)?(o.window.set(e.subarray(r-n,r),0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0};var oyt={inflateReset:Zgt,inflateReset2:Jgt,inflateResetKeep:Ygt,inflateInit:t=>$gt(t,15),inflateInit2:$gt,inflate:(t,e)=>{let r,n,i,o,s,a,l,u,h,c,A,f,p,d,g,y,m,v,_,w,b,x,E=0;const C=new Uint8Array(4);let S,B;const I=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Xgt(t)||!t.output||!t.input&&0!==t.avail_in)return Lgt;r=t.state,r.mode===Ggt&&(r.mode=Qgt),s=t.next_out,i=t.output,l=t.avail_out,o=t.next_in,n=t.input,a=t.avail_in,u=r.hold,h=r.bits,c=a,A=l,x=Tgt;t:for(;;)switch(r.mode){case Ugt:if(0===r.wrap){r.mode=Qgt;break}for(;h<16;){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}if(2&r.wrap&&35615===u){0===r.wbits&&(r.wbits=15),r.check=0,C[0]=255&u,C[1]=u>>>8&255,r.check=Jpt(r.check,C,2,0),u=0,h=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){t.msg="incorrect header check",r.mode=Kgt;break}if((15&u)!==kgt){t.msg="unknown compression method",r.mode=Kgt;break}if(u>>>=4,h-=4,b=8+(15&u),0===r.wbits&&(r.wbits=b),b>15||b>r.wbits){t.msg="invalid window size",r.mode=Kgt;break}r.dmax=1<<r.wbits,r.flags=0,t.adler=r.check=1,r.mode=512&u?16189:Ggt,u=0,h=0;break;case 16181:for(;h<16;){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}if(r.flags=u,(255&r.flags)!==kgt){t.msg="unknown compression method",r.mode=Kgt;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=Kgt;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&4&r.wrap&&(C[0]=255&u,C[1]=u>>>8&255,r.check=Jpt(r.check,C,2,0)),u=0,h=0,r.mode=16182;case 16182:for(;h<32;){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}r.head&&(r.head.time=u),512&r.flags&&4&r.wrap&&(C[0]=255&u,C[1]=u>>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,r.check=Jpt(r.check,C,4,0)),u=0,h=0,r.mode=16183;case 16183:for(;h<16;){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&4&r.wrap&&(C[0]=255&u,C[1]=u>>>8&255,r.check=Jpt(r.check,C,2,0)),u=0,h=0,r.mode=16184;case 16184:if(1024&r.flags){for(;h<16;){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&4&r.wrap&&(C[0]=255&u,C[1]=u>>>8&255,r.check=Jpt(r.check,C,2,0)),u=0,h=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(f=r.length,f>a&&(f=a),f&&(r.head&&(b=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(o,o+f),b)),512&r.flags&&4&r.wrap&&(r.check=Jpt(r.check,n,f,o)),a-=f,o+=f,r.length-=f),r.length))break t;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===a)break t;f=0;do{b=n[o+f++],r.head&&b&&r.length<65536&&(r.head.name+=String.fromCharCode(b))}while(b&&f<a);if(512&r.flags&&4&r.wrap&&(r.check=Jpt(r.check,n,f,o)),a-=f,o+=f,b)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===a)break t;f=0;do{b=n[o+f++],r.head&&b&&r.length<65536&&(r.head.comment+=String.fromCharCode(b))}while(b&&f<a);if(512&r.flags&&4&r.wrap&&(r.check=Jpt(r.check,n,f,o)),a-=f,o+=f,b)break t}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;h<16;){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}if(4&r.wrap&&u!==(65535&r.check)){t.msg="header crc mismatch",r.mode=Kgt;break}u=0,h=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=Ggt;break;case 16189:for(;h<32;){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}t.adler=r.check=qgt(u),u=0,h=0,r.mode=Dgt;case Dgt:if(0===r.havedict)return t.next_out=s,t.avail_out=l,t.next_in=o,t.avail_in=a,r.hold=u,r.bits=h,Mgt;t.adler=r.check=1,r.mode=Ggt;case Ggt:if(e===Igt||e===Pgt)break t;case Qgt:if(r.last){u>>>=7&h,h-=7&h,r.mode=Vgt;break}for(;h<3;){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}switch(r.last=1&u,u>>>=1,h-=1,3&u){case 0:r.mode=16193;break;case 1:if(nyt(r),r.mode=Hgt,e===Pgt){u>>>=2,h-=2;break t}break;case 2:r.mode=16196;break;case 3:t.msg="invalid block type",r.mode=Kgt}u>>>=2,h-=2;break;case 16193:for(u>>>=7&h,h-=7&h;h<32;){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}if((65535&u)!=(u>>>16^65535)){t.msg="invalid stored block lengths",r.mode=Kgt;break}if(r.length=65535&u,u=0,h=0,r.mode=jgt,e===Pgt)break t;case jgt:r.mode=16195;case 16195:if(f=r.length,f){if(f>a&&(f=a),f>l&&(f=l),0===f)break t;i.set(n.subarray(o,o+f),s),a-=f,o+=f,l-=f,s+=f,r.length-=f;break}r.mode=Ggt;break;case 16196:for(;h<14;){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}if(r.nlen=257+(31&u),u>>>=5,h-=5,r.ndist=1+(31&u),u>>>=5,h-=5,r.ncode=4+(15&u),u>>>=4,h-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=Kgt;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;h<3;){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}r.lens[I[r.have++]]=7&u,u>>>=3,h-=3}for(;r.have<19;)r.lens[I[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},x=Sgt(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,x){t.msg="invalid code lengths set",r.mode=Kgt;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;E=r.lencode[u&(1<<r.lenbits)-1],g=E>>>24,y=E>>>16&255,m=65535&E,!(g<=h);){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}if(m<16)u>>>=g,h-=g,r.lens[r.have++]=m;else{if(16===m){for(B=g+2;h<B;){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}if(u>>>=g,h-=g,0===r.have){t.msg="invalid bit length repeat",r.mode=Kgt;break}b=r.lens[r.have-1],f=3+(3&u),u>>>=2,h-=2}else if(17===m){for(B=g+3;h<B;){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}u>>>=g,h-=g,b=0,f=3+(7&u),u>>>=3,h-=3}else{for(B=g+7;h<B;){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}u>>>=g,h-=g,b=0,f=11+(127&u),u>>>=7,h-=7}if(r.have+f>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=Kgt;break}for(;f--;)r.lens[r.have++]=b}}if(r.mode===Kgt)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=Kgt;break}if(r.lenbits=9,S={bits:r.lenbits},x=Sgt(1,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,x){t.msg="invalid literal/lengths set",r.mode=Kgt;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},x=Sgt(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,x){t.msg="invalid distances set",r.mode=Kgt;break}if(r.mode=Hgt,e===Pgt)break t;case Hgt:r.mode=zgt;case zgt:if(a>=6&&l>=258){t.next_out=s,t.avail_out=l,t.next_in=o,t.avail_in=a,r.hold=u,r.bits=h,wgt(t,A),s=t.next_out,i=t.output,l=t.avail_out,o=t.next_in,n=t.input,a=t.avail_in,u=r.hold,h=r.bits,r.mode===Ggt&&(r.back=-1);break}for(r.back=0;E=r.lencode[u&(1<<r.lenbits)-1],g=E>>>24,y=E>>>16&255,m=65535&E,!(g<=h);){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}if(y&&0==(240&y)){for(v=g,_=y,w=m;E=r.lencode[w+((u&(1<<v+_)-1)>>v)],g=E>>>24,y=E>>>16&255,m=65535&E,!(v+g<=h);){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}u>>>=v,h-=v,r.back+=v}if(u>>>=g,h-=g,r.back+=g,r.length=m,0===y){r.mode=16205;break}if(32&y){r.back=-1,r.mode=Ggt;break}if(64&y){t.msg="invalid literal/length code",r.mode=Kgt;break}r.extra=15&y,r.mode=16201;case 16201:if(r.extra){for(B=r.extra;h<B;){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,h-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;E=r.distcode[u&(1<<r.distbits)-1],g=E>>>24,y=E>>>16&255,m=65535&E,!(g<=h);){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}if(0==(240&y)){for(v=g,_=y,w=m;E=r.distcode[w+((u&(1<<v+_)-1)>>v)],g=E>>>24,y=E>>>16&255,m=65535&E,!(v+g<=h);){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}u>>>=v,h-=v,r.back+=v}if(u>>>=g,h-=g,r.back+=g,64&y){t.msg="invalid distance code",r.mode=Kgt;break}r.offset=m,r.extra=15&y,r.mode=16203;case 16203:if(r.extra){for(B=r.extra;h<B;){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,h-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=Kgt;break}r.mode=16204;case 16204:if(0===l)break t;if(f=A-l,r.offset>f){if(f=r.offset-f,f>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=Kgt;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),d=r.window}else d=i,p=s-r.offset,f=r.length;f>l&&(f=l),l-=f,r.length-=f;do{i[s++]=d[p++]}while(--f);0===r.length&&(r.mode=zgt);break;case 16205:if(0===l)break t;i[s++]=r.length,l--,r.mode=zgt;break;case Vgt:if(r.wrap){for(;h<32;){if(0===a)break t;a--,u|=n[o++]<<h,h+=8}if(A-=l,t.total_out+=A,r.total+=A,4&r.wrap&&A&&(t.adler=r.check=r.flags?Jpt(r.check,i,A,s-A):Ypt(r.check,i,A,s-A)),A=l,4&r.wrap&&(r.flags?u:qgt(u))!==r.check){t.msg="incorrect data check",r.mode=Kgt;break}u=0,h=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;h<32;){if(0===a)break t;a--,u+=n[o++]<<h,h+=8}if(4&r.wrap&&u!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=Kgt;break}u=0,h=0}r.mode=16208;case 16208:x=Fgt;break t;case Kgt:x=Ogt;break t;case 16210:return Ngt;default:return Lgt}return t.next_out=s,t.avail_out=l,t.next_in=o,t.avail_in=a,r.hold=u,r.bits=h,(r.wsize||A!==t.avail_out&&r.mode<Kgt&&(r.mode<Vgt||e!==Bgt))&&iyt(t,t.output,t.next_out,A-t.avail_out),c-=t.avail_in,A-=t.avail_out,t.total_in+=c,t.total_out+=A,r.total+=A,4&r.wrap&&A&&(t.adler=r.check=r.flags?Jpt(r.check,i,A,t.next_out-A):Ypt(r.check,i,A,t.next_out-A)),t.data_type=r.bits+(r.last?64:0)+(r.mode===Ggt?128:0)+(r.mode===Hgt||r.mode===jgt?256:0),(0===c&&0===A||e===Bgt)&&x===Tgt&&(x=Rgt),x},inflateEnd:t=>{if(Xgt(t))return Lgt;let e=t.state;return e.window&&(e.window=null),t.state=null,Tgt},inflateGetHeader:(t,e)=>{if(Xgt(t))return Lgt;const r=t.state;return 0==(2&r.wrap)?Lgt:(r.head=e,e.done=!1,Tgt)},inflateSetDictionary:(t,e)=>{const r=e.length;let n,i,o;return Xgt(t)?Lgt:(n=t.state,0!==n.wrap&&n.mode!==Dgt?Lgt:n.mode===Dgt&&(i=1,i=Ypt(i,e,r,0),i!==n.check)?Ogt:(o=iyt(t,e,r,r),o?(n.mode=16210,Ngt):(n.havedict=1,Tgt)))},inflateInfo:"pako inflate (from Nodeca project)"},syt=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const ayt=Object.prototype.toString,{Z_NO_FLUSH:lyt,Z_FINISH:uyt,Z_OK:hyt,Z_STREAM_END:cyt,Z_NEED_DICT:Ayt,Z_STREAM_ERROR:fyt,Z_DATA_ERROR:pyt,Z_MEM_ERROR:dyt}=tdt;function gyt(t){this.options=igt.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new lgt,this.strm.avail_out=0;let r=oyt.inflateInit2(this.strm,e.windowBits);if(r!==hyt)throw new Error($pt[r]);if(this.header=new syt,oyt.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=agt.string2buf(e.dictionary):"[object ArrayBuffer]"===ayt.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=oyt.inflateSetDictionary(this.strm,e.dictionary),r!==hyt)))throw new Error($pt[r])}function yyt(t,e){const r=new gyt(e);if(r.push(t),r.err)throw r.msg||$pt[r.err];return r.result}gyt.prototype.push=function(t,e){const r=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let o,s,a;if(this.ended)return!1;for(s=e===~~e?e:!0===e?uyt:lyt,"[object ArrayBuffer]"===ayt.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),o=oyt.inflate(r,s),o===Ayt&&i&&(o=oyt.inflateSetDictionary(r,i),o===hyt?o=oyt.inflate(r,s):o===pyt&&(o=Ayt));r.avail_in>0&&o===cyt&&r.state.wrap>0&&0!==t[r.next_in];)oyt.inflateReset(r),o=oyt.inflate(r,s);switch(o){case fyt:case pyt:case Ayt:case dyt:return this.onEnd(o),this.ended=!0,!1}if(a=r.avail_out,r.next_out&&(0===r.avail_out||o===cyt))if("string"===this.options.to){let t=agt.utf8border(r.output,r.next_out),e=r.next_out-t,i=agt.buf2string(r.output,t);r.next_out=e,r.avail_out=n-e,e&&r.output.set(r.output.subarray(t,t+e),0),this.onData(i)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(o!==hyt||0!==a){if(o===cyt)return o=oyt.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},gyt.prototype.onData=function(t){this.chunks.push(t)},gyt.prototype.onEnd=function(t){t===hyt&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=igt.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var myt={Inflate:gyt,inflate:yyt,inflateRaw:function(t,e){return(e=e||{}).raw=!0,yyt(t,e)},ungzip:yyt,constants:tdt};const{Inflate:vyt,inflate:_yt,inflateRaw:wyt,ungzip:byt}=myt;var xyt=_yt;const Eyt=Object.freeze(Object.defineProperty({__proto__:null,default:class extends Zft{decodeBlock(t){return xyt(new Uint8Array(t)).buffer}}},Symbol.toStringTag,{value:"Module"})),Cyt=Object.freeze(Object.defineProperty({__proto__:null,default:class extends Zft{decodeBlock(t){const e=new DataView(t),r=[];for(let n=0;n<t.byteLength;++n){let t=e.getInt8(n);if(t<0){const i=e.getUint8(n+1);t=-t;for(let e=0;e<=t;++e)r.push(i);n+=1}else{for(let i=0;i<=t;++i)r.push(e.getUint8(n+i+1));n+=t+1}}return new Uint8Array(r).buffer}}},Symbol.toStringTag,{value:"Module"}));var Syt={};!function(t){
471
471
  /* Copyright 2015-2021 Esri. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 @preserve */
472
472
  !function(){var e,r,n,i,o,s,a,l,u,h,c,A,f,p,d,g,y,m=(e={defaultNoDataValue:-34027999387901484e22,decode:function(t,s){var a=(s=s||{}).encodedMaskData||null===s.encodedMaskData,l=o(t,s.inputOffset||0,a),u=null!==s.noDataValue?s.noDataValue:e.defaultNoDataValue,h=r(l,s.pixelType||Float32Array,s.encodedMaskData,u,s.returnMask),c={width:l.width,height:l.height,pixelData:h.resultPixels,minValue:h.minValue,maxValue:l.pixels.maxValue,noDataValue:u};return h.resultMask&&(c.maskData=h.resultMask),s.returnEncodedMask&&l.mask&&(c.encodedMaskData=l.mask.bitset?l.mask.bitset:null),s.returnFileInfo&&(c.fileInfo=n(l),s.computeUsedBitDepths&&(c.fileInfo.bitDepths=i(l))),c}},r=function(t,e,r,n,i){var o,a,l,u=0,h=t.pixels.numBlocksX,c=t.pixels.numBlocksY,A=Math.floor(t.width/h),f=Math.floor(t.height/c),p=2*t.maxZError,d=Number.MAX_VALUE;r=r||(t.mask?t.mask.bitset:null),a=new e(t.width*t.height),i&&r&&(l=new Uint8Array(t.width*t.height));for(var g,y,m=new Float32Array(A*f),v=0;v<=c;v++){var _=v!==c?f:t.height%c;if(0!==_)for(var w=0;w<=h;w++){var b=w!==h?A:t.width%h;if(0!==b){var x,E,C,S,B=v*t.width*f+w*A,I=t.width-b,P=t.pixels.blocks[u];if(P.encoding<2?(0===P.encoding?x=P.rawData:(s(P.stuffedData,P.bitsPerPixel,P.numValidPixels,P.offset,p,m,t.pixels.maxValue),x=m),E=0):C=2===P.encoding?0:P.offset,r)for(y=0;y<_;y++){for(7&B&&(S=r[B>>3],S<<=7&B),g=0;g<b;g++)7&B||(S=r[B>>3]),128&S?(l&&(l[B]=1),d=d>(o=P.encoding<2?x[E++]:C)?o:d,a[B++]=o):(l&&(l[B]=0),a[B++]=n),S<<=1;B+=I}else if(P.encoding<2)for(y=0;y<_;y++){for(g=0;g<b;g++)d=d>(o=x[E++])?o:d,a[B++]=o;B+=I}else for(d=d>C?C:d,y=0;y<_;y++){for(g=0;g<b;g++)a[B++]=C;B+=I}if(1===P.encoding&&E!==P.numValidPixels)throw"Block and Mask do not match";u++}}}return{resultPixels:a,resultMask:l,minValue:d}},n=function(t){return{fileIdentifierString:t.fileIdentifierString,fileVersion:t.fileVersion,imageType:t.imageType,height:t.height,width:t.width,maxZError:t.maxZError,eofOffset:t.eofOffset,mask:t.mask?{numBlocksX:t.mask.numBlocksX,numBlocksY:t.mask.numBlocksY,numBytes:t.mask.numBytes,maxValue:t.mask.maxValue}:null,pixels:{numBlocksX:t.pixels.numBlocksX,numBlocksY:t.pixels.numBlocksY,numBytes:t.pixels.numBytes,maxValue:t.pixels.maxValue,noDataValue:t.noDataValue}}},i=function(t){for(var e=t.pixels.numBlocksX*t.pixels.numBlocksY,r={},n=0;n<e;n++){var i=t.pixels.blocks[n];0===i.encoding?r.float32=!0:1===i.encoding?r[i.bitsPerPixel]=!0:r[0]=!0}return Object.keys(r)},o=function(t,e,r){var n={},i=new Uint8Array(t,e,10);if(n.fileIdentifierString=String.fromCharCode.apply(null,i),"CntZImage"!==n.fileIdentifierString.trim())throw"Unexpected file identifier string: "+n.fileIdentifierString;e+=10;var o=new DataView(t,e,24);if(n.fileVersion=o.getInt32(0,!0),n.imageType=o.getInt32(4,!0),n.height=o.getUint32(8,!0),n.width=o.getUint32(12,!0),n.maxZError=o.getFloat64(16,!0),e+=24,!r)if(o=new DataView(t,e,16),n.mask={},n.mask.numBlocksY=o.getUint32(0,!0),n.mask.numBlocksX=o.getUint32(4,!0),n.mask.numBytes=o.getUint32(8,!0),n.mask.maxValue=o.getFloat32(12,!0),e+=16,n.mask.numBytes>0){var s=new Uint8Array(Math.ceil(n.width*n.height/8)),a=(o=new DataView(t,e,n.mask.numBytes)).getInt16(0,!0),l=2,u=0;do{if(a>0)for(;a--;)s[u++]=o.getUint8(l++);else{var h=o.getUint8(l++);for(a=-a;a--;)s[u++]=h}a=o.getInt16(l,!0),l+=2}while(l<n.mask.numBytes);if(-32768!==a||u<s.length)throw"Unexpected end of mask RLE encoding";n.mask.bitset=s,e+=n.mask.numBytes}else 0==(n.mask.numBytes|n.mask.numBlocksY|n.mask.maxValue)&&(n.mask.bitset=new Uint8Array(Math.ceil(n.width*n.height/8)));o=new DataView(t,e,16),n.pixels={},n.pixels.numBlocksY=o.getUint32(0,!0),n.pixels.numBlocksX=o.getUint32(4,!0),n.pixels.numBytes=o.getUint32(8,!0),n.pixels.maxValue=o.getFloat32(12,!0),e+=16;var c=n.pixels.numBlocksX,A=n.pixels.numBlocksY,f=c+(n.width%c>0?1:0),p=A+(n.height%A>0?1:0);n.pixels.blocks=new Array(f*p);for(var d=0,g=0;g<p;g++)for(var y=0;y<f;y++){var m=0,v=t.byteLength-e;o=new DataView(t,e,Math.min(10,v));var _={};n.pixels.blocks[d++]=_;var w=o.getUint8(0);if(m++,_.encoding=63&w,_.encoding>3)throw"Invalid block encoding ("+_.encoding+")";if(2!==_.encoding){if(0!==w&&2!==w){if(w>>=6,_.offsetType=w,2===w)_.offset=o.getInt8(1),m++;else if(1===w)_.offset=o.getInt16(1,!0),m+=2;else{if(0!==w)throw"Invalid block offset type";_.offset=o.getFloat32(1,!0),m+=4}if(1===_.encoding)if(w=o.getUint8(m),m++,_.bitsPerPixel=63&w,w>>=6,_.numValidPixelsType=w,2===w)_.numValidPixels=o.getUint8(m),m++;else if(1===w)_.numValidPixels=o.getUint16(m,!0),m+=2;else{if(0!==w)throw"Invalid valid pixel count type";_.numValidPixels=o.getUint32(m,!0),m+=4}}var b;if(e+=m,3!==_.encoding)if(0===_.encoding){var x=(n.pixels.numBytes-1)/4;if(x!==Math.floor(x))throw"uncompressed block has invalid length";b=new ArrayBuffer(4*x),new Uint8Array(b).set(new Uint8Array(t,e,4*x));var E=new Float32Array(b);_.rawData=E,e+=4*x}else if(1===_.encoding){var C=Math.ceil(_.numValidPixels*_.bitsPerPixel/8),S=Math.ceil(C/4);b=new ArrayBuffer(4*S),new Uint8Array(b).set(new Uint8Array(t,e,C)),_.stuffedData=new Uint32Array(b),e+=C}}else e++}return n.eofOffset=e,n},s=function(t,e,r,n,i,o,s){var a,l,u,h=(1<<e)-1,c=0,A=0,f=Math.ceil((s-n)/i),p=4*t.length-Math.ceil(e*r/8);for(t[t.length-1]<<=8*p,a=0;a<r;a++){if(0===A&&(u=t[c++],A=32),A>=e)l=u>>>A-e&h,A-=e;else{var d=e-A;l=(u&h)<<d&h,l+=(u=t[c++])>>>(A=32-d)}o[a]=l<f?n+l*i:s}return o},e),v=(a=function(t,e,r,n,i,o,s,a){var l,u,h,c,A,f=(1<<r)-1,p=0,d=0,g=4*t.length-Math.ceil(r*n/8);if(t[t.length-1]<<=8*g,i)for(l=0;l<n;l++)0===d&&(h=t[p++],d=32),d>=r?(u=h>>>d-r&f,d-=r):(u=(h&f)<<(c=r-d)&f,u+=(h=t[p++])>>>(d=32-c)),e[l]=i[u];else for(A=Math.ceil((a-o)/s),l=0;l<n;l++)0===d&&(h=t[p++],d=32),d>=r?(u=h>>>d-r&f,d-=r):(u=(h&f)<<(c=r-d)&f,u+=(h=t[p++])>>>(d=32-c)),e[l]=u<A?o+u*s:a},l=function(t,e,r,n,i,o){var s,a=(1<<e)-1,l=0,u=0,h=0,c=0,A=0,f=[],p=4*t.length-Math.ceil(e*r/8);t[t.length-1]<<=8*p;var d=Math.ceil((o-n)/i);for(u=0;u<r;u++)0===c&&(s=t[l++],c=32),c>=e?(A=s>>>c-e&a,c-=e):(A=(s&a)<<(h=e-c)&a,A+=(s=t[l++])>>>(c=32-h)),f[u]=A<d?n+A*i:o;return f.unshift(n),f},u=function(t,e,r,n,i,o,s,a){var l,u,h,c,A=(1<<r)-1,f=0,p=0,d=0;if(i)for(l=0;l<n;l++)0===p&&(h=t[f++],p=32,d=0),p>=r?(u=h>>>d&A,p-=r,d+=r):(u=h>>>d&A,p=32-(c=r-p),u|=((h=t[f++])&(1<<c)-1)<<r-c,d=c),e[l]=i[u];else{var g=Math.ceil((a-o)/s);for(l=0;l<n;l++)0===p&&(h=t[f++],p=32,d=0),p>=r?(u=h>>>d&A,p-=r,d+=r):(u=h>>>d&A,p=32-(c=r-p),u|=((h=t[f++])&(1<<c)-1)<<r-c,d=c),e[l]=u<g?o+u*s:a}return e},h=function(t,e,r,n,i,o){var s,a=(1<<e)-1,l=0,u=0,h=0,c=0,A=0,f=0,p=[],d=Math.ceil((o-n)/i);for(u=0;u<r;u++)0===c&&(s=t[l++],c=32,f=0),c>=e?(A=s>>>f&a,c-=e,f+=e):(A=s>>>f&a,c=32-(h=e-c),A|=((s=t[l++])&(1<<h)-1)<<e-h,f=h),p[u]=A<d?n+A*i:o;return p.unshift(n),p},c=function(t,e,r,n){var i,o,s,a,l=(1<<r)-1,u=0,h=0,c=4*t.length-Math.ceil(r*n/8);for(t[t.length-1]<<=8*c,i=0;i<n;i++)0===h&&(s=t[u++],h=32),h>=r?(o=s>>>h-r&l,h-=r):(o=(s&l)<<(a=r-h)&l,o+=(s=t[u++])>>>(h=32-a)),e[i]=o;return e},A=function(t,e,r,n){var i,o,s,a,l=(1<<r)-1,u=0,h=0,c=0;for(i=0;i<n;i++)0===h&&(s=t[u++],h=32,c=0),h>=r?(o=s>>>c&l,h-=r,c+=r):(o=s>>>c&l,h=32-(a=r-h),o|=((s=t[u++])&(1<<a)-1)<<r-a,c=a),e[i]=o;return e},f={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(t){for(var e=65535,r=65535,n=t.length,i=Math.floor(n/2),o=0;i;){var s=i>=359?359:i;i-=s;do{e+=t[o++]<<8,r+=e+=t[o++]}while(--s);e=(65535&e)+(e>>>16),r=(65535&r)+(r>>>16)}return 1&n&&(r+=e+=t[o]<<8),((r=(65535&r)+(r>>>16))<<16|(e=(65535&e)+(e>>>16)))>>>0},readHeaderInfo:function(t,e){var r=e.ptr,n=new Uint8Array(t,r,6),i={};if(i.fileIdentifierString=String.fromCharCode.apply(null,n),0!==i.fileIdentifierString.lastIndexOf("Lerc2",0))throw"Unexpected file identifier string (expect Lerc2 ): "+i.fileIdentifierString;r+=6;var o,s=new DataView(t,r,8),a=s.getInt32(0,!0);if(i.fileVersion=a,r+=4,a>=3&&(i.checksum=s.getUint32(4,!0),r+=4),s=new DataView(t,r,12),i.height=s.getUint32(0,!0),i.width=s.getUint32(4,!0),r+=8,a>=4?(i.numDims=s.getUint32(8,!0),r+=4):i.numDims=1,s=new DataView(t,r,40),i.numValidPixel=s.getUint32(0,!0),i.microBlockSize=s.getInt32(4,!0),i.blobSize=s.getInt32(8,!0),i.imageType=s.getInt32(12,!0),i.maxZError=s.getFloat64(16,!0),i.zMin=s.getFloat64(24,!0),i.zMax=s.getFloat64(32,!0),r+=40,e.headerInfo=i,e.ptr=r,a>=3&&(o=a>=4?52:48,this.computeChecksumFletcher32(new Uint8Array(t,r-o,i.blobSize-14))!==i.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(t,e){var r=e.headerInfo,n=this.getDataTypeArray(r.imageType),i=r.numDims*this.getDataTypeSize(r.imageType),o=this.readSubArray(t,e.ptr,n,i),s=this.readSubArray(t,e.ptr+i,n,i);e.ptr+=2*i;var a,l=!0;for(a=0;a<r.numDims;a++)if(o[a]!==s[a]){l=!1;break}return r.minValues=o,r.maxValues=s,l},readSubArray:function(t,e,r,n){var i;if(r===Uint8Array)i=new Uint8Array(t,e,n);else{var o=new ArrayBuffer(n);new Uint8Array(o).set(new Uint8Array(t,e,n)),i=new r(o)}return i},readMask:function(t,e){var r,n,i=e.ptr,o=e.headerInfo,s=o.width*o.height,a=o.numValidPixel,l=new DataView(t,i,4),u={};if(u.numBytes=l.getUint32(0,!0),i+=4,(0===a||s===a)&&0!==u.numBytes)throw"invalid mask";if(0===a)r=new Uint8Array(Math.ceil(s/8)),u.bitset=r,n=new Uint8Array(s),e.pixels.resultMask=n,i+=u.numBytes;else if(u.numBytes>0){r=new Uint8Array(Math.ceil(s/8));var h=(l=new DataView(t,i,u.numBytes)).getInt16(0,!0),c=2,A=0,f=0;do{if(h>0)for(;h--;)r[A++]=l.getUint8(c++);else for(f=l.getUint8(c++),h=-h;h--;)r[A++]=f;h=l.getInt16(c,!0),c+=2}while(c<u.numBytes);if(-32768!==h||A<r.length)throw"Unexpected end of mask RLE encoding";n=new Uint8Array(s);var p=0,d=0;for(d=0;d<s;d++)7&d?(p=r[d>>3],p<<=7&d):p=r[d>>3],128&p&&(n[d]=1);e.pixels.resultMask=n,u.bitset=r,i+=u.numBytes}return e.ptr=i,e.mask=u,!0},readDataOneSweep:function(t,e,r,n){var i,o=e.ptr,s=e.headerInfo,a=s.numDims,l=s.width*s.height,u=s.imageType,h=s.numValidPixel*f.getDataTypeSize(u)*a,c=e.pixels.resultMask;if(r===Uint8Array)i=new Uint8Array(t,o,h);else{var A=new ArrayBuffer(h);new Uint8Array(A).set(new Uint8Array(t,o,h)),i=new r(A)}if(i.length===l*a)e.pixels.resultPixels=n?f.swapDimensionOrder(i,l,a,r,!0):i;else{e.pixels.resultPixels=new r(l*a);var p=0,d=0,g=0,y=0;if(a>1){if(n){for(d=0;d<l;d++)if(c[d])for(y=d,g=0;g<a;g++,y+=l)e.pixels.resultPixels[y]=i[p++]}else for(d=0;d<l;d++)if(c[d])for(y=d*a,g=0;g<a;g++)e.pixels.resultPixels[y+g]=i[p++]}else for(d=0;d<l;d++)c[d]&&(e.pixels.resultPixels[d]=i[p++])}return o+=h,e.ptr=o,!0},readHuffmanTree:function(t,e){var r=this.HUFFMAN_LUT_BITS_MAX,n=new DataView(t,e.ptr,16);if(e.ptr+=16,n.getInt32(0,!0)<2)throw"unsupported Huffman version";var i=n.getInt32(4,!0),o=n.getInt32(8,!0),s=n.getInt32(12,!0);if(o>=s)return!1;var a=new Uint32Array(s-o);f.decodeBits(t,e,a);var l,u,h,c,A=[];for(l=o;l<s;l++)A[u=l-(l<i?0:i)]={first:a[l-o],second:null};var d=t.byteLength-e.ptr,g=Math.ceil(d/4),y=new ArrayBuffer(4*g);new Uint8Array(y).set(new Uint8Array(t,e.ptr,d));var m,v=new Uint32Array(y),_=0,w=0;for(m=v[0],l=o;l<s;l++)(c=A[u=l-(l<i?0:i)].first)>0&&(A[u].second=m<<_>>>32-c,32-_>=c?32===(_+=c)&&(_=0,m=v[++w]):(_+=c-32,m=v[++w],A[u].second|=m>>>32-_));var b,x=0,E=new p;for(l=0;l<A.length;l++)void 0!==A[l]&&(x=Math.max(x,A[l].first));b=x>=r?r:x;var C,S,B,I,P,T=[];for(l=o;l<s;l++)if((c=A[u=l-(l<i?0:i)].first)>0)if(C=[c,u],c<=b)for(S=A[u].second<<b-c,B=1<<b-c,h=0;h<B;h++)T[S|h]=C;else for(S=A[u].second,P=E,I=c-1;I>=0;I--)S>>>I&1?(P.right||(P.right=new p),P=P.right):(P.left||(P.left=new p),P=P.left),0!==I||P.val||(P.val=C[1]);return{decodeLut:T,numBitsLUTQick:b,numBitsLUT:x,tree:E,stuffedData:v,srcPtr:w,bitPos:_}},readHuffman:function(t,e,r,n){var i,o,s,a,l,u,h,c,A,p=e.headerInfo.numDims,d=e.headerInfo.height,g=e.headerInfo.width,y=g*d,m=this.readHuffmanTree(t,e),v=m.decodeLut,_=m.tree,w=m.stuffedData,b=m.srcPtr,x=m.bitPos,E=m.numBitsLUTQick,C=m.numBitsLUT,S=0===e.headerInfo.imageType?128:0,B=e.pixels.resultMask,I=0;x>0&&(b++,x=0);var P,T=w[b],F=1===e.encodeMode,M=new r(y*p),L=M;if(p<2||F){for(P=0;P<p;P++)if(p>1&&(L=new r(M.buffer,y*P,y),I=0),e.headerInfo.numValidPixel===g*d)for(c=0,u=0;u<d;u++)for(h=0;h<g;h++,c++){if(o=0,l=a=T<<x>>>32-E,32-x<E&&(l=a|=w[b+1]>>>64-x-E),v[l])o=v[l][1],x+=v[l][0];else for(l=a=T<<x>>>32-C,32-x<C&&(l=a|=w[b+1]>>>64-x-C),i=_,A=0;A<C;A++)if(!(i=a>>>C-A-1&1?i.right:i.left).left&&!i.right){o=i.val,x=x+A+1;break}x>=32&&(x-=32,T=w[++b]),s=o-S,F?(s+=h>0?I:u>0?L[c-g]:I,s&=255,L[c]=s,I=s):L[c]=s}else for(c=0,u=0;u<d;u++)for(h=0;h<g;h++,c++)if(B[c]){if(o=0,l=a=T<<x>>>32-E,32-x<E&&(l=a|=w[b+1]>>>64-x-E),v[l])o=v[l][1],x+=v[l][0];else for(l=a=T<<x>>>32-C,32-x<C&&(l=a|=w[b+1]>>>64-x-C),i=_,A=0;A<C;A++)if(!(i=a>>>C-A-1&1?i.right:i.left).left&&!i.right){o=i.val,x=x+A+1;break}x>=32&&(x-=32,T=w[++b]),s=o-S,F?(h>0&&B[c-1]?s+=I:u>0&&B[c-g]?s+=L[c-g]:s+=I,s&=255,L[c]=s,I=s):L[c]=s}}else for(c=0,u=0;u<d;u++)for(h=0;h<g;h++)if(c=u*g+h,!B||B[c])for(P=0;P<p;P++,c+=y){if(o=0,l=a=T<<x>>>32-E,32-x<E&&(l=a|=w[b+1]>>>64-x-E),v[l])o=v[l][1],x+=v[l][0];else for(l=a=T<<x>>>32-C,32-x<C&&(l=a|=w[b+1]>>>64-x-C),i=_,A=0;A<C;A++)if(!(i=a>>>C-A-1&1?i.right:i.left).left&&!i.right){o=i.val,x=x+A+1;break}x>=32&&(x-=32,T=w[++b]),s=o-S,L[c]=s}e.ptr=e.ptr+4*(b+1)+(x>0?4:0),e.pixels.resultPixels=M,p>1&&!n&&(e.pixels.resultPixels=f.swapDimensionOrder(M,y,p,r))},decodeBits:function(t,e,r,n,i){var o=e.headerInfo,s=o.fileVersion,f=0,p=t.byteLength-e.ptr>=5?5:t.byteLength-e.ptr,d=new DataView(t,e.ptr,p),g=d.getUint8(0);f++;var y=g>>6,m=0===y?4:3-y,v=(32&g)>0,_=31&g,w=0;if(1===m)w=d.getUint8(f),f++;else if(2===m)w=d.getUint16(f,!0),f+=2;else{if(4!==m)throw"Invalid valid pixel count type";w=d.getUint32(f,!0),f+=4}var b,x,E,C,S,B,I,P,T,F=2*o.maxZError,M=o.numDims>1?o.maxValues[i]:o.zMax;if(v){for(e.counter.lut++,P=d.getUint8(f),f++,C=Math.ceil((P-1)*_/8),S=Math.ceil(C/4),x=new ArrayBuffer(4*S),E=new Uint8Array(x),e.ptr+=f,E.set(new Uint8Array(t,e.ptr,C)),I=new Uint32Array(x),e.ptr+=C,T=0;P-1>>>T;)T++;C=Math.ceil(w*T/8),S=Math.ceil(C/4),x=new ArrayBuffer(4*S),(E=new Uint8Array(x)).set(new Uint8Array(t,e.ptr,C)),b=new Uint32Array(x),e.ptr+=C,B=s>=3?h(I,_,P-1,n,F,M):l(I,_,P-1,n,F,M),s>=3?u(b,r,T,w,B):a(b,r,T,w,B)}else e.counter.bitstuffer++,T=_,e.ptr+=f,T>0&&(C=Math.ceil(w*T/8),S=Math.ceil(C/4),x=new ArrayBuffer(4*S),(E=new Uint8Array(x)).set(new Uint8Array(t,e.ptr,C)),b=new Uint32Array(x),e.ptr+=C,s>=3?null==n?A(b,r,T,w):u(b,r,T,w,!1,n,F,M):null==n?c(b,r,T,w):a(b,r,T,w,!1,n,F,M))},readTiles:function(t,e,r,n){var i=e.headerInfo,o=i.width,s=i.height,a=o*s,l=i.microBlockSize,u=i.imageType,h=f.getDataTypeSize(u),c=Math.ceil(o/l),A=Math.ceil(s/l);e.pixels.numBlocksY=A,e.pixels.numBlocksX=c,e.pixels.ptr=0;var p,d,g,y,m,v,_,w,b,x,E=0,C=0,S=0,B=0,I=0,P=0,T=0,F=0,M=0,L=0,O=0,N=0,R=0,k=0,U=0,D=new r(l*l),G=s%l||l,Q=o%l||l,j=i.numDims,H=e.pixels.resultMask,z=e.pixels.resultPixels,V=i.fileVersion>=5?14:15,K=i.zMax;for(S=0;S<A;S++)for(I=S!==A-1?l:G,B=0;B<c;B++)for(L=S*o*l+B*l,O=o-(P=B!==c-1?l:Q),w=0;w<j;w++){if(j>1?(x=z,L=S*o*l+B*l,z=new r(e.pixels.resultPixels.buffer,a*w*h,a),K=i.maxValues[w]):x=null,T=t.byteLength-e.ptr,d={},U=0,F=(p=new DataView(t,e.ptr,Math.min(10,T))).getUint8(0),U++,b=i.fileVersion>=5?4&F:0,M=F>>6&255,(F>>2&V)!=(B*l>>3&V))throw"integrity issue";if(b&&0===w)throw"integrity issue";if((m=3&F)>3)throw e.ptr+=U,"Invalid block encoding ("+m+")";if(2!==m)if(0===m){if(b)throw"integrity issue";if(e.counter.uncompressed++,e.ptr+=U,N=(N=I*P*h)<(R=t.byteLength-e.ptr)?N:R,g=new ArrayBuffer(N%h==0?N:N+h-N%h),new Uint8Array(g).set(new Uint8Array(t,e.ptr,N)),y=new r(g),k=0,H)for(E=0;E<I;E++){for(C=0;C<P;C++)H[L]&&(z[L]=y[k++]),L++;L+=O}else for(E=0;E<I;E++){for(C=0;C<P;C++)z[L++]=y[k++];L+=O}e.ptr+=k*h}else if(v=f.getDataTypeUsed(b&&u<6?4:u,M),_=f.getOnePixel(d,U,v,p),U+=f.getDataTypeSize(v),3===m)if(e.ptr+=U,e.counter.constantoffset++,H)for(E=0;E<I;E++){for(C=0;C<P;C++)H[L]&&(z[L]=b?Math.min(K,x[L]+_):_),L++;L+=O}else for(E=0;E<I;E++){for(C=0;C<P;C++)z[L]=b?Math.min(K,x[L]+_):_,L++;L+=O}else if(e.ptr+=U,f.decodeBits(t,e,D,_,w),U=0,b)if(H)for(E=0;E<I;E++){for(C=0;C<P;C++)H[L]&&(z[L]=D[U++]+x[L]),L++;L+=O}else for(E=0;E<I;E++){for(C=0;C<P;C++)z[L]=D[U++]+x[L],L++;L+=O}else if(H)for(E=0;E<I;E++){for(C=0;C<P;C++)H[L]&&(z[L]=D[U++]),L++;L+=O}else for(E=0;E<I;E++){for(C=0;C<P;C++)z[L++]=D[U++];L+=O}else{if(b)if(H)for(E=0;E<I;E++)for(C=0;C<P;C++)H[L]&&(z[L]=x[L]),L++;else for(E=0;E<I;E++)for(C=0;C<P;C++)z[L]=x[L],L++;e.counter.constant++,e.ptr+=U}}j>1&&!n&&(e.pixels.resultPixels=f.swapDimensionOrder(e.pixels.resultPixels,a,j,r))},formatFileInfo:function(t){return{fileIdentifierString:t.headerInfo.fileIdentifierString,fileVersion:t.headerInfo.fileVersion,imageType:t.headerInfo.imageType,height:t.headerInfo.height,width:t.headerInfo.width,numValidPixel:t.headerInfo.numValidPixel,microBlockSize:t.headerInfo.microBlockSize,blobSize:t.headerInfo.blobSize,maxZError:t.headerInfo.maxZError,pixelType:f.getPixelType(t.headerInfo.imageType),eofOffset:t.eofOffset,mask:t.mask?{numBytes:t.mask.numBytes}:null,pixels:{numBlocksX:t.pixels.numBlocksX,numBlocksY:t.pixels.numBlocksY,maxValue:t.headerInfo.zMax,minValue:t.headerInfo.zMin,noDataValue:t.noDataValue}}},constructConstantSurface:function(t,e){var r=t.headerInfo.zMax,n=t.headerInfo.zMin,i=t.headerInfo.maxValues,o=t.headerInfo.numDims,s=t.headerInfo.height*t.headerInfo.width,a=0,l=0,u=0,h=t.pixels.resultMask,c=t.pixels.resultPixels;if(h)if(o>1){if(e)for(a=0;a<o;a++)for(u=a*s,r=i[a],l=0;l<s;l++)h[l]&&(c[u+l]=r);else for(l=0;l<s;l++)if(h[l])for(u=l*o,a=0;a<o;a++)c[u+o]=i[a]}else for(l=0;l<s;l++)h[l]&&(c[l]=r);else if(o>1&&n!==r)if(e)for(a=0;a<o;a++)for(u=a*s,r=i[a],l=0;l<s;l++)c[u+l]=r;else for(l=0;l<s;l++)for(u=l*o,a=0;a<o;a++)c[u+a]=i[a];else for(l=0;l<s*o;l++)c[l]=r},getDataTypeArray:function(t){var e;switch(t){case 0:e=Int8Array;break;case 1:e=Uint8Array;break;case 2:e=Int16Array;break;case 3:e=Uint16Array;break;case 4:e=Int32Array;break;case 5:e=Uint32Array;break;case 6:default:e=Float32Array;break;case 7:e=Float64Array}return e},getPixelType:function(t){var e;switch(t){case 0:e="S8";break;case 1:e="U8";break;case 2:e="S16";break;case 3:e="U16";break;case 4:e="S32";break;case 5:e="U32";break;case 6:default:e="F32";break;case 7:e="F64"}return e},isValidPixelValue:function(t,e){if(null==e)return!1;var r;switch(t){case 0:r=e>=-128&&e<=127;break;case 1:r=e>=0&&e<=255;break;case 2:r=e>=-32768&&e<=32767;break;case 3:r=e>=0&&e<=65536;break;case 4:r=e>=-2147483648&&e<=2147483647;break;case 5:r=e>=0&&e<=4294967296;break;case 6:r=e>=-34027999387901484e22&&e<=34027999387901484e22;break;case 7:r=e>=-17976931348623157e292&&e<=17976931348623157e292;break;default:r=!1}return r},getDataTypeSize:function(t){var e=0;switch(t){case 0:case 1:e=1;break;case 2:case 3:e=2;break;case 4:case 5:case 6:e=4;break;case 7:e=8;break;default:e=t}return e},getDataTypeUsed:function(t,e){var r=t;switch(t){case 2:case 4:r=t-e;break;case 3:case 5:r=t-2*e;break;case 6:r=0===e?t:1===e?2:1;break;case 7:r=0===e?t:t-2*e+1;break;default:r=t}return r},getOnePixel:function(t,e,r,n){var i=0;switch(r){case 0:i=n.getInt8(e);break;case 1:i=n.getUint8(e);break;case 2:i=n.getInt16(e,!0);break;case 3:i=n.getUint16(e,!0);break;case 4:i=n.getInt32(e,!0);break;case 5:i=n.getUInt32(e,!0);break;case 6:i=n.getFloat32(e,!0);break;case 7:i=n.getFloat64(e,!0);break;default:throw"the decoder does not understand this pixel type"}return i},swapDimensionOrder:function(t,e,r,n,i){var o=0,s=0,a=0,l=0,u=t;if(r>1)if(u=new n(e*r),i)for(o=0;o<e;o++)for(l=o,a=0;a<r;a++,l+=e)u[l]=t[s++];else for(o=0;o<e;o++)for(l=o,a=0;a<r;a++,l+=e)u[s++]=t[l];return u}},p=function(t,e,r){this.val=t,this.left=e,this.right=r},d={decode:function(t,e){var r=(e=e||{}).noDataValue,n=0,i={};if(i.ptr=e.inputOffset||0,i.pixels={},f.readHeaderInfo(t,i)){var o=i.headerInfo,s=o.fileVersion,a=f.getDataTypeArray(o.imageType);if(s>5)throw"unsupported lerc version 2."+s;f.readMask(t,i),o.numValidPixel===o.width*o.height||i.pixels.resultMask||(i.pixels.resultMask=e.maskData);var l=o.width*o.height;i.pixels.resultPixels=new a(l*o.numDims),i.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0};var u,h=!e.returnPixelInterleavedDims;if(0!==o.numValidPixel)if(o.zMax===o.zMin)f.constructConstantSurface(i,h);else if(s>=4&&f.checkMinMaxRanges(t,i))f.constructConstantSurface(i,h);else{var c=new DataView(t,i.ptr,2),A=c.getUint8(0);if(i.ptr++,A)f.readDataOneSweep(t,i,a,h);else if(s>1&&o.imageType<=1&&Math.abs(o.maxZError-.5)<1e-5){var p=c.getUint8(1);if(i.ptr++,i.encodeMode=p,p>2||s<4&&p>1)throw"Invalid Huffman flag "+p;p?f.readHuffman(t,i,a,h):f.readTiles(t,i,a,h)}else f.readTiles(t,i,a,h)}i.eofOffset=i.ptr,e.inputOffset?(u=i.headerInfo.blobSize+e.inputOffset-i.ptr,Math.abs(u)>=1&&(i.eofOffset=e.inputOffset+i.headerInfo.blobSize)):(u=i.headerInfo.blobSize-i.ptr,Math.abs(u)>=1&&(i.eofOffset=i.headerInfo.blobSize));var d={width:o.width,height:o.height,pixelData:i.pixels.resultPixels,minValue:o.zMin,maxValue:o.zMax,validPixelCount:o.numValidPixel,dimCount:o.numDims,dimStats:{minValues:o.minValues,maxValues:o.maxValues},maskData:i.pixels.resultMask};if(i.pixels.resultMask&&f.isValidPixelValue(o.imageType,r)){var g=i.pixels.resultMask;for(n=0;n<l;n++)g[n]||(d.pixelData[n]=r);d.noDataValue=r}return i.noDataValue=r,e.returnFileInfo&&(d.fileInfo=f.formatFileInfo(i)),d}},getBandCount:function(t){for(var e=0,r=0,n={ptr:0,pixels:{}};r<t.byteLength-58;)f.readHeaderInfo(t,n),r+=n.headerInfo.blobSize,e++,n.ptr=r;return e}},d),_=(g=new ArrayBuffer(4),y=new Uint8Array(g),new Uint32Array(g)[0]=1,1===y[0]),w={decode:function(t,e){if(!_)throw"Big endian system is not supported.";var r,n,i=(e=e||{}).inputOffset||0,o=new Uint8Array(t,i,10),s=String.fromCharCode.apply(null,o);if("CntZImage"===s.trim())r=m,n=1;else{if("Lerc2"!==s.substring(0,5))throw"Unexpected file identifier string: "+s;r=v,n=2}for(var a,l,u,h,c,A,f=0,p=t.byteLength-10,d=[],g={width:0,height:0,pixels:[],pixelType:e.pixelType,mask:null,statistics:[]},y=0;i<p;){var w=r.decode(t,{inputOffset:i,encodedMaskData:a,maskData:u,returnMask:0===f,returnEncodedMask:0===f,returnFileInfo:!0,returnPixelInterleavedDims:e.returnPixelInterleavedDims,pixelType:e.pixelType||null,noDataValue:e.noDataValue||null});i=w.fileInfo.eofOffset,u=w.maskData,0===f&&(a=w.encodedMaskData,g.width=w.width,g.height=w.height,g.dimCount=w.dimCount||1,g.pixelType=w.pixelType||w.fileInfo.pixelType,g.mask=u),n>1&&(u&&d.push(u),w.fileInfo.mask&&w.fileInfo.mask.numBytes>0&&y++),f++,g.pixels.push(w.pixelData),g.statistics.push({minValue:w.minValue,maxValue:w.maxValue,noDataValue:w.noDataValue,dimStats:w.dimStats})}if(n>1&&y>1){for(A=g.width*g.height,g.bandMasks=d,(u=new Uint8Array(A)).set(d[0]),h=1;h<d.length;h++)for(l=d[h],c=0;c<A;c++)u[c]=u[c]&l[c];g.maskData=u}return g}};t.exports?t.exports=w:this.Lerc=w}()}({get exports(){return Syt},set exports(t){Syt=t}});const Byt=Object.freeze(Object.defineProperty({__proto__:null,default:class extends Zft{constructor(t){super(),this.planarConfiguration=void 0!==t.PlanarConfiguration?t.PlanarConfiguration:1,this.samplesPerPixel=void 0!==t.SamplesPerPixel?t.SamplesPerPixel:1,this.addCompression=t.LercParameters[1]}decodeBlock(t){switch(this.addCompression){case 0:break;case 1:t=xyt(new Uint8Array(t)).buffer;break;default:throw new Error(`Unsupported LERC additional compression method identifier: ${this.addCompression}`)}return Syt.decode(t,{returnPixelInterleavedDims:1===this.planarConfiguration}).pixels[0].buffer}}},Symbol.toStringTag,{value:"Module"})),Iyt=Object.freeze(Object.defineProperty({__proto__:null,default:class extends Zft{constructor(){if(super(),"undefined"==typeof createImageBitmap)throw new Error("Cannot decode WebImage as `createImageBitmap` is not available");if("undefined"==typeof document&&"undefined"==typeof OffscreenCanvas)throw new Error("Cannot decode WebImage as neither `document` nor `OffscreenCanvas` is not available")}async decode(t,e){const r=new Blob([e]),n=await createImageBitmap(r);let i;"undefined"!=typeof document?(i=document.createElement("canvas"),i.width=n.width,i.height=n.height):i=new OffscreenCanvas(n.width,n.height);const o=i.getContext("2d");return o.drawImage(n,0,0),o.getImageData(0,0,n.width,n.height).data.buffer}}},Symbol.toStringTag,{value:"Module"}));var Pyt=Worker;const Tyt=Object.freeze(Object.defineProperty({__proto__:null,create:function(){const t='function e(e,t,r,n,i,a,o){try{var s=e[a](o),f=s.value}catch(e){return void r(e)}s.done?t(f):Promise.resolve(f).then(n,i)}function t(t){return function(){var r=this,n=arguments;return new Promise((function(i,a){var o=t.apply(r,n);function s(t){e(o,i,a,s,f,"next",t)}function f(t){e(o,i,a,s,f,"throw",t)}s(void 0)}))}}function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}var n={exports:{}};!function(e){var t=function(e){var t,n=Object.prototype,i=n.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=t&&t.prototype instanceof y?t:y,a=Object.create(i.prototype),o=new T(n||[]);return a._invoke=function(e,t,r){var n=h;return function(i,a){if(n===p)throw new Error("Generator is already running");if(n===m){if("throw"===i)throw a;return E()}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=I(o,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var f=c(e,t,r);if("normal"===f.type){if(n=r.done?m:d,f.arg===v)continue;return{value:f.arg,done:r.done}}"throw"===f.type&&(n=m,r.method="throw",r.arg=f.arg)}}}(e,r,o),a}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var h="suspendedStart",d="suspendedYield",p="executing",m="completed",v={};function y(){}function w(){}function g(){}var b={};l(b,o,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(D([])));x&&x!==n&&i.call(x,o)&&(b=x);var _=g.prototype=y.prototype=Object.create(b);function A(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function P(e,t){function n(a,o,s,f){var l=c(e[a],e,o);if("throw"!==l.type){var u=l.arg,h=u.value;return h&&"object"===r(h)&&i.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,s,f)}),(function(e){n("throw",e,s,f)})):t.resolve(h).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,f)}))}f(l.arg)}var a;this._invoke=function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return a=a?a.then(i,i):i()}}function I(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,I(e,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a \'throw\' method")}return v}var i=c(n,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function U(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(U,this),this.reset(!0)}function D(e){if(e){var r=e[o];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function r(){for(;++n<e.length;)if(i.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:E}}function E(){return{value:t,done:!0}}return w.prototype=g,l(_,"constructor",g),l(g,"constructor",w),w.displayName=l(g,f,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,l(e,f,"GeneratorFunction")),e.prototype=Object.create(_),e},e.awrap=function(e){return{__await:e}},A(P.prototype),l(P.prototype,s,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new P(u(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},A(_),l(_,f,"Generator"),l(_,o,(function(){return this})),l(_,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=D,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(S),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var f=i.call(o,"catchLoc"),l=i.call(o,"finallyLoc");if(f&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(f){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,v):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;S(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:D(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"===("undefined"==typeof globalThis?"undefined":r(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(n);var i=n.exports,a=new Map;function o(e,t){Array.isArray(e)||(e=[e]),e.forEach((function(e){return a.set(e,t)}))}function s(e){return f.apply(this,arguments)}function f(){return(f=t(i.mark((function e(t){var r,n;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=a.get(t.Compression)){e.next=3;break}throw new Error("Unknown compression method identifier: ".concat(t.Compression));case 3:return e.next=5,r();case 5:return n=e.sent,e.abrupt("return",new n(t));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}o([void 0,1],(function(){return Promise.resolve().then((function(){return _})).then((function(e){return e.default}))})),o(5,(function(){return Promise.resolve().then((function(){return S})).then((function(e){return e.default}))})),o(6,(function(){throw new Error("old style JPEG compression is not supported.")})),o(7,(function(){return Promise.resolve().then((function(){return L})).then((function(e){return e.default}))})),o([8,32946],(function(){return Promise.resolve().then((function(){return Ne})).then((function(e){return e.default}))})),o(32773,(function(){return Promise.resolve().then((function(){return Ye})).then((function(e){return e.default}))})),o(34887,(function(){return Promise.resolve().then((function(){return ut})).then((function(e){return e.default}))})),o(50001,(function(){return Promise.resolve().then((function(){return dt})).then((function(e){return e.default}))}));var l=globalThis;function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function h(e,t,r){return t&&c(e.prototype,t),r&&c(e,r),e}function d(e,t){return d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},d(e,t)}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}function m(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e)}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}function y(e,t){var r=e.length-t,n=0;do{for(var i=t;i>0;i--)e[n+t]+=e[n],n++;r-=t}while(r>0)}function w(e,t,r){for(var n=0,i=e.length,a=i/r;i>t;){for(var o=t;o>0;--o)e[n+t]+=e[n],++n;i-=t}for(var s=e.slice(),f=0;f<a;++f)for(var l=0;l<r;++l)e[r*f+l]=s[(r-l-1)*a+f]}function g(e,t,r,n,i,a){if(!t||1===t)return e;for(var o=0;o<i.length;++o){if(i[o]%8!=0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(i[o]!==i[0])throw new Error("When decoding with predictor, all samples must have the same size.")}for(var s=i[0]/8,f=2===a?1:i.length,l=0;l<n&&!(l*f*r*s>=e.byteLength);++l){var u=void 0;if(2===t){switch(i[0]){case 8:u=new Uint8Array(e,l*f*r*s,f*r*s);break;case 16:u=new Uint16Array(e,l*f*r*s,f*r*s/2);break;case 32:u=new Uint32Array(e,l*f*r*s,f*r*s/4);break;default:throw new Error("Predictor 2 not allowed with ".concat(i[0]," bits per sample."))}y(u,f)}else 3===t&&w(u=new Uint8Array(e,l*f*r*s,f*r*s),f,s)}return e}l.addEventListener("message",function(){var e=t(i.mark((function e(t){var r,n,a,o,f,u;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.data,n=r.id,a=r.fileDirectory,o=r.buffer,e.next=3,s(a);case 3:return f=e.sent,e.next=6,f.decode(a,o);case 6:u=e.sent,l.postMessage({decoded:u,id:n},[u]);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());var b=function(){function e(){u(this,e)}var r;return h(e,[{key:"decode",value:(r=t(i.mark((function e(t,r){var n,a,o,s,f;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.decodeBlock(r);case 2:if(n=e.sent,1===(a=t.Predictor||1)){e.next=9;break}return o=!t.StripOffsets,s=o?t.TileWidth:t.ImageWidth,f=o?t.TileLength:t.RowsPerStrip||t.ImageLength,e.abrupt("return",g(n,a,s,f,t.BitsPerSample,t.PlanarConfiguration));case 9:return e.abrupt("return",n);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})}]),e}();function k(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v(e);if(t){var i=v(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return m(this,r)}}var x=function(e){p(r,b);var t=k(r);function r(){return u(this,r),t.apply(this,arguments)}return h(r,[{key:"decodeBlock",value:function(e){return e}}]),r}(),_=Object.freeze({__proto__:null,default:x});function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v(e);if(t){var i=v(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return m(this,r)}}function P(e,t){for(var r=t.length-1;r>=0;r--)e.push(t[r]);return e}function I(e){for(var t=new Uint16Array(4093),r=new Uint8Array(4093),n=0;n<=257;n++)t[n]=4096,r[n]=n;var i=258,a=9,o=0;function s(){i=258,a=9}function f(e){var t=function(e,t,r){var n=t%8,i=Math.floor(t/8),a=8-n,o=t+r-8*(i+1),s=8*(i+2)-(t+r),f=8*(i+2)-t;if(s=Math.max(0,s),i>=e.length)return console.warn("ran off the end of the buffer before finding EOI_CODE (end on input code)"),257;var l=e[i]&Math.pow(2,8-n)-1,u=l<<=r-a;if(i+1<e.length){var c=e[i+1]>>>s;u+=c<<=Math.max(0,r-f)}if(o>8&&i+2<e.length){var h=8*(i+3)-(t+r);u+=e[i+2]>>>h}return u}(e,o,a);return o+=a,t}function l(e,n){return r[i]=n,t[i]=e,++i-1}function u(e){for(var n=[],i=e;4096!==i;i=t[i])n.push(r[i]);return n}var c=[];s();for(var h,d=new Uint8Array(e),p=f(d);257!==p;){if(256===p){for(s(),p=f(d);256===p;)p=f(d);if(257===p)break;if(p>256)throw new Error("corrupted code at scanline ".concat(p));P(c,u(p)),h=p}else if(p<i){var m=u(p);P(c,m),l(h,m[m.length-1]),h=p}else{var v=u(h);if(!v)throw new Error("Bogus entry. Not in dictionary, ".concat(h," / ").concat(i,", position: ").concat(o));P(c,v),c.push(v[v.length-1]),l(h,v[v.length-1]),h=p}i+1>=Math.pow(2,a)&&(12===a?h=void 0:a++),p=f(d)}return new Uint8Array(c)}var U=function(e){p(r,b);var t=A(r);function r(){return u(this,r),t.apply(this,arguments)}return h(r,[{key:"decodeBlock",value:function(e){return I(e).buffer}}]),r}(),S=Object.freeze({__proto__:null,default:U});function T(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v(e);if(t){var i=v(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return m(this,r)}}var D=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]);function E(e,t){for(var r=0,n=[],i=16;i>0&&!e[i-1];)--i;n.push({children:[],index:0});for(var a,o=n[0],s=0;s<i;s++){for(var f=0;f<e[s];f++){for((o=n.pop()).children[o.index]=t[r];o.index>0;)o=n.pop();for(o.index++,n.push(o);n.length<=s;)n.push(a={children:[],index:0}),o.children[o.index]=a.children,o=a;r++}s+1<i&&(n.push(a={children:[],index:0}),o.children[o.index]=a.children,o=a)}return n[0].children}function B(e,t,n,i,a,o,s,f,l){var u=n.mcusPerLine,c=n.progressive,h=t,d=t,p=0,m=0;function v(){if(m>0)return m--,p>>m&1;if(255===(p=e[d++])){var t=e[d++];if(t)throw new Error("unexpected marker: ".concat((p<<8|t).toString(16)))}return m=7,p>>>7}function y(e){for(var t,n=e;null!==(t=v());){if("number"==typeof(n=n[t]))return n;if("object"!==r(n))throw new Error("invalid huffman sequence")}return null}function w(e){for(var t=e,r=0;t>0;){var n=v();if(null===n)return;r=r<<1|n,--t}return r}function g(e){var t=w(e);return t>=1<<e-1?t:t+(-1<<e)+1}var b=0;var k,x=0;function _(e,t,r,n,i){var a=r%u,o=(r/u|0)*e.v+n,s=a*e.h+i;t(e,e.blocks[o][s])}function A(e,t,r){var n=r/e.blocksPerLine|0,i=r%e.blocksPerLine;t(e,e.blocks[n][i])}var P,I,U,S,T,E,B=i.length;E=c?0===o?0===f?function(e,t){var r=y(e.huffmanTableDC),n=0===r?0:g(r)<<l;e.pred+=n,t[0]=e.pred}:function(e,t){t[0]|=v()<<l}:0===f?function(e,t){if(b>0)b--;else for(var r=o,n=s;r<=n;){var i=y(e.huffmanTableAC),a=15&i,f=i>>4;if(0===a){if(f<15){b=w(f)+(1<<f)-1;break}r+=16}else t[D[r+=f]]=g(a)*(1<<l),r++}}:function(e,t){for(var r=o,n=s,i=0;r<=n;){var a=D[r],f=t[a]<0?-1:1;switch(x){case 0:var u=y(e.huffmanTableAC),c=15&u;if(i=u>>4,0===c)i<15?(b=w(i)+(1<<i),x=4):(i=16,x=1);else{if(1!==c)throw new Error("invalid ACn encoding");k=g(c),x=i?2:3}continue;case 1:case 2:t[a]?t[a]+=(v()<<l)*f:0==--i&&(x=2===x?3:0);break;case 3:t[a]?t[a]+=(v()<<l)*f:(t[a]=k<<l,x=0);break;case 4:t[a]&&(t[a]+=(v()<<l)*f)}r++}4===x&&0==--b&&(x=0)}:function(e,t){var r=y(e.huffmanTableDC),n=0===r?0:g(r);e.pred+=n,t[0]=e.pred;for(var i=1;i<64;){var a=y(e.huffmanTableAC),o=15&a,s=a>>4;if(0===o){if(s<15)break;i+=16}else t[D[i+=s]]=g(o),i++}};var O,M,C=0;M=1===B?i[0].blocksPerLine*i[0].blocksPerColumn:u*n.mcusPerColumn;for(var L=a||M;C<M;){for(I=0;I<B;I++)i[I].pred=0;if(b=0,1===B)for(P=i[0],T=0;T<L;T++)A(P,E,C),C++;else for(T=0;T<L;T++){for(I=0;I<B;I++){var R=P=i[I],V=R.h,G=R.v;for(U=0;U<G;U++)for(S=0;S<V;S++)_(P,E,C,U,S)}if(++C===M)break}if(m=0,(O=e[d]<<8|e[d+1])<65280)throw new Error("marker was not found");if(!(O>=65488&&O<=65495))break;d+=2}return d-h}function O(e,t){var r=[],n=t.blocksPerLine,i=t.blocksPerColumn,a=n<<3,o=new Int32Array(64),s=new Uint8Array(64);function f(e,r,n){var i,a,o,s,f,l,u,c,h,d,p=t.quantizationTable,m=n;for(d=0;d<64;d++)m[d]=e[d]*p[d];for(d=0;d<8;++d){var v=8*d;0!==m[1+v]||0!==m[2+v]||0!==m[3+v]||0!==m[4+v]||0!==m[5+v]||0!==m[6+v]||0!==m[7+v]?(i=5793*m[0+v]+128>>8,a=5793*m[4+v]+128>>8,o=m[2+v],s=m[6+v],f=2896*(m[1+v]-m[7+v])+128>>8,c=2896*(m[1+v]+m[7+v])+128>>8,l=m[3+v]<<4,h=i-a+1>>1,i=i+a+1>>1,a=h,h=3784*o+1567*s+128>>8,o=1567*o-3784*s+128>>8,s=h,h=f-(u=m[5+v]<<4)+1>>1,f=f+u+1>>1,u=h,h=c+l+1>>1,l=c-l+1>>1,c=h,h=i-s+1>>1,i=i+s+1>>1,s=h,h=a-o+1>>1,a=a+o+1>>1,o=h,h=2276*f+3406*c+2048>>12,f=3406*f-2276*c+2048>>12,c=h,h=799*l+4017*u+2048>>12,l=4017*l-799*u+2048>>12,u=h,m[0+v]=i+c,m[7+v]=i-c,m[1+v]=a+u,m[6+v]=a-u,m[2+v]=o+l,m[5+v]=o-l,m[3+v]=s+f,m[4+v]=s-f):(h=5793*m[0+v]+512>>10,m[0+v]=h,m[1+v]=h,m[2+v]=h,m[3+v]=h,m[4+v]=h,m[5+v]=h,m[6+v]=h,m[7+v]=h)}for(d=0;d<8;++d){var y=d;0!==m[8+y]||0!==m[16+y]||0!==m[24+y]||0!==m[32+y]||0!==m[40+y]||0!==m[48+y]||0!==m[56+y]?(i=5793*m[0+y]+2048>>12,a=5793*m[32+y]+2048>>12,o=m[16+y],s=m[48+y],f=2896*(m[8+y]-m[56+y])+2048>>12,c=2896*(m[8+y]+m[56+y])+2048>>12,l=m[24+y],h=i-a+1>>1,i=i+a+1>>1,a=h,h=3784*o+1567*s+2048>>12,o=1567*o-3784*s+2048>>12,s=h,h=f-(u=m[40+y])+1>>1,f=f+u+1>>1,u=h,h=c+l+1>>1,l=c-l+1>>1,c=h,h=i-s+1>>1,i=i+s+1>>1,s=h,h=a-o+1>>1,a=a+o+1>>1,o=h,h=2276*f+3406*c+2048>>12,f=3406*f-2276*c+2048>>12,c=h,h=799*l+4017*u+2048>>12,l=4017*l-799*u+2048>>12,u=h,m[0+y]=i+c,m[56+y]=i-c,m[8+y]=a+u,m[48+y]=a-u,m[16+y]=o+l,m[40+y]=o-l,m[24+y]=s+f,m[32+y]=s-f):(h=5793*n[d+0]+8192>>14,m[0+y]=h,m[8+y]=h,m[16+y]=h,m[24+y]=h,m[32+y]=h,m[40+y]=h,m[48+y]=h,m[56+y]=h)}for(d=0;d<64;++d){var w=128+(m[d]+8>>4);r[d]=w<0?0:w>255?255:w}}for(var l=0;l<i;l++){for(var u=l<<3,c=0;c<8;c++)r.push(new Uint8Array(a));for(var h=0;h<n;h++){f(t.blocks[l][h],s,o);for(var d=0,p=h<<3,m=0;m<8;m++)for(var v=r[u+m],y=0;y<8;y++)v[p+y]=s[d++]}}return r}var M=function(){function e(){u(this,e),this.jfif=null,this.adobe=null,this.quantizationTables=[],this.huffmanTablesAC=[],this.huffmanTablesDC=[],this.resetFrames()}return h(e,[{key:"resetFrames",value:function(){this.frames=[]}},{key:"parse",value:function(e){var t=0;function r(){var r=e[t]<<8|e[t+1];return t+=2,r}function n(e){var t,r,n=0,i=0;for(r in e.components)e.components.hasOwnProperty(r)&&(n<(t=e.components[r]).h&&(n=t.h),i<t.v&&(i=t.v));var a=Math.ceil(e.samplesPerLine/8/n),o=Math.ceil(e.scanLines/8/i);for(r in e.components)if(e.components.hasOwnProperty(r)){t=e.components[r];for(var s=Math.ceil(Math.ceil(e.samplesPerLine/8)*t.h/n),f=Math.ceil(Math.ceil(e.scanLines/8)*t.v/i),l=a*t.h,u=o*t.v,c=[],h=0;h<u;h++){for(var d=[],p=0;p<l;p++)d.push(new Int32Array(64));c.push(d)}t.blocksPerLine=s,t.blocksPerColumn=f,t.blocks=c}e.maxH=n,e.maxV=i,e.mcusPerLine=a,e.mcusPerColumn=o}var i,a,o=r();if(65496!==o)throw new Error("SOI not found");for(o=r();65497!==o;){switch(o){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var s=(i=void 0,a=void 0,i=r(),a=e.subarray(t,t+i-2),t+=a.length,a);65504===o&&74===s[0]&&70===s[1]&&73===s[2]&&70===s[3]&&0===s[4]&&(this.jfif={version:{major:s[5],minor:s[6]},densityUnits:s[7],xDensity:s[8]<<8|s[9],yDensity:s[10]<<8|s[11],thumbWidth:s[12],thumbHeight:s[13],thumbData:s.subarray(14,14+3*s[12]*s[13])}),65518===o&&65===s[0]&&100===s[1]&&111===s[2]&&98===s[3]&&101===s[4]&&0===s[5]&&(this.adobe={version:s[6],flags0:s[7]<<8|s[8],flags1:s[9]<<8|s[10],transformCode:s[11]});break;case 65499:for(var f=r()+t-2;t<f;){var l=e[t++],u=new Int32Array(64);if(l>>4==0)for(var c=0;c<64;c++){u[D[c]]=e[t++]}else{if(l>>4!=1)throw new Error("DQT: invalid table spec");for(var h=0;h<64;h++){u[D[h]]=r()}}this.quantizationTables[15&l]=u}break;case 65472:case 65473:case 65474:r();for(var d={extended:65473===o,progressive:65474===o,precision:e[t++],scanLines:r(),samplesPerLine:r(),components:{},componentsOrder:[]},p=e[t++],m=void 0,v=0;v<p;v++){m=e[t];var y=e[t+1]>>4,w=15&e[t+1],g=e[t+2];d.componentsOrder.push(m),d.components[m]={h:y,v:w,quantizationIdx:g},t+=3}n(d),this.frames.push(d);break;case 65476:for(var b=r(),k=2;k<b;){for(var x=e[t++],_=new Uint8Array(16),A=0,P=0;P<16;P++,t++)_[P]=e[t],A+=_[P];for(var I=new Uint8Array(A),U=0;U<A;U++,t++)I[U]=e[t];k+=17+A,x>>4==0?this.huffmanTablesDC[15&x]=E(_,I):this.huffmanTablesAC[15&x]=E(_,I)}break;case 65501:r(),this.resetInterval=r();break;case 65498:r();for(var S=e[t++],T=[],O=this.frames[0],M=0;M<S;M++){var C=O.components[e[t++]],L=e[t++];C.huffmanTableDC=this.huffmanTablesDC[L>>4],C.huffmanTableAC=this.huffmanTablesAC[15&L],T.push(C)}var R=e[t++],V=e[t++],G=e[t++],F=B(e,t,O,T,this.resetInterval,R,V,G>>4,15&G);t+=F;break;case 65535:255!==e[t]&&t--;break;default:if(255===e[t-3]&&e[t-2]>=192&&e[t-2]<=254){t-=3;break}throw new Error("unknown JPEG marker ".concat(o.toString(16)))}o=r()}}},{key:"getResult",value:function(){var e=this.frames;if(0===this.frames.length)throw new Error("no frames were decoded");this.frames.length>1&&console.warn("more than one frame is not supported");for(var t=0;t<this.frames.length;t++)for(var r=this.frames[t].components,n=0,i=Object.keys(r);n<i.length;n++){var a=i[n];r[a].quantizationTable=this.quantizationTables[r[a].quantizationIdx],delete r[a].quantizationIdx}for(var o=e[0],s=o.components,f=o.componentsOrder,l=[],u=o.samplesPerLine,c=o.scanLines,h=0;h<f.length;h++){var d=s[f[h]];l.push({lines:O(0,d),scaleX:d.h/o.maxH,scaleY:d.v/o.maxV})}for(var p=new Uint8Array(u*c*l.length),m=0,v=0;v<c;++v)for(var y=0;y<u;++y)for(var w=0;w<l.length;++w){var g=l[w];p[m]=g.lines[0|v*g.scaleY][0|y*g.scaleX],++m}return p}}]),e}(),C=function(e){p(r,b);var t=T(r);function r(e){var n;return u(this,r),(n=t.call(this)).reader=new M,e.JPEGTables&&n.reader.parse(e.JPEGTables),n}return h(r,[{key:"decodeBlock",value:function(e){return this.reader.resetFrames(),this.reader.parse(new Uint8Array(e)),this.reader.getResult().buffer}}]),r}(),L=Object.freeze({__proto__:null,default:C});function R(e){for(var t=e.length;--t>=0;)e[t]=0}R(new Array(576)),R(new Array(60)),R(new Array(512)),R(new Array(256)),R(new Array(29)),R(new Array(30));var V=function(e,t,r,n){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;0!==r;){r-=o=r>2e3?2e3:r;do{a=a+(i=i+t[n++]|0)|0}while(--o);i%=65521,a%=65521}return i|a<<16|0},G=new Uint32Array(function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}()),F=function(e,t,r,n){var i=G,a=n+r;e^=-1;for(var o=n;o<a;o++)e=e>>>8^i[255&(e^t[o])];return-1^e},z={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},j={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},N=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},Z=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==r(n))throw new TypeError(n+"must be non-object");for(var i in n)N(n,i)&&(e[i]=n[i])}}return e},K=function(e){for(var t=0,r=0,n=e.length;r<n;r++)t+=e[r].length;for(var i=new Uint8Array(t),a=0,o=0,s=e.length;a<s;a++){var f=e[a];i.set(f,o),o+=f.length}return i},H=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){H=!1}for(var Y=new Uint8Array(256),X=0;X<256;X++)Y[X]=X>=252?6:X>=248?5:X>=240?4:X>=224?3:X>=192?2:1;Y[254]=Y[254]=1;var W=function(e){if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);var t,r,n,i,a,o=e.length,s=0;for(i=0;i<o;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<o&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(s),a=0,i=0;a<s;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<o&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),r<128?t[a++]=r:r<2048?(t[a++]=192|r>>>6,t[a++]=128|63&r):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|63&r):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|63&r);return t},q=function(e,t){var r,n,i=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));var a=new Array(2*i);for(n=0,r=0;r<i;){var o=e[r++];if(o<128)a[n++]=o;else{var s=Y[o];if(s>4)a[n++]=65533,r+=s-1;else{for(o&=2===s?31:3===s?15:7;s>1&&r<i;)o=o<<6|63&e[r++],s--;s>1?a[n++]=65533:o<65536?a[n++]=o:(o-=65536,a[n++]=55296|o>>10&1023,a[n++]=56320|1023&o)}}}return function(e,t){if(t<65534&&e.subarray&&H)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}(a,n)},J=function(e,t){(t=t||e.length)>e.length&&(t=e.length);for(var r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+Y[e[r]]>t?r:t};var Q=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},$=function(e,t){var r,n,i,a,o,s,f,l,u,c,h,d,p,m,v,y,w,g,b,k,x,_,A,P,I=e.state;r=e.next_in,A=e.input,n=r+(e.avail_in-5),i=e.next_out,P=e.output,a=i-(t-e.avail_out),o=i+(e.avail_out-257),s=I.dmax,f=I.wsize,l=I.whave,u=I.wnext,c=I.window,h=I.hold,d=I.bits,p=I.lencode,m=I.distcode,v=(1<<I.lenbits)-1,y=(1<<I.distbits)-1;e:do{d<15&&(h+=A[r++]<<d,d+=8,h+=A[r++]<<d,d+=8),w=p[h&v];t:for(;;){if(h>>>=g=w>>>24,d-=g,0===(g=w>>>16&255))P[i++]=65535&w;else{if(!(16&g)){if(0==(64&g)){w=p[(65535&w)+(h&(1<<g)-1)];continue t}if(32&g){I.mode=12;break e}e.msg="invalid literal/length code",I.mode=30;break e}b=65535&w,(g&=15)&&(d<g&&(h+=A[r++]<<d,d+=8),b+=h&(1<<g)-1,h>>>=g,d-=g),d<15&&(h+=A[r++]<<d,d+=8,h+=A[r++]<<d,d+=8),w=m[h&y];r:for(;;){if(h>>>=g=w>>>24,d-=g,!(16&(g=w>>>16&255))){if(0==(64&g)){w=m[(65535&w)+(h&(1<<g)-1)];continue r}e.msg="invalid distance code",I.mode=30;break e}if(k=65535&w,d<(g&=15)&&(h+=A[r++]<<d,(d+=8)<g&&(h+=A[r++]<<d,d+=8)),(k+=h&(1<<g)-1)>s){e.msg="invalid distance too far back",I.mode=30;break e}if(h>>>=g,d-=g,k>(g=i-a)){if((g=k-g)>l&&I.sane){e.msg="invalid distance too far back",I.mode=30;break e}if(x=0,_=c,0===u){if(x+=f-g,g<b){b-=g;do{P[i++]=c[x++]}while(--g);x=i-k,_=P}}else if(u<g){if(x+=f+u-g,(g-=u)<b){b-=g;do{P[i++]=c[x++]}while(--g);if(x=0,u<b){b-=g=u;do{P[i++]=c[x++]}while(--g);x=i-k,_=P}}}else if(x+=u-g,g<b){b-=g;do{P[i++]=c[x++]}while(--g);x=i-k,_=P}for(;b>2;)P[i++]=_[x++],P[i++]=_[x++],P[i++]=_[x++],b-=3;b&&(P[i++]=_[x++],b>1&&(P[i++]=_[x++]))}else{x=i-k;do{P[i++]=P[x++],P[i++]=P[x++],P[i++]=P[x++],b-=3}while(b>2);b&&(P[i++]=P[x++],b>1&&(P[i++]=P[x++]))}break}}break}}while(r<n&&i<o);r-=b=d>>3,h&=(1<<(d-=b<<3))-1,e.next_in=r,e.next_out=i,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=i<o?o-i+257:257-(i-o),I.hold=h,I.bits=d},ee=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),te=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),re=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),ne=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),ie=function(e,t,r,n,i,a,o,s){var f,l,u,c,h,d,p,m,v,y=s.bits,w=0,g=0,b=0,k=0,x=0,_=0,A=0,P=0,I=0,U=0,S=null,T=0,D=new Uint16Array(16),E=new Uint16Array(16),B=null,O=0;for(w=0;w<=15;w++)D[w]=0;for(g=0;g<n;g++)D[t[r+g]]++;for(x=y,k=15;k>=1&&0===D[k];k--);if(x>k&&(x=k),0===k)return i[a++]=20971520,i[a++]=20971520,s.bits=1,0;for(b=1;b<k&&0===D[b];b++);for(x<b&&(x=b),P=1,w=1;w<=15;w++)if(P<<=1,(P-=D[w])<0)return-1;if(P>0&&(0===e||1!==k))return-1;for(E[1]=0,w=1;w<15;w++)E[w+1]=E[w]+D[w];for(g=0;g<n;g++)0!==t[r+g]&&(o[E[t[r+g]]++]=g);if(0===e?(S=B=o,d=19):1===e?(S=ee,T-=257,B=te,O-=257,d=256):(S=re,B=ne,d=-1),U=0,g=0,w=b,h=a,_=x,A=0,u=-1,c=(I=1<<x)-1,1===e&&I>852||2===e&&I>592)return 1;for(;;){p=w-A,o[g]<d?(m=0,v=o[g]):o[g]>d?(m=B[O+o[g]],v=S[T+o[g]]):(m=96,v=0),f=1<<w-A,b=l=1<<_;do{i[h+(U>>A)+(l-=f)]=p<<24|m<<16|v|0}while(0!==l);for(f=1<<w-1;U&f;)f>>=1;if(0!==f?(U&=f-1,U+=f):U=0,g++,0==--D[w]){if(w===k)break;w=t[r+o[g]]}if(w>x&&(U&c)!==u){for(0===A&&(A=x),h+=b,P=1<<(_=w-A);_+A<k&&!((P-=D[_+A])<=0);)_++,P<<=1;if(I+=1<<_,1===e&&I>852||2===e&&I>592)return 1;i[u=U&c]=x<<24|_<<16|h-a|0}}return 0!==U&&(i[h+U]=w-A<<24|64<<16|0),s.bits=x,0},ae=j.Z_FINISH,oe=j.Z_BLOCK,se=j.Z_TREES,fe=j.Z_OK,le=j.Z_STREAM_END,ue=j.Z_NEED_DICT,ce=j.Z_STREAM_ERROR,he=j.Z_DATA_ERROR,de=j.Z_MEM_ERROR,pe=j.Z_BUF_ERROR,me=j.Z_DEFLATED,ve=function(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)};function ye(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var we,ge,be=function(e){if(!e||!e.state)return ce;var t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,fe},ke=function(e){if(!e||!e.state)return ce;var t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,be(e)},xe=function(e,t){var r;if(!e||!e.state)return ce;var n=e.state;return t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?ce:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,ke(e))},_e=function(e,t){if(!e)return ce;var r=new ye;e.state=r,r.window=null;var n=xe(e,t);return n!==fe&&(e.state=null),n},Ae=!0,Pe=function(e){if(Ae){we=new Int32Array(512),ge=new Int32Array(32);for(var t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(ie(1,e.lens,0,288,we,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;ie(2,e.lens,0,32,ge,0,e.work,{bits:5}),Ae=!1}e.lencode=we,e.lenbits=9,e.distcode=ge,e.distbits=5},Ie=function(e,t,r,n){var i,a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),n>=a.wsize?(a.window.set(t.subarray(r-a.wsize,r),0),a.wnext=0,a.whave=a.wsize):((i=a.wsize-a.wnext)>n&&(i=n),a.window.set(t.subarray(r-n,r-n+i),a.wnext),(n-=i)?(a.window.set(t.subarray(r-n,r),0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0},Ue={inflateReset:ke,inflateReset2:xe,inflateResetKeep:be,inflateInit:function(e){return _e(e,15)},inflateInit2:_e,inflate:function(e,t){var r,n,i,a,o,s,f,l,u,c,h,d,p,m,v,y,w,g,b,k,x,_,A,P,I=0,U=new Uint8Array(4),S=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return ce;12===(r=e.state).mode&&(r.mode=13),o=e.next_out,i=e.output,f=e.avail_out,a=e.next_in,n=e.input,s=e.avail_in,l=r.hold,u=r.bits,c=s,h=f,_=fe;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;u<16;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if(2&r.wrap&&35615===l){r.check=0,U[0]=255&l,U[1]=l>>>8&255,r.check=F(r.check,U,2,0),l=0,u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&l)<<8)+(l>>8))%31){e.msg="incorrect header check",r.mode=30;break}if((15&l)!==me){e.msg="unknown compression method",r.mode=30;break}if(u-=4,x=8+(15&(l>>>=4)),0===r.wbits)r.wbits=x;else if(x>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<<r.wbits,e.adler=r.check=1,r.mode=512&l?10:12,l=0,u=0;break;case 2:for(;u<16;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if(r.flags=l,(255&r.flags)!==me){e.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=l>>8&1),512&r.flags&&(U[0]=255&l,U[1]=l>>>8&255,r.check=F(r.check,U,2,0)),l=0,u=0,r.mode=3;case 3:for(;u<32;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}r.head&&(r.head.time=l),512&r.flags&&(U[0]=255&l,U[1]=l>>>8&255,U[2]=l>>>16&255,U[3]=l>>>24&255,r.check=F(r.check,U,4,0)),l=0,u=0,r.mode=4;case 4:for(;u<16;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}r.head&&(r.head.xflags=255&l,r.head.os=l>>8),512&r.flags&&(U[0]=255&l,U[1]=l>>>8&255,r.check=F(r.check,U,2,0)),l=0,u=0,r.mode=5;case 5:if(1024&r.flags){for(;u<16;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}r.length=l,r.head&&(r.head.extra_len=l),512&r.flags&&(U[0]=255&l,U[1]=l>>>8&255,r.check=F(r.check,U,2,0)),l=0,u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((d=r.length)>s&&(d=s),d&&(r.head&&(x=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(a,a+d),x)),512&r.flags&&(r.check=F(r.check,n,d,a)),s-=d,a+=d,r.length-=d),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break e;d=0;do{x=n[a+d++],r.head&&x&&r.length<65536&&(r.head.name+=String.fromCharCode(x))}while(x&&d<s);if(512&r.flags&&(r.check=F(r.check,n,d,a)),s-=d,a+=d,x)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===s)break e;d=0;do{x=n[a+d++],r.head&&x&&r.length<65536&&(r.head.comment+=String.fromCharCode(x))}while(x&&d<s);if(512&r.flags&&(r.check=F(r.check,n,d,a)),s-=d,a+=d,x)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;u<16;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if(l!==(65535&r.check)){e.msg="header crc mismatch",r.mode=30;break}l=0,u=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;u<32;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}e.adler=r.check=ve(l),l=0,u=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=o,e.avail_out=f,e.next_in=a,e.avail_in=s,r.hold=l,r.bits=u,ue;e.adler=r.check=1,r.mode=12;case 12:if(t===oe||t===se)break e;case 13:if(r.last){l>>>=7&u,u-=7&u,r.mode=27;break}for(;u<3;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}switch(r.last=1&l,u-=1,3&(l>>>=1)){case 0:r.mode=14;break;case 1:if(Pe(r),r.mode=20,t===se){l>>>=2,u-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}l>>>=2,u-=2;break;case 14:for(l>>>=7&u,u-=7&u;u<32;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if((65535&l)!=(l>>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&l,l=0,u=0,r.mode=15,t===se)break e;case 15:r.mode=16;case 16:if(d=r.length){if(d>s&&(d=s),d>f&&(d=f),0===d)break e;i.set(n.subarray(a,a+d),o),s-=d,a+=d,f-=d,o+=d,r.length-=d;break}r.mode=12;break;case 17:for(;u<14;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if(r.nlen=257+(31&l),l>>>=5,u-=5,r.ndist=1+(31&l),l>>>=5,u-=5,r.ncode=4+(15&l),l>>>=4,u-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;u<3;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}r.lens[S[r.have++]]=7&l,l>>>=3,u-=3}for(;r.have<19;)r.lens[S[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,A={bits:r.lenbits},_=ie(0,r.lens,0,19,r.lencode,0,r.work,A),r.lenbits=A.bits,_){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;y=(I=r.lencode[l&(1<<r.lenbits)-1])>>>16&255,w=65535&I,!((v=I>>>24)<=u);){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if(w<16)l>>>=v,u-=v,r.lens[r.have++]=w;else{if(16===w){for(P=v+2;u<P;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if(l>>>=v,u-=v,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}x=r.lens[r.have-1],d=3+(3&l),l>>>=2,u-=2}else if(17===w){for(P=v+3;u<P;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}u-=v,x=0,d=3+(7&(l>>>=v)),l>>>=3,u-=3}else{for(P=v+7;u<P;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}u-=v,x=0,d=11+(127&(l>>>=v)),l>>>=7,u-=7}if(r.have+d>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;d--;)r.lens[r.have++]=x}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,A={bits:r.lenbits},_=ie(1,r.lens,0,r.nlen,r.lencode,0,r.work,A),r.lenbits=A.bits,_){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,A={bits:r.distbits},_=ie(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,A),r.distbits=A.bits,_){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,t===se)break e;case 20:r.mode=21;case 21:if(s>=6&&f>=258){e.next_out=o,e.avail_out=f,e.next_in=a,e.avail_in=s,r.hold=l,r.bits=u,$(e,h),o=e.next_out,i=e.output,f=e.avail_out,a=e.next_in,n=e.input,s=e.avail_in,l=r.hold,u=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;y=(I=r.lencode[l&(1<<r.lenbits)-1])>>>16&255,w=65535&I,!((v=I>>>24)<=u);){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if(y&&0==(240&y)){for(g=v,b=y,k=w;y=(I=r.lencode[k+((l&(1<<g+b)-1)>>g)])>>>16&255,w=65535&I,!(g+(v=I>>>24)<=u);){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}l>>>=g,u-=g,r.back+=g}if(l>>>=v,u-=v,r.back+=v,r.length=w,0===y){r.mode=26;break}if(32&y){r.back=-1,r.mode=12;break}if(64&y){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&y,r.mode=22;case 22:if(r.extra){for(P=r.extra;u<P;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}r.length+=l&(1<<r.extra)-1,l>>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;y=(I=r.distcode[l&(1<<r.distbits)-1])>>>16&255,w=65535&I,!((v=I>>>24)<=u);){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if(0==(240&y)){for(g=v,b=y,k=w;y=(I=r.distcode[k+((l&(1<<g+b)-1)>>g)])>>>16&255,w=65535&I,!(g+(v=I>>>24)<=u);){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}l>>>=g,u-=g,r.back+=g}if(l>>>=v,u-=v,r.back+=v,64&y){e.msg="invalid distance code",r.mode=30;break}r.offset=w,r.extra=15&y,r.mode=24;case 24:if(r.extra){for(P=r.extra;u<P;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}r.offset+=l&(1<<r.extra)-1,l>>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===f)break e;if(d=h-f,r.offset>d){if((d=r.offset-d)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d>r.wnext?(d-=r.wnext,p=r.wsize-d):p=r.wnext-d,d>r.length&&(d=r.length),m=r.window}else m=i,p=o-r.offset,d=r.length;d>f&&(d=f),f-=d,r.length-=d;do{i[o++]=m[p++]}while(--d);0===r.length&&(r.mode=21);break;case 26:if(0===f)break e;i[o++]=r.length,f--,r.mode=21;break;case 27:if(r.wrap){for(;u<32;){if(0===s)break e;s--,l|=n[a++]<<u,u+=8}if(h-=f,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=r.flags?F(r.check,i,h,o-h):V(r.check,i,h,o-h)),h=f,(r.flags?l:ve(l))!==r.check){e.msg="incorrect data check",r.mode=30;break}l=0,u=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;u<32;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if(l!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=30;break}l=0,u=0}r.mode=29;case 29:_=le;break e;case 30:_=he;break e;case 31:return de;default:return ce}return e.next_out=o,e.avail_out=f,e.next_in=a,e.avail_in=s,r.hold=l,r.bits=u,(r.wsize||h!==e.avail_out&&r.mode<30&&(r.mode<27||t!==ae))&&Ie(e,e.output,e.next_out,h-e.avail_out),c-=e.avail_in,h-=e.avail_out,e.total_in+=c,e.total_out+=h,r.total+=h,r.wrap&&h&&(e.adler=r.check=r.flags?F(r.check,i,h,e.next_out-h):V(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0===c&&0===h||t===ae)&&_===fe&&(_=pe),_},inflateEnd:function(e){if(!e||!e.state)return ce;var t=e.state;return t.window&&(t.window=null),e.state=null,fe},inflateGetHeader:function(e,t){if(!e||!e.state)return ce;var r=e.state;return 0==(2&r.wrap)?ce:(r.head=t,t.done=!1,fe)},inflateSetDictionary:function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?ce:11===r.mode&&V(1,t,n,0)!==r.check?he:Ie(e,t,n,n)?(r.mode=31,de):(r.havedict=1,fe):ce},inflateInfo:"pako inflate (from Nodeca project)"};var Se=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},Te=Object.prototype.toString,De=j.Z_NO_FLUSH,Ee=j.Z_FINISH,Be=j.Z_OK,Oe=j.Z_STREAM_END,Me=j.Z_NEED_DICT,Ce=j.Z_STREAM_ERROR,Le=j.Z_DATA_ERROR,Re=j.Z_MEM_ERROR;function Ve(e){this.options=Z({chunkSize:65536,windowBits:15,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Q,this.strm.avail_out=0;var r=Ue.inflateInit2(this.strm,t.windowBits);if(r!==Be)throw new Error(z[r]);if(this.header=new Se,Ue.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=W(t.dictionary):"[object ArrayBuffer]"===Te.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Ue.inflateSetDictionary(this.strm,t.dictionary))!==Be))throw new Error(z[r])}function Ge(e,t){var r=new Ve(t);if(r.push(e),r.err)throw r.msg||z[r.err];return r.result}Ve.prototype.push=function(e,t){var r,n,i,a=this.strm,o=this.options.chunkSize,s=this.options.dictionary;if(this.ended)return!1;for(n=t===~~t?t:!0===t?Ee:De,"[object ArrayBuffer]"===Te.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(o),a.next_out=0,a.avail_out=o),(r=Ue.inflate(a,n))===Me&&s&&((r=Ue.inflateSetDictionary(a,s))===Be?r=Ue.inflate(a,n):r===Le&&(r=Me));a.avail_in>0&&r===Oe&&a.state.wrap>0&&0!==e[a.next_in];)Ue.inflateReset(a),r=Ue.inflate(a,n);switch(r){case Ce:case Le:case Me:case Re:return this.onEnd(r),this.ended=!0,!1}if(i=a.avail_out,a.next_out&&(0===a.avail_out||r===Oe))if("string"===this.options.to){var f=J(a.output,a.next_out),l=a.next_out-f,u=q(a.output,f);a.next_out=l,a.avail_out=o-l,l&&a.output.set(a.output.subarray(f,f+l),0),this.onData(u)}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(r!==Be||0!==i){if(r===Oe)return r=Ue.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===a.avail_in)break}}return!0},Ve.prototype.onData=function(e){this.chunks.push(e)},Ve.prototype.onEnd=function(e){e===Be&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=K(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Fe={Inflate:Ve,inflate:Ge,inflateRaw:function(e,t){return(t=t||{}).raw=!0,Ge(e,t)},ungzip:Ge,constants:j}.inflate;function ze(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v(e);if(t){var i=v(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return m(this,r)}}var je=function(e){p(r,b);var t=ze(r);function r(){return u(this,r),t.apply(this,arguments)}return h(r,[{key:"decodeBlock",value:function(e){return Fe(new Uint8Array(e)).buffer}}]),r}(),Ne=Object.freeze({__proto__:null,default:je});function Ze(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v(e);if(t){var i=v(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return m(this,r)}}var Ke,He=function(e){p(r,b);var t=Ze(r);function r(){return u(this,r),t.apply(this,arguments)}return h(r,[{key:"decodeBlock",value:function(e){for(var t=new DataView(e),r=[],n=0;n<e.byteLength;++n){var i=t.getInt8(n);if(i<0){var a=t.getUint8(n+1);i=-i;for(var o=0;o<=i;++o)r.push(a);n+=1}else{for(var s=0;s<=i;++s)r.push(t.getUint8(n+s+1));n+=i+1}}return new Uint8Array(r).buffer}}]),r}(),Ye=Object.freeze({__proto__:null,default:He}),Xe={exports:{}};Ke=Xe,\n/* Copyright 2015-2021 Esri. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 @preserve */\nfunction(){var e,t,r,n,i,a,o,s,f,l,u,c,h,d,p,m,v=(e={defaultNoDataValue:-34027999387901484e22,decode:function(a,o){var s=(o=o||{}).encodedMaskData||null===o.encodedMaskData,f=i(a,o.inputOffset||0,s),l=null!==o.noDataValue?o.noDataValue:e.defaultNoDataValue,u=t(f,o.pixelType||Float32Array,o.encodedMaskData,l,o.returnMask),c={width:f.width,height:f.height,pixelData:u.resultPixels,minValue:u.minValue,maxValue:f.pixels.maxValue,noDataValue:l};return u.resultMask&&(c.maskData=u.resultMask),o.returnEncodedMask&&f.mask&&(c.encodedMaskData=f.mask.bitset?f.mask.bitset:null),o.returnFileInfo&&(c.fileInfo=r(f),o.computeUsedBitDepths&&(c.fileInfo.bitDepths=n(f))),c}},t=function(e,t,r,n,i){var o,s,f,l=0,u=e.pixels.numBlocksX,c=e.pixels.numBlocksY,h=Math.floor(e.width/u),d=Math.floor(e.height/c),p=2*e.maxZError,m=Number.MAX_VALUE;r=r||(e.mask?e.mask.bitset:null),s=new t(e.width*e.height),i&&r&&(f=new Uint8Array(e.width*e.height));for(var v,y,w=new Float32Array(h*d),g=0;g<=c;g++){var b=g!==c?d:e.height%c;if(0!==b)for(var k=0;k<=u;k++){var x=k!==u?h:e.width%u;if(0!==x){var _,A,P,I,U=g*e.width*d+k*h,S=e.width-x,T=e.pixels.blocks[l];if(T.encoding<2?(0===T.encoding?_=T.rawData:(a(T.stuffedData,T.bitsPerPixel,T.numValidPixels,T.offset,p,w,e.pixels.maxValue),_=w),A=0):P=2===T.encoding?0:T.offset,r)for(y=0;y<b;y++){for(7&U&&(I=r[U>>3],I<<=7&U),v=0;v<x;v++)7&U||(I=r[U>>3]),128&I?(f&&(f[U]=1),m=m>(o=T.encoding<2?_[A++]:P)?o:m,s[U++]=o):(f&&(f[U]=0),s[U++]=n),I<<=1;U+=S}else if(T.encoding<2)for(y=0;y<b;y++){for(v=0;v<x;v++)m=m>(o=_[A++])?o:m,s[U++]=o;U+=S}else for(m=m>P?P:m,y=0;y<b;y++){for(v=0;v<x;v++)s[U++]=P;U+=S}if(1===T.encoding&&A!==T.numValidPixels)throw"Block and Mask do not match";l++}}}return{resultPixels:s,resultMask:f,minValue:m}},r=function(e){return{fileIdentifierString:e.fileIdentifierString,fileVersion:e.fileVersion,imageType:e.imageType,height:e.height,width:e.width,maxZError:e.maxZError,eofOffset:e.eofOffset,mask:e.mask?{numBlocksX:e.mask.numBlocksX,numBlocksY:e.mask.numBlocksY,numBytes:e.mask.numBytes,maxValue:e.mask.maxValue}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,numBytes:e.pixels.numBytes,maxValue:e.pixels.maxValue,noDataValue:e.noDataValue}}},n=function(e){for(var t=e.pixels.numBlocksX*e.pixels.numBlocksY,r={},n=0;n<t;n++){var i=e.pixels.blocks[n];0===i.encoding?r.float32=!0:1===i.encoding?r[i.bitsPerPixel]=!0:r[0]=!0}return Object.keys(r)},i=function(e,t,r){var n={},i=new Uint8Array(e,t,10);if(n.fileIdentifierString=String.fromCharCode.apply(null,i),"CntZImage"!==n.fileIdentifierString.trim())throw"Unexpected file identifier string: "+n.fileIdentifierString;t+=10;var a=new DataView(e,t,24);if(n.fileVersion=a.getInt32(0,!0),n.imageType=a.getInt32(4,!0),n.height=a.getUint32(8,!0),n.width=a.getUint32(12,!0),n.maxZError=a.getFloat64(16,!0),t+=24,!r)if(a=new DataView(e,t,16),n.mask={},n.mask.numBlocksY=a.getUint32(0,!0),n.mask.numBlocksX=a.getUint32(4,!0),n.mask.numBytes=a.getUint32(8,!0),n.mask.maxValue=a.getFloat32(12,!0),t+=16,n.mask.numBytes>0){var o=new Uint8Array(Math.ceil(n.width*n.height/8)),s=(a=new DataView(e,t,n.mask.numBytes)).getInt16(0,!0),f=2,l=0;do{if(s>0)for(;s--;)o[l++]=a.getUint8(f++);else{var u=a.getUint8(f++);for(s=-s;s--;)o[l++]=u}s=a.getInt16(f,!0),f+=2}while(f<n.mask.numBytes);if(-32768!==s||l<o.length)throw"Unexpected end of mask RLE encoding";n.mask.bitset=o,t+=n.mask.numBytes}else 0==(n.mask.numBytes|n.mask.numBlocksY|n.mask.maxValue)&&(n.mask.bitset=new Uint8Array(Math.ceil(n.width*n.height/8)));a=new DataView(e,t,16),n.pixels={},n.pixels.numBlocksY=a.getUint32(0,!0),n.pixels.numBlocksX=a.getUint32(4,!0),n.pixels.numBytes=a.getUint32(8,!0),n.pixels.maxValue=a.getFloat32(12,!0),t+=16;var c=n.pixels.numBlocksX,h=n.pixels.numBlocksY,d=c+(n.width%c>0?1:0),p=h+(n.height%h>0?1:0);n.pixels.blocks=new Array(d*p);for(var m=0,v=0;v<p;v++)for(var y=0;y<d;y++){var w=0,g=e.byteLength-t;a=new DataView(e,t,Math.min(10,g));var b={};n.pixels.blocks[m++]=b;var k=a.getUint8(0);if(w++,b.encoding=63&k,b.encoding>3)throw"Invalid block encoding ("+b.encoding+")";if(2!==b.encoding){if(0!==k&&2!==k){if(k>>=6,b.offsetType=k,2===k)b.offset=a.getInt8(1),w++;else if(1===k)b.offset=a.getInt16(1,!0),w+=2;else{if(0!==k)throw"Invalid block offset type";b.offset=a.getFloat32(1,!0),w+=4}if(1===b.encoding)if(k=a.getUint8(w),w++,b.bitsPerPixel=63&k,k>>=6,b.numValidPixelsType=k,2===k)b.numValidPixels=a.getUint8(w),w++;else if(1===k)b.numValidPixels=a.getUint16(w,!0),w+=2;else{if(0!==k)throw"Invalid valid pixel count type";b.numValidPixels=a.getUint32(w,!0),w+=4}}var x;if(t+=w,3!==b.encoding)if(0===b.encoding){var _=(n.pixels.numBytes-1)/4;if(_!==Math.floor(_))throw"uncompressed block has invalid length";x=new ArrayBuffer(4*_),new Uint8Array(x).set(new Uint8Array(e,t,4*_));var A=new Float32Array(x);b.rawData=A,t+=4*_}else if(1===b.encoding){var P=Math.ceil(b.numValidPixels*b.bitsPerPixel/8),I=Math.ceil(P/4);x=new ArrayBuffer(4*I),new Uint8Array(x).set(new Uint8Array(e,t,P)),b.stuffedData=new Uint32Array(x),t+=P}}else t++}return n.eofOffset=t,n},a=function(e,t,r,n,i,a,o){var s,f,l,u=(1<<t)-1,c=0,h=0,d=Math.ceil((o-n)/i),p=4*e.length-Math.ceil(t*r/8);for(e[e.length-1]<<=8*p,s=0;s<r;s++){if(0===h&&(l=e[c++],h=32),h>=t)f=l>>>h-t&u,h-=t;else{var m=t-h;f=(l&u)<<m&u,f+=(l=e[c++])>>>(h=32-m)}a[s]=f<d?n+f*i:o}return a},e),y=(o=function(e,t,r,n,i,a,o,s){var f,l,u,c,h,d=(1<<r)-1,p=0,m=0,v=4*e.length-Math.ceil(r*n/8);if(e[e.length-1]<<=8*v,i)for(f=0;f<n;f++)0===m&&(u=e[p++],m=32),m>=r?(l=u>>>m-r&d,m-=r):(l=(u&d)<<(c=r-m)&d,l+=(u=e[p++])>>>(m=32-c)),t[f]=i[l];else for(h=Math.ceil((s-a)/o),f=0;f<n;f++)0===m&&(u=e[p++],m=32),m>=r?(l=u>>>m-r&d,m-=r):(l=(u&d)<<(c=r-m)&d,l+=(u=e[p++])>>>(m=32-c)),t[f]=l<h?a+l*o:s},s=function(e,t,r,n,i,a){var o,s=(1<<t)-1,f=0,l=0,u=0,c=0,h=0,d=[],p=4*e.length-Math.ceil(t*r/8);e[e.length-1]<<=8*p;var m=Math.ceil((a-n)/i);for(l=0;l<r;l++)0===c&&(o=e[f++],c=32),c>=t?(h=o>>>c-t&s,c-=t):(h=(o&s)<<(u=t-c)&s,h+=(o=e[f++])>>>(c=32-u)),d[l]=h<m?n+h*i:a;return d.unshift(n),d},f=function(e,t,r,n,i,a,o,s){var f,l,u,c,h=(1<<r)-1,d=0,p=0,m=0;if(i)for(f=0;f<n;f++)0===p&&(u=e[d++],p=32,m=0),p>=r?(l=u>>>m&h,p-=r,m+=r):(l=u>>>m&h,p=32-(c=r-p),l|=((u=e[d++])&(1<<c)-1)<<r-c,m=c),t[f]=i[l];else{var v=Math.ceil((s-a)/o);for(f=0;f<n;f++)0===p&&(u=e[d++],p=32,m=0),p>=r?(l=u>>>m&h,p-=r,m+=r):(l=u>>>m&h,p=32-(c=r-p),l|=((u=e[d++])&(1<<c)-1)<<r-c,m=c),t[f]=l<v?a+l*o:s}return t},l=function(e,t,r,n,i,a){var o,s=(1<<t)-1,f=0,l=0,u=0,c=0,h=0,d=0,p=[],m=Math.ceil((a-n)/i);for(l=0;l<r;l++)0===c&&(o=e[f++],c=32,d=0),c>=t?(h=o>>>d&s,c-=t,d+=t):(h=o>>>d&s,c=32-(u=t-c),h|=((o=e[f++])&(1<<u)-1)<<t-u,d=u),p[l]=h<m?n+h*i:a;return p.unshift(n),p},u=function(e,t,r,n){var i,a,o,s,f=(1<<r)-1,l=0,u=0,c=4*e.length-Math.ceil(r*n/8);for(e[e.length-1]<<=8*c,i=0;i<n;i++)0===u&&(o=e[l++],u=32),u>=r?(a=o>>>u-r&f,u-=r):(a=(o&f)<<(s=r-u)&f,a+=(o=e[l++])>>>(u=32-s)),t[i]=a;return t},c=function(e,t,r,n){var i,a,o,s,f=(1<<r)-1,l=0,u=0,c=0;for(i=0;i<n;i++)0===u&&(o=e[l++],u=32,c=0),u>=r?(a=o>>>c&f,u-=r,c+=r):(a=o>>>c&f,u=32-(s=r-u),a|=((o=e[l++])&(1<<s)-1)<<r-s,c=s),t[i]=a;return t},h={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(e){for(var t=65535,r=65535,n=e.length,i=Math.floor(n/2),a=0;i;){var o=i>=359?359:i;i-=o;do{t+=e[a++]<<8,r+=t+=e[a++]}while(--o);t=(65535&t)+(t>>>16),r=(65535&r)+(r>>>16)}return 1&n&&(r+=t+=e[a]<<8),((r=(65535&r)+(r>>>16))<<16|(t=(65535&t)+(t>>>16)))>>>0},readHeaderInfo:function(e,t){var r=t.ptr,n=new Uint8Array(e,r,6),i={};if(i.fileIdentifierString=String.fromCharCode.apply(null,n),0!==i.fileIdentifierString.lastIndexOf("Lerc2",0))throw"Unexpected file identifier string (expect Lerc2 ): "+i.fileIdentifierString;r+=6;var a,o=new DataView(e,r,8),s=o.getInt32(0,!0);if(i.fileVersion=s,r+=4,s>=3&&(i.checksum=o.getUint32(4,!0),r+=4),o=new DataView(e,r,12),i.height=o.getUint32(0,!0),i.width=o.getUint32(4,!0),r+=8,s>=4?(i.numDims=o.getUint32(8,!0),r+=4):i.numDims=1,o=new DataView(e,r,40),i.numValidPixel=o.getUint32(0,!0),i.microBlockSize=o.getInt32(4,!0),i.blobSize=o.getInt32(8,!0),i.imageType=o.getInt32(12,!0),i.maxZError=o.getFloat64(16,!0),i.zMin=o.getFloat64(24,!0),i.zMax=o.getFloat64(32,!0),r+=40,t.headerInfo=i,t.ptr=r,s>=3&&(a=s>=4?52:48,this.computeChecksumFletcher32(new Uint8Array(e,r-a,i.blobSize-14))!==i.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(e,t){var r=t.headerInfo,n=this.getDataTypeArray(r.imageType),i=r.numDims*this.getDataTypeSize(r.imageType),a=this.readSubArray(e,t.ptr,n,i),o=this.readSubArray(e,t.ptr+i,n,i);t.ptr+=2*i;var s,f=!0;for(s=0;s<r.numDims;s++)if(a[s]!==o[s]){f=!1;break}return r.minValues=a,r.maxValues=o,f},readSubArray:function(e,t,r,n){var i;if(r===Uint8Array)i=new Uint8Array(e,t,n);else{var a=new ArrayBuffer(n);new Uint8Array(a).set(new Uint8Array(e,t,n)),i=new r(a)}return i},readMask:function(e,t){var r,n,i=t.ptr,a=t.headerInfo,o=a.width*a.height,s=a.numValidPixel,f=new DataView(e,i,4),l={};if(l.numBytes=f.getUint32(0,!0),i+=4,(0===s||o===s)&&0!==l.numBytes)throw"invalid mask";if(0===s)r=new Uint8Array(Math.ceil(o/8)),l.bitset=r,n=new Uint8Array(o),t.pixels.resultMask=n,i+=l.numBytes;else if(l.numBytes>0){r=new Uint8Array(Math.ceil(o/8));var u=(f=new DataView(e,i,l.numBytes)).getInt16(0,!0),c=2,h=0,d=0;do{if(u>0)for(;u--;)r[h++]=f.getUint8(c++);else for(d=f.getUint8(c++),u=-u;u--;)r[h++]=d;u=f.getInt16(c,!0),c+=2}while(c<l.numBytes);if(-32768!==u||h<r.length)throw"Unexpected end of mask RLE encoding";n=new Uint8Array(o);var p=0,m=0;for(m=0;m<o;m++)7&m?(p=r[m>>3],p<<=7&m):p=r[m>>3],128&p&&(n[m]=1);t.pixels.resultMask=n,l.bitset=r,i+=l.numBytes}return t.ptr=i,t.mask=l,!0},readDataOneSweep:function(e,t,r,n){var i,a=t.ptr,o=t.headerInfo,s=o.numDims,f=o.width*o.height,l=o.imageType,u=o.numValidPixel*h.getDataTypeSize(l)*s,c=t.pixels.resultMask;if(r===Uint8Array)i=new Uint8Array(e,a,u);else{var d=new ArrayBuffer(u);new Uint8Array(d).set(new Uint8Array(e,a,u)),i=new r(d)}if(i.length===f*s)t.pixels.resultPixels=n?h.swapDimensionOrder(i,f,s,r,!0):i;else{t.pixels.resultPixels=new r(f*s);var p=0,m=0,v=0,y=0;if(s>1){if(n){for(m=0;m<f;m++)if(c[m])for(y=m,v=0;v<s;v++,y+=f)t.pixels.resultPixels[y]=i[p++]}else for(m=0;m<f;m++)if(c[m])for(y=m*s,v=0;v<s;v++)t.pixels.resultPixels[y+v]=i[p++]}else for(m=0;m<f;m++)c[m]&&(t.pixels.resultPixels[m]=i[p++])}return a+=u,t.ptr=a,!0},readHuffmanTree:function(e,t){var r=this.HUFFMAN_LUT_BITS_MAX,n=new DataView(e,t.ptr,16);if(t.ptr+=16,n.getInt32(0,!0)<2)throw"unsupported Huffman version";var i=n.getInt32(4,!0),a=n.getInt32(8,!0),o=n.getInt32(12,!0);if(a>=o)return!1;var s=new Uint32Array(o-a);h.decodeBits(e,t,s);var f,l,u,c,p=[];for(f=a;f<o;f++)p[l=f-(f<i?0:i)]={first:s[f-a],second:null};var m=e.byteLength-t.ptr,v=Math.ceil(m/4),y=new ArrayBuffer(4*v);new Uint8Array(y).set(new Uint8Array(e,t.ptr,m));var w,g=new Uint32Array(y),b=0,k=0;for(w=g[0],f=a;f<o;f++)(c=p[l=f-(f<i?0:i)].first)>0&&(p[l].second=w<<b>>>32-c,32-b>=c?32===(b+=c)&&(b=0,w=g[++k]):(b+=c-32,w=g[++k],p[l].second|=w>>>32-b));var x=0,_=0,A=new d;for(f=0;f<p.length;f++)void 0!==p[f]&&(x=Math.max(x,p[f].first));_=x>=r?r:x;var P,I,U,S,T,D=[];for(f=a;f<o;f++)if((c=p[l=f-(f<i?0:i)].first)>0)if(P=[c,l],c<=_)for(I=p[l].second<<_-c,U=1<<_-c,u=0;u<U;u++)D[I|u]=P;else for(I=p[l].second,T=A,S=c-1;S>=0;S--)I>>>S&1?(T.right||(T.right=new d),T=T.right):(T.left||(T.left=new d),T=T.left),0!==S||T.val||(T.val=P[1]);return{decodeLut:D,numBitsLUTQick:_,numBitsLUT:x,tree:A,stuffedData:g,srcPtr:k,bitPos:b}},readHuffman:function(e,t,r,n){var i,a,o,s,f,l,u,c,d,p=t.headerInfo.numDims,m=t.headerInfo.height,v=t.headerInfo.width,y=v*m,w=this.readHuffmanTree(e,t),g=w.decodeLut,b=w.tree,k=w.stuffedData,x=w.srcPtr,_=w.bitPos,A=w.numBitsLUTQick,P=w.numBitsLUT,I=0===t.headerInfo.imageType?128:0,U=t.pixels.resultMask,S=0;_>0&&(x++,_=0);var T,D=k[x],E=1===t.encodeMode,B=new r(y*p),O=B;if(p<2||E){for(T=0;T<p;T++)if(p>1&&(O=new r(B.buffer,y*T,y),S=0),t.headerInfo.numValidPixel===v*m)for(c=0,l=0;l<m;l++)for(u=0;u<v;u++,c++){if(a=0,f=s=D<<_>>>32-A,32-_<A&&(f=s|=k[x+1]>>>64-_-A),g[f])a=g[f][1],_+=g[f][0];else for(f=s=D<<_>>>32-P,32-_<P&&(f=s|=k[x+1]>>>64-_-P),i=b,d=0;d<P;d++)if(!(i=s>>>P-d-1&1?i.right:i.left).left&&!i.right){a=i.val,_=_+d+1;break}_>=32&&(_-=32,D=k[++x]),o=a-I,E?(o+=u>0?S:l>0?O[c-v]:S,o&=255,O[c]=o,S=o):O[c]=o}else for(c=0,l=0;l<m;l++)for(u=0;u<v;u++,c++)if(U[c]){if(a=0,f=s=D<<_>>>32-A,32-_<A&&(f=s|=k[x+1]>>>64-_-A),g[f])a=g[f][1],_+=g[f][0];else for(f=s=D<<_>>>32-P,32-_<P&&(f=s|=k[x+1]>>>64-_-P),i=b,d=0;d<P;d++)if(!(i=s>>>P-d-1&1?i.right:i.left).left&&!i.right){a=i.val,_=_+d+1;break}_>=32&&(_-=32,D=k[++x]),o=a-I,E?(u>0&&U[c-1]?o+=S:l>0&&U[c-v]?o+=O[c-v]:o+=S,o&=255,O[c]=o,S=o):O[c]=o}}else for(c=0,l=0;l<m;l++)for(u=0;u<v;u++)if(c=l*v+u,!U||U[c])for(T=0;T<p;T++,c+=y){if(a=0,f=s=D<<_>>>32-A,32-_<A&&(f=s|=k[x+1]>>>64-_-A),g[f])a=g[f][1],_+=g[f][0];else for(f=s=D<<_>>>32-P,32-_<P&&(f=s|=k[x+1]>>>64-_-P),i=b,d=0;d<P;d++)if(!(i=s>>>P-d-1&1?i.right:i.left).left&&!i.right){a=i.val,_=_+d+1;break}_>=32&&(_-=32,D=k[++x]),o=a-I,O[c]=o}t.ptr=t.ptr+4*(x+1)+(_>0?4:0),t.pixels.resultPixels=B,p>1&&!n&&(t.pixels.resultPixels=h.swapDimensionOrder(B,y,p,r))},decodeBits:function(e,t,r,n,i){var a=t.headerInfo,h=a.fileVersion,d=0,p=e.byteLength-t.ptr>=5?5:e.byteLength-t.ptr,m=new DataView(e,t.ptr,p),v=m.getUint8(0);d++;var y=v>>6,w=0===y?4:3-y,g=(32&v)>0,b=31&v,k=0;if(1===w)k=m.getUint8(d),d++;else if(2===w)k=m.getUint16(d,!0),d+=2;else{if(4!==w)throw"Invalid valid pixel count type";k=m.getUint32(d,!0),d+=4}var x,_,A,P,I,U,S,T,D,E=2*a.maxZError,B=a.numDims>1?a.maxValues[i]:a.zMax;if(g){for(t.counter.lut++,T=m.getUint8(d),d++,P=Math.ceil((T-1)*b/8),I=Math.ceil(P/4),_=new ArrayBuffer(4*I),A=new Uint8Array(_),t.ptr+=d,A.set(new Uint8Array(e,t.ptr,P)),S=new Uint32Array(_),t.ptr+=P,D=0;T-1>>>D;)D++;P=Math.ceil(k*D/8),I=Math.ceil(P/4),_=new ArrayBuffer(4*I),(A=new Uint8Array(_)).set(new Uint8Array(e,t.ptr,P)),x=new Uint32Array(_),t.ptr+=P,U=h>=3?l(S,b,T-1,n,E,B):s(S,b,T-1,n,E,B),h>=3?f(x,r,D,k,U):o(x,r,D,k,U)}else t.counter.bitstuffer++,D=b,t.ptr+=d,D>0&&(P=Math.ceil(k*D/8),I=Math.ceil(P/4),_=new ArrayBuffer(4*I),(A=new Uint8Array(_)).set(new Uint8Array(e,t.ptr,P)),x=new Uint32Array(_),t.ptr+=P,h>=3?null==n?c(x,r,D,k):f(x,r,D,k,!1,n,E,B):null==n?u(x,r,D,k):o(x,r,D,k,!1,n,E,B))},readTiles:function(e,t,r,n){var i=t.headerInfo,a=i.width,o=i.height,s=a*o,f=i.microBlockSize,l=i.imageType,u=h.getDataTypeSize(l),c=Math.ceil(a/f),d=Math.ceil(o/f);t.pixels.numBlocksY=d,t.pixels.numBlocksX=c,t.pixels.ptr=0;var p,m,v,y,w,g,b,k,x,_,A=0,P=0,I=0,U=0,S=0,T=0,D=0,E=0,B=0,O=0,M=0,C=0,L=0,R=0,V=0,G=new r(f*f),F=o%f||f,z=a%f||f,j=i.numDims,N=t.pixels.resultMask,Z=t.pixels.resultPixels,K=i.fileVersion>=5?14:15,H=i.zMax;for(I=0;I<d;I++)for(S=I!==d-1?f:F,U=0;U<c;U++)for(O=I*a*f+U*f,M=a-(T=U!==c-1?f:z),k=0;k<j;k++){if(j>1?(_=Z,O=I*a*f+U*f,Z=new r(t.pixels.resultPixels.buffer,s*k*u,s),H=i.maxValues[k]):_=null,D=e.byteLength-t.ptr,m={},V=0,E=(p=new DataView(e,t.ptr,Math.min(10,D))).getUint8(0),V++,x=i.fileVersion>=5?4&E:0,B=E>>6&255,(E>>2&K)!=(U*f>>3&K))throw"integrity issue";if(x&&0===k)throw"integrity issue";if((w=3&E)>3)throw t.ptr+=V,"Invalid block encoding ("+w+")";if(2!==w)if(0===w){if(x)throw"integrity issue";if(t.counter.uncompressed++,t.ptr+=V,C=(C=S*T*u)<(L=e.byteLength-t.ptr)?C:L,v=new ArrayBuffer(C%u==0?C:C+u-C%u),new Uint8Array(v).set(new Uint8Array(e,t.ptr,C)),y=new r(v),R=0,N)for(A=0;A<S;A++){for(P=0;P<T;P++)N[O]&&(Z[O]=y[R++]),O++;O+=M}else for(A=0;A<S;A++){for(P=0;P<T;P++)Z[O++]=y[R++];O+=M}t.ptr+=R*u}else if(g=h.getDataTypeUsed(x&&l<6?4:l,B),b=h.getOnePixel(m,V,g,p),V+=h.getDataTypeSize(g),3===w)if(t.ptr+=V,t.counter.constantoffset++,N)for(A=0;A<S;A++){for(P=0;P<T;P++)N[O]&&(Z[O]=x?Math.min(H,_[O]+b):b),O++;O+=M}else for(A=0;A<S;A++){for(P=0;P<T;P++)Z[O]=x?Math.min(H,_[O]+b):b,O++;O+=M}else if(t.ptr+=V,h.decodeBits(e,t,G,b,k),V=0,x)if(N)for(A=0;A<S;A++){for(P=0;P<T;P++)N[O]&&(Z[O]=G[V++]+_[O]),O++;O+=M}else for(A=0;A<S;A++){for(P=0;P<T;P++)Z[O]=G[V++]+_[O],O++;O+=M}else if(N)for(A=0;A<S;A++){for(P=0;P<T;P++)N[O]&&(Z[O]=G[V++]),O++;O+=M}else for(A=0;A<S;A++){for(P=0;P<T;P++)Z[O++]=G[V++];O+=M}else{if(x)if(N)for(A=0;A<S;A++)for(P=0;P<T;P++)N[O]&&(Z[O]=_[O]),O++;else for(A=0;A<S;A++)for(P=0;P<T;P++)Z[O]=_[O],O++;t.counter.constant++,t.ptr+=V}}j>1&&!n&&(t.pixels.resultPixels=h.swapDimensionOrder(t.pixels.resultPixels,s,j,r))},formatFileInfo:function(e){return{fileIdentifierString:e.headerInfo.fileIdentifierString,fileVersion:e.headerInfo.fileVersion,imageType:e.headerInfo.imageType,height:e.headerInfo.height,width:e.headerInfo.width,numValidPixel:e.headerInfo.numValidPixel,microBlockSize:e.headerInfo.microBlockSize,blobSize:e.headerInfo.blobSize,maxZError:e.headerInfo.maxZError,pixelType:h.getPixelType(e.headerInfo.imageType),eofOffset:e.eofOffset,mask:e.mask?{numBytes:e.mask.numBytes}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,maxValue:e.headerInfo.zMax,minValue:e.headerInfo.zMin,noDataValue:e.noDataValue}}},constructConstantSurface:function(e,t){var r=e.headerInfo.zMax,n=e.headerInfo.zMin,i=e.headerInfo.maxValues,a=e.headerInfo.numDims,o=e.headerInfo.height*e.headerInfo.width,s=0,f=0,l=0,u=e.pixels.resultMask,c=e.pixels.resultPixels;if(u)if(a>1){if(t)for(s=0;s<a;s++)for(l=s*o,r=i[s],f=0;f<o;f++)u[f]&&(c[l+f]=r);else for(f=0;f<o;f++)if(u[f])for(l=f*a,s=0;s<a;s++)c[l+a]=i[s]}else for(f=0;f<o;f++)u[f]&&(c[f]=r);else if(a>1&&n!==r)if(t)for(s=0;s<a;s++)for(l=s*o,r=i[s],f=0;f<o;f++)c[l+f]=r;else for(f=0;f<o;f++)for(l=f*a,s=0;s<a;s++)c[l+s]=i[s];else for(f=0;f<o*a;f++)c[f]=r},getDataTypeArray:function(e){var t;switch(e){case 0:t=Int8Array;break;case 1:t=Uint8Array;break;case 2:t=Int16Array;break;case 3:t=Uint16Array;break;case 4:t=Int32Array;break;case 5:t=Uint32Array;break;case 6:default:t=Float32Array;break;case 7:t=Float64Array}return t},getPixelType:function(e){var t;switch(e){case 0:t="S8";break;case 1:t="U8";break;case 2:t="S16";break;case 3:t="U16";break;case 4:t="S32";break;case 5:t="U32";break;case 6:default:t="F32";break;case 7:t="F64"}return t},isValidPixelValue:function(e,t){if(null==t)return!1;var r;switch(e){case 0:r=t>=-128&&t<=127;break;case 1:r=t>=0&&t<=255;break;case 2:r=t>=-32768&&t<=32767;break;case 3:r=t>=0&&t<=65536;break;case 4:r=t>=-2147483648&&t<=2147483647;break;case 5:r=t>=0&&t<=4294967296;break;case 6:r=t>=-34027999387901484e22&&t<=34027999387901484e22;break;case 7:r=t>=-17976931348623157e292&&t<=17976931348623157e292;break;default:r=!1}return r},getDataTypeSize:function(e){var t=0;switch(e){case 0:case 1:t=1;break;case 2:case 3:t=2;break;case 4:case 5:case 6:t=4;break;case 7:t=8;break;default:t=e}return t},getDataTypeUsed:function(e,t){var r=e;switch(e){case 2:case 4:r=e-t;break;case 3:case 5:r=e-2*t;break;case 6:r=0===t?e:1===t?2:1;break;case 7:r=0===t?e:e-2*t+1;break;default:r=e}return r},getOnePixel:function(e,t,r,n){var i=0;switch(r){case 0:i=n.getInt8(t);break;case 1:i=n.getUint8(t);break;case 2:i=n.getInt16(t,!0);break;case 3:i=n.getUint16(t,!0);break;case 4:i=n.getInt32(t,!0);break;case 5:i=n.getUInt32(t,!0);break;case 6:i=n.getFloat32(t,!0);break;case 7:i=n.getFloat64(t,!0);break;default:throw"the decoder does not understand this pixel type"}return i},swapDimensionOrder:function(e,t,r,n,i){var a=0,o=0,s=0,f=0,l=e;if(r>1)if(l=new n(t*r),i)for(a=0;a<t;a++)for(f=a,s=0;s<r;s++,f+=t)l[f]=e[o++];else for(a=0;a<t;a++)for(f=a,s=0;s<r;s++,f+=t)l[o++]=e[f];return l}},d=function(e,t,r){this.val=e,this.left=t,this.right=r},{decode:function(e,t){var r=(t=t||{}).noDataValue,n=0,i={};i.ptr=t.inputOffset||0,i.pixels={},h.readHeaderInfo(e,i);var a=i.headerInfo,o=a.fileVersion,s=h.getDataTypeArray(a.imageType);if(o>5)throw"unsupported lerc version 2."+o;h.readMask(e,i),a.numValidPixel===a.width*a.height||i.pixels.resultMask||(i.pixels.resultMask=t.maskData);var f=a.width*a.height;i.pixels.resultPixels=new s(f*a.numDims),i.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0};var l,u=!t.returnPixelInterleavedDims;if(0!==a.numValidPixel)if(a.zMax===a.zMin)h.constructConstantSurface(i,u);else if(o>=4&&h.checkMinMaxRanges(e,i))h.constructConstantSurface(i,u);else{var c=new DataView(e,i.ptr,2),d=c.getUint8(0);if(i.ptr++,d)h.readDataOneSweep(e,i,s,u);else if(o>1&&a.imageType<=1&&Math.abs(a.maxZError-.5)<1e-5){var p=c.getUint8(1);if(i.ptr++,i.encodeMode=p,p>2||o<4&&p>1)throw"Invalid Huffman flag "+p;p?h.readHuffman(e,i,s,u):h.readTiles(e,i,s,u)}else h.readTiles(e,i,s,u)}i.eofOffset=i.ptr,t.inputOffset?(l=i.headerInfo.blobSize+t.inputOffset-i.ptr,Math.abs(l)>=1&&(i.eofOffset=t.inputOffset+i.headerInfo.blobSize)):(l=i.headerInfo.blobSize-i.ptr,Math.abs(l)>=1&&(i.eofOffset=i.headerInfo.blobSize));var m={width:a.width,height:a.height,pixelData:i.pixels.resultPixels,minValue:a.zMin,maxValue:a.zMax,validPixelCount:a.numValidPixel,dimCount:a.numDims,dimStats:{minValues:a.minValues,maxValues:a.maxValues},maskData:i.pixels.resultMask};if(i.pixels.resultMask&&h.isValidPixelValue(a.imageType,r)){var v=i.pixels.resultMask;for(n=0;n<f;n++)v[n]||(m.pixelData[n]=r);m.noDataValue=r}return i.noDataValue=r,t.returnFileInfo&&(m.fileInfo=h.formatFileInfo(i)),m},getBandCount:function(e){for(var t=0,r=0,n={ptr:0,pixels:{}};r<e.byteLength-58;)h.readHeaderInfo(e,n),r+=n.headerInfo.blobSize,t++,n.ptr=r;return t}}),w=(p=new ArrayBuffer(4),m=new Uint8Array(p),new Uint32Array(p)[0]=1,1===m[0]),g={decode:function(e,t){if(!w)throw"Big endian system is not supported.";var r,n,i=(t=t||{}).inputOffset||0,a=new Uint8Array(e,i,10),o=String.fromCharCode.apply(null,a);if("CntZImage"===o.trim())r=v,n=1;else{if("Lerc2"!==o.substring(0,5))throw"Unexpected file identifier string: "+o;r=y,n=2}for(var s,f,l,u,c,h,d=0,p=e.byteLength-10,m=[],g={width:0,height:0,pixels:[],pixelType:t.pixelType,mask:null,statistics:[]},b=0;i<p;){var k=r.decode(e,{inputOffset:i,encodedMaskData:s,maskData:l,returnMask:0===d,returnEncodedMask:0===d,returnFileInfo:!0,returnPixelInterleavedDims:t.returnPixelInterleavedDims,pixelType:t.pixelType||null,noDataValue:t.noDataValue||null});i=k.fileInfo.eofOffset,l=k.maskData,0===d&&(s=k.encodedMaskData,g.width=k.width,g.height=k.height,g.dimCount=k.dimCount||1,g.pixelType=k.pixelType||k.fileInfo.pixelType,g.mask=l),n>1&&(l&&m.push(l),k.fileInfo.mask&&k.fileInfo.mask.numBytes>0&&b++),d++,g.pixels.push(k.pixelData),g.statistics.push({minValue:k.minValue,maxValue:k.maxValue,noDataValue:k.noDataValue,dimStats:k.dimStats})}if(n>1&&b>1){for(h=g.width*g.height,g.bandMasks=m,(l=new Uint8Array(h)).set(m[0]),u=1;u<m.length;u++)for(f=m[u],c=0;c<h;c++)l[c]=l[c]&f[c];g.maskData=l}return g}};Ke.exports?Ke.exports=g:this.Lerc=g}();var We=Xe.exports,qe={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},Je={};for(var Qe in qe)qe.hasOwnProperty(Qe)&&(Je[qe[Qe]]=parseInt(Qe,10));Je.BitsPerSample,Je.ExtraSamples,Je.SampleFormat,Je.StripByteCounts,Je.StripOffsets,Je.StripRowCounts,Je.TileByteCounts,Je.TileOffsets,Je.SubIFDs;var $e={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},et={};for(var tt in $e)$e.hasOwnProperty(tt)&&(et[$e[tt]]=parseInt(tt,10));var rt=1,nt=0,it=1,at={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"},ot={};for(var st in at)at.hasOwnProperty(st)&&(ot[at[st]]=parseInt(st,10));function ft(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v(e);if(t){var i=v(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return m(this,r)}}var lt=function(e){p(r,b);var t=ft(r);function r(e){var n;return u(this,r),(n=t.call(this)).planarConfiguration=void 0!==e.PlanarConfiguration?e.PlanarConfiguration:1,n.samplesPerPixel=void 0!==e.SamplesPerPixel?e.SamplesPerPixel:1,n.addCompression=e.LercParameters[rt],n}return h(r,[{key:"decodeBlock",value:function(e){switch(this.addCompression){case nt:break;case it:e=Fe(new Uint8Array(e)).buffer;break;default:throw new Error("Unsupported LERC additional compression method identifier: ".concat(this.addCompression))}return We.decode(e,{returnPixelInterleavedDims:1===this.planarConfiguration}).pixels[0].buffer}}]),r}(),ut=Object.freeze({__proto__:null,default:lt});function ct(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v(e);if(t){var i=v(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return m(this,r)}}var ht=function(e){p(a,b);var r,n=ct(a);function a(){var e;if(u(this,a),e=n.call(this),"undefined"==typeof createImageBitmap)throw new Error("Cannot decode WebImage as `createImageBitmap` is not available");if("undefined"==typeof document&&"undefined"==typeof OffscreenCanvas)throw new Error("Cannot decode WebImage as neither `document` nor `OffscreenCanvas` is not available");return e}return h(a,[{key:"decode",value:(r=t(i.mark((function e(t,r){var n,a,o,s;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Blob([r]),e.next=3,createImageBitmap(n);case 3:return a=e.sent,"undefined"!=typeof document?((o=document.createElement("canvas")).width=a.width,o.height=a.height):o=new OffscreenCanvas(a.width,a.height),(s=o.getContext("2d")).drawImage(a,0,0),e.abrupt("return",s.getImageData(0,0,a.width,a.height).data.buffer);case 8:case"end":return e.stop()}}),e)}))),function(e,t){return r.apply(this,arguments)})}]),a}(),dt=Object.freeze({__proto__:null,default:ht});';return new Pyt("undefined"==typeof Blob?"data:application/javascript;base64,"+Buffer.from(t,"binary").toString("base64"):URL.createObjectURL(new Blob([t],{type:"application/javascript"})))}},Symbol.toStringTag,{value:"Module"}));