


!function(a){function b(){var a=location.href;return hashtag=-1!==a.indexOf("#prettyPhoto")?decodeURI(a.substring(a.indexOf("#prettyPhoto")+1,a.length)):!1,hashtag}function c(){"undefined"!=typeof theRel&&(location.hash=theRel+"/"+rel_index+"/")}function d(){-1!==location.href.indexOf("#prettyPhoto")&&(location.hash="prettyPhoto")}function e(a,b){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var c="[\\?&]"+a+"=([^&#]*)",d=new RegExp(c),e=d.exec(b);return null==e?"":e[1]}a.prettyPhoto={version:"3.1.5"},a.fn.prettyPhoto=function(f){function g(){a(".pp_loaderIcon").hide(),projectedTop=scroll_pos.scrollTop+(A-r.containerHeight)/4,projectedTop<0&&(projectedTop=0),$ppt.fadeTo(settings.animation_speed,1),$pp_pic_holder.find(".pp_content").animate({height:r.contentHeight,width:r.contentWidth},settings.animation_speed),$pp_pic_holder.animate({top:projectedTop,left:B/2-r.containerWidth/2<0?0:B/2-r.containerWidth/2,width:r.containerWidth},settings.animation_speed,function(){$pp_pic_holder.find(".pp_hoverContainer,#fullResImage").height(r.height).width(r.width),$pp_pic_holder.find(".pp_fade").fadeIn(settings.animation_speed),isSet&&"image"==l(pp_images[set_position])?$pp_pic_holder.find(".pp_hoverContainer").show():$pp_pic_holder.find(".pp_hoverContainer").hide(),settings.allow_expand&&(r.resized?a("a.pp_expand,a.pp_contract").show():a("a.pp_expand").hide()),!settings.autoplay_slideshow||x||s||a.prettyPhoto.startSlideshow(),settings.changepicturecallback(),s=!0}),p(),f.ajaxcallback()}function h(b){$pp_pic_holder.find("#pp_full_res object,#pp_full_res embed").css("visibility","hidden"),$pp_pic_holder.find(".pp_fade").fadeOut(settings.animation_speed,function(){a(".pp_loaderIcon").show(),b()})}function i(b){b>1?a(".pp_nav").show():a(".pp_nav").hide()}function j(a,b){if(resized=!1,k(a,b),imageWidth=a,imageHeight=b,(w>B||v>A)&&doresize&&settings.allow_resize&&!z){for(resized=!0,fitting=!1;!fitting;)w>B?(imageWidth=B-200,imageHeight=b/a*imageWidth):v>A?(imageHeight=A-200,imageWidth=a/b*imageHeight):fitting=!0,v=imageHeight,w=imageWidth;(w>B||v>A)&&j(w,v),k(imageWidth,imageHeight)}return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(v),containerWidth:Math.floor(w)+2*settings.horizontal_padding,contentHeight:Math.floor(t),contentWidth:Math.floor(u),resized:resized}}function k(b,c){b=parseFloat(b),c=parseFloat(c),$pp_details=$pp_pic_holder.find(".pp_details"),$pp_details.width(b),detailsHeight=parseFloat($pp_details.css("marginTop"))+parseFloat($pp_details.css("marginBottom")),$pp_details=$pp_details.clone().addClass(settings.theme).width(b).appendTo(a("body")).css({position:"absolute",top:-1e4}),detailsHeight+=$pp_details.height(),detailsHeight=detailsHeight<=34?36:detailsHeight,$pp_details.remove(),$pp_title=$pp_pic_holder.find(".ppt"),$pp_title.width(b),titleHeight=parseFloat($pp_title.css("marginTop"))+parseFloat($pp_title.css("marginBottom")),$pp_title=$pp_title.clone().appendTo(a("body")).css({position:"absolute",top:-1e4}),titleHeight+=$pp_title.height(),$pp_title.remove(),t=c+detailsHeight,u=b,v=t+titleHeight+$pp_pic_holder.find(".pp_top").height()+$pp_pic_holder.find(".pp_bottom").height(),w=b}function l(a){return a.match(/youtube\.com\/watch/i)||a.match(/youtu\.be/i)?"youtube":a.match(/vimeo\.com/i)?"vimeo":a.match(/\b.mov\b/i)?"quicktime":a.match(/\b.swf\b/i)?"flash":a.match(/\biframe=true\b/i)?"iframe":a.match(/\bajax=true\b/i)?"ajax":a.match(/\bcustom=true\b/i)?"custom":"#"==a.substr(0,1)?"inline":"image"}function m(){if(doresize&&"undefined"!=typeof $pp_pic_holder){if(scroll_pos=n(),contentHeight=$pp_pic_holder.height(),contentwidth=$pp_pic_holder.width(),projectedTop=A/2+scroll_pos.scrollTop-contentHeight/2,projectedTop<0&&(projectedTop=0),contentHeight>A)return;$pp_pic_holder.css({top:projectedTop,left:B/2+scroll_pos.scrollLeft-contentwidth/2})}}function n(){return self.pageYOffset?{scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset}:document.documentElement&&document.documentElement.scrollTop?{scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft}:document.body?{scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft}:void 0}function o(){A=a(window).height(),B=a(window).width(),"undefined"!=typeof $pp_overlay&&$pp_overlay.height(a(document).height()).width(B)}function p(){isSet&&settings.overlay_gallery&&pp_images.length>1&&"image"==l(pp_images[set_position])?(itemWidth=57,navWidth="facebook"==settings.theme||"pp_default"==settings.theme?50:30,itemsPerPage=Math.floor((r.containerWidth-100-navWidth)/itemWidth),itemsPerPage=itemsPerPage<pp_images.length?itemsPerPage:pp_images.length,totalPage=Math.ceil(pp_images.length/itemsPerPage)-1,0==totalPage?(navWidth=0,$pp_gallery.find(".pp_arrow_next,.pp_arrow_previous").hide()):$pp_gallery.find(".pp_arrow_next,.pp_arrow_previous").show(),galleryWidth=itemsPerPage*itemWidth,fullGalleryWidth=pp_images.length*itemWidth,$pp_gallery.css("margin-left",-(galleryWidth/2+navWidth/2)).find("div:first").width(galleryWidth+5).find("ul").width(fullGalleryWidth).find("li.selected").removeClass("selected"),goToPage=Math.floor(set_position/itemsPerPage)<totalPage?Math.floor(set_position/itemsPerPage):totalPage,a.prettyPhoto.changeGalleryPage(goToPage),$pp_gallery_li.filter(":eq("+set_position+")").addClass("selected")):$pp_pic_holder.find(".pp_content").unbind("mouseenter mouseleave")}function q(b){if(settings.social_tools&&(facebook_like_link=settings.social_tools.replace("{location_href}",encodeURIComponent(location.href))),settings.markup=settings.markup.replace("{pp_social}",""),a("body").append(settings.markup),$pp_pic_holder=a(".pp_pic_holder"),$ppt=a(".ppt"),$pp_overlay=a("div.pp_overlay"),isSet&&settings.overlay_gallery){currentGalleryPage=0,toInject="";for(var c=0;c<pp_images.length;c++)classname="",img_src=pp_images[c],toInject+="<li class='"+classname+"'><a href='#'><img src='"+img_src+"' width='50' alt='' /></a></li>";toInject=settings.gallery_markup.replace(/{gallery}/g,toInject),$pp_pic_holder.find("#pp_full_res").after(toInject),$pp_gallery=a(".pp_pic_holder .pp_gallery"),$pp_gallery_li=$pp_gallery.find("li"),$pp_gallery.find(".pp_arrow_next").click(function(){return a.prettyPhoto.changeGalleryPage("next"),a.prettyPhoto.stopSlideshow(),!1}),$pp_gallery.find(".pp_arrow_previous").click(function(){return a.prettyPhoto.changeGalleryPage("previous"),a.prettyPhoto.stopSlideshow(),!1}),$pp_pic_holder.find(".pp_content").hover(function(){$pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeIn()},function(){$pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeOut()}),itemWidth=57,$pp_gallery_li.each(function(b){a(this).find("a").click(function(){return a.prettyPhoto.changePage(b),a.prettyPhoto.stopSlideshow(),!1})})}settings.slideshow&&($pp_pic_holder.find(".pp_nav").prepend('<a href="#" class="pp_play">Play</a>'),$pp_pic_holder.find(".pp_nav .pp_play").click(function(){return a.prettyPhoto.startSlideshow(),!1})),$pp_pic_holder.attr("class","pp_pic_holder "+settings.theme),$pp_overlay.css({opacity:0,height:a(document).height(),width:a(window).width()}).bind("click",function(){settings.modal||a.prettyPhoto.close()}),a("a.pp_close").bind("click",function(){return a.prettyPhoto.close(),!1}),settings.allow_expand&&a("a.pp_expand").bind("click",function(b){return a(this).hasClass("pp_expand")?(a(this).removeClass("pp_expand").addClass("pp_contract"),doresize=!1):(a(this).removeClass("pp_contract").addClass("pp_expand"),doresize=!0),h(function(){a.prettyPhoto.open()}),!1}),$pp_pic_holder.find(".pp_previous, .pp_nav .pp_arrow_previous").bind("click",function(){return a.prettyPhoto.changePage("previous"),a.prettyPhoto.stopSlideshow(),!1}),$pp_pic_holder.find(".pp_next, .pp_nav .pp_arrow_next").bind("click",function(){return a.prettyPhoto.changePage("next"),a.prettyPhoto.stopSlideshow(),!1}),m()}f=jQuery.extend({hook:"rel",animation_speed:"fast",ajaxcallback:function(){},slideshow:5e3,autoplay_slideshow:!1,opacity:.8,show_title:!0,allow_resize:!0,allow_expand:!0,default_width:500,default_height:344,counter_separator_label:"/",theme:"pp_default",horizontal_padding:20,hideflash:!1,wmode:"opaque",autoplay:!0,modal:!1,deeplinking:!0,overlay_gallery:!0,overlay_gallery_max:30,keyboard_shortcuts:!0,changepicturecallback:function(){},callback:function(){},ie6_fallback:!0,markup:'<div class="pp_pic_holder"> 						<div class="ppt">&nbsp;</div> 						<div class="pp_top"> 							<div class="pp_left"></div> 							<div class="pp_middle"></div> 							<div class="pp_right"></div> 						</div> 						<div class="pp_content_container"> 							<div class="pp_left"> 							<div class="pp_right"> 								<div class="pp_content"> 									<div class="pp_loaderIcon"></div> 									<div class="pp_fade"> 										<!--<a href="#" class="pp_expand" title="Expand the image">Expand</a>--> 										<a class="pp_close" href="#">Close</a> 										<div class="pp_hoverContainer"> 											<a class="pp_next" href="#">next</a> 											<a class="pp_previous" href="#">previous</a> 										</div> 										<div id="pp_full_res"></div> 										<div class="pp_details"> 											<div class="pp_nav"> 												<p class="currentTextHolder">0/0</p> 											</div> 											<p class="pp_description"></p> 											<div class="pp_social">{pp_social}</div> 										</div> 									</div> 								</div> 							</div> 							</div> 						</div> 						<div class="pp_bottom"> 							<div class="pp_left"></div> 							<div class="pp_middle"></div> 							<div class="pp_right"></div> 						</div> 					</div> 					<div class="pp_overlay"></div>',gallery_markup:'<div class="pp_gallery"> 								<a href="#" class="pp_arrow_previous">Previous</a> 								<div> 									<ul> 										{gallery} 									</ul> 								</div> 								<a href="#" class="pp_arrow_next">Next</a> 							</div>',image_markup:'<img id="fullResImage" src="{path}" />',flash_markup:'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',quicktime_markup:'<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',iframe_markup:'<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',inline_markup:'<div class="pp_inline">{content}</div>',custom_markup:"",social_tools:'<div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>'},f);var r,s,t,u,v,w,x,y=this,z=!1,A=a(window).height(),B=a(window).width();doresize=!0,scroll_pos=n();var C=function(a){for(var b in window)window[b]&&"object"==typeof window[b]&&psrk.gmap&&window[b]instanceof psrk.gmap&&window[b].map.setOptions({keyboardShortcuts:a})},D=function(){C(!1)};return a(window).unbind("resize.prettyphoto").bind("resize.prettyphoto",function(){m(),o()}),f.keyboard_shortcuts&&a(document).unbind("keydown.prettyphoto").bind("keydown.prettyphoto",function(b){if("undefined"!=typeof $pp_pic_holder&&$pp_pic_holder.is(":visible"))switch(b.keyCode){case 37:a.prettyPhoto.changePage("previous"),b.preventDefault();break;case 39:a.prettyPhoto.changePage("next"),b.preventDefault();break;case 27:settings.modal||a.prettyPhoto.close(),b.preventDefault()}}),a.prettyPhoto.initialize=function(){return settings=f,"pp_default"==settings.theme&&(settings.horizontal_padding=16),theRel=a(this).attr(settings.hook),galleryRegExp=/\[(?:.*)\]/,isSet=galleryRegExp.exec(theRel)?!0:!1,pp_images=isSet?jQuery.map(y,function(b,c){return-1!=a(b).attr(settings.hook).indexOf(theRel)?a(b).attr("href"):void 0}):a.makeArray(a(this).attr("href")),pp_titles=isSet?jQuery.map(y,function(b,c){return-1!=a(b).attr(settings.hook).indexOf(theRel)?a(b).find("img").attr("alt")?a(b).find("img").attr("alt"):"":void 0}):a.makeArray(a(this).find("img").attr("alt")),pp_descriptions=isSet?jQuery.map(y,function(b,c){return-1!=a(b).attr(settings.hook).indexOf(theRel)?a(b).attr("title")?a(b).attr("title"):"":void 0}):a.makeArray(a(this).attr("title")),pp_images.length>settings.overlay_gallery_max&&(settings.overlay_gallery=!1),set_position=jQuery.inArray(a(this).attr("href"),pp_images),rel_index=isSet?set_position:a("a["+settings.hook+"^='"+theRel+"']").index(a(this)),q(this),settings.allow_resize&&a(window).bind("scroll.prettyphoto",function(){m()}),a.prettyPhoto.open(),!1},a.prettyPhoto.open=function(b){D();var d=this;if("undefined"==typeof settings){settings=f,pp_images=a.makeArray(arguments[0]),pp_titles=arguments[1]?a.makeArray(arguments[1]):a.makeArray(""),pp_descriptions=arguments[2]?a.makeArray(arguments[2]):a.makeArray(""),isSet=pp_images.length>1?!0:!1,set_position=arguments[3]?arguments[3]:0,pw_id=arguments[4]?arguments[4]:0,q(b.target),this.err_obj=this.err_obj||{},this.err_obj[pw_id]=this.err_obj[pw_id]||[];for(var h=0;h<pp_images.length;h++){this.err_obj[pw_id].push(0);var k=new Image;k.src=pp_images[h],function(a){k.onerror=function(){d.err_obj[pw_id][a]=1}}(h)}}return"pp_default"==settings.theme&&(settings.horizontal_padding=16),settings.hideflash&&a("object,embed,iframe[src*=youtube],iframe[src*=vimeo]").css("visibility","hidden"),i(a(pp_images).size()),a(".pp_loaderIcon").show(),settings.deeplinking&&c(),settings.social_tools&&(facebook_like_link=settings.social_tools.replace("{location_href}",encodeURIComponent(location.href)),$pp_pic_holder.find(".pp_social").html(facebook_like_link)),$ppt.is(":hidden")&&$ppt.css("opacity",0).show(),$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity),$pp_pic_holder.find(".currentTextHolder").text(set_position+1+settings.counter_separator_label+a(pp_images).size()),"undefined"!=typeof pp_descriptions[set_position]&&""!=pp_descriptions[set_position]?$pp_pic_holder.find(".pp_description").show().html(unescape(pp_descriptions[set_position])):$pp_pic_holder.find(".pp_description").hide(),movie_width=parseFloat(e("width",pp_images[set_position]))?e("width",pp_images[set_position]):settings.default_width.toString(),movie_height=parseFloat(e("height",pp_images[set_position]))?e("height",pp_images[set_position]):settings.default_height.toString(),z=!1,-1!=movie_height.indexOf("%")&&(movie_height=parseFloat(a(window).height()*parseFloat(movie_height)/100-150),z=!0),-1!=movie_width.indexOf("%")&&(movie_width=parseFloat(a(window).width()*parseFloat(movie_width)/100-150),z=!0),$pp_pic_holder.fadeIn(function(){switch(settings.show_title&&""!=pp_titles[set_position]&&"undefined"!=typeof pp_titles[set_position]?$ppt.html(unescape(pp_titles[set_position])):$ppt.html("&nbsp;"),imgPreloader="",skipInjection=!1,l(pp_images[set_position])){case"image":var b=function(b){if(imgPreloader=new Image,imgPreloader.onload=function(){r=j(imgPreloader.width,imgPreloader.height),g()},isSet&&d.err_obj[pw_id][set_position]){imgPreloader.src=psrk.url.cdn+"/webservices/ext/jquery.prettyPhoto.custom/img/default/nophoto.png";var c=set_position+1;a(".pp_gallery li:nth-child("+c+")").find("img").attr("src",psrk.url.cdn+"/webservices/ext/jquery.prettyPhoto.custom/img/default/nophoto.png")}else imgPreloader.src=b},c=function(){b(psrk.url.cdn+"/webservices/ext/jquery.prettyPhoto.custom/img/default/nophoto.png"),a("#fullResImage").attr("src",psrk.url.cdn+"/webservices/ext/jquery.prettyPhoto.custom/img/default/nophoto.png");var c=set_position+1;a(".pp_gallery li:nth-child("+c+")").find("img").attr("src",psrk.url.cdn+"/webservices/ext/jquery.prettyPhoto.custom/img/default/nophoto.png")};b(pp_images[set_position]),isSet&&d.err_obj[pw_id][set_position]?$pp_pic_holder.find("#pp_full_res")[0].innerHTML=settings.image_markup.replace(/{path}/g,psrk.url.cdn+"/webservices/ext/jquery.prettyPhoto.custom/img/default/nophoto.png"):$pp_pic_holder.find("#pp_full_res")[0].innerHTML=settings.image_markup.replace(/{path}/g,pp_images[set_position]),imgPreloader.onerror=function(){c()};break;case"youtube":r=j(movie_width,movie_height),movie_id=e("v",pp_images[set_position]),""==movie_id&&(movie_id=pp_images[set_position].split("youtu.be/"),movie_id=movie_id[1],movie_id.indexOf("?")>0&&(movie_id=movie_id.substr(0,movie_id.indexOf("?"))),movie_id.indexOf("&")>0&&(movie_id=movie_id.substr(0,movie_id.indexOf("&")))),movie="http://www.youtube.com/embed/"+movie_id,e("rel",pp_images[set_position])?movie+="?rel="+e("rel",pp_images[set_position]):movie+="?rel=1",settings.autoplay&&(movie+="&autoplay=1"),toInject=settings.iframe_markup.replace(/{width}/g,r.width).replace(/{height}/g,r.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);break;case"vimeo":r=j(movie_width,movie_height),movie_id=pp_images[set_position];var f=/http(s?):\/\/(www\.)?vimeo.com\/(\d+)/,h=movie_id.match(f);movie="http://player.vimeo.com/video/"+h[3]+"?title=0&amp;byline=0&amp;portrait=0",settings.autoplay&&(movie+="&autoplay=1;"),vimeo_width=r.width+"/embed/?moog_width="+r.width,toInject=settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,r.height).replace(/{path}/g,movie);break;case"quicktime":r=j(movie_width,movie_height),r.height+=15,r.contentHeight+=15,r.containerHeight+=15,toInject=settings.quicktime_markup.replace(/{width}/g,r.width).replace(/{height}/g,r.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);break;case"flash":r=j(movie_width,movie_height),flash_vars=pp_images[set_position],flash_vars=flash_vars.substring(pp_images[set_position].indexOf("flashvars")+10,pp_images[set_position].length),filename=pp_images[set_position],filename=filename.substring(0,filename.indexOf("?")),toInject=settings.flash_markup.replace(/{width}/g,r.width).replace(/{height}/g,r.height).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+"?"+flash_vars);break;case"iframe":r=j(movie_width,movie_height),frame_url=pp_images[set_position],frame_url=frame_url.substr(0,frame_url.indexOf("iframe")-1),toInject=settings.iframe_markup.replace(/{width}/g,r.width).replace(/{height}/g,r.height).replace(/{path}/g,frame_url);break;case"ajax":doresize=!1,r=j(movie_width,movie_height),doresize=!0,skipInjection=!0,a.get(pp_images[set_position],function(a){toInject=settings.inline_markup.replace(/{content}/g,a),$pp_pic_holder.find("#pp_full_res")[0].innerHTML=toInject,g()});break;case"custom":r=j(movie_width,movie_height),toInject=settings.custom_markup;break;case"inline":myClone=a(pp_images[set_position]).clone().append('<br clear="all" />').css({width:settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo(a("body")).show(),doresize=!1,r=j(a(myClone).width(),a(myClone).height()),doresize=!0,a(myClone).remove(),toInject=settings.inline_markup.replace(/{content}/g,a(pp_images[set_position]).html())}imgPreloader||skipInjection||($pp_pic_holder.find("#pp_full_res")[0].innerHTML=toInject,g())}),!1},a.prettyPhoto.changePage=function(b){currentGalleryPage=0,"previous"==b?(set_position--,set_position<0&&(set_position=a(pp_images).size()-1)):"next"==b?(set_position++,set_position>a(pp_images).size()-1&&(set_position=0)):set_position=b,rel_index=set_position,doresize||(doresize=!0),settings.allow_expand&&a(".pp_contract").removeClass("pp_contract").addClass("pp_expand"),h(function(){a.prettyPhoto.open()})},a.prettyPhoto.changeGalleryPage=function(a){"next"==a?(currentGalleryPage++,currentGalleryPage>totalPage&&(currentGalleryPage=0)):"previous"==a?(currentGalleryPage--,currentGalleryPage<0&&(currentGalleryPage=totalPage)):currentGalleryPage=a,slide_speed="next"==a||"previous"==a?settings.animation_speed:0,slide_to=currentGalleryPage*(itemsPerPage*itemWidth),$pp_gallery.find("ul").animate({left:-slide_to},slide_speed)},a.prettyPhoto.startSlideshow=function(){"undefined"==typeof x?($pp_pic_holder.find(".pp_play").unbind("click").removeClass("pp_play").addClass("pp_pause").click(function(){return a.prettyPhoto.stopSlideshow(),!1}),x=setInterval(a.prettyPhoto.startSlideshow,settings.slideshow)):a.prettyPhoto.changePage("next")},a.prettyPhoto.stopSlideshow=function(){$pp_pic_holder.find(".pp_pause").unbind("click").removeClass("pp_pause").addClass("pp_play").click(function(){return a.prettyPhoto.startSlideshow(),!1}),clearInterval(x),x=void 0},a.prettyPhoto.close=function(){C(!0),$pp_overlay.is(":animated")||(a.prettyPhoto.stopSlideshow(),$pp_pic_holder.stop().find("object,embed").css("visibility","hidden"),a("div.pp_pic_holder,div.ppt,.pp_fade").fadeOut(settings.animation_speed,function(){a(this).remove()}),$pp_overlay.fadeOut(settings.animation_speed,function(){settings.hideflash&&a("object,embed,iframe[src*=youtube],iframe[src*=vimeo]").css("visibility","visible"),a(this).remove(),a(window).unbind("scroll.prettyphoto"),d(),settings.callback(),doresize=!0,s=!1,delete settings}))},!pp_alreadyInitialized&&b()&&(pp_alreadyInitialized=!0,hashIndex=b(),hashRel=hashIndex,hashIndex=hashIndex.substring(hashIndex.indexOf("/")+1,hashIndex.length-1),hashRel=hashRel.substring(0,hashRel.indexOf("/")),setTimeout(function(){a("a["+f.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger("click")},50)),this.unbind("click.prettyphoto").bind("click.prettyphoto",a.prettyPhoto.initialize)}}(jQuery);var pp_alreadyInitialized=!1;
var JSON;JSON||(JSON={}),function(){"use strict";function f(a){return 10>a?"0"+a:a}function quote(a){return escapable.lastIndex=0,escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return"string"==typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g,h=gap,i=b[a];switch(i&&"object"==typeof i&&"function"==typeof i.toJSON&&(i=i.toJSON(a)),"function"==typeof rep&&(i=rep.call(b,a,i)),typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";if(gap+=indent,g=[],"[object Array]"===Object.prototype.toString.apply(i)){for(f=i.length,c=0;f>c;c+=1)g[c]=str(c,i)||"null";return e=0===g.length?"[]":gap?"[\n"+gap+g.join(",\n"+gap)+"\n"+h+"]":"["+g.join(",")+"]",gap=h,e}if(rep&&"object"==typeof rep)for(f=rep.length,c=0;f>c;c+=1)"string"==typeof rep[c]&&(d=rep[c],e=str(d,i),e&&g.push(quote(d)+(gap?": ":":")+e));else for(d in i)Object.prototype.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&g.push(quote(d)+(gap?": ":":")+e));return e=0===g.length?"{}":gap?"{\n"+gap+g.join(",\n"+gap)+"\n"+h+"}":"{"+g.join(",")+"}",gap=h,e}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(a){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","	":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(a,b,c){var d;if(gap="",indent="","number"==typeof c)for(d=0;c>d;d+=1)indent+=" ";else"string"==typeof c&&(indent=c);if(rep=b,b&&"function"!=typeof b&&("object"!=typeof b||"number"!=typeof b.length))throw new Error("JSON.stringify");return str("",{"":a})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&"object"==typeof e)for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&(d=walk(e,c),void 0!==d?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}();
!function(a){"use strict";var b=a.tablesorter={version:"2.31.0",parsers:[],widgets:[],defaults:{theme:"default",widthFixed:!1,showProcessing:!1,headerTemplate:"{content}",onRenderTemplate:null,onRenderHeader:null,cancelSelection:!0,tabIndex:!0,dateFormat:"mmddyyyy",sortMultiSortKey:"shiftKey",sortResetKey:"ctrlKey",usNumberFormat:!0,delayInit:!1,serverSideSorting:!1,resort:!0,headers:{},ignoreCase:!0,sortForce:null,sortList:[],sortAppend:null,sortStable:!1,sortInitialOrder:"asc",sortLocaleCompare:!1,sortReset:!1,sortRestart:!1,emptyTo:"bottom",stringTo:"max",duplicateSpan:!0,textExtraction:"basic",textAttribute:"data-text",textSorter:null,numberSorter:null,initWidgets:!0,widgetClass:"widget-{name}",widgets:[],widgetOptions:{zebra:["even","odd"]},initialized:null,tableClass:"",cssAsc:"",cssDesc:"",cssNone:"",cssHeader:"",cssHeaderRow:"",cssProcessing:"",cssChildRow:"tablesorter-childRow",cssInfoBlock:"tablesorter-infoOnly",cssNoSort:"tablesorter-noSort",cssIgnoreRow:"tablesorter-ignoreRow",cssIcon:"tablesorter-icon",cssIconNone:"",cssIconAsc:"",cssIconDesc:"",cssIconDisabled:"",pointerClick:"click",pointerDown:"mousedown",pointerUp:"mouseup",selectorHeaders:"> thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[],globalize:0,imgAttr:0},css:{table:"tablesorter",cssHasChild:"tablesorter-hasChildRow",childRow:"tablesorter-childRow",colgroup:"tablesorter-colgroup",header:"tablesorter-header",headerRow:"tablesorter-headerRow",headerIn:"tablesorter-header-inner",icon:"tablesorter-icon",processing:"tablesorter-processing",sortAsc:"tablesorter-headerAsc",sortDesc:"tablesorter-headerDesc",sortNone:"tablesorter-headerUnSorted"},language:{sortAsc:"Ascending sort applied, ",sortDesc:"Descending sort applied, ",sortNone:"No sort applied, ",sortDisabled:"sorting is disabled",nextAsc:"activate to apply an ascending sort",nextDesc:"activate to apply a descending sort",nextNone:"activate to remove the sort"},regex:{templateContent:/\{content\}/g,templateIcon:/\{icon\}/g,templateName:/\{name\}/i,spaces:/\s+/g,nonWord:/\W/g,formElements:/(input|select|button|textarea)/i,chunk:/(^([+\-]?(?:\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,chunks:/(^\\0|\\0$)/,hex:/^0x[0-9a-f]+$/i,comma:/,/g,digitNonUS:/[\s|\.]/g,digitNegativeTest:/^\s*\([.\d]+\)/,digitNegativeReplace:/^\s*\(([.\d]+)\)/,digitTest:/^[\-+(]?\d+[)]?$/,digitReplace:/[,.'"\s]/g},string:{max:1,min:-1,emptymin:1,emptymax:-1,zero:0,none:0,"null":0,top:!0,bottom:!1},keyCodes:{enter:13},dates:{},instanceMethods:{},setup:function(c,d){if(!c||!c.tHead||0===c.tBodies.length||c.hasInitialized===!0)return void(b.debug(d,"core")&&(c.hasInitialized?console.warn("Stopping initialization. Tablesorter has already been initialized"):console.error("Stopping initialization! No table, thead or tbody",c)));var e="",f=a(c),g=a.metadata;c.hasInitialized=!1,c.isProcessing=!0,c.config=d,a.data(c,"tablesorter",d),b.debug(d,"core")&&(console[console.group?"group":"log"]("Initializing tablesorter v"+b.version),a.data(c,"startoveralltimer",new Date)),d.supportsDataObject=function(a){return a[0]=parseInt(a[0],10),a[0]>1||1===a[0]&&parseInt(a[1],10)>=4}(a.fn.jquery.split(".")),d.emptyTo=d.emptyTo.toLowerCase(),d.stringTo=d.stringTo.toLowerCase(),d.last={sortList:[],clickedIndex:-1},/tablesorter\-/.test(f.attr("class"))||(e=""!==d.theme?" tablesorter-"+d.theme:""),d.namespace?d.namespace="."+d.namespace.replace(b.regex.nonWord,""):d.namespace=".tablesorter"+Math.random().toString(16).slice(2),d.table=c,d.$table=f.addClass(b.css.table+" "+d.tableClass+e+" "+d.namespace.slice(1)).attr("role","grid"),d.$headers=f.find(d.selectorHeaders),d.$table.children().children("tr").attr("role","row"),d.$tbodies=f.children("tbody:not(."+d.cssInfoBlock+")").attr({"aria-live":"polite","aria-relevant":"all"}),d.$table.children("caption").length&&(e=d.$table.children("caption")[0],e.id||(e.id=d.namespace.slice(1)+"caption"),d.$table.attr("aria-labelledby",e.id)),d.widgetInit={},d.textExtraction=d.$table.attr("data-text-extraction")||d.textExtraction||"basic",b.buildHeaders(d),b.fixColumnWidth(c),b.addWidgetFromClass(c),b.applyWidgetOptions(c),b.setupParsers(d),d.totalRows=0,d.debug&&b.validateOptions(d),d.delayInit||b.buildCache(d),b.bindEvents(c,d.$headers,!0),b.bindMethods(d),d.supportsDataObject&&"undefined"!=typeof f.data().sortlist?d.sortList=f.data().sortlist:g&&f.metadata()&&f.metadata().sortlist&&(d.sortList=f.metadata().sortlist),b.applyWidget(c,!0),d.sortList.length>0?b.sortOn(d,d.sortList,{},!d.initWidgets):(b.setHeadersCss(d),d.initWidgets&&b.applyWidget(c,!1)),d.showProcessing&&f.unbind("sortBegin"+d.namespace+" sortEnd"+d.namespace).bind("sortBegin"+d.namespace+" sortEnd"+d.namespace,function(a){clearTimeout(d.timerProcessing),b.isProcessing(c),"sortBegin"===a.type&&(d.timerProcessing=setTimeout(function(){b.isProcessing(c,!0)},500))}),c.hasInitialized=!0,c.isProcessing=!1,b.debug(d,"core")&&(console.log("Overall initialization time:"+b.benchmark(a.data(c,"startoveralltimer"))),b.debug(d,"core")&&console.groupEnd&&console.groupEnd()),f.triggerHandler("tablesorter-initialized",c),"function"==typeof d.initialized&&d.initialized(c)},bindMethods:function(c){var d=c.$table,e=c.namespace,f="sortReset update updateRows updateAll updateHeaders addRows updateCell updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave ".split(" ").join(e+" ");d.unbind(f.replace(b.regex.spaces," ")).bind("sortReset"+e,function(a,c){a.stopPropagation(),b.sortReset(this.config,function(a){a.isApplyingWidgets?setTimeout(function(){b.applyWidget(a,"",c)},100):b.applyWidget(a,"",c)})}).bind("updateAll"+e,function(a,c,d){a.stopPropagation(),b.updateAll(this.config,c,d)}).bind("update"+e+" updateRows"+e,function(a,c,d){a.stopPropagation(),b.update(this.config,c,d)}).bind("updateHeaders"+e,function(a,c){a.stopPropagation(),b.updateHeaders(this.config,c)}).bind("updateCell"+e,function(a,c,d,e){a.stopPropagation(),b.updateCell(this.config,c,d,e)}).bind("addRows"+e,function(a,c,d,e){a.stopPropagation(),b.addRows(this.config,c,d,e)}).bind("updateComplete"+e,function(){this.isUpdating=!1}).bind("sorton"+e,function(a,c,d,e){a.stopPropagation(),b.sortOn(this.config,c,d,e)}).bind("appendCache"+e,function(c,d,e){c.stopPropagation(),b.appendCache(this.config,e),a.isFunction(d)&&d(this)}).bind("updateCache"+e,function(a,c,d){a.stopPropagation(),b.updateCache(this.config,c,d)}).bind("applyWidgetId"+e,function(a,c){a.stopPropagation(),b.applyWidgetId(this,c)}).bind("applyWidgets"+e,function(a,c){a.stopPropagation(),b.applyWidget(this,!1,c)}).bind("refreshWidgets"+e,function(a,c,d){a.stopPropagation(),b.refreshWidgets(this,c,d)}).bind("removeWidget"+e,function(a,c,d){a.stopPropagation(),b.removeWidget(this,c,d)}).bind("destroy"+e,function(a,c,d){a.stopPropagation(),b.destroy(this,c,d)}).bind("resetToLoadState"+e,function(d){d.stopPropagation(),b.removeWidget(this,!0,!1);var e=a.extend(!0,{},c.originalSettings);c=a.extend(!0,{},b.defaults,e),c.originalSettings=e,this.hasInitialized=!1,b.setup(this,c)})},bindEvents:function(c,d,e){c=a(c)[0];var f,g=c.config,h=g.namespace,i=null;e!==!0&&(d.addClass(h.slice(1)+"_extra_headers"),f=b.getClosest(d,"table"),f.length&&"TABLE"===f[0].nodeName&&f[0]!==c&&a(f[0]).addClass(h.slice(1)+"_extra_table")),f=(g.pointerDown+" "+g.pointerUp+" "+g.pointerClick+" sort keyup ").replace(b.regex.spaces," ").split(" ").join(h+" "),d.find(g.selectorSort).add(d.filter(g.selectorSort)).unbind(f).bind(f,function(c,d){var e,f,h,j=a(c.target),k=" "+c.type+" ";if(!(1!==(c.which||c.button)&&!k.match(" "+g.pointerClick+" | sort | keyup ")||" keyup "===k&&c.which!==b.keyCodes.enter||k.match(" "+g.pointerClick+" ")&&"undefined"!=typeof c.which||k.match(" "+g.pointerUp+" ")&&i!==c.target&&d!==!0)){if(k.match(" "+g.pointerDown+" "))return i=c.target,h=j.jquery.split("."),void("1"===h[0]&&h[1]<4&&c.preventDefault());if(i=null,e=b.getClosest(a(this),"."+b.css.header),b.regex.formElements.test(c.target.nodeName)||j.hasClass(g.cssNoSort)||j.parents("."+g.cssNoSort).length>0||e.hasClass("sorter-false")||j.parents("button").length>0)return!g.cancelSelection;g.delayInit&&b.isEmptyObject(g.cache)&&b.buildCache(g),g.last.clickedIndex=e.attr("data-column")||e.index(),f=g.$headerIndexed[g.last.clickedIndex][0],f&&!f.sortDisabled&&b.initSort(g,f,c)}}),g.cancelSelection&&d.attr("unselectable","on").bind("selectstart",!1).css({"user-select":"none",MozUserSelect:"none"})},buildHeaders:function(c){var d,e,f,g;for(c.headerList=[],c.headerContent=[],c.sortVars=[],b.debug(c,"core")&&(f=new Date),c.columns=b.computeColumnIndex(c.$table.children("thead, tfoot").children("tr")),e=c.cssIcon?'<i class="'+(c.cssIcon===b.css.icon?b.css.icon:c.cssIcon+" "+b.css.icon)+'"></i>':"",c.$headers=a(a.map(c.$table.find(c.selectorHeaders),function(d,f){var g,h,i,j,k,l=a(d);if(!b.getClosest(l,"tr").hasClass(c.cssIgnoreRow))return/(th|td)/i.test(d.nodeName)||(k=b.getClosest(l,"th, td"),l.attr("data-column",k.attr("data-column"))),g=b.getColumnData(c.table,c.headers,f,!0),c.headerContent[f]=l.html(),""===c.headerTemplate||l.find("."+b.css.headerIn).length||(j=c.headerTemplate.replace(b.regex.templateContent,l.html()).replace(b.regex.templateIcon,l.find("."+b.css.icon).length?"":e),c.onRenderTemplate&&(h=c.onRenderTemplate.apply(l,[f,j]),h&&"string"==typeof h&&(j=h)),l.html('<div class="'+b.css.headerIn+'">'+j+"</div>")),c.onRenderHeader&&c.onRenderHeader.apply(l,[f,c,c.$table]),i=parseInt(l.attr("data-column"),10),d.column=i,k=b.getOrder(b.getData(l,g,"sortInitialOrder")||c.sortInitialOrder),c.sortVars[i]={count:-1,order:k?c.sortReset?[1,0,2]:[1,0]:c.sortReset?[0,1,2]:[0,1],lockedOrder:!1,sortedBy:""},k=b.getData(l,g,"lockedOrder")||!1,"undefined"!=typeof k&&k!==!1&&(c.sortVars[i].lockedOrder=!0,c.sortVars[i].order=b.getOrder(k)?[1,1]:[0,0]),c.headerList[f]=d,l.addClass(b.css.header+" "+c.cssHeader),b.getClosest(l,"tr").addClass(b.css.headerRow+" "+c.cssHeaderRow).attr("role","row"),c.tabIndex&&l.attr("tabindex",0),d})),c.$headerIndexed=[],g=0;g<c.columns;g++)b.isEmptyObject(c.sortVars[g])&&(c.sortVars[g]={}),d=c.$headers.filter('[data-column="'+g+'"]'),c.$headerIndexed[g]=d.length?d.not(".sorter-false").length?d.not(".sorter-false").filter(":last"):d.filter(":last"):a();c.$table.find(c.selectorHeaders).attr({scope:"col",role:"columnheader"}),b.updateHeader(c),b.debug(c,"core")&&(console.log("Built headers:"+b.benchmark(f)),console.log(c.$headers))},addInstanceMethods:function(c){a.extend(b.instanceMethods,c)},setupParsers:function(a,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r=a.table,s=0,t=b.debug(a,"core"),u={};if(a.$tbodies=a.$table.children("tbody:not(."+a.cssInfoBlock+")"),p="undefined"==typeof c?a.$tbodies:c,q=p.length,0===q)return t?console.warn("Warning: *Empty table!* Not building a parser cache"):"";for(t&&(o=new Date,console[console.group?"group":"log"]("Detecting parsers for each column")),e={extractors:[],parsers:[]};q>s;){if(d=p[s].rows,d.length)for(h=0,g=a.columns,i=0;g>i;i++){if(j=a.$headerIndexed[h],j&&j.length&&(k=b.getColumnData(r,a.headers,h),n=b.getParserById(b.getData(j,k,"extractor")),m=b.getParserById(b.getData(j,k,"sorter")),l="false"===b.getData(j,k,"parser"),a.empties[h]=(b.getData(j,k,"empty")||a.emptyTo||(a.emptyToBottom?"bottom":"top")).toLowerCase(),a.strings[h]=(b.getData(j,k,"string")||a.stringTo||"max").toLowerCase(),l&&(m=b.getParserById("no-parser")),n||(n=!1),m||(m=b.detectParserForColumn(a,d,-1,h)),t&&(u["("+h+") "+j.text()]={parser:m.id,extractor:n?n.id:"none",string:a.strings[h],empty:a.empties[h]}),e.parsers[h]=m,e.extractors[h]=n,f=j[0].colSpan-1,f>0))for(h+=f,g+=f;f+1>0;)e.parsers[h-f]=m,e.extractors[h-f]=n,f--;h++}s+=e.parsers.length?q:1}t&&(b.isEmptyObject(u)?console.warn("  No parsers detected!"):console[console.table?"table":"log"](u),console.log("Completed detecting parsers"+b.benchmark(o)),console.groupEnd&&console.groupEnd()),a.parsers=e.parsers,a.extractors=e.extractors},addParser:function(a){var c,d=b.parsers.length,e=!0;for(c=0;d>c;c++)b.parsers[c].id.toLowerCase()===a.id.toLowerCase()&&(e=!1);e&&(b.parsers[b.parsers.length]=a)},getParserById:function(a){if("false"==a)return!1;var c,d=b.parsers.length;for(c=0;d>c;c++)if(b.parsers[c].id.toLowerCase()===a.toString().toLowerCase())return b.parsers[c];return!1},detectParserForColumn:function(c,d,e,f){for(var g,h,i,j=b.parsers.length,k=!1,l="",m=b.debug(c,"core"),n=!0;""===l&&n;)e++,i=d[e],i&&50>e?i.className.indexOf(b.cssIgnoreRow)<0&&(k=d[e].cells[f],l=b.getElementText(c,k,f),h=a(k),m&&console.log("Checking if value was empty on row "+e+", column: "+f+': "'+l+'"')):n=!1;for(;--j>=0;)if(g=b.parsers[j],g&&"text"!==g.id&&g.is&&g.is(l,c.table,k,h))return g;return b.getParserById("text")},getElementText:function(c,d,e){if(!d)return"";var f,g=c.textExtraction||"",h=d.jquery?d:a(d);return"string"==typeof g?"basic"===g&&"undefined"!=typeof(f=h.attr(c.textAttribute))?a.trim(f):a.trim(d.textContent||h.text()):"function"==typeof g?a.trim(g(h[0],c.table,e)):"function"==typeof(f=b.getColumnData(c.table,g,e))?a.trim(f(h[0],c.table,e)):a.trim(h[0].textContent||h.text())},getParsedText:function(a,c,d,e){"undefined"==typeof e&&(e=b.getElementText(a,c,d));var f=""+e,g=a.parsers[d],h=a.extractors[d];return g?(h&&"function"==typeof h.format&&(e=h.format(e,a.table,c,d)),f="no-parser"===g.id?"":g.format(""+e,a.table,c,d),a.ignoreCase&&"string"==typeof f?(f=f.toLowerCase(),f.length>1?f:"a"):"string"!=typeof f&&isNaN(parseInt(f))?0:f):void 0},buildCache:function(c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B=c.table,C=c.parsers,D=b.debug(c,"core");if(c.$tbodies=c.$table.children("tbody:not(."+c.cssInfoBlock+")"),l="undefined"==typeof e?c.$tbodies:e,c.cache={},c.totalRows=0,!C)return D?console.warn("Warning: *Empty table!* Not building a cache"):"";for(D&&(q=new Date),c.showProcessing&&b.isProcessing(B,!0),k=0;k<l.length;k++){for(u=[],f=c.cache[k]={normalized:[]},r=l[k]&&l[k].rows.length||0,i=0;r>i;++i)if(s={child:[],raw:[]},m=a(l[k].rows[i]),n=[],!m.hasClass(c.selectorRemove.slice(1)))if(m.hasClass(c.cssChildRow)&&0!==i)for(z=f.normalized.length-1,t=f.normalized[z][c.columns],t.$row=t.$row.add(m),m.prev().hasClass(c.cssChildRow)||m.prev().addClass(b.css.cssHasChild),o=m.children("th, td"),z=t.child.length,t.child[z]=[],w=0,y=c.columns,j=0;y>j;j++)p=o[j],p&&(t.child[z][j]=b.getParsedText(c,p,j),v=o[j].colSpan-1,v>0&&(w+=v,y+=v)),w++;else{for(s.$row=m,s.order=i,w=0,y=c.columns,j=0;y>j;++j){if(p=m[0].cells[j],p&&w<c.columns&&(x="undefined"!=typeof C[w],!x&&D&&console.warn("No parser found for row: "+i+", column: "+j+'; cell containing: "'+a(p).text()+'"; does it have a header?'),g=b.getElementText(c,p,w),s.raw[w]=g,h=b.getParsedText(c,p,w,g),n[w]=h,x&&"numeric"===(C[w].type||"").toLowerCase()&&(u[w]=Math.max(Math.abs(h)||0,u[w]||0)),v=p.colSpan-1,v>0)){for(A=0;v>=A;)h=c.duplicateSpan||0===A?g:"string"!=typeof c.textExtraction?b.getElementText(c,p,w+A)||"":"",s.raw[w+A]=h,n[w+A]=h,A++;w+=v,y+=v}w++}n[c.columns]=s,f.normalized[f.normalized.length]=n}f.colMax=u,c.totalRows+=f.normalized.length}if(c.showProcessing&&b.isProcessing(B),D){for(z=Math.min(5,c.cache[0].normalized.length),console[console.group?"group":"log"]("Building cache for "+c.totalRows+" rows (showing "+z+" rows in log) and "+c.columns+" columns"+b.benchmark(q)),g={},j=0;j<c.columns;j++)for(w=0;z>w;w++)g["row: "+w]||(g["row: "+w]={}),g["row: "+w][c.$headerIndexed[j].text()]=c.cache[0].normalized[w][j];console[console.table?"table":"log"](g),console.groupEnd&&console.groupEnd()}a.isFunction(d)&&d(B)},getColumnText:function(c,d,e,f){c=a(c)[0];var g,h,i,j,k,l,m,n,o,p,q="function"==typeof e,r="all"===d,s={raw:[],parsed:[],$cell:[]},t=c.config;if(!b.isEmptyObject(t)){for(k=t.$tbodies.length,g=0;k>g;g++)for(i=t.cache[g].normalized,l=i.length,h=0;l>h;h++)j=i[h],(!f||j[t.columns].$row.is(f))&&(p=!0,n=r?j.slice(0,t.columns):j[d],j=j[t.columns],m=r?j.raw:j.raw[d],o=r?j.$row.children():j.$row.children().eq(d),q&&(p=e({tbodyIndex:g,rowIndex:h,parsed:n,raw:m,$row:j.$row,$cell:o})),p!==!1&&(s.parsed[s.parsed.length]=n,s.raw[s.raw.length]=m,s.$cell[s.$cell.length]=o));return s}b.debug(t,"core")&&console.warn("No cache found - aborting getColumnText function!")},setHeadersCss:function(c){var d,e,f=c.sortList,g=f.length,h=b.css.sortNone+" "+c.cssNone,i=[b.css.sortAsc+" "+c.cssAsc,b.css.sortDesc+" "+c.cssDesc],j=[c.cssIconAsc,c.cssIconDesc,c.cssIconNone],k=["ascending","descending"],l=function(a,c){a.removeClass(h).addClass(i[c]).attr("aria-sort",k[c]).find("."+b.css.icon).removeClass(j[2]).addClass(j[c])},m=c.$table.find("tfoot tr").children("td, th").add(a(c.namespace+"_extra_headers")).removeClass(i.join(" ")),n=c.$headers.add(a("thead "+c.namespace+"_extra_headers")).removeClass(i.join(" ")).addClass(h).attr("aria-sort","none").find("."+b.css.icon).removeClass(j.join(" ")).end();for(n.not(".sorter-false").find("."+b.css.icon).addClass(j[2]),c.cssIconDisabled&&n.filter(".sorter-false").find("."+b.css.icon).addClass(c.cssIconDisabled),d=0;g>d;d++)if(2!==f[d][1]){if(n=c.$headers.filter(function(a){for(var d=!0,e=c.$headers.eq(a),f=parseInt(e.attr("data-column"),10),g=f+b.getClosest(e,"th, td")[0].colSpan;g>f;f++)d=d?d||b.isValueInArray(f,c.sortList)>-1:!1;return d}),n=n.not(".sorter-false").filter('[data-column="'+f[d][0]+'"]'+(1===g?":last":"")),n.length)for(e=0;e<n.length;e++)n[e].sortDisabled||l(n.eq(e),f[d][1]);m.length&&l(m.filter('[data-column="'+f[d][0]+'"]'),f[d][1])}for(g=c.$headers.length,d=0;g>d;d++)b.setColumnAriaLabel(c,c.$headers.eq(d))},getClosest:function(b,c){return a.fn.closest?b.closest(c):b.is(c)?b:b.parents(c).filter(":first")},setColumnAriaLabel:function(c,d,e){if(d.length){var f=parseInt(d.attr("data-column"),10),g=c.sortVars[f],h=d.hasClass(b.css.sortAsc)?"sortAsc":d.hasClass(b.css.sortDesc)?"sortDesc":"sortNone",i=a.trim(d.text())+": "+b.language[h];d.hasClass("sorter-false")||e===!1?i+=b.language.sortDisabled:(h=(g.count+1)%g.order.length,e=g.order[h],i+=b.language[0===e?"nextAsc":1===e?"nextDesc":"nextNone"]),d.attr("aria-label",i),g.sortedBy?d.attr("data-sortedBy",g.sortedBy):d.removeAttr("data-sortedBy")}},updateHeader:function(a){var c,d,e,f,g=a.table,h=a.$headers.length;for(c=0;h>c;c++)e=a.$headers.eq(c),f=b.getColumnData(g,a.headers,c,!0),d="false"===b.getData(e,f,"sorter")||"false"===b.getData(e,f,"parser"),b.setColumnSort(a,e,d)},setColumnSort:function(a,b,c){var d=a.table.id;b[0].sortDisabled=c,b[c?"addClass":"removeClass"]("sorter-false").attr("aria-disabled",""+c),a.tabIndex&&(c?b.removeAttr("tabindex"):b.attr("tabindex","0")),d&&(c?b.removeAttr("aria-controls"):b.attr("aria-controls",d))},updateHeaderSortCount:function(c,d){var e,f,g,h,i,j,k,l,m=d||c.sortList,n=m.length;for(c.sortList=[],h=0;n>h;h++)if(k=m[h],e=parseInt(k[0],10),e<c.columns){switch(c.sortVars[e].order||(l=b.getOrder(c.sortInitialOrder)?c.sortReset?[1,0,2]:[1,0]:c.sortReset?[0,1,2]:[0,1],c.sortVars[e].order=l,c.sortVars[e].count=0),l=c.sortVars[e].order,f=(""+k[1]).match(/^(1|d|s|o|n)/),f=f?f[0]:""){case"1":case"d":f=1;break;case"s":f=i||0;break;case"o":j=l[(i||0)%l.length],f=0===j?1:1===j?0:2;break;case"n":f=l[++c.sortVars[e].count%l.length];break;default:f=0}i=0===h?f:i,g=[e,parseInt(f,10)||0],c.sortList[c.sortList.length]=g,f=a.inArray(g[1],l),c.sortVars[e].count=f>=0?f:g[1]%l.length}},updateAll:function(a,c,d){var e=a.table;e.isUpdating=!0,b.refreshWidgets(e,!0,!0),b.buildHeaders(a),b.bindEvents(e,a.$headers,!0),b.bindMethods(a),b.commonUpdate(a,c,d)},update:function(a,c,d){var e=a.table;e.isUpdating=!0,b.updateHeader(a),b.commonUpdate(a,c,d)},updateHeaders:function(a,c){a.table.isUpdating=!0,b.buildHeaders(a),b.bindEvents(a.table,a.$headers,!0),b.resortComplete(a,c)},updateCell:function(c,d,e,f){if(a(d).closest("tr").hasClass(c.cssChildRow))return void console.warn('Tablesorter Warning! "updateCell" for child row content has been disabled, use "update" instead');if(b.isEmptyObject(c.cache))return b.updateHeader(c),void b.commonUpdate(c,e,f);c.table.isUpdating=!0,c.$table.find(c.selectorRemove).remove();var g,h,i,j,k,l,m=c.$tbodies,n=a(d),o=m.index(b.getClosest(n,"tbody")),p=c.cache[o],q=b.getClosest(n,"tr");if(d=n[0],m.length&&o>=0){if(i=m.eq(o).find("tr").not("."+c.cssChildRow).index(q),k=p.normalized[i],l=q[0].cells.length,l!==c.columns)for(j=0,g=!1,h=0;l>h;h++)g||q[0].cells[h]===d?g=!0:j+=q[0].cells[h].colSpan;else j=n.index();g=b.getElementText(c,d,j),k[c.columns].raw[j]=g,g=b.getParsedText(c,d,j,g),k[j]=g,"numeric"===(c.parsers[j].type||"").toLowerCase()&&(p.colMax[j]=Math.max(Math.abs(g)||0,p.colMax[j]||0)),g="undefined"!==e?e:c.resort,g!==!1?b.checkResort(c,g,f):b.resortComplete(c,f)}else b.debug(c,"core")&&console.error("updateCell aborted, tbody missing or not within the indicated table"),c.table.isUpdating=!1},addRows:function(c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s,t="string"==typeof d&&1===c.$tbodies.length&&/<tr/.test(d||""),u=c.table;if(t)d=a(d),c.$tbodies.append(d);else if(!(d&&d instanceof a&&b.getClosest(d,"table")[0]===c.table))return b.debug(c,"core")&&console.error("addRows method requires (1) a jQuery selector reference to rows that have already been added to the table, or (2) row HTML string to be added to a table with only one tbody"),!1;if(u.isUpdating=!0,b.isEmptyObject(c.cache))b.updateHeader(c),b.commonUpdate(c,e,f);else{for(k=d.filter("tr").attr("role","row").length,i=c.$tbodies.index(d.parents("tbody").filter(":first")),c.parsers&&c.parsers.length||b.setupParsers(c),j=0;k>j;j++){for(o=0,m=d[j].cells.length,n=c.cache[i].normalized.length,q=[],p={child:[],raw:[],$row:d.eq(j),order:n},l=0;m>l;l++)r=d[j].cells[l],g=b.getElementText(c,r,o),p.raw[o]=g,h=b.getParsedText(c,r,o,g),q[o]=h,"numeric"===(c.parsers[o].type||"").toLowerCase()&&(c.cache[i].colMax[o]=Math.max(Math.abs(h)||0,c.cache[i].colMax[o]||0)),s=r.colSpan-1,s>0&&(o+=s),o++;q[c.columns]=p,c.cache[i].normalized[n]=q}b.checkResort(c,e,f)}},updateCache:function(a,c,d){a.parsers&&a.parsers.length||b.setupParsers(a,d),b.buildCache(a,c,d)},appendCache:function(a,c){var d,e,f,g,h,i,j,k=a.table,l=a.$tbodies,m=[],n=a.cache;if(b.isEmptyObject(n))return a.appender?a.appender(k,m):k.isUpdating?a.$table.triggerHandler("updateComplete",k):"";for(b.debug(a,"core")&&(j=new Date),i=0;i<l.length;i++)if(f=l.eq(i),f.length){for(g=b.processTbody(k,f,!0),d=n[i].normalized,e=d.length,h=0;e>h;h++)m[m.length]=d[h][a.columns].$row,(!a.appender||a.pager&&!a.pager.removeRows&&!a.pager.ajax)&&g.append(d[h][a.columns].$row);b.processTbody(k,g,!1)}a.appender&&a.appender(k,m),b.debug(a,"core")&&console.log("Rebuilt table"+b.benchmark(j)),c||a.appender||b.applyWidget(k),k.isUpdating&&a.$table.triggerHandler("updateComplete",k)},commonUpdate:function(a,c,d){a.$table.find(a.selectorRemove).remove(),b.setupParsers(a),b.buildCache(a),b.checkResort(a,c,d)},initSort:function(c,d,e){if(c.table.isUpdating)return setTimeout(function(){b.initSort(c,d,e)},50);var f,g,h,i,j,k,l,m=!e[c.sortMultiSortKey],n=c.table,o=c.$headers.length,p=b.getClosest(a(d),"th, td"),q=parseInt(p.attr("data-column"),10),r="mouseup"===e.type?"user":e.type,s=c.sortVars[q].order;if(p=p[0],c.$table.triggerHandler("sortStart",n),k=(c.sortVars[q].count+1)%s.length,c.sortVars[q].count=e[c.sortResetKey]?2:k,c.sortRestart)for(h=0;o>h;h++)l=c.$headers.eq(h),k=parseInt(l.attr("data-column"),10),q!==k&&(m||l.hasClass(b.css.sortNone))&&(c.sortVars[k].count=-1);if(m){if(a.each(c.sortVars,function(a){c.sortVars[a].sortedBy=""}),c.sortList=[],c.last.sortList=[],null!==c.sortForce)for(f=c.sortForce,g=0;g<f.length;g++)f[g][0]!==q&&(c.sortList[c.sortList.length]=f[g],c.sortVars[f[g][0]].sortedBy="sortForce");if(i=s[c.sortVars[q].count],2>i&&(c.sortList[c.sortList.length]=[q,i],c.sortVars[q].sortedBy=r,p.colSpan>1))for(g=1;g<p.colSpan;g++)c.sortList[c.sortList.length]=[q+g,i],c.sortVars[q+g].count=a.inArray(i,s),c.sortVars[q+g].sortedBy=r}else if(c.sortList=a.extend([],c.last.sortList),b.isValueInArray(q,c.sortList)>=0)for(c.sortVars[q].sortedBy=r,g=0;g<c.sortList.length;g++)k=c.sortList[g],k[0]===q&&(k[1]=s[c.sortVars[q].count],2===k[1]&&(c.sortList.splice(g,1),c.sortVars[q].count=-1));else if(i=s[c.sortVars[q].count],c.sortVars[q].sortedBy=r,2>i&&(c.sortList[c.sortList.length]=[q,i],p.colSpan>1))for(g=1;g<p.colSpan;g++)c.sortList[c.sortList.length]=[q+g,i],c.sortVars[q+g].count=a.inArray(i,s),c.sortVars[q+g].sortedBy=r;if(c.last.sortList=a.extend([],c.sortList),c.sortList.length&&c.sortAppend&&(f=a.isArray(c.sortAppend)?c.sortAppend:c.sortAppend[c.sortList[0][0]],!b.isEmptyObject(f)))for(g=0;g<f.length;g++)if(f[g][0]!==q&&b.isValueInArray(f[g][0],c.sortList)<0){if(i=f[g][1],j=(""+i).match(/^(a|d|s|o|n)/))switch(k=c.sortList[0][1],j[0]){case"d":i=1;break;case"s":i=k;break;case"o":i=0===k?1:0;break;case"n":i=(k+1)%s.length;break;default:i=0}c.sortList[c.sortList.length]=[f[g][0],i],c.sortVars[f[g][0]].sortedBy="sortAppend"}c.$table.triggerHandler("sortBegin",n),setTimeout(function(){b.setHeadersCss(c),b.multisort(c),b.appendCache(c),c.$table.triggerHandler("sortBeforeEnd",n),c.$table.triggerHandler("sortEnd",n)},1)},multisort:function(a){var c,d,e,f,g,h=a.table,i=[],j=0,k=a.textSorter||"",l=a.sortList,m=l.length,n=a.$tbodies.length;if(!a.serverSideSorting&&!b.isEmptyObject(a.cache)){if(b.debug(a,"core")&&(d=new Date),"object"==typeof k)for(e=a.columns;e--;)g=b.getColumnData(h,k,e),"function"==typeof g&&(i[e]=g);for(c=0;n>c;c++)e=a.cache[c].colMax,f=a.cache[c].normalized,f.sort(function(c,d){var f,g,n,o,p,q,r;for(f=0;m>f;f++){if(n=l[f][0],o=l[f][1],j=0===o,a.sortStable&&c[n]===d[n]&&1===m)return c[a.columns].order-d[a.columns].order;if(g=/n/i.test(b.getSortType(a.parsers,n)),g&&a.strings[n]?(g="boolean"==typeof b.string[a.strings[n]]?(j?1:-1)*(b.string[a.strings[n]]?-1:1):a.strings[n]?b.string[a.strings[n]]||0:0,p=a.numberSorter?a.numberSorter(c[n],d[n],j,e[n],h):b["sortNumeric"+(j?"Asc":"Desc")](c[n],d[n],g,e[n],n,a)):(q=j?c:d,r=j?d:c,p="function"==typeof k?k(q[n],r[n],j,n,h):"function"==typeof i[n]?i[n](q[n],r[n],j,n,h):b["sortNatural"+(j?"Asc":"Desc")](c[n]||"",d[n]||"",n,a)),p)return p}return c[a.columns].order-d[a.columns].order});b.debug(a,"core")&&console.log("Applying sort "+l.toString()+b.benchmark(d))}},resortComplete:function(b,c){b.table.isUpdating&&b.$table.triggerHandler("updateComplete",b.table),a.isFunction(c)&&c(b.table)},checkResort:function(c,d,e){var f=a.isArray(d)?d:c.sortList,g="undefined"==typeof d?c.resort:d;g===!1||c.serverSideSorting||c.table.isProcessing?(b.resortComplete(c,e),b.applyWidget(c.table,!1)):f.length?b.sortOn(c,f,function(){b.resortComplete(c,e)},!0):b.sortReset(c,function(){b.resortComplete(c,e),b.applyWidget(c.table,!1)})},sortOn:function(c,d,e,f){var g,h=c.table;for(c.$table.triggerHandler("sortStart",h),g=0;g<c.columns;g++)c.sortVars[g].sortedBy=b.isValueInArray(g,d)>-1?"sorton":"";b.updateHeaderSortCount(c,d),b.setHeadersCss(c),c.delayInit&&b.isEmptyObject(c.cache)&&b.buildCache(c),c.$table.triggerHandler("sortBegin",h),b.multisort(c),b.appendCache(c,f),c.$table.triggerHandler("sortBeforeEnd",h),c.$table.triggerHandler("sortEnd",h),b.applyWidget(h),a.isFunction(e)&&e(h)},sortReset:function(c,d){c.sortList=[];var e;for(e=0;e<c.columns;e++)c.sortVars[e].count=-1,c.sortVars[e].sortedBy="";b.setHeadersCss(c),b.multisort(c),b.appendCache(c),a.isFunction(d)&&d(c.table)},getSortType:function(a,b){return a&&a[b]?a[b].type||"":""},getOrder:function(a){return/^d/i.test(a)||1===a},sortNatural:function(a,c){if(a===c)return 0;a=(a||"").toString(),c=(c||"").toString();var d,e,f,g,h,i,j=b.regex;if(j.hex.test(c)){if(d=parseInt(a.match(j.hex),16),e=parseInt(c.match(j.hex),16),e>d)return-1;if(d>e)return 1}for(d=a.replace(j.chunk,"\\0$1\\0").replace(j.chunks,"").split("\\0"),e=c.replace(j.chunk,"\\0$1\\0").replace(j.chunks,"").split("\\0"),i=Math.max(d.length,e.length),h=0;i>h;h++){if(f=isNaN(d[h])?d[h]||0:parseFloat(d[h])||0,g=isNaN(e[h])?e[h]||0:parseFloat(e[h])||0,isNaN(f)!==isNaN(g))return isNaN(f)?1:-1;if(typeof f!=typeof g&&(f+="",g+=""),g>f)return-1;if(f>g)return 1}return 0},sortNaturalAsc:function(a,c,d,e){if(a===c)return 0;var f=b.string[e.empties[d]||e.emptyTo];return""===a&&0!==f?"boolean"==typeof f?f?-1:1:-f||-1:""===c&&0!==f?"boolean"==typeof f?f?1:-1:f||1:b.sortNatural(a,c)},sortNaturalDesc:function(a,c,d,e){if(a===c)return 0;var f=b.string[e.empties[d]||e.emptyTo];return""===a&&0!==f?"boolean"==typeof f?f?-1:1:f||1:""===c&&0!==f?"boolean"==typeof f?f?1:-1:-f||-1:b.sortNatural(c,a)},sortText:function(a,b){return a>b?1:b>a?-1:0},getTextValue:function(a,b,c){if(c){var d,e=a?a.length:0,f=c+b;for(d=0;e>d;d++)f+=a.charCodeAt(d);return b*f}return 0},sortNumericAsc:function(a,c,d,e,f,g){if(a===c)return 0;var h=b.string[g.empties[f]||g.emptyTo];return""===a&&0!==h?"boolean"==typeof h?h?-1:1:-h||-1:""===c&&0!==h?"boolean"==typeof h?h?1:-1:h||1:(isNaN(a)&&(a=b.getTextValue(a,d,e)),isNaN(c)&&(c=b.getTextValue(c,d,e)),a-c)},sortNumericDesc:function(a,c,d,e,f,g){if(a===c)return 0;var h=b.string[g.empties[f]||g.emptyTo];return""===a&&0!==h?"boolean"==typeof h?h?-1:1:h||1:""===c&&0!==h?"boolean"==typeof h?h?1:-1:-h||-1:(isNaN(a)&&(a=b.getTextValue(a,d,e)),isNaN(c)&&(c=b.getTextValue(c,d,e)),c-a)},sortNumeric:function(a,b){return a-b},addWidget:function(a){a.id&&!b.isEmptyObject(b.getWidgetById(a.id))&&console.warn('"'+a.id+'" widget was loaded more than once!'),b.widgets[b.widgets.length]=a},hasWidget:function(b,c){return b=a(b),b.length&&b[0].config&&b[0].config.widgetInit[c]||!1},getWidgetById:function(a){var c,d,e=b.widgets.length;for(c=0;e>c;c++)if(d=b.widgets[c],d&&d.id&&d.id.toLowerCase()===a.toLowerCase())return d},applyWidgetOptions:function(c){var d,e,f,g=c.config,h=g.widgets.length;if(h)for(d=0;h>d;d++)e=b.getWidgetById(g.widgets[d]),e&&e.options&&(f=a.extend(!0,{},e.options),g.widgetOptions=a.extend(!0,f,g.widgetOptions),a.extend(!0,b.defaults.widgetOptions,e.options))},addWidgetFromClass:function(a){var c,d,e=a.config,f="^"+e.widgetClass.replace(b.regex.templateName,"(\\S+)+")+"$",g=new RegExp(f,"g"),h=(a.className||"").split(b.regex.spaces);if(h.length)for(c=h.length,d=0;c>d;d++)h[d].match(g)&&(e.widgets[e.widgets.length]=h[d].replace(g,"$1"))},applyWidgetId:function(c,d,e){c=a(c)[0];var f,g,h,i=c.config,j=i.widgetOptions,k=b.debug(i,"core"),l=b.getWidgetById(d);l&&(h=l.id,f=!1,a.inArray(h,i.widgets)<0&&(i.widgets[i.widgets.length]=h),k&&(g=new Date),(e||!i.widgetInit[h])&&(i.widgetInit[h]=!0,c.hasInitialized&&b.applyWidgetOptions(c),"function"==typeof l.init&&(f=!0,k&&console[console.group?"group":"log"]("Initializing "+h+" widget"),l.init(c,l,i,j))),e||"function"!=typeof l.format||(f=!0,k&&console[console.group?"group":"log"]("Updating "+h+" widget"),l.format(c,i,j,!1)),k&&f&&(console.log("Completed "+(e?"initializing ":"applying ")+h+" widget"+b.benchmark(g)),console.groupEnd&&console.groupEnd()))},applyWidget:function(c,d,e){c=a(c)[0];var f,g,h,i,j,k=c.config,l=b.debug(k,"core"),m=[];if(d===!1||!c.hasInitialized||!c.isApplyingWidgets&&!c.isUpdating){if(l&&(j=new Date),b.addWidgetFromClass(c),clearTimeout(k.timerReady),k.widgets.length){for(c.isApplyingWidgets=!0,k.widgets=a.grep(k.widgets,function(b,c){return a.inArray(b,k.widgets)===c}),h=k.widgets||[],g=h.length,f=0;g>f;f++)i=b.getWidgetById(h[f]),i&&i.id?(i.priority||(i.priority=10),m[f]=i):l&&console.warn('"'+h[f]+'" was enabled, but the widget code has not been loaded!');for(m.sort(function(a,b){return a.priority<b.priority?-1:a.priority===b.priority?0:1}),g=m.length,l&&console[console.group?"group":"log"]("Start "+(d?"initializing":"applying")+" widgets"),f=0;g>f;f++)i=m[f],i&&i.id&&b.applyWidgetId(c,i.id,d);l&&console.groupEnd&&console.groupEnd()}k.timerReady=setTimeout(function(){c.isApplyingWidgets=!1,a.data(c,"lastWidgetApplication",new Date),k.$table.triggerHandler("tablesorter-ready"),d||"function"!=typeof e||e(c),l&&(i=k.widgets.length,console.log("Completed "+(d===!0?"initializing ":"applying ")+i+" widget"+(1!==i?"s":"")+b.benchmark(j)))},10)}},removeWidget:function(c,d,e){c=a(c)[0];
var f,g,h,i,j=c.config;if(d===!0)for(d=[],i=b.widgets.length,h=0;i>h;h++)g=b.widgets[h],g&&g.id&&(d[d.length]=g.id);else d=(a.isArray(d)?d.join(","):d||"").toLowerCase().split(/[\s,]+/);for(i=d.length,f=0;i>f;f++)g=b.getWidgetById(d[f]),h=a.inArray(d[f],j.widgets),h>=0&&e!==!0&&j.widgets.splice(h,1),g&&g.remove&&(b.debug(j,"core")&&console.log((e?"Refreshing":"Removing")+' "'+d[f]+'" widget'),g.remove(c,j,j.widgetOptions,e),j.widgetInit[d[f]]=!1);j.$table.triggerHandler("widgetRemoveEnd",c)},refreshWidgets:function(c,d,e){c=a(c)[0];var f,g,h=c.config,i=h.widgets,j=b.widgets,k=j.length,l=[],m=function(b){a(b).triggerHandler("refreshComplete")};for(f=0;k>f;f++)g=j[f],g&&g.id&&(d||a.inArray(g.id,i)<0)&&(l[l.length]=g.id);b.removeWidget(c,l.join(","),!0),e!==!0?(b.applyWidget(c,d||!1,m),d&&b.applyWidget(c,!1,m)):m(c)},benchmark:function(a){return" ("+((new Date).getTime()-a.getTime())+" ms)"},log:function(){console.log(arguments)},debug:function(a,b){return a&&(a.debug===!0||"string"==typeof a.debug&&a.debug.indexOf(b)>-1)},isEmptyObject:function(a){for(var b in a)return!1;return!0},isValueInArray:function(a,b){var c,d=b&&b.length||0;for(c=0;d>c;c++)if(b[c][0]===a)return c;return-1},formatFloat:function(c,d){if("string"!=typeof c||""===c)return c;var e,f=d&&d.config?d.config.usNumberFormat!==!1:"undefined"!=typeof d?d:!0;return c=f?c.replace(b.regex.comma,""):c.replace(b.regex.digitNonUS,"").replace(b.regex.comma,"."),b.regex.digitNegativeTest.test(c)&&(c=c.replace(b.regex.digitNegativeReplace,"-$1")),e=parseFloat(c),isNaN(e)?a.trim(c):e},isDigit:function(a){return isNaN(a)?b.regex.digitTest.test(a.toString().replace(b.regex.digitReplace,"")):""!==a},computeColumnIndex:function(c,d){var e,f,g,h,i,j,k,l,m,n,o=d&&d.columns||0,p=[],q=new Array(o);for(e=0;e<c.length;e++)for(j=c[e].cells,f=0;f<j.length;f++){for(i=j[f],k=e,l=i.rowSpan||1,m=i.colSpan||1,"undefined"==typeof p[k]&&(p[k]=[]),g=0;g<p[k].length+1;g++)if("undefined"==typeof p[k][g]){n=g;break}for(o&&i.cellIndex===n||(i.setAttribute?i.setAttribute("data-column",n):a(i).attr("data-column",n)),g=k;k+l>g;g++)for("undefined"==typeof p[g]&&(p[g]=[]),q=p[g],h=n;n+m>h;h++)q[h]="x"}return b.checkColumnCount(c,p,q.length),q.length},checkColumnCount:function(a,b,c){var d,e,f=!0,g=[];for(d=0;d<b.length;d++)if(b[d]&&(e=b[d].length,b[d].length!==c)){f=!1;break}f||(a.each(function(a,b){var c=b.parentElement.nodeName;g.indexOf(c)<0&&g.push(c)}),console.error("Invalid or incorrect number of columns in the "+g.join(" or ")+"; expected "+c+", but found "+e+" columns"))},fixColumnWidth:function(c){c=a(c)[0];var d,e,f,g,h,i=c.config,j=i.$table.children("colgroup");if(j.length&&j.hasClass(b.css.colgroup)&&j.remove(),i.widthFixed&&0===i.$table.children("colgroup").length){for(j=a('<colgroup class="'+b.css.colgroup+'">'),d=i.$table.width(),f=i.$tbodies.find("tr:first").children(":visible"),g=f.length,h=0;g>h;h++)e=parseInt(f.eq(h).width()/d*1e3,10)/10+"%",j.append(a("<col>").css("width",e));i.$table.prepend(j)}},getData:function(b,c,d){var e,f,g="",h=a(b);return h.length?(e=a.metadata?h.metadata():!1,f=" "+(h.attr("class")||""),"undefined"!=typeof h.data(d)||"undefined"!=typeof h.data(d.toLowerCase())?g+=h.data(d)||h.data(d.toLowerCase()):e&&"undefined"!=typeof e[d]?g+=e[d]:c&&"undefined"!=typeof c[d]?g+=c[d]:" "!==f&&f.match(" "+d+"-")&&(g=f.match(new RegExp("\\s"+d+"-([\\w-]+)"))[1]||""),a.trim(g)):""},getColumnData:function(b,c,d,e,f){if("object"!=typeof c||null===c)return c;b=a(b)[0];var g,h,i=b.config,j=f||i.$headers,k=i.$headerIndexed&&i.$headerIndexed[d]||j.find('[data-column="'+d+'"]:last');if("undefined"!=typeof c[d])return e?c[d]:c[j.index(k)];for(h in c)if("string"==typeof h&&(g=k.filter(h).add(k.find(h)),g.length))return c[h]},isProcessing:function(c,d,e){c=a(c);var f=c[0].config,g=e||c.find("."+b.css.header);d?("undefined"!=typeof e&&f.sortList.length>0&&(g=g.filter(function(){return this.sortDisabled?!1:b.isValueInArray(parseFloat(a(this).attr("data-column")),f.sortList)>=0})),c.add(g).addClass(b.css.processing+" "+f.cssProcessing)):c.add(g).removeClass(b.css.processing+" "+f.cssProcessing)},processTbody:function(b,c,d){if(b=a(b)[0],d)return b.isProcessing=!0,c.before('<colgroup class="tablesorter-savemyplace"/>'),a.fn.detach?c.detach():c.remove();var e=a(b).find("colgroup.tablesorter-savemyplace");c.insertAfter(e),e.remove(),b.isProcessing=!1},clearTableBody:function(b){a(b)[0].config.$tbodies.children().detach()},characterEquivalents:{a:"áàâãäąå",A:"ÁÀÂÃÄĄÅ",c:"çćč",C:"ÇĆČ",e:"éèêëěę",E:"ÉÈÊËĚĘ",i:"íìİîïı",I:"ÍÌİÎÏ",o:"óòôõöō",O:"ÓÒÔÕÖŌ",ss:"ß",SS:"ẞ",u:"úùûüů",U:"ÚÙÛÜŮ"},replaceAccents:function(a){var c,d="[",e=b.characterEquivalents;if(!b.characterRegex){b.characterRegexArray={};for(c in e)"string"==typeof c&&(d+=e[c],b.characterRegexArray[c]=new RegExp("["+e[c]+"]","g"));b.characterRegex=new RegExp(d+"]")}if(b.characterRegex.test(a))for(c in e)"string"==typeof c&&(a=a.replace(b.characterRegexArray[c],c));return a},validateOptions:function(c){var d,e,f,g,h="headers sortForce sortList sortAppend widgets".split(" "),i=c.originalSettings;if(i){b.debug(c,"core")&&(g=new Date);for(d in i)if(f=typeof b.defaults[d],"undefined"===f)console.warn('Tablesorter Warning! "table.config.'+d+'" option not recognized');else if("object"===f)for(e in i[d])f=b.defaults[d]&&typeof b.defaults[d][e],a.inArray(d,h)<0&&"undefined"===f&&console.warn('Tablesorter Warning! "table.config.'+d+"."+e+'" option not recognized');b.debug(c,"core")&&console.log("validate options time:"+b.benchmark(g))}},restoreHeaders:function(c){var d,e,f=a(c)[0].config,g=f.$table.find(f.selectorHeaders),h=g.length;for(d=0;h>d;d++)e=g.eq(d),e.find("."+b.css.headerIn).length&&e.html(f.headerContent[d])},destroy:function(c,d,e){if(c=a(c)[0],c.hasInitialized){b.removeWidget(c,!0,!1);var f,g=a(c),h=c.config,i=g.find("thead:first"),j=i.find("tr."+b.css.headerRow).removeClass(b.css.headerRow+" "+h.cssHeaderRow),k=g.find("tfoot:first > tr").children("th, td");d===!1&&a.inArray("uitheme",h.widgets)>=0&&(g.triggerHandler("applyWidgetId",["uitheme"]),g.triggerHandler("applyWidgetId",["zebra"])),i.find("tr").not(j).remove(),f="sortReset update updateRows updateAll updateHeaders updateCell addRows updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets removeWidget destroy mouseup mouseleave "+"keypress sortBegin sortEnd resetToLoadState ".split(" ").join(h.namespace+" "),g.removeData("tablesorter").unbind(f.replace(b.regex.spaces," ")),h.$headers.add(k).removeClass([b.css.header,h.cssHeader,h.cssAsc,h.cssDesc,b.css.sortAsc,b.css.sortDesc,b.css.sortNone].join(" ")).removeAttr("data-column").removeAttr("aria-label").attr("aria-disabled","true"),j.find(h.selectorSort).unbind("mousedown mouseup keypress ".split(" ").join(h.namespace+" ").replace(b.regex.spaces," ")),b.restoreHeaders(c),g.toggleClass(b.css.table+" "+h.tableClass+" tablesorter-"+h.theme,d===!1),g.removeClass(h.namespace.slice(1)),c.hasInitialized=!1,delete c.config.cache,"function"==typeof e&&e(c),b.debug(h,"core")&&console.log("tablesorter has been removed")}}};a.fn.tablesorter=function(c){return this.each(function(){var d=this,e=a.extend(!0,{},b.defaults,c,b.instanceMethods);e.originalSettings=c,!d.hasInitialized&&b.buildTable&&"TABLE"!==this.nodeName?b.buildTable(d,e):b.setup(d,e)})},window.console&&window.console.log||(b.logs=[],console={},console.log=console.warn=console.error=console.table=function(){var a=arguments.length>1?arguments:arguments[0];b.logs[b.logs.length]={date:Date.now(),log:a}}),b.addParser({id:"no-parser",is:function(){return!1},format:function(){return""},type:"text"}),b.addParser({id:"text",is:function(){return!0},format:function(c,d){var e=d.config;return c&&(c=a.trim(e.ignoreCase?c.toLocaleLowerCase():c),c=e.sortLocaleCompare?b.replaceAccents(c):c),c},type:"text"}),b.regex.nondigit=/[^\w,. \-()]/g,b.addParser({id:"digit",is:function(a){return b.isDigit(a)},format:function(c,d){var e=b.formatFloat((c||"").replace(b.regex.nondigit,""),d);return c&&"number"==typeof e?e:c?a.trim(c&&d.config.ignoreCase?c.toLocaleLowerCase():c):c},type:"numeric"}),b.regex.currencyReplace=/[+\-,. ]/g,b.regex.currencyTest=/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/,b.addParser({id:"currency",is:function(a){return a=(a||"").replace(b.regex.currencyReplace,""),b.regex.currencyTest.test(a)},format:function(c,d){var e=b.formatFloat((c||"").replace(b.regex.nondigit,""),d);return c&&"number"==typeof e?e:c?a.trim(c&&d.config.ignoreCase?c.toLocaleLowerCase():c):c},type:"numeric"}),b.regex.urlProtocolTest=/^(https?|ftp|file):\/\//,b.regex.urlProtocolReplace=/(https?|ftp|file):\/\/(www\.)?/,b.addParser({id:"url",is:function(a){return b.regex.urlProtocolTest.test(a)},format:function(c){return c?a.trim(c.replace(b.regex.urlProtocolReplace,"")):c},type:"text"}),b.regex.dash=/-/g,b.regex.isoDate=/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/,b.addParser({id:"isoDate",is:function(a){return b.regex.isoDate.test(a)},format:function(a){var c=a?new Date(a.replace(b.regex.dash,"/")):a;return c instanceof Date&&isFinite(c)?c.getTime():a},type:"numeric"}),b.regex.percent=/%/g,b.regex.percentTest=/(\d\s*?%|%\s*?\d)/,b.addParser({id:"percent",is:function(a){return b.regex.percentTest.test(a)&&a.length<15},format:function(a,c){return a?b.formatFloat(a.replace(b.regex.percent,""),c):a},type:"numeric"}),b.addParser({id:"image",is:function(a,b,c,d){return d.find("img").length>0},format:function(b,c,d){return a(d).find("img").attr(c.config.imgAttr||"alt")||b},parsed:!0,type:"text"}),b.regex.dateReplace=/(\S)([AP]M)$/i,b.regex.usLongDateTest1=/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i,b.regex.usLongDateTest2=/^\d{1,2}\s+[A-Z]{3,10}\s+\d{4}/i,b.addParser({id:"usLongDate",is:function(a){return b.regex.usLongDateTest1.test(a)||b.regex.usLongDateTest2.test(a)},format:function(a){var c=a?new Date(a.replace(b.regex.dateReplace,"$1 $2")):a;return c instanceof Date&&isFinite(c)?c.getTime():a},type:"numeric"}),b.regex.shortDateTest=/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/,b.regex.shortDateReplace=/[\-.,]/g,b.regex.shortDateXXY=/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,b.regex.shortDateYMD=/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,b.convertFormat=function(a,c){a=(a||"").replace(b.regex.spaces," ").replace(b.regex.shortDateReplace,"/"),"mmddyyyy"===c?a=a.replace(b.regex.shortDateXXY,"$3/$1/$2"):"ddmmyyyy"===c?a=a.replace(b.regex.shortDateXXY,"$3/$2/$1"):"yyyymmdd"===c&&(a=a.replace(b.regex.shortDateYMD,"$1/$2/$3"));var d=new Date(a);return d instanceof Date&&isFinite(d)?d.getTime():""},b.addParser({id:"shortDate",is:function(a){return a=(a||"").replace(b.regex.spaces," ").replace(b.regex.shortDateReplace,"/"),b.regex.shortDateTest.test(a)},format:function(a,c,d,e){if(a){var f=c.config,g=f.$headerIndexed[e],h=g.length&&g.data("dateFormat")||b.getData(g,b.getColumnData(c,f.headers,e),"dateFormat")||f.dateFormat;return g.length&&g.data("dateFormat",h),b.convertFormat(a,h)||a}return a},type:"numeric"}),b.regex.timeTest=/^(0?[1-9]|1[0-2]):([0-5]\d)(\s[AP]M)$|^((?:[01]\d|[2][0-4]):[0-5]\d)$/i,b.regex.timeMatch=/(0?[1-9]|1[0-2]):([0-5]\d)(\s[AP]M)|((?:[01]\d|[2][0-4]):[0-5]\d)/i,b.addParser({id:"time",is:function(a){return b.regex.timeTest.test(a)},format:function(a){var c,d=(a||"").match(b.regex.timeMatch),e=new Date(a),f=a&&(null!==d?d[0]:"00:00 AM"),g=f?new Date("2000/01/01 "+f.replace(b.regex.dateReplace,"$1 $2")):f;return g instanceof Date&&isFinite(g)?(c=e instanceof Date&&isFinite(e)?e.getTime():0,c?parseFloat(g.getTime()+"."+e.getTime()):g.getTime()):a},type:"numeric"}),b.addParser({id:"metadata",is:function(){return!1},format:function(b,c,d){var e=c.config,f=e.parserMetadataName?e.parserMetadataName:"sortValue";return a(d).metadata()[f]},type:"numeric"}),b.addWidget({id:"zebra",priority:90,format:function(b,c,d){var e,f,g,h,i,j,k,l=new RegExp(c.cssChildRow,"i"),m=c.$tbodies.add(a(c.namespace+"_extra_table").children("tbody:not(."+c.cssInfoBlock+")"));for(i=0;i<m.length;i++)for(g=0,e=m.eq(i).children("tr:visible").not(c.selectorRemove),k=e.length,j=0;k>j;j++)f=e.eq(j),l.test(f[0].className)||g++,h=g%2===0,f.removeClass(d.zebra[h?1:0]).addClass(d.zebra[h?0:1])},remove:function(a,c,d,e){if(!e){var f,g,h=c.$tbodies,i=(d.zebra||["even","odd"]).join(" ");for(f=0;f<h.length;f++)g=b.processTbody(a,h.eq(f),!0),g.children().removeClass(i),b.processTbody(a,g,!1)}}})}(jQuery);
!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports):"function"==typeof define&&define.amd?define(["exports"],b):b(a.turf={})}(this,function(a){"use strict";function b(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var d=c.bbox,e=c.id;if(void 0===a)throw new Error("geometry is required");if(b&&b.constructor!==Object)throw new Error("properties must be an Object");d&&z(d),e&&A(e);var f={type:"Feature"};return e&&(f.id=e),d&&(f.bbox=d),f.properties=b||{},f.geometry=a,f}function c(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var e=c.bbox;if(!a)throw new Error("type is required");if(!b)throw new Error("coordinates is required");if(!Array.isArray(b))throw new Error("coordinates must be an Array");e&&z(e);var g;switch(a){case"Point":g=d(b).geometry;break;case"LineString":g=h(b).geometry;break;case"Polygon":g=f(b).geometry;break;case"MultiPoint":g=l(b).geometry;break;case"MultiLineString":g=k(b).geometry;break;case"MultiPolygon":g=m(b).geometry;break;default:throw new Error(a+" is invalid")}return e&&(g.bbox=e),g}function d(a,c,d){if(!a)throw new Error("coordinates is required");if(!Array.isArray(a))throw new Error("coordinates must be an Array");if(a.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!x(a[0])||!x(a[1]))throw new Error("coordinates must contain numbers");return b({type:"Point",coordinates:a},c,d)}function e(a,b,c){if(!a)throw new Error("coordinates is required");if(!Array.isArray(a))throw new Error("coordinates must be an Array");return j(a.map(function(a){return d(a,b)}),c)}function f(a,c,d){if(!a)throw new Error("coordinates is required");for(var e=0;e<a.length;e++){var f=a[e];if(f.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var g=0;g<f[f.length-1].length;g++){if(0===e&&0===g&&!x(f[0][0])||!x(f[0][1]))throw new Error("coordinates must contain numbers");if(f[f.length-1][g]!==f[0][g])throw new Error("First and last Position are not equivalent.")}}return b({type:"Polygon",coordinates:a},c,d)}function g(a,b,c){if(!a)throw new Error("coordinates is required");if(!Array.isArray(a))throw new Error("coordinates must be an Array");return j(a.map(function(a){return f(a,b)}),c)}function h(a,c,d){if(!a)throw new Error("coordinates is required");if(a.length<2)throw new Error("coordinates must be an array of two or more positions");if(!x(a[0][1])||!x(a[0][1]))throw new Error("coordinates must contain numbers");return b({type:"LineString",coordinates:a},c,d)}function i(a,b,c){if(!a)throw new Error("coordinates is required");if(!Array.isArray(a))throw new Error("coordinates must be an Array");return j(a.map(function(a){return h(a,b)}),c)}function j(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.bbox,d=b.id;if(!a)throw new Error("No features passed");if(!Array.isArray(a))throw new Error("features must be an Array");c&&z(c),d&&A(d);var e={type:"FeatureCollection"};return d&&(e.id=d),c&&(e.bbox=c),e.features=a,e}function k(a,c,d){if(!a)throw new Error("coordinates is required");return b({type:"MultiLineString",coordinates:a},c,d)}function l(a,c,d){if(!a)throw new Error("coordinates is required");return b({type:"MultiPoint",coordinates:a},c,d)}function m(a,c,d){if(!a)throw new Error("coordinates is required");return b({type:"MultiPolygon",coordinates:a},c,d)}function n(a,c,d){if(!a)throw new Error("geometries is required");if(!Array.isArray(a))throw new Error("geometries must be an Array");return b({type:"GeometryCollection",geometries:a},c,d)}function o(a,b){if(void 0===a||null===a||isNaN(a))throw new Error("num is required");if(b&&!(b>=0))throw new Error("precision must be a positive number");var c=Math.pow(10,b||0);return Math.round(a*c)/c}function p(a,b){if(void 0===a||null===a)throw new Error("radians is required");if(b&&"string"!=typeof b)throw new Error("units must be a string");var c=Kf[b||"kilometers"];if(!c)throw new Error(b+" units is invalid");return a*c}function q(a,b){if(void 0===a||null===a)throw new Error("distance is required");if(b&&"string"!=typeof b)throw new Error("units must be a string");var c=Kf[b||"kilometers"];if(!c)throw new Error(b+" units is invalid");return a/c}function r(a,b){return t(q(a,b))}function s(a){if(null===a||void 0===a)throw new Error("bearing is required");var b=a%360;return 0>b&&(b+=360),b}function t(a){if(null===a||void 0===a)throw new Error("radians is required");return 180*(a%(2*Math.PI))/Math.PI}function u(a){if(null===a||void 0===a)throw new Error("degrees is required");return a%360*Math.PI/180}function v(a,b,c){if(null===a||void 0===a)throw new Error("length is required");if(!(a>=0))throw new Error("length must be a positive number");return p(q(a,b),c||"kilometers")}function w(a,b,c){if(null===a||void 0===a)throw new Error("area is required");if(!(a>=0))throw new Error("area must be a positive number");var d=Mf[b||"meters"];if(!d)throw new Error("invalid original units");var e=Mf[c||"kilometers"];if(!e)throw new Error("invalid final units");return a/d*e}function x(a){return!isNaN(a)&&null!==a&&!Array.isArray(a)}function y(a){return!!a&&a.constructor===Object}function z(a){if(!a)throw new Error("bbox is required");if(!Array.isArray(a))throw new Error("bbox must be an Array");if(4!==a.length&&6!==a.length)throw new Error("bbox must be an Array of 4 or 6 numbers");a.forEach(function(a){if(!x(a))throw new Error("bbox must only contain numbers")})}function A(a){if(!a)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof a))throw new Error("id must be a number or a string")}function B(a,b,c){if(null!==a)for(var d,e,f,g,h,i,j,k,l=0,m=0,n=a.type,o="FeatureCollection"===n,p="Feature"===n,q=o?a.features.length:1,r=0;q>r;r++){h=(k=!!(j=o?a.features[r].geometry:p?a.geometry:a)&&"GeometryCollection"===j.type)?j.geometries.length:1;for(var s=0;h>s;s++){var t=0,u=0;if(null!==(g=k?j.geometries[s]:j)){i=g.coordinates;var v=g.type;switch(l=!c||"Polygon"!==v&&"MultiPolygon"!==v?0:1,v){case null:break;case"Point":b(i,m,r,t,u),m++,t++;break;case"LineString":case"MultiPoint":for(d=0;d<i.length;d++)b(i[d],m,r,t,u),m++,"MultiPoint"===v&&t++;"LineString"===v&&t++;break;case"Polygon":case"MultiLineString":for(d=0;d<i.length;d++){for(e=0;e<i[d].length-l;e++)b(i[d][e],m,r,t,u),m++;"MultiLineString"===v&&t++,"Polygon"===v&&u++}"Polygon"===v&&t++;break;case"MultiPolygon":for(d=0;d<i.length;d++){for("MultiPolygon"===v&&(u=0),e=0;e<i[d].length;e++){for(f=0;f<i[d][e].length-l;f++)b(i[d][e][f],m,r,t,u),m++;u++}t++}break;case"GeometryCollection":for(d=0;d<g.geometries.length;d++)B(g.geometries[d],b,c);break;default:throw new Error("Unknown Geometry Type")}}}}}function C(a,b,c,d){var e=c;return B(a,function(a,d,f,g,h){e=0===d&&void 0===c?a:b(e,a,d,f,g,h)},d),e}function D(a,b){var c;switch(a.type){case"FeatureCollection":for(c=0;c<a.features.length;c++)b(a.features[c].properties,c);break;case"Feature":b(a.properties,0)}}function E(a,b,c){var d=c;return D(a,function(a,e){d=0===e&&void 0===c?a:b(d,a,e)}),d}function F(a,b){if("Feature"===a.type)b(a,0);else if("FeatureCollection"===a.type)for(var c=0;c<a.features.length;c++)b(a.features[c],c)}function G(a,b,c){var d=c;return F(a,function(a,e){d=0===e&&void 0===c?a:b(d,a,e)}),d}function H(a){var b=[];return B(a,function(a){b.push(a)}),b}function I(a,b){var c,d,e,f,g,h,i,j,k,l,m=0,n="FeatureCollection"===a.type,o="Feature"===a.type,p=n?a.features.length:1;for(c=0;p>c;c++){for(h=n?a.features[c].geometry:o?a.geometry:a,j=n?a.features[c].properties:o?a.properties:{},k=n?a.features[c].bbox:o?a.bbox:void 0,l=n?a.features[c].id:o?a.id:void 0,g=(i=!!h&&"GeometryCollection"===h.type)?h.geometries.length:1,e=0;g>e;e++)if(null!==(f=i?h.geometries[e]:h))switch(f.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":b(f,m,j,k,l);break;case"GeometryCollection":for(d=0;d<f.geometries.length;d++)b(f.geometries[d],m,j,k,l);break;default:throw new Error("Unknown Geometry Type")}else b(null,m,j,k,l);m++}}function J(a,b,c){var d=c;return I(a,function(a,e,f,g,h){d=0===e&&void 0===c?a:b(d,a,e,f,g,h)}),d}function K(a,c){I(a,function(a,d,e,f,g){var h=null===a?null:a.type;switch(h){case null:case"Point":case"LineString":case"Polygon":return void c(b(a,e,{bbox:f,id:g}),d,0)}var i;switch(h){case"MultiPoint":i="Point";break;case"MultiLineString":i="LineString";break;case"MultiPolygon":i="Polygon"}a.coordinates.forEach(function(a,f){c(b({type:i,coordinates:a},e),d,f)})})}function L(a,b,c){var d=c;return K(a,function(a,e,f){d=0===e&&0===f&&void 0===c?a:b(d,a,e,f)}),d}function M(a,b){K(a,function(a,c,d){var e=0;if(a.geometry){var f=a.geometry.type;"Point"!==f&&"MultiPoint"!==f&&C(a,function(f,g,i,j,k,l){var m=h([f,g],a.properties);return b(m,c,d,l,e),e++,g})}})}function N(a,b,c){var d=c,e=!1;return M(a,function(a,f,g,h,i){d=!1===e&&void 0===c?a:b(d,a,f,g,h,i),e=!0}),d}function O(a,b){if(!a)throw new Error("geojson is required");K(a,function(a,c,d){if(null!==a.geometry){var e=a.geometry.type,f=a.geometry.coordinates;switch(e){case"LineString":b(a,c,d,0,0);break;case"Polygon":for(var g=0;g<f.length;g++)b(h(f[g],a.properties),c,d,g)}}})}function P(a,b,c){var d=c;return O(a,function(a,e,f,g){d=0===e&&void 0===c?a:b(d,a,e,f,g)}),d}function Q(a){var b=[1/0,1/0,-1/0,-1/0];return B(a,function(a){b[0]>a[0]&&(b[0]=a[0]),b[1]>a[1]&&(b[1]=a[1]),b[2]<a[0]&&(b[2]=a[0]),b[3]<a[1]&&(b[3]=a[1])}),b}function R(a){if(!a)throw new Error("obj is required");var b=S(a);if(b.length>1&&x(b[0])&&x(b[1]))return b;throw new Error("Coordinate is not a valid Point")}function S(a){if(!a)throw new Error("obj is required");var b;if(a.length?b=a:a.coordinates?b=a.coordinates:a.geometry&&a.geometry.coordinates&&(b=a.geometry.coordinates),b)return T(b),b;throw new Error("No valid coordinates")}function T(a){if(a.length>1&&x(a[0])&&x(a[1]))return!0;if(Array.isArray(a[0])&&a[0].length)return T(a[0]);throw new Error("coordinates must only contain numbers")}function U(a,b,c){if(!b||!c)throw new Error("type and name required");if(!a||a.type!==b)throw new Error("Invalid input to "+c+": must be a "+b+", given "+a.type)}function V(a,b,c){if(!a)throw new Error("No feature passed");if(!c)throw new Error(".featureOf() requires a name");if(!a||"Feature"!==a.type||!a.geometry)throw new Error("Invalid input to "+c+", Feature with geometry required");if(!a.geometry||a.geometry.type!==b)throw new Error("Invalid input to "+c+": must be a "+b+", given "+a.geometry.type)}function W(a,b,c){if(!a)throw new Error("No featureCollection passed");if(!c)throw new Error(".collectionOf() requires a name");if(!a||"FeatureCollection"!==a.type)throw new Error("Invalid input to "+c+", FeatureCollection required");for(var d=0;d<a.features.length;d++){var e=a.features[d];if(!e||"Feature"!==e.type||!e.geometry)throw new Error("Invalid input to "+c+", Feature with geometry required");if(!e.geometry||e.geometry.type!==b)throw new Error("Invalid input to "+c+": must be a "+b+", given "+e.geometry.type)}}function X(a){if(!a)throw new Error("geojson is required");if(void 0!==a.geometry)return a.geometry;if(a.coordinates||a.geometries)return a;throw new Error("geojson must be a valid Feature or Geometry Object")}function Y(){throw new Error("invariant.getGeomType has been deprecated in v5.0 in favor of invariant.getType")}function Z(a,b){if(!a)throw new Error((b||"geojson")+" is required");if(a.geometry&&a.geometry.type)return a.geometry.type;if(a.type)return a.type;throw new Error((b||"geojson")+" is invalid")}function $(a,b,c){c=c||{};for(var d=Object.keys(Qf),e=0;e<d.length;e++){var f=d[e],g=c[f];g=void 0!==g&&null!==g?g:Qf[f],Rf[f]=g}Rf.verbose&&console.log("MarchingSquaresJS-isoContours: computing isocontour for "+b);var h=function(a){var b=[],c=0;return a.rows,a.cols,a.cells.forEach(function(d,e){d.forEach(function(d,f){if(void 0!==d&&!function(a){return 5===a.cval||10===a.cval}(d)&&!aa(d)){var g=function(a,b,c){var d,e,f,g=a.length,h=[],i=[0,0,1,1,0,0,0,0,-1,0,1,1,-1,0,-1,0],j=[0,-1,0,0,1,1,1,1,0,-1,0,0,0,-1,0,0],k=["none","bottom","right","right","top","top","top","top","left","bottom","right","right","left","bottom","left","none"],l=(a[b][c],a[b][c]),m=l.cval,n=ca(l,f=["none","left","bottom","left","right","none","bottom","left","top","top","none","top","right","right","bottom","none"][m]);h.push([c+n[0],b+n[1]]),n=ca(l,f=k[m]),h.push([c+n[0],b+n[1]]),ba(l);for(var o=c+i[m],p=b+j[m],q=m;o>=0&&p>=0&&g>p&&(o!=c||p!=b)&&void 0!==(l=a[p][o]);){if(0===(m=l.cval)||15===m)return{path:h,info:"mergeable"};f=k[m],d=i[m],e=j[m],5!==m&&10!==m||(5===m?l.flipped?-1===j[q]?(f="left",d=-1,e=0):(f="right",d=1,e=0):-1===i[q]&&(f="bottom",d=0,e=-1):10===m&&(l.flipped?-1===i[q]?(f="top",d=0,e=1):(f="bottom",d=0,e=-1):1===j[q]&&(f="left",d=-1,e=0))),n=ca(l,f),h.push([o+n[0],p+n[1]]),ba(l),o+=d,p+=e,q=m}return{path:h,info:"closed"}}(a.cells,e,f),h=!1;if("mergeable"===g.info)for(var i=g.path[g.path.length-1][0],j=g.path[g.path.length-1][1],k=c-1;k>=0;k--)if(Math.abs(b[k][0][0]-i)<=1e-7&&Math.abs(b[k][0][1]-j)<=1e-7){for(var l=g.path.length-2;l>=0;--l)b[k].unshift(g.path[l]);h=!0;break}h||(b[c++]=g.path)}})}),b}(function(a,b){for(var c=a.length-1,d=a[0].length-1,e={rows:c,cols:d,cells:[]},f=0;c>f;++f){e.cells[f]=[];for(var g=0;d>g;++g){var h=0,i=a[f+1][g],j=a[f+1][g+1],k=a[f][g+1],l=a[f][g];if(!(isNaN(i)||isNaN(j)||isNaN(k)||isNaN(l))){h|=i>=b?8:0,h|=j>=b?4:0,h|=k>=b?2:0;var m=!1;if(5===(h|=l>=b?1:0)||10===h){var n=(i+j+k+l)/4;5===h&&b>n?(h=10,m=!0):10===h&&b>n&&(h=5,m=!0)}if(0!==h&&15!==h){var o,p,q,r;o=p=q=r=.5,1===h?(q=1-_(b,i,l),p=1-_(b,k,l)):2===h?(p=_(b,l,k),r=1-_(b,j,k)):3===h?(q=1-_(b,i,l),r=1-_(b,j,k)):4===h?(o=_(b,i,j),r=_(b,k,j)):5===h?(o=_(b,i,j),r=_(b,k,j),p=1-_(b,k,l),q=1-_(b,i,l)):6===h?(p=_(b,l,k),o=_(b,i,j)):7===h?(q=1-_(b,i,l),o=_(b,i,j)):8===h?(q=_(b,l,i),o=1-_(b,j,i)):9===h?(p=1-_(b,k,l),o=1-_(b,j,i)):10===h?(o=1-_(b,j,i),r=1-_(b,j,k),p=_(b,l,k),q=_(b,l,i)):11===h?(o=1-_(b,j,i),r=1-_(b,j,k)):12===h?(q=_(b,l,i),r=_(b,k,j)):13===h?(p=1-_(b,k,l),r=_(b,k,j)):14===h?(q=_(b,l,i),p=_(b,l,k)):console.log("MarchingSquaresJS-isoContours: Illegal cval detected: "+h),e.cells[f][g]={cval:h,flipped:m,top:o,right:r,bottom:p,left:q}}}}}return e}(a,b));return"function"==typeof Rf.successCallback&&Rf.successCallback(h),h}function _(a,b,c){return(a-b)/(c-b)}function aa(a){return 0===a.cval||15===a.cval}function ba(a){aa(a)||5===a.cval||10===a.cval||(a.cval=15)}function ca(a,b){return"top"===b?[a.top,1]:"bottom"===b?[a.bottom,0]:"right"===b?[1,a.right]:"left"===b?[0,a.left]:void 0}function da(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.zProperty||"elevation",d=b.flip,e=b.flags;W(a,"Point","input must contain Points");for(var f=function(a,b){var c={};return F(a,function(a){var b=S(a)[1];c[b]||(c[b]=[]),c[b].push(a)}),Object.keys(c).map(function(a){var b=c[a],d=b.sort(function(a,b){return S(a)[0]-S(b)[0]});return d}).sort(function(a,c){return b?S(a[0])[1]-S(c[0])[1]:S(c[0])[1]-S(a[0])[1]})}(a,d),g=[],h=0;h<f.length;h++){for(var i=f[h],j=[],k=0;k<i.length;k++){var l=i[k];l.properties[c]?j.push(l.properties[c]):j.push(0),!0===e&&(l.properties.matrixPosition=[h,k])}g.push(j)}return g}function ea(a,b,c,d,e){for(c=c||0,d=d||a.length-1,e=e||function(a,b){return b>a?-1:a>b?1:0};d>c;){if(d-c>600){var f=d-c+1,g=b-c+1,h=Math.log(f),i=.5*Math.exp(2*h/3),j=.5*Math.sqrt(h*i*(f-i)/f)*(0>g-f/2?-1:1);ea(a,b,Math.max(c,Math.floor(b-g*i/f+j)),Math.min(d,Math.floor(b+(f-g)*i/f+j)),e)}var k=a[b],l=c,m=d;for(fa(a,c,b),e(a[d],k)>0&&fa(a,c,d);m>l;){for(fa(a,l,m),l++,m--;e(a[l],k)<0;)l++;for(;e(a[m],k)>0;)m--}0===e(a[c],k)?fa(a,c,m):fa(a,++m,d),b>=m&&(c=m+1),m>=b&&(d=m-1)}}function fa(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function ga(a,b){return this instanceof ga?(this._maxEntries=Math.max(4,a||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),b&&this._initFormat(b),this.clear(),void 0):new ga(a,b)}function ha(a,b){ia(a,0,a.children.length,b,a)}function ia(a,b,c,d,e){e||(e=qa(null)),e.minX=1/0,e.minY=1/0,e.maxX=-1/0,e.maxY=-1/0;for(var f,g=b;c>g;g++)f=a.children[g],ja(e,a.leaf?d(f):f);return e}function ja(a,b){return a.minX=Math.min(a.minX,b.minX),a.minY=Math.min(a.minY,b.minY),a.maxX=Math.max(a.maxX,b.maxX),a.maxY=Math.max(a.maxY,b.maxY),a}function ka(a,b){return a.minX-b.minX}function la(a,b){return a.minY-b.minY}function ma(a){return(a.maxX-a.minX)*(a.maxY-a.minY)}function na(a){return a.maxX-a.minX+(a.maxY-a.minY)}function oa(a,b){return a.minX<=b.minX&&a.minY<=b.minY&&b.maxX<=a.maxX&&b.maxY<=a.maxY}function pa(a,b){return b.minX<=a.maxX&&b.minY<=a.maxY&&b.maxX>=a.minX&&b.maxY>=a.minY}function qa(a){return{children:a,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ra(a,b,c,d,e){for(var f,g=[b,c];g.length;)(c=g.pop())-(b=g.pop())<=d||(f=b+Math.ceil((c-b)/d/2)*d,Sf(a,f,b,c,e),g.push(b,f,f,c))}function sa(a,b){return b={exports:{}},a(b,b.exports),b.exports}function ta(a,b){if(!(this instanceof ta))return new ta(a,b);if(this.data=a||[],this.length=this.data.length,this.compare=b||function(a,b){return b>a?-1:a>b?1:0},this.length>0)for(var c=(this.length>>1)-1;c>=0;c--)this._down(c)}function ua(a,b,c){b=Math.max(0,void 0===b?2:b),c=c||0;for(var d,e=function(a){for(var b=a[0],c=a[0],d=a[0],e=a[0],f=0;f<a.length;f++){var g=a[f];g[0]<b[0]&&(b=g),g[0]>d[0]&&(d=g),g[1]<c[1]&&(c=g),g[1]>e[1]&&(e=g)}var h=[b,c,d,e],i=h.slice();for(f=0;f<a.length;f++)dg(a[f],h)||i.push(a[f]);var j=_f(i),k=[];for(f=0;f<j.length;f++)k.push(i[j[f]]);return k}(a),f=Tf(16,["[0]","[1]","[0]","[1]"]).load(a),g=[],h=0;h<e.length;h++){var i=e[h];f.remove(i),d=za(i,d),g.push(d)}var j=Tf(16);for(h=0;h<g.length;h++)j.insert(ya(g[h]));for(var k=b*b,l=c*c;g.length;){var m=g.shift(),n=m.p,o=m.next.p,p=Aa(n,o);if(!(l>p)){var q=p/k;(i=function(a,b,c,d,e,f,g){for(var h=new bg(null,va),i=a.data;i;){for(var j=0;j<i.children.length;j++){var k=i.children[j],l=i.leaf?Ba(k,c,d):function(a,b,c){if(wa(a,c)||wa(b,c))return 0;var d=Ca(a[0],a[1],b[0],b[1],c.minX,c.minY,c.maxX,c.minY);if(0===d)return 0;var e=Ca(a[0],a[1],b[0],b[1],c.minX,c.minY,c.minX,c.maxY);if(0===e)return 0;var f=Ca(a[0],a[1],b[0],b[1],c.maxX,c.minY,c.maxX,c.maxY);if(0===f)return 0;var g=Ca(a[0],a[1],b[0],b[1],c.minX,c.maxY,c.maxX,c.maxY);return 0===g?0:Math.min(d,e,f,g)}(c,d,k);l>f||h.push({node:k,dist:l})}for(;h.length&&!h.peek().node.children;){var m=h.pop(),n=m.node,o=Ba(n,b,c),p=Ba(n,d,e);if(m.dist<o&&m.dist<p&&xa(c,n,g)&&xa(d,n,g))return n}(i=h.pop())&&(i=i.node)}return null}(f,m.prev.p,n,o,m.next.next.p,q,j))&&Math.min(Aa(i,n),Aa(i,o))<=q&&(g.push(m),g.push(za(i,m)),f.remove(i),j.remove(m),j.insert(ya(m)),j.insert(ya(m.next)))}}m=d;var r=[];do r.push(m.p),m=m.next;while(m!==d);return r.push(m.p),r}function va(a,b){return a.dist-b.dist}function wa(a,b){return a[0]>=b.minX&&a[0]<=b.maxX&&a[1]>=b.minY&&a[1]<=b.maxY}function xa(a,b,c){for(var d=Math.min(a[0],b[0]),e=Math.min(a[1],b[1]),f=Math.max(a[0],b[0]),g=Math.max(a[1],b[1]),h=c.search({minX:d,minY:e,maxX:f,maxY:g}),i=0;i<h.length;i++)if(function(a,b,c,d){return a!==d&&b!==c&&eg(a,b,c)>0!=eg(a,b,d)>0&&eg(c,d,a)>0!=eg(c,d,b)>0}(h[i].p,h[i].next.p,a,b))return!1;return!0}function ya(a){var b=a.p,c=a.next.p;return a.minX=Math.min(b[0],c[0]),a.minY=Math.min(b[1],c[1]),a.maxX=Math.max(b[0],c[0]),a.maxY=Math.max(b[1],c[1]),a}function za(a,b){var c={p:a,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return b?(c.next=b.next,c.prev=b,b.next.prev=c,b.next=c):(c.prev=c,c.next=c),c}function Aa(a,b){var c=a[0]-b[0],d=a[1]-b[1];return c*c+d*d}function Ba(a,b,c){var d=b[0],e=b[1],f=c[0]-d,g=c[1]-e;if(0!==f||0!==g){var h=((a[0]-d)*f+(a[1]-e)*g)/(f*f+g*g);h>1?(d=c[0],e=c[1]):h>0&&(d+=f*h,e+=g*h)}return f=a[0]-d,g=a[1]-e,f*f+g*g}function Ca(a,b,c,d,e,f,g,h){var i,j,k,l,m=c-a,n=d-b,o=g-e,p=h-f,q=a-e,r=b-f,s=m*m+n*n,t=m*o+n*p,u=o*o+p*p,v=m*q+n*r,w=o*q+p*r,x=s*u-t*t,y=x,z=x;0===x?(j=0,y=1,l=w,z=u):(l=s*w-t*v,(j=t*w-u*v)<0?(j=0,l=w,z=u):j>y&&(j=y,l=w+t,z=u)),0>l?(l=0,0>-v?j=0:-v>s?j=y:(j=-v,y=s)):l>z&&(l=z,0>-v+t?j=0:-v+t>s?j=y:(j=-v+t,y=s)),i=0===j?0:j/y;var A=(1-(k=0===l?0:l/z))*e+k*g-((1-i)*a+i*c),B=(1-k)*f+k*h-((1-i)*b+i*d);return A*A+B*B}function Da(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.concavity||1/0,d=[];if(B(a,function(a){d.push([a[0],a[1]])}),!d.length)return null;var e=fg(d,c);return e.length>3?f([e]):null}function Ea(a,b,c){if("object"!=typeof(c=c||{}))throw new Error("options is invalid");var d=c.ignoreBoundary;if(!a)throw new Error("point is required");if(!b)throw new Error("polygon is required");var e=R(a),f=S(b),g=b.geometry?b.geometry.type:b.type,h=b.bbox;if(h&&!1===function(a,b){return b[0]<=a[0]&&b[1]<=a[1]&&b[2]>=a[0]&&b[3]>=a[1]}(e,h))return!1;"Polygon"===g&&(f=[f]);for(var i=0,j=!1;i<f.length&&!j;i++)if(Fa(e,f[i][0],d)){for(var k=!1,l=1;l<f[i].length&&!k;)Fa(e,f[i][l],!d)&&(k=!0),l++;k||(j=!0)}return j}function Fa(a,b,c){var d=!1;b[0][0]===b[b.length-1][0]&&b[0][1]===b[b.length-1][1]&&(b=b.slice(0,b.length-1));for(var e=0,f=b.length-1;e<b.length;f=e++){var g=b[e][0],h=b[e][1],i=b[f][0],j=b[f][1];if(a[1]*(g-i)+h*(i-a[0])+j*(a[0]-g)==0&&(g-a[0])*(i-a[0])<=0&&(h-a[1])*(j-a[1])<=0)return!c;h>a[1]!=j>a[1]&&a[0]<(i-g)*(a[1]-h)/(j-h)+g&&(d=!d)}return d}function Ga(a,b){var c=[];return I(b,function(b){F(a,function(a){Ea(a,b)&&c.push(a)})}),j(c)}function Ha(a,b){if("FeatureCollection"!==a.type)throw new Error("points must be a FeatureCollection");var c=!1;return j(function(a){if(a.length<3)return[];a.sort(Ja);for(var b,c,d,e,f,g,h=a.length-1,i=a[h].x,j=a[0].x,k=a[h].y,l=k;h--;)a[h].y<k&&(k=a[h].y),a[h].y>l&&(l=a[h].y);var m,n=j-i,o=l-k,p=n>o?n:o,q=.5*(j+i),r=.5*(l+k),s=[new Ia({x:q-20*p,y:r-p,__sentinel:!0},{x:q,y:r+20*p,__sentinel:!0},{x:q+20*p,y:r-p,__sentinel:!0})],t=[],u=[];for(h=a.length;h--;){for(u.length=0,m=s.length;m--;)(n=a[h].x-s[m].x)>0&&n*n>s[m].r?(t.push(s[m]),s.splice(m,1)):(o=a[h].y-s[m].y,n*n+o*o>s[m].r||(u.push(s[m].a,s[m].b,s[m].b,s[m].c,s[m].c,s[m].a),s.splice(m,1)));for(Ka(u),m=u.length;m;)c=u[--m],b=u[--m],d=a[h],e=c.x-b.x,f=c.y-b.y,g=2*(e*(d.y-c.y)-f*(d.x-c.x)),Math.abs(g)>1e-12&&s.push(new Ia(b,c,d))}for(Array.prototype.push.apply(t,s),h=t.length;h--;)(t[h].a.__sentinel||t[h].b.__sentinel||t[h].c.__sentinel)&&t.splice(h,1);return t}(a.features.map(function(a){var d={x:a.geometry.coordinates[0],y:a.geometry.coordinates[1]};return b?d.z=a.properties[b]:3===a.geometry.coordinates.length&&(c=!0,d.z=a.geometry.coordinates[2]),d})).map(function(a){var b=[a.a.x,a.a.y],d=[a.b.x,a.b.y],e=[a.c.x,a.c.y],g={};return c?(b.push(a.a.z),d.push(a.b.z),e.push(a.c.z)):g={a:a.a.z,b:a.b.z,c:a.c.z},f([[b,d,e,b]],g)}))}function Ia(a,b,c){this.a=a,this.b=b,this.c=c;var d,e,f=b.x-a.x,g=b.y-a.y,h=c.x-a.x,i=c.y-a.y,j=f*(a.x+b.x)+g*(a.y+b.y),k=h*(a.x+c.x)+i*(a.y+c.y),l=2*(f*(c.y-b.y)-g*(c.x-b.x));this.x=(i*j-g*k)/l,this.y=(f*k-h*j)/l,d=this.x-a.x,e=this.y-a.y,this.r=d*d+e*e}function Ja(a,b){return b.x-a.x}function Ka(a){var b,c,d,e,f,g=a.length;a:for(;g;)for(c=a[--g],b=a[--g],d=g;d;)if(f=a[--d],e=a[--d],b===e&&c===f||b===f&&c===e){a.splice(g,2),a.splice(d,2),g-=2;continue a}}function La(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var d=c.units,e=R(a),f=R(b),g=u(f[1]-e[1]),h=u(f[0]-e[0]),i=u(e[1]),j=u(f[1]),k=Math.pow(Math.sin(g/2),2)+Math.pow(Math.sin(h/2),2)*Math.cos(i)*Math.cos(j);return p(2*Math.atan2(Math.sqrt(k),Math.sqrt(1-k)),d)}function Ma(a){if(!a)throw new Error("geojson is required");switch(a.type){case"Feature":return Na(a);case"FeatureCollection":return function(a){var b={type:"FeatureCollection"};return Object.keys(a).forEach(function(c){switch(c){case"type":case"features":return;default:b[c]=a[c]}}),b.features=a.features.map(function(a){return Na(a)}),b}(a);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Pa(a);default:throw new Error("unknown GeoJSON type")}}function Na(a){var b={type:"Feature"};return Object.keys(a).forEach(function(c){switch(c){case"type":case"properties":case"geometry":return;default:b[c]=a[c]}}),b.properties=Oa(a.properties),b.geometry=Pa(a.geometry),b}function Oa(a){var b={};return a?(Object.keys(a).forEach(function(c){var d=a[c];"object"==typeof d?null===d?b[c]=null:d.length?b[c]=d.map(function(a){return a}):b[c]=Oa(d):b[c]=d}),b):b}function Pa(a){var b={type:a.type};return a.bbox&&(b.bbox=a.bbox),"GeometryCollection"===a.type?(b.geometries=a.geometries.map(function(a){return Pa(a)}),b):(b.coordinates=Qa(a.coordinates),b)}function Qa(a){return"object"!=typeof a[0]?a.slice():a.map(function(a){return Qa(a)})}function Ra(a,b){function c(a,b){b.length&&b.pop();for(var c=j[0>a?~a:a],d=0,e=c.length;e>d;++d)b.push(i(c[d],d));0>a&&jg(b,e)}function d(a){return i(a)}function e(a){for(var b=[],d=0,e=a.length;e>d;++d)c(a[d],b);return b.length<2&&b.push(b[0]),b}function f(a){for(var b=e(a);b.length<4;)b.push(b[0]);return b}function g(a){return a.map(f)}function h(a){var b,c=a.type;switch(c){case"GeometryCollection":return{type:c,geometries:a.geometries.map(h)};case"Point":b=d(a.coordinates);break;case"MultiPoint":b=a.coordinates.map(d);break;case"LineString":b=e(a.arcs);break;case"MultiLineString":b=a.arcs.map(e);break;case"Polygon":b=g(a.arcs);break;case"MultiPolygon":b=a.arcs.map(g);break;default:return null}return{type:c,coordinates:b}}var i=ig(a.transform),j=a.arcs;return h(b)}function Sa(a,b){function c(a){switch(a.type){case"GeometryCollection":a.geometries.forEach(c);break;case"Polygon":d(a.arcs);break;case"MultiPolygon":a.arcs.forEach(d)}}function d(a){a.forEach(function(b){b.forEach(function(b){(f[b=0>b?~b:b]||(f[b]=[])).push(a)})}),g.push(a)}function e(b){return function(a){for(var b,c=-1,d=a.length,e=a[d-1],f=0;++c<d;)b=e,e=a[c],f+=b[0]*e[1]-b[1]*e[0];return Math.abs(f)}(Ra(a,{type:"Polygon",arcs:[b]}).coordinates[0])}var f={},g=[],h=[];return b.forEach(c),g.forEach(function(a){if(!a._){var b=[],c=[a];for(a._=1,h.push(b);a=c.pop();)b.push(a),a.forEach(function(a){a.forEach(function(a){f[0>a?~a:a].forEach(function(a){a._||(a._=1,c.push(a))})})})}}),g.forEach(function(a){delete a._}),{type:"MultiPolygon",arcs:h.map(function(b){var c,d=[];if(b.forEach(function(a){a.forEach(function(a){a.forEach(function(a){f[0>a?~a:a].length<2&&d.push(a)})})}),d=kg(a,d),(c=d.length)>1)for(var g,h,i=1,j=e(d[0]);c>i;++i)(g=e(d[i]))>j&&(h=d[0],d[0]=d[i],d[i]=h,j=g);return d})}}function Ta(a,b,c){for(var d,e=b+(c-- -b>>1);e>b;++b,--c)d=a[b],a[b]=a[c],a[c]=d}function Ua(a){return null==a?{type:null}:("FeatureCollection"===a.type?function(a){var b={type:"GeometryCollection",geometries:a.features.map(Va)};return null!=a.bbox&&(b.bbox=a.bbox),b}:"Feature"===a.type?Va:Wa)(a)}function Va(a){var b,c=Wa(a.geometry);null!=a.id&&(c.id=a.id),null!=a.bbox&&(c.bbox=a.bbox);for(b in a.properties){c.properties=a.properties;break}return c}function Wa(a){if(null==a)return{type:null};var b="GeometryCollection"===a.type?{type:"GeometryCollection",geometries:a.geometries.map(Wa)}:"Point"===a.type||"MultiPoint"===a.type?{type:a.type,coordinates:a.coordinates}:{type:a.type,arcs:a.coordinates};return null!=a.bbox&&(b.bbox=a.bbox),b}function Xa(a){var b,c=a[0],d=a[1];return c>d&&(b=c,c=d,d=b),c+31*d}function Ya(a,b){var c,d=a[0],e=a[1],f=b[0],g=b[1];return d>e&&(c=d,d=e,e=c),f>g&&(c=f,f=g,g=c),d===f&&e===g}function Za(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.mutate;if("FeatureCollection"!==Z(a))throw new Error("geojson must be a FeatureCollection");if(!a.features.length)throw new Error("geojson is empty");!1!==c&&void 0!==c||(a=Ma(a));var d=[],e=P(a,function(a,b){var c=function(a,b){var c,d=a.geometry.coordinates,e=b.geometry.coordinates,f=$a(d[0]),g=$a(d[d.length-1]),i=$a(e[0]),j=$a(e[e.length-1]);if(f===j)c=e.concat(d.slice(1));else if(i===g)c=d.concat(e.slice(1));else if(f===i)c=d.slice(1).reverse().concat(e);else{if(g!==j)return null;c=d.concat(e.reverse().slice(1))}return h(c)}(a,b);return c||(d.push(a),b)});return e&&d.push(e),d.length?1===d.length?d[0]:k(d.map(function(a){return a.coordinates})):null}function $a(a){return a[0].toString()+","+a[1].toString()}function _a(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.mutate;if("FeatureCollection"!==Z(a))throw new Error("geojson must be a FeatureCollection");if(!a.features.length)throw new Error("geojson is empty");!1!==c&&void 0!==c||(a=Ma(a));var d=function(a){var b={};K(a,function(a){b[a.geometry.type]=!0});var c=Object.keys(b);return 1===c.length?c[0]:null}(a);if(!d)throw new Error("geojson must be homogenous");switch(d){case"LineString":return Za(a,b);case"Polygon":return function(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.mutate;if("FeatureCollection"!==Z(a))throw new Error("geojson must be a FeatureCollection");if(!a.features.length)throw new Error("geojson is empty");!1!==c&&void 0!==c||(a=Ma(a));var d=[];K(a,function(a){d.push(a.geometry)});var e=vg({geoms:n(d).geometry});return lg(e,e.objects.geoms.geometries)}(a,b);default:throw new Error(d+" is not supported")}}function ab(a,c){var d="object"==typeof c?c.mutate:c;if(!a)throw new Error("geojson is required");var e=Z(a),f=[];switch(e){case"LineString":f=bb(a);break;case"MultiLineString":case"Polygon":S(a).forEach(function(a){f.push(bb(a))});break;case"MultiPolygon":S(a).forEach(function(a){var b=[];a.forEach(function(a){b.push(bb(a))}),f.push(b)});break;case"Point":return a;case"MultiPoint":var g={};S(a).forEach(function(a){var b=a.join("-");g.hasOwnProperty(b)||(f.push(a),g[b]=!0)});break;default:throw new Error(e+" geometry not supported")}return a.coordinates?!0===d?(a.coordinates=f,a):{type:e,coordinates:f}:!0===d?(a.geometry.coordinates=f,a):b({type:e,coordinates:f},a.properties,a.bbox,a.id)}function bb(a){var b=S(a);if(2===b.length&&!function(a,b){return a[0]===b[0]&&a[1]===b[1]}(b[0],b[1]))return b;var c,d,e,f=[],g=b.length-1;f.push(b[0]);for(var h=1;g>h;h++)c=b[h-1],d=b[h],function(a,b,c){var d=c[0],e=c[1],f=a[0],g=a[1],h=b[0],i=b[1],j=h-f,k=i-g;return(d-f)*k-(e-g)*j==0&&(Math.abs(j)>=Math.abs(k)?j>0?d>=f&&h>=d:d>=h&&f>=d:k>0?e>=g&&i>=e:e>=i&&g>=e)}(c,e=b[h+1],d)||f.push(d);return f.push(e),f}function cb(a,b){var c=a.x-b.x,d=a.y-b.y;return c*c+d*d}function db(a,b,c){var d=b.x,e=b.y,f=c.x-d,g=c.y-e;if(0!==f||0!==g){var h=((a.x-d)*f+(a.y-e)*g)/(f*f+g*g);h>1?(d=c.x,e=c.y):h>0&&(d+=f*h,e+=g*h)}return f=a.x-d,g=a.y-e,f*f+g*g}function eb(a,b,c,d,e){for(var f,g=d,h=b+1;c>h;h++){var i=db(a[h],a[b],a[c]);i>g&&(f=h,g=i)}g>d&&(f-b>1&&eb(a,b,f,d,e),e.push(a[f]),c-f>1&&eb(a,f,c,d,e))}function fb(a,b,c){if(a.length<=2)return a;var d=void 0!==b?b*b:1;return a=c?a:function(a,b){for(var c,d=a[0],e=[d],f=1,g=a.length;g>f;f++)cb(c=a[f],d)>b&&(e.push(c),d=c);return d!==c&&e.push(c),e}(a,d),a=function(a,b){var c=a.length-1,d=[a[0]];return eb(a,0,c,b,d),d.push(a[c]),d}(a,d)}function gb(a,b,c){return fb(a.map(function(a){return{x:a[0],y:a[1],z:a[2]}}),b,c).map(function(a){return a.z?[a.x,a.y,a.z]:[a.x,a.y]})}function hb(a,b,c){return a.map(function(a){var d=a.map(function(a){return{x:a[0],y:a[1]}});if(d.length<4)throw new Error("invalid polygon");for(var e=fb(d,b,c).map(function(a){return[a.x,a.y]});!function(a){return!(a.length<3||3===a.length&&a[2][0]===a[0][0]&&a[2][1]===a[0][1])}(e);)e=fb(d,b-=.01*b,c).map(function(a){return[a.x,a.y]});return e[e.length-1][0]===e[0][0]&&e[e.length-1][1]===e[0][1]||e.push(e[0]),e})}function ib(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.resolution||1e4,d=b.sharpness||.85;if(!a)throw new Error("line is required");if(!x(c))throw new Error("resolution must be an number");if(!x(d))throw new Error("sharpness must be an number");for(var e=[],f=new wg({points:X(a).coordinates.map(function(a){return{x:a[0],y:a[1]}}),duration:c,sharpness:d}),g=0;g<f.duration;g+=10){var i=f.pos(g);Math.floor(g/100)%2==0&&e.push([i.x,i.y])}return h(e,a.properties)}function jb(a){z(a);var b=Number(a[0]),c=Number(a[1]),d=Number(a[2]),e=Number(a[3]);if(6===a.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var g=[b,c];return f([[g,[d,c],[d,e],[b,e],g]])}function kb(a){return jb(Q(a))}function lb(a){
var b=a[0],c=a[1],d=a[2],e=a[3];if(La(a.slice(0,2),[d,c])>=La(a.slice(0,2),[b,e])){var f=(c+e)/2;return[b,f-(d-b)/2,d,f+(d-b)/2]}var g=(b+d)/2;return[g-(e-c)/2,c,g+(e-c)/2,e]}function mb(a,b,c,e){if(e=e||{},!y(e))throw new Error("options is invalid");var f=e.units,g=e.properties,h=R(a),i=u(h[0]),j=u(h[1]),k=u(c),l=q(b,f),m=Math.asin(Math.sin(j)*Math.cos(l)+Math.cos(j)*Math.sin(l)*Math.cos(k));return d([t(i+Math.atan2(Math.sin(k)*Math.sin(l)*Math.cos(j),Math.cos(l)-Math.sin(j)*Math.sin(m))),t(m)],g)}function nb(a,b,c){var d=(c=c||{}).steps||64,e=c.properties;if(!a)throw new Error("center is required");if(!b)throw new Error("radius is required");if("object"!=typeof c)throw new Error("options must be an object");if("number"!=typeof d)throw new Error("steps must be a number");d=d||64,e=e||a.properties||{};for(var g=[],h=0;d>h;h++)g.push(mb(a,b,-360*h/d,c).geometry.coordinates);return g.push(g[0]),f([g],e)}function ob(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");if(!0===c["final"])return function(a,b){var c=ob(b,a);return c=(c+180)%360}(a,b);var d=R(a),e=R(b),f=u(d[0]),g=u(e[0]),h=u(d[1]),i=u(e[1]),j=Math.sin(g-f)*Math.cos(i),k=Math.cos(h)*Math.sin(i)-Math.sin(h)*Math.cos(i)*Math.cos(g-f);return t(Math.atan2(j,k))}function pb(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.properties;if(!a)throw new Error("geojson is required");var e=Q(a);return d([(e[0]+e[2])/2,(e[1]+e[3])/2],c)}function qb(a,b){var c=0,e=0,f=0;return B(a,function(a){c+=a[0],e+=a[1],f++},!0),d([c/f,e/f],b)}function rb(a,b){switch(Z(a)){case"Point":return a;case"Polygon":var c=[];B(a,function(a){c.push(a)});var e,f,g,h,i,j,k,l,m=qb(a,b),n=m.geometry.coordinates,o=0,p=0,q=0,r=c.map(function(a){return[a[0]-n[0],a[1]-n[1]]});for(e=0;e<c.length-1;e++)h=(f=r[e])[0],j=f[1],i=(g=r[e+1])[0],q+=l=h*(k=g[1])-i*j,o+=(h+i)*l,p+=(j+k)*l;if(0===q)return m;var s=1/(6*(.5*q));return d([n[0]+s*o,n[1]+s*p],b);default:var t=Da(a);return t?rb(t,b):qb(a,b)}}function sb(a){var b=[];return"FeatureCollection"===a.type?F(a,function(a){B(a,function(c){b.push(d(c,a.properties))})}):B(a,function(c){b.push(d(c,a.properties))}),j(b)}function tb(a,b,c){c=c||2;var d=b&&b.length,e=d?b[0]*c:a.length,f=ub(a,0,e,c,!0),g=[];if(!f)return g;var h,i,j,k,l,m,n;if(d&&(f=function(a,b,c,d){var e,f,g,h,i,j=[];for(e=0,f=b.length;f>e;e++)g=b[e]*d,h=f-1>e?b[e+1]*d:a.length,(i=ub(a,g,h,d,!1))===i.next&&(i.steiner=!0),j.push(function(a){var b=a,c=a;do b.x<c.x&&(c=b),b=b.next;while(b!==a);return c}(i));for(j.sort(xb),e=0;e<j.length;e++)!function(a,b){if(b=function(a,b){var c,d=b,e=a.x,f=a.y,g=-1/0;do{if(f<=d.y&&f>=d.next.y&&d.next.y!==d.y){var h=d.x+(f-d.y)*(d.next.x-d.x)/(d.next.y-d.y);if(e>=h&&h>g){if(g=h,h===e){if(f===d.y)return d;if(f===d.next.y)return d.next}c=d.x<d.next.x?d:d.next}}d=d.next}while(d!==b);if(!c)return null;if(e===g)return c.prev;var i,j=c,k=c.x,l=c.y,m=1/0;for(d=c.next;d!==j;)e>=d.x&&d.x>=k&&e!==d.x&&zb(l>f?e:g,f,k,l,l>f?g:e,f,d.x,d.y)&&((i=Math.abs(f-d.y)/(e-d.x))<m||i===m&&d.x>c.x)&&Db(d,a)&&(c=d,m=i),d=d.next;return c}(a,b)){var c=Eb(b,a);vb(c,c.next)}}(j[e],c),c=vb(c,c.next);return c}(a,b,f,c)),a.length>80*c){h=j=a[0],i=k=a[1];for(var o=c;e>o;o+=c)l=a[o],m=a[o+1],h>l&&(h=l),i>m&&(i=m),l>j&&(j=l),m>k&&(k=m);n=0!==(n=Math.max(j-h,k-i))?1/n:0}return wb(f,g,c,h,i,n),g}function ub(a,b,c,d,e){var f,g;if(e===Ib(a,b,c,d)>0)for(f=b;c>f;f+=d)g=Fb(f,a[f],a[f+1],g);else for(f=c-d;f>=b;f-=d)g=Fb(f,a[f],a[f+1],g);return g&&Bb(g,g.next)&&(Gb(g),g=g.next),g}function vb(a,b){if(!a)return a;b||(b=a);var c,d=a;do if(c=!1,d.steiner||!Bb(d,d.next)&&0!==Ab(d.prev,d,d.next))d=d.next;else{if(Gb(d),(d=b=d.prev)===d.next)break;c=!0}while(c||d!==b);return b}function wb(a,b,c,d,e,f,g){if(a){!g&&f&&function(a,b,c,d){var e=a;do null===e.z&&(e.z=yb(e.x,e.y,b,c,d)),e.prevZ=e.prev,e.nextZ=e.next,e=e.next;while(e!==a);e.prevZ.nextZ=null,e.prevZ=null,function(a){var b,c,d,e,f,g,h,i,j=1;do{for(c=a,a=null,f=null,g=0;c;){for(g++,d=c,h=0,b=0;j>b&&(h++,d=d.nextZ);b++);for(i=j;h>0||i>0&&d;)0!==h&&(0===i||!d||c.z<=d.z)?(e=c,c=c.nextZ,h--):(e=d,d=d.nextZ,i--),f?f.nextZ=e:a=e,e.prevZ=f,f=e;c=d}f.nextZ=null,j*=2}while(g>1)}(e)}(a,d,e,f);for(var h,i,j=a;a.prev!==a.next;)if(h=a.prev,i=a.next,f?function(a,b,c,d){var e=a.prev,f=a,g=a.next;if(Ab(e,f,g)>=0)return!1;for(var h=e.x<f.x?e.x<g.x?e.x:g.x:f.x<g.x?f.x:g.x,i=e.y<f.y?e.y<g.y?e.y:g.y:f.y<g.y?f.y:g.y,j=e.x>f.x?e.x>g.x?e.x:g.x:f.x>g.x?f.x:g.x,k=e.y>f.y?e.y>g.y?e.y:g.y:f.y>g.y?f.y:g.y,l=yb(h,i,b,c,d),m=yb(j,k,b,c,d),n=a.nextZ;n&&n.z<=m;){if(n!==a.prev&&n!==a.next&&zb(e.x,e.y,f.x,f.y,g.x,g.y,n.x,n.y)&&Ab(n.prev,n,n.next)>=0)return!1;n=n.nextZ}for(n=a.prevZ;n&&n.z>=l;){if(n!==a.prev&&n!==a.next&&zb(e.x,e.y,f.x,f.y,g.x,g.y,n.x,n.y)&&Ab(n.prev,n,n.next)>=0)return!1;n=n.prevZ}return!0}(a,d,e,f):function(a){var b=a.prev,c=a,d=a.next;if(Ab(b,c,d)>=0)return!1;for(var e=a.next.next;e!==a.prev;){if(zb(b.x,b.y,c.x,c.y,d.x,d.y,e.x,e.y)&&Ab(e.prev,e,e.next)>=0)return!1;e=e.next}return!0}(a))b.push(h.i/c),b.push(a.i/c),b.push(i.i/c),Gb(a),a=i.next,j=i.next;else if((a=i)===j){g?1===g?wb(a=function(a,b,c){var d=a;do{var e=d.prev,f=d.next.next;!Bb(e,f)&&Cb(e,d,d.next,f)&&Db(e,f)&&Db(f,e)&&(b.push(e.i/c),b.push(d.i/c),b.push(f.i/c),Gb(d),Gb(d.next),d=a=f),d=d.next}while(d!==a);return d}(a,b,c),b,c,d,e,f,2):2===g&&function(a,b,c,d,e,f){var g=a;do{for(var h=g.next.next;h!==g.prev;){if(g.i!==h.i&&function(a,b){return a.next.i!==b.i&&a.prev.i!==b.i&&!function(a,b){var c=a;do{if(c.i!==a.i&&c.next.i!==a.i&&c.i!==b.i&&c.next.i!==b.i&&Cb(c,c.next,a,b))return!0;c=c.next}while(c!==a);return!1}(a,b)&&Db(a,b)&&Db(b,a)&&function(a,b){var c=a,d=!1,e=(a.x+b.x)/2,f=(a.y+b.y)/2;do c.y>f!=c.next.y>f&&c.next.y!==c.y&&e<(c.next.x-c.x)*(f-c.y)/(c.next.y-c.y)+c.x&&(d=!d),c=c.next;while(c!==a);return d}(a,b)}(g,h)){var i=Eb(g,h);return g=vb(g,g.next),i=vb(i,i.next),wb(g,b,c,d,e,f),void wb(i,b,c,d,e,f)}h=h.next}g=g.next}while(g!==a)}(a,b,c,d,e,f):wb(vb(a),b,c,d,e,f,1);break}}}function xb(a,b){return a.x-b.x}function yb(a,b,c,d,e){return a=32767*(a-c)*e,b=32767*(b-d)*e,a=16711935&(a|a<<8),a=252645135&(a|a<<4),a=858993459&(a|a<<2),a=1431655765&(a|a<<1),b=16711935&(b|b<<8),b=252645135&(b|b<<4),b=858993459&(b|b<<2),b=1431655765&(b|b<<1),a|b<<1}function zb(a,b,c,d,e,f,g,h){return(e-g)*(b-h)-(a-g)*(f-h)>=0&&(a-g)*(d-h)-(c-g)*(b-h)>=0&&(c-g)*(f-h)-(e-g)*(d-h)>=0}function Ab(a,b,c){return(b.y-a.y)*(c.x-b.x)-(b.x-a.x)*(c.y-b.y)}function Bb(a,b){return a.x===b.x&&a.y===b.y}function Cb(a,b,c,d){return!!(Bb(a,b)&&Bb(c,d)||Bb(a,d)&&Bb(c,b))||Ab(a,b,c)>0!=Ab(a,b,d)>0&&Ab(c,d,a)>0!=Ab(c,d,b)>0}function Db(a,b){return Ab(a.prev,a,a.next)<0?Ab(a,b,a.next)>=0&&Ab(a,a.prev,b)>=0:Ab(a,b,a.prev)<0||Ab(a,a.next,b)<0}function Eb(a,b){var c=new Hb(a.i,a.x,a.y),d=new Hb(b.i,b.x,b.y),e=a.next,f=b.prev;return a.next=b,b.prev=a,c.next=e,e.prev=c,d.next=c,c.prev=d,f.next=d,d.prev=f,d}function Fb(a,b,c,d){var e=new Hb(a,b,c);return d?(e.next=d.next,e.prev=d,d.next.prev=e,d.next=e):(e.prev=e,e.next=e),e}function Gb(a){a.next.prev=a.prev,a.prev.next=a.next,a.prevZ&&(a.prevZ.nextZ=a.nextZ),a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function Hb(a,b,c){this.i=a,this.x=b,this.y=c,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ib(a,b,c,d){for(var e=0,f=b,g=c-d;c>f;f+=d)e+=(a[g]-a[f])*(a[f+1]+a[g+1]),g=f;return e}function Jb(a){var b=function(a){for(var b=a[0][0].length,c={vertices:[],holes:[],dimensions:b},d=0,e=0;e<a.length;e++){for(var f=0;f<a[e].length;f++)for(var g=0;b>g;g++)c.vertices.push(a[e][f][g]);e>0&&(d+=a[e-1].length,c.holes.push(d))}return c}(a),c=xg(b.vertices,b.holes,2),d=[],e=[];c.forEach(function(a,d){var f=c[d];e.push([b.vertices[2*f],b.vertices[2*f+1]])});for(var g=0;g<e.length;g+=3){var h=e.slice(g,g+3);h.push(e[g]),d.push(f([h]))}return d}function Kb(a,b){if(!a)throw new Error("targetPoint is required");if(!b)throw new Error("points is required");var c,d=1/0;return F(b,function(b,e){var f=La(a,b);d>f&&((c=Ma(b)).properties.featureIndex=e,c.properties.distanceToPoint=f,d=f)}),c}function Lb(a,b,c,d,e){Mb(a,b,c||0,d||a.length-1,e||function(a,b){return b>a?-1:a>b?1:0})}function Mb(a,b,c,d,e){for(;d>c;){if(d-c>600){var f=d-c+1,g=b-c+1,h=Math.log(f),i=.5*Math.exp(2*h/3),j=.5*Math.sqrt(h*i*(f-i)/f)*(0>g-f/2?-1:1);Mb(a,b,Math.max(c,Math.floor(b-g*i/f+j)),Math.min(d,Math.floor(b+(f-g)*i/f+j)),e)}var k=a[b],l=c,m=d;for(Nb(a,c,b),e(a[d],k)>0&&Nb(a,c,d);m>l;){for(Nb(a,l,m),l++,m--;e(a[l],k)<0;)l++;for(;e(a[m],k)>0;)m--}0===e(a[c],k)?Nb(a,c,m):Nb(a,++m,d),b>=m&&(c=m+1),m>=b&&(d=m-1)}}function Nb(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function Ob(a,b){return this instanceof Ob?(this._maxEntries=Math.max(4,a||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),b&&this._initFormat(b),this.clear(),void 0):new Ob(a,b)}function Pb(a,b){Qb(a,0,a.children.length,b,a)}function Qb(a,b,c,d,e){e||(e=Yb(null)),e.minX=1/0,e.minY=1/0,e.maxX=-1/0,e.maxY=-1/0;for(var f,g=b;c>g;g++)f=a.children[g],Rb(e,a.leaf?d(f):f);return e}function Rb(a,b){return a.minX=Math.min(a.minX,b.minX),a.minY=Math.min(a.minY,b.minY),a.maxX=Math.max(a.maxX,b.maxX),a.maxY=Math.max(a.maxY,b.maxY),a}function Sb(a,b){return a.minX-b.minX}function Tb(a,b){return a.minY-b.minY}function Ub(a){return(a.maxX-a.minX)*(a.maxY-a.minY)}function Vb(a){return a.maxX-a.minX+(a.maxY-a.minY)}function Wb(a,b){return a.minX<=b.minX&&a.minY<=b.minY&&b.maxX<=a.maxX&&b.maxY<=a.maxY}function Xb(a,b){return b.minX<=a.maxX&&b.minY<=a.maxY&&b.maxX>=a.minX&&b.maxY>=a.minY}function Yb(a){return{children:a,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Zb(a,b,c,d,e){for(var f,g=[b,c];g.length;)(c=g.pop())-(b=g.pop())<=d||(Lb(a,f=b+Math.ceil((c-b)/d/2)*d,b,c,e),g.push(b,f,f,c))}function $b(a){var b=Ob(a);return b.insert=function(a){if(Array.isArray(a)){var b=a;(a=_b(b)).bbox=b}else a.bbox=a.bbox?a.bbox:ac(a);return Ob.prototype.insert.call(this,a)},b.load=function(a){var b=[];return Array.isArray(a)?a.forEach(function(a){var c=_b(a);c.bbox=a,b.push(c)}):F(a,function(a){a.bbox=a.bbox?a.bbox:ac(a),b.push(a)}),Ob.prototype.load.call(this,b)},b.remove=function(a){if(Array.isArray(a)){var b=a;(a=_b(b)).bbox=b}return Ob.prototype.remove.call(this,a)},b.clear=function(){return Ob.prototype.clear.call(this)},b.search=function(a){return{type:"FeatureCollection",features:Ob.prototype.search.call(this,this.toBBox(a))}},b.collides=function(a){return Ob.prototype.collides.call(this,this.toBBox(a))},b.all=function(){return{type:"FeatureCollection",features:Ob.prototype.all.call(this)}},b.toJSON=function(){return Ob.prototype.toJSON.call(this)},b.fromJSON=function(a){return Ob.prototype.fromJSON.call(this,a)},b.toBBox=function(a){var b;return b=a.bbox?a.bbox:Array.isArray(a)&&4===a.length?a:ac(a),{minX:b[0],minY:b[1],maxX:b[2],maxY:b[3]}},b}function _b(a){var b=[a[0],a[1]],c=[a[0],a[3]],d=[a[2],a[3]];return{type:"Feature",bbox:a,properties:{},geometry:{type:"Polygon",coordinates:[[b,[a[2],a[1]],d,c,b]]}}}function ac(a){var b=[1/0,1/0,-1/0,-1/0];return B(a,function(a){b[0]>a[0]&&(b[0]=a[0]),b[1]>a[1]&&(b[1]=a[1]),b[2]<a[0]&&(b[2]=a[0]),b[3]<a[1]&&(b[3]=a[1])}),b}function bc(a){if(!a)throw new Error("geojson is required");var b=[];return K(a,function(a){!function(a,b){var c=[],d=a.geometry;switch(d.type){case"Polygon":c=S(d);break;case"LineString":c=[S(d)]}c.forEach(function(c){var d=function(a,b){var c=[];return a.reduce(function(a,d){var e=h([a,d],b);return e.bbox=function(a,b){var c=a[0],d=a[1],e=b[0],f=b[1];return[e>c?c:e,f>d?d:f,c>e?c:e,d>f?d:f]}(a,d),c.push(e),d}),c}(c,a.properties);d.forEach(function(a){a.id=b.length,b.push(a)})})}(a,b)}),j(b)}function cc(a,c){var d={},e=[];if("LineString"===a.type&&(a=b(a)),"LineString"===c.type&&(c=b(c)),"Feature"===a.type&&"Feature"===c.type&&"LineString"===a.geometry.type&&"LineString"===c.geometry.type&&2===a.geometry.coordinates.length&&2===c.geometry.coordinates.length){var f=dc(a,c);return f&&e.push(f),j(e)}var g=$b();return g.load(bc(c)),F(bc(a),function(a){F(g.search(a),function(b){var c=dc(a,b);if(c){var f=S(c).join(",");d[f]||(d[f]=!0,e.push(c))}})}),j(e)}function dc(a,b){var c=S(a),e=S(b);if(2!==c.length)throw new Error("<intersects> line1 must only contain 2 coordinates");if(2!==e.length)throw new Error("<intersects> line2 must only contain 2 coordinates");var f=c[0][0],g=c[0][1],h=c[1][0],i=c[1][1],j=e[0][0],k=e[0][1],l=e[1][0],m=e[1][1],n=(m-k)*(h-f)-(l-j)*(i-g),o=(l-j)*(g-k)-(m-k)*(f-j),p=(h-f)*(g-k)-(i-g)*(f-j);if(0===n)return null;var q=o/n,r=p/n;return q>=0&&1>=q&&r>=0&&1>=r?d([f+q*(h-f),g+q*(i-g)]):null}function ec(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var e=a.geometry?a.geometry.type:a.type;if("LineString"!==e&&"MultiLineString"!==e)throw new Error("lines must be LineString or MultiLineString");var f=d([1/0,1/0],{dist:1/0}),g=0;return K(a,function(a){for(var e=S(a),i=0;i<e.length-1;i++){var j=d(e[i]);j.properties.dist=La(b,j,c);var k=d(e[i+1]);k.properties.dist=La(b,k,c);var l=La(j,k,c),m=Math.max(j.properties.dist,k.properties.dist),n=ob(j,k),o=mb(b,m,n+90,c),p=mb(b,m,n-90,c),q=cc(h([o.geometry.coordinates,p.geometry.coordinates]),h([j.geometry.coordinates,k.geometry.coordinates])),r=null;q.features.length>0&&((r=q.features[0]).properties.dist=La(b,r,c),r.properties.location=g+La(j,r,c)),j.properties.dist<f.properties.dist&&((f=j).properties.index=i,f.properties.location=g),k.properties.dist<f.properties.dist&&((f=k).properties.index=i+1,f.properties.location=g+l),r&&r.properties.dist<f.properties.dist&&((f=r).properties.index=i),g+=l}}),f}function fc(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var d=c["final"];if(!a)throw new Error("start point is required");if(!b)throw new Error("end point is required");var e;return(e=d?gc(R(b),R(a)):gc(R(a),R(b)))>180?-(360-e):e}function gc(a,b){var c=u(a[1]),d=u(b[1]),e=u(b[0]-a[0]);e>Math.PI&&(e-=2*Math.PI),e<-Math.PI&&(e+=2*Math.PI);var f=Math.log(Math.tan(d/2+Math.PI/4)/Math.tan(c/2+Math.PI/4));return(t(Math.atan2(e,f))+360)%360}function hc(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var d=c.units;if(!a)throw new Error("from point is required");if(!b)throw new Error("to point is required");var e=R(a),f=R(b);return f[0]+=f[0]-e[0]>180?-360:e[0]-f[0]>180?360:0,v(function(a,b,c){var d=c=void 0===c?Jf:Number(c),e=a[1]*Math.PI/180,f=b[1]*Math.PI/180,g=f-e,h=Math.abs(b[0]-a[0])*Math.PI/180;h>Math.PI&&(h-=2*Math.PI);var i=Math.log(Math.tan(f/2+Math.PI/4)/Math.tan(e/2+Math.PI/4)),j=Math.abs(i)>1e-11?g/i:Math.cos(e);return Math.sqrt(g*g+j*j*h*h)*d}(e,f),"meters",d)}function ic(a,b){return kc(a,"mercator",b)}function jc(a,b){return kc(a,"wgs84",b)}function kc(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var d=c.mutate;if(!a)throw new Error("geojson is required");return Array.isArray(a)&&x(a[0])?a="mercator"===b?lc(a):mc(a):(!0!==d&&(a=Ma(a)),B(a,function(a){var c="mercator"===b?lc(a):mc(a);a[0]=c[0],a[1]=c[1]})),a}function lc(a){var b=Math.PI/180,c=20037508.342789244,d=[6378137*(Math.abs(a[0])<=180?a[0]:a[0]-360*function(a){return 0>a?-1:a>0?1:0}(a[0]))*b,6378137*Math.log(Math.tan(.25*Math.PI+.5*a[1]*b))];return d[0]>c&&(d[0]=c),d[0]<-c&&(d[0]=-c),d[1]>c&&(d[1]=c),d[1]<-c&&(d[1]=-c),d}function mc(a){var b=180/Math.PI;return[a[0]*b/6378137,(.5*Math.PI-2*Math.atan(Math.exp(-a[1]/6378137)))*b]}function nc(a,c,e){if(e=e||{},!y(e))throw new Error("options is invalid");if(!a)throw new Error("pt is required");if(Array.isArray(a)?a=d(a):"Point"===a.type?a=b(a):V(a,"Point","point"),!c)throw new Error("line is required");Array.isArray(c)?c=h(c):"LineString"===c.type?c=b(c):V(c,"LineString","line");var f=1/0,g=a.geometry.coordinates;return M(c,function(a){var b=a.geometry.coordinates[0],c=a.geometry.coordinates[1],h=function(a,b,c,e){var f=e.mercator,g=!0!==f?La(b,a,e):oc(b,a,e),h=s(!0!==f?ob(b,a):fc(b,a)),i=s(!0!==f?ob(b,c):fc(b,c)),j=Math.abs(h-i);if(j>90)return g;var k=(i+180)%360,l=s(!0!==f?ob(c,a):fc(c,a)),m=Math.abs(l-k);return m>180&&(m=Math.abs(m-360)),m>90?!0!==f?La(a,c,e):oc(a,c,e):!0!==f?g*Math.sin(u(j)):function(a,b,c,e){var f=0;(Math.abs(a[0])>=180||Math.abs(b[0])>=180||Math.abs(c[0])>=180)&&(f=a[0]>0||b[0]>0||c[0]>0?-180:180);var g=d(c),h=ic([a[0]+f,a[1]]),i=ic([b[0]+f,b[1]]),j=ic([c[0]+f,c[1]]),k=jc(function(a,b,c){var d=a[0],e=a[1],f=b[0],g=b[1],h=c[0],i=c[1],j=f-d,k=g-e,l=((h-d)*j+(i-e)*k)/(j*j+k*k);return[d+l*j,e+l*k]}(h,i,j));return 0!==f&&(k[0]-=f),hc(g,k,e)}(b,c,a,e)}(g,b,c,e);f>h&&(f=h)}),f}function oc(a,b,c){var d=c.units,e=0;Math.abs(a[0])>=180&&(e=a[0]>0?-180:180),Math.abs(b[0])>=180&&(e=b[0]>0?-180:180);var f=ic([a[0]+e,a[1]]),g=ic([b[0]+e,b[1]]),h=function(a){return a*a},i=h(f[0]-g[0])+h(f[1]-g[1]);return v(Math.sqrt(i),"meters",d)}function pc(a){for(var c=function(a){return"FeatureCollection"!==a.type?j("Feature"!==a.type?[b(a)]:[a]):a}(a),e=pb(c),f=!1,g=0;!f&&g<c.features.length;){var h,i=c.features[g].geometry,k=!1;if("Point"===i.type)e.geometry.coordinates[0]===i.coordinates[0]&&e.geometry.coordinates[1]===i.coordinates[1]&&(f=!0);else if("MultiPoint"===i.type){var l=!1;for(h=0;!l&&h<i.coordinates.length;)e.geometry.coordinates[0]===i.coordinates[h][0]&&e.geometry.coordinates[1]===i.coordinates[h][1]&&(f=!0,l=!0),h++}else if("LineString"===i.type)for(h=0;!k&&h<i.coordinates.length-1;)qc(e.geometry.coordinates[0],e.geometry.coordinates[1],i.coordinates[h][0],i.coordinates[h][1],i.coordinates[h+1][0],i.coordinates[h+1][1])&&(k=!0,f=!0),h++;else if("MultiLineString"===i.type)for(var m=0;m<i.coordinates.length;){k=!1,h=0;for(var n=i.coordinates[m];!k&&h<n.length-1;)qc(e.geometry.coordinates[0],e.geometry.coordinates[1],n[h][0],n[h][1],n[h+1][0],n[h+1][1])&&(k=!0,f=!0),h++;m++}else"Polygon"!==i.type&&"MultiPolygon"!==i.type||Ea(e,i)&&(f=!0);g++}if(f)return e;var o=j([]);for(g=0;g<c.features.length;g++)o.features=o.features.concat(sb(c.features[g]).features);return d(Kb(e,o).geometry.coordinates)}function qc(a,b,c,d,e,f){return Math.sqrt((e-c)*(e-c)+(f-d)*(f-d))===Math.sqrt((a-c)*(a-c)+(b-d)*(b-d))+Math.sqrt((e-a)*(e-a)+(f-b)*(f-b))}function rc(a){return J(a,function(a,b){return a+sc(b)},0)}function sc(a){var b,c=0;switch(a.type){case"Polygon":return tc(a.coordinates);case"MultiPolygon":for(b=0;b<a.coordinates.length;b++)c+=tc(a.coordinates[b]);return c;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(b=0;b<a.geometries.length;b++)c+=sc(a.geometries[b]);return c}}function tc(a){var b=0;if(a&&a.length>0){b+=Math.abs(uc(a[0]));for(var c=1;c<a.length;c++)b-=Math.abs(uc(a[c]))}return b}function uc(a){var b,c,d,e,f,g,h=0,i=a.length;if(i>2){for(g=0;i>g;g++)g===i-2?(d=i-2,e=i-1,f=0):g===i-1?(d=i-1,e=0,f=1):(d=g,e=g+1,f=g+2),b=a[d],c=a[e],h+=(vc(a[f][0])-vc(b[0]))*Math.sin(vc(c[1]));h=h*Ag*Ag/2}return h}function vc(a){return a*Math.PI/180}function wc(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");if(!a)throw new Error("geojson is required");return N(a,function(a,c){var d=c.geometry.coordinates;return a+La(d[0],d[1],b)},0)}function xc(a,b,c,d){if(d=d||{},!y(d))throw new Error("options is invalid");var e,f=[];if("Feature"===a.type)e=a.geometry.coordinates;else{if("LineString"!==a.type)throw new Error("input must be a LineString Feature or Geometry");e=a.coordinates}for(var g,i,j,k=0,l=0;l<e.length&&!(b>=k&&l===e.length-1);l++){if(k>b&&0===f.length){if(!(g=b-k))return f.push(e[l]),h(f);i=ob(e[l],e[l-1])-180,j=mb(e[l],g,i,d),f.push(j.geometry.coordinates)}if(k>=c)return(g=c-k)?(i=ob(e[l],e[l-1])-180,j=mb(e[l],g,i,d),f.push(j.geometry.coordinates),h(f)):(f.push(e[l]),h(f));if(k>=b&&f.push(e[l]),l===e.length-1)return h(f);k+=La(e[l],e[l+1],d)}return h(e[e.length-1])}function yc(a,b,c){var d=(c=c||{}).ignoreEndVertices;if(!y(c))throw new Error("invalid options");if(!a)throw new Error("pt is required");if(!b)throw new Error("line is required");for(var e=R(a),f=S(b),g=0;g<f.length-1;g++){var h=!1;if(d&&(0===g&&(h="start"),g===f.length-2&&(h="end"),0===g&&g+1===f.length-1&&(h="both")),function(a,b,c,d){var e=c[0],f=c[1],g=a[0],h=a[1],i=b[0],j=b[1],k=c[0]-g,l=c[1]-h,m=i-g,n=j-h;return k*n-l*m!=0?!1:d?"start"===d?Math.abs(m)>=Math.abs(n)?m>0?e>g&&i>=e:e>=i&&g>e:n>0?f>h&&j>=f:f>=j&&h>f:"end"===d?Math.abs(m)>=Math.abs(n)?m>0?e>=g&&i>e:e>i&&g>=e:n>0?f>=h&&j>f:f>j&&h>=f:"both"===d?Math.abs(m)>=Math.abs(n)?m>0?e>g&&i>e:e>i&&g>e:n>0?f>h&&j>f:f>j&&h>f:void 0:Math.abs(m)>=Math.abs(n)?m>0?e>=g&&i>=e:e>=i&&g>=e:n>0?f>=h&&j>=f:f>=j&&h>=f}(f[g],f[g+1],e,h))return!0}return!1}function zc(a,b){var c=Z(a),d=Z(b),e=X(a),f=X(b);switch(c){case"Point":switch(d){case"MultiPoint":return function(a,b){var c,d=!1;for(c=0;c<b.coordinates.length;c++)if(Bc(b.coordinates[c],a.coordinates)){d=!0;break}return d}(e,f);case"LineString":return yc(e,f,{ignoreEndVertices:!0});case"Polygon":return Ea(e,f,{ignoreBoundary:!0});default:throw new Error("feature2 "+d+" geometry not supported")}case"MultiPoint":switch(d){case"MultiPoint":return function(a,b){for(var c=0;c<a.coordinates.length;c++){for(var d=!1,e=0;e<b.coordinates.length;e++)Bc(a.coordinates[c],b.coordinates[e])&&(d=!0);if(!d)return!1}return!0}(e,f);case"LineString":return function(a,b){for(var c=!1,d=0;d<a.coordinates.length;d++){if(!yc(a.coordinates[d],b))return!1;c||(c=yc(a.coordinates[d],b,{ignoreEndVertices:!0}))}return c}(e,f);case"Polygon":return function(a,b){for(var c=!0,d=0;d<a.coordinates.length;d++){var e=Ea(a.coordinates[1],b);if(!e){c=!1;break}e=Ea(a.coordinates[1],b,{ignoreBoundary:!0})}return c&&e}(e,f);default:throw new Error("feature2 "+d+" geometry not supported")}case"LineString":switch(d){case"LineString":return function(a,b){for(var c=0;c<a.coordinates.length;c++)if(!yc(a.coordinates[c],b))return!1;return!0}(e,f);case"Polygon":return function(a,b){var c=Q(b),d=Q(a);if(!Ac(c,d))return!1;for(var e=!1,f=0;f<a.coordinates.length-1;f++){if(!Ea(a.coordinates[f],b))return!1;if(e||(e=Ea(a.coordinates[f],b,{ignoreBoundary:!0})),!e){var g=function(a,b){return[(a[0]+b[0])/2,(a[1]+b[1])/2]}(a.coordinates[f],a.coordinates[f+1]);e=Ea(g,b,{ignoreBoundary:!0})}}return e}(e,f);default:throw new Error("feature2 "+d+" geometry not supported")}case"Polygon":switch(d){case"Polygon":return function(a,b){var c=Q(a);if(!Ac(Q(b),c))return!1;for(var d=0;d<a.coordinates[0].length;d++)if(!Ea(a.coordinates[0][d],b))return!1;return!0}(e,f);default:throw new Error("feature2 "+d+" geometry not supported")}default:throw new Error("feature1 "+c+" geometry not supported")}}function Ac(a,b){return!(a[0]>b[0]||a[2]<b[2]||a[1]>b[1]||a[3]<b[3])}function Bc(a,b){return a[0]===b[0]&&a[1]===b[1]}function Cc(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var e=c.mask,f=c.properties,g=[];if(null===b||void 0===b)throw new Error("cellSide is required");if(!x(b))throw new Error("cellSide is invalid");if(!a)throw new Error("bbox is required");if(!Array.isArray(a))throw new Error("bbox must be array");if(4!==a.length)throw new Error("bbox must contain 4 numbers");if(e&&-1===["Polygon","MultiPolygon"].indexOf(Z(e)))throw new Error("options.mask must be a (Multi)Polygon");for(var h=a[0],i=a[1],k=a[2],l=a[3],m=b/La([h,i],[k,i],c)*(k-h),n=b/La([h,i],[h,l],c)*(l-i),o=k-h,p=l-i,q=Math.floor(o/m),r=(p-Math.floor(p/n)*n)/2,s=h+(o-q*m)/2;k>=s;){for(var t=i+r;l>=t;){var u=d([s,t],f);e?zc(u,e)&&g.push(u):g.push(u),t+=n}s+=m}return j(g)}function Dc(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.precision,d=b.coordinates,e=b.mutate;if(c=void 0===c||null===c||isNaN(c)?6:c,d=void 0===d||null===d||isNaN(d)?3:d,!a)throw new Error("<geojson> is required");if("number"!=typeof c)throw new Error("<precision> must be a number");if("number"!=typeof d)throw new Error("<coordinates> must be a number");!1!==e&&void 0!==e||(a=JSON.parse(JSON.stringify(a)));var f=Math.pow(10,c);return B(a,function(a){!function(a,b,c){a.length>c&&a.splice(c,a.length);for(var d=0;d<a.length;d++)a[d]=Math.round(a[d]*b)/b}(a,f,d)}),a}function Ec(a,b){if(!a||!b)return!1;if(a.length!==b.length)return!1;for(var c=0,d=a.length;d>c;c++)if(a[c]instanceof Array&&b[c]instanceof Array){if(!Ec(a[c],b[c]))return!1}else if(a[c]!==b[c])return!1;return!0}function Fc(a,b){if(void 0===b&&(b=!0),3!=a.length)throw new Error("This function requires an array of three points [x,y]");return(a[1][0]-a[0][0])*(a[2][1]-a[0][1])-(a[1][1]-a[0][1])*(a[2][0]-a[0][0])>=0==b}function Gc(a,b){if(!a||!b)return!1;if(a.length!=b.length)return!1;for(var c=0,d=a.length;d>c;c++)if(a[c]instanceof Array&&b[c]instanceof Array){if(!Gc(a[c],b[c]))return!1}else if(a[c]!=b[c])return!1;return!0}function Hc(a,b){var c=[],d=$b();return K(b,function(b){if(c.forEach(function(a,b){a.id=b}),c.length){var e=d.search(b);if(e.features.length){var f=Jc(b,e);c=c.filter(function(a){return a.id!==f.id}),d.remove(f),F(Ic(f,b),function(a){c.push(a),d.insert(a)})}}else(c=Ic(a,b).features).forEach(function(a){a.bbox||(a.bbox=lb(Q(a)))}),d.load(j(c))}),j(c)}function Ic(a,b){var c=[],d=S(a)[0],e=S(a)[a.geometry.coordinates.length-1];if(Kc(d,R(b))||Kc(e,R(b)))return j([a]);var f=$b(),g=bc(a);f.load(g);var i=f.search(b);if(!i.features.length)return j([a]);var k=Jc(b,i),l=G(g,function(a,d,e){var f=S(d)[1],g=R(b);return e===k.id?(a.push(g),c.push(h(a)),Kc(g,f)?[g]:[g,f]):(a.push(f),a)},[d]);return l.length>1&&c.push(h(l)),j(c)}function Jc(a,b){if(!b.features.length)throw new Error("lines must contain features");if(1===b.features.length)return b.features[0];var c,d=1/0;return F(b,function(b){var e=ec(b,a).properties.dist;d>e&&(c=b,d=e)}),c}function Kc(a,b){return a[0]===b[0]&&a[1]===b[1]}function Lc(a,b,c,d,e){if(e=e||{},!y(e))throw new Error("options is invalid");var f=e.steps,g=e.units;if(!a)throw new Error("center is required");if(!b)throw new Error("radius is required");if(void 0===c||null===c)throw new Error("bearing1 is required");if(void 0===d||null===d)throw new Error("bearing2 is required");if("object"!=typeof e)throw new Error("options must be an object");f=f||64;var i=Mc(c),j=Mc(d),k=a.properties;if(i===j)return h(nb(a,b,e).geometry.coordinates[0],k);for(var l=i,m=j>i?j:j+360,n=l,o=[],p=0;m>n;)o.push(mb(a,b,n,g).geometry.coordinates),n=l+360*++p/f;return n>m&&o.push(mb(a,b,m,g).geometry.coordinates),h(o,k)}function Mc(a){var b=a%360;return 0>b&&(b+=360),b}function Nc(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.properties,d=Z(a),e=S(a);if(c=c||a.properties||{},!e.length)throw new Error("polygon must contain coordinates");switch(d){case"Polygon":return Oc(e,c);case"MultiPolygon":var f=[];return e.forEach(function(a){f.push(Oc(a,c))}),j(f);default:throw new Error("geom "+d+" not supported")}}function Oc(a,b){return a.length>1?k(a,b):h(a[0],b)}function Pc(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.properties,d=b.autoComplete,e=b.orderCoords;if(!a)throw new Error("lines is required");switch(d=void 0===d||d,e=void 0===e||e,Z(a)){case"FeatureCollection":case"GeometryCollection":var f=[];return(a.features?a.features:a.geometries).forEach(function(a){f.push(S(Qc(a,{},d,e)))}),m(f,c)}return Qc(a,c,d,e)}function Qc(a,b,c,d){b=b||a.properties||{};var e=S(a),g=Z(a);if(!e.length)throw new Error("line must contain coordinates");switch(g){case"LineString":return c&&(e=Rc(e)),f([e],b);case"MultiLineString":var i=[],j=0;return e.forEach(function(a){if(c&&(a=Rc(a)),d){var b=function(a){var b=a[0],c=a[1],d=a[2],e=a[3];return Math.abs(b-d)*Math.abs(c-e)}(Q(h(a)));b>j?(i.unshift(a),j=b):i.push(a)}else i.push(a)}),f(i,b);default:throw new Error("geometry type "+g+" is not supported")}}function Rc(a){var b=a[0],c=b[0],d=b[1],e=a[a.length-1],f=e[0],g=e[1];return c===f&&d===g||a.push(b),a}function Sc(a,b,c){var d,e,f,g,h,i=a.length,j=Uc(a[0],b),k=[];for(c||(c=[]),d=1;i>d;d++){for(e=a[d-1],g=h=Uc(f=a[d],b);;){if(!(j|g)){k.push(e),g!==h?(k.push(f),i-1>d&&(c.push(k),k=[])):d===i-1&&k.push(f);break}if(j&g)break;j?j=Uc(e=Tc(e,f,j,b),b):g=Uc(f=Tc(e,f,g,b),b)}j=h}return k.length&&c.push(k),c}function Tc(a,b,c,d){return 8&c?[a[0]+(b[0]-a[0])*(d[3]-a[1])/(b[1]-a[1]),d[3]]:4&c?[a[0]+(b[0]-a[0])*(d[1]-a[1])/(b[1]-a[1]),d[1]]:2&c?[d[2],a[1]+(b[1]-a[1])*(d[2]-a[0])/(b[0]-a[0])]:1&c?[d[0],a[1]+(b[1]-a[1])*(d[0]-a[0])/(b[0]-a[0])]:null}function Uc(a,b){var c=0;return a[0]<b[0]?c|=1:a[0]>b[2]&&(c|=2),a[1]<b[1]?c|=4:a[1]>b[3]&&(c|=8),c}function Vc(a,b){for(var c=[],d=0;d<a.length;d++){var e=Lg.polygon(a[d],b);e.length>0&&(e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]||e.push(e[0]),e.length>=4&&c.push(e))}return c}function Wc(a){return"[object Arguments]"===Object.prototype.toString.call(a)}function Xc(a,b,c){return c||(c={}),a===b||(a instanceof Date&&b instanceof Date?a.getTime()===b.getTime():!a||!b||"object"!=typeof a&&"object"!=typeof b?(c.strict,a===b):function(a,b,c){var d,e;if(Yc(a)||Yc(b))return!1;if(a.prototype!==b.prototype)return!1;if(Wc(a))return!!Wc(b)&&(a=Mg.call(a),b=Mg.call(b),Xc(a,b,c));if(Zc(a)){if(!Zc(b))return!1;if(a.length!==b.length)return!1;for(d=0;d<a.length;d++)if(a[d]!==b[d])return!1;return!0}try{var f=Object.keys(a),g=Object.keys(b)}catch(a){return!1}if(f.length!==g.length)return!1;for(f.sort(),g.sort(),d=f.length-1;d>=0;d--)if(f[d]!==g[d])return!1;for(d=f.length-1;d>=0;d--)if(e=f[d],!Xc(a[e],b[e],c))return!1;return typeof a==typeof b}(a,b,c))}function Yc(a){return null===a||void 0===a}function Zc(a){return!(!a||"object"!=typeof a||"number"!=typeof a.length||"function"!=typeof a.copy||"function"!=typeof a.slice||a.length>0&&"number"!=typeof a[0])}function $c(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var d=c.tolerance||0,e=[],f=$b();f.load(bc(a));var g;return M(b,function(a){var b=!1;F(f.search(a),function(c){if(!1===b){var e=S(a).sort(),f=S(c).sort();Xc(e,f)?(b=!0,g=g?_c(g,a):a):(0===d?yc(e[0],c)&&yc(e[1],c):ec(c,e[0]).properties.dist<=d&&ec(c,e[1]).properties.dist<=d)?(b=!0,g=g?_c(g,a):a):(0===d?yc(f[0],a)&&yc(f[1],a):ec(a,f[0]).properties.dist<=d&&ec(a,f[1]).properties.dist<=d)&&(g=g?_c(g,c):c)}}),!1===b&&g&&(e.push(g),g=void 0)}),g&&e.push(g),j(e)}function _c(a,b){var c=S(b),d=S(a),e=d[0],f=d[d.length-1],g=a.geometry.coordinates;return Xc(c[0],e)?g.unshift(c[1]):Xc(c[0],f)?g.push(c[1]):Xc(c[1],e)?g.unshift(c[0]):Xc(c[1],f)&&g.push(c[0]),a}function ad(a){var b=a%360;return 0>b&&(b+=360),b}function bd(a,b,c,e){if(e=e||{},!y(e))throw new Error("options is invalid");var f=e.units,g=e.properties;if(!a)throw new Error("origin is required");if(void 0===b||null===b)throw new Error("distance is required");if(void 0===c||null===c)throw new Error("bearing is required");if(!(b>=0))throw new Error("distance must be greater than 0");var h=v(b,f,"meters"),i=R(a),j=function(a,b,c,d){d=void 0===d?Jf:Number(d);var e=b/d,f=a[0]*Math.PI/180,g=u(a[1]),h=u(c),i=e*Math.cos(h),j=g+i;Math.abs(j)>Math.PI/2&&(j=j>0?Math.PI-j:-Math.PI-j);var k=Math.log(Math.tan(j/2+Math.PI/4)/Math.tan(g/2+Math.PI/4)),l=Math.abs(k)>1e-11?i/k:Math.cos(g),m=e*Math.sin(h)/l;return[(180*(f+m)/Math.PI+540)%360-180,180*j/Math.PI]}(i,h,c);return j[0]+=j[0]-i[0]>180?-360:i[0]-j[0]>180?360:0,d(j,g)}function cd(a,b,c,d,e,f){for(var g=0;g<a.length;g++){var h=a[g],i=a[g+1];g===a.length-1&&(i=a[0]),d=dd(h,i,b),0>=c&&d>0?function(a,b,c){return dd(a,b,c)<0}(b,h,e)||(e=h):c>0&&0>=d&&(function(a,b,c){return dd(a,b,c)>0}(b,h,f)||(f=h)),c=d}return[e,f]}function dd(a,b,c){return(b[0]-a[0])*(c[1]-a[1])-(c[0]-a[0])*(b[1]-a[1])}function ed(a){if(!a)throw new Error("line is required");var b=a.geometry?a.geometry.type:a.type;if(!Array.isArray(a)&&"LineString"!==b)throw new Error("geometry must be a LineString");for(var c,d,e=S(a),f=0,g=1;g<e.length;)c=d||e[0],f+=((d=e[g])[0]-c[0])*(d[1]+c[1]),g++;return f>0}function fd(a,b){switch("Feature"===a.type?a.geometry.type:a.type){case"GeometryCollection":return I(a,function(a){fd(a,b)}),a;case"LineString":return gd(S(a),b),a;case"Polygon":return hd(S(a),b),a;case"MultiLineString":return S(a).forEach(function(a){gd(a,b)}),a;case"MultiPolygon":return S(a).forEach(function(a){hd(a,b)}),a;case"Point":case"MultiPoint":return a}}function gd(a,b){ed(a)===b&&a.reverse()}function hd(a,b){ed(a[0])!==b&&a[0].reverse();for(var c=1;c<a.length;c++)ed(a[c])===b&&a[c].reverse()}function id(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");
var c=b.zProperty||"elevation",d=b.flip,e=b.flags;W(a,"Point","input must contain Points");for(var f=function(a,b){var c={};return F(a,function(a){var b=S(a)[1];c[b]||(c[b]=[]),c[b].push(a)}),Object.keys(c).map(function(a){var b=c[a],d=b.sort(function(a,b){return S(a)[0]-S(b)[0]});return d}).sort(function(a,c){return b?S(a[0])[1]-S(c[0])[1]:S(c[0])[1]-S(a[0])[1]})}(a,d),g=[],h=0;h<f.length;h++){for(var i=f[h],j=[],k=0;k<i.length;k++){var l=i[k];l.properties[c]?j.push(l.properties[c]):j.push(0),!0===e&&(l.properties.matrixPosition=[h,k])}g.push(j)}return g}function jd(a,b,c,d){d=d||{};for(var e=Object.keys(Ng),f=0;f<e.length;f++){var g=e[f],h=d[g];h=void 0!==h&&null!==h?h:Ng[g],Og[g]=h}Og.verbose&&console.log("MarchingSquaresJS-isoBands: computing isobands for ["+b+":"+(b+c)+"]");var i,j=function(a,b,c){for(var d=a.length-1,e=a[0].length-1,f={rows:d,cols:e,cells:[]},g=b+Math.abs(c),h=0;d>h;++h){f.cells[h]=[];for(var i=0;e>i;++i){var j=0,k=a[h+1][i],l=a[h+1][i+1],m=a[h][i+1],n=a[h][i];if(!(isNaN(k)||isNaN(l)||isNaN(m)||isNaN(n))){j|=b>k?0:k>g?128:64,j|=b>l?0:l>g?32:16,j|=b>m?0:m>g?8:4;var o=+(j|=b>n?0:n>g?2:1),p=0;if(17===j||18===j||33===j||34===j||38===j||68===j||72===j||98===j||102===j||132===j||136===j||137===j||152===j||153===j){var q=(k+l+m+n)/4;p=q>g?2:b>q?0:1,34===j?1===p?j=35:0===p&&(j=136):136===j?1===p?(j=35,p=4):0===p&&(j=34):17===j?1===p?(j=155,p=4):0===p&&(j=153):68===j?1===p?(j=103,p=4):0===p&&(j=102):153===j?1===p&&(j=155):102===j?1===p&&(j=103):152===j?2>p&&(j=156,p=1):137===j?2>p&&(j=139,p=1):98===j?2>p&&(j=99,p=1):38===j?2>p&&(j=39,p=1):18===j?p>0?(j=156,p=4):j=152:33===j?p>0?(j=139,p=4):j=137:72===j?p>0?(j=99,p=4):j=98:132===j&&(p>0?(j=39,p=4):j=38)}if(0!=j&&170!=j){var r,s,t,u,v,w,x,y;r=s=t=u=v=w=x=y=.5;var z=[];1===j?(t=1-kd(b,m,n),y=1-kd(b,k,n),z.push(Ah[j])):169===j?(t=kd(g,n,m),y=kd(g,n,k),z.push(Ah[j])):4===j?(w=1-kd(b,l,m),u=kd(b,n,m),z.push(yh[j])):166===j?(w=kd(g,m,l),u=1-kd(g,m,n),z.push(yh[j])):16===j?(v=kd(b,m,l),s=kd(b,k,l),z.push(xh[j])):154===j?(v=1-kd(g,l,m),s=1-kd(g,l,k),z.push(xh[j])):64===j?(x=kd(b,n,k),r=1-kd(b,l,k),z.push(Ch[j])):106===j?(x=1-kd(g,k,n),r=kd(g,k,l),z.push(Ch[j])):168===j?(u=kd(g,n,m),t=kd(b,n,m),y=kd(b,n,k),x=kd(g,n,k),z.push(zh[j]),z.push(Ah[j])):2===j?(u=1-kd(b,m,n),t=1-kd(g,m,n),y=1-kd(g,k,n),x=1-kd(b,k,n),z.push(zh[j]),z.push(Ah[j])):162===j?(v=kd(g,m,l),w=kd(b,m,l),u=1-kd(b,m,n),t=1-kd(g,m,n),z.push(zh[j]),z.push(Ah[j])):8===j?(v=1-kd(b,l,m),w=1-kd(g,l,m),u=kd(g,n,m),t=kd(b,n,m),z.push(xh[j]),z.push(yh[j])):138===j?(v=1-kd(b,l,m),w=1-kd(g,l,m),r=1-kd(g,l,k),s=1-kd(b,l,k),z.push(xh[j]),z.push(yh[j])):32===j?(v=kd(g,m,l),w=kd(b,m,l),r=kd(b,k,l),s=kd(g,k,l),z.push(xh[j]),z.push(yh[j])):42===j?(y=1-kd(g,k,n),x=1-kd(b,k,n),r=kd(b,k,l),s=kd(g,k,l),z.push(Bh[j]),z.push(Ch[j])):128===j&&(y=kd(b,n,k),x=kd(g,n,k),r=1-kd(g,l,k),s=1-kd(b,l,k),z.push(Bh[j]),z.push(Ch[j])),5===j?(w=1-kd(b,l,m),y=1-kd(b,k,n),z.push(yh[j])):165===j?(w=kd(g,m,l),y=kd(g,n,k),z.push(yh[j])):20===j?(u=kd(b,n,m),s=kd(b,k,l),z.push(zh[j])):150===j?(u=1-kd(g,m,n),s=1-kd(g,l,k),z.push(zh[j])):80===j?(v=kd(b,m,l),x=kd(b,n,k),z.push(xh[j])):90===j?(v=1-kd(g,l,m),x=1-kd(g,k,n),z.push(xh[j])):65===j?(t=1-kd(b,m,n),r=1-kd(b,l,k),z.push(Ah[j])):105===j?(t=kd(g,n,m),r=kd(g,k,l),z.push(Ah[j])):160===j?(v=kd(g,m,l),w=kd(b,m,l),y=kd(b,n,k),x=kd(g,n,k),z.push(xh[j]),z.push(yh[j])):10===j?(v=1-kd(b,l,m),w=1-kd(g,l,m),y=1-kd(g,k,n),x=1-kd(b,k,n),z.push(xh[j]),z.push(yh[j])):130===j?(u=1-kd(b,m,n),t=1-kd(g,m,n),r=1-kd(g,l,k),s=1-kd(b,l,k),z.push(zh[j]),z.push(Ah[j])):40===j?(u=kd(g,n,m),t=kd(b,n,m),r=kd(b,k,l),s=kd(g,k,l),z.push(zh[j]),z.push(Ah[j])):101===j?(w=kd(g,m,l),r=kd(g,k,l),z.push(yh[j])):69===j?(w=1-kd(b,l,m),r=1-kd(b,l,k),z.push(yh[j])):149===j?(y=kd(g,n,k),s=1-kd(g,l,k),z.push(Bh[j])):21===j?(y=1-kd(b,k,n),s=kd(b,k,l),z.push(Bh[j])):86===j?(u=1-kd(g,m,n),x=1-kd(g,k,n),z.push(zh[j])):84===j?(u=kd(b,n,m),x=kd(b,n,k),z.push(zh[j])):89===j?(v=1-kd(g,l,m),t=kd(g,n,m),z.push(Ah[j])):81===j?(v=kd(b,m,l),t=1-kd(b,m,n),z.push(Ah[j])):96===j?(v=kd(g,m,l),w=kd(b,m,l),x=kd(b,n,k),r=kd(g,k,l),z.push(xh[j]),z.push(yh[j])):74===j?(v=1-kd(b,l,m),w=1-kd(g,l,m),x=1-kd(g,k,n),r=1-kd(b,l,k),z.push(xh[j]),z.push(yh[j])):24===j?(v=1-kd(g,l,m),u=kd(g,n,m),t=kd(b,n,m),s=kd(b,k,l),z.push(xh[j]),z.push(Ah[j])):146===j?(v=kd(b,m,l),u=1-kd(b,m,n),t=1-kd(g,m,n),s=1-kd(g,l,k),z.push(xh[j]),z.push(Ah[j])):6===j?(w=1-kd(b,l,m),u=1-kd(g,m,n),y=1-kd(g,k,n),x=1-kd(b,k,n),z.push(yh[j]),z.push(zh[j])):164===j?(w=kd(g,m,l),u=kd(b,n,m),y=kd(b,n,k),x=kd(g,n,k),z.push(yh[j]),z.push(zh[j])):129===j?(t=1-kd(b,m,n),y=kd(g,n,k),r=1-kd(g,l,k),s=1-kd(b,l,k),z.push(Ah[j]),z.push(Bh[j])):41===j?(t=kd(g,n,m),y=1-kd(b,k,n),r=kd(b,k,l),s=kd(g,k,l),z.push(Ah[j]),z.push(Bh[j])):66===j?(u=1-kd(b,m,n),t=1-kd(g,m,n),x=1-kd(g,k,n),r=1-kd(b,l,k),z.push(zh[j]),z.push(Ah[j])):104===j?(u=kd(g,n,m),t=kd(b,n,m),x=kd(b,n,k),r=kd(g,k,l),z.push(Ah[j]),z.push(Dh[j])):144===j?(v=kd(b,m,l),y=kd(b,n,k),x=kd(g,n,k),s=1-kd(g,l,k),z.push(xh[j]),z.push(Ch[j])):26===j?(v=1-kd(g,l,m),y=1-kd(g,k,n),x=1-kd(b,k,n),s=kd(b,k,l),z.push(xh[j]),z.push(Ch[j])):36===j?(w=kd(g,m,l),u=kd(b,n,m),r=kd(b,k,l),s=kd(g,k,l),z.push(yh[j]),z.push(zh[j])):134===j?(w=1-kd(b,l,m),u=1-kd(g,m,n),r=1-kd(g,l,k),s=1-kd(b,l,k),z.push(yh[j]),z.push(zh[j])):9===j?(v=1-kd(b,l,m),w=1-kd(g,l,m),t=kd(g,n,m),y=1-kd(b,k,n),z.push(xh[j]),z.push(yh[j])):161===j?(v=kd(g,m,l),w=kd(b,m,l),t=1-kd(b,m,n),y=kd(g,n,k),z.push(xh[j]),z.push(yh[j])):37===j?(w=kd(g,m,l),y=1-kd(b,k,n),r=kd(b,k,l),s=kd(g,k,l),z.push(yh[j]),z.push(Bh[j])):133===j?(w=1-kd(b,l,m),y=kd(g,n,k),r=1-kd(g,l,k),s=1-kd(b,l,k),z.push(yh[j]),z.push(Bh[j])):148===j?(u=kd(b,n,m),y=kd(b,n,k),x=kd(g,n,k),s=1-kd(g,l,k),z.push(zh[j]),z.push(Ch[j])):22===j?(u=1-kd(g,m,n),y=1-kd(g,k,n),x=1-kd(b,k,n),s=kd(b,k,l),z.push(zh[j]),z.push(Ch[j])):82===j?(v=kd(b,m,l),u=1-kd(b,m,n),t=1-kd(g,m,n),x=1-kd(g,k,n),z.push(xh[j]),z.push(Ah[j])):88===j?(v=1-kd(g,l,m),u=kd(g,n,m),t=kd(b,n,m),x=kd(b,n,k),z.push(xh[j]),z.push(Ah[j])):73===j?(v=1-kd(b,l,m),w=1-kd(g,l,m),t=kd(g,n,m),r=1-kd(b,l,k),z.push(xh[j]),z.push(yh[j])):97===j?(v=kd(g,m,l),w=kd(b,m,l),t=1-kd(b,m,n),r=kd(g,k,l),z.push(xh[j]),z.push(yh[j])):145===j?(v=kd(b,m,l),t=1-kd(b,m,n),y=kd(g,n,k),s=1-kd(g,l,k),z.push(xh[j]),z.push(Bh[j])):25===j?(v=1-kd(g,l,m),t=kd(g,n,m),y=1-kd(b,k,n),s=kd(b,k,l),z.push(xh[j]),z.push(Bh[j])):70===j?(w=1-kd(b,l,m),u=1-kd(g,m,n),x=1-kd(g,k,n),r=1-kd(b,l,k),z.push(yh[j]),z.push(zh[j])):100===j?(w=kd(g,m,l),u=kd(b,n,m),x=kd(b,n,k),r=kd(g,k,l),z.push(yh[j]),z.push(zh[j])):34===j?(0===p?(v=1-kd(b,l,m),w=1-kd(g,l,m),u=kd(g,n,m),t=kd(b,n,m),y=kd(b,n,k),x=kd(g,n,k),r=1-kd(g,l,k),s=1-kd(b,l,k)):(v=kd(g,m,l),w=kd(b,m,l),u=1-kd(b,m,n),t=1-kd(g,m,n),y=1-kd(g,k,n),x=1-kd(b,k,n),r=kd(b,k,l),s=kd(g,k,l)),z.push(xh[j]),z.push(yh[j]),z.push(Bh[j]),z.push(Ch[j])):35===j?(4===p?(v=1-kd(b,l,m),w=1-kd(g,l,m),u=kd(g,n,m),t=kd(b,n,m),y=kd(b,n,k),x=kd(g,n,k),r=1-kd(g,l,k),s=1-kd(b,l,k)):(v=kd(g,m,l),w=kd(b,m,l),u=1-kd(b,m,n),t=1-kd(g,m,n),y=1-kd(g,k,n),x=1-kd(b,k,n),r=kd(b,k,l),s=kd(g,k,l)),z.push(xh[j]),z.push(yh[j]),z.push(Ah[j]),z.push(Ch[j])):136===j?(0===p?(v=kd(g,m,l),w=kd(b,m,l),u=1-kd(b,m,n),t=1-kd(g,m,n),y=1-kd(g,k,n),x=1-kd(b,k,n),r=kd(b,k,l),s=kd(g,k,l)):(v=1-kd(b,l,m),w=1-kd(g,l,m),u=kd(g,n,m),t=kd(b,n,m),y=kd(b,n,k),x=kd(g,n,k),r=1-kd(g,l,k),s=1-kd(b,l,k)),z.push(xh[j]),z.push(yh[j]),z.push(Bh[j]),z.push(Ch[j])):153===j?(0===p?(v=kd(b,m,l),t=1-kd(b,m,n),y=1-kd(b,k,n),s=kd(b,k,l)):(v=1-kd(g,l,m),t=kd(g,n,m),y=kd(g,n,k),s=1-kd(g,l,k)),z.push(xh[j]),z.push(Ah[j])):102===j?(0===p?(w=1-kd(b,l,m),u=kd(b,n,m),x=kd(b,n,k),r=1-kd(b,l,k)):(w=kd(g,m,l),u=1-kd(g,m,n),x=1-kd(g,k,n),r=kd(g,k,l)),z.push(yh[j]),z.push(Ch[j])):155===j?(4===p?(v=kd(b,m,l),t=1-kd(b,m,n),y=1-kd(b,k,n),s=kd(b,k,l)):(v=1-kd(g,l,m),t=kd(g,n,m),y=kd(g,n,k),s=1-kd(g,l,k)),z.push(xh[j]),z.push(Bh[j])):103===j?(4===p?(w=1-kd(b,l,m),u=kd(b,n,m),x=kd(b,n,k),r=1-kd(b,l,k)):(w=kd(g,m,l),u=1-kd(g,m,n),x=1-kd(g,k,n),r=kd(g,k,l)),z.push(yh[j]),z.push(zh[j])):152===j?(0===p?(v=kd(b,m,l),u=1-kd(b,m,n),t=1-kd(g,m,n),y=1-kd(g,k,n),x=1-kd(b,k,n),s=kd(b,k,l)):(v=1-kd(g,l,m),u=kd(g,n,m),t=kd(b,n,m),y=kd(b,n,k),x=kd(g,n,k),s=1-kd(g,l,k)),z.push(xh[j]),z.push(zh[j]),z.push(Ah[j])):156===j?(4===p?(v=kd(b,m,l),u=1-kd(b,m,n),t=1-kd(g,m,n),y=1-kd(g,k,n),x=1-kd(b,k,n),s=kd(b,k,l)):(v=1-kd(g,l,m),u=kd(g,n,m),t=kd(b,n,m),y=kd(b,n,k),x=kd(g,n,k),s=1-kd(g,l,k)),z.push(xh[j]),z.push(Ah[j]),z.push(Ch[j])):137===j?(0===p?(v=kd(g,m,l),w=kd(b,m,l),t=1-kd(b,m,n),y=1-kd(b,k,n),r=kd(b,k,l),s=kd(g,k,l)):(v=1-kd(b,l,m),w=1-kd(g,l,m),t=kd(g,n,m),y=kd(g,n,k),r=1-kd(g,l,k),s=1-kd(b,l,k)),z.push(xh[j]),z.push(yh[j]),z.push(Ah[j])):139===j?(4===p?(v=kd(g,m,l),w=kd(b,m,l),t=1-kd(b,m,n),y=1-kd(b,k,n),r=kd(b,k,l),s=kd(g,k,l)):(v=1-kd(b,l,m),w=1-kd(g,l,m),t=kd(g,n,m),y=kd(g,n,k),r=1-kd(g,l,k),s=1-kd(b,l,k)),z.push(xh[j]),z.push(yh[j]),z.push(Bh[j])):98===j?(0===p?(v=1-kd(b,l,m),w=1-kd(g,l,m),u=kd(g,n,m),t=kd(b,n,m),x=kd(b,n,k),r=1-kd(b,l,k)):(v=kd(g,m,l),w=kd(b,m,l),u=1-kd(b,m,n),t=1-kd(g,m,n),x=1-kd(g,k,n),r=kd(g,k,l)),z.push(xh[j]),z.push(yh[j]),z.push(Ch[j])):99===j?(4===p?(v=1-kd(b,l,m),w=1-kd(g,l,m),u=kd(g,n,m),t=kd(b,n,m),x=kd(b,n,k),r=1-kd(b,l,k)):(v=kd(g,m,l),w=kd(b,m,l),u=1-kd(b,m,n),t=1-kd(g,m,n),x=1-kd(g,k,n),r=kd(g,k,l)),z.push(xh[j]),z.push(yh[j]),z.push(Ah[j])):38===j?(0===p?(w=1-kd(b,l,m),u=kd(b,n,m),y=kd(b,n,k),x=kd(g,n,k),r=1-kd(g,l,k),s=1-kd(b,l,k)):(w=kd(g,m,l),u=1-kd(g,m,n),y=1-kd(g,k,n),x=1-kd(b,k,n),r=kd(b,k,l),s=kd(g,k,l)),z.push(yh[j]),z.push(Bh[j]),z.push(Ch[j])):39===j?(4===p?(w=1-kd(b,l,m),u=kd(b,n,m),y=kd(b,n,k),x=kd(g,n,k),r=1-kd(g,l,k),s=1-kd(b,l,k)):(w=kd(g,m,l),u=1-kd(g,m,n),y=1-kd(g,k,n),x=1-kd(b,k,n),r=kd(b,k,l),s=kd(g,k,l)),z.push(yh[j]),z.push(zh[j]),z.push(Ch[j])):85===j&&(v=1,w=0,u=1,t=0,y=0,x=1,r=0,s=1),(0>r||r>1||0>s||s>1||0>v||v>1||0>u||u>1||0>y||y>1||0>x||x>1)&&console.log("MarchingSquaresJS-isoBands: "+j+" "+o+" "+k+","+l+","+m+","+n+" "+p+" "+r+" "+s+" "+v+" "+w+" "+u+" "+t+" "+y+" "+x),f.cells[h][i]={cval:j,cval_real:o,flipped:p,topleft:r,topright:s,righttop:v,rightbottom:w,bottomright:u,bottomleft:t,leftbottom:y,lefttop:x,edges:z}}}}}return f}(a,b,c);return Og.polygons?(Og.verbose&&console.log("MarchingSquaresJS-isoBands: returning single polygons for each grid cell"),i=function(a){var b=[],c=0;return a.cells.forEach(function(a,d){a.forEach(function(a,e){if(void 0!==a){var f=Fh[a.cval](a);"object"==typeof f&&ld(f)?"object"==typeof f[0]&&ld(f[0])?"object"==typeof f[0][0]&&ld(f[0][0])?f.forEach(function(a){a.forEach(function(a){a[0]+=e,a[1]+=d}),b[c++]=a}):(f.forEach(function(a){a[0]+=e,a[1]+=d}),b[c++]=f):console.log("MarchingSquaresJS-isoBands: bandcell polygon with malformed coordinates"):console.log("MarchingSquaresJS-isoBands: bandcell polygon with null coordinates")}})}),b}(j)):(Og.verbose&&console.log("MarchingSquaresJS-isoBands: returning polygon paths for entire data grid"),i=function(a){for(var b=[],c=a.rows,d=a.cols,e=[],f=0;c>f;f++)for(var g=0;d>g;g++)if(void 0!==a.cells[f][g]&&a.cells[f][g].edges.length>0){var h=a.cells[f][g],i=function(a){if(a.edges.length>0){var b=a.edges[a.edges.length-1],c=a.cval_real;switch(b){case 0:return c&Qg?{p:[1,a.righttop],x:-1,y:0,o:1}:{p:[a.topleft,1],x:0,y:-1,o:0};case 1:return c&Rg?{p:[a.topleft,1],x:0,y:-1,o:0}:{p:[1,a.rightbottom],x:-1,y:0,o:0};case 2:return c&Rg?{p:[a.bottomright,0],x:0,y:1,o:1}:{p:[a.topleft,1],x:0,y:-1,o:0};case 3:return c&Sg?{p:[a.topleft,1],x:0,y:-1,o:0}:{p:[a.bottomleft,0],x:0,y:1,o:0};case 4:return c&Qg?{p:[1,a.righttop],x:-1,y:0,o:1}:{p:[a.topright,1],x:0,y:-1,o:1};case 5:return c&Rg?{p:[a.topright,1],x:0,y:-1,o:1}:{p:[1,a.rightbottom],x:-1,y:0,o:0};case 6:return c&Rg?{p:[a.bottomright,0],x:0,y:1,o:1}:{p:[a.topright,1],x:0,y:-1,o:1};case 7:return c&Sg?{p:[a.topright,1],x:0,y:-1,o:1}:{p:[a.bottomleft,0],x:0,y:1,o:0};case 8:return c&Rg?{p:[a.bottomright,0],x:0,y:1,o:1}:{p:[1,a.righttop],x:-1,y:0,o:1};case 9:return c&Sg?{p:[1,a.righttop],x:-1,y:0,o:1}:{p:[a.bottomleft,0],x:0,y:1,o:0};case 10:return c&Sg?{p:[0,a.leftbottom],x:1,y:0,o:0}:{p:[1,a.righttop],x:-1,y:0,o:1};case 11:return c&Pg?{p:[1,a.righttop],x:-1,y:0,o:1}:{p:[0,a.lefttop],x:1,y:0,o:1};case 12:return c&Rg?{p:[a.bottomright,0],x:0,y:1,o:1}:{p:[1,a.rightbottom],x:-1,y:0,o:0};case 13:return c&Sg?{p:[1,a.rightbottom],x:-1,y:0,o:0}:{p:[a.bottomleft,0],x:0,y:1,o:0};case 14:return c&Sg?{p:[0,a.leftbottom],x:1,y:0,o:0}:{p:[1,a.rightbottom],x:-1,y:0,o:0};case 15:return c&Pg?{p:[1,a.rightbottom],x:-1,y:0,o:0}:{p:[0,a.lefttop],x:1,y:0,o:1};case 16:return c&Rg?{p:[a.bottomright,0],x:0,y:1,o:1}:{p:[0,a.leftbottom],x:1,y:0,o:0};case 17:return c&Pg?{p:[a.bottomright,0],x:0,y:1,o:1}:{p:[0,a.lefttop],x:1,y:0,o:1};case 18:return c&Sg?{p:[0,a.leftbottom],x:1,y:0,o:0}:{p:[a.bottomleft,0],x:0,y:1,o:0};case 19:return c&Pg?{p:[a.bottomleft,0],x:0,y:1,o:0}:{p:[0,a.lefttop],x:1,y:0,o:1};case 20:return c&Pg?{p:[a.topleft,1],x:0,y:-1,o:0}:{p:[0,a.leftbottom],x:1,y:0,o:0};case 21:return c&Qg?{p:[0,a.leftbottom],x:1,y:0,o:0}:{p:[a.topright,1],x:0,y:-1,o:1};case 22:return c&Pg?{p:[a.topleft,1],x:0,y:-1,o:0}:{p:[0,a.lefttop],x:1,y:0,o:1};case 23:return c&Qg?{p:[0,a.lefttop],x:1,y:0,o:1}:{p:[a.topright,1],x:0,y:-1,o:1};default:console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(a)}}return null}(h),j=null,k=g,l=f;null!==i&&e.push([i.p[0]+k,i.p[1]+l]);do{if(null===(j=function(a,b,c,d){var e,f,g,h,i,j=a.cval;switch(b){case-1:switch(d){case 0:e=yh[j],g=ah[j],h=bh[j],i=ch[j];break;default:e=xh[j],g=Zg[j],h=$g[j],i=_g[j]}break;case 1:switch(d){case 0:e=Bh[j],g=mh[j],h=nh[j],i=oh[j];break;default:e=Ch[j],g=jh[j],h=kh[j],i=lh[j]}break;default:switch(c){case-1:switch(d){case 0:e=Dh[j],g=Tg[j],h=Ug[j],i=Vg[j];break;default:e=Eh[j],g=Wg[j],h=Xg[j],i=Yg[j]}break;case 1:switch(d){case 0:e=Ah[j],g=dh[j],h=eh[j],i=fh[j];break;default:e=zh[j],g=gh[j],h=hh[j],i=ih[j]}}}if(f=a.edges.indexOf(e),void 0===a.edges[f])return null;switch(!function(a,b){delete a.edges[b];for(var c=b+1;c<a.edges.length;c++)a.edges[c-1]=a.edges[c];a.edges.pop()}(a,f),j=a.cval_real,e){case 0:j&Qg?(b=a.topleft,c=1):(b=1,c=a.righttop);break;case 1:j&Rg?(b=1,c=a.rightbottom):(b=a.topleft,c=1);break;case 2:j&Rg?(b=a.topleft,c=1):(b=a.bottomright,c=0);break;case 3:j&Sg?(b=a.bottomleft,c=0):(b=a.topleft,c=1);break;case 4:j&Qg?(b=a.topright,c=1):(b=1,c=a.righttop);break;case 5:j&Rg?(b=1,c=a.rightbottom):(b=a.topright,c=1);break;case 6:j&Rg?(b=a.topright,c=1):(b=a.bottomright,c=0);break;case 7:j&Sg?(b=a.bottomleft,c=0):(b=a.topright,c=1);break;case 8:j&Rg?(b=1,c=a.righttop):(b=a.bottomright,c=0);break;case 9:j&Sg?(b=a.bottomleft,c=0):(b=1,c=a.righttop);break;case 10:j&Sg?(b=1,c=a.righttop):(b=0,c=a.leftbottom);break;case 11:j&Pg?(b=0,c=a.lefttop):(b=1,c=a.righttop);break;case 12:j&Rg?(b=1,c=a.rightbottom):(b=a.bottomright,c=0);break;case 13:j&Sg?(b=a.bottomleft,c=0):(b=1,c=a.rightbottom);break;case 14:j&Sg?(b=1,c=a.rightbottom):(b=0,c=a.leftbottom);break;case 15:j&Pg?(b=0,c=a.lefttop):(b=1,c=a.rightbottom);break;case 16:j&Rg?(b=0,c=a.leftbottom):(b=a.bottomright,c=0);break;case 17:j&Pg?(b=0,c=a.lefttop):(b=a.bottomright,c=0);break;case 18:j&Sg?(b=a.bottomleft,c=0):(b=0,c=a.leftbottom);break;case 19:j&Pg?(b=0,c=a.lefttop):(b=a.bottomleft,c=0);break;case 20:j&Pg?(b=0,c=a.leftbottom):(b=a.topleft,c=1);break;case 21:j&Qg?(b=a.topright,c=1):(b=0,c=a.leftbottom);break;case 22:j&Pg?(b=0,c=a.lefttop):(b=a.topleft,c=1);break;case 23:j&Qg?(b=a.topright,c=1):(b=0,c=a.lefttop);break;default:return console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(a),null}return void 0!==b&&void 0!==c&&void 0!==g&&void 0!==h&&void 0!==i||(console.log("MarchingSquaresJS-isoBands: undefined value!"),console.log(a),console.log(b+" "+c+" "+g+" "+h+" "+i)),{p:[b,c],x:g,y:h,o:i}}(a.cells[l][k],i.x,i.y,i.o)))break;if(e.push([j.p[0]+k,j.p[1]+l]),k+=j.x,l+=j.y,i=j,0>l||l>=c||0>k||k>=d||void 0===a.cells[l][k]){k-=j.x,l-=j.y;var m=function(a,b,c,d,e,f){for(var g=a.cells[c][b],h=g.cval_real,i=b+d,j=c+e,k=[],l=!1;!l;){if(void 0===a.cells[j]||void 0===a.cells[j][i])if(j-=e,i-=d,g=a.cells[j][i],h=g.cval_real,-1===e)if(0===f)if(h&Sg)k.push([i,j]),d=-1,e=0,f=0;else{if(!(h&Rg)){k.push([i+g.bottomright,j]),d=0,e=1,f=1,l=!0;break}k.push([i+1,j]),d=1,e=0,f=0}else{if(!(h&Sg)){if(h&Rg){k.push([i+g.bottomright,j]),d=0,e=1,f=1,l=!0;break}k.push([i+g.bottomleft,j]),d=0,e=1,f=0,l=!0;break}k.push([i,j]),d=-1,e=0,f=0}else if(1===e)if(0===f){if(!(h&Qg)){if(h&Pg){k.push([i+g.topleft,j+1]),d=0,e=-1,f=0,l=!0;break}k.push([i+g.topright,j+1]),d=0,e=-1,f=1,l=!0;break}k.push([i+1,j+1]),d=1,e=0,f=1}else k.push([i+1,j+1]),d=1,e=0,f=1;else if(-1===d)if(0===f){if(!(h&Pg)){if(h&Sg){k.push([i,j+g.leftbottom]),d=1,e=0,f=0,l=!0;break}k.push([i,j+g.lefttop]),d=1,e=0,f=1,l=!0;break}k.push([i,j+1]),d=0,e=1,f=0}else{if(!(h&Pg)){console.log("MarchingSquaresJS-isoBands: wtf");break}k.push([i,j+1]),d=0,e=1,f=0}else{if(1!==d){console.log("MarchingSquaresJS-isoBands: we came from nowhere!");break}if(0===f){if(!(h&Rg)){k.push([i+1,j+g.rightbottom]),d=-1,e=0,f=0,l=!0;break}k.push([i+1,j]),d=0,e=-1,f=1}else{if(!(h&Rg)){if(h&Qg){k.push([i+1,j+g.righttop]),d=-1,e=0,f=1;break}k.push([i+1,j+g.rightbottom]),d=-1,e=0,f=0,l=!0;break}k.push([i+1,j]),d=0,e=-1,f=1}}else if(g=a.cells[j][i],h=g.cval_real,-1===d)if(0===f)if(void 0!==a.cells[j-1]&&void 0!==a.cells[j-1][i])d=0,e=-1,f=1;else{if(!(h&Sg)){k.push([i+g.bottomright,j]),d=0,e=1,f=1,l=!0;break}k.push([i,j])}else{if(!(h&Pg)){console.log("MarchingSquaresJS-isoBands: found entry from top at "+i+","+j);break}console.log("MarchingSquaresJS-isoBands: proceeding in x-direction!")}else if(1===d){if(0===f){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==a.cells[j+1]&&void 0!==a.cells[j+1][i])d=0,e=1,f=0;else{if(!(h&Qg)){k.push([i+g.topleft,j+1]),d=0,e=-1,f=0,l=!0;break}k.push([i+1,j+1]),d=1,e=0,f=1}}else if(-1===e){if(1!==f){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==a.cells[j][i+1])d=1,e=0,f=1;else{if(!(h&Rg)){k.push([i+1,j+g.righttop]),d=-1,e=0,f=1,l=!0;break}k.push([i+1,j]),d=0,e=-1,f=1}}else{if(1!==e){console.log("MarchingSquaresJS-isoBands: where did we came from???");break}if(0!==f){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==a.cells[j][i-1])d=-1,e=0,f=0;else{if(!(h&Pg)){k.push([i,j+g.leftbottom]),d=1,e=0,f=0,l=!0;break}k.push([i,j+1]),d=0,e=1,f=0}}if(i+=d,j+=e,i===b&&j===c)break}return{path:k,i:i,j:j,x:d,y:e,o:f}}(a,k,l,j.x,j.y,j.o);if(null===m)break;m.path.forEach(function(a){e.push(a)}),k=m.i,l=m.j,i=m}}while(void 0!==a.cells[l][k]&&a.cells[l][k].edges.length>0);b.push(e),e=[],a.cells[f][g].edges.length>0&&g--}return b}(j)),"function"==typeof Og.successCallback&&Og.successCallback(i),i}function kd(a,b,c){return(a-b)/(c-b)}function ld(a){return a.constructor.toString().indexOf("Array")>-1}function md(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var d=c.pivot,e=c.mutate;if(!a)throw new Error("geojson is required");if(void 0===b||null===b||isNaN(b))throw new Error("angle is required");return 0===b?a:(d||(d=qb(a)),!1!==e&&void 0!==e||(a=Ma(a)),B(a,function(a){var c=fc(d,a)+b,e=hc(d,a),f=S(bd(d,e,c));a[0]=f[0],a[1]=f[1]}),a)}function nd(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var d=c.origin,e=c.mutate;if(!a)throw new Error("geojson required");if("number"!=typeof b||0===b)throw new Error("invalid factor");var f=Array.isArray(d)||"object"==typeof d;return!0!==e&&(a=Ma(a)),"FeatureCollection"!==a.type||f?od(a,b,d):(F(a,function(c,e){a.features[e]=od(c,b,d)}),a)}function od(a,b,c){var e="Point"===Z(a);return c=function(a,b){if(void 0!==b&&null!==b||(b="centroid"),Array.isArray(b)||"object"==typeof b)return R(b);var c=a.bbox?a.bbox:Q(a),e=c[0],f=c[1],g=c[2],h=c[3];switch(b){case"sw":case"southwest":case"westsouth":case"bottomleft":return d([e,f]);case"se":case"southeast":case"eastsouth":case"bottomright":return d([g,f]);case"nw":case"northwest":case"westnorth":case"topleft":return d([e,h]);case"ne":case"northeast":case"eastnorth":case"topright":return d([g,h]);case"center":return pb(a);case void 0:case null:case"centroid":return qb(a);default:throw new Error("invalid origin")}}(a,c),1===b||e?a:(B(a,function(a){var d=hc(c,a),e=fc(c,a),f=S(bd(c,d*b,e));a[0]=f[0],a[1]=f[1],3===a.length&&(a[2]*=b)}),a)}function pd(a){var b=a[0],c=a[1];return[c[0]-b[0],c[1]-b[1]]}function qd(a,b){return a[0]*b[1]-b[0]*a[1]}function rd(a,b){return!function(a,b){return 0===qd(pd(a),pd(b))}(a,b)&&function(a,b){var c=a[0],d=pd(a),e=b[0],f=pd(b),g=qd(d,f);return function(a,b){return[a[0]+b[0],a[1]+b[1]]}(c,function(a,b){return[a*b[0],a*b[1]]}(qd(function(a,b){return[a[0]-b[0],a[1]-b[1]]}(e,c),f)/g,d))}(a,b)}function sd(a,b,c){var d=[],e=r(b,c),f=S(a),g=[];return f.forEach(function(a,b){if(b!==f.length-1){var c=function(a,b,c){var d=Math.sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1])),e=a[0]+c*(b[1]-a[1])/d,f=b[0]+c*(b[1]-a[1])/d,g=a[1]+c*(a[0]-b[0])/d,h=b[1]+c*(a[0]-b[0])/d;return[[e,g],[f,h]]}(a,f[b+1],e);if(d.push(c),b>0){var h=d[b-1],i=rd(c,h);!1!==i&&(h[1]=i,c[0]=i),g.push(h[0]),b===f.length-2&&(g.push(c[0]),g.push(c[1]))}2===f.length&&(g.push(c[0]),g.push(c[1]))}}),h(g,a.properties)}function td(a,b,c){var d=b[0]-a[0],e=b[1]-a[1],f=c[0]-b[0],g=c[1]-b[1];return Math.sign(d*g-f*e)}function ud(a,b){return b.geometry.coordinates[0].every(function(b){return Ea(d(b),a)})}function vd(a,b){for(var c=0;c<a.coordinates.length-1;c++)if(function(a,b,c){var d=c[0]-a[0],e=c[1]-a[1],f=b[0]-a[0],g=b[1]-a[1];return d*g-e*f!=0?!1:Math.abs(f)>=Math.abs(g)?f>0?a[0]<=c[0]&&c[0]<=b[0]:b[0]<=c[0]&&c[0]<=a[0]:g>0?a[1]<=c[1]&&c[1]<=b[1]:b[1]<=c[1]&&c[1]<=a[1]}(a.coordinates[c],a.coordinates[c+1],b.coordinates))return!0;return!1}function wd(a,b){return cc(b,Nc(a)).features.length>0}function xd(a,b){return!(a[0]>b[0]||a[2]<b[2]||a[1]>b[1]||a[3]<b[3])}function yd(a,b){return a[0]===b[0]&&a[1]===b[1]}function zd(a,b){for(var c=!1,d=!1,e=a.coordinates.length,f=0;e>f&&!c&&!d;){for(var g=0;g<b.coordinates.length-1;g++){var h=!0;0!==g&&g!==b.coordinates.length-2||(h=!1),Cd(b.coordinates[g],b.coordinates[g+1],a.coordinates[f],h)?c=!0:d=!0}f++}return c&&d}function Ad(a,b){return cc(a,Nc(b)).features.length>0}function Bd(a,b){for(var c=!1,e=!1,f=a.coordinates[0].length,g=0;f>g&&c&&e;)Ea(d(a.coordinates[0][g]),b)?c=!0:e=!0,g++;return e&&e}function Cd(a,b,c,d){var e=c[0]-a[0],f=c[1]-a[1],g=b[0]-a[0],h=b[1]-a[1];return 0==e*h-f*g&&(d?Math.abs(g)>=Math.abs(h)?g>0?a[0]<=c[0]&&c[0]<=b[0]:b[0]<=c[0]&&c[0]<=a[0]:h>0?a[1]<=c[1]&&c[1]<=b[1]:b[1]<=c[1]&&c[1]<=a[1]:Math.abs(g)>=Math.abs(h)?g>0?a[0]<c[0]&&c[0]<b[0]:b[0]<c[0]&&c[0]<a[0]:h>0?a[1]<c[1]&&c[1]<b[1]:b[1]<c[1]&&c[1]<a[1])}function Dd(a){return a.coordinates.map(function(b){return{type:a.type.replace("Multi",""),coordinates:b}})}function Ed(a,b){return a.hasOwnProperty("coordinates")?a.coordinates.length===b.coordinates.length:a.length===b.length}function Fd(a,b){return Nh(a,b,{strict:!0})}function Gd(a,b){if(!a)throw new Error("feature1 is required");if(!b)throw new Error("feature2 is required");var c=Z(a);if(c!==Z(b))throw new Error("features must be of the same type");if("Point"===c)throw new Error("Point geometry not supported");if(new Ph({precision:6}).compare(a,b))return!1;var d=0;switch(c){case"MultiPoint":var e=H(a),f=H(b);e.forEach(function(a){f.forEach(function(b){a[0]===b[0]&&a[1]===b[1]&&d++})});break;case"LineString":case"MultiLineString":M(a,function(a){M(b,function(b){$c(a,b).features.length&&d++})});break;case"Polygon":case"MultiPolygon":M(a,function(a){M(b,function(b){cc(a,b).features.length&&d++})})}return d>0}function Hd(a,b,c){c=c||[];for(var d=0;a>d;d++)c[d]=b;return c}function Id(a,b){if(a.geometry&&a.geometry.type)return a.geometry.type;if(a.type)return a.type;throw new Error("Invalid GeoJSON object for "+b)}function Jd(a){for(var b=a,c=[];b.parent;)c.unshift(b),b=b.parent;return c}function Kd(a,b){b=b||{},this.nodes=[],this.diagonal=!!b.diagonal,this.grid=[];for(var c=0;c<a.length;c++){this.grid[c]=[];for(var d=0,e=a[c];d<e.length;d++){var f=new Ld(c,d,e[d]);this.grid[c][d]=f,this.nodes.push(f)}}this.init()}function Ld(a,b,c){this.x=a,this.y=b,this.weight=c}function Md(a){this.content=[],this.scoreFunction=a}function Nd(a){return a[0]}function Od(a){return a[1]}function Pd(){this._=null}function Qd(a){a.U=a.C=a.L=a.R=a.P=a.N=null}function Rd(a,b){var c=b,d=b.R,e=c.U;e?e.L===c?e.L=d:e.R=d:a._=d,d.U=e,c.U=d,c.R=d.L,c.R&&(c.R.U=c),d.L=c}function Sd(a,b){var c=b,d=b.L,e=c.U;e?e.L===c?e.L=d:e.R=d:a._=d,d.U=e,c.U=d,c.L=d.R,c.L&&(c.L.U=c),d.R=c}function Td(a){for(;a.L;)a=a.L;return a}function Ud(a,b,c,d){var e=[null,null],f=hi.push(e)-1;return e.left=a,e.right=b,c&&Wd(e,a,b,c),d&&Wd(e,b,a,d),fi[a.index].halfedges.push(f),fi[b.index].halfedges.push(f),e}function Vd(a,b,c){var d=[b,c];return d.left=a,d}function Wd(a,b,c,d){a[0]||a[1]?a.left===c?a[1]=d:a[0]=d:(a[0]=d,a.left=b,a.right=c)}function Xd(a,b,c,d,e){var f,g=a[0],h=a[1],i=g[0],j=g[1],k=0,l=1,m=h[0]-i,n=h[1]-j;if(f=b-i,m||!(f>0)){if(f/=m,0>m){if(k>f)return;l>f&&(l=f)}else if(m>0){if(f>l)return;f>k&&(k=f)}if(f=d-i,m||!(0>f)){if(f/=m,0>m){if(f>l)return;f>k&&(k=f)}else if(m>0){if(k>f)return;l>f&&(l=f)}if(f=c-j,n||!(f>0)){if(f/=n,0>n){if(k>f)return;l>f&&(l=f)}else if(n>0){if(f>l)return;f>k&&(k=f)}if(f=e-j,n||!(0>f)){if(f/=n,0>n){if(f>l)return;f>k&&(k=f)}else if(n>0){if(k>f)return;l>f&&(l=f)}return!(k>0||1>l)||(k>0&&(a[0]=[i+k*m,j+k*n]),1>l&&(a[1]=[i+l*m,j+l*n]),!0)}}}}}function Yd(a,b,c,d,e){var f=a[1];if(f)return!0;var g,h,i=a[0],j=a.left,k=a.right,l=j[0],m=j[1],n=k[0],o=k[1],p=(l+n)/2,q=(m+o)/2;if(o===m){if(b>p||p>=d)return;if(l>n){if(i){if(i[1]>=e)return}else i=[p,c];f=[p,e]}else{if(i){if(i[1]<c)return}else i=[p,e];f=[p,c]}}else if(g=(l-n)/(o-m),h=q-g*p,-1>g||g>1)if(l>n){if(i){if(i[1]>=e)return}else i=[(c-h)/g,c];f=[(e-h)/g,e]}else{if(i){if(i[1]<c)return}else i=[(e-h)/g,e];f=[(c-h)/g,c]}else if(o>m){if(i){if(i[0]>=d)return}else i=[b,g*b+h];f=[d,g*d+h]}else{if(i){if(i[0]<b)return}else i=[d,g*d+h];f=[b,g*b+h]}return a[0]=i,a[1]=f,!0}function Zd(a,b){var c=a.site,d=b.left,e=b.right;return c===e&&(e=d,d=c),e?Math.atan2(e[1]-d[1],e[0]-d[0]):(c===d?(d=b[1],e=b[0]):(d=b[0],e=b[1]),Math.atan2(d[0]-e[0],e[1]-d[1]))}function $d(a,b){return b[+(b.left!==a.site)]}function _d(a,b){return b[+(b.left===a.site)]}function ae(a){var b=a.P,c=a.N;if(b&&c){var d=b.site,e=a.site,f=c.site;if(d!==f){var g=e[0],h=e[1],i=d[0]-g,j=d[1]-h,k=f[0]-g,l=f[1]-h,m=2*(i*l-j*k);if(!(m>=-li)){var n=i*i+j*j,o=k*k+l*l,p=(l*n-j*o)/m,q=(i*o-k*n)/m,r=ii.pop()||new function(){Qd(this),this.x=this.y=this.arc=this.site=this.cy=null};r.arc=a,r.site=e,r.x=p+g,r.y=(r.cy=q+h)+Math.sqrt(p*p+q*q),a.circle=r;for(var s=null,t=gi._;t;)if(r.y<t.y||r.y===t.y&&r.x<=t.x){if(!t.L){s=t.P;break}t=t.L}else{if(!t.R){s=t;break}t=t.R}gi.insert(s,r),s||(di=r)}}}}function be(a){var b=a.circle;b&&(b.P||(di=b.N),gi.remove(b),ii.push(b),Qd(b),a.circle=null)}function ce(a){var b=ji.pop()||new function(){Qd(this),this.edge=this.site=this.circle=null};return b.site=a,b}function de(a){be(a),ei.remove(a),ji.push(a),Qd(a)}function ee(a){var b=a.circle,c=b.x,d=b.cy,e=[c,d],f=a.P,g=a.N,h=[a];de(a);for(var i=f;i.circle&&Math.abs(c-i.circle.x)<ki&&Math.abs(d-i.circle.cy)<ki;)f=i.P,h.unshift(i),de(i),i=f;h.unshift(i),be(i);for(var j=g;j.circle&&Math.abs(c-j.circle.x)<ki&&Math.abs(d-j.circle.cy)<ki;)g=j.N,h.push(j),de(j),j=g;h.push(j),be(j);var k,l=h.length;for(k=1;l>k;++k)j=h[k],i=h[k-1],Wd(j.edge,i.site,j.site,e);i=h[0],(j=h[l-1]).edge=Ud(i.site,j.site,null,e),ae(i),ae(j)}function fe(a){for(var b,c,d,e,f=a[0],g=a[1],h=ei._;h;)if((d=ge(h,g)-f)>ki)h=h.L;else{if(!((e=f-function(a,b){var c=a.N;if(c)return ge(c,b);var d=a.site;return d[1]===b?d[0]:1/0}(h,g))>ki)){d>-ki?(b=h.P,c=h):e>-ki?(b=h,c=h.N):b=c=h;break}if(!h.R){b=h;break}h=h.R}!function(a){fi[a.index]={site:a,halfedges:[]}}(a);var i=ce(a);if(ei.insert(b,i),b||c){if(b===c)return be(b),c=ce(b.site),ei.insert(i,c),i.edge=c.edge=Ud(b.site,i.site),ae(b),void ae(c);if(c){be(b),be(c);var j=b.site,k=j[0],l=j[1],m=a[0]-k,n=a[1]-l,o=c.site,p=o[0]-k,q=o[1]-l,r=2*(m*q-n*p),s=m*m+n*n,t=p*p+q*q,u=[(q*s-n*t)/r+k,(m*t-p*s)/r+l];Wd(c.edge,j,o,u),i.edge=Ud(j,a,null,u),c.edge=Ud(a,o,null,u),ae(b),ae(c)}else i.edge=Ud(b.site,i.site)}}function ge(a,b){var c=a.site,d=c[0],e=c[1],f=e-b;if(!f)return d;var g=a.P;if(!g)return-1/0;var h=(c=g.site)[0],i=c[1],j=i-b;if(!j)return h;var k=h-d,l=1/f-1/j,m=k/j;return l?(-m+Math.sqrt(m*m-2*l*(k*k/(-2*j)-i+j/2+e-f/2)))/l+d:(d+h)/2}function he(a,b,c){return(a[0]-c[0])*(b[1]-a[1])-(a[0]-b[0])*(c[1]-a[1])}function ie(a,b){return b[1]-a[1]||b[0]-a[0]}function je(a,b){var c,d,e,f=a.sort(ie).pop();for(hi=[],fi=new Array(a.length),ei=new Pd,gi=new Pd;;)if(e=di,f&&(!e||f[1]<e.y||f[1]===e.y&&f[0]<e.x))f[0]===c&&f[1]===d||(fe(f),c=f[0],d=f[1]),f=a.pop();else{if(!e)break;ee(e.arc)}if(function(){for(var a,b,c,d,e=0,f=fi.length;f>e;++e)if((a=fi[e])&&(d=(b=a.halfedges).length)){var g=new Array(d),h=new Array(d);for(c=0;d>c;++c)g[c]=c,h[c]=Zd(a,hi[b[c]]);for(g.sort(function(a,b){return h[b]-h[a]}),c=0;d>c;++c)h[c]=b[g[c]];for(c=0;d>c;++c)b[c]=h[c]}}(),b){var g=+b[0][0],h=+b[0][1],i=+b[1][0],j=+b[1][1];!function(a,b,c,d){for(var e,f=hi.length;f--;)Yd(e=hi[f],a,b,c,d)&&Xd(e,a,b,c,d)&&(Math.abs(e[0][0]-e[1][0])>ki||Math.abs(e[0][1]-e[1][1])>ki)||delete hi[f]}(g,h,i,j),function(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q=fi.length,r=!0;for(e=0;q>e;++e)if(f=fi[e]){for(g=f.site,h=(i=f.halfedges).length;h--;)hi[i[h]]||i.splice(h,1);for(h=0,j=i.length;j>h;)o=(n=_d(f,hi[i[h]]))[0],p=n[1],l=(k=$d(f,hi[i[++h%j]]))[0],m=k[1],(Math.abs(o-l)>ki||Math.abs(p-m)>ki)&&(i.splice(h,0,hi.push(Vd(g,n,Math.abs(o-a)<ki&&d-p>ki?[a,Math.abs(l-a)<ki?m:d]:Math.abs(p-d)<ki&&c-o>ki?[Math.abs(m-d)<ki?l:c,d]:Math.abs(o-c)<ki&&p-b>ki?[c,Math.abs(l-c)<ki?m:b]:Math.abs(p-b)<ki&&o-a>ki?[Math.abs(m-b)<ki?l:a,b]:null))-1),++j);j&&(r=!1)}if(r){var s,t,u,v=1/0;for(e=0,r=null;q>e;++e)(f=fi[e])&&(u=(s=(g=f.site)[0]-a)*s+(t=g[1]-b)*t)<v&&(v=u,r=f);if(r){var w=[a,b],x=[a,d],y=[c,d],z=[c,b];r.halfedges.push(hi.push(Vd(g=r.site,w,x))-1,hi.push(Vd(g,x,y))-1,hi.push(Vd(g,y,z))-1,hi.push(Vd(g,z,w))-1)}}for(e=0;q>e;++e)(f=fi[e])&&(f.halfedges.length||delete fi[e])}(g,h,i,j)}this.edges=hi,this.cells=fi,ei=gi=hi=fi=null}function ke(a){return(a=a.slice()).push(a[0]),f([a])}function le(a,b,c,d){var e=(d=d||{}).steps||64,g=d.units||"kilometers",h=d.angle||0,i=d.pivot||a,j=d.properties||a.properties||{};if(!a)throw new Error("center is required");if(!b)throw new Error("xSemiAxis is required");if(!c)throw new Error("ySemiAxis is required");if(!y(d))throw new Error("options must be an object");if(!x(e))throw new Error("steps must be a number");if(!x(h))throw new Error("angle must be a number");var k=R(a);if("degrees"===g)var l=u(h);else b=bd(a,b,90,{units:g}),c=bd(a,c,0,{units:g}),b=R(b)[0]-k[0],c=R(c)[1]-k[1];for(var m=[],n=0;e>n;n+=1){var o=-360*n/e,p=b*c/Math.sqrt(Math.pow(c,2)+Math.pow(b,2)*Math.pow(me(o),2)),q=b*c/Math.sqrt(Math.pow(b,2)+Math.pow(c,2)/Math.pow(me(o),2));if(-90>o&&o>=-270&&(p=-p),-180>o&&o>=-360&&(q=-q),"degrees"===g){var r=p*Math.cos(l)+q*Math.sin(l),s=q*Math.cos(l)-p*Math.sin(l);p=r,q=s}m.push([p+k[0],q+k[1]])}return m.push(m[0]),"degrees"===g?f([m],j):md(f([m],j),h,{pivot:i})}function me(a){var b=a*Math.PI/180;return Math.tan(b)}function ne(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.properties,e=b.weight;if(!a)throw new Error("geojson is required");var f=0,g=0,h=0;return I(a,function(a,b,c){var d=c[e];if(d=void 0===d||null===d?1:d,!x(d))throw new Error("weight value must be a number for feature index "+b);(d=Number(d))>0&&B(a,function(a){f+=a[0]*d,g+=a[1]*d,h+=d})}),d([f/h,g/h],c)}function oe(a,b,c,e){var f=c.properties.tolerance||.001,g=0,h=0,i=0,j=0;if(F(c,function(b){var c=b.properties.weight,d=void 0===c||null===c?1:c;if(d=Number(d),!x(d))throw new Error("weight value must be a number");if(d>0){j+=1;var e=d*La(b,a);0===e&&(e=1);var f=d/e;g+=b.geometry.coordinates[0]*f,h+=b.geometry.coordinates[1]*f,i+=f}}),1>j)throw new Error("no features to measure");var k=g/i,l=h/i;return 1===j||0===e||Math.abs(k-b[0])<f&&Math.abs(l-b[1])<f?d([k,l],{
medianCandidates:c.properties.medianCandidates}):(c.properties.medianCandidates.push([k,l]),oe([k,l],a,c,e-1))}function pe(a,b){return{x:a[0]-b[0],y:a[1]-b[1]}}function qe(a){if(y(a)&&(a=a.bbox),a&&!Array.isArray(a))throw new Error("bbox is invalid");return a?function(a){return[Math.random()*(a[2]-a[0])+a[0],Math.random()*(a[3]-a[1])+a[1]]}(a):[360*ue(),180*ue()]}function re(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.bbox;void 0!==a&&null!==a||(a=1);for(var e=[],f=0;a>f;f++)e.push(d(qe(c)));return j(e)}function se(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.bbox,d=b.num_vertices,e=b.max_radial_length;void 0!==a&&null!==a||(a=1),x(d)||(d=10),x(e)||(e=10);for(var g=[],h=0;a>h;h++){var i=[],k=Array.apply(null,new Array(d+1)).map(Math.random);k.forEach(function(a,b,c){c[b]=b>0?a+c[b-1]:a}),k.forEach(function(a){a=2*a*Math.PI/k[k.length-1];var b=Math.random();i.push([b*e*Math.sin(a),b*e*Math.cos(a)])}),i[i.length-1]=i[0],i=i.map(function(a){return function(b){return[b[0]+a[0],b[1]+a[1]]}}(qe(c))),g.push(f([i]))}return j(g)}function te(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.bbox,d=b.num_vertices,e=b.max_length,f=b.max_rotation;void 0!==a&&null!==a||(a=1),(!x(d)||2>d)&&(d=10),x(e)||(e=1e-4),x(f)||(f=Math.PI/8);for(var g=[],i=0;a>i;i++){for(var k=[qe(c)],l=0;d-1>l;l++){var m=(0===l?2*Math.random()*Math.PI:Math.tan((k[l][1]-k[l-1][1])/(k[l][0]-k[l-1][0])))+(Math.random()-.5)*f*2,n=Math.random()*e;k.push([k[l][0]+n*Math.cos(m),k[l][1]+n*Math.sin(m)])}g.push(h(k))}return j(g)}function ue(){return Math.random()-.5}function ve(a,b){if(!a)throw new Error("geojson is required");if("FeatureCollection"!==a.type)throw new Error("geojson must be a FeatureCollection");if(void 0===b||null===b)throw new Error("filter is required");var c=[];return F(a,function(a){ze(a.properties,b)&&c.push(a)}),j(c)}function we(a,b,c){if(!a)throw new Error("geojson is required");if("FeatureCollection"!==a.type)throw new Error("geojson must be a FeatureCollection");if(void 0===b||null===b)throw new Error("property is required");for(var d=ye(a,b),e=Object.keys(d),f=0;f<e.length;f++){for(var g=e[f],h=d[g],i=[],k=0;k<h.length;k++)i.push(a.features[h[k]]);c(j(i),g,f)}}function xe(a,b,c,d){var e=d;return we(a,b,function(a,b,f){e=0===f&&void 0===d?a:c(e,a,b,f)}),e}function ye(a,b){var c={};return F(a,function(a,d){var e=a.properties||{};if(e.hasOwnProperty(b)){var f=e[b];c.hasOwnProperty(f)?c[f].push(d):c[f]=[d]}}),c}function ze(a,b){if(void 0===a)return!1;var c=typeof b;if("number"===c||"string"===c)return a.hasOwnProperty(b);if(Array.isArray(b)){for(var d=0;d<b.length;d++)if(!ze(a,b[d]))return!1;return!0}return Ae(a,b)}function Ae(a,b){for(var c=Object.keys(b),d=0;d<c.length;d++){var e=c[d];if(a[e]!==b[e])return!1}return!0}function Be(a,b){if(!b)return{};if(!b.length)return{};for(var c={},d=0;d<b.length;d++){var e=b[d];a.hasOwnProperty(e)&&(c[e]=a[e])}return c}function Ce(){}function De(a){this.message=a||""}function Ee(a){this.message=a||""}function Fe(){}function Ge(a){return null===a?Hj:a.color}function He(a){return null===a?null:a.parent}function Ie(a,b){null!==a&&(a.color=b)}function Je(a){return null===a?null:a.left}function Ke(a){return null===a?null:a.right}function Le(){this.root_=null,this.size_=0}function Me(){}function Ne(){this.array_=[],arguments[0]instanceof sj&&this.addAll(arguments[0])}function Oe(){}function Pe(a){this.message=a||""}function Qe(){this.array_=[]}function Re(a){switch(a.type){case"Polygon":return rc(a)>1?a:null;case"MultiPolygon":var b=[];if(K(a,function(a){rc(a)>1&&b.push(a.geometry.coordinates)}),b.length)return{type:"MultiPolygon",coordinates:b}}}function Se(){this.reset()}function Te(a,b,c){var d=a.s=b+c,e=d-b,f=d-e;a.t=b-f+(c-e)}function Ue(a){return a>1?Nn:-1>a?-Nn:Math.asin(a)}function Ve(){}function We(a,b){a&&ao.hasOwnProperty(a.type)&&ao[a.type](a,b)}function Xe(a,b,c){var d,e=-1,f=a.length-c;for(b.lineStart();++e<f;)d=a[e],b.point(d[0],d[1],d[2]);b.lineEnd()}function Ye(a,b){var c=-1,d=a.length;for(b.polygonStart();++c<d;)Xe(a[c],b,1);b.polygonEnd()}function Ze(a){return[Un(a[1],a[0]),Ue(a[2])]}function $e(a){var b=a[0],c=a[1],d=Vn(c);return[d*Vn(b),d*Yn(b),Yn(c)]}function _e(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}function af(a,b){return[a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0]]}function bf(a,b){a[0]+=b[0],a[1]+=b[1],a[2]+=b[2]}function cf(a,b){return[a[0]*b,a[1]*b,a[2]*b]}function df(a){var b=Zn(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);a[0]/=b,a[1]/=b,a[2]/=b}function ef(a,b){return[a>Mn?a-Pn:-Mn>a?a+Pn:a,b]}function ff(a,b,c){return(a%=Pn)?b||c?co(hf(a),jf(b,c)):hf(a):b||c?jf(b,c):ef}function gf(a){return function(b,c){return b+=a,[b>Mn?b-Pn:-Mn>b?b+Pn:b,c]}}function hf(a){var b=gf(a);return b.invert=gf(-a),b}function jf(a,b){function c(a,b){var c=Vn(b),h=Vn(a)*c,i=Yn(a)*c,j=Yn(b),k=j*d+h*e;return[Un(i*f-k*g,h*d-j*e),Ue(k*f+i*g)]}var d=Vn(a),e=Yn(a),f=Vn(b),g=Yn(b);return c.invert=function(a,b){var c=Vn(b),h=Vn(a)*c,i=Yn(a)*c,j=Yn(b),k=j*f-i*g;return[Un(i*f+j*g,h*d+k*e),Ue(k*d-h*e)]},c}function kf(a,b){(b=$e(b))[0]-=a,df(b);var c=function(a){return a>1?0:-1>a?Mn:Math.acos(a)}(-b[1]);return((-b[2]<0?-c:c)+Pn-Ln)%Pn}function lf(a,b,c,d){this.x=a,this.z=b,this.o=c,this.e=d,this.v=!1,this.n=this.p=null}function mf(a){if(b=a.length){for(var b,c,d=0,e=a[0];++d<b;)e.n=c=a[d],c.p=e,e=c;e.n=c=a[0],c.p=e}}function nf(a,b,c,d){function e(e,f){return e>=a&&c>=e&&f>=b&&d>=f}function f(e,f,h,j){var k=0,l=0;if(null==e||(k=g(e,h))!==(l=g(f,h))||i(e,f)<0^h>0){do j.point(0===k||3===k?a:c,k>1?d:b);while((k=(k+h+4)%4)!==l)}else j.point(f[0],f[1])}function g(d,e){return Sn(d[0]-a)<Ln?e>0?0:3:Sn(d[0]-c)<Ln?e>0?2:1:Sn(d[1]-b)<Ln?e>0?1:0:e>0?3:2}function h(a,b){return i(a.x,b.x)}function i(a,b){var c=g(a,1),d=g(b,1);return c!==d?c-d:0===c?b[1]-a[1]:1===c?a[0]-b[0]:2===c?a[1]-b[1]:b[0]-a[0]}return function(g){function i(a,b){e(a,b)&&v.point(a,b)}function j(f,g){var h=e(f,g);if(l&&m.push([f,g]),t)n=f,o=g,p=h,t=!1,h&&(v.lineStart(),v.point(f,g));else if(h&&s)v.point(f,g);else{var i=[q=Math.max(mo,Math.min(lo,q)),r=Math.max(mo,Math.min(lo,r))],j=[f=Math.max(mo,Math.min(lo,f)),g=Math.max(mo,Math.min(lo,g))];go(i,j,a,b,c,d)?(s||(v.lineStart(),v.point(i[0],i[1])),v.point(j[0],j[1]),h||v.lineEnd(),u=!1):h&&(v.lineStart(),v.point(f,g),u=!1)}q=f,r=g,s=h}var k,l,m,n,o,p,q,r,s,t,u,v=g,w=fo(),x={point:i,lineStart:function(){x.point=j,l&&l.push(m=[]),t=!0,s=!1,q=r=NaN},lineEnd:function(){k&&(j(n,o),p&&s&&w.rejoin(),k.push(w.result())),x.point=i,s&&v.lineEnd()},polygonStart:function(){v=w,k=[],l=[],u=!0},polygonEnd:function(){var b=function(){for(var b=0,c=0,e=l.length;e>c;++c)for(var f,g,h=l[c],i=1,j=h.length,k=h[0],m=k[0],n=k[1];j>i;++i)f=m,g=n,m=(k=h[i])[0],n=k[1],d>=g?n>d&&(m-f)*(d-g)>(n-g)*(a-f)&&++b:d>=n&&(n-g)*(a-f)>(m-f)*(d-g)&&--b;return b}(),c=u&&b,e=(k=ko(k)).length;(c||e)&&(g.polygonStart(),c&&(g.lineStart(),f(null,null,1,g),g.lineEnd()),e&&io(k,h,b,f,g),g.polygonEnd()),v=g,k=l=m=null}};return x}}function of(a){return a.length>1}function pf(a,b){return((a=a.x)[0]<0?a[1]-Nn-Ln:Nn-a[1])-((b=b.x)[0]<0?b[1]-Nn-Ln:Nn-b[1])}function qf(a){return function(b){var c=new rf;for(var d in a)c[d]=a[d];return c.stream=b,c}}function rf(){}function sf(a,b,c){var d=b[1][0]-b[0][0],e=b[1][1]-b[0][1],f=a.clipExtent&&a.clipExtent();a.scale(150).translate([0,0]),null!=f&&a.clipExtent(null),bo(c,a.stream(to));var g=to.result(),h=Math.min(d/(g[1][0]-g[0][0]),e/(g[1][1]-g[0][1])),i=+b[0][0]+(d-h*(g[1][0]+g[0][0]))/2,j=+b[0][1]+(e-h*(g[1][1]+g[0][1]))/2;return null!=f&&a.clipExtent(f),a.scale(150*h).translate([i,j])}function tf(a){return function(a){function b(a){return a=j(a[0]*Rn,a[1]*Rn),[a[0]*p+g,h-a[1]*p]}function c(a,b){return a=f(a,b),[a[0]*p+g,h-a[1]*p]}function d(){j=co(i=ff(u,v,w),f);var a=f(s,t);return g=q-a[0]*p,h=r+a[1]*p,e()}function e(){return n=o=null,b}var f,g,h,i,j,k,l,m,n,o,p=150,q=480,r=250,s=0,t=0,u=0,v=0,w=0,x=null,y=vo,z=null,A=oo,B=.5,C=zo(c,B);return b.stream=function(a){return n&&o===a?n:n=Ao(y(i,C(A(o=a))))},b.clipAngle=function(a){return arguments.length?(y=+a?wo(x=a*Rn,6*Rn):(x=null,vo),e()):x*Qn},b.clipExtent=function(a){return arguments.length?(A=null==a?(z=k=l=m=null,oo):nf(z=+a[0][0],k=+a[0][1],l=+a[1][0],m=+a[1][1]),e()):null==z?null:[[z,k],[l,m]]},b.scale=function(a){return arguments.length?(p=+a,d()):p},b.translate=function(a){return arguments.length?(q=+a[0],r=+a[1],d()):[q,r]},b.center=function(a){return arguments.length?(s=a[0]%360*Rn,t=a[1]%360*Rn,d()):[s*Qn,t*Qn]},b.rotate=function(a){return arguments.length?(u=a[0]%360*Rn,v=a[1]%360*Rn,w=a.length>2?a[2]%360*Rn:0,d()):[u*Qn,v*Qn,w*Qn]},b.precision=function(a){return arguments.length?(C=zo(c,B=a*a),e()):Zn(B)},b.fitExtent=function(a,c){return sf(b,a,c)},b.fitSize=function(a,c){return function(a,b,c){return sf(a,[[0,0],b],c)}(b,a,c)},function(){return f=a.apply(this,arguments),b.invert=f.invert&&function(a){return(a=j.invert((a[0]-g)/p,(h-a[1])/p))&&[a[0]*Qn,a[1]*Qn]},d()}}(function(){return a})()}function uf(a,b){return[a,Xn($n((Nn+b)/2))]}function vf(a,b){return[Xn($n((Nn+b)/2)),-a]}function wf(a,c,d,e){var f=a.properties||{},g="Feature"===a.type?a.geometry:a;if("GeometryCollection"===g.type){var h=[];return I(a,function(a){var b=wf(a,c,d,e);b&&h.push(b)}),j(h)}var i,k=Q(a),l=k[1]>50&&k[3]>50;i=l?{type:g.type,coordinates:yf(g.coordinates,Af(g))}:ic(g);var m=(new wk).read(i),n=p(q(c,d),"meters"),o=nm.bufferOp(m,n);if(o=(new xk).write(o),!xf(o.coordinates)){var r;return(r=l?{type:o.type,coordinates:zf(o.coordinates,Af(g))}:jc(o)).geometry?r:b(r,f)}}function xf(a){return Array.isArray(a[0])?xf(a[0]):isNaN(a[0])}function yf(a,b){return"object"!=typeof a[0]?b(a):a.map(function(a){return yf(a,b)})}function zf(a,b){return"object"!=typeof a[0]?b.invert(a):a.map(function(a){return zf(a,b)})}function Af(a){var b=pb(a).geometry.coordinates.reverse(),c=b.map(function(a){return-a});return Bo().center(b).rotate(c).scale(Jf)}function Bf(){for(var a=new wk,b=a.read(JSON.stringify(arguments[0].geometry)),c=1;c<arguments.length;c++)b=In.union(b,a.read(JSON.stringify(arguments[c].geometry)));return b=(new xk).write(b),{type:"Feature",geometry:b,properties:arguments[0].properties}}function Cf(a,c){var d=X(a),e=X(c);if(ab(Dc(e,{precision:4})).coordinates[0].length<4)return null;if(ab(Dc(d,{precision:4})).coordinates[0].length<4)return null;var f=new wk,g=f.read(Dc(d)),h=f.read(Dc(e)),i=zn.intersection(g,h);return i.isEmpty()?null:b((new xk).write(i))}function Df(a,b){return function(a,b,c){var d,e;if(!Array.isArray(b))throw new Error("Get closest expects an array as second argument");return b.forEach(function(b,f){var g=c(b,a);g>=0&&(void 0===e||e>g)&&(e=g,d=f)}),d}(a,b,function(a,b){return a-b})}function Ef(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var d=c.properties||{},e=c.triangles,g=c.mask;if(null===b||void 0===b)throw new Error("cellSide is required");if(!x(b))throw new Error("cellSide is invalid");if(!a)throw new Error("bbox is required");if(!Array.isArray(a))throw new Error("bbox must be array");if(4!==a.length)throw new Error("bbox must contain 4 numbers");if(g&&-1===["Polygon","MultiPolygon"].indexOf(Z(g)))throw new Error("options.mask must be a (Multi)Polygon");var h=a[0],i=a[1],k=a[2],l=a[3],m=(i+l)/2,n=(h+k)/2,o=2*b/La([h,m],[k,m],c)*(k-h),p=2*b/La([n,i],[n,l],c)*(l-i),q=o/2,r=2*q,s=Math.sqrt(3)/2*p,t=k-h,u=l-i,v=.75*r,w=s,z=(t-r)/(r-q/2),A=Math.floor(z),B=(A*v-q/2-t)/2-q/2+v/2,C=Math.floor((u-s)/s),D=(u-C*s)/2,E=C*s-u>s/2;E&&(D-=s/4);for(var F=[],G=[],H=0;6>H;H++){var I=2*Math.PI/6*H;F.push(Math.cos(I)),G.push(Math.sin(I))}for(var J=[],K=0;A>=K;K++)for(var L=0;C>=L;L++){var M=K%2==1;if(!(0===L&&M||0===L&&E)){var N=K*v+h-B,O=L*w+i+D;if(M&&(O-=s/2),!0===e)(function(a,b,c,d,e,g){for(var h=[],i=0;6>i;i++){var j=[];j.push(a),j.push([a[0]+b*e[i],a[1]+c*g[i]]),j.push([a[0]+b*e[(i+1)%6],a[1]+c*g[(i+1)%6]]),j.push(a),h.push(f([j],d))}return h})([N,O],o/2,p/2,d,F,G).forEach(function(a){g?Cf(g,a)&&J.push(a):J.push(a)});else{var P=function(a,b,c,d,e,g){for(var h=[],i=0;6>i;i++){var j=a[0]+b*e[i],k=a[1]+c*g[i];h.push([j,k])}return h.push(h[0].slice()),f([h],d)}([N,O],o/2,p/2,d,F,G);g?Cf(g,P)&&J.push(P):J.push(P)}}}return j(J)}function Ff(a){if(a.features.length<=1)return a;var b=function(a){var b=Tf(),c=[];return K(a,function(a,b){var d=Q(a);c.push({minX:d[0],minY:d[1],maxX:d[2],maxY:d[3],geojson:a,index:b})}),b.load(c),b}(a),c=[],d={};return K(a,function(a,e){if(d[e])return!0;for(b.remove({index:e},Gf),d[e]=!0;;){var f=Q(a),g=b.search({minX:f[0],minY:f[1],maxX:f[2],maxY:f[3]});if(g.length>0){var h=g.map(function(a){return d[a.index]=!0,b.remove({index:a.index},Gf),a.geojson});h.push(a),a=Bf.apply(this,h)}if(0===g.length)break}c.push(a)}),j(c)}function Gf(a,b){return a.index===b.index}function Hf(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var d=c.properties,e=c.mask,g=[];if(null===b||void 0===b)throw new Error("cellSide is required");if(!x(b))throw new Error("cellSide is invalid");if(!a)throw new Error("bbox is required");if(!Array.isArray(a))throw new Error("bbox must be array");if(4!==a.length)throw new Error("bbox must contain 4 numbers");if(e&&-1===["Polygon","MultiPolygon"].indexOf(Z(e)))throw new Error("options.mask must be a (Multi)Polygon");for(var h=a[0],i=a[1],k=a[2],l=a[3],m=b/La([h,i],[k,i],c)*(k-h),n=b/La([h,i],[h,l],c)*(l-i),o=k-h,p=l-i,q=Math.floor(o/m),r=Math.floor(p/n),s=(p-r*n)/2,t=h+(o-q*m)/2,u=0;q>u;u++){for(var v=i+s,w=0;r>w;w++){var z=f([[[t,v],[t,v+n],[t+m,v+n],[t+m,v],[t,v]]],d);e?Cf(e,z)&&g.push(z):g.push(z),v+=n}t+=m}return j(g)}function If(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var d=c.properties,e=c.mask,g=[];if(null===b||void 0===b)throw new Error("cellSide is required");if(!x(b))throw new Error("cellSide is invalid");if(!a)throw new Error("bbox is required");if(!Array.isArray(a))throw new Error("bbox must be array");if(4!==a.length)throw new Error("bbox must contain 4 numbers");if(e&&-1===["Polygon","MultiPolygon"].indexOf(Z(e)))throw new Error("options.mask must be a (Multi)Polygon");for(var h=b/La([a[0],a[1]],[a[2],a[1]],c)*(a[2]-a[0]),i=b/La([a[0],a[1]],[a[0],a[3]],c)*(a[3]-a[1]),k=0,l=a[0];l<=a[2];){for(var m=0,n=a[1];n<=a[3];){var o=null,p=null;k%2==0&&m%2==0?(o=f([[[l,n],[l,n+i],[l+h,n],[l,n]]],d),p=f([[[l,n+i],[l+h,n+i],[l+h,n],[l,n+i]]],d)):k%2==0&&m%2==1?(o=f([[[l,n],[l+h,n+i],[l+h,n],[l,n]]],d),p=f([[[l,n],[l,n+i],[l+h,n+i],[l,n]]],d)):m%2==0&&k%2==1?(o=f([[[l,n],[l,n+i],[l+h,n+i],[l,n]]],d),p=f([[[l,n],[l+h,n+i],[l+h,n],[l,n]]],d)):m%2==1&&k%2==1&&(o=f([[[l,n],[l,n+i],[l+h,n],[l,n]]],d),p=f([[[l,n+i],[l+h,n+i],[l+h,n],[l,n+i]]],d)),e?(Cf(e,o)&&g.push(o),Cf(e,p)&&g.push(p)):(g.push(o),g.push(p)),n+=i,m++}k++,l+=h}return j(g)}var Jf=6371008.8,Kf={meters:Jf,metres:Jf,millimeters:1e3*Jf,millimetres:1e3*Jf,centimeters:100*Jf,centimetres:100*Jf,kilometers:Jf/1e3,kilometres:Jf/1e3,miles:Jf/1609.344,nauticalmiles:Jf/1852,inches:39.37*Jf,yards:Jf/1.0936,feet:3.28084*Jf,radians:1,degrees:Jf/111325},Lf={meters:1,metres:1,millimeters:1e3,millimetres:1e3,centimeters:100,centimetres:100,kilometers:.001,kilometres:.001,miles:1/1609.344,nauticalmiles:1/1852,inches:39.37,yards:1/1.0936,feet:3.28084,radians:1/Jf,degrees:1/111325},Mf={meters:1,metres:1,millimeters:1e6,millimetres:1e6,centimeters:1e4,centimetres:1e4,kilometers:1e-6,kilometres:1e-6,acres:247105e-9,miles:3.86e-7,yards:1.195990046,feet:10.763910417,inches:1550.003100006},Nf=Object.freeze({earthRadius:Jf,factors:Kf,unitsFactors:Lf,areaFactors:Mf,feature:b,geometry:c,point:d,points:e,polygon:f,polygons:g,lineString:h,lineStrings:i,featureCollection:j,multiLineString:k,multiPoint:l,multiPolygon:m,geometryCollection:n,round:o,radiansToLength:p,lengthToRadians:q,lengthToDegrees:r,bearingToAzimuth:s,radiansToDegrees:t,degreesToRadians:u,convertLength:v,convertArea:w,isNumber:x,isObject:y,validateBBox:z,validateId:A,radians2degrees:function(){throw new Error("method has been renamed to `radiansToDegrees`")},degrees2radians:function(){throw new Error("method has been renamed to `degreesToRadians`")},distanceToDegrees:function(){throw new Error("method has been renamed to `lengthToDegrees`")},distanceToRadians:function(){throw new Error("method has been renamed to `lengthToRadians`")},radiansToDistance:function(){throw new Error("method has been renamed to `radiansToLength`")},bearingToAngle:function(){throw new Error("method has been renamed to `bearingToAzimuth`")},convertDistance:function(){throw new Error("method has been renamed to `convertLength`")}}),Of=Object.freeze({coordEach:B,coordReduce:C,propEach:D,propReduce:E,featureEach:F,featureReduce:G,coordAll:H,geomEach:I,geomReduce:J,flattenEach:K,flattenReduce:L,segmentEach:M,segmentReduce:N,lineEach:O,lineReduce:P}),Pf=Object.freeze({getCoord:R,getCoords:S,containsNumber:T,geojsonType:U,featureOf:V,collectionOf:W,getGeom:X,getGeomType:Y,getType:Z}),Qf={successCallback:null,verbose:!1},Rf={},Sf=ea,Tf=ga;ga.prototype={all:function(){return this._all(this.data,[])},search:function(a){var b=this.data,c=[],d=this.toBBox;if(!pa(a,b))return c;for(var e,f,g,h,i=[];b;){for(e=0,f=b.children.length;f>e;e++)g=b.children[e],pa(a,h=b.leaf?d(g):g)&&(b.leaf?c.push(g):oa(a,h)?this._all(g,c):i.push(g));b=i.pop()}return c},collides:function(a){var b=this.data,c=this.toBBox;if(!pa(a,b))return!1;for(var d,e,f,g,h=[];b;){for(d=0,e=b.children.length;e>d;d++)if(f=b.children[d],g=b.leaf?c(f):f,pa(a,g)){if(b.leaf||oa(a,g))return!0;h.push(f)}b=h.pop()}return!1},load:function(a){if(!a||!a.length)return this;if(a.length<this._minEntries){for(var b=0,c=a.length;c>b;b++)this.insert(a[b]);return this}var d=this._build(a.slice(),0,a.length-1,0);if(this.data.children.length)if(this.data.height===d.height)this._splitRoot(this.data,d);else{if(this.data.height<d.height){var e=this.data;this.data=d,d=e}this._insert(d,this.data.height-d.height-1,!0)}else this.data=d;return this},insert:function(a){return a&&this._insert(a,this.data.height-1),this},clear:function(){return this.data=qa([]),this},remove:function(a,b){if(!a)return this;for(var c,d,e,f,g=this.data,h=this.toBBox(a),i=[],j=[];g||i.length;){if(g||(g=i.pop(),d=i[i.length-1],c=j.pop(),f=!0),g.leaf&&-1!==(e=function(a,b,c){if(!c)return b.indexOf(a);for(var d=0;d<b.length;d++)if(c(a,b[d]))return d;return-1}(a,g.children,b)))return g.children.splice(e,1),i.push(g),this._condense(i),this;f||g.leaf||!oa(g,h)?d?(c++,g=d.children[c],f=!1):g=null:(i.push(g),j.push(c),c=0,d=g,g=g.children[0])}return this},toBBox:function(a){return a},compareMinX:ka,compareMinY:la,toJSON:function(){return this.data},fromJSON:function(a){return this.data=a,this},_all:function(a,b){for(var c=[];a;)a.leaf?b.push.apply(b,a.children):c.push.apply(c,a.children),a=c.pop();return b},_build:function(a,b,c,d){var e,f=c-b+1,g=this._maxEntries;if(g>=f)return e=qa(a.slice(b,c+1)),ha(e,this.toBBox),e;d||(d=Math.ceil(Math.log(f)/Math.log(g)),g=Math.ceil(f/Math.pow(g,d-1))),(e=qa([])).leaf=!1,e.height=d;var h,i,j,k,l=Math.ceil(f/g),m=l*Math.ceil(Math.sqrt(g));for(ra(a,b,c,m,this.compareMinX),h=b;c>=h;h+=m)for(ra(a,h,j=Math.min(h+m-1,c),l,this.compareMinY),i=h;j>=i;i+=l)k=Math.min(i+l-1,j),e.children.push(this._build(a,i,k,d-1));return ha(e,this.toBBox),e},_chooseSubtree:function(a,b,c,d){for(var e,f,g,h,i,j,k,l;d.push(b),!b.leaf&&d.length-1!==c;){for(k=l=1/0,e=0,f=b.children.length;f>e;e++)i=ma(g=b.children[e]),(j=function(a,b){return(Math.max(b.maxX,a.maxX)-Math.min(b.minX,a.minX))*(Math.max(b.maxY,a.maxY)-Math.min(b.minY,a.minY))}(a,g)-i)<l?(l=j,k=k>i?i:k,h=g):j===l&&k>i&&(k=i,h=g);b=h||b.children[0]}return b},_insert:function(a,b,c){var d=this.toBBox,e=c?a:d(a),f=[],g=this._chooseSubtree(e,this.data,b,f);for(g.children.push(a),ja(g,e);b>=0&&f[b].children.length>this._maxEntries;)this._split(f,b),b--;this._adjustParentBBoxes(e,f,b)},_split:function(a,b){var c=a[b],d=c.children.length,e=this._minEntries;this._chooseSplitAxis(c,e,d);var f=this._chooseSplitIndex(c,e,d),g=qa(c.children.splice(f,c.children.length-f));g.height=c.height,g.leaf=c.leaf,ha(c,this.toBBox),ha(g,this.toBBox),b?a[b-1].children.push(g):this._splitRoot(c,g)},_splitRoot:function(a,b){this.data=qa([a,b]),this.data.height=a.height+1,this.data.leaf=!1,ha(this.data,this.toBBox)},_chooseSplitIndex:function(a,b,c){var d,e,f,g,h,i,j,k;for(i=j=1/0,d=b;c-b>=d;d++)g=function(a,b){var c=Math.max(a.minX,b.minX),d=Math.max(a.minY,b.minY),e=Math.min(a.maxX,b.maxX),f=Math.min(a.maxY,b.maxY);return Math.max(0,e-c)*Math.max(0,f-d)}(e=ia(a,0,d,this.toBBox),f=ia(a,d,c,this.toBBox)),h=ma(e)+ma(f),i>g?(i=g,k=d,j=j>h?h:j):g===i&&j>h&&(j=h,k=d);return k},_chooseSplitAxis:function(a,b,c){var d=a.leaf?this.compareMinX:ka,e=a.leaf?this.compareMinY:la;this._allDistMargin(a,b,c,d)<this._allDistMargin(a,b,c,e)&&a.children.sort(d)},_allDistMargin:function(a,b,c,d){a.children.sort(d);var e,f,g=this.toBBox,h=ia(a,0,b,g),i=ia(a,c-b,c,g),j=na(h)+na(i);for(e=b;c-b>e;e++)f=a.children[e],ja(h,a.leaf?g(f):f),j+=na(h);for(e=c-b-1;e>=b;e--)f=a.children[e],ja(i,a.leaf?g(f):f),j+=na(i);return j},_adjustParentBBoxes:function(a,b,c){for(var d=c;d>=0;d--)ja(b[d],a)},_condense:function(a){for(var b,c=a.length-1;c>=0;c--)0===a[c].children.length?c>0?(b=a[c-1].children).splice(b.indexOf(a[c]),1):this.clear():ha(a[c],this.toBBox)},_initFormat:function(a){var b=["return a"," - b",";"];this.compareMinX=new Function("a","b",b.join(a[0])),this.compareMinY=new Function("a","b",b.join(a[1])),this.toBBox=new Function("a","return {minX: a"+a[0]+", minY: a"+a[1]+", maxX: a"+a[2]+", maxY: a"+a[3]+"};")}};var Uf=function(a,b,c){var d=a*b,e=Vf*a,f=e-(e-a),g=a-f,h=Vf*b,i=h-(h-b),j=b-i,k=g*j-(d-f*i-g*i-f*j);return c?(c[0]=k,c[1]=d,c):[k,d]},Vf=+(Math.pow(2,27)+1),Wf=function(a,b){var c=0|a.length,d=0|b.length;if(1===c&&1===d)return function(a,b){var c=a+b,d=c-a,e=a-(c-d)+(b-d);return e?[e,c]:[c]}(a[0],b[0]);var e,f,g=c+d,h=new Array(g),i=0,j=0,k=0,l=Math.abs,m=a[j],n=l(m),o=b[k],p=l(o);p>n?(f=m,(j+=1)<c&&(n=l(m=a[j]))):(f=o,(k+=1)<d&&(p=l(o=b[k]))),c>j&&p>n||k>=d?(e=m,(j+=1)<c&&(n=l(m=a[j]))):(e=o,(k+=1)<d&&(p=l(o=b[k])));for(var q,r,s=e+f,t=s-e,u=f-t,v=u,w=s;c>j&&d>k;)p>n?(e=m,(j+=1)<c&&(n=l(m=a[j]))):(e=o,(k+=1)<d&&(p=l(o=b[k]))),(u=(f=v)-(t=(s=e+f)-e))&&(h[i++]=u),v=w-((q=w+s)-(r=q-w))+(s-r),w=q;for(;c>j;)(u=(f=v)-(t=(s=(e=m)+f)-e))&&(h[i++]=u),v=w-((q=w+s)-(r=q-w))+(s-r),w=q,(j+=1)<c&&(m=a[j]);for(;d>k;)(u=(f=v)-(t=(s=(e=o)+f)-e))&&(h[i++]=u),v=w-((q=w+s)-(r=q-w))+(s-r),w=q,(k+=1)<d&&(o=b[k]);return v&&(h[i++]=v),w&&(h[i++]=w),i||(h[i++]=0),h.length=i,h},Xf=function(a,b,c){var d=a+b,e=d-a,f=b-e,g=a-(d-e);return c?(c[0]=g+f,c[1]=d,c):[g+f,d]},Yf=function(a,b){var c=a.length;if(1===c){var d=Uf(a[0],b);return d[0]?d:[d[1]]}var e=new Array(2*c),f=[.1,.1],g=[.1,.1],h=0;Uf(a[0],b,f),f[0]&&(e[h++]=f[0]);for(var i=1;c>i;++i){Uf(a[i],b,g);var j=f[1];Xf(j,g[0],f),f[0]&&(e[h++]=f[0]);var k=g[1],l=f[1],m=k+l,n=l-(m-k);f[1]=m,n&&(e[h++]=n)}return f[1]&&(e[h++]=f[1]),0===h&&(e[h++]=0),e.length=h,e},Zf=function(a,b){var c=0|a.length,d=0|b.length;if(1===c&&1===d)return function(a,b){var c=a+b,d=c-a,e=a-(c-d)+(b-d);return e?[e,c]:[c]}(a[0],-b[0]);var e,f,g=c+d,h=new Array(g),i=0,j=0,k=0,l=Math.abs,m=a[j],n=l(m),o=-b[k],p=l(o);p>n?(f=m,(j+=1)<c&&(n=l(m=a[j]))):(f=o,(k+=1)<d&&(p=l(o=-b[k]))),c>j&&p>n||k>=d?(e=m,(j+=1)<c&&(n=l(m=a[j]))):(e=o,(k+=1)<d&&(p=l(o=-b[k])));for(var q,r,s=e+f,t=s-e,u=f-t,v=u,w=s;c>j&&d>k;)p>n?(e=m,(j+=1)<c&&(n=l(m=a[j]))):(e=o,(k+=1)<d&&(p=l(o=-b[k]))),(u=(f=v)-(t=(s=e+f)-e))&&(h[i++]=u),v=w-((q=w+s)-(r=q-w))+(s-r),w=q;for(;c>j;)(u=(f=v)-(t=(s=(e=m)+f)-e))&&(h[i++]=u),v=w-((q=w+s)-(r=q-w))+(s-r),w=q,(j+=1)<c&&(m=a[j]);for(;d>k;)(u=(f=v)-(t=(s=(e=o)+f)-e))&&(h[i++]=u),v=w-((q=w+s)-(r=q-w))+(s-r),w=q,(k+=1)<d&&(o=-b[k]);return v&&(h[i++]=v),w&&(h[i++]=w),i||(h[i++]=0),h.length=i,h},$f=sa(function(a){function b(a,b){for(var c=new Array(a.length-1),d=1;d<a.length;++d)for(var e=c[d-1]=new Array(a.length-1),f=0,g=0;f<a.length;++f)f!==b&&(e[g++]=a[d][f]);return c}function c(a){return 1&a?"-":""}function d(a){if(1===a.length)return a[0];if(2===a.length)return["sum(",a[0],",",a[1],")"].join("");var b=a.length>>1;return["sum(",d(a.slice(0,b)),",",d(a.slice(b)),")"].join("")}function e(a){if(2===a.length)return[["sum(prod(",a[0][0],",",a[1][1],"),prod(-",a[0][1],",",a[1][0],"))"].join("")];for(var f=[],g=0;g<a.length;++g)f.push(["scale(",d(e(b(a,g))),",",c(g),a[0][g],")"].join(""));return f}function f(a){for(var c=[],f=[],g=function(a){for(var b=new Array(a),c=0;a>c;++c){b[c]=new Array(a);for(var d=0;a>d;++d)b[c][d]=["m",d,"[",a-c-1,"]"].join("")}return b}(a),h=[],i=0;a>i;++i)0==(1&i)?c.push.apply(c,e(b(g,i))):f.push.apply(f,e(b(g,i))),h.push("m"+i);var j=d(c),k=d(f),l="orientation"+a+"Exact",m=["function ",l,"(",h.join(),"){var p=",j,",n=",k,",d=sub(p,n);return d[d.length-1];};return ",l].join("");return new Function("sum","prod","scale","sub",m)(Wf,Uf,Yf,Zf)}var g=5,h=f(3),i=f(4),j=[function(){return 0},function(){return 0},function(a,b){return b[0]-a[0]},function(a,b,c){var d,e=(a[1]-c[1])*(b[0]-c[0]),f=(a[0]-c[0])*(b[1]-c[1]),g=e-f;if(e>0){if(0>=f)return g;d=e+f}else{if(!(0>e))return g;if(f>=0)return g;d=-(e+f)}var i=3.3306690738754716e-16*d;return g>=i||-i>=g?g:h(a,b,c)},function(a,b,c,d){var e=a[0]-d[0],f=b[0]-d[0],g=c[0]-d[0],h=a[1]-d[1],j=b[1]-d[1],k=c[1]-d[1],l=a[2]-d[2],m=b[2]-d[2],n=c[2]-d[2],o=f*k,p=g*j,q=g*h,r=e*k,s=e*j,t=f*h,u=l*(o-p)+m*(q-r)+n*(s-t),v=7.771561172376103e-16*((Math.abs(o)+Math.abs(p))*Math.abs(l)+(Math.abs(q)+Math.abs(r))*Math.abs(m)+(Math.abs(s)+Math.abs(t))*Math.abs(n));return u>v||-u>v?u:i(a,b,c,d)}];!function(){for(;j.length<=g;)j.push(f(j.length));for(var b=[],c=["slow"],d=0;g>=d;++d)b.push("a"+d),c.push("o"+d);var e=["function getOrientation(",b.join(),"){switch(arguments.length){case 0:case 1:return 0;"];for(d=2;g>=d;++d)e.push("case ",d,":return o",d,"(",b.slice(0,d).join(),");");e.push("}var s=new Array(arguments.length);for(var i=0;i<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return getOrientation"),c.push(e.join(""));var h=Function.apply(void 0,c);for(a.exports=h.apply(void 0,[function(a){var b=j[a.length];return b||(b=j[a.length]=f(a.length)),b.apply(void 0,a)}].concat(j)),d=0;g>=d;++d)a.exports[d]=j[d]}()}),_f=function(a){var b=a.length;if(3>b){for(var c=new Array(b),d=0;b>d;++d)c[d]=d;return 2===b&&a[0][0]===a[1][0]&&a[0][1]===a[1][1]?[0]:c}var e=new Array(b);for(d=0;b>d;++d)e[d]=d;e.sort(function(b,c){var d=a[b][0]-a[c][0];return d||a[b][1]-a[c][1]});var f=[e[0],e[1]],g=[e[0],e[1]];for(d=2;b>d;++d){for(var h=e[d],i=a[h],j=f.length;j>1&&ag(a[f[j-2]],a[f[j-1]],i)<=0;)j-=1,f.pop();for(f.push(h),j=g.length;j>1&&ag(a[g[j-2]],a[g[j-1]],i)>=0;)j-=1,g.pop();g.push(h)}c=new Array(g.length+f.length-2);for(var k=0,l=(d=0,f.length);l>d;++d)c[k++]=f[d];for(var m=g.length-2;m>0;--m)c[k++]=g[m];return c},ag=$f[3],bg=ta,cg=ta;ta.prototype={push:function(a){this.data.push(a),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var a=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),a}},peek:function(){return this.data[0]},_up:function(a){for(var b=this.data,c=this.compare,d=b[a];a>0;){var e=a-1>>1,f=b[e];if(c(d,f)>=0)break;b[a]=f,a=e}b[a]=d},_down:function(a){for(var b=this.data,c=this.compare,d=this.length>>1,e=b[a];d>a;){var f=1+(a<<1),g=f+1,h=b[f];if(g<this.length&&c(b[g],h)<0&&(f=g,h=b[g]),c(h,e)>=0)break;b[a]=h,a=f}b[a]=e}},bg["default"]=cg;var dg=function(a,b){for(var c=a[0],d=a[1],e=!1,f=0,g=b.length-1;f<b.length;g=f++){var h=b[f][0],i=b[f][1],j=b[g][0],k=b[g][1];i>d!=k>d&&(j-h)*(d-i)/(k-i)+h>c&&(e=!e)}return e},eg=$f[3],fg=ua,gg=ua;fg["default"]=gg;var hg=function(a){return a},ig=function(a){if(null==a)return hg;var b,c,d=a.scale[0],e=a.scale[1],f=a.translate[0],g=a.translate[1];return function(a,h){h||(b=c=0);var i=2,j=a.length,k=new Array(j);for(k[0]=(b+=a[0])*d+f,k[1]=(c+=a[1])*e+g;j>i;)k[i]=a[i],++i;return k}},jg=function(a,b){for(var c,d=a.length,e=d-b;e<--d;)c=a[e],a[e++]=a[d],a[d]=c},kg=function(a,b){function c(a,b){for(var c in a){var e=a[c];delete b[e.start],delete e.start,delete e.end,e.forEach(function(a){d[0>a?~a:a]=1}),g.push(e)}}var d={},e={},f={},g=[],h=-1;return b.forEach(function(c,d){var e,f=a.arcs[0>c?~c:c];f.length<3&&!f[1][0]&&!f[1][1]&&(e=b[++h],b[h]=c,b[d]=e)}),b.forEach(function(b){var c,d,g=function(b){var c,d=a.arcs[0>b?~b:b],e=d[0];return a.transform?(c=[0,0],d.forEach(function(a){c[0]+=a[0],c[1]+=a[1]})):c=d[d.length-1],0>b?[c,e]:[e,c]}(b),h=g[0],i=g[1];if(c=f[h])if(delete f[c.end],c.push(b),c.end=i,d=e[i]){delete e[d.start];var j=d===c?c:c.concat(d);e[j.start=c.start]=f[j.end=d.end]=j}else e[c.start]=f[c.end]=c;else if(c=e[i])if(delete e[c.start],c.unshift(b),c.start=h,d=f[h]){delete f[d.end];var k=d===c?c:d.concat(c);e[k.start=d.start]=f[k.end=c.end]=k}else e[c.start]=f[c.end]=c;else e[(c=[b]).start=h]=f[c.end=i]=c}),c(f,e),c(e,f),b.forEach(function(a){d[0>a?~a:a]||g.push([a])}),g},lg=function(a){return Ra(a,Sa.apply(this,arguments))},mg=function(a,b,c,d,e,f){3===arguments.length&&(d=f=Array,e=null);for(var g=new d(a=1<<Math.max(4,Math.ceil(Math.log(a)/Math.LN2))),h=new f(a),i=a-1,j=0;a>j;++j)g[j]=e;return{set:function(d,f){for(var j=b(d)&i,k=g[j],l=0;k!=e;){if(c(k,d))return h[j]=f;if(++l>=a)throw new Error("full hashmap");k=g[j=j+1&i]}return g[j]=d,h[j]=f,f},maybeSet:function(d,f){for(var j=b(d)&i,k=g[j],l=0;k!=e;){if(c(k,d))return h[j];if(++l>=a)throw new Error("full hashmap");k=g[j=j+1&i]}return g[j]=d,h[j]=f,f},get:function(d,f){for(var j=b(d)&i,k=g[j],l=0;k!=e;){if(c(k,d))return h[j];if(++l>=a)break;k=g[j=j+1&i]}return f},keys:function(){for(var a=[],b=0,c=g.length;c>b;++b){var d=g[b];d!=e&&a.push(d)}return a}}},ng=function(a,b){return a[0]===b[0]&&a[1]===b[1]},og=new ArrayBuffer(16),pg=new Float64Array(og),qg=new Uint32Array(og),rg=function(a){pg[0]=a[0],pg[1]=a[1];var b=qg[0]^qg[1];return 2147483647&(b=b<<5^b>>7^qg[2]^qg[3])},sg=function(a){function b(a,b,c,d){if(m[c]!==a){m[c]=a;var e=n[c];if(e>=0){var f=o[c];e===b&&f===d||e===d&&f===b||(++q,p[c]=1)}else n[c]=b,o[c]=d}}function c(a){return rg(i[a])}function d(a,b){return ng(i[a],i[b])}var e,f,g,h,i=a.coordinates,j=a.lines,k=a.rings,l=function(){for(var a=mg(1.4*i.length,c,d,Int32Array,-1,Int32Array),b=new Int32Array(i.length),e=0,f=i.length;f>e;++e)b[e]=a.maybeSet(e,e);return b}(),m=new Int32Array(i.length),n=new Int32Array(i.length),o=new Int32Array(i.length),p=new Int8Array(i.length),q=0;for(e=0,f=i.length;f>e;++e)m[e]=n[e]=o[e]=-1;for(e=0,f=j.length;f>e;++e){var r=j[e],s=r[0],t=r[1];for(g=l[s],h=l[++s],++q,p[g]=1;++s<=t;)b(e,g,g=h,h=l[s]);++q,p[h]=1}for(e=0,f=i.length;f>e;++e)m[e]=-1;for(e=0,f=k.length;f>e;++e){var u=k[e],v=u[0]+1,w=u[1];for(b(e,l[w-1],g=l[v-1],h=l[v]);++v<=w;)b(e,g,g=h,h=l[v])}m=n=o=null;var x,y=function(a,b,c,d,e){3===arguments.length&&(d=Array,e=null);for(var f=new d(a=1<<Math.max(4,Math.ceil(Math.log(a)/Math.LN2))),g=a-1,h=0;a>h;++h)f[h]=e;return{add:function(d){for(var h=b(d)&g,i=f[h],j=0;i!=e;){if(c(i,d))return!0;if(++j>=a)throw new Error("full hashset");i=f[h=h+1&g]}return f[h]=d,!0},has:function(d){for(var h=b(d)&g,i=f[h],j=0;i!=e;){if(c(i,d))return!0;if(++j>=a)break;i=f[h=h+1&g]}return!1},values:function(){for(var a=[],b=0,c=f.length;c>b;++b){var d=f[b];d!=e&&a.push(d)}return a}}}(1.4*q,rg,ng);for(e=0,f=i.length;f>e;++e)p[x=l[e]]&&y.add(i[x]);return y},tg=function(a){var b,c,d,e=sg(a),f=a.coordinates,g=a.lines,h=a.rings;for(c=0,d=g.length;d>c;++c)for(var i=g[c],j=i[0],k=i[1];++j<k;)e.has(f[j])&&(b={0:j,1:i[1]},i[1]=j,i=i.next=b);for(c=0,d=h.length;d>c;++c)for(var l=h[c],m=l[0],n=m,o=l[1],p=e.has(f[m]);++n<o;)e.has(f[n])&&(p?(b={0:n,1:l[1]},l[1]=n,l=l.next=b):(!function(a,b,c,d){Ta(a,b,c),Ta(a,b,b+d),Ta(a,b+d,c)}(f,m,o,o-n),f[o]=f[m],p=!0,n=m));return a},ug=function(a){function b(a){var b,c,d,e,f,g,h,i;if(d=n.get(b=j[a[0]]))for(h=0,i=d.length;i>h;++h)if(e=d[h],function(a,b){var c=a[0],d=b[0],e=a[1],f=b[1];if(c-e!=d-f)return!1;for(;e>=c;++c,++d)if(!ng(j[c],j[d]))return!1;return!0}(e,a))return a[0]=e[0],void(a[1]=e[1]);if(f=n.get(c=j[a[1]]))for(h=0,
i=f.length;i>h;++h)if(g=f[h],function(a,b){var c=a[0],d=b[0],e=a[1],f=b[1];if(c-e!=d-f)return!1;for(;e>=c;++c,--f)if(!ng(j[c],j[f]))return!1;return!0}(g,a))return a[1]=g[0],void(a[0]=g[1]);d?d.push(a):n.set(b,[a]),f?f.push(a):n.set(c,[a]),o.push(a)}function c(a,b){var c=a[0],d=b[0],f=a[1]-c;if(f!==b[1]-d)return!1;for(var g=e(a),h=e(b),i=0;f>i;++i)if(!ng(j[c+(i+g)%f],j[d+(i+h)%f]))return!1;return!0}function d(a,b){var c=a[0],d=b[0],f=a[1],g=b[1],h=f-c;if(h!==g-d)return!1;for(var i=e(a),k=h-e(b),l=0;h>l;++l)if(!ng(j[c+(l+i)%h],j[g-(l+k)%h]))return!1;return!0}function e(a){for(var b=a[0],c=a[1],d=b,e=d,f=j[d];++d<c;){var g=j[d];(g[0]<f[0]||g[0]===f[0]&&g[1]<f[1])&&(e=d,f=g)}return e-b}var f,g,h,i,j=a.coordinates,k=a.lines,l=a.rings,m=k.length+l.length;for(delete a.lines,delete a.rings,h=0,i=k.length;i>h;++h)for(f=k[h];f=f.next;)++m;for(h=0,i=l.length;i>h;++h)for(g=l[h];g=g.next;)++m;var n=mg(2*m*1.4,rg,ng),o=a.arcs=[];for(h=0,i=k.length;i>h;++h){f=k[h];do b(f);while(f=f.next)}for(h=0,i=l.length;i>h;++h)if((g=l[h]).next){do b(g);while(g=g.next)}else!function(a){var b,f,g,h,i;if(f=n.get(b=j[a[0]]))for(h=0,i=f.length;i>h;++h){if(g=f[h],c(g,a))return a[0]=g[0],void(a[1]=g[1]);if(d(g,a))return a[0]=g[1],void(a[1]=g[0])}if(f=n.get(b=j[a[0]+e(a)]))for(h=0,i=f.length;i>h;++h){if(g=f[h],c(g,a))return a[0]=g[0],void(a[1]=g[1]);if(d(g,a))return a[0]=g[1],void(a[1]=g[0])}f?f.push(a):n.set(b,[a]),o.push(a)}(g);return a},vg=function(a,b){function c(a){a&&k.hasOwnProperty(a.type)&&k[a.type](a)}function d(a){var b=[];do{var c=j.get(a);b.push(a[0]<a[1]?c:~c)}while(a=a.next);return b}function e(a){return a.map(d)}var f=function(a){function b(a){null!=a&&j.hasOwnProperty(a.type)&&j[a.type](a)}function c(a){var b=a[0],c=a[1];f>b&&(f=b),b>h&&(h=b),g>c&&(g=c),c>i&&(i=c)}function d(a){a.forEach(c)}function e(a){a.forEach(d)}var f=1/0,g=1/0,h=-1/0,i=-1/0,j={GeometryCollection:function(a){a.geometries.forEach(b)},Point:function(a){c(a.coordinates)},MultiPoint:function(a){a.coordinates.forEach(c)},LineString:function(a){d(a.arcs)},MultiLineString:function(a){a.arcs.forEach(d)},Polygon:function(a){a.arcs.forEach(d)},MultiPolygon:function(a){a.arcs.forEach(e)}};for(var k in a)b(a[k]);return h>=f&&i>=g?[f,g,h,i]:void 0}(a=function(a){var b,c={};for(b in a)c[b]=Ua(a[b]);return c}(a)),g=b>0&&f&&function(a,b,c){function d(a){return[Math.round((a[0]-j)*n),Math.round((a[1]-k)*o)]}function e(a,b){for(var c,d,e,f,g,h=-1,i=0,l=a.length,m=new Array(l);++h<l;)c=a[h],f=Math.round((c[0]-j)*n),g=Math.round((c[1]-k)*o),f===d&&g===e||(m[i++]=[d=f,e=g]);for(m.length=i;b>i;)i=m.push([m[0][0],m[0][1]]);return m}function f(a){return e(a,2)}function g(a){return e(a,4)}function h(a){return a.map(g)}function i(a){null!=a&&p.hasOwnProperty(a.type)&&p[a.type](a)}var j=b[0],k=b[1],l=b[2],m=b[3],n=l-j?(c-1)/(l-j):1,o=m-k?(c-1)/(m-k):1,p={GeometryCollection:function(a){a.geometries.forEach(i)},Point:function(a){a.coordinates=d(a.coordinates)},MultiPoint:function(a){a.coordinates=a.coordinates.map(d)},LineString:function(a){a.arcs=f(a.arcs)},MultiLineString:function(a){a.arcs=a.arcs.map(f)},Polygon:function(a){a.arcs=h(a.arcs)},MultiPolygon:function(a){a.arcs=a.arcs.map(h)}};for(var q in a)i(a[q]);return{scale:[1/n,1/o],translate:[j,k]}}(a,f,b),h=ug(tg(function(a){function b(a){a&&j.hasOwnProperty(a.type)&&j[a.type](a)}function c(a){for(var b=0,c=a.length;c>b;++b)i[++f]=a[b];var d={0:f-c+1,1:f};return g.push(d),d}function d(a){for(var b=0,c=a.length;c>b;++b)i[++f]=a[b];var d={0:f-c+1,1:f};return h.push(d),d}function e(a){return a.map(d)}var f=-1,g=[],h=[],i=[],j={GeometryCollection:function(a){a.geometries.forEach(b)},LineString:function(a){a.arcs=c(a.arcs)},MultiLineString:function(a){a.arcs=a.arcs.map(c)},Polygon:function(a){a.arcs=a.arcs.map(d)},MultiPolygon:function(a){a.arcs=a.arcs.map(e)}};for(var k in a)b(a[k]);return{type:"Topology",coordinates:i,lines:g,rings:h,objects:a}}(a))),i=h.coordinates,j=mg(1.4*h.arcs.length,Xa,Ya);a=h.objects,h.bbox=f,h.arcs=h.arcs.map(function(a,b){return j.set(a,b),i.slice(a[0],a[1]+1)}),delete h.coordinates,i=null;var k={GeometryCollection:function(a){a.geometries.forEach(c)},LineString:function(a){a.arcs=d(a.arcs)},MultiLineString:function(a){a.arcs=a.arcs.map(d)},Polygon:function(a){a.arcs=a.arcs.map(d)},MultiPolygon:function(a){a.arcs=a.arcs.map(e)}};for(var l in a)c(a[l]);return g&&(h.transform=g,h.arcs=function(a){for(var b=-1,c=a.length;++b<c;){for(var d,e,f=a[b],g=0,h=1,i=f.length,j=f[0],k=j[0],l=j[1];++g<i;)d=(j=f[g])[0],e=j[1],d===k&&e===l||(f[h++]=[d-k,e-l],k=d,l=e);1===h&&(f[h++]=[0,0]),f.length=h}return a}(h.arcs)),h},wg=function(a){this.points=a.points||[],this.duration=a.duration||1e4,this.sharpness=a.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=a.stepLength||60,this.length=this.points.length,this.delay=0;for(var b=0;b<this.length;b++)this.points[b].z=this.points[b].z||0;for(b=0;b<this.length-1;b++){var c=this.points[b],d=this.points[b+1];this.centers.push({x:(c.x+d.x)/2,y:(c.y+d.y)/2,z:(c.z+d.z)/2})}for(this.controls.push([this.points[0],this.points[0]]),b=0;b<this.centers.length-1;b++){c=this.centers[b],d=this.centers[b+1];var e=this.points[b+1].x-(this.centers[b].x+this.centers[b+1].x)/2,f=this.points[b+1].y-(this.centers[b].y+this.centers[b+1].y)/2,g=this.points[b+1].z-(this.centers[b].y+this.centers[b+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[b+1].x+this.sharpness*(this.centers[b].x+e),y:(1-this.sharpness)*this.points[b+1].y+this.sharpness*(this.centers[b].y+f),z:(1-this.sharpness)*this.points[b+1].z+this.sharpness*(this.centers[b].z+g)},{x:(1-this.sharpness)*this.points[b+1].x+this.sharpness*(this.centers[b+1].x+e),y:(1-this.sharpness)*this.points[b+1].y+this.sharpness*(this.centers[b+1].y+f),z:(1-this.sharpness)*this.points[b+1].z+this.sharpness*(this.centers[b+1].z+g)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this};wg.prototype.cacheSteps=function(a){var b=[],c=this.pos(0);b.push(0);for(var d=0;d<this.duration;d+=10){var e=this.pos(d);Math.sqrt((e.x-c.x)*(e.x-c.x)+(e.y-c.y)*(e.y-c.y)+(e.z-c.z)*(e.z-c.z))>a&&(b.push(d),c=e)}return b},wg.prototype.vector=function(a){var b=this.pos(a+10),c=this.pos(a-10);return{angle:180*Math.atan2(b.y-c.y,b.x-c.x)/3.14,speed:Math.sqrt((c.x-b.x)*(c.x-b.x)+(c.y-b.y)*(c.y-b.y)+(c.z-b.z)*(c.z-b.z))}},wg.prototype.pos=function(a){var b=a-this.delay;0>b&&(b=0),b>this.duration&&(b=this.duration-1);var c=b/this.duration;if(c>=1)return this.points[this.length-1];var d=Math.floor((this.points.length-1)*c);return function(a,b,c,d,e){var f=function(a){var b=a*a;return[b*a,3*b*(1-a),3*a*(1-a)*(1-a),(1-a)*(1-a)*(1-a)]}(a);return{x:e.x*f[0]+d.x*f[1]+c.x*f[2]+b.x*f[3],y:e.y*f[0]+d.y*f[1]+c.y*f[2]+b.y*f[3],z:e.z*f[0]+d.z*f[1]+c.z*f[2]+b.z*f[3]}}((this.length-1)*c-d,this.points[d],this.controls[d][1],this.controls[d+1][0],this.points[d+1])};var xg=tb,yg=tb;tb.deviation=function(a,b,c,d){var e=b&&b.length,f=e?b[0]*c:a.length,g=Math.abs(Ib(a,0,f,c));if(e)for(var h=0,i=b.length;i>h;h++){var j=b[h]*c,k=i-1>h?b[h+1]*c:a.length;g-=Math.abs(Ib(a,j,k,c))}var l=0;for(h=0;h<d.length;h+=3){var m=d[h]*c,n=d[h+1]*c,o=d[h+2]*c;l+=Math.abs((a[m]-a[o])*(a[n+1]-a[m+1])-(a[m]-a[n])*(a[o+1]-a[m+1]))}return 0===g&&0===l?0:Math.abs((l-g)/g)},tb.flatten=function(a){for(var b=a[0][0].length,c={vertices:[],holes:[],dimensions:b},d=0,e=0;e<a.length;e++){for(var f=0;f<a[e].length;f++)for(var g=0;b>g;g++)c.vertices.push(a[e][f][g]);e>0&&(d+=a[e-1].length,c.holes.push(d))}return c},xg["default"]=yg,Ob.prototype={all:function(){return this._all(this.data,[])},search:function(a){var b=this.data,c=[],d=this.toBBox;if(!Xb(a,b))return c;for(var e,f,g,h,i=[];b;){for(e=0,f=b.children.length;f>e;e++)g=b.children[e],Xb(a,h=b.leaf?d(g):g)&&(b.leaf?c.push(g):Wb(a,h)?this._all(g,c):i.push(g));b=i.pop()}return c},collides:function(a){var b=this.data,c=this.toBBox;if(!Xb(a,b))return!1;for(var d,e,f,g,h=[];b;){for(d=0,e=b.children.length;e>d;d++)if(f=b.children[d],g=b.leaf?c(f):f,Xb(a,g)){if(b.leaf||Wb(a,g))return!0;h.push(f)}b=h.pop()}return!1},load:function(a){if(!a||!a.length)return this;if(a.length<this._minEntries){for(var b=0,c=a.length;c>b;b++)this.insert(a[b]);return this}var d=this._build(a.slice(),0,a.length-1,0);if(this.data.children.length)if(this.data.height===d.height)this._splitRoot(this.data,d);else{if(this.data.height<d.height){var e=this.data;this.data=d,d=e}this._insert(d,this.data.height-d.height-1,!0)}else this.data=d;return this},insert:function(a){return a&&this._insert(a,this.data.height-1),this},clear:function(){return this.data=Yb([]),this},remove:function(a,b){if(!a)return this;for(var c,d,e,f,g=this.data,h=this.toBBox(a),i=[],j=[];g||i.length;){if(g||(g=i.pop(),d=i[i.length-1],c=j.pop(),f=!0),g.leaf&&-1!==(e=function(a,b,c){if(!c)return b.indexOf(a);for(var d=0;d<b.length;d++)if(c(a,b[d]))return d;return-1}(a,g.children,b)))return g.children.splice(e,1),i.push(g),this._condense(i),this;f||g.leaf||!Wb(g,h)?d?(c++,g=d.children[c],f=!1):g=null:(i.push(g),j.push(c),c=0,d=g,g=g.children[0])}return this},toBBox:function(a){return a},compareMinX:Sb,compareMinY:Tb,toJSON:function(){return this.data},fromJSON:function(a){return this.data=a,this},_all:function(a,b){for(var c=[];a;)a.leaf?b.push.apply(b,a.children):c.push.apply(c,a.children),a=c.pop();return b},_build:function(a,b,c,d){var e,f=c-b+1,g=this._maxEntries;if(g>=f)return e=Yb(a.slice(b,c+1)),Pb(e,this.toBBox),e;d||(d=Math.ceil(Math.log(f)/Math.log(g)),g=Math.ceil(f/Math.pow(g,d-1))),(e=Yb([])).leaf=!1,e.height=d;var h,i,j,k,l=Math.ceil(f/g),m=l*Math.ceil(Math.sqrt(g));for(Zb(a,b,c,m,this.compareMinX),h=b;c>=h;h+=m)for(Zb(a,h,j=Math.min(h+m-1,c),l,this.compareMinY),i=h;j>=i;i+=l)k=Math.min(i+l-1,j),e.children.push(this._build(a,i,k,d-1));return Pb(e,this.toBBox),e},_chooseSubtree:function(a,b,c,d){for(var e,f,g,h,i,j,k,l;d.push(b),!b.leaf&&d.length-1!==c;){for(k=l=1/0,e=0,f=b.children.length;f>e;e++)i=Ub(g=b.children[e]),(j=function(a,b){return(Math.max(b.maxX,a.maxX)-Math.min(b.minX,a.minX))*(Math.max(b.maxY,a.maxY)-Math.min(b.minY,a.minY))}(a,g)-i)<l?(l=j,k=k>i?i:k,h=g):j===l&&k>i&&(k=i,h=g);b=h||b.children[0]}return b},_insert:function(a,b,c){var d=this.toBBox,e=c?a:d(a),f=[],g=this._chooseSubtree(e,this.data,b,f);for(g.children.push(a),Rb(g,e);b>=0&&f[b].children.length>this._maxEntries;)this._split(f,b),b--;this._adjustParentBBoxes(e,f,b)},_split:function(a,b){var c=a[b],d=c.children.length,e=this._minEntries;this._chooseSplitAxis(c,e,d);var f=this._chooseSplitIndex(c,e,d),g=Yb(c.children.splice(f,c.children.length-f));g.height=c.height,g.leaf=c.leaf,Pb(c,this.toBBox),Pb(g,this.toBBox),b?a[b-1].children.push(g):this._splitRoot(c,g)},_splitRoot:function(a,b){this.data=Yb([a,b]),this.data.height=a.height+1,this.data.leaf=!1,Pb(this.data,this.toBBox)},_chooseSplitIndex:function(a,b,c){var d,e,f,g,h,i,j,k;for(i=j=1/0,d=b;c-b>=d;d++)g=function(a,b){var c=Math.max(a.minX,b.minX),d=Math.max(a.minY,b.minY),e=Math.min(a.maxX,b.maxX),f=Math.min(a.maxY,b.maxY);return Math.max(0,e-c)*Math.max(0,f-d)}(e=Qb(a,0,d,this.toBBox),f=Qb(a,d,c,this.toBBox)),h=Ub(e)+Ub(f),i>g?(i=g,k=d,j=j>h?h:j):g===i&&j>h&&(j=h,k=d);return k},_chooseSplitAxis:function(a,b,c){var d=a.leaf?this.compareMinX:Sb,e=a.leaf?this.compareMinY:Tb;this._allDistMargin(a,b,c,d)<this._allDistMargin(a,b,c,e)&&a.children.sort(d)},_allDistMargin:function(a,b,c,d){a.children.sort(d);var e,f,g=this.toBBox,h=Qb(a,0,b,g),i=Qb(a,c-b,c,g),j=Vb(h)+Vb(i);for(e=b;c-b>e;e++)f=a.children[e],Rb(h,a.leaf?g(f):f),j+=Vb(h);for(e=c-b-1;e>=b;e--)f=a.children[e],Rb(i,a.leaf?g(f):f),j+=Vb(i);return j},_adjustParentBBoxes:function(a,b,c){for(var d=c;d>=0;d--)Rb(b[d],a)},_condense:function(a){for(var b,c=a.length-1;c>=0;c--)0===a[c].children.length?c>0?(b=a[c-1].children).splice(b.indexOf(a[c]),1):this.clear():Pb(a[c],this.toBBox)},_initFormat:function(a){var b=["return a"," - b",";"];this.compareMinX=new Function("a","b",b.join(a[0])),this.compareMinY=new Function("a","b",b.join(a[1])),this.toBBox=new Function("a","return {minX: a"+a[0]+", minY: a"+a[1]+", maxX: a"+a[2]+", maxY: a"+a[3]+"};")}};var zg=Object.freeze({toMercator:ic,toWgs84:jc}),Ag=6378137,Bg=function(a,b,c){function d(a,c,d,e){var i=f[a][c],j=f[a][c+1],k=f[d][e],l=f[d][e+1],m=function(a,b,c,d){if(Ec(a,c)||Ec(a,d)||Ec(b,c)||Ec(d,c))return null;var e=a[0],f=a[1],g=b[0],h=b[1],i=c[0],j=c[1],k=d[0],l=d[1],m=(e-g)*(j-l)-(f-h)*(i-k);return 0===m?null:[((e*h-f*g)*(i-k)-(e-g)*(i*l-j*k))/m,((e*h-f*g)*(j-l)-(f-h)*(i*l-j*k))/m]}(i,j,k,l);if(null!==m){var n,o;if(n=j[0]!==i[0]?(m[0]-i[0])/(j[0]-i[0]):(m[1]-i[1])/(j[1]-i[1]),o=l[0]!==k[0]?(m[0]-k[0])/(l[0]-k[0]):(m[1]-k[1])/(l[1]-k[1]),!(n>=1||0>=n||o>=1||0>=o)){var p=m,q=!h[p];q&&(h[p]=!0),b?g.push(b(m,a,c,i,j,n,d,e,k,l,o,q)):g.push(m)}}}function e(a,b){var c,d,e,g,h=f[a][b],i=f[a][b+1];return h[0]<i[0]?(c=h[0],d=i[0]):(c=i[0],d=h[0]),h[1]<i[1]?(e=h[1],g=i[1]):(e=i[1],g=h[1]),{minX:c,minY:e,maxX:d,maxY:g,ring:a,edge:b}}if("Polygon"!==a.geometry.type)throw new Error("The input feature must be a Polygon");void 0===c&&(c=1);var f=a.geometry.coordinates,g=[],h={};if(c){for(var i=[],j=0;j<f.length;j++)for(var k=0;k<f[j].length-1;k++)i.push(e(j,k));var l=Tf();l.load(i)}for(var m=0;m<f.length;m++)for(var n=0;n<f[m].length-1;n++)if(c)l.search(e(m,n)).forEach(function(a){var b=a.ring,c=a.edge;d(m,n,b,c)});else for(var o=0;o<f.length;o++)for(var p=0;p<f[o].length-1;p++)d(m,n,o,p);return b||(g={type:"Feature",geometry:{type:"MultiPoint",coordinates:g}}),g},Cg=function(a){function b(){for(var a=[],b=0;b<o.features.length;b++)-1==o.features[b].properties.parent&&a.push(b);if(a.length>1)for(b=0;b<a.length;b++){for(var c=-1,d=0;d<o.features.length;d++)a[b]!=d&&Ea(o.features[a[b]].geometry.coordinates[0][0],o.features[d],{ignoreBoundary:!0})&&rc(o.features[d])<1/0&&(c=d);o.features[a[b]].properties.parent=c}}function c(){for(var a=0;a<o.features.length;a++)if(-1==o.features[a].properties.parent){var b=o.features[a].properties.winding;o.features[a].properties.netWinding=b,d(a,b)}}function d(a,b){for(var c=0;c<o.features.length;c++)if(o.features[c].properties.parent==a){var e=b+o.features[c].properties.winding;o.features[c].properties.netWinding=e,d(c,e)}}if("Feature"!=a.type)throw new Error("The input must a geojson object of type Feature");if(void 0===a.geometry||null==a.geometry)throw new Error("The input must a geojson object with a non-empty geometry");if("Polygon"!=a.geometry.type)throw new Error("The input must be a geojson Polygon");for(var e=a.geometry.coordinates.length,g=[],h=0;e>h;h++){var i=a.geometry.coordinates[h];Gc(i[0],i[i.length-1])||i.push(i[0]),g.push.apply(g,i.slice(0,i.length-1))}if(!function(a){for(var b={},c=1,d=0,e=a.length;e>d;++d){if(b.hasOwnProperty(a[d])){c=0;break}b[a[d]]=1}return c}(g))throw new Error("The input polygon may not have duplicate vertices (except for the first and last vertex of each ring)");var k=g.length,l=Bg(a,function(a,b,c,d,e,f,g,h,i,j,k,l){return[a,b,c,d,e,f,g,h,i,j,k,l]}),m=l.length;if(0==m){var n=[];for(h=0;e>h;h++)n.push(f([a.geometry.coordinates[h]],{parent:-1,winding:function(a){for(var b=0,c=0;c<a.length-1;c++)a[c][0]<a[b][0]&&(b=c);if(Fc([a[(b-1).modulo(a.length-1)],a[b],a[(b+1).modulo(a.length-1)]],!0))var d=1;else d=-1;return d}(a.geometry.coordinates[h])}));var o=j(n);return b(),c(),o}var p=[],q=[];for(h=0;e>h;h++){p.push([]);for(var r=0;r<a.geometry.coordinates[h].length-1;r++)p[h].push([new Dg(a.geometry.coordinates[h][(r+1).modulo(a.geometry.coordinates[h].length-1)],1,[h,r],[h,(r+1).modulo(a.geometry.coordinates[h].length-1)],void 0)]),q.push(new Eg(a.geometry.coordinates[h][r],[h,(r-1).modulo(a.geometry.coordinates[h].length-1)],[h,r],void 0,void 0,!1,!0))}for(h=0;m>h;h++)p[l[h][1]][l[h][2]].push(new Dg(l[h][0],l[h][5],[l[h][1],l[h][2]],[l[h][6],l[h][7]],void 0)),l[h][11]&&q.push(new Eg(l[h][0],[l[h][1],l[h][2]],[l[h][6],l[h][7]],void 0,void 0,!0,!0));var s=q.length;for(h=0;h<p.length;h++)for(r=0;r<p[h].length;r++)p[h][r].sort(function(a,b){return a.param<b.param?-1:1});var t=[];for(h=0;s>h;h++)t.push({minX:q[h].coord[0],minY:q[h].coord[1],maxX:q[h].coord[0],maxY:q[h].coord[1],index:h});var u=Tf();for(u.load(t),h=0;h<p.length;h++)for(r=0;r<p[h].length;r++)for(var v=0;v<p[h][r].length;v++){x=v==p[h][r].length-1?p[h][(r+1).modulo(a.geometry.coordinates[h].length-1)][0].coord:p[h][r][v+1].coord;var w=u.search({minX:x[0],minY:x[1],maxX:x[0],maxY:x[1]})[0];p[h][r][v].nxtIsectAlongEdgeIn=w.index}for(h=0;h<p.length;h++)for(r=0;r<p[h].length;r++)for(v=0;v<p[h][r].length;v++){var x=p[h][r][v].coord,y=(w=u.search({minX:x[0],minY:x[1],maxX:x[0],maxY:x[1]})[0]).index;k>y?q[y].nxtIsectAlongRingAndEdge2=p[h][r][v].nxtIsectAlongEdgeIn:Gc(q[y].ringAndEdge1,p[h][r][v].ringAndEdgeIn)?q[y].nxtIsectAlongRingAndEdge1=p[h][r][v].nxtIsectAlongEdgeIn:q[y].nxtIsectAlongRingAndEdge2=p[h][r][v].nxtIsectAlongEdgeIn}var z=[];for(h=0,r=0;e>r;r++){var A=h;for(v=0;v<a.geometry.coordinates[r].length-1;v++)q[h].coord[0]<q[A].coord[0]&&(A=h),h++;var B=q[A].nxtIsectAlongRingAndEdge2;for(v=0;v<q.length;v++)if(q[v].nxtIsectAlongRingAndEdge1==A||q[v].nxtIsectAlongRingAndEdge2==A){var C=v;break}var D=Fc([q[C].coord,q[A].coord,q[B].coord],!0)?1:-1;z.push({isect:A,parent:-1,winding:D})}for(z.sort(function(a,b){return q[a.isect].coord>q[b.isect].coord?-1:1}),n=[];z.length>0;){var E=z.pop(),F=E.isect,G=E.parent,H=E.winding,I=n.length,J=[q[F].coord],K=F;if(q[F].ringAndEdge1Walkable)var L=q[F].ringAndEdge1,M=q[F].nxtIsectAlongRingAndEdge1;else L=q[F].ringAndEdge2,M=q[F].nxtIsectAlongRingAndEdge2;for(;!Gc(q[F].coord,q[M].coord);){J.push(q[M].coord);var N=void 0;for(h=0;h<z.length;h++)if(z[h].isect==M){N=h;break}if(void 0!=N&&z.splice(N,1),Gc(L,q[M].ringAndEdge1)){if(L=q[M].ringAndEdge2,q[M].ringAndEdge2Walkable=!1,q[M].ringAndEdge1Walkable){var O={isect:M};Fc([q[K].coord,q[M].coord,q[q[M].nxtIsectAlongRingAndEdge2].coord],1==H)?(O.parent=G,O.winding=-H):(O.parent=I,O.winding=H),z.push(O)}K=M,M=q[M].nxtIsectAlongRingAndEdge2}else L=q[M].ringAndEdge1,q[M].ringAndEdge1Walkable=!1,q[M].ringAndEdge2Walkable&&(O={isect:M},Fc([q[K].coord,q[M].coord,q[q[M].nxtIsectAlongRingAndEdge1].coord],1==H)?(O.parent=G,O.winding=-H):(O.parent=I,O.winding=H),z.push(O)),K=M,M=q[M].nxtIsectAlongRingAndEdge1}J.push(q[M].coord),n.push(f([J],{index:I,parent:G,winding:H,netWinding:void 0}))}return o=j(n),b(),c(),o},Dg=function(a,b,c,d,e){this.coord=a,this.param=b,this.ringAndEdgeIn=c,this.ringAndEdgeOut=d,this.nxtIsectAlongEdgeIn=e},Eg=function(a,b,c,d,e,f,g){this.coord=a,this.ringAndEdge1=b,this.ringAndEdge2=c,this.nxtIsectAlongRingAndEdge1=d,this.nxtIsectAlongRingAndEdge2=e,this.ringAndEdge1Walkable=f,this.ringAndEdge2Walkable=g};Number.prototype.modulo=function(a){return(this%a+a)%a};var Fg=Math.PI/180,Gg=180/Math.PI,Hg=function(a,b){this.lon=a,this.lat=b,this.x=Fg*a,this.y=Fg*b};Hg.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)},Hg.prototype.antipode=function(){var a=-1*this.lat,b=this.lon<0?180+this.lon:-1*(180-this.lon);return new Hg(b,a)};var Ig=function(){this.coords=[],this.length=0};Ig.prototype.move_to=function(a){this.length++,this.coords.push(a)};var Jg=function(a){this.properties=a||{},this.geometries=[]};Jg.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(1===this.geometries.length)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var a=[],b=0;b<this.geometries.length;b++)a.push(this.geometries[b].coords);return{geometry:{type:"MultiLineString",coordinates:a},type:"Feature",properties:this.properties}},Jg.prototype.wkt=function(){for(var a="",b="LINESTRING(",c=function(a){b+=a[0]+" "+a[1]+","},d=0;d<this.geometries.length;d++){if(0===this.geometries[d].coords.length)return"LINESTRING(empty)";this.geometries[d].coords.forEach(c),a+=b.substring(0,b.length-1)+")"}return a};var Kg=function(a,b,c){if(!a||void 0===a.x||void 0===a.y)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!b||void 0===b.x||void 0===b.y)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new Hg(a.x,a.y),this.end=new Hg(b.x,b.y),this.properties=c||{};var d=this.start.x-this.end.x,e=this.start.y-this.end.y,f=Math.pow(Math.sin(e/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(d/2),2);if(this.g=2*Math.asin(Math.sqrt(f)),this.g===Math.PI)throw new Error("it appears "+a.view()+" and "+b.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+a+" and "+b)};Kg.prototype.interpolate=function(a){var b=Math.sin((1-a)*this.g)/Math.sin(this.g),c=Math.sin(a*this.g)/Math.sin(this.g),d=b*Math.cos(this.start.y)*Math.cos(this.start.x)+c*Math.cos(this.end.y)*Math.cos(this.end.x),e=b*Math.cos(this.start.y)*Math.sin(this.start.x)+c*Math.cos(this.end.y)*Math.sin(this.end.x),f=b*Math.sin(this.start.y)+c*Math.sin(this.end.y),g=Gg*Math.atan2(f,Math.sqrt(Math.pow(d,2)+Math.pow(e,2)));return[Gg*Math.atan2(e,d),g]},Kg.prototype.Arc=function(a,b){var c=[];if(!a||2>=a)c.push([this.start.lon,this.start.lat]),c.push([this.end.lon,this.end.lat]);else for(var d=1/(a-1),e=0;a>e;++e){var f=d*e,g=this.interpolate(f);c.push(g)}for(var h=!1,i=0,j=b&&b.offset?b.offset:10,k=180-j,l=-180+j,m=360-j,n=1;n<c.length;++n){var o=c[n-1][0],p=c[n][0],q=Math.abs(p-o);q>m&&(p>k&&l>o||o>k&&l>p)?h=!0:q>i&&(i=q)}var r=[];if(h&&j>i){var s=[];r.push(s);for(var t=0;t<c.length;++t){var u=parseFloat(c[t][0]);if(t>0&&Math.abs(u-c[t-1][0])>m){var v=parseFloat(c[t-1][0]),w=parseFloat(c[t-1][1]),x=parseFloat(c[t][0]),y=parseFloat(c[t][1]);if(v>-180&&l>v&&180===x&&t+1<c.length&&c[t-1][0]>-180&&c[t-1][0]<l){s.push([-180,c[t][1]]),t++,s.push([c[t][0],c[t][1]]);continue}if(v>k&&180>v&&-180===x&&t+1<c.length&&c[t-1][0]>k&&c[t-1][0]<180){s.push([180,c[t][1]]),t++,s.push([c[t][0],c[t][1]]);continue}if(l>v&&x>k){var z=v;v=x,x=z;var A=w;w=y,y=A}if(v>k&&l>x&&(x+=360),180>=v&&x>=180&&x>v){var B=(180-v)/(x-v),C=B*y+(1-B)*w;s.push([c[t-1][0]>k?180:-180,C]),(s=[]).push([c[t-1][0]>k?-180:180,C]),r.push(s)}else s=[],r.push(s);s.push([u,c[t][1]])}else s.push([c[t][0],c[t][1]])}}else{var D=[];r.push(D);for(var E=0;E<c.length;++E)D.push([c[E][0],c[E][1]])}for(var F=new Jg(this.properties),G=0;G<r.length;++G){var H=new Ig;F.geometries.push(H);for(var I=r[G],J=0;J<I.length;++J)H.move_to(I[J])}return F};var Lg=Sc;Sc.polyline=Sc,Sc.polygon=function(a,b){var c,d,e,f,g,h,i;for(d=1;8>=d;d*=2){for(c=[],f=!(Uc(e=a[a.length-1],b)&d),g=0;g<a.length;g++)(i=!(Uc(h=a[g],b)&d))!==f&&c.push(Tc(e,h,d,b)),i&&c.push(h),e=h,f=i;if(!(a=c).length)break}return c};var Mg=Array.prototype.slice,Ng={successCallback:null,verbose:!1,polygons:!1},Og={},Pg=64,Qg=16,Rg=4,Sg=1,Tg=[],Ug=[],Vg=[],Wg=[],Xg=[],Yg=[],Zg=[],$g=[],_g=[],ah=[],bh=[],ch=[],dh=[],eh=[],fh=[],gh=[],hh=[],ih=[],jh=[],kh=[],lh=[],mh=[],nh=[],oh=[];Zg[85]=ah[85]=-1,$g[85]=bh[85]=0,_g[85]=ch[85]=1,jh[85]=mh[85]=1,kh[85]=nh[85]=0,lh[85]=oh[85]=1,Tg[85]=Wg[85]=0,Ug[85]=Xg[85]=-1,Vg[85]=fh[85]=0,gh[85]=dh[85]=0,hh[85]=eh[85]=1,Yg[85]=ih[85]=1,mh[1]=mh[169]=0,nh[1]=nh[169]=-1,oh[1]=oh[169]=0,dh[1]=dh[169]=-1,eh[1]=eh[169]=0,fh[1]=fh[169]=0,ah[4]=ah[166]=0,bh[4]=bh[166]=-1,ch[4]=ch[166]=1,gh[4]=gh[166]=1,hh[4]=hh[166]=0,ih[4]=ih[166]=0,Zg[16]=Zg[154]=0,$g[16]=$g[154]=1,_g[16]=_g[154]=1,Wg[16]=Wg[154]=1,Xg[16]=Xg[154]=0,Yg[16]=Yg[154]=1,jh[64]=jh[106]=0,kh[64]=kh[106]=1,lh[64]=lh[106]=0,Tg[64]=Tg[106]=-1,Ug[64]=Ug[106]=0,Vg[64]=Vg[106]=1,jh[2]=jh[168]=0,kh[2]=kh[168]=-1,lh[2]=lh[168]=1,mh[2]=mh[168]=0,nh[2]=nh[168]=-1,oh[2]=oh[168]=0,dh[2]=dh[168]=-1,eh[2]=eh[168]=0,fh[2]=fh[168]=0,gh[2]=gh[168]=-1,hh[2]=hh[168]=0,ih[2]=ih[168]=1,Zg[8]=Zg[162]=0,$g[8]=$g[162]=-1,_g[8]=_g[162]=0,ah[8]=ah[162]=0,bh[8]=bh[162]=-1,ch[8]=ch[162]=1,dh[8]=dh[162]=1,eh[8]=eh[162]=0,fh[8]=fh[162]=1,gh[8]=gh[162]=1,hh[8]=hh[162]=0,ih[8]=ih[162]=0,Zg[32]=Zg[138]=0,$g[32]=$g[138]=1,_g[32]=_g[138]=1,ah[32]=ah[138]=0,bh[32]=bh[138]=1,ch[32]=ch[138]=0,Tg[32]=Tg[138]=1,Ug[32]=Ug[138]=0,Vg[32]=Vg[138]=0,Wg[32]=Wg[138]=1,Xg[32]=Xg[138]=0,Yg[32]=Yg[138]=1,mh[128]=mh[42]=0,nh[128]=nh[42]=1,oh[128]=oh[42]=1,jh[128]=jh[42]=0,kh[128]=kh[42]=1,lh[128]=lh[42]=0,Tg[128]=Tg[42]=-1,Ug[128]=Ug[42]=0,Vg[128]=Vg[42]=1,Wg[128]=Wg[42]=-1,Xg[128]=Xg[42]=0,Yg[128]=Yg[42]=0,ah[5]=ah[165]=-1,bh[5]=bh[165]=0,ch[5]=ch[165]=0,mh[5]=mh[165]=1,nh[5]=nh[165]=0,oh[5]=oh[165]=0,gh[20]=gh[150]=0,hh[20]=hh[150]=1,ih[20]=ih[150]=1,Wg[20]=Wg[150]=0,Xg[20]=Xg[150]=-1,Yg[20]=Yg[150]=1,Zg[80]=Zg[90]=-1,$g[80]=$g[90]=0,_g[80]=_g[90]=1,jh[80]=jh[90]=1,kh[80]=kh[90]=0,lh[80]=lh[90]=1,dh[65]=dh[105]=0,eh[65]=eh[105]=1,fh[65]=fh[105]=0,Tg[65]=Tg[105]=0,Ug[65]=Ug[105]=-1,Vg[65]=Vg[105]=0,Zg[160]=Zg[10]=-1,$g[160]=$g[10]=0,_g[160]=_g[10]=1,ah[160]=ah[10]=-1,bh[160]=bh[10]=0,ch[160]=ch[10]=0,mh[160]=mh[10]=1,nh[160]=nh[10]=0,oh[160]=oh[10]=0,jh[160]=jh[10]=1,kh[160]=kh[10]=0,lh[160]=lh[10]=1,gh[130]=gh[40]=0,hh[130]=hh[40]=1,ih[130]=ih[40]=1,dh[130]=dh[40]=0,eh[130]=eh[40]=1,fh[130]=fh[40]=0,Tg[130]=Tg[40]=0,Ug[130]=Ug[40]=-1,Vg[130]=Vg[40]=0,Wg[130]=Wg[40]=0,Xg[130]=Xg[40]=-1,Yg[130]=Yg[40]=1,ah[37]=ah[133]=0,bh[37]=bh[133]=1,ch[37]=ch[133]=1,mh[37]=mh[133]=0,nh[37]=nh[133]=1,oh[37]=oh[133]=0,Tg[37]=Tg[133]=-1,Ug[37]=Ug[133]=0,Vg[37]=Vg[133]=0,Wg[37]=Wg[133]=1,Xg[37]=Xg[133]=0,Yg[37]=Yg[133]=0,gh[148]=gh[22]=-1,hh[148]=hh[22]=0,ih[148]=ih[22]=0,mh[148]=mh[22]=0,nh[148]=nh[22]=-1,oh[148]=oh[22]=1,jh[148]=jh[22]=0,kh[148]=kh[22]=1,lh[148]=lh[22]=1,Wg[148]=Wg[22]=-1,Xg[148]=Xg[22]=0,Yg[148]=Yg[22]=1,Zg[82]=Zg[88]=0,$g[82]=$g[88]=-1,_g[82]=_g[88]=1,gh[82]=gh[88]=1,hh[82]=hh[88]=0,ih[82]=ih[88]=1,dh[82]=dh[88]=-1,eh[82]=eh[88]=0,fh[82]=fh[88]=1,jh[82]=jh[88]=0,kh[82]=kh[88]=-1,lh[82]=lh[88]=0,Zg[73]=Zg[97]=0,$g[73]=$g[97]=1,_g[73]=_g[97]=0,ah[73]=ah[97]=0,bh[73]=bh[97]=-1,ch[73]=ch[97]=0,dh[73]=dh[97]=1,eh[73]=eh[97]=0,fh[73]=fh[97]=0,Tg[73]=Tg[97]=1,Ug[73]=Ug[97]=0,Vg[73]=Vg[97]=1,Zg[145]=Zg[25]=0,$g[145]=$g[25]=-1,_g[145]=_g[25]=0,dh[145]=dh[25]=1,eh[145]=eh[25]=0,fh[145]=fh[25]=1,mh[145]=mh[25]=0,nh[145]=nh[25]=1,oh[145]=oh[25]=1,Wg[145]=Wg[25]=-1,Xg[145]=Xg[25]=0,Yg[145]=Yg[25]=0,ah[70]=ah[100]=0,bh[70]=bh[100]=1,ch[70]=ch[100]=0,gh[70]=gh[100]=-1,hh[70]=hh[100]=0,ih[70]=ih[100]=1,jh[70]=jh[100]=0,kh[70]=kh[100]=-1,lh[70]=lh[100]=1,Tg[70]=Tg[100]=1,Ug[70]=Ug[100]=0,Vg[70]=Vg[100]=0,ah[101]=ah[69]=0,bh[101]=bh[69]=1,ch[101]=ch[69]=0,Tg[101]=Tg[69]=1,Ug[101]=Ug[69]=0,Vg[101]=Vg[69]=0,mh[149]=mh[21]=0,nh[149]=nh[21]=1,oh[149]=oh[21]=1,Wg[149]=Wg[21]=-1,Xg[149]=Xg[21]=0,Yg[149]=Yg[21]=0,gh[86]=gh[84]=-1,hh[86]=hh[84]=0,ih[86]=ih[84]=1,jh[86]=jh[84]=0,kh[86]=kh[84]=-1,lh[86]=lh[84]=1,Zg[89]=Zg[81]=0,$g[89]=$g[81]=-1,_g[89]=_g[81]=0,dh[89]=dh[81]=1,eh[89]=eh[81]=0,fh[89]=fh[81]=1,Zg[96]=Zg[74]=0,$g[96]=$g[74]=1,_g[96]=_g[74]=0,ah[96]=ah[74]=-1,bh[96]=bh[74]=0,ch[96]=ch[74]=1,jh[96]=jh[74]=1,kh[96]=kh[74]=0,lh[96]=lh[74]=0,Tg[96]=Tg[74]=1,Ug[96]=Ug[74]=0,Vg[96]=Vg[74]=1,Zg[24]=Zg[146]=0,$g[24]=$g[146]=-1,_g[24]=_g[146]=1,gh[24]=gh[146]=1,hh[24]=hh[146]=0,ih[24]=ih[146]=1,dh[24]=dh[146]=0,eh[24]=eh[146]=1,fh[24]=fh[146]=1,Wg[24]=Wg[146]=0,Xg[24]=Xg[146]=-1,Yg[24]=Yg[146]=0,ah[6]=ah[164]=-1,bh[6]=bh[164]=0,ch[6]=ch[164]=1,gh[6]=gh[164]=-1,hh[6]=hh[164]=0,ih[6]=ih[164]=0,mh[6]=mh[164]=0,nh[6]=nh[164]=-1,oh[6]=oh[164]=1,jh[6]=jh[164]=1,kh[6]=kh[164]=0,lh[6]=lh[164]=0,dh[129]=dh[41]=0,eh[129]=eh[41]=1,fh[129]=fh[41]=1,mh[129]=mh[41]=0,nh[129]=nh[41]=1,oh[129]=oh[41]=0,Tg[129]=Tg[41]=-1,Ug[129]=Ug[41]=0,Vg[129]=Vg[41]=0,Wg[129]=Wg[41]=0,Xg[129]=Xg[41]=-1,Yg[129]=Yg[41]=0,gh[66]=gh[104]=0,hh[66]=hh[104]=1,ih[66]=ih[104]=0,dh[66]=dh[104]=-1,eh[66]=eh[104]=0,fh[66]=fh[104]=1,jh[66]=jh[104]=0,kh[66]=kh[104]=-1,lh[66]=lh[104]=0,Tg[66]=Tg[104]=0,Ug[66]=Ug[104]=-1,Vg[66]=Vg[104]=1,Zg[144]=Zg[26]=-1,$g[144]=$g[26]=0,_g[144]=_g[26]=0,mh[144]=mh[26]=1,nh[144]=nh[26]=0,oh[144]=oh[26]=1,jh[144]=jh[26]=0,kh[144]=kh[26]=1,lh[144]=lh[26]=1,Wg[144]=Wg[26]=-1,Xg[144]=Xg[26]=0,Yg[144]=Yg[26]=1,ah[36]=ah[134]=0,bh[36]=bh[134]=1,ch[36]=ch[134]=1,gh[36]=gh[134]=0,hh[36]=hh[134]=1,ih[36]=ih[134]=0,Tg[36]=Tg[134]=0,Ug[36]=Ug[134]=-1,Vg[36]=Vg[134]=1,Wg[36]=Wg[134]=1,Xg[36]=Xg[134]=0,Yg[36]=Yg[134]=0,Zg[9]=Zg[161]=-1,$g[9]=$g[161]=0,_g[9]=_g[161]=0,ah[9]=ah[161]=0,bh[9]=bh[161]=-1,ch[9]=ch[161]=0,dh[9]=dh[161]=1,eh[9]=eh[161]=0,fh[9]=fh[161]=0,mh[9]=mh[161]=1,nh[9]=nh[161]=0,oh[9]=oh[161]=1,Zg[136]=0,$g[136]=1,_g[136]=1,ah[136]=0,bh[136]=1,ch[136]=0,gh[136]=-1,hh[136]=0,ih[136]=1,dh[136]=-1,eh[136]=0,fh[136]=0,mh[136]=0,nh[136]=-1,oh[136]=0,jh[136]=0,kh[136]=-1,lh[136]=1,Tg[136]=1,Ug[136]=0,Vg[136]=0,Wg[136]=1,Xg[136]=0,Yg[136]=1,Zg[34]=0,$g[34]=-1,_g[34]=0,ah[34]=0,bh[34]=-1,ch[34]=1,gh[34]=1,hh[34]=0,ih[34]=0,dh[34]=1,eh[34]=0,fh[34]=1,mh[34]=0,nh[34]=1,oh[34]=1,jh[34]=0,kh[34]=1,lh[34]=0,Tg[34]=-1,Ug[34]=0,Vg[34]=1,Wg[34]=-1,Xg[34]=0,Yg[34]=0,Zg[35]=0,$g[35]=1,_g[35]=1,ah[35]=0,bh[35]=-1,ch[35]=1,gh[35]=1,hh[35]=0,ih[35]=0,dh[35]=-1,eh[35]=0,fh[35]=0,mh[35]=0,nh[35]=-1,oh[35]=0,jh[35]=0,kh[35]=1,lh[35]=0,Tg[35]=-1,Ug[35]=0,Vg[35]=1,Wg[35]=1,Xg[35]=0,Yg[35]=1,Zg[153]=0,$g[153]=1,_g[153]=1,dh[153]=-1,eh[153]=0,fh[153]=0,mh[153]=0,nh[153]=-1,oh[153]=0,Wg[153]=1,Xg[153]=0,Yg[153]=1,ah[102]=0,bh[102]=-1,ch[102]=1,gh[102]=1,hh[102]=0,ih[102]=0,jh[102]=0,kh[102]=1,lh[102]=0,Tg[102]=-1,Ug[102]=0,Vg[102]=1,Zg[155]=0,$g[155]=-1,_g[155]=0,dh[155]=1,eh[155]=0,fh[155]=1,mh[155]=0,nh[155]=1,oh[155]=1,Wg[155]=-1,Xg[155]=0,Yg[155]=0,ah[103]=0,bh[103]=1,ch[103]=0,gh[103]=-1,hh[103]=0,ih[103]=1,jh[103]=0,kh[103]=-1,lh[103]=1,Tg[103]=1,Ug[103]=0,Vg[103]=0,Zg[152]=0,$g[152]=1,_g[152]=1,gh[152]=-1,hh[152]=0,ih[152]=1,dh[152]=-1,eh[152]=0,fh[152]=0,mh[152]=0,nh[152]=-1,oh[152]=0,jh[152]=0,kh[152]=-1,lh[152]=1,Wg[152]=1,Xg[152]=0,Yg[152]=1,Zg[156]=0,$g[156]=-1,_g[156]=1,gh[156]=1,hh[156]=0,ih[156]=1,dh[156]=-1,eh[156]=0,fh[156]=0,mh[156]=0,nh[156]=-1,oh[156]=0,jh[156]=0,kh[156]=1,lh[156]=1,Wg[156]=-1,Xg[156]=0,Yg[156]=1,Zg[137]=0,$g[137]=1,_g[137]=1,ah[137]=0,bh[137]=1,ch[137]=0,dh[137]=-1,eh[137]=0,fh[137]=0,mh[137]=0,nh[137]=-1,oh[137]=0,Tg[137]=1,Ug[137]=0,Vg[137]=0,Wg[137]=1,Xg[137]=0,Yg[137]=1,Zg[139]=0,$g[139]=1,_g[139]=1,ah[139]=0,bh[139]=-1,ch[139]=0,dh[139]=1,eh[139]=0,fh[139]=0,mh[139]=0,nh[139]=1,oh[139]=0,Tg[139]=-1,Ug[139]=0,Vg[139]=0,Wg[139]=1,Xg[139]=0,Yg[139]=1,Zg[98]=0,$g[98]=-1,_g[98]=0,ah[98]=0,bh[98]=-1,ch[98]=1,gh[98]=1,hh[98]=0,ih[98]=0,dh[98]=1,eh[98]=0,fh[98]=1,jh[98]=0,kh[98]=1,lh[98]=0,Tg[98]=-1,Ug[98]=0,Vg[98]=1,Zg[99]=0,$g[99]=1,_g[99]=0,ah[99]=0,bh[99]=-1,ch[99]=1,gh[99]=1,hh[99]=0,ih[99]=0,dh[99]=-1,eh[99]=0,fh[99]=1,jh[99]=0,kh[99]=-1,lh[99]=0,Tg[99]=1,Ug[99]=0,Vg[99]=1,ah[38]=0,bh[38]=-1,ch[38]=1,gh[38]=1,hh[38]=0,ih[38]=0,mh[38]=0,nh[38]=1,oh[38]=1,jh[38]=0,kh[38]=1,lh[38]=0,Tg[38]=-1,Ug[38]=0,Vg[38]=1,Wg[38]=-1,Xg[38]=0,Yg[38]=0,ah[39]=0,bh[39]=1,ch[39]=1,gh[39]=-1,hh[39]=0,ih[39]=0,mh[39]=0,nh[39]=-1,oh[39]=1,jh[39]=0,kh[39]=1,lh[39]=0,Tg[39]=-1,Ug[39]=0,Vg[39]=1,Wg[39]=1,Xg[39]=0,Yg[39]=0;var ph=function(a){return[[a.bottomleft,0],[0,0],[0,a.leftbottom]]},qh=function(a){return[[1,a.rightbottom],[1,0],[a.bottomright,0]]},rh=function(a){return[[a.topright,1],[1,1],[1,a.righttop]]},sh=function(a){return[[0,a.lefttop],[0,1],[a.topleft,1]]},th=function(a){return[[a.bottomright,0],[a.bottomleft,0],[0,a.leftbottom],[0,a.lefttop]]},uh=function(a){return[[a.bottomright,0],[a.bottomleft,0],[1,a.righttop],[1,a.rightbottom]]},vh=function(a){return[[1,a.righttop],[1,a.rightbottom],[a.topleft,1],[a.topright,1]]},wh=function(a){return[[0,a.leftbottom],[0,a.lefttop],[a.topleft,1],[a.topright,1]]},xh=[],yh=[],zh=[],Ah=[],Bh=[],Ch=[],Dh=[],Eh=[];Ah[1]=Bh[1]=18,Ah[169]=Bh[169]=18,zh[4]=yh[4]=12,zh[166]=yh[166]=12,xh[16]=Eh[16]=4,xh[154]=Eh[154]=4,Ch[64]=Dh[64]=22,Ch[106]=Dh[106]=22,zh[2]=Ch[2]=17,Ah[2]=Bh[2]=18,zh[168]=Ch[168]=17,Ah[168]=Bh[168]=18,xh[8]=Ah[8]=9,yh[8]=zh[8]=12,xh[162]=Ah[162]=9,
yh[162]=zh[162]=12,xh[32]=Eh[32]=4,yh[32]=Dh[32]=1,xh[138]=Eh[138]=4,yh[138]=Dh[138]=1,Bh[128]=Eh[128]=21,Ch[128]=Dh[128]=22,Bh[42]=Eh[42]=21,Ch[42]=Dh[42]=22,yh[5]=Bh[5]=14,yh[165]=Bh[165]=14,zh[20]=Eh[20]=6,zh[150]=Eh[150]=6,xh[80]=Ch[80]=11,xh[90]=Ch[90]=11,Ah[65]=Dh[65]=3,Ah[105]=Dh[105]=3,xh[160]=Ch[160]=11,yh[160]=Bh[160]=14,xh[10]=Ch[10]=11,yh[10]=Bh[10]=14,zh[130]=Eh[130]=6,Ah[130]=Dh[130]=3,zh[40]=Eh[40]=6,Ah[40]=Dh[40]=3,yh[101]=Dh[101]=1,yh[69]=Dh[69]=1,Bh[149]=Eh[149]=21,Bh[21]=Eh[21]=21,zh[86]=Ch[86]=17,zh[84]=Ch[84]=17,xh[89]=Ah[89]=9,xh[81]=Ah[81]=9,xh[96]=Dh[96]=0,yh[96]=Ch[96]=15,xh[74]=Dh[74]=0,yh[74]=Ch[74]=15,xh[24]=zh[24]=8,Ah[24]=Eh[24]=7,xh[146]=zh[146]=8,Ah[146]=Eh[146]=7,yh[6]=Ch[6]=15,zh[6]=Bh[6]=16,yh[164]=Ch[164]=15,zh[164]=Bh[164]=16,Ah[129]=Eh[129]=7,Bh[129]=Dh[129]=20,Ah[41]=Eh[41]=7,Bh[41]=Dh[41]=20,zh[66]=Dh[66]=2,Ah[66]=Ch[66]=19,zh[104]=Dh[104]=2,Ah[104]=Ch[104]=19,xh[144]=Bh[144]=10,Ch[144]=Eh[144]=23,xh[26]=Bh[26]=10,Ch[26]=Eh[26]=23,yh[36]=Eh[36]=5,zh[36]=Dh[36]=2,yh[134]=Eh[134]=5,zh[134]=Dh[134]=2,xh[9]=Bh[9]=10,yh[9]=Ah[9]=13,xh[161]=Bh[161]=10,yh[161]=Ah[161]=13,yh[37]=Eh[37]=5,Bh[37]=Dh[37]=20,yh[133]=Eh[133]=5,Bh[133]=Dh[133]=20,zh[148]=Bh[148]=16,Ch[148]=Eh[148]=23,zh[22]=Bh[22]=16,Ch[22]=Eh[22]=23,xh[82]=zh[82]=8,Ah[82]=Ch[82]=19,xh[88]=zh[88]=8,Ah[88]=Ch[88]=19,xh[73]=Dh[73]=0,yh[73]=Ah[73]=13,xh[97]=Dh[97]=0,yh[97]=Ah[97]=13,xh[145]=Ah[145]=9,Bh[145]=Eh[145]=21,xh[25]=Ah[25]=9,Bh[25]=Eh[25]=21,yh[70]=Dh[70]=1,zh[70]=Ch[70]=17,yh[100]=Dh[100]=1,zh[100]=Ch[100]=17,xh[34]=Ah[34]=9,yh[34]=zh[34]=12,Bh[34]=Eh[34]=21,Ch[34]=Dh[34]=22,xh[136]=Eh[136]=4,yh[136]=Dh[136]=1,zh[136]=Ch[136]=17,Ah[136]=Bh[136]=18,xh[35]=Eh[35]=4,yh[35]=zh[35]=12,Ah[35]=Bh[35]=18,Ch[35]=Dh[35]=22,xh[153]=Eh[153]=4,Ah[153]=Bh[153]=18,yh[102]=zh[102]=12,Ch[102]=Dh[102]=22,xh[155]=Ah[155]=9,Bh[155]=Eh[155]=23,yh[103]=Dh[103]=1,zh[103]=Ch[103]=17,xh[152]=Eh[152]=4,zh[152]=Ch[152]=17,Ah[152]=Bh[152]=18,xh[156]=zh[156]=8,Ah[156]=Bh[156]=18,Ch[156]=Eh[156]=23,xh[137]=Eh[137]=4,yh[137]=Dh[137]=1,Ah[137]=Bh[137]=18,xh[139]=Eh[139]=4,yh[139]=Ah[139]=13,Bh[139]=Dh[139]=20,xh[98]=Ah[98]=9,yh[98]=zh[98]=12,Ch[98]=Dh[98]=22,xh[99]=Dh[99]=0,yh[99]=zh[99]=12,Ah[99]=Ch[99]=19,yh[38]=zh[38]=12,Bh[38]=Eh[38]=21,Ch[38]=Dh[38]=22,yh[39]=Eh[39]=5,zh[39]=Bh[39]=16,Ch[39]=Dh[39]=22;var Fh=[];Fh[1]=Fh[169]=ph,Fh[4]=Fh[166]=qh,Fh[16]=Fh[154]=rh,Fh[64]=Fh[106]=sh,Fh[168]=Fh[2]=th,Fh[162]=Fh[8]=uh,Fh[138]=Fh[32]=vh,Fh[42]=Fh[128]=wh,Fh[5]=Fh[165]=function(a){return[[0,0],[0,a.leftbottom],[1,a.rightbottom],[1,0]]},Fh[20]=Fh[150]=function(a){return[[1,0],[a.bottomright,0],[a.topright,1],[1,1]]},Fh[80]=Fh[90]=function(a){return[[1,1],[1,a.righttop],[0,a.lefttop],[0,1]]},Fh[65]=Fh[105]=function(a){return[[a.bottomleft,0],[0,0],[0,1],[a.topleft,1]]},Fh[160]=Fh[10]=function(a){return[[1,a.righttop],[1,a.rightbottom],[0,a.leftbottom],[0,a.lefttop]]},Fh[130]=Fh[40]=function(a){return[[a.topleft,1],[a.topright,1],[a.bottomright,0],[a.bottomleft,0]]},Fh[85]=function(){return[[0,0],[0,1],[1,1],[1,0]]},Fh[101]=Fh[69]=function(a){return[[1,a.rightbottom],[1,0],[0,0],[0,1],[a.topleft,1]]},Fh[149]=Fh[21]=function(a){return[[a.topright,1],[1,1],[1,0],[0,0],[0,a.leftbottom]]},Fh[86]=Fh[84]=function(a){return[[1,0],[a.bottomright,0],[0,a.lefttop],[0,1],[1,1]]},Fh[89]=Fh[81]=function(a){return[[1,1],[1,a.righttop],[a.bottomleft,0],[0,0],[0,1]]},Fh[96]=Fh[74]=function(a){return[[1,a.righttop],[1,a.rightbottom],[0,a.lefttop],[0,1],[a.topleft,1]]},Fh[24]=Fh[146]=function(a){return[[1,1],[1,a.righttop],[a.bottomright,0],[a.bottomleft,0],[a.topright,1]]},Fh[6]=Fh[164]=function(a){return[[1,a.rightbottom],[1,0],[a.bottomright,0],[0,a.leftbottom],[0,a.lefttop]]},Fh[129]=Fh[41]=function(a){return[[a.topright,1],[a.bottomleft,0],[0,0],[0,a.leftbottom],[a.topleft,1]]},Fh[66]=Fh[104]=function(a){return[[a.bottomright,0],[a.bottomleft,0],[0,a.lefttop],[0,1],[a.topleft,1]]},Fh[144]=Fh[26]=function(a){return[[1,1],[1,a.righttop],[0,a.leftbottom],[0,a.lefttop],[a.topright,1]]},Fh[36]=Fh[134]=function(a){return[[1,a.rightbottom],[1,0],[a.bottomright,0],[a.topleft,1],[a.topright,1]]},Fh[9]=Fh[161]=function(a){return[[1,a.righttop],[1,a.rightbottom],[a.bottomleft,0],[0,0],[0,a.leftbottom]]},Fh[37]=Fh[133]=function(a){return[[1,a.rightbottom],[1,0],[0,0],[0,a.leftbottom],[a.topleft,1],[a.topright,1]]},Fh[148]=Fh[22]=function(a){return[[1,1],[1,0],[a.bottomright,0],[0,a.leftbottom],[0,a.lefttop],[a.topright,1]]},Fh[82]=Fh[88]=function(a){return[[1,1],[1,a.righttop],[a.bottomright,0],[a.bottomleft,0],[0,a.lefttop],[0,1]]},Fh[73]=Fh[97]=function(a){return[[1,a.righttop],[1,a.rightbottom],[a.bottomleft,0],[0,0],[0,1],[a.topleft,1]]},Fh[145]=Fh[25]=function(a){return[[1,1],[1,a.righttop],[a.bottomleft,0],[0,0],[0,a.leftbottom],[a.topright,1]]},Fh[70]=Fh[100]=function(a){return[[1,a.rightbottom],[1,0],[a.bottomright,0],[0,a.lefttop],[0,1],[a.topleft,1]]},Fh[34]=function(a){return[wh(a),uh(a)]},Fh[35]=function(a){return[[1,a.righttop],[1,a.rightbottom],[a.bottomright,0],[a.bottomleft,0],[0,a.leftbottom],[0,a.lefttop],[a.topleft,1],[a.topright,1]]},Fh[136]=function(a){return[vh(a),th(a)]},Fh[153]=function(a){return[rh(a),ph(a)]},Fh[102]=function(a){return[qh(a),sh(a)]},Fh[155]=function(a){return[[1,1],[1,a.righttop],[a.bottomleft,0],[0,0],[0,a.leftbottom],[a.topright,1]]},Fh[103]=function(a){return[[1,a.rightbottom],[1,0],[a.bottomright,0],[0,a.lefttop],[0,1],[a.topleft,1]]},Fh[152]=function(a){return[rh(a),th(a)]},Fh[156]=function(a){return[[1,1],[1,a.righttop],[a.bottomright,0],[a.bottomleft,0],[0,a.leftbottom],[0,a.lefttop],[a.topright,1]]},Fh[137]=function(a){return[vh(a),ph(a)]},Fh[139]=function(a){return[[1,a.righttop],[1,a.rightbottom],[a.bottomleft,0],[0,0],[0,a.leftbottom],[a.topleft,1],[a.topright,1]]},Fh[98]=function(a){return[uh(a),sh(a)]},Fh[99]=function(a){return[[1,a.righttop],[1,a.rightbottom],[a.bottomright,0],[a.bottomleft,0],[0,a.lefttop],[0,1],[a.topleft,1]]},Fh[38]=function(a){return[qh(a),wh(a)]},Fh[39]=function(a){return[[1,a.rightbottom],[1,0],[a.bottomright,0],[0,a.leftbottom],[0,a.lefttop],[a.topleft,1],[a.topright,1]]};var Gh=function Co(a){this.id=Co.buildId(a),this.coordinates=a,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1};Gh.buildId=function(a){return a.join(",")},Gh.prototype.removeInnerEdge=function(a){this.innerEdges=this.innerEdges.filter(function(b){return b.from.id!==a.from.id})},Gh.prototype.removeOuterEdge=function(a){this.outerEdges=this.outerEdges.filter(function(b){return b.to.id!==a.to.id})},Gh.prototype.addOuterEdge=function(a){this.outerEdges.push(a),this.outerEdgesSorted=!1},Gh.prototype.sortOuterEdges=function(){var a=this;this.outerEdgesSorted||(this.outerEdges.sort(function(b,c){var d=b.to,e=c.to;if(d.coordinates[0]-a.coordinates[0]>=0&&e.coordinates[0]-a.coordinates[0]<0)return 1;if(d.coordinates[0]-a.coordinates[0]<0&&e.coordinates[0]-a.coordinates[0]>=0)return-1;if(d.coordinates[0]-a.coordinates[0]==0&&e.coordinates[0]-a.coordinates[0]==0)return d.coordinates[1]-a.coordinates[1]>=0||e.coordinates[1]-a.coordinates[1]>=0?d.coordinates[1]-e.coordinates[1]:e.coordinates[1]-d.coordinates[1];var f=td(a.coordinates,d.coordinates,e.coordinates);return 0>f?1:f>0?-1:Math.pow(d.coordinates[0]-a.coordinates[0],2)+Math.pow(d.coordinates[1]-a.coordinates[1],2)-(Math.pow(e.coordinates[0]-a.coordinates[0],2)+Math.pow(e.coordinates[1]-a.coordinates[1],2))}),this.outerEdgesSorted=!0)},Gh.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},Gh.prototype.getOuterEdge=function(a){return this.sortOuterEdges(),this.outerEdges[a]},Gh.prototype.addInnerEdge=function(a){this.innerEdges.push(a)};var Hh=function(a,b){this.from=a,this.to=b,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)};Hh.prototype.getSymetric=function(){return this.symetric||(this.symetric=new Hh(this.to,this.from),this.symetric.symetric=this),this.symetric},Hh.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},Hh.prototype.isEqual=function(a){return this.from.id===a.from.id&&this.to.id===a.to.id},Hh.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},Hh.prototype.toLineString=function(){return h([this.from.coordinates,this.to.coordinates])},Hh.prototype.compareTo=function(a){return td(a.from.coordinates,a.to.coordinates,this.to.coordinates)};var Ih=function(){this.edges=[],this.polygon=void 0,this.envelope=void 0},Jh={length:{configurable:!0}};Ih.prototype.push=function(a){this[this.edges.length]=a,this.edges.push(a),this.polygon=this.envelope=void 0},Ih.prototype.get=function(a){return this.edges[a]},Jh.length.get=function(){return this.edges.length},Ih.prototype.forEach=function(a){this.edges.forEach(a)},Ih.prototype.map=function(a){return this.edges.map(a)},Ih.prototype.some=function(a){return this.edges.some(a)},Ih.prototype.isValid=function(){return!0},Ih.prototype.isHole=function(){var a=this,b=this.edges.reduce(function(b,c,d){return c.from.coordinates[1]>a.edges[b].from.coordinates[1]&&(b=d),b},0),c=(0===b?this.length:b)-1,d=(b+1)%this.length,e=td(this.edges[c].from.coordinates,this.edges[b].from.coordinates,this.edges[d].from.coordinates);return 0===e?this.edges[c].from.coordinates[0]>this.edges[d].from.coordinates[0]:e>0},Ih.prototype.toMultiPoint=function(){return l(this.edges.map(function(a){return a.from.coordinates}))},Ih.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var a=this.edges.map(function(a){return a.from.coordinates});return a.push(this.edges[0].from.coordinates),this.polygon=f([a])},Ih.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=kb(this.toPolygon())},Ih.findEdgeRingContaining=function(a,b){var c,e,f=a.getEnvelope();return b.forEach(function(b){var g=b.getEnvelope();if(e&&(c=e.getEnvelope()),!function(a,b){var c=a.geometry.coordinates.map(function(a){return a[0]}),d=a.geometry.coordinates.map(function(a){return a[1]}),e=b.geometry.coordinates.map(function(a){return a[0]}),f=b.geometry.coordinates.map(function(a){return a[1]});return Math.max(null,c)===Math.max(null,e)&&Math.max(null,d)===Math.max(null,f)&&Math.min(null,c)===Math.min(null,e)&&Math.min(null,d)===Math.min(null,f)}(g,f)&&ud(g,f)){var h=a.map(function(a){return a.from.coordinates}).find(function(a){return!b.some(function(b){return function(a,b){return a[0]===b[0]&&a[1]===b[1]}(a,b.from.coordinates)})});h&&b.inside(d(h))&&(e&&!ud(c,g)||(e=b))}}),e},Ih.prototype.inside=function(a){return Ea(a,this.toPolygon())},Object.defineProperties(Ih.prototype,Jh);var Kh=function(){this.edges=[],this.nodes={}};Kh.fromGeoJson=function(a){!function(a){if(!a)throw new Error("No geojson passed");if("FeatureCollection"!==a.type&&"GeometryCollection"!==a.type&&"MultiLineString"!==a.type&&"LineString"!==a.type&&"Feature"!==a.type)throw new Error("Invalid input type '"+a.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}(a);var b=new Kh;return K(a,function(a){V(a,"LineString","Graph::fromGeoJson"),C(a,function(a,c){if(a){var d=b.getNode(a),e=b.getNode(c);b.addEdge(d,e)}return c})}),b},Kh.prototype.getNode=function(a){var b=Gh.buildId(a),c=this.nodes[b];return c||(c=this.nodes[b]=new Gh(a)),c},Kh.prototype.addEdge=function(a,b){var c=new Hh(a,b),d=c.getSymetric();this.edges.push(c),this.edges.push(d)},Kh.prototype.deleteDangles=function(){var a=this;Object.keys(this.nodes).map(function(b){return a.nodes[b]}).forEach(function(b){return a._removeIfDangle(b)})},Kh.prototype._removeIfDangle=function(a){var b=this;if(a.innerEdges.length<=1){var c=a.getOuterEdges().map(function(a){return a.to});this.removeNode(a),c.forEach(function(a){return b._removeIfDangle(a)})}},Kh.prototype.deleteCutEdges=function(){var a=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(b){b.label===b.symetric.label&&(a.removeEdge(b.symetric),a.removeEdge(b))})},Kh.prototype._computeNextCWEdges=function(a){var b=this;void 0===a?Object.keys(this.nodes).forEach(function(a){return b._computeNextCWEdges(b.nodes[a])}):a.getOuterEdges().forEach(function(b,c){a.getOuterEdge((0===c?a.getOuterEdges().length:c)-1).symetric.next=b})},Kh.prototype._computeNextCCWEdges=function(a,b){for(var c,d,e=a.getOuterEdges(),f=e.length-1;f>=0;--f){var g=e[f],h=g.symetric,i=void 0,j=void 0;g.label===b&&(i=g),h.label===b&&(j=h),i&&j&&(j&&(d=j),i&&(d&&(d.next=i,d=void 0),c||(c=i)))}d&&(d.next=c)},Kh.prototype._findLabeledEdgeRings=function(){var a=[],b=0;return this.edges.forEach(function(c){if(!(c.label>=0)){a.push(c);var d=c;do d.label=b,d=d.next;while(!c.isEqual(d));b++}}),a},Kh.prototype.getEdgeRings=function(){var a=this;this._computeNextCWEdges(),this.edges.forEach(function(a){a.label=void 0}),this._findLabeledEdgeRings().forEach(function(b){a._findIntersectionNodes(b).forEach(function(c){a._computeNextCCWEdges(c,b.label)})});var b=[];return this.edges.forEach(function(c){c.ring||b.push(a._findEdgeRing(c))}),b},Kh.prototype._findIntersectionNodes=function(a){var b=[],c=a,d=function(){var d=0;c.from.getOuterEdges().forEach(function(b){b.label===a.label&&++d}),d>1&&b.push(c.from),c=c.next};do d();while(!a.isEqual(c));return b},Kh.prototype._findEdgeRing=function(a){var b=a,c=new Ih;do c.push(b),b.ring=c,b=b.next;while(!a.isEqual(b));return c},Kh.prototype.removeNode=function(a){var b=this;a.getOuterEdges().forEach(function(a){return b.removeEdge(a)}),a.innerEdges.forEach(function(a){return b.removeEdge(a)}),delete this.nodes[a.id]},Kh.prototype.removeEdge=function(a){this.edges=this.edges.filter(function(b){return!b.isEqual(a)}),a.deleteEdge()};var Lh=sa(function(a,b){function c(a){var b=[];for(var c in a)b.push(c);return b}(a.exports="function"==typeof Object.keys?Object.keys:c).shim=c}),Mh=(Lh.shim,sa(function(a,b){function c(a){return"[object Arguments]"==Object.prototype.toString.call(a)}function d(a){return a&&"object"==typeof a&&"number"==typeof a.length&&Object.prototype.hasOwnProperty.call(a,"callee")&&!Object.prototype.propertyIsEnumerable.call(a,"callee")||!1}var e="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();(b=a.exports=e?c:d).supported=c,b.unsupported=d})),Nh=(Mh.supported,Mh.unsupported,sa(function(a){function b(a){return null===a||void 0===a}function c(a){return!(!a||"object"!=typeof a||"number"!=typeof a.length||"function"!=typeof a.copy||"function"!=typeof a.slice||a.length>0&&"number"!=typeof a[0])}var d=Array.prototype.slice,e=a.exports=function(a,f,g){return g||(g={}),a===f||(a instanceof Date&&f instanceof Date?a.getTime()===f.getTime():!a||!f||"object"!=typeof a&&"object"!=typeof f?g.strict?a===f:a==f:function(a,f,g){var h,i;if(b(a)||b(f))return!1;if(a.prototype!==f.prototype)return!1;if(Mh(a))return!!Mh(f)&&(a=d.call(a),f=d.call(f),e(a,f,g));if(c(a)){if(!c(f))return!1;if(a.length!==f.length)return!1;for(h=0;h<a.length;h++)if(a[h]!==f[h])return!1;return!0}try{var j=Lh(a),k=Lh(f)}catch(a){return!1}if(j.length!=k.length)return!1;for(j.sort(),k.sort(),h=j.length-1;h>=0;h--)if(j[h]!=k[h])return!1;for(h=j.length-1;h>=0;h--)if(i=j[h],!e(a[i],f[i],g))return!1;return typeof a==typeof f}(a,f,g))}})),Oh=function(a){this.precision=a&&a.precision?a.precision:17,this.direction=!(!a||!a.direction)&&a.direction,this.pseudoNode=!(!a||!a.pseudoNode)&&a.pseudoNode,this.objectComparator=a&&a.objectComparator?a.objectComparator:Fd};Oh.prototype.compare=function(a,b){if(a.type!==b.type||!Ed(a,b))return!1;switch(a.type){case"Point":return this.compareCoord(a.coordinates,b.coordinates);case"LineString":return this.compareLine(a.coordinates,b.coordinates,0,!1);case"Polygon":return this.comparePolygon(a,b);case"Feature":return this.compareFeature(a,b);default:if(0===a.type.indexOf("Multi")){var c=this,d=Dd(a),e=Dd(b);return d.every(function(a){return this.some(function(b){return c.compare(a,b)})},e)}}return!1},Oh.prototype.compareCoord=function(a,b){if(a.length!==b.length)return!1;for(var c=0;c<a.length;c++)if(a[c].toFixed(this.precision)!==b[c].toFixed(this.precision))return!1;return!0},Oh.prototype.compareLine=function(a,b,c,d){if(!Ed(a,b))return!1;var e=this.pseudoNode?a:this.removePseudo(a),f=this.pseudoNode?b:this.removePseudo(b);if(!d||this.compareCoord(e[0],f[0])||(f=this.fixStartIndex(f,e))){var g=this.compareCoord(e[c],f[c]);return this.direction||g?this.comparePath(e,f):!!this.compareCoord(e[c],f[f.length-(1+c)])&&this.comparePath(e.slice().reverse(),f)}},Oh.prototype.fixStartIndex=function(a,b){for(var c,d=-1,e=0;e<a.length;e++)if(this.compareCoord(a[e],b[0])){d=e;break}return d>=0&&(c=[].concat(a.slice(d,a.length),a.slice(1,d+1))),c},Oh.prototype.comparePath=function(a,b){var c=this;return a.every(function(a,b){return c.compareCoord(a,this[b])},b)},Oh.prototype.comparePolygon=function(a,b){if(this.compareLine(a.coordinates[0],b.coordinates[0],1,!0)){var c=a.coordinates.slice(1,a.coordinates.length),d=b.coordinates.slice(1,b.coordinates.length),e=this;return c.every(function(a){return this.some(function(b){return e.compareLine(a,b,1,!0)})},d)}return!1},Oh.prototype.compareFeature=function(a,b){return!(a.id!==b.id||!this.objectComparator(a.properties,b.properties)||!this.compareBBox(a,b))&&this.compare(a.geometry,b.geometry)},Oh.prototype.compareBBox=function(a,b){return!!(!a.bbox&&!b.bbox||a.bbox&&b.bbox&&this.compareCoord(a.bbox,b.bbox))},Oh.prototype.removePseudo=function(a){return a};var Ph=Oh,Qh=sa(function(a){function b(a,b,c,d){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(a,b,c,d)}b.prototype.run=function(a,b,c,d){this._init(a,b,c,d);for(var e=0;e<this._datasetLength;e++)if(1!==this._visited[e]){this._visited[e]=1;var f=this._regionQuery(e);if(f.length<this.minPts)this.noise.push(e);else{var g=this.clusters.length;this.clusters.push([]),this._addToCluster(e,g),this._expandCluster(g,f)}}return this.clusters},b.prototype._init=function(a,b,c,d){if(a){if(!(a instanceof Array))throw Error("Dataset must be of type array, "+typeof a+" given");this.dataset=a,this.clusters=[],this.noise=[],this._datasetLength=a.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}b&&(this.epsilon=b),c&&(this.minPts=c),d&&(this.distance=d)},b.prototype._expandCluster=function(a,b){for(var c=0;c<b.length;c++){var d=b[c];if(1!==this._visited[d]){this._visited[d]=1;var e=this._regionQuery(d);e.length>=this.minPts&&(b=this._mergeArrays(b,e))}1!==this._assigned[d]&&this._addToCluster(d,a)}},b.prototype._addToCluster=function(a,b){this.clusters[b].push(a),this._assigned[a]=1},b.prototype._regionQuery=function(a){for(var b=[],c=0;c<this._datasetLength;c++)this.distance(this.dataset[a],this.dataset[c])<this.epsilon&&b.push(c);return b},b.prototype._mergeArrays=function(a,b){for(var c=b.length,d=0;c>d;d++){var e=b[d];a.indexOf(e)<0&&a.push(e)}return a},b.prototype._euclideanDistance=function(a,b){for(var c=0,d=Math.min(a.length,b.length);d--;)c+=(a[d]-b[d])*(a[d]-b[d]);return Math.sqrt(c)},a.exports&&(a.exports=b)}),Rh=sa(function(a){function b(a,b,c){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(a,b,c)}b.prototype.init=function(a,b,c){this.assignments=[],this.centroids=[],void 0!==a&&(this.dataset=a),void 0!==b&&(this.k=b),void 0!==c&&(this.distance=c)},b.prototype.run=function(a,b){this.init(a,b);for(var c=this.dataset.length,d=0;d<this.k;d++)this.centroids[d]=this.randomCentroid();for(var e=!0;e;){e=this.assign();for(var f=0;f<this.k;f++){for(var g=new Array(k),h=0,i=0;k>i;i++)g[i]=0;for(var j=0;c>j;j++){var k=this.dataset[j].length;if(f===this.assignments[j]){for(i=0;k>i;i++)g[i]+=this.dataset[j][i];h++}}if(h>0){for(i=0;k>i;i++)g[i]/=h;this.centroids[f]=g}else this.centroids[f]=this.randomCentroid(),e=!0}}return this.getClusters()},b.prototype.randomCentroid=function(){var a,b,c=this.dataset.length-1;do b=Math.round(Math.random()*c),a=this.dataset[b];while(this.centroids.indexOf(a)>=0);return a},b.prototype.assign=function(){for(var a,b=!1,c=this.dataset.length,d=0;c>d;d++)(a=this.argmin(this.dataset[d],this.centroids,this.distance))!=this.assignments[d]&&(this.assignments[d]=a,b=!0);return b},b.prototype.getClusters=function(){for(var a,b=new Array(this.k),c=0;c<this.assignments.length;c++)void 0===b[a=this.assignments[c]]&&(b[a]=[]),b[a].push(c);return b},b.prototype.argmin=function(a,b,c){for(var d,e=Number.MAX_VALUE,f=0,g=b.length,h=0;g>h;h++)(d=c(a,b[h]))<e&&(e=d,f=h);return f},b.prototype.distance=function(a,b){for(var c=0,d=Math.min(a.length,b.length);d--;){var e=a[d]-b[d];c+=e*e}return Math.sqrt(c)},a.exports&&(a.exports=b)}),Sh=sa(function(a){function b(a,b,c){this._queue=[],this._priorities=[],this._sorting="desc",this._init(a,b,c)}b.prototype.insert=function(a,b){for(var c=this._queue.length,d=c;d--;){var e=this._priorities[d];"desc"===this._sorting?b>e&&(c=d):e>b&&(c=d)}this._insertAt(a,b,c)},b.prototype.remove=function(a){for(var b=this._queue.length;b--;)if(a===this._queue[b]){this._queue.splice(b,1),this._priorities.splice(b,1);break}},b.prototype.forEach=function(a){this._queue.forEach(a)},b.prototype.getElements=function(){return this._queue},b.prototype.getElementPriority=function(a){return this._priorities[a]},b.prototype.getPriorities=function(){return this._priorities},b.prototype.getElementsWithPriorities=function(){for(var a=[],b=0,c=this._queue.length;c>b;b++)a.push([this._queue[b],this._priorities[b]]);return a},b.prototype._init=function(a,b,c){if(a&&b){if(this._queue=[],this._priorities=[],a.length!==b.length)throw new Error("Arrays must have the same length");for(var d=0;d<a.length;d++)this.insert(a[d],b[d])}c&&(this._sorting=c)},b.prototype._insertAt=function(a,b,c){this._queue.length===c?(this._queue.push(a),this._priorities.push(b)):(this._queue.splice(c,0,a),this._priorities.splice(c,0,b))},a.exports&&(a.exports=b)}),Th=sa(function(a){function b(a,b,c,d){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(a,b,c,d)}if(a.exports)var c=Sh;b.prototype.run=function(a,b,d,e){this._init(a,b,d,e);for(var f=0,g=this.dataset.length;g>f;f++)if(1!==this._processed[f]){this._processed[f]=1,this.clusters.push([f]);var h=this.clusters.length-1;this._orderedList.push(f);var i=new c(null,null,"asc"),j=this._regionQuery(f);void 0!==this._distanceToCore(f)&&(this._updateQueue(f,j,i),this._expandCluster(h,i))}return this.clusters},b.prototype.getReachabilityPlot=function(){for(var a=[],b=0,c=this._orderedList.length;c>b;b++){var d=this._orderedList[b],e=this._reachability[d];a.push([d,e])}return a},b.prototype._init=function(a,b,c,d){if(a){if(!(a instanceof Array))throw Error("Dataset must be of type array, "+typeof a+" given");this.dataset=a,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}b&&(this.epsilon=b),c&&(this.minPts=c),d&&(this.distance=d)},b.prototype._updateQueue=function(a,b,c){var d=this;this._coreDistance=this._distanceToCore(a),b.forEach(function(b){if(void 0===d._processed[b]){var e=d.distance(d.dataset[a],d.dataset[b]),f=Math.max(d._coreDistance,e);void 0===d._reachability[b]?(d._reachability[b]=f,c.insert(b,f)):f<d._reachability[b]&&(d._reachability[b]=f,c.remove(b),c.insert(b,f))}})},b.prototype._expandCluster=function(a,b){for(var c=b.getElements(),d=0,e=c.length;e>d;d++){var f=c[d];if(void 0===this._processed[f]){var g=this._regionQuery(f);this._processed[f]=1,this.clusters[a].push(f),this._orderedList.push(f),void 0!==this._distanceToCore(f)&&(this._updateQueue(f,g,b),this._expandCluster(a,b))}}},b.prototype._distanceToCore=function(a){for(var b=this.epsilon,c=0;b>c;c++)if(this._regionQuery(a,c).length>=this.minPts)return c},b.prototype._regionQuery=function(a,b){b=b||this.epsilon;for(var c=[],d=0,e=this.dataset.length;e>d;d++)this.distance(this.dataset[a],this.dataset[d])<b&&c.push(d);return c},b.prototype._euclideanDistance=function(a,b){for(var c=0,d=Math.min(a.length,b.length);d--;)c+=(a[d]-b[d])*(a[d]-b[d]);return Math.sqrt(c)},a.exports&&(a.exports=b)}),Uh=sa(function(a){a.exports&&(a.exports={DBSCAN:Qh,KMEANS:Rh,OPTICS:Th,PriorityQueue:Sh})}),Vh=(Uh.DBSCAN,Uh.KMEANS,Uh.OPTICS,Uh.PriorityQueue,function(a,b,c){for(var d=a.length,e=0,f=0;d>f;f++){var g=(a[f]||0)-(b[f]||0);e+=g*g}return c?Math.sqrt(e):e}),Wh=Vh,Xh=function(a,b,c){var d=Math.abs(a-b);return c?d:d*d},Yh=Vh,Zh=function(a,b){for(var c={},d=[],e=b<<2,f=a.length,g=a[0].length>0;d.length<b&&e-->0;){var h=a[Math.floor(Math.random()*f)],i=g?h.join("_"):""+h;c[i]||(c[i]=!0,d.push(h))}if(d.length<b)throw new Error("Error initializating clusters");return d},$h=function(a,b){var c=a[0].length?Wh:Xh,d=[],e=a.length,f=a[0].length>0,g=a[Math.floor(Math.random()*e)];for(f&&g.join("_"),d.push(g);d.length<b;){for(var h=[],i=d.length,j=0,k=[],l=0;e>l;l++){for(var m=1/0,n=0;i>n;n++){var o=c(a[l],d[n]);m>=o&&(m=o)}h[l]=m}for(var p=0;e>p;p++)j+=h[p];for(var q=0;e>q;q++)k[q]={i:q,v:a[q],pr:h[q]/j,cs:0};k.sort(function(a,b){return a.pr-b.pr}),k[0].cs=k[0].pr;for(var r=1;e>r;r++)k[r].cs=k[r-1].cs+k[r].pr;for(var s=Math.random(),t=0;e-1>t&&k[t++].cs<s;);d.push(k[t-1].v)}return d},_h=1e4,ai=function(a,b,c,d){var e=[],f=[],g=[],h=[],i=!1,j=d||_h,k=a.length,l=a[0].length,m=l>0,n=[];if(c)e="kmrand"==c?Zh(a,b):"kmpp"==c?$h(a,b):c;else for(var o={};e.length<b;){var p=Math.floor(Math.random()*k);o[p]||(o[p]=!0,e.push(a[p]))}do{Hd(b,0,n);for(var q=0;k>q;q++){for(var r=1/0,s=0,t=0;b>t;t++)(h=m?Yh(a[q],e[t]):Math.abs(a[q]-e[t]))<=r&&(r=h,s=t);g[q]=s,n[s]++}for(var u=[],v=(f=[],0);b>v;v++)u[v]=m?Hd(l,0,u[v]):0,f[v]=e[v];if(m){for(var w=0;b>w;w++)e[w]=[];for(var x=0;k>x;x++)for(var y=u[g[x]],z=a[x],A=0;l>A;A++)y[A]+=z[A];i=!0;for(var B=0;b>B;B++){for(var C=e[B],D=u[B],E=f[B],F=n[B],G=0;l>G;G++)C[G]=D[G]/F||0;if(i)for(var H=0;l>H;H++)if(E[H]!=C[H]){i=!1;break}}}else{for(var I=0;k>I;I++)u[g[I]]+=a[I];for(var J=0;b>J;J++)e[J]=u[J]/n[J]||0;i=!0;for(var K=0;b>K;K++)if(f[K]!=e[K]){i=!1;break}}i=i||--j<=0}while(!i);return{it:_h-j,k:b,idxs:g,centroids:e}},bi={search:function(a,b,c,d){a.cleanDirty();var e=(d=d||{}).heuristic||bi.heuristics.manhattan,f=d.closest||!1,g=new Md(function(a){return a.f}),h=b;for(b.h=e(b,c),g.push(b);g.size()>0;){var i=g.pop();if(i===c)return Jd(i);i.closed=!0;for(var j=a.neighbors(i),k=0,l=j.length;l>k;++k){var m=j[k];if(!m.closed&&!m.isWall()){var n=i.g+m.getCost(i),o=m.visited;(!o||n<m.g)&&(m.visited=!0,m.parent=i,m.h=m.h||e(m,c),m.g=n,m.f=m.g+m.h,a.markDirty(m),f&&(m.h<h.h||m.h===h.h&&m.g<h.g)&&(h=m),o?g.rescoreElement(m):g.push(m))}}}return f?Jd(h):[]},heuristics:{manhattan:function(a,b){return Math.abs(b.x-a.x)+Math.abs(b.y-a.y)},diagonal:function(a,b){var c=Math.sqrt(2),d=Math.abs(b.x-a.x),e=Math.abs(b.y-a.y);return 1*(d+e)+(c-2)*Math.min(d,e)}},cleanNode:function(a){a.f=0,a.g=0,a.h=0,a.visited=!1,a.closed=!1,a.parent=null}};Kd.prototype.init=function(){this.dirtyNodes=[];for(var a=0;a<this.nodes.length;a++)bi.cleanNode(this.nodes[a])},Kd.prototype.cleanDirty=function(){for(var a=0;a<this.dirtyNodes.length;a++)bi.cleanNode(this.dirtyNodes[a]);this.dirtyNodes=[]},Kd.prototype.markDirty=function(a){this.dirtyNodes.push(a)},Kd.prototype.neighbors=function(a){var b=[],c=a.x,d=a.y,e=this.grid;return e[c-1]&&e[c-1][d]&&b.push(e[c-1][d]),e[c+1]&&e[c+1][d]&&b.push(e[c+1][d]),e[c]&&e[c][d-1]&&b.push(e[c][d-1]),e[c]&&e[c][d+1]&&b.push(e[c][d+1]),this.diagonal&&(e[c-1]&&e[c-1][d-1]&&b.push(e[c-1][d-1]),e[c+1]&&e[c+1][d-1]&&b.push(e[c+1][d-1]),e[c-1]&&e[c-1][d+1]&&b.push(e[c-1][d+1]),e[c+1]&&e[c+1][d+1]&&b.push(e[c+1][d+1])),b},Kd.prototype.toString=function(){for(var a,b,c,d,e=[],f=this.grid,g=0,h=f.length;h>g;g++){for(a=[],c=0,d=(b=f[g]).length;d>c;c++)a.push(b[c].weight);e.push(a.join(" "))}return e.join("\n")},Ld.prototype.toString=function(){return"["+this.x+" "+this.y+"]"},Ld.prototype.getCost=function(a){return a&&a.x!==this.x&&a.y!==this.y?1.41421*this.weight:this.weight},Ld.prototype.isWall=function(){return 0===this.weight},Md.prototype={push:function(a){this.content.push(a),this.sinkDown(this.content.length-1)},pop:function(){var a=this.content[0],b=this.content.pop();return this.content.length>0&&(this.content[0]=b,this.bubbleUp(0)),a},remove:function(a){var b=this.content.indexOf(a),c=this.content.pop();b!==this.content.length-1&&(this.content[b]=c,this.scoreFunction(c)<this.scoreFunction(a)?this.sinkDown(b):this.bubbleUp(b))},size:function(){return this.content.length},rescoreElement:function(a){this.sinkDown(this.content.indexOf(a))},sinkDown:function(a){for(var b=this.content[a];a>0;){var c=(a+1>>1)-1,d=this.content[c];if(!(this.scoreFunction(b)<this.scoreFunction(d)))break;this.content[c]=b,this.content[a]=d,a=c}},bubbleUp:function(a){for(var b=this.content.length,c=this.content[a],d=this.scoreFunction(c);;){var e,f=a+1<<1,g=f-1,h=null;if(b>g){var i=this.content[g];(e=this.scoreFunction(i))<d&&(h=g)}if(b>f){var j=this.content[f];this.scoreFunction(j)<(null===h?d:e)&&(h=f)}if(null===h)break;this.content[a]=this.content[h],this.content[h]=c,a=h}}};var ci=function(a){return function(){return a}};Pd.prototype={constructor:Pd,insert:function(a,b){var c,d,e;if(a){if(b.P=a,b.N=a.N,a.N&&(a.N.P=b),a.N=b,a.R){for(a=a.R;a.L;)a=a.L;a.L=b}else a.R=b;c=a}else this._?(a=Td(this._),b.P=null,b.N=a,a.P=a.L=b,c=a):(b.P=b.N=null,this._=b,c=null);for(b.L=b.R=null,b.U=c,b.C=!0,a=b;c&&c.C;)c===(d=c.U).L?(e=d.R)&&e.C?(c.C=e.C=!1,d.C=!0,a=d):(a===c.R&&(Rd(this,c),c=(a=c).U),c.C=!1,d.C=!0,Sd(this,d)):(e=d.L)&&e.C?(c.C=e.C=!1,d.C=!0,a=d):(a===c.L&&(Sd(this,c),c=(a=c).U),c.C=!1,d.C=!0,Rd(this,d)),c=a.U;this._.C=!1},remove:function(a){a.N&&(a.N.P=a.P),a.P&&(a.P.N=a.N),a.N=a.P=null;var b,c,d,e=a.U,f=a.L,g=a.R;if(c=f?g?Td(g):f:g,e?e.L===a?e.L=c:e.R=c:this._=c,f&&g?(d=c.C,c.C=a.C,c.L=f,f.U=c,c!==g?(e=c.U,c.U=a.U,a=c.R,e.L=a,c.R=g,g.U=c):(c.U=e,e=c,a=c.R)):(d=a.C,a=c),a&&(a.U=e),!d)if(a&&a.C)a.C=!1;else{do{if(a===this._)break;if(a===e.L){if((b=e.R).C&&(b.C=!1,e.C=!0,Rd(this,e),b=e.R),b.L&&b.L.C||b.R&&b.R.C){b.R&&b.R.C||(b.L.C=!1,b.C=!0,Sd(this,b),b=e.R),b.C=e.C,e.C=b.R.C=!1,Rd(this,e),a=this._;break}}else if((b=e.L).C&&(b.C=!1,e.C=!0,Sd(this,e),b=e.L),b.L&&b.L.C||b.R&&b.R.C){b.L&&b.L.C||(b.R.C=!1,b.C=!0,Rd(this,b),b=e.L),b.C=e.C,e.C=b.L.C=!1,Sd(this,e),a=this._;break}b.C=!0,a=e,e=e.U}while(!a.C);a&&(a.C=!1)}}};var di,ei,fi,gi,hi,ii=[],ji=[],ki=1e-6,li=1e-12;je.prototype={constructor:je,polygons:function(){var a=this.edges;return this.cells.map(function(b){var c=b.halfedges.map(function(c){return $d(b,a[c])});return c.data=b.site.data,c})},triangles:function(){var a=[],b=this.edges;return this.cells.forEach(function(c,d){if(f=(e=c.halfedges).length)for(var e,f,g,h=c.site,i=-1,j=b[e[f-1]],k=j.left===h?j.right:j.left;++i<f;)g=k,k=(j=b[e[i]]).left===h?j.right:j.left,g&&k&&d<g.index&&d<k.index&&he(h,g,k)<0&&a.push([h.data,g.data,k.data])}),a},links:function(){return this.edges.filter(function(a){return a.right}).map(function(a){return{source:a.left.data,target:a.right.data}})},find:function(a,b,c){for(var d,e,f=this,g=f._found||0,h=f.cells.length;!(e=f.cells[g]);)if(++g>=h)return null;var i=a-e.site[0],j=b-e.site[1],k=i*i+j*j;do e=f.cells[d=g],g=null,e.halfedges.forEach(function(c){var d=f.edges[c],h=d.left;if(h!==e.site&&h||(h=d.right)){var i=a-h[0],j=b-h[1],l=i*i+j*j;k>l&&(k=l,g=h.index)}});while(null!==g);return f._found=d,null==c||c*c>=k?e.site:null}};var mi=function(){function a(a){return new je(a.map(function(d,e){var f=[Math.round(b(d,e,a)/ki)*ki,Math.round(c(d,e,a)/ki)*ki];return f.index=e,f.data=d,f}),d)}var b=Nd,c=Od,d=null;return a.polygons=function(b){return a(b).polygons()},a.links=function(b){return a(b).links()},a.triangles=function(b){return a(b).triangles()},a.x=function(c){return arguments.length?(b="function"==typeof c?c:ci(+c),a):b},a.y=function(b){return arguments.length?(c="function"==typeof b?b:ci(+b),
a):c},a.extent=function(b){return arguments.length?(d=null==b?null:[[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]],a):d&&[[d[0][0],d[0][1]],[d[1][0],d[1][1]]]},a.size=function(b){return arguments.length?(d=null==b?null:[[0,0],[+b[0],+b[1]]],a):d&&[d[1][0]-d[0][0],d[1][1]-d[0][1]]},a},ni=Object.freeze({randomPosition:qe,randomPoint:re,randomPolygon:se,randomLineString:te}),oi=Object.freeze({getCluster:ve,clusterEach:we,clusterReduce:xe,createBins:ye,applyFilter:ze,propertiesContainsFilter:Ae,filterProperties:Be});"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(a){if(void 0===this||null===this)throw new TypeError(this+" is not an object");var b=Object(this),c=Math.max(Math.min(b.length,9007199254740991),0)||0,d=1 in arguments?parseInt(Number(arguments[1]),10)||0:0;d=0>d?Math.max(c+d,0):Math.min(d,c);var e=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:c;for(e=0>e?Math.max(c+arguments[2],0):Math.min(e,c);e>d;)b[d]=a,++d;return b},writable:!0}),Number.isFinite=Number.isFinite||function(a){return"number"==typeof a&&isFinite(a)},Number.isInteger=Number.isInteger||function(a){return"number"==typeof a&&isFinite(a)&&Math.floor(a)===a},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(a){return a!=a},Math.trunc=Math.trunc||function(a){return 0>a?Math.ceil(a):Math.floor(a)};var pi=function(){};pi.prototype.interfaces_=function(){return[]},pi.prototype.getClass=function(){return pi},pi.prototype.equalsWithTolerance=function(a,b,c){return Math.abs(a-b)<=c};var qi=function(){},ri=function(){},si={MAX_VALUE:{configurable:!0}};ri.isNaN=function(a){return Number.isNaN(a)},ri.doubleToLongBits=function(a){return a},ri.longBitsToDouble=function(a){return a},ri.isInfinite=function(a){return!Number.isFinite(a)},si.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(ri,si);var ti=function(){},ui=function(){},vi=function(){},wi=function Do(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)this.x=0,this.y=0,this.z=Do.NULL_ORDINATE;else if(1===arguments.length){var a=arguments[0];this.x=a.x,this.y=a.y,this.z=a.z}else 2===arguments.length?(this.x=arguments[0],this.y=arguments[1],this.z=Do.NULL_ORDINATE):3===arguments.length&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},xi={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};wi.prototype.setOrdinate=function(a,b){switch(a){case wi.X:this.x=b;break;case wi.Y:this.y=b;break;case wi.Z:this.z=b;break;default:throw new qi("Invalid ordinate index: "+a)}},wi.prototype.equals2D=function(){if(1===arguments.length){var a=arguments[0];return this.x===a.x&&this.y===a.y}if(2===arguments.length){var b=arguments[0],c=arguments[1];return!!pi.equalsWithTolerance(this.x,b.x,c)&&!!pi.equalsWithTolerance(this.y,b.y,c)}},wi.prototype.getOrdinate=function(a){switch(a){case wi.X:return this.x;case wi.Y:return this.y;case wi.Z:return this.z}throw new qi("Invalid ordinate index: "+a)},wi.prototype.equals3D=function(a){return this.x===a.x&&this.y===a.y&&(this.z===a.z||ri.isNaN(this.z))&&ri.isNaN(a.z)},wi.prototype.equals=function(a){return a instanceof wi&&this.equals2D(a)},wi.prototype.equalInZ=function(a,b){return pi.equalsWithTolerance(this.z,a.z,b)},wi.prototype.compareTo=function(a){var b=a;return this.x<b.x?-1:this.x>b.x?1:this.y<b.y?-1:this.y>b.y?1:0},wi.prototype.clone=function(){},wi.prototype.copy=function(){return new wi(this)},wi.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},wi.prototype.distance3D=function(a){var b=this.x-a.x,c=this.y-a.y,d=this.z-a.z;return Math.sqrt(b*b+c*c+d*d)},wi.prototype.distance=function(a){var b=this.x-a.x,c=this.y-a.y;return Math.sqrt(b*b+c*c)},wi.prototype.hashCode=function(){var a=17;return a=37*a+wi.hashCode(this.x),a=37*a+wi.hashCode(this.y)},wi.prototype.setCoordinate=function(a){this.x=a.x,this.y=a.y,this.z=a.z},wi.prototype.interfaces_=function(){return[ti,ui,Ce]},wi.prototype.getClass=function(){return wi},wi.hashCode=function(){if(1===arguments.length){var a=arguments[0],b=ri.doubleToLongBits(a);return Math.trunc((b^b)>>>32)}},xi.DimensionalComparator.get=function(){return yi},xi.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},xi.NULL_ORDINATE.get=function(){return ri.NaN},xi.X.get=function(){return 0},xi.Y.get=function(){return 1},xi.Z.get=function(){return 2},Object.defineProperties(wi,xi);var yi=function(a){if(this._dimensionsToTest=2,0===arguments.length);else if(1===arguments.length){var b=arguments[0];if(2!==b&&3!==b)throw new qi("only 2 or 3 dimensions may be specified");this._dimensionsToTest=b}};yi.prototype.compare=function(a,b){var c=a,d=b,e=yi.compare(c.x,d.x);if(0!==e)return e;var f=yi.compare(c.y,d.y);return 0!==f?f:this._dimensionsToTest<=2?0:yi.compare(c.z,d.z)},yi.prototype.interfaces_=function(){return[vi]},yi.prototype.getClass=function(){return yi},yi.compare=function(a,b){return b>a?-1:a>b?1:ri.isNaN(a)?ri.isNaN(b)?0:-1:ri.isNaN(b)?1:0};var zi=function(){};zi.prototype.create=function(){},zi.prototype.interfaces_=function(){return[]},zi.prototype.getClass=function(){return zi};var Ai=function(){},Bi={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};Ai.prototype.interfaces_=function(){return[]},Ai.prototype.getClass=function(){return Ai},Ai.toLocationSymbol=function(a){switch(a){case Ai.EXTERIOR:return"e";case Ai.BOUNDARY:return"b";case Ai.INTERIOR:return"i";case Ai.NONE:return"-"}throw new qi("Unknown location value: "+a)},Bi.INTERIOR.get=function(){return 0},Bi.BOUNDARY.get=function(){return 1},Bi.EXTERIOR.get=function(){return 2},Bi.NONE.get=function(){return-1},Object.defineProperties(Ai,Bi);var Ci=function(a,b){return a.interfaces_&&a.interfaces_().indexOf(b)>-1},Di=function(){},Ei={LOG_10:{configurable:!0}};Di.prototype.interfaces_=function(){return[]},Di.prototype.getClass=function(){return Di},Di.log10=function(a){var b=Math.log(a);return ri.isInfinite(b)?b:ri.isNaN(b)?b:b/Di.LOG_10},Di.min=function(a,b,c,d){var e=a;return e>b&&(e=b),e>c&&(e=c),e>d&&(e=d),e},Di.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var a=arguments[0],b=arguments[1],c=arguments[2];return b>a?b:a>c?c:a}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var d=arguments[0],e=arguments[1],f=arguments[2];return e>d?e:d>f?f:d}},Di.wrap=function(a,b){return 0>a?b- -a%b:a%b},Di.max=function(){if(3===arguments.length){var a=arguments[0],b=arguments[1],c=arguments[2],d=a;return b>d&&(d=b),c>d&&(d=c),d}if(4===arguments.length){var e=arguments[0],f=arguments[1],g=arguments[2],h=arguments[3],i=e;return f>i&&(i=f),g>i&&(i=g),h>i&&(i=h),i}},Di.average=function(a,b){return(a+b)/2},Ei.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(Di,Ei);var Fi=function(a){this.str=a};Fi.prototype.append=function(a){this.str+=a},Fi.prototype.setCharAt=function(a,b){this.str=this.str.substr(0,a)+b+this.str.substr(a+1)},Fi.prototype.toString=function(a){return this.str};var Gi=function(a){this.value=a};Gi.prototype.intValue=function(){return this.value},Gi.prototype.compareTo=function(a){return this.value<a?-1:this.value>a?1:0},Gi.isNaN=function(a){return Number.isNaN(a)};var Hi=function(){};Hi.isWhitespace=function(a){return 32>=a&&a>=0||127===a},Hi.toUpperCase=function(a){return a.toUpperCase()};var Ii=function Eo(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){var a=arguments[0];this.init(a)}else if(arguments[0]instanceof Eo){var b=arguments[0];this.init(b)}else if("string"==typeof arguments[0]){var c=arguments[0];Eo.call(this,Eo.parse(c))}}else if(2===arguments.length){var d=arguments[0],e=arguments[1];this.init(d,e)}},Ji={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}};Ii.prototype.le=function(a){return(this._hi<a._hi||this._hi===a._hi)&&this._lo<=a._lo},Ii.prototype.extractSignificantDigits=function(a,b){var c=this.abs(),d=Ii.magnitude(c._hi),e=Ii.TEN.pow(d);(c=c.divide(e)).gt(Ii.TEN)?(c=c.divide(Ii.TEN),d+=1):c.lt(Ii.ONE)&&(c=c.multiply(Ii.TEN),d-=1);for(var f=d+1,g=new Fi,h=Ii.MAX_PRINT_DIGITS-1,i=0;h>=i;i++){a&&i===f&&g.append(".");var j=Math.trunc(c._hi);if(0>j)break;var k=!1,l=0;j>9?(k=!0,l="9"):l="0"+j,g.append(l),c=c.subtract(Ii.valueOf(j)).multiply(Ii.TEN),k&&c.selfAdd(Ii.TEN);var m=!0,n=Ii.magnitude(c._hi);if(0>n&&Math.abs(n)>=h-i&&(m=!1),!m)break}return b[0]=d,g.toString()},Ii.prototype.sqr=function(){return this.multiply(this)},Ii.prototype.doubleValue=function(){return this._hi+this._lo},Ii.prototype.subtract=function(){if(arguments[0]instanceof Ii){var a=arguments[0];return this.add(a.negate())}if("number"==typeof arguments[0]){var b=arguments[0];return this.add(-b)}},Ii.prototype.equals=function(){if(1===arguments.length){var a=arguments[0];return this._hi===a._hi&&this._lo===a._lo}},Ii.prototype.isZero=function(){return 0===this._hi&&0===this._lo},Ii.prototype.selfSubtract=function(){if(arguments[0]instanceof Ii){var a=arguments[0];return this.isNaN()?this:this.selfAdd(-a._hi,-a._lo)}if("number"==typeof arguments[0]){var b=arguments[0];return this.isNaN()?this:this.selfAdd(-b,0)}},Ii.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},Ii.prototype.min=function(a){return this.le(a)?this:a},Ii.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof Ii){var a=arguments[0];return this.selfDivide(a._hi,a._lo)}if("number"==typeof arguments[0]){var b=arguments[0];return this.selfDivide(b,0)}}else if(2===arguments.length){var c=arguments[0],d=arguments[1],e=null,f=null,g=null,h=null,i=null,j=null,k=null,l=null;return i=this._hi/c,j=Ii.SPLIT*i,e=j-i,l=Ii.SPLIT*c,e=j-e,f=i-e,g=l-c,k=i*c,g=l-g,h=c-g,l=e*g-k+e*h+f*g+f*h,j=(this._hi-k-l+this._lo-i*d)/c,l=i+j,this._hi=l,this._lo=i-l+j,this}},Ii.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},Ii.prototype.divide=function(){if(arguments[0]instanceof Ii){var a=arguments[0],b=null,c=null,d=null,e=null,f=null,g=null,h=null,i=null;return c=(f=this._hi/a._hi)-(b=(g=Ii.SPLIT*f)-(b=g-f)),i=b*(d=(i=Ii.SPLIT*a._hi)-(d=i-a._hi))-(h=f*a._hi)+b*(e=a._hi-d)+c*d+c*e,g=(this._hi-h-i+this._lo-f*a._lo)/a._hi,new Ii(i=f+g,f-i+g)}if("number"==typeof arguments[0]){var j=arguments[0];return ri.isNaN(j)?Ii.createNaN():Ii.copy(this).selfDivide(j,0)}},Ii.prototype.ge=function(a){return(this._hi>a._hi||this._hi===a._hi)&&this._lo>=a._lo},Ii.prototype.pow=function(a){if(0===a)return Ii.valueOf(1);var b=new Ii(this),c=Ii.valueOf(1),d=Math.abs(a);if(d>1)for(;d>0;)d%2==1&&c.selfMultiply(b),(d/=2)>0&&(b=b.sqr());else c=b;return 0>a?c.reciprocal():c},Ii.prototype.ceil=function(){if(this.isNaN())return Ii.NaN;var a=Math.ceil(this._hi),b=0;return a===this._hi&&(b=Math.ceil(this._lo)),new Ii(a,b)},Ii.prototype.compareTo=function(a){var b=a;return this._hi<b._hi?-1:this._hi>b._hi?1:this._lo<b._lo?-1:this._lo>b._lo?1:0},Ii.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},Ii.prototype.setValue=function(){if(arguments[0]instanceof Ii){var a=arguments[0];return this.init(a),this}if("number"==typeof arguments[0]){var b=arguments[0];return this.init(b),this}},Ii.prototype.max=function(a){return this.ge(a)?this:a},Ii.prototype.sqrt=function(){if(this.isZero())return Ii.valueOf(0);if(this.isNegative())return Ii.NaN;var a=1/Math.sqrt(this._hi),b=this._hi*a,c=Ii.valueOf(b),d=this.subtract(c.sqr())._hi*(.5*a);return c.add(d)},Ii.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof Ii){var a=arguments[0];return this.selfAdd(a._hi,a._lo)}if("number"==typeof arguments[0]){var b=arguments[0],c=null,d=null,e=null,f=null,g=null,h=null;return e=this._hi+b,g=e-this._hi,f=e-g,f=b-g+(this._hi-f),h=f+this._lo,c=e+h,d=h+(e-c),this._hi=c+d,this._lo=d+(c-this._hi),this}}else if(2===arguments.length){var i=arguments[0],j=arguments[1],k=null,l=null,m=null,n=null,o=null,p=null,q=null;n=this._hi+i,l=this._lo+j,o=n-(p=n-this._hi),m=l-(q=l-this._lo);var r=(k=n+(p=(o=i-p+(this._hi-o))+l))+(p=(m=j-q+(this._lo-m))+(p+(n-k))),s=p+(k-r);return this._hi=r,this._lo=s,this}},Ii.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof Ii){var a=arguments[0];return this.selfMultiply(a._hi,a._lo)}if("number"==typeof arguments[0]){var b=arguments[0];return this.selfMultiply(b,0)}}else if(2===arguments.length){var c=arguments[0],d=arguments[1],e=null,f=null,g=null,h=null,i=null,j=null;e=(i=Ii.SPLIT*this._hi)-this._hi,j=Ii.SPLIT*c,e=i-e,f=this._hi-e,g=j-c;var k=(i=this._hi*c)+(j=e*(g=j-g)-i+e*(h=c-g)+f*g+f*h+(this._hi*d+this._lo*c)),l=j+(e=i-k);return this._hi=k,this._lo=l,this}},Ii.prototype.selfSqr=function(){return this.selfMultiply(this)},Ii.prototype.floor=function(){if(this.isNaN())return Ii.NaN;var a=Math.floor(this._hi),b=0;return a===this._hi&&(b=Math.floor(this._lo)),new Ii(a,b)},Ii.prototype.negate=function(){return this.isNaN()?this:new Ii(-this._hi,-this._lo)},Ii.prototype.clone=function(){},Ii.prototype.multiply=function(){if(arguments[0]instanceof Ii){var a=arguments[0];return a.isNaN()?Ii.createNaN():Ii.copy(this).selfMultiply(a)}if("number"==typeof arguments[0]){var b=arguments[0];return ri.isNaN(b)?Ii.createNaN():Ii.copy(this).selfMultiply(b,0)}},Ii.prototype.isNaN=function(){return ri.isNaN(this._hi)},Ii.prototype.intValue=function(){return Math.trunc(this._hi)},Ii.prototype.toString=function(){var a=Ii.magnitude(this._hi);return a>=-3&&20>=a?this.toStandardNotation():this.toSciNotation()},Ii.prototype.toStandardNotation=function(){var a=this.getSpecialNumberString();if(null!==a)return a;var b=new Array(1).fill(null),c=this.extractSignificantDigits(!0,b),d=b[0]+1,e=c;if("."===c.charAt(0))e="0"+c;else if(0>d)e="0."+Ii.stringOfChar("0",-d)+c;else if(-1===c.indexOf(".")){var f=d-c.length;e=c+Ii.stringOfChar("0",f)+".0"}return this.isNegative()?"-"+e:e},Ii.prototype.reciprocal=function(){var a=null,b=null,c=null,d=null,e=null,f=null,g=null,h=null;b=(e=1/this._hi)-(a=(f=Ii.SPLIT*e)-(a=f-e)),c=(h=Ii.SPLIT*this._hi)-this._hi;var i=e+(f=(1-(g=e*this._hi)-(h=a*(c=h-c)-g+a*(d=this._hi-c)+b*c+b*d)-e*this._lo)/this._hi);return new Ii(i,e-i+f)},Ii.prototype.toSciNotation=function(){if(this.isZero())return Ii.SCI_NOT_ZERO;var a=this.getSpecialNumberString();if(null!==a)return a;var b=new Array(1).fill(null),c=this.extractSignificantDigits(!1,b),d=Ii.SCI_NOT_EXPONENT_CHAR+b[0];if("0"===c.charAt(0))throw new Error("Found leading zero: "+c);var e="";c.length>1&&(e=c.substring(1));var f=c.charAt(0)+"."+e;return this.isNegative()?"-"+f+d:f+d},Ii.prototype.abs=function(){return this.isNaN()?Ii.NaN:this.isNegative()?this.negate():new Ii(this)},Ii.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},Ii.prototype.lt=function(a){return(this._hi<a._hi||this._hi===a._hi)&&this._lo<a._lo},Ii.prototype.add=function(){if(arguments[0]instanceof Ii){var a=arguments[0];return Ii.copy(this).selfAdd(a)}if("number"==typeof arguments[0]){var b=arguments[0];return Ii.copy(this).selfAdd(b)}},Ii.prototype.init=function(){if(1===arguments.length){if("number"==typeof arguments[0]){var a=arguments[0];this._hi=a,this._lo=0}else if(arguments[0]instanceof Ii){var b=arguments[0];this._hi=b._hi,this._lo=b._lo}}else if(2===arguments.length){var c=arguments[0],d=arguments[1];this._hi=c,this._lo=d}},Ii.prototype.gt=function(a){return(this._hi>a._hi||this._hi===a._hi)&&this._lo>a._lo},Ii.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},Ii.prototype.trunc=function(){return this.isNaN()?Ii.NaN:this.isPositive()?this.floor():this.ceil()},Ii.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},Ii.prototype.interfaces_=function(){return[Ce,ti,ui]},Ii.prototype.getClass=function(){return Ii},Ii.sqr=function(a){return Ii.valueOf(a).selfMultiply(a)},Ii.valueOf=function(){if("string"==typeof arguments[0]){var a=arguments[0];return Ii.parse(a)}if("number"==typeof arguments[0]){var b=arguments[0];return new Ii(b)}},Ii.sqrt=function(a){return Ii.valueOf(a).sqrt()},Ii.parse=function(a){for(var b=0,c=a.length;Hi.isWhitespace(a.charAt(b));)b++;var d=!1;if(c>b){var e=a.charAt(b);"-"!==e&&"+"!==e||(b++,"-"===e&&(d=!0))}for(var f=new Ii,g=0,h=0,i=0;!(b>=c);){var j=a.charAt(b);if(b++,Hi.isDigit(j)){var k=j-"0";f.selfMultiply(Ii.TEN),f.selfAdd(k),g++}else{if("."!==j){if("e"===j||"E"===j){var l=a.substring(b);try{i=Gi.parseInt(l)}catch(b){throw b instanceof Error?new Error("Invalid exponent "+l+" in string "+a):b}break}throw new Error("Unexpected character '"+j+"' at position "+b+" in string "+a)}h=g}}var m=f,n=g-h-i;if(0===n)m=f;else if(n>0){var o=Ii.TEN.pow(n);m=f.divide(o)}else if(0>n){var p=Ii.TEN.pow(-n);m=f.multiply(p)}return d?m.negate():m},Ii.createNaN=function(){return new Ii(ri.NaN,ri.NaN)},Ii.copy=function(a){return new Ii(a)},Ii.magnitude=function(a){var b=Math.abs(a),c=Math.log(b)/Math.log(10),d=Math.trunc(Math.floor(c));return 10*Math.pow(10,d)<=b&&(d+=1),d},Ii.stringOfChar=function(a,b){for(var c=new Fi,d=0;b>d;d++)c.append(a);return c.toString()},Ji.PI.get=function(){return new Ii(3.141592653589793,1.2246467991473532e-16)},Ji.TWO_PI.get=function(){return new Ii(6.283185307179586,2.4492935982947064e-16)},Ji.PI_2.get=function(){return new Ii(1.5707963267948966,6.123233995736766e-17)},Ji.E.get=function(){return new Ii(2.718281828459045,1.4456468917292502e-16)},Ji.NaN.get=function(){return new Ii(ri.NaN,ri.NaN)},Ji.EPS.get=function(){return 1.23259516440783e-32},Ji.SPLIT.get=function(){return 134217729},Ji.MAX_PRINT_DIGITS.get=function(){return 32},Ji.TEN.get=function(){return Ii.valueOf(10)},Ji.ONE.get=function(){return Ii.valueOf(1)},Ji.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},Ji.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(Ii,Ji);var Ki=function(){},Li={DP_SAFE_EPSILON:{configurable:!0}};Ki.prototype.interfaces_=function(){return[]},Ki.prototype.getClass=function(){return Ki},Ki.orientationIndex=function(a,b,c){var d=Ki.orientationIndexFilter(a,b,c);if(1>=d)return d;var e=Ii.valueOf(b.x).selfAdd(-a.x),f=Ii.valueOf(b.y).selfAdd(-a.y),g=Ii.valueOf(c.x).selfAdd(-b.x),h=Ii.valueOf(c.y).selfAdd(-b.y);return e.selfMultiply(h).selfSubtract(f.selfMultiply(g)).signum()},Ki.signOfDet2x2=function(a,b,c,d){return a.multiply(d).selfSubtract(b.multiply(c)).signum()},Ki.intersection=function(a,b,c,d){var e=Ii.valueOf(d.y).selfSubtract(c.y).selfMultiply(Ii.valueOf(b.x).selfSubtract(a.x)),f=Ii.valueOf(d.x).selfSubtract(c.x).selfMultiply(Ii.valueOf(b.y).selfSubtract(a.y)),g=e.subtract(f),h=Ii.valueOf(d.x).selfSubtract(c.x).selfMultiply(Ii.valueOf(a.y).selfSubtract(c.y)),i=Ii.valueOf(d.y).selfSubtract(c.y).selfMultiply(Ii.valueOf(a.x).selfSubtract(c.x)),j=h.subtract(i).selfDivide(g).doubleValue(),k=Ii.valueOf(a.x).selfAdd(Ii.valueOf(b.x).selfSubtract(a.x).selfMultiply(j)).doubleValue(),l=Ii.valueOf(b.x).selfSubtract(a.x).selfMultiply(Ii.valueOf(a.y).selfSubtract(c.y)),m=Ii.valueOf(b.y).selfSubtract(a.y).selfMultiply(Ii.valueOf(a.x).selfSubtract(c.x)),n=l.subtract(m).selfDivide(g).doubleValue(),o=Ii.valueOf(c.y).selfAdd(Ii.valueOf(d.y).selfSubtract(c.y).selfMultiply(n)).doubleValue();return new wi(k,o)},Ki.orientationIndexFilter=function(a,b,c){var d=null,e=(a.x-c.x)*(b.y-c.y),f=(a.y-c.y)*(b.x-c.x),g=e-f;if(e>0){if(0>=f)return Ki.signum(g);d=e+f}else{if(!(0>e))return Ki.signum(g);if(f>=0)return Ki.signum(g);d=-e-f}var h=Ki.DP_SAFE_EPSILON*d;return g>=h||-g>=h?Ki.signum(g):2},Ki.signum=function(a){return a>0?1:0>a?-1:0},Li.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Ki,Li);var Mi=function(){},Ni={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Ni.X.get=function(){return 0},Ni.Y.get=function(){return 1},Ni.Z.get=function(){return 2},Ni.M.get=function(){return 3},Mi.prototype.setOrdinate=function(a,b,c){},Mi.prototype.size=function(){},Mi.prototype.getOrdinate=function(a,b){},Mi.prototype.getCoordinate=function(){},Mi.prototype.getCoordinateCopy=function(a){},Mi.prototype.getDimension=function(){},Mi.prototype.getX=function(a){},Mi.prototype.clone=function(){},Mi.prototype.expandEnvelope=function(a){},Mi.prototype.copy=function(){},Mi.prototype.getY=function(a){},Mi.prototype.toCoordinateArray=function(){},Mi.prototype.interfaces_=function(){return[ui]},Mi.prototype.getClass=function(){return Mi},Object.defineProperties(Mi,Ni);var Oi=function(){},Pi=function(a){function b(){a.call(this,"Projective point not representable on the Cartesian plane.")}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b}(Oi),Qi=function(){};Qi.arraycopy=function(a,b,c,d,e){for(var f=0,g=b;b+e>g;g++)c[d+f]=a[g],f++},Qi.getProperty=function(a){return{"line.separator":"\n"}[a]};var Ri=function Fo(){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 a=arguments[0];this.x=a.x,this.y=a.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var b=arguments[0],c=arguments[1];this.x=b,this.y=c,this.w=1}else if(arguments[0]instanceof Fo&&arguments[1]instanceof Fo){var d=arguments[0],e=arguments[1];this.x=d.y*e.w-e.y*d.w,this.y=e.x*d.w-d.x*e.w,this.w=d.x*e.y-e.x*d.y}else if(arguments[0]instanceof wi&&arguments[1]instanceof wi){var f=arguments[0],g=arguments[1];this.x=f.y-g.y,this.y=g.x-f.x,this.w=f.x*g.y-g.x*f.y}}else if(3===arguments.length){var h=arguments[0],i=arguments[1],j=arguments[2];this.x=h,this.y=i,this.w=j}else if(4===arguments.length){var k=arguments[0],l=arguments[1],m=arguments[2],n=arguments[3],o=k.y-l.y,p=l.x-k.x,q=k.x*l.y-l.x*k.y,r=m.y-n.y,s=n.x-m.x,t=m.x*n.y-n.x*m.y;this.x=p*t-s*q,this.y=r*q-o*t,this.w=o*s-r*p}};Ri.prototype.getY=function(){var a=this.y/this.w;if(ri.isNaN(a)||ri.isInfinite(a))throw new Pi;return a},Ri.prototype.getX=function(){var a=this.x/this.w;if(ri.isNaN(a)||ri.isInfinite(a))throw new Pi;return a},Ri.prototype.getCoordinate=function(){var a=new wi;return a.x=this.getX(),a.y=this.getY(),a},Ri.prototype.interfaces_=function(){return[]},Ri.prototype.getClass=function(){return Ri},Ri.intersection=function(a,b,c,d){var e=a.y-b.y,f=b.x-a.x,g=a.x*b.y-b.x*a.y,h=c.y-d.y,i=d.x-c.x,j=c.x*d.y-d.x*c.y,k=e*i-h*f,l=(f*j-i*g)/k,m=(h*g-e*j)/k;if(ri.isNaN(l)||ri.isInfinite(l)||ri.isNaN(m)||ri.isInfinite(m))throw new Pi;return new wi(l,m)};var Si=function Go(){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 wi){var a=arguments[0];this.init(a.x,a.x,a.y,a.y)}else if(arguments[0]instanceof Go){var b=arguments[0];this.init(b)}}else if(2===arguments.length){var c=arguments[0],d=arguments[1];this.init(c.x,d.x,c.y,d.y)}else if(4===arguments.length){var e=arguments[0],f=arguments[1],g=arguments[2],h=arguments[3];this.init(e,f,g,h)}},Ti={serialVersionUID:{configurable:!0}};Si.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Si.prototype.equals=function(a){if(!(a instanceof Si))return!1;var b=a;return this.isNull()?b.isNull():this._maxx===b.getMaxX()&&this._maxy===b.getMaxY()&&this._minx===b.getMinX()&&this._miny===b.getMinY()},Si.prototype.intersection=function(a){if(this.isNull()||a.isNull()||!this.intersects(a))return new Si;var b=this._minx>a._minx?this._minx:a._minx,c=this._miny>a._miny?this._miny:a._miny,d=this._maxx<a._maxx?this._maxx:a._maxx,e=this._maxy<a._maxy?this._maxy:a._maxy;return new Si(b,d,c,e)},Si.prototype.isNull=function(){return this._maxx<this._minx},Si.prototype.getMaxX=function(){return this._maxx},Si.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof wi){var a=arguments[0];return this.covers(a.x,a.y)}if(arguments[0]instanceof Si){var b=arguments[0];return!this.isNull()&&!b.isNull()&&b.getMinX()>=this._minx&&b.getMaxX()<=this._maxx&&b.getMinY()>=this._miny&&b.getMaxY()<=this._maxy}}else if(2===arguments.length){var c=arguments[0],d=arguments[1];return!this.isNull()&&c>=this._minx&&c<=this._maxx&&d>=this._miny&&d<=this._maxy}},Si.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof Si){var a=arguments[0];return!this.isNull()&&!a.isNull()&&!(a._minx>this._maxx||a._maxx<this._minx||a._miny>this._maxy||a._maxy<this._miny)}if(arguments[0]instanceof wi){var b=arguments[0];return this.intersects(b.x,b.y)}}else if(2===arguments.length){var c=arguments[0],d=arguments[1];return!this.isNull()&&!(c>this._maxx||c<this._minx||d>this._maxy||d<this._miny)}},Si.prototype.getMinY=function(){return this._miny},Si.prototype.getMinX=function(){return this._minx},Si.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof wi){var a=arguments[0];this.expandToInclude(a.x,a.y)}else if(arguments[0]instanceof Si){var b=arguments[0];if(b.isNull())return null;this.isNull()?(this._minx=b.getMinX(),this._maxx=b.getMaxX(),this._miny=b.getMinY(),this._maxy=b.getMaxY()):(b._minx<this._minx&&(this._minx=b._minx),b._maxx>this._maxx&&(this._maxx=b._maxx),b._miny<this._miny&&(this._miny=b._miny),b._maxy>this._maxy&&(this._maxy=b._maxy))}}else if(2===arguments.length){var c=arguments[0],d=arguments[1];this.isNull()?(this._minx=c,this._maxx=c,this._miny=d,this._maxy=d):(c<this._minx&&(this._minx=c),c>this._maxx&&(this._maxx=c),d<this._miny&&(this._miny=d),d>this._maxy&&(this._maxy=d))}},Si.prototype.minExtent=function(){if(this.isNull())return 0;var a=this.getWidth(),b=this.getHeight();return b>a?a:b},Si.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Si.prototype.compareTo=function(a){var b=a;return this.isNull()?b.isNull()?0:-1:b.isNull()?1:this._minx<b._minx?-1:this._minx>b._minx?1:this._miny<b._miny?-1:this._miny>b._miny?1:this._maxx<b._maxx?-1:this._maxx>b._maxx?1:this._maxy<b._maxy?-1:this._maxy>b._maxy?1:0},Si.prototype.translate=function(a,b){return this.isNull()?null:void this.init(this.getMinX()+a,this.getMaxX()+a,this.getMinY()+b,this.getMaxY()+b)},Si.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Si.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Si.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Si.prototype.maxExtent=function(){if(this.isNull())return 0;var a=this.getWidth(),b=this.getHeight();return a>b?a:b},Si.prototype.expandBy=function(){if(1===arguments.length){var a=arguments[0];this.expandBy(a,a)}else if(2===arguments.length){var b=arguments[0],c=arguments[1];if(this.isNull())return null;this._minx-=b,this._maxx+=b,this._miny-=c,this._maxy+=c,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},Si.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof Si){var a=arguments[0];return this.covers(a)}if(arguments[0]instanceof wi){var b=arguments[0];return this.covers(b)}}else if(2===arguments.length){var c=arguments[0],d=arguments[1];return this.covers(c,d)}},Si.prototype.centre=function(){return this.isNull()?null:new wi((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Si.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof wi){var a=arguments[0];this.init(a.x,a.x,a.y,a.y)}else if(arguments[0]instanceof Si){var b=arguments[0];this._minx=b._minx,this._maxx=b._maxx,this._miny=b._miny,this._maxy=b._maxy}}else if(2===arguments.length){var c=arguments[0],d=arguments[1];this.init(c.x,d.x,c.y,d.y)}else if(4===arguments.length){var e=arguments[0],f=arguments[1],g=arguments[2],h=arguments[3];f>e?(this._minx=e,this._maxx=f):(this._minx=f,this._maxx=e),h>g?(this._miny=g,this._maxy=h):(this._miny=h,this._maxy=g)}},Si.prototype.getMaxY=function(){return this._maxy},Si.prototype.distance=function(a){if(this.intersects(a))return 0;var b=0;this._maxx<a._minx?b=a._minx-this._maxx:this._minx>a._maxx&&(b=this._minx-a._maxx);var c=0;return this._maxy<a._miny?c=a._miny-this._maxy:this._miny>a._maxy&&(c=this._miny-a._maxy),0===b?c:0===c?b:Math.sqrt(b*b+c*c)},Si.prototype.hashCode=function(){var a=17;return a=37*a+wi.hashCode(this._minx),a=37*a+wi.hashCode(this._maxx),a=37*a+wi.hashCode(this._miny),a=37*a+wi.hashCode(this._maxy)},Si.prototype.interfaces_=function(){return[ti,Ce]},Si.prototype.getClass=function(){return Si},Si.intersects=function(){if(3===arguments.length){var a=arguments[0],b=arguments[1],c=arguments[2];return c.x>=(a.x<b.x?a.x:b.x)&&c.x<=(a.x>b.x?a.x:b.x)&&c.y>=(a.y<b.y?a.y:b.y)&&c.y<=(a.y>b.y?a.y:b.y)}if(4===arguments.length){var d=arguments[0],e=arguments[1],f=arguments[2],g=arguments[3],h=Math.min(f.x,g.x),i=Math.max(f.x,g.x),j=Math.min(d.x,e.x),k=Math.max(d.x,e.x);return!(j>i||h>k||(h=Math.min(f.y,g.y),i=Math.max(f.y,g.y),j=Math.min(d.y,e.y),k=Math.max(d.y,e.y),j>i||h>k))}},Ti.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(Si,Ti);var Ui={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,emptyTypeStr:/^\s*(\w+)\s*EMPTY\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},Vi=function(a){this.geometryFactory=a||new qk};Vi.prototype.read=function(a){var b,c,d;a=a.replace(/[\n\r]/g," ");var e=Ui.typeStr.exec(a);if(-1!==a.search("EMPTY")&&((e=Ui.emptyTypeStr.exec(a))[2]=void 0),e&&(c=e[1].toLowerCase(),d=e[2],Xi[c]&&(b=Xi[c].apply(this,[d]))),void 0===b)throw new Error("Could not parse WKT "+a);return b},Vi.prototype.write=function(a){return this.extractGeometry(a)},Vi.prototype.extractGeometry=function(a){var b=a.getGeometryType().toLowerCase();if(!Wi[b])return null;var c=b.toUpperCase();return a.isEmpty()?c+" EMPTY":c+"("+Wi[b].apply(this,[a])+")"};var Wi={coordinate:function(a){return a.x+" "+a.y},point:function(a){return Wi.coordinate.call(this,a._coordinates._coordinates[0])},multipoint:function(a){for(var b=[],c=0,d=a._geometries.length;d>c;++c)b.push("("+Wi.point.apply(this,[a._geometries[c]])+")");return b.join(",")},linestring:function(a){for(var b=[],c=0,d=a._points._coordinates.length;d>c;++c)b.push(Wi.coordinate.apply(this,[a._points._coordinates[c]]));return b.join(",")},linearring:function(a){for(var b=[],c=0,d=a._points._coordinates.length;d>c;++c)b.push(Wi.coordinate.apply(this,[a._points._coordinates[c]]));return b.join(",")},multilinestring:function(a){for(var b=[],c=0,d=a._geometries.length;d>c;++c)b.push("("+Wi.linestring.apply(this,[a._geometries[c]])+")");return b.join(",")},polygon:function(a){var b=[];b.push("("+Wi.linestring.apply(this,[a._shell])+")");for(var c=0,d=a._holes.length;d>c;++c)b.push("("+Wi.linestring.apply(this,[a._holes[c]])+")");return b.join(",")},multipolygon:function(a){for(var b=[],c=0,d=a._geometries.length;d>c;++c)b.push("("+Wi.polygon.apply(this,[a._geometries[c]])+")");return b.join(",")},geometrycollection:function(a){for(var b=[],c=0,d=a._geometries.length;d>c;++c)b.push(this.extractGeometry(a._geometries[c]));return b.join(",")}},Xi={point:function(a){if(void 0===a)return this.geometryFactory.createPoint();var b=a.trim().split(Ui.spaces);return this.geometryFactory.createPoint(new wi(Number.parseFloat(b[0]),Number.parseFloat(b[1])))},multipoint:function(a){if(void 0===a)return this.geometryFactory.createMultiPoint();for(var b,c=a.trim().split(","),d=[],e=0,f=c.length;f>e;++e)b=c[e].replace(Ui.trimParens,"$1"),d.push(Xi.point.apply(this,[b]));return this.geometryFactory.createMultiPoint(d)},linestring:function(a){if(void 0===a)return this.geometryFactory.createLineString();
for(var b,c=a.trim().split(","),d=[],e=0,f=c.length;f>e;++e)b=c[e].trim().split(Ui.spaces),d.push(new wi(Number.parseFloat(b[0]),Number.parseFloat(b[1])));return this.geometryFactory.createLineString(d)},linearring:function(a){if(void 0===a)return this.geometryFactory.createLinearRing();for(var b,c=a.trim().split(","),d=[],e=0,f=c.length;f>e;++e)b=c[e].trim().split(Ui.spaces),d.push(new wi(Number.parseFloat(b[0]),Number.parseFloat(b[1])));return this.geometryFactory.createLinearRing(d)},multilinestring:function(a){if(void 0===a)return this.geometryFactory.createMultiLineString();for(var b,c=a.trim().split(Ui.parenComma),d=[],e=0,f=c.length;f>e;++e)b=c[e].replace(Ui.trimParens,"$1"),d.push(Xi.linestring.apply(this,[b]));return this.geometryFactory.createMultiLineString(d)},polygon:function(a){if(void 0===a)return this.geometryFactory.createPolygon();for(var b,c,d,e,f=a.trim().split(Ui.parenComma),g=[],h=0,i=f.length;i>h;++h)b=f[h].replace(Ui.trimParens,"$1"),c=Xi.linestring.apply(this,[b]),d=this.geometryFactory.createLinearRing(c._points),0===h?e=d:g.push(d);return this.geometryFactory.createPolygon(e,g)},multipolygon:function(a){if(void 0===a)return this.geometryFactory.createMultiPolygon();for(var b,c=a.trim().split(Ui.doubleParenComma),d=[],e=0,f=c.length;f>e;++e)b=c[e].replace(Ui.trimParens,"$1"),d.push(Xi.polygon.apply(this,[b]));return this.geometryFactory.createMultiPolygon(d)},geometrycollection:function(a){if(void 0===a)return this.geometryFactory.createGeometryCollection();for(var b=(a=a.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),c=[],d=0,e=b.length;e>d;++d)c.push(this.read(b[d]));return this.geometryFactory.createGeometryCollection(c)}},Yi=function(a){this.parser=new Vi(a)};Yi.prototype.write=function(a){return this.parser.write(a)},Yi.toLineString=function(a,b){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+a.x+" "+a.y+", "+b.x+" "+b.y+" )"};var Zi=function(a){function b(b){a.call(this,b),this.name="RuntimeException",this.message=b,this.stack=(new a).stack}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b}(Error),$i=function(a){function b(){if(a.call(this),0===arguments.length)a.call(this);else if(1===arguments.length){var b=arguments[0];a.call(this,b)}}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b}(Zi),_i=function(){};_i.prototype.interfaces_=function(){return[]},_i.prototype.getClass=function(){return _i},_i.shouldNeverReachHere=function(){if(0===arguments.length)_i.shouldNeverReachHere(null);else if(1===arguments.length){var a=arguments[0];throw new $i("Should never reach here"+(null!==a?": "+a:""))}},_i.isTrue=function(){var a,b;if(1===arguments.length)a=arguments[0],_i.isTrue(a,null);else if(2===arguments.length&&(a=arguments[0],b=arguments[1],!a))throw null===b?new $i:new $i(b)},_i.equals=function(){var a,b,c;if(2===arguments.length)a=arguments[0],b=arguments[1],_i.equals(a,b,null);else if(3===arguments.length&&(a=arguments[0],b=arguments[1],c=arguments[2],!b.equals(a)))throw new $i("Expected "+a+" but encountered "+b+(null!==c?": "+c:""))};var aj=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 wi,this._intPt[1]=new wi,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},bj={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};aj.prototype.getIndexAlongSegment=function(a,b){return this.computeIntLineIndex(),this._intLineIndex[a][b]},aj.prototype.getTopologySummary=function(){var a=new Fi;return this.isEndPoint()&&a.append(" endpoint"),this._isProper&&a.append(" proper"),this.isCollinear()&&a.append(" collinear"),a.toString()},aj.prototype.computeIntersection=function(a,b,c,d){this._inputLines[0][0]=a,this._inputLines[0][1]=b,this._inputLines[1][0]=c,this._inputLines[1][1]=d,this._result=this.computeIntersect(a,b,c,d)},aj.prototype.getIntersectionNum=function(){return this._result},aj.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 a=arguments[0];this.getEdgeDistance(a,0)>this.getEdgeDistance(a,1)?(this._intLineIndex[a][0]=0,this._intLineIndex[a][1]=1):(this._intLineIndex[a][0]=1,this._intLineIndex[a][1]=0)}},aj.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},aj.prototype.setPrecisionModel=function(a){this._precisionModel=a},aj.prototype.isInteriorIntersection=function(){if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var a=arguments[0],b=0;b<this._result;b++)if(!this._intPt[b].equals2D(this._inputLines[a][0])&&!this._intPt[b].equals2D(this._inputLines[a][1]))return!0;return!1}},aj.prototype.getIntersection=function(a){return this._intPt[a]},aj.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},aj.prototype.hasIntersection=function(){return this._result!==aj.NO_INTERSECTION},aj.prototype.getEdgeDistance=function(a,b){return aj.computeEdgeDistance(this._intPt[b],this._inputLines[a][0],this._inputLines[a][1])},aj.prototype.isCollinear=function(){return this._result===aj.COLLINEAR_INTERSECTION},aj.prototype.toString=function(){return Yi.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Yi.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},aj.prototype.getEndpoint=function(a,b){return this._inputLines[a][b]},aj.prototype.isIntersection=function(a){for(var b=0;b<this._result;b++)if(this._intPt[b].equals2D(a))return!0;return!1},aj.prototype.getIntersectionAlongSegment=function(a,b){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[a][b]]},aj.prototype.interfaces_=function(){return[]},aj.prototype.getClass=function(){return aj},aj.computeEdgeDistance=function(a,b,c){var d=Math.abs(c.x-b.x),e=Math.abs(c.y-b.y),f=-1;if(a.equals(b))f=0;else if(a.equals(c))f=d>e?d:e;else{var g=Math.abs(a.x-b.x),h=Math.abs(a.y-b.y);0!==(f=d>e?g:h)||a.equals(b)||(f=Math.max(g,h))}return _i.isTrue(!(0===f&&!a.equals(b)),"Bad distance calculation"),f},aj.nonRobustComputeEdgeDistance=function(a,b,c){var d=a.x-b.x,e=a.y-b.y,f=Math.sqrt(d*d+e*e);return _i.isTrue(!(0===f&&!a.equals(b)),"Invalid distance calculation"),f},bj.DONT_INTERSECT.get=function(){return 0},bj.DO_INTERSECT.get=function(){return 1},bj.COLLINEAR.get=function(){return 2},bj.NO_INTERSECTION.get=function(){return 0},bj.POINT_INTERSECTION.get=function(){return 1},bj.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(aj,bj);var cj=function(a){function b(){a.apply(this,arguments)}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.isInSegmentEnvelopes=function(a){var b=new Si(this._inputLines[0][0],this._inputLines[0][1]),c=new Si(this._inputLines[1][0],this._inputLines[1][1]);return b.contains(a)&&c.contains(a)},b.prototype.computeIntersection=function(){if(3!==arguments.length)return a.prototype.computeIntersection.apply(this,arguments);var b=arguments[0],c=arguments[1],d=arguments[2];return this._isProper=!1,Si.intersects(c,d,b)&&0===fj.orientationIndex(c,d,b)&&0===fj.orientationIndex(d,c,b)?(this._isProper=!0,(b.equals(c)||b.equals(d))&&(this._isProper=!1),this._result=a.POINT_INTERSECTION,null):void(this._result=a.NO_INTERSECTION)},b.prototype.normalizeToMinimum=function(a,b,c,d,e){e.x=this.smallestInAbsValue(a.x,b.x,c.x,d.x),e.y=this.smallestInAbsValue(a.y,b.y,c.y,d.y),a.x-=e.x,a.y-=e.y,b.x-=e.x,b.y-=e.y,c.x-=e.x,c.y-=e.y,d.x-=e.x,d.y-=e.y},b.prototype.safeHCoordinateIntersection=function(a,c,d,e){var f=null;try{f=Ri.intersection(a,c,d,e)}catch(g){if(!(g instanceof Pi))throw g;f=b.nearestEndpoint(a,c,d,e)}return f},b.prototype.intersection=function(a,c,d,e){var f=this.intersectionWithNormalization(a,c,d,e);return this.isInSegmentEnvelopes(f)||(f=new wi(b.nearestEndpoint(a,c,d,e))),null!==this._precisionModel&&this._precisionModel.makePrecise(f),f},b.prototype.smallestInAbsValue=function(a,b,c,d){var e=a,f=Math.abs(e);return Math.abs(b)<f&&(e=b,f=Math.abs(b)),Math.abs(c)<f&&(e=c,f=Math.abs(c)),Math.abs(d)<f&&(e=d),e},b.prototype.checkDD=function(a,b,c,d,e){var f=Ki.intersection(a,b,c,d),g=this.isInSegmentEnvelopes(f);Qi.out.println("DD in env = "+g+"  --------------------- "+f),e.distance(f)>1e-4&&Qi.out.println("Distance = "+e.distance(f))},b.prototype.intersectionWithNormalization=function(a,b,c,d){var e=new wi(a),f=new wi(b),g=new wi(c),h=new wi(d),i=new wi;this.normalizeToEnvCentre(e,f,g,h,i);var j=this.safeHCoordinateIntersection(e,f,g,h);return j.x+=i.x,j.y+=i.y,j},b.prototype.computeCollinearIntersection=function(b,c,d,e){var f=Si.intersects(b,c,d),g=Si.intersects(b,c,e),h=Si.intersects(d,e,b),i=Si.intersects(d,e,c);return f&&g?(this._intPt[0]=d,this._intPt[1]=e,a.COLLINEAR_INTERSECTION):h&&i?(this._intPt[0]=b,this._intPt[1]=c,a.COLLINEAR_INTERSECTION):f&&h?(this._intPt[0]=d,this._intPt[1]=b,!d.equals(b)||g||i?a.COLLINEAR_INTERSECTION:a.POINT_INTERSECTION):f&&i?(this._intPt[0]=d,this._intPt[1]=c,!d.equals(c)||g||h?a.COLLINEAR_INTERSECTION:a.POINT_INTERSECTION):g&&h?(this._intPt[0]=e,this._intPt[1]=b,!e.equals(b)||f||i?a.COLLINEAR_INTERSECTION:a.POINT_INTERSECTION):g&&i?(this._intPt[0]=e,this._intPt[1]=c,!e.equals(c)||f||h?a.COLLINEAR_INTERSECTION:a.POINT_INTERSECTION):a.NO_INTERSECTION},b.prototype.normalizeToEnvCentre=function(a,b,c,d,e){var f=a.x<b.x?a.x:b.x,g=a.y<b.y?a.y:b.y,h=a.x>b.x?a.x:b.x,i=a.y>b.y?a.y:b.y,j=c.x<d.x?c.x:d.x,k=c.y<d.y?c.y:d.y,l=c.x>d.x?c.x:d.x,m=c.y>d.y?c.y:d.y,n=((f>j?f:j)+(l>h?h:l))/2,o=((g>k?g:k)+(m>i?i:m))/2;e.x=n,e.y=o,a.x-=e.x,a.y-=e.y,b.x-=e.x,b.y-=e.y,c.x-=e.x,c.y-=e.y,d.x-=e.x,d.y-=e.y},b.prototype.computeIntersect=function(b,c,d,e){if(this._isProper=!1,!Si.intersects(b,c,d,e))return a.NO_INTERSECTION;var f=fj.orientationIndex(b,c,d),g=fj.orientationIndex(b,c,e);if(f>0&&g>0||0>f&&0>g)return a.NO_INTERSECTION;var h=fj.orientationIndex(d,e,b),i=fj.orientationIndex(d,e,c);return h>0&&i>0||0>h&&0>i?a.NO_INTERSECTION:0===f&&0===g&&0===h&&0===i?this.computeCollinearIntersection(b,c,d,e):(0===f||0===g||0===h||0===i?(this._isProper=!1,b.equals2D(d)||b.equals2D(e)?this._intPt[0]=b:c.equals2D(d)||c.equals2D(e)?this._intPt[0]=c:0===f?this._intPt[0]=new wi(d):0===g?this._intPt[0]=new wi(e):0===h?this._intPt[0]=new wi(b):0===i&&(this._intPt[0]=new wi(c))):(this._isProper=!0,this._intPt[0]=this.intersection(b,c,d,e)),a.POINT_INTERSECTION)},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b.nearestEndpoint=function(a,b,c,d){var e=a,f=fj.distancePointLine(a,c,d),g=fj.distancePointLine(b,c,d);return f>g&&(f=g,e=b),(g=fj.distancePointLine(c,a,b))<f&&(f=g,e=c),(g=fj.distancePointLine(d,a,b))<f&&(f=g,e=d),e},b}(aj),dj=function(){};dj.prototype.interfaces_=function(){return[]},dj.prototype.getClass=function(){return dj},dj.orientationIndex=function(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=c.x-b.x,g=c.y-b.y;return dj.signOfDet2x2(d,e,f,g)},dj.signOfDet2x2=function(a,b,c,d){var e=null,f=null,g=null;if(e=1,0===a||0===d)return 0===b||0===c?0:b>0?c>0?-e:e:c>0?e:-e;if(0===b||0===c)return d>0?a>0?e:-e:a>0?-e:e;if(b>0?d>0?d>=b||(e=-e,f=a,a=c,c=f,f=b,b=d,d=f):-d>=b?(e=-e,c=-c,d=-d):(f=a,a=-c,c=f,f=b,b=-d,d=f):d>0?d>=-b?(e=-e,a=-a,b=-b):(f=-a,a=c,c=f,f=-b,b=d,d=f):b>=d?(a=-a,b=-b,c=-c,d=-d):(e=-e,f=-a,a=-c,c=f,f=-b,b=-d,d=f),a>0){if(!(c>0))return e;if(!(c>=a))return e}else{if(c>0)return-e;if(!(a>=c))return-e;e=-e,a=-a,c=-c}for(;;){if(g=Math.floor(c/a),c-=g*a,(d-=g*b)<0)return-e;if(d>b)return e;if(a>c+c){if(d+d>b)return e}else{if(b>d+d)return-e;c=a-c,d=b-d,e=-e}if(0===d)return 0===c?0:-e;if(0===c)return e;if(g=Math.floor(a/c),a-=g*c,(b-=g*d)<0)return e;if(b>d)return-e;if(c>a+a){if(b+b>d)return-e}else{if(d>b+b)return e;a=c-a,b=d-b,e=-e}if(0===b)return 0===a?0:e;if(0===a)return-e}};var ej=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var a=arguments[0];this._p=a};ej.prototype.countSegment=function(a,b){if(a.x<this._p.x&&b.x<this._p.x)return null;if(this._p.x===b.x&&this._p.y===b.y)return this._isPointOnSegment=!0,null;if(a.y===this._p.y&&b.y===this._p.y){var c=a.x,d=b.x;return c>d&&(c=b.x,d=a.x),this._p.x>=c&&this._p.x<=d&&(this._isPointOnSegment=!0),null}if(a.y>this._p.y&&b.y<=this._p.y||b.y>this._p.y&&a.y<=this._p.y){var e=a.x-this._p.x,f=a.y-this._p.y,g=b.x-this._p.x,h=b.y-this._p.y,i=dj.signOfDet2x2(e,f,g,h);if(0===i)return this._isPointOnSegment=!0,null;f>h&&(i=-i),i>0&&this._crossingCount++}},ej.prototype.isPointInPolygon=function(){return this.getLocation()!==Ai.EXTERIOR},ej.prototype.getLocation=function(){return this._isPointOnSegment?Ai.BOUNDARY:this._crossingCount%2==1?Ai.INTERIOR:Ai.EXTERIOR},ej.prototype.isOnSegment=function(){return this._isPointOnSegment},ej.prototype.interfaces_=function(){return[]},ej.prototype.getClass=function(){return ej},ej.locatePointInRing=function(){if(arguments[0]instanceof wi&&Ci(arguments[1],Mi)){for(var a=arguments[0],b=arguments[1],c=new ej(a),d=new wi,e=new wi,f=1;f<b.size();f++)if(b.getCoordinate(f,d),b.getCoordinate(f-1,e),c.countSegment(d,e),c.isOnSegment())return c.getLocation();return c.getLocation()}if(arguments[0]instanceof wi&&arguments[1]instanceof Array){for(var g=arguments[0],h=arguments[1],i=new ej(g),j=1;j<h.length;j++){var k=h[j],l=h[j-1];if(i.countSegment(k,l),i.isOnSegment())return i.getLocation()}return i.getLocation()}};var fj=function(){},gj={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};fj.prototype.interfaces_=function(){return[]},fj.prototype.getClass=function(){return fj},fj.orientationIndex=function(a,b,c){return Ki.orientationIndex(a,b,c)},fj.signedArea=function(){if(arguments[0]instanceof Array){var a=arguments[0];if(a.length<3)return 0;for(var b=0,c=a[0].x,d=1;d<a.length-1;d++){var e=a[d].x-c,f=a[d+1].y;b+=e*(a[d-1].y-f)}return b/2}if(Ci(arguments[0],Mi)){var g=arguments[0],h=g.size();if(3>h)return 0;var i=new wi,j=new wi,k=new wi;g.getCoordinate(0,j),g.getCoordinate(1,k);var l=j.x;k.x-=l;for(var m=0,n=1;h-1>n;n++)i.y=j.y,j.x=k.x,j.y=k.y,g.getCoordinate(n+1,k),k.x-=l,m+=j.x*(i.y-k.y);return m/2}},fj.distanceLineLine=function(a,b,c,d){if(a.equals(b))return fj.distancePointLine(a,c,d);if(c.equals(d))return fj.distancePointLine(d,a,b);var e=!1;if(Si.intersects(a,b,c,d)){var f=(b.x-a.x)*(d.y-c.y)-(b.y-a.y)*(d.x-c.x);if(0===f)e=!0;else{var g=(a.y-c.y)*(d.x-c.x)-(a.x-c.x)*(d.y-c.y),h=((a.y-c.y)*(b.x-a.x)-(a.x-c.x)*(b.y-a.y))/f,i=g/f;(0>i||i>1||0>h||h>1)&&(e=!0)}}else e=!0;return e?Di.min(fj.distancePointLine(a,c,d),fj.distancePointLine(b,c,d),fj.distancePointLine(c,a,b),fj.distancePointLine(d,a,b)):0},fj.isPointInRing=function(a,b){return fj.locatePointInRing(a,b)!==Ai.EXTERIOR},fj.computeLength=function(a){var b=a.size();if(1>=b)return 0;var c=0,d=new wi;a.getCoordinate(0,d);for(var e=d.x,f=d.y,g=1;b>g;g++){a.getCoordinate(g,d);var h=d.x,i=d.y,j=h-e,k=i-f;c+=Math.sqrt(j*j+k*k),e=h,f=i}return c},fj.isCCW=function(a){var b=a.length-1;if(3>b)throw new qi("Ring has fewer than 4 points, so orientation cannot be determined");for(var c=a[0],d=0,e=1;b>=e;e++){var f=a[e];f.y>c.y&&(c=f,d=e)}var g=d;do(g-=1)<0&&(g=b);while(a[g].equals2D(c)&&g!==d);var h=d;do h=(h+1)%b;while(a[h].equals2D(c)&&h!==d);var i=a[g],j=a[h];if(i.equals2D(c)||j.equals2D(c)||i.equals2D(j))return!1;var k=fj.computeOrientation(i,c,j),l=!1;return l=0===k?i.x>j.x:k>0},fj.locatePointInRing=function(a,b){return ej.locatePointInRing(a,b)},fj.distancePointLinePerpendicular=function(a,b,c){var d=(c.x-b.x)*(c.x-b.x)+(c.y-b.y)*(c.y-b.y),e=((b.y-a.y)*(c.x-b.x)-(b.x-a.x)*(c.y-b.y))/d;return Math.abs(e)*Math.sqrt(d)},fj.computeOrientation=function(a,b,c){return fj.orientationIndex(a,b,c)},fj.distancePointLine=function(){if(2===arguments.length){var a=arguments[0],b=arguments[1];if(0===b.length)throw new qi("Line array must contain at least one vertex");for(var c=a.distance(b[0]),d=0;d<b.length-1;d++){var e=fj.distancePointLine(a,b[d],b[d+1]);c>e&&(c=e)}return c}if(3===arguments.length){var f=arguments[0],g=arguments[1],h=arguments[2];if(g.x===h.x&&g.y===h.y)return f.distance(g);var i=(h.x-g.x)*(h.x-g.x)+(h.y-g.y)*(h.y-g.y),j=((f.x-g.x)*(h.x-g.x)+(f.y-g.y)*(h.y-g.y))/i;if(0>=j)return f.distance(g);if(j>=1)return f.distance(h);var k=((g.y-f.y)*(h.x-g.x)-(g.x-f.x)*(h.y-g.y))/i;return Math.abs(k)*Math.sqrt(i)}},fj.isOnLine=function(a,b){for(var c=new cj,d=1;d<b.length;d++){var e=b[d-1],f=b[d];if(c.computeIntersection(a,e,f),c.hasIntersection())return!0}return!1},gj.CLOCKWISE.get=function(){return-1},gj.RIGHT.get=function(){return fj.CLOCKWISE},gj.COUNTERCLOCKWISE.get=function(){return 1},gj.LEFT.get=function(){return fj.COUNTERCLOCKWISE},gj.COLLINEAR.get=function(){return 0},gj.STRAIGHT.get=function(){return fj.COLLINEAR},Object.defineProperties(fj,gj);var hj=function(){};hj.prototype.filter=function(a){},hj.prototype.interfaces_=function(){return[]},hj.prototype.getClass=function(){return hj};var ij=function(){var a=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=a,this._SRID=a.getSRID()},jj={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}};ij.prototype.isGeometryCollection=function(){return this.getSortIndex()===ij.SORTINDEX_GEOMETRYCOLLECTION},ij.prototype.getFactory=function(){return this._factory},ij.prototype.getGeometryN=function(a){return this},ij.prototype.getArea=function(){return 0},ij.prototype.isRectangle=function(){return!1},ij.prototype.equals=function(){if(arguments[0]instanceof ij){var a=arguments[0];return null!==a&&this.equalsTopo(a)}if(arguments[0]instanceof Object){var b=arguments[0];if(!(b instanceof ij))return!1;var c=b;return this.equalsExact(c)}},ij.prototype.equalsExact=function(a){return this===a||this.equalsExact(a,0)},ij.prototype.geometryChanged=function(){this.apply(ij.geometryChangedFilter)},ij.prototype.geometryChangedAction=function(){this._envelope=null},ij.prototype.equalsNorm=function(a){return null!==a&&this.norm().equalsExact(a.norm())},ij.prototype.getLength=function(){return 0},ij.prototype.getNumGeometries=function(){return 1},ij.prototype.compareTo=function(){if(1===arguments.length){var a=arguments[0],b=a;return this.getSortIndex()!==b.getSortIndex()?this.getSortIndex()-b.getSortIndex():this.isEmpty()&&b.isEmpty()?0:this.isEmpty()?-1:b.isEmpty()?1:this.compareToSameClass(a)}if(2===arguments.length){var c=arguments[0],d=arguments[1];return this.getSortIndex()!==c.getSortIndex()?this.getSortIndex()-c.getSortIndex():this.isEmpty()&&c.isEmpty()?0:this.isEmpty()?-1:c.isEmpty()?1:this.compareToSameClass(c,d)}},ij.prototype.getUserData=function(){return this._userData},ij.prototype.getSRID=function(){return this._SRID},ij.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},ij.prototype.checkNotGeometryCollection=function(a){if(a.getSortIndex()===ij.SORTINDEX_GEOMETRYCOLLECTION)throw new qi("This method does not support GeometryCollection arguments")},ij.prototype.equal=function(a,b,c){return 0===c?a.equals(b):a.distance(b)<=c},ij.prototype.norm=function(){var a=this.copy();return a.normalize(),a},ij.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},ij.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new Si(this._envelope)},ij.prototype.setSRID=function(a){this._SRID=a},ij.prototype.setUserData=function(a){this._userData=a},ij.prototype.compare=function(a,b){for(var c=a.iterator(),d=b.iterator();c.hasNext()&&d.hasNext();){var e=c.next(),f=d.next(),g=e.compareTo(f);if(0!==g)return g}return c.hasNext()?1:d.hasNext()?-1:0},ij.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},ij.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===ij.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===ij.SORTINDEX_MULTIPOINT||this.getSortIndex()===ij.SORTINDEX_MULTILINESTRING||this.getSortIndex()===ij.SORTINDEX_MULTIPOLYGON},ij.prototype.interfaces_=function(){return[ui,ti,Ce]},ij.prototype.getClass=function(){return ij},ij.hasNonEmptyElements=function(a){for(var b=0;b<a.length;b++)if(!a[b].isEmpty())return!0;return!1},ij.hasNullElements=function(a){for(var b=0;b<a.length;b++)if(null===a[b])return!0;return!1},jj.serialVersionUID.get=function(){return 0x799ea46522854c00},jj.SORTINDEX_POINT.get=function(){return 0},jj.SORTINDEX_MULTIPOINT.get=function(){return 1},jj.SORTINDEX_LINESTRING.get=function(){return 2},jj.SORTINDEX_LINEARRING.get=function(){return 3},jj.SORTINDEX_MULTILINESTRING.get=function(){return 4},jj.SORTINDEX_POLYGON.get=function(){return 5},jj.SORTINDEX_MULTIPOLYGON.get=function(){return 6},jj.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},jj.geometryChangedFilter.get=function(){return kj},Object.defineProperties(ij,jj);var kj=function(){};kj.interfaces_=function(){return[hj]},kj.filter=function(a){a.geometryChangedAction()};var lj=function(){};lj.prototype.filter=function(a){},lj.prototype.interfaces_=function(){return[]},lj.prototype.getClass=function(){return lj};var mj=function(){},nj={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}};mj.prototype.isInBoundary=function(a){},mj.prototype.interfaces_=function(){return[]},mj.prototype.getClass=function(){return mj},nj.Mod2BoundaryNodeRule.get=function(){return oj},nj.EndPointBoundaryNodeRule.get=function(){return pj},nj.MultiValentEndPointBoundaryNodeRule.get=function(){return qj},nj.MonoValentEndPointBoundaryNodeRule.get=function(){return rj},nj.MOD2_BOUNDARY_RULE.get=function(){return new oj},nj.ENDPOINT_BOUNDARY_RULE.get=function(){return new pj},nj.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new qj},nj.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new rj},nj.OGC_SFS_BOUNDARY_RULE.get=function(){return mj.MOD2_BOUNDARY_RULE},Object.defineProperties(mj,nj);var oj=function(){};oj.prototype.isInBoundary=function(a){return a%2==1},oj.prototype.interfaces_=function(){return[mj]},oj.prototype.getClass=function(){return oj};var pj=function(){};pj.prototype.isInBoundary=function(a){return a>0},pj.prototype.interfaces_=function(){return[mj]},pj.prototype.getClass=function(){return pj};var qj=function(){};qj.prototype.isInBoundary=function(a){return a>1},qj.prototype.interfaces_=function(){return[mj]},qj.prototype.getClass=function(){return qj};var rj=function(){};rj.prototype.isInBoundary=function(a){return 1===a},rj.prototype.interfaces_=function(){return[mj]},rj.prototype.getClass=function(){return rj};var sj=function(){};sj.prototype.add=function(){},sj.prototype.addAll=function(){},sj.prototype.isEmpty=function(){},sj.prototype.iterator=function(){},sj.prototype.size=function(){},sj.prototype.toArray=function(){},sj.prototype.remove=function(){};var tj=function(a){function b(b){a.call(this),this.message=b||""}a&&(b.__proto__=a),(b.prototype=Object.create(a&&a.prototype)).constructor=b;var c={name:{configurable:!0}};return c.name.get=function(){return"IndexOutOfBoundsException"},Object.defineProperties(b,c),b}(Error),uj=function(){};uj.prototype.hasNext=function(){},uj.prototype.next=function(){},uj.prototype.remove=function(){};var vj=function(a){function b(){a.apply(this,arguments)}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.get=function(){},b.prototype.set=function(){},b.prototype.isEmpty=function(){},b}(sj);(De.prototype=new Error).name="NoSuchElementException";var wj=function(a){function b(){a.call(this),this.array_=[],arguments[0]instanceof sj&&this.addAll(arguments[0])}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.ensureCapacity=function(){},b.prototype.interfaces_=function(){return[a,sj]},b.prototype.add=function(a){return 1===arguments.length?this.array_.push(a):this.array_.splice(arguments[0],arguments[1]),!0},b.prototype.clear=function(){this.array_=[]},b.prototype.addAll=function(a){for(var b=a.iterator();b.hasNext();)this.add(b.next());return!0},b.prototype.set=function(a,b){var c=this.array_[a];return this.array_[a]=b,c},b.prototype.iterator=function(){return new xj(this)},b.prototype.get=function(a){if(0>a||a>=this.size())throw new tj;return this.array_[a]},b.prototype.isEmpty=function(){return 0===this.array_.length},b.prototype.size=function(){return this.array_.length},b.prototype.toArray=function(){for(var a=[],b=0,c=this.array_.length;c>b;b++)a.push(this.array_[b]);return a},b.prototype.remove=function(a){for(var b=!1,c=0,d=this.array_.length;d>c;c++)if(this.array_[c]===a){this.array_.splice(c,1),b=!0;break}return b},b}(vj),xj=function(a){function b(b){a.call(this),this.arrayList_=b,this.position_=0}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new De;return this.arrayList_.get(this.position_++)},b.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},b.prototype.set=function(a){return this.arrayList_.set(this.position_-1,a)},b.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},b}(uj),yj=function(a){function b(){if(a.call(this),0===arguments.length);else if(1===arguments.length){var b=arguments[0];this.ensureCapacity(b.length),this.add(b,!0)}else if(2===arguments.length){var c=arguments[0],d=arguments[1];this.ensureCapacity(c.length),this.add(c,d)}}a&&(b.__proto__=a),(b.prototype=Object.create(a&&a.prototype)).constructor=b;var c={coordArrayType:{configurable:!0}};return c.coordArrayType.get=function(){return new Array(0).fill(null)},b.prototype.getCoordinate=function(a){return this.get(a)},b.prototype.addAll=function(){if(2===arguments.length){for(var b=arguments[0],c=arguments[1],d=!1,e=b.iterator();e.hasNext();)this.add(e.next(),c),d=!0;return d}return a.prototype.addAll.apply(this,arguments)},b.prototype.clone=function(){for(var b=a.prototype.clone.call(this),c=0;c<this.size();c++)b.add(c,this.get(c).copy());return b},b.prototype.toCoordinateArray=function(){return this.toArray(b.coordArrayType)},b.prototype.add=function(){if(1===arguments.length){var b=arguments[0];a.prototype.add.call(this,b)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var c=arguments[0],d=arguments[1];return this.add(c,d,!0),!0}if(arguments[0]instanceof wi&&"boolean"==typeof arguments[1]){var e=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(e))return null;a.prototype.add.call(this,e)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var f=arguments[0],g=arguments[1];return this.add(f,g),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var h=arguments[0],i=arguments[1];if(arguments[2])for(var j=0;j<h.length;j++)this.add(h[j],i);else for(var k=h.length-1;k>=0;k--)this.add(h[k],i);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof wi){var l=arguments[0],m=arguments[1];if(!arguments[2]){var n=this.size();if(n>0){if(l>0&&this.get(l-1).equals2D(m))return null;if(n>l&&this.get(l).equals2D(m))return null}}a.prototype.add.call(this,l,m)}}else if(4===arguments.length){var o=arguments[0],p=arguments[1],q=arguments[2],r=arguments[3],s=1;q>r&&(s=-1);for(var t=q;t!==r;t+=s)this.add(o[t],p);return!0}},b.prototype.closeRing=function(){this.size()>0&&this.add(new wi(this.get(0)),!1)},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},Object.defineProperties(b,c),b}(wj),zj=function(){},Aj={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Aj.ForwardComparator.get=function(){return Bj},Aj.BidirectionalComparator.get=function(){return Cj},Aj.coordArrayType.get=function(){return new Array(0).fill(null)},zj.prototype.interfaces_=function(){return[]},zj.prototype.getClass=function(){return zj},zj.isRing=function(a){return!(a.length<4||!a[0].equals2D(a[a.length-1]))},zj.ptNotInList=function(a,b){for(var c=0;c<a.length;c++){var d=a[c];if(zj.indexOf(d,b)<0)return d}return null},zj.scroll=function(a,b){var c=zj.indexOf(b,a);if(0>c)return null;var d=new Array(a.length).fill(null);Qi.arraycopy(a,c,d,0,a.length-c),Qi.arraycopy(a,0,d,a.length-c,c),Qi.arraycopy(d,0,a,0,a.length)},zj.equals=function(){if(2===arguments.length){var a=arguments[0],b=arguments[1];if(a===b)return!0;if(null===a||null===b)return!1;if(a.length!==b.length)return!1;for(var c=0;c<a.length;c++)if(!a[c].equals(b[c]))return!1;return!0}if(3===arguments.length){var d=arguments[0],e=arguments[1],f=arguments[2];if(d===e)return!0;if(null===d||null===e)return!1;if(d.length!==e.length)return!1;for(var g=0;g<d.length;g++)if(0!==f.compare(d[g],e[g]))return!1;return!0}},zj.intersection=function(a,b){for(var c=new yj,d=0;d<a.length;d++)b.intersects(a[d])&&c.add(a[d],!0);return c.toCoordinateArray()},zj.hasRepeatedPoints=function(a){for(var b=1;b<a.length;b++)if(a[b-1].equals(a[b]))return!0;return!1},zj.removeRepeatedPoints=function(a){return zj.hasRepeatedPoints(a)?new yj(a,!1).toCoordinateArray():a},zj.reverse=function(a){for(var b=a.length-1,c=Math.trunc(b/2),d=0;c>=d;d++){var e=a[d];a[d]=a[b-d],a[b-d]=e}},zj.removeNull=function(a){for(var b=0,c=0;c<a.length;c++)null!==a[c]&&b++;var d=new Array(b).fill(null);if(0===b)return d;for(var e=0,f=0;f<a.length;f++)null!==a[f]&&(d[e++]=a[f]);return d},zj.copyDeep=function(){if(1===arguments.length){for(var a=arguments[0],b=new Array(a.length).fill(null),c=0;c<a.length;c++)b[c]=new wi(a[c]);return b}if(5===arguments.length)for(var d=arguments[0],e=arguments[1],f=arguments[2],g=arguments[3],h=arguments[4],i=0;h>i;i++)f[g+i]=new wi(d[e+i])},zj.isEqualReversed=function(a,b){for(var c=0;c<a.length;c++){var d=a[c],e=b[a.length-c-1];if(0!==d.compareTo(e))return!1}return!0},zj.envelope=function(a){for(var b=new Si,c=0;c<a.length;c++)b.expandToInclude(a[c]);return b},zj.toCoordinateArray=function(a){return a.toArray(zj.coordArrayType)},zj.atLeastNCoordinatesOrNothing=function(a,b){return b.length>=a?b:[]},zj.indexOf=function(a,b){for(var c=0;c<b.length;c++)if(a.equals(b[c]))return c;return-1},zj.increasingDirection=function(a){for(var b=0;b<Math.trunc(a.length/2);b++){var c=a.length-1-b,d=a[b].compareTo(a[c]);if(0!==d)return d}return 1},zj.compare=function(a,b){for(var c=0;c<a.length&&c<b.length;){var d=a[c].compareTo(b[c]);if(0!==d)return d;c++}return c<b.length?-1:c<a.length?1:0},zj.minCoordinate=function(a){for(var b=null,c=0;c<a.length;c++)(null===b||b.compareTo(a[c])>0)&&(b=a[c]);return b},zj.extract=function(a,b,c){b=Di.clamp(b,0,a.length);var d=(c=Di.clamp(c,-1,a.length))-b+1;
0>c&&(d=0),b>=a.length&&(d=0),b>c&&(d=0);var e=new Array(d).fill(null);if(0===d)return e;for(var f=0,g=b;c>=g;g++)e[f++]=a[g];return e},Object.defineProperties(zj,Aj);var Bj=function(){};Bj.prototype.compare=function(a,b){return zj.compare(a,b)},Bj.prototype.interfaces_=function(){return[vi]},Bj.prototype.getClass=function(){return Bj};var Cj=function(){};Cj.prototype.compare=function(a,b){var c=a,d=b;if(c.length<d.length)return-1;if(c.length>d.length)return 1;if(0===c.length)return 0;var e=zj.compare(c,d);return zj.isEqualReversed(c,d)?0:e},Cj.prototype.OLDcompare=function(a,b){var c=a,d=b;if(c.length<d.length)return-1;if(c.length>d.length)return 1;if(0===c.length)return 0;for(var e=zj.increasingDirection(c),f=zj.increasingDirection(d),g=e>0?0:c.length-1,h=f>0?0:c.length-1,i=0;i<c.length;i++){var j=c[g].compareTo(d[h]);if(0!==j)return j;g+=e,h+=f}return 0},Cj.prototype.interfaces_=function(){return[vi]},Cj.prototype.getClass=function(){return Cj};var Dj=function(){};Dj.prototype.get=function(){},Dj.prototype.put=function(){},Dj.prototype.size=function(){},Dj.prototype.values=function(){},Dj.prototype.entrySet=function(){};var Ej=function(a){function b(){a.apply(this,arguments)}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b}(Dj);(Ee.prototype=new Error).name="OperationNotSupported",(Fe.prototype=new sj).contains=function(){};var Fj=function(a){function b(){a.call(this),this.array_=[],arguments[0]instanceof sj&&this.addAll(arguments[0])}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.contains=function(a){for(var b=0,c=this.array_.length;c>b;b++)if(this.array_[b]===a)return!0;return!1},b.prototype.add=function(a){return!this.contains(a)&&(this.array_.push(a),!0)},b.prototype.addAll=function(a){for(var b=a.iterator();b.hasNext();)this.add(b.next());return!0},b.prototype.remove=function(a){throw new Error},b.prototype.size=function(){return this.array_.length},b.prototype.isEmpty=function(){return 0===this.array_.length},b.prototype.toArray=function(){for(var a=[],b=0,c=this.array_.length;c>b;b++)a.push(this.array_[b]);return a},b.prototype.iterator=function(){return new Gj(this)},b}(Fe),Gj=function(a){function b(b){a.call(this),this.hashSet_=b,this.position_=0}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new De;return this.hashSet_.array_[this.position_++]},b.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},b.prototype.remove=function(){throw new Ee},b}(uj),Hj=0;(Le.prototype=new Ej).get=function(a){for(var b=this.root_;null!==b;){var c=a.compareTo(b.key);if(0>c)b=b.left;else{if(!(c>0))return b.value;b=b.right}}return null},Le.prototype.put=function(a,b){if(null===this.root_)return this.root_={key:a,value:b,left:null,right:null,parent:null,color:Hj,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var c,d,e=this.root_;do if(c=e,(d=a.compareTo(e.key))<0)e=e.left;else{if(!(d>0)){var f=e.value;return e.value=b,f}e=e.right}while(null!==e);var g={key:a,left:null,right:null,value:b,parent:c,color:Hj,getValue:function(){return this.value},getKey:function(){return this.key}};return 0>d?c.left=g:c.right=g,this.fixAfterInsertion(g),this.size_++,null},Le.prototype.fixAfterInsertion=function(a){for(a.color=1;null!=a&&a!==this.root_&&1===a.parent.color;)if(He(a)===Je(He(He(a)))){var b=Ke(He(He(a)));1===Ge(b)?(Ie(He(a),Hj),Ie(b,Hj),Ie(He(He(a)),1),a=He(He(a))):(a===Ke(He(a))&&(a=He(a),this.rotateLeft(a)),Ie(He(a),Hj),Ie(He(He(a)),1),this.rotateRight(He(He(a))))}else{var c=Je(He(He(a)));1===Ge(c)?(Ie(He(a),Hj),Ie(c,Hj),Ie(He(He(a)),1),a=He(He(a))):(a===Je(He(a))&&(a=He(a),this.rotateRight(a)),Ie(He(a),Hj),Ie(He(He(a)),1),this.rotateLeft(He(He(a))))}this.root_.color=Hj},Le.prototype.values=function(){var a=new wj,b=this.getFirstEntry();if(null!==b)for(a.add(b.value);null!==(b=Le.successor(b));)a.add(b.value);return a},Le.prototype.entrySet=function(){var a=new Fj,b=this.getFirstEntry();if(null!==b)for(a.add(b);null!==(b=Le.successor(b));)a.add(b);return a},Le.prototype.rotateLeft=function(a){if(null!=a){var b=a.right;a.right=b.left,null!=b.left&&(b.left.parent=a),b.parent=a.parent,null===a.parent?this.root_=b:a.parent.left===a?a.parent.left=b:a.parent.right=b,b.left=a,a.parent=b}},Le.prototype.rotateRight=function(a){if(null!=a){var b=a.left;a.left=b.right,null!=b.right&&(b.right.parent=a),b.parent=a.parent,null===a.parent?this.root_=b:a.parent.right===a?a.parent.right=b:a.parent.left=b,b.right=a,a.parent=b}},Le.prototype.getFirstEntry=function(){var a=this.root_;if(null!=a)for(;null!=a.left;)a=a.left;return a},Le.successor=function(a){if(null===a)return null;if(null!==a.right){for(var b=a.right;null!==b.left;)b=b.left;return b}for(var c=a.parent,d=a;null!==c&&d===c.right;)d=c,c=c.parent;return c},Le.prototype.size=function(){return this.size_};var Ij=function(){};Ij.prototype.interfaces_=function(){return[]},Ij.prototype.getClass=function(){return Ij},Me.prototype=new Fe,(Ne.prototype=new Me).contains=function(a){for(var b=0,c=this.array_.length;c>b;b++)if(0===this.array_[b].compareTo(a))return!0;return!1},Ne.prototype.add=function(a){if(this.contains(a))return!1;for(var b=0,c=this.array_.length;c>b;b++)if(1===this.array_[b].compareTo(a))return this.array_.splice(b,0,a),!0;return this.array_.push(a),!0},Ne.prototype.addAll=function(a){for(var b=a.iterator();b.hasNext();)this.add(b.next());return!0},Ne.prototype.remove=function(a){throw new Ee},Ne.prototype.size=function(){return this.array_.length},Ne.prototype.isEmpty=function(){return 0===this.array_.length},Ne.prototype.toArray=function(){for(var a=[],b=0,c=this.array_.length;c>b;b++)a.push(this.array_[b]);return a},Ne.prototype.iterator=function(){return new Jj(this)};var Jj=function(a){this.treeSet_=a,this.position_=0};Jj.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new De;return this.treeSet_.array_[this.position_++]},Jj.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Jj.prototype.remove=function(){throw new Ee};var Kj=function(){};Kj.sort=function(){var a,b,c,d,e=arguments[0];if(1===arguments.length)d=function(a,b){return a.compareTo(b)},e.sort(d);else if(2===arguments.length)c=arguments[1],d=function(a,b){return c.compare(a,b)},e.sort(d);else if(3===arguments.length){(b=e.slice(arguments[1],arguments[2])).sort();var f=e.slice(0,arguments[1]).concat(b,e.slice(arguments[2],e.length));for(e.splice(0,e.length),a=0;a<f.length;a++)e.push(f[a])}else if(4===arguments.length)for(b=e.slice(arguments[1],arguments[2]),c=arguments[3],d=function(a,b){return c.compare(a,b)},b.sort(d),f=e.slice(0,arguments[1]).concat(b,e.slice(arguments[2],e.length)),e.splice(0,e.length),a=0;a<f.length;a++)e.push(f[a])},Kj.asList=function(a){for(var b=new wj,c=0,d=a.length;d>c;c++)b.add(a[c]);return b};var Lj=function(){},Mj={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}};Mj.P.get=function(){return 0},Mj.L.get=function(){return 1},Mj.A.get=function(){return 2},Mj.FALSE.get=function(){return-1},Mj.TRUE.get=function(){return-2},Mj.DONTCARE.get=function(){return-3},Mj.SYM_FALSE.get=function(){return"F"},Mj.SYM_TRUE.get=function(){return"T"},Mj.SYM_DONTCARE.get=function(){return"*"},Mj.SYM_P.get=function(){return"0"},Mj.SYM_L.get=function(){return"1"},Mj.SYM_A.get=function(){return"2"},Lj.prototype.interfaces_=function(){return[]},Lj.prototype.getClass=function(){return Lj},Lj.toDimensionSymbol=function(a){switch(a){case Lj.FALSE:return Lj.SYM_FALSE;case Lj.TRUE:return Lj.SYM_TRUE;case Lj.DONTCARE:return Lj.SYM_DONTCARE;case Lj.P:return Lj.SYM_P;case Lj.L:return Lj.SYM_L;case Lj.A:return Lj.SYM_A}throw new qi("Unknown dimension value: "+a)},Lj.toDimensionValue=function(a){switch(Hi.toUpperCase(a)){case Lj.SYM_FALSE:return Lj.FALSE;case Lj.SYM_TRUE:return Lj.TRUE;case Lj.SYM_DONTCARE:return Lj.DONTCARE;case Lj.SYM_P:return Lj.P;case Lj.SYM_L:return Lj.L;case Lj.SYM_A:return Lj.A}throw new qi("Unknown dimension symbol: "+a)},Object.defineProperties(Lj,Mj);var Nj=function(){};Nj.prototype.filter=function(a){},Nj.prototype.interfaces_=function(){return[]},Nj.prototype.getClass=function(){return Nj};var Oj=function(){};Oj.prototype.filter=function(a,b){},Oj.prototype.isDone=function(){},Oj.prototype.isGeometryChanged=function(){},Oj.prototype.interfaces_=function(){return[]},Oj.prototype.getClass=function(){return Oj};var Pj=function(a){function b(b,c){if(a.call(this,c),this._geometries=b||[],a.hasNullElements(this._geometries))throw new qi("geometries must not contain null elements")}a&&(b.__proto__=a),(b.prototype=Object.create(a&&a.prototype)).constructor=b;var c={serialVersionUID:{configurable:!0}};return b.prototype.computeEnvelopeInternal=function(){for(var a=new Si,b=0;b<this._geometries.length;b++)a.expandToInclude(this._geometries[b].getEnvelopeInternal());return a},b.prototype.getGeometryN=function(a){return this._geometries[a]},b.prototype.getSortIndex=function(){return a.SORTINDEX_GEOMETRYCOLLECTION},b.prototype.getCoordinates=function(){for(var a=new Array(this.getNumPoints()).fill(null),b=-1,c=0;c<this._geometries.length;c++)for(var d=this._geometries[c].getCoordinates(),e=0;e<d.length;e++)a[++b]=d[e];return a},b.prototype.getArea=function(){for(var a=0,b=0;b<this._geometries.length;b++)a+=this._geometries[b].getArea();return a},b.prototype.equalsExact=function(){if(2===arguments.length){var b=arguments[0],c=arguments[1];if(!this.isEquivalentClass(b))return!1;var d=b;if(this._geometries.length!==d._geometries.length)return!1;for(var e=0;e<this._geometries.length;e++)if(!this._geometries[e].equalsExact(d._geometries[e],c))return!1;return!0}return a.prototype.equalsExact.apply(this,arguments)},b.prototype.normalize=function(){for(var a=0;a<this._geometries.length;a++)this._geometries[a].normalize();Kj.sort(this._geometries)},b.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},b.prototype.getBoundaryDimension=function(){for(var a=Lj.FALSE,b=0;b<this._geometries.length;b++)a=Math.max(a,this._geometries[b].getBoundaryDimension());return a},b.prototype.getDimension=function(){for(var a=Lj.FALSE,b=0;b<this._geometries.length;b++)a=Math.max(a,this._geometries[b].getDimension());return a},b.prototype.getLength=function(){for(var a=0,b=0;b<this._geometries.length;b++)a+=this._geometries[b].getLength();return a},b.prototype.getNumPoints=function(){for(var a=0,b=0;b<this._geometries.length;b++)a+=this._geometries[b].getNumPoints();return a},b.prototype.getNumGeometries=function(){return this._geometries.length},b.prototype.reverse=function(){for(var a=this._geometries.length,b=new Array(a).fill(null),c=0;c<this._geometries.length;c++)b[c]=this._geometries[c].reverse();return this.getFactory().createGeometryCollection(b)},b.prototype.compareToSameClass=function(){if(1===arguments.length){var a=arguments[0],b=new Ne(Kj.asList(this._geometries)),c=new Ne(Kj.asList(a._geometries));return this.compare(b,c)}if(2===arguments.length){for(var d=arguments[0],e=arguments[1],f=d,g=this.getNumGeometries(),h=f.getNumGeometries(),i=0;g>i&&h>i;){var j=this.getGeometryN(i),k=f.getGeometryN(i),l=j.compareToSameClass(k,e);if(0!==l)return l;i++}return g>i?1:h>i?-1:0}},b.prototype.apply=function(){if(Ci(arguments[0],lj))for(var a=arguments[0],b=0;b<this._geometries.length;b++)this._geometries[b].apply(a);else if(Ci(arguments[0],Oj)){var c=arguments[0];if(0===this._geometries.length)return null;for(var d=0;d<this._geometries.length&&(this._geometries[d].apply(c),!c.isDone());d++);c.isGeometryChanged()&&this.geometryChanged()}else if(Ci(arguments[0],Nj)){var e=arguments[0];e.filter(this);for(var f=0;f<this._geometries.length;f++)this._geometries[f].apply(e)}else if(Ci(arguments[0],hj)){var g=arguments[0];g.filter(this);for(var h=0;h<this._geometries.length;h++)this._geometries[h].apply(g)}},b.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),_i.shouldNeverReachHere(),null},b.prototype.clone=function(){var b=a.prototype.clone.call(this);b._geometries=new Array(this._geometries.length).fill(null);for(var c=0;c<this._geometries.length;c++)b._geometries[c]=this._geometries[c].clone();return b},b.prototype.getGeometryType=function(){return"GeometryCollection"},b.prototype.copy=function(){for(var a=new Array(this._geometries.length).fill(null),c=0;c<a.length;c++)a[c]=this._geometries[c].copy();return new b(a,this._factory)},b.prototype.isEmpty=function(){for(var a=0;a<this._geometries.length;a++)if(!this._geometries[a].isEmpty())return!1;return!0},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},c.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(b,c),b}(ij),Qj=function(a){function b(){a.apply(this,arguments)}a&&(b.__proto__=a),(b.prototype=Object.create(a&&a.prototype)).constructor=b;var c={serialVersionUID:{configurable:!0}};return b.prototype.getSortIndex=function(){return ij.SORTINDEX_MULTILINESTRING},b.prototype.equalsExact=function(){if(2===arguments.length){var b=arguments[0],c=arguments[1];return!!this.isEquivalentClass(b)&&a.prototype.equalsExact.call(this,b,c)}return a.prototype.equalsExact.apply(this,arguments)},b.prototype.getBoundaryDimension=function(){return this.isClosed()?Lj.FALSE:0},b.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var a=0;a<this._geometries.length;a++)if(!this._geometries[a].isClosed())return!1;return!0},b.prototype.getDimension=function(){return 1},b.prototype.reverse=function(){for(var a=this._geometries.length,b=new Array(a).fill(null),c=0;c<this._geometries.length;c++)b[a-1-c]=this._geometries[c].reverse();return this.getFactory().createMultiLineString(b)},b.prototype.getBoundary=function(){return new Rj(this).getBoundary()},b.prototype.getGeometryType=function(){return"MultiLineString"},b.prototype.copy=function(){for(var a=new Array(this._geometries.length).fill(null),c=0;c<a.length;c++)a[c]=this._geometries[c].copy();return new b(a,this._factory)},b.prototype.interfaces_=function(){return[Ij]},b.prototype.getClass=function(){return b},c.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(b,c),b}(Pj),Rj=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var a=arguments[0],b=mj.MOD2_BOUNDARY_RULE;this._geom=a,this._geomFact=a.getFactory(),this._bnRule=b}else if(2===arguments.length){var c=arguments[0],d=arguments[1];this._geom=c,this._geomFact=c.getFactory(),this._bnRule=d}};Rj.prototype.boundaryMultiLineString=function(a){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var b=this.computeBoundaryCoordinates(a);return 1===b.length?this._geomFact.createPoint(b[0]):this._geomFact.createMultiPointFromCoords(b)},Rj.prototype.getBoundary=function(){return this._geom instanceof Wj?this.boundaryLineString(this._geom):this._geom instanceof Qj?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},Rj.prototype.boundaryLineString=function(a){return this._geom.isEmpty()?this.getEmptyMultiPoint():a.isClosed()?this._bnRule.isInBoundary(2)?a.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([a.getStartPoint(),a.getEndPoint()])},Rj.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},Rj.prototype.computeBoundaryCoordinates=function(a){var b=new wj;this._endpointMap=new Le;for(var c=0;c<a.getNumGeometries();c++){var d=a.getGeometryN(c);0!==d.getNumPoints()&&(this.addEndpoint(d.getCoordinateN(0)),this.addEndpoint(d.getCoordinateN(d.getNumPoints()-1)))}for(var e=this._endpointMap.entrySet().iterator();e.hasNext();){var f=e.next(),g=f.getValue().count;this._bnRule.isInBoundary(g)&&b.add(f.getKey())}return zj.toCoordinateArray(b)},Rj.prototype.addEndpoint=function(a){var b=this._endpointMap.get(a);null===b&&(b=new Sj,this._endpointMap.put(a,b)),b.count++},Rj.prototype.interfaces_=function(){return[]},Rj.prototype.getClass=function(){return Rj},Rj.getBoundary=function(){if(1===arguments.length){var a=arguments[0];return new Rj(a).getBoundary()}if(2===arguments.length){var b=arguments[0],c=arguments[1];return new Rj(b,c).getBoundary()}};var Sj=function(){this.count=null};Sj.prototype.interfaces_=function(){return[]},Sj.prototype.getClass=function(){return Sj};var Tj=function(){},Uj={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};Tj.prototype.interfaces_=function(){return[]},Tj.prototype.getClass=function(){return Tj},Tj.chars=function(a,b){for(var c=new Array(b).fill(null),d=0;b>d;d++)c[d]=a;return String(c)},Tj.getStackTrace=function(){if(1===arguments.length){var a=arguments[0],b=new function(){},c=new function(){}(b);return a.printStackTrace(c),b.toString()}if(2===arguments.length){for(var d=arguments[0],e=arguments[1],f="",g=new function(){}(new function(){}(Tj.getStackTrace(d))),h=0;e>h;h++)try{f+=g.readLine()+Tj.NEWLINE}catch(a){if(!(a instanceof Oe))throw a;_i.shouldNeverReachHere()}return f}},Tj.split=function(a,b){for(var c=b.length,d=new wj,e=""+a,f=e.indexOf(b);f>=0;){var g=e.substring(0,f);d.add(g),f=(e=e.substring(f+c)).indexOf(b)}e.length>0&&d.add(e);for(var h=new Array(d.size()).fill(null),i=0;i<h.length;i++)h[i]=d.get(i);return h},Tj.toString=function(){if(1===arguments.length){var a=arguments[0];return Tj.SIMPLE_ORDINATE_FORMAT.format(a)}},Tj.spaces=function(a){return Tj.chars(" ",a)},Uj.NEWLINE.get=function(){return Qi.getProperty("line.separator")},Uj.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(Tj,Uj);var Vj=function(){};Vj.prototype.interfaces_=function(){return[]},Vj.prototype.getClass=function(){return Vj},Vj.copyCoord=function(a,b,c,d){for(var e=Math.min(a.getDimension(),c.getDimension()),f=0;e>f;f++)c.setOrdinate(d,f,a.getOrdinate(b,f))},Vj.isRing=function(a){var b=a.size();return 0===b||!(3>=b)&&a.getOrdinate(0,Mi.X)===a.getOrdinate(b-1,Mi.X)&&a.getOrdinate(0,Mi.Y)===a.getOrdinate(b-1,Mi.Y)},Vj.isEqual=function(a,b){var c=a.size();if(c!==b.size())return!1;for(var d=Math.min(a.getDimension(),b.getDimension()),e=0;c>e;e++)for(var f=0;d>f;f++){var g=a.getOrdinate(e,f),h=b.getOrdinate(e,f);if(!(a.getOrdinate(e,f)===b.getOrdinate(e,f)||ri.isNaN(g)&&ri.isNaN(h)))return!1}return!0},Vj.extend=function(a,b,c){var d=a.create(c,b.getDimension()),e=b.size();if(Vj.copy(b,0,d,0,e),e>0)for(var f=e;c>f;f++)Vj.copy(b,e-1,d,f,1);return d},Vj.reverse=function(a){for(var b=a.size()-1,c=Math.trunc(b/2),d=0;c>=d;d++)Vj.swap(a,d,b-d)},Vj.swap=function(a,b,c){if(b===c)return null;for(var d=0;d<a.getDimension();d++){var e=a.getOrdinate(b,d);a.setOrdinate(b,d,a.getOrdinate(c,d)),a.setOrdinate(c,d,e)}},Vj.copy=function(a,b,c,d,e){for(var f=0;e>f;f++)Vj.copyCoord(a,b+f,c,d+f)},Vj.toString=function(){if(1===arguments.length){var a=arguments[0],b=a.size();if(0===b)return"()";var c=a.getDimension(),d=new Fi;d.append("(");for(var e=0;b>e;e++){e>0&&d.append(" ");for(var f=0;c>f;f++)f>0&&d.append(","),d.append(Tj.toString(a.getOrdinate(e,f)))}return d.append(")"),d.toString()}},Vj.ensureValidRing=function(a,b){var c=b.size();return 0===c?b:3>=c?Vj.createClosedRing(a,b,4):b.getOrdinate(0,Mi.X)===b.getOrdinate(c-1,Mi.X)&&b.getOrdinate(0,Mi.Y)===b.getOrdinate(c-1,Mi.Y)?b:Vj.createClosedRing(a,b,c+1)},Vj.createClosedRing=function(a,b,c){var d=a.create(c,b.getDimension()),e=b.size();Vj.copy(b,0,d,0,e);for(var f=e;c>f;f++)Vj.copy(b,0,d,f,1);return d};var Wj=function(a){function b(b,c){a.call(this,c),this._points=null,this.init(b)}a&&(b.__proto__=a),(b.prototype=Object.create(a&&a.prototype)).constructor=b;var c={serialVersionUID:{configurable:!0}};return b.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new Si:this._points.expandEnvelope(new Si)},b.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},b.prototype.getSortIndex=function(){return a.SORTINDEX_LINESTRING},b.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},b.prototype.equalsExact=function(){if(2===arguments.length){var b=arguments[0],c=arguments[1];if(!this.isEquivalentClass(b))return!1;var d=b;if(this._points.size()!==d._points.size())return!1;for(var e=0;e<this._points.size();e++)if(!this.equal(this._points.getCoordinate(e),d._points.getCoordinate(e),c))return!1;return!0}return a.prototype.equalsExact.apply(this,arguments)},b.prototype.normalize=function(){for(var a=0;a<Math.trunc(this._points.size()/2);a++){var b=this._points.size()-1-a;if(!this._points.getCoordinate(a).equals(this._points.getCoordinate(b)))return this._points.getCoordinate(a).compareTo(this._points.getCoordinate(b))>0&&Vj.reverse(this._points),null}},b.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},b.prototype.getBoundaryDimension=function(){return this.isClosed()?Lj.FALSE:0},b.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},b.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},b.prototype.getDimension=function(){return 1},b.prototype.getLength=function(){return fj.computeLength(this._points)},b.prototype.getNumPoints=function(){return this._points.size()},b.prototype.reverse=function(){var a=this._points.copy();return Vj.reverse(a),this.getFactory().createLineString(a)},b.prototype.compareToSameClass=function(){if(1===arguments.length){for(var a=arguments[0],b=0,c=0;b<this._points.size()&&c<a._points.size();){var d=this._points.getCoordinate(b).compareTo(a._points.getCoordinate(c));if(0!==d)return d;b++,c++}return b<this._points.size()?1:c<a._points.size()?-1:0}if(2===arguments.length){var e=arguments[0];return arguments[1].compare(this._points,e._points)}},b.prototype.apply=function(){if(Ci(arguments[0],lj))for(var a=arguments[0],b=0;b<this._points.size();b++)a.filter(this._points.getCoordinate(b));else if(Ci(arguments[0],Oj)){var c=arguments[0];if(0===this._points.size())return null;for(var d=0;d<this._points.size()&&(c.filter(this._points,d),!c.isDone());d++);c.isGeometryChanged()&&this.geometryChanged()}else Ci(arguments[0],Nj)?arguments[0].filter(this):Ci(arguments[0],hj)&&arguments[0].filter(this)},b.prototype.getBoundary=function(){return new Rj(this).getBoundary()},b.prototype.isEquivalentClass=function(a){return a instanceof b},b.prototype.clone=function(){var b=a.prototype.clone.call(this);return b._points=this._points.clone(),b},b.prototype.getCoordinateN=function(a){return this._points.getCoordinate(a)},b.prototype.getGeometryType=function(){return"LineString"},b.prototype.copy=function(){return new b(this._points.copy(),this._factory)},b.prototype.getCoordinateSequence=function(){return this._points},b.prototype.isEmpty=function(){return 0===this._points.size()},b.prototype.init=function(a){if(null===a&&(a=this.getFactory().getCoordinateSequenceFactory().create([])),1===a.size())throw new qi("Invalid number of points in LineString (found "+a.size()+" - must be 0 or >= 2)");this._points=a},b.prototype.isCoordinate=function(a){for(var b=0;b<this._points.size();b++)if(this._points.getCoordinate(b).equals(a))return!0;return!1},b.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},b.prototype.getPointN=function(a){return this.getFactory().createPoint(this._points.getCoordinate(a))},b.prototype.interfaces_=function(){return[Ij]},b.prototype.getClass=function(){return b},c.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(b,c),b}(ij),Xj=function(){};Xj.prototype.interfaces_=function(){return[]},Xj.prototype.getClass=function(){return Xj};var Yj=function(a){function b(b,c){a.call(this,c),this._coordinates=b||null,this.init(this._coordinates)}a&&(b.__proto__=a),(b.prototype=Object.create(a&&a.prototype)).constructor=b;var c={serialVersionUID:{configurable:!0}};return b.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new Si;var a=new Si;return a.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),a},b.prototype.getSortIndex=function(){return a.SORTINDEX_POINT},b.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},b.prototype.equalsExact=function(){if(2===arguments.length){var b=arguments[0],c=arguments[1];return!!this.isEquivalentClass(b)&&(!(!this.isEmpty()||!b.isEmpty())||this.isEmpty()===b.isEmpty()&&this.equal(b.getCoordinate(),this.getCoordinate(),c))}return a.prototype.equalsExact.apply(this,arguments)},b.prototype.normalize=function(){},b.prototype.getCoordinate=function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},b.prototype.getBoundaryDimension=function(){return Lj.FALSE},b.prototype.getDimension=function(){return 0},b.prototype.getNumPoints=function(){return this.isEmpty()?0:1},b.prototype.reverse=function(){return this.copy()},b.prototype.getX=function(){if(null===this.getCoordinate())throw new Error("getX called on empty Point");return this.getCoordinate().x},b.prototype.compareToSameClass=function(){if(1===arguments.length){var a=arguments[0];return this.getCoordinate().compareTo(a.getCoordinate())}if(2===arguments.length){var b=arguments[0];return arguments[1].compare(this._coordinates,b._coordinates)}},b.prototype.apply=function(){if(Ci(arguments[0],lj)){var a=arguments[0];if(this.isEmpty())return null;a.filter(this.getCoordinate())}else if(Ci(arguments[0],Oj)){var b=arguments[0];if(this.isEmpty())return null;b.filter(this._coordinates,0),b.isGeometryChanged()&&this.geometryChanged()}else Ci(arguments[0],Nj)?arguments[0].filter(this):Ci(arguments[0],hj)&&arguments[0].filter(this)},b.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},b.prototype.clone=function(){var b=a.prototype.clone.call(this);return b._coordinates=this._coordinates.clone(),b},b.prototype.getGeometryType=function(){return"Point"},b.prototype.copy=function(){return new b(this._coordinates.copy(),this._factory)},b.prototype.getCoordinateSequence=function(){return this._coordinates},b.prototype.getY=function(){if(null===this.getCoordinate())throw new Error("getY called on empty Point");return this.getCoordinate().y},b.prototype.isEmpty=function(){return 0===this._coordinates.size()},b.prototype.init=function(a){null===a&&(a=this.getFactory().getCoordinateSequenceFactory().create([])),_i.isTrue(a.size()<=1),this._coordinates=a},b.prototype.isSimple=function(){return!0},b.prototype.interfaces_=function(){return[Xj]},b.prototype.getClass=function(){return b},c.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(b,c),b}(ij),Zj=function(){};Zj.prototype.interfaces_=function(){return[]},Zj.prototype.getClass=function(){return Zj};var $j=function(a){function b(b,c,d){if(a.call(this,d),this._shell=null,this._holes=null,null===b&&(b=this.getFactory().createLinearRing()),null===c&&(c=[]),a.hasNullElements(c))throw new qi("holes must not contain null elements");if(b.isEmpty()&&a.hasNonEmptyElements(c))throw new qi("shell is empty but holes are not");this._shell=b,this._holes=c}a&&(b.__proto__=a),(b.prototype=Object.create(a&&a.prototype)).constructor=b;var c={serialVersionUID:{configurable:!0}};return b.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},b.prototype.getSortIndex=function(){return a.SORTINDEX_POLYGON},b.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var a=new Array(this.getNumPoints()).fill(null),b=-1,c=this._shell.getCoordinates(),d=0;d<c.length;d++)a[++b]=c[d];for(var e=0;e<this._holes.length;e++)for(var f=this._holes[e].getCoordinates(),g=0;g<f.length;g++)a[++b]=f[g];return a},b.prototype.getArea=function(){var a=0;a+=Math.abs(fj.signedArea(this._shell.getCoordinateSequence()));for(var b=0;b<this._holes.length;b++)a-=Math.abs(fj.signedArea(this._holes[b].getCoordinateSequence()));return a},b.prototype.isRectangle=function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var a=this._shell.getCoordinateSequence(),b=this.getEnvelopeInternal(),c=0;5>c;c++){var d=a.getX(c);if(d!==b.getMinX()&&d!==b.getMaxX())return!1;var e=a.getY(c);if(e!==b.getMinY()&&e!==b.getMaxY())return!1}for(var f=a.getX(0),g=a.getY(0),h=1;4>=h;h++){var i=a.getX(h),j=a.getY(h);if(i!==f==(j!==g))return!1;f=i,g=j}return!0},b.prototype.equalsExact=function(){if(2===arguments.length){var b=arguments[0],c=arguments[1];if(!this.isEquivalentClass(b))return!1;var d=b,e=this._shell,f=d._shell;if(!e.equalsExact(f,c))return!1;if(this._holes.length!==d._holes.length)return!1;for(var g=0;g<this._holes.length;g++)if(!this._holes[g].equalsExact(d._holes[g],c))return!1;return!0}return a.prototype.equalsExact.apply(this,arguments)},b.prototype.normalize=function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var a=0;a<this._holes.length;a++)this.normalize(this._holes[a],!1);Kj.sort(this._holes)}else if(2===arguments.length){var b=arguments[0],c=arguments[1];if(b.isEmpty())return null;var d=new Array(b.getCoordinates().length-1).fill(null);Qi.arraycopy(b.getCoordinates(),0,d,0,d.length);var e=zj.minCoordinate(b.getCoordinates());zj.scroll(d,e),Qi.arraycopy(d,0,b.getCoordinates(),0,d.length),b.getCoordinates()[d.length]=d[0],fj.isCCW(b.getCoordinates())===c&&zj.reverse(b.getCoordinates())}},b.prototype.getCoordinate=function(){return this._shell.getCoordinate()},b.prototype.getNumInteriorRing=function(){return this._holes.length},b.prototype.getBoundaryDimension=function(){return 1},b.prototype.getDimension=function(){return 2},b.prototype.getLength=function(){var a=0;a+=this._shell.getLength();for(var b=0;b<this._holes.length;b++)a+=this._holes[b].getLength();return a},b.prototype.getNumPoints=function(){for(var a=this._shell.getNumPoints(),b=0;b<this._holes.length;b++)a+=this._holes[b].getNumPoints();return a},b.prototype.reverse=function(){var a=this.copy();a._shell=this._shell.copy().reverse(),a._holes=new Array(this._holes.length).fill(null);for(var b=0;b<this._holes.length;b++)a._holes[b]=this._holes[b].copy().reverse();return a},b.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},b.prototype.compareToSameClass=function(){if(1===arguments.length){var a=arguments[0],b=this._shell,c=a._shell;return b.compareToSameClass(c)}if(2===arguments.length){var d=arguments[0],e=arguments[1],f=d,g=this._shell,h=f._shell,i=g.compareToSameClass(h,e);if(0!==i)return i;for(var j=this.getNumInteriorRing(),k=f.getNumInteriorRing(),l=0;j>l&&k>l;){var m=this.getInteriorRingN(l),n=f.getInteriorRingN(l),o=m.compareToSameClass(n,e);if(0!==o)return o;l++}return j>l?1:k>l?-1:0}},b.prototype.apply=function(a){if(Ci(a,lj)){this._shell.apply(a);for(var b=0;b<this._holes.length;b++)this._holes[b].apply(a)}else if(Ci(a,Oj)){if(this._shell.apply(a),!a.isDone())for(var c=0;c<this._holes.length&&(this._holes[c].apply(a),!a.isDone());c++);a.isGeometryChanged()&&this.geometryChanged()}else if(Ci(a,Nj))a.filter(this);else if(Ci(a,hj)){a.filter(this),this._shell.apply(a);for(var d=0;d<this._holes.length;d++)this._holes[d].apply(a)}},b.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var a=new Array(this._holes.length+1).fill(null);a[0]=this._shell;for(var b=0;b<this._holes.length;b++)a[b+1]=this._holes[b];return a.length<=1?this.getFactory().createLinearRing(a[0].getCoordinateSequence()):this.getFactory().createMultiLineString(a)},b.prototype.clone=function(){var b=a.prototype.clone.call(this);b._shell=this._shell.clone(),b._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)b._holes[c]=this._holes[c].clone();
return b},b.prototype.getGeometryType=function(){return"Polygon"},b.prototype.copy=function(){for(var a=this._shell.copy(),c=new Array(this._holes.length).fill(null),d=0;d<c.length;d++)c[d]=this._holes[d].copy();return new b(a,c,this._factory)},b.prototype.getExteriorRing=function(){return this._shell},b.prototype.isEmpty=function(){return this._shell.isEmpty()},b.prototype.getInteriorRingN=function(a){return this._holes[a]},b.prototype.interfaces_=function(){return[Zj]},b.prototype.getClass=function(){return b},c.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(b,c),b}(ij),_j=function(a){function b(){a.apply(this,arguments)}a&&(b.__proto__=a),(b.prototype=Object.create(a&&a.prototype)).constructor=b;var c={serialVersionUID:{configurable:!0}};return b.prototype.getSortIndex=function(){return ij.SORTINDEX_MULTIPOINT},b.prototype.isValid=function(){return!0},b.prototype.equalsExact=function(){if(2===arguments.length){var b=arguments[0],c=arguments[1];return!!this.isEquivalentClass(b)&&a.prototype.equalsExact.call(this,b,c)}return a.prototype.equalsExact.apply(this,arguments)},b.prototype.getCoordinate=function(){if(1===arguments.length){var b=arguments[0];return this._geometries[b].getCoordinate()}return a.prototype.getCoordinate.apply(this,arguments)},b.prototype.getBoundaryDimension=function(){return Lj.FALSE},b.prototype.getDimension=function(){return 0},b.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},b.prototype.getGeometryType=function(){return"MultiPoint"},b.prototype.copy=function(){for(var a=new Array(this._geometries.length).fill(null),c=0;c<a.length;c++)a[c]=this._geometries[c].copy();return new b(a,this._factory)},b.prototype.interfaces_=function(){return[Xj]},b.prototype.getClass=function(){return b},c.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(b,c),b}(Pj),ak=function(a){function b(b,c){b instanceof wi&&c instanceof qk&&(b=c.getCoordinateSequenceFactory().create(b)),a.call(this,b,c),this.validateConstruction()}a&&(b.__proto__=a),(b.prototype=Object.create(a&&a.prototype)).constructor=b;var c={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return b.prototype.getSortIndex=function(){return ij.SORTINDEX_LINEARRING},b.prototype.getBoundaryDimension=function(){return Lj.FALSE},b.prototype.isClosed=function(){return!!this.isEmpty()||a.prototype.isClosed.call(this)},b.prototype.reverse=function(){var a=this._points.copy();return Vj.reverse(a),this.getFactory().createLinearRing(a)},b.prototype.validateConstruction=function(){if(!this.isEmpty()&&!a.prototype.isClosed.call(this))throw new qi("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<b.MINIMUM_VALID_SIZE)throw new qi("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},b.prototype.getGeometryType=function(){return"LinearRing"},b.prototype.copy=function(){return new b(this._points.copy(),this._factory)},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},c.MINIMUM_VALID_SIZE.get=function(){return 4},c.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(b,c),b}(Wj),bk=function(a){function b(){a.apply(this,arguments)}a&&(b.__proto__=a),(b.prototype=Object.create(a&&a.prototype)).constructor=b;var c={serialVersionUID:{configurable:!0}};return b.prototype.getSortIndex=function(){return ij.SORTINDEX_MULTIPOLYGON},b.prototype.equalsExact=function(){if(2===arguments.length){var b=arguments[0],c=arguments[1];return!!this.isEquivalentClass(b)&&a.prototype.equalsExact.call(this,b,c)}return a.prototype.equalsExact.apply(this,arguments)},b.prototype.getBoundaryDimension=function(){return 1},b.prototype.getDimension=function(){return 2},b.prototype.reverse=function(){for(var a=this._geometries.length,b=new Array(a).fill(null),c=0;c<this._geometries.length;c++)b[c]=this._geometries[c].reverse();return this.getFactory().createMultiPolygon(b)},b.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var a=new wj,b=0;b<this._geometries.length;b++)for(var c=this._geometries[b].getBoundary(),d=0;d<c.getNumGeometries();d++)a.add(c.getGeometryN(d));var e=new Array(a.size()).fill(null);return this.getFactory().createMultiLineString(a.toArray(e))},b.prototype.getGeometryType=function(){return"MultiPolygon"},b.prototype.copy=function(){for(var a=new Array(this._geometries.length).fill(null),c=0;c<a.length;c++)a[c]=this._geometries[c].copy();return new b(a,this._factory)},b.prototype.interfaces_=function(){return[Zj]},b.prototype.getClass=function(){return b},c.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(b,c),b}(Pj),ck=function(a){this._factory=a||null,this._isUserDataCopied=!1},dk={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};ck.prototype.setCopyUserData=function(a){this._isUserDataCopied=a},ck.prototype.edit=function(a,b){if(null===a)return null;var c=this.editInternal(a,b);return this._isUserDataCopied&&c.setUserData(a.getUserData()),c},ck.prototype.editInternal=function(a,b){return null===this._factory&&(this._factory=a.getFactory()),a instanceof Pj?this.editGeometryCollection(a,b):a instanceof $j?this.editPolygon(a,b):a instanceof Yj?b.edit(a,this._factory):a instanceof Wj?b.edit(a,this._factory):(_i.shouldNeverReachHere("Unsupported Geometry class: "+a.getClass().getName()),null)},ck.prototype.editGeometryCollection=function(a,b){for(var c=b.edit(a,this._factory),d=new wj,e=0;e<c.getNumGeometries();e++){var f=this.edit(c.getGeometryN(e),b);null===f||f.isEmpty()||d.add(f)}return c.getClass()===_j?this._factory.createMultiPoint(d.toArray([])):c.getClass()===Qj?this._factory.createMultiLineString(d.toArray([])):c.getClass()===bk?this._factory.createMultiPolygon(d.toArray([])):this._factory.createGeometryCollection(d.toArray([]))},ck.prototype.editPolygon=function(a,b){var c=b.edit(a,this._factory);if(null===c&&(c=this._factory.createPolygon(null)),c.isEmpty())return c;var d=this.edit(c.getExteriorRing(),b);if(null===d||d.isEmpty())return this._factory.createPolygon();for(var e=new wj,f=0;f<c.getNumInteriorRing();f++){var g=this.edit(c.getInteriorRingN(f),b);null===g||g.isEmpty()||e.add(g)}return this._factory.createPolygon(d,e.toArray([]))},ck.prototype.interfaces_=function(){return[]},ck.prototype.getClass=function(){return ck},ck.GeometryEditorOperation=function(){},dk.NoOpGeometryOperation.get=function(){return ek},dk.CoordinateOperation.get=function(){return fk},dk.CoordinateSequenceOperation.get=function(){return gk},Object.defineProperties(ck,dk);var ek=function(){};ek.prototype.edit=function(a,b){return a},ek.prototype.interfaces_=function(){return[ck.GeometryEditorOperation]},ek.prototype.getClass=function(){return ek};var fk=function(){};fk.prototype.edit=function(a,b){var c=this.editCoordinates(a.getCoordinates(),a);return null===c?a:a instanceof ak?b.createLinearRing(c):a instanceof Wj?b.createLineString(c):a instanceof Yj?c.length>0?b.createPoint(c[0]):b.createPoint():a},fk.prototype.interfaces_=function(){return[ck.GeometryEditorOperation]},fk.prototype.getClass=function(){return fk};var gk=function(){};gk.prototype.edit=function(a,b){return a instanceof ak?b.createLinearRing(this.edit(a.getCoordinateSequence(),a)):a instanceof Wj?b.createLineString(this.edit(a.getCoordinateSequence(),a)):a instanceof Yj?b.createPoint(this.edit(a.getCoordinateSequence(),a)):a},gk.prototype.interfaces_=function(){return[ck.GeometryEditorOperation]},gk.prototype.getClass=function(){return gk};var hk=function(){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 a=arguments[0];this._coordinates=new Array(a).fill(null);for(var b=0;a>b;b++)this._coordinates[b]=new wi}else if(Ci(arguments[0],Mi)){var c=arguments[0];if(null===c)return this._coordinates=new Array(0).fill(null),null;this._dimension=c.getDimension(),this._coordinates=new Array(c.size()).fill(null);for(var d=0;d<this._coordinates.length;d++)this._coordinates[d]=c.getCoordinateCopy(d)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var e=arguments[0],f=arguments[1];this._coordinates=e,this._dimension=f,null===e&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var g=arguments[0],h=arguments[1];this._coordinates=new Array(g).fill(null),this._dimension=h;for(var i=0;g>i;i++)this._coordinates[i]=new wi}},ik={serialVersionUID:{configurable:!0}};hk.prototype.setOrdinate=function(a,b,c){switch(b){case Mi.X:this._coordinates[a].x=c;break;case Mi.Y:this._coordinates[a].y=c;break;case Mi.Z:this._coordinates[a].z=c;break;default:throw new qi("invalid ordinateIndex")}},hk.prototype.size=function(){return this._coordinates.length},hk.prototype.getOrdinate=function(a,b){switch(b){case Mi.X:return this._coordinates[a].x;case Mi.Y:return this._coordinates[a].y;case Mi.Z:return this._coordinates[a].z}return ri.NaN},hk.prototype.getCoordinate=function(){if(1===arguments.length){var a=arguments[0];return this._coordinates[a]}if(2===arguments.length){var b=arguments[0],c=arguments[1];c.x=this._coordinates[b].x,c.y=this._coordinates[b].y,c.z=this._coordinates[b].z}},hk.prototype.getCoordinateCopy=function(a){return new wi(this._coordinates[a])},hk.prototype.getDimension=function(){return this._dimension},hk.prototype.getX=function(a){return this._coordinates[a].x},hk.prototype.clone=function(){for(var a=new Array(this.size()).fill(null),b=0;b<this._coordinates.length;b++)a[b]=this._coordinates[b].clone();return new hk(a,this._dimension)},hk.prototype.expandEnvelope=function(a){for(var b=0;b<this._coordinates.length;b++)a.expandToInclude(this._coordinates[b]);return a},hk.prototype.copy=function(){for(var a=new Array(this.size()).fill(null),b=0;b<this._coordinates.length;b++)a[b]=this._coordinates[b].copy();return new hk(a,this._dimension)},hk.prototype.toString=function(){if(this._coordinates.length>0){var a=new Fi(17*this._coordinates.length);a.append("("),a.append(this._coordinates[0]);for(var b=1;b<this._coordinates.length;b++)a.append(", "),a.append(this._coordinates[b]);return a.append(")"),a.toString()}return"()"},hk.prototype.getY=function(a){return this._coordinates[a].y},hk.prototype.toCoordinateArray=function(){return this._coordinates},hk.prototype.interfaces_=function(){return[Mi,Ce]},hk.prototype.getClass=function(){return hk},ik.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(hk,ik);var jk=function(){},kk={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};jk.prototype.readResolve=function(){return jk.instance()},jk.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array){var a=arguments[0];return new hk(a)}if(Ci(arguments[0],Mi)){var b=arguments[0];return new hk(b)}}else if(2===arguments.length){var c=arguments[0],d=arguments[1];return d>3&&(d=3),2>d?new hk(c):new hk(c,d)}},jk.prototype.interfaces_=function(){return[zi,Ce]},jk.prototype.getClass=function(){return jk},jk.instance=function(){return jk.instanceObject},kk.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},kk.instanceObject.get=function(){return new jk},Object.defineProperties(jk,kk);var lk=function(a){function b(){a.call(this),this.map_=new Map}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.get=function(a){return this.map_.get(a)||null},b.prototype.put=function(a,b){return this.map_.set(a,b),b},b.prototype.values=function(){for(var a=new wj,b=this.map_.values(),c=b.next();!c.done;)a.add(c.value),c=b.next();return a},b.prototype.entrySet=function(){var a=new Fj;return this.map_.entries().forEach(function(b){return a.add(b)}),a},b.prototype.size=function(){return this.map_.size()},b}(Dj),mk=function Ho(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=Ho.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof ok){var a=arguments[0];this._modelType=a,a===Ho.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var b=arguments[0];this._modelType=Ho.FIXED,this.setScale(b)}else if(arguments[0]instanceof Ho){var c=arguments[0];this._modelType=c._modelType,this._scale=c._scale}},nk={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};mk.prototype.equals=function(a){if(!(a instanceof mk))return!1;var b=a;return this._modelType===b._modelType&&this._scale===b._scale},mk.prototype.compareTo=function(a){var b=a,c=this.getMaximumSignificantDigits(),d=b.getMaximumSignificantDigits();return new Gi(c).compareTo(new Gi(d))},mk.prototype.getScale=function(){return this._scale},mk.prototype.isFloating=function(){return this._modelType===mk.FLOATING||this._modelType===mk.FLOATING_SINGLE},mk.prototype.getType=function(){return this._modelType},mk.prototype.toString=function(){var a="UNKNOWN";return this._modelType===mk.FLOATING?a="Floating":this._modelType===mk.FLOATING_SINGLE?a="Floating-Single":this._modelType===mk.FIXED&&(a="Fixed (Scale="+this.getScale()+")"),a},mk.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var a=arguments[0];return ri.isNaN(a)?a:this._modelType===mk.FLOATING_SINGLE?a:this._modelType===mk.FIXED?Math.round(a*this._scale)/this._scale:a}if(arguments[0]instanceof wi){var b=arguments[0];if(this._modelType===mk.FLOATING)return null;b.x=this.makePrecise(b.x),b.y=this.makePrecise(b.y)}},mk.prototype.getMaximumSignificantDigits=function(){var a=16;return this._modelType===mk.FLOATING?a=16:this._modelType===mk.FLOATING_SINGLE?a=6:this._modelType===mk.FIXED&&(a=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),a},mk.prototype.setScale=function(a){this._scale=Math.abs(a)},mk.prototype.interfaces_=function(){return[Ce,ti]},mk.prototype.getClass=function(){return mk},mk.mostPrecise=function(a,b){return a.compareTo(b)>=0?a:b},nk.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},nk.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(mk,nk);var ok=function Io(a){this._name=a||null,Io.nameToTypeMap.put(a,this)},pk={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ok.prototype.readResolve=function(){return ok.nameToTypeMap.get(this._name)},ok.prototype.toString=function(){return this._name},ok.prototype.interfaces_=function(){return[Ce]},ok.prototype.getClass=function(){return ok},pk.serialVersionUID.get=function(){return-552860263173159e4},pk.nameToTypeMap.get=function(){return new lk},Object.defineProperties(ok,pk),mk.Type=ok,mk.FIXED=new ok("FIXED"),mk.FLOATING=new ok("FLOATING"),mk.FLOATING_SINGLE=new ok("FLOATING SINGLE");var qk=function Jo(){this._precisionModel=new mk,this._SRID=0,this._coordinateSequenceFactory=Jo.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?Ci(arguments[0],zi)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof mk&&(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]))},rk={serialVersionUID:{configurable:!0}};qk.prototype.toGeometry=function(a){return a.isNull()?this.createPoint(null):a.getMinX()===a.getMaxX()&&a.getMinY()===a.getMaxY()?this.createPoint(new wi(a.getMinX(),a.getMinY())):a.getMinX()===a.getMaxX()||a.getMinY()===a.getMaxY()?this.createLineString([new wi(a.getMinX(),a.getMinY()),new wi(a.getMaxX(),a.getMaxY())]):this.createPolygon(this.createLinearRing([new wi(a.getMinX(),a.getMinY()),new wi(a.getMinX(),a.getMaxY()),new wi(a.getMaxX(),a.getMaxY()),new wi(a.getMaxX(),a.getMinY()),new wi(a.getMinX(),a.getMinY())]),null)},qk.prototype.createLineString=function(a){return a?a instanceof Array?new Wj(this.getCoordinateSequenceFactory().create(a),this):Ci(a,Mi)?new Wj(a,this):void 0:new Wj(this.getCoordinateSequenceFactory().create([]),this)},qk.prototype.createMultiLineString=function(){if(0===arguments.length)return new Qj(null,this);if(1===arguments.length){var a=arguments[0];return new Qj(a,this)}},qk.prototype.buildGeometry=function(a){for(var b=null,c=!1,d=!1,e=a.iterator();e.hasNext();){var f=e.next(),g=f.getClass();null===b&&(b=g),g!==b&&(c=!0),f.isGeometryCollectionOrDerived()&&(d=!0)}if(null===b)return this.createGeometryCollection();if(c||d)return this.createGeometryCollection(qk.toGeometryArray(a));var h=a.iterator().next();if(a.size()>1){if(h instanceof $j)return this.createMultiPolygon(qk.toPolygonArray(a));if(h instanceof Wj)return this.createMultiLineString(qk.toLineStringArray(a));if(h instanceof Yj)return this.createMultiPoint(qk.toPointArray(a));_i.shouldNeverReachHere("Unhandled class: "+h.getClass().getName())}return h},qk.prototype.createMultiPointFromCoords=function(a){return this.createMultiPoint(null!==a?this.getCoordinateSequenceFactory().create(a):null)},qk.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof wi){var a=arguments[0];return this.createPoint(null!==a?this.getCoordinateSequenceFactory().create([a]):null)}if(Ci(arguments[0],Mi)){var b=arguments[0];return new Yj(b,this)}}},qk.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},qk.prototype.createPolygon=function(){if(0===arguments.length)return new $j(null,null,this);if(1===arguments.length){if(Ci(arguments[0],Mi)){var a=arguments[0];return this.createPolygon(this.createLinearRing(a))}if(arguments[0]instanceof Array){var b=arguments[0];return this.createPolygon(this.createLinearRing(b))}if(arguments[0]instanceof ak){var c=arguments[0];return this.createPolygon(c,null)}}else if(2===arguments.length){var d=arguments[0],e=arguments[1];return new $j(d,e,this)}},qk.prototype.getSRID=function(){return this._SRID},qk.prototype.createGeometryCollection=function(){if(0===arguments.length)return new Pj(null,this);if(1===arguments.length){var a=arguments[0];return new Pj(a,this)}},qk.prototype.createGeometry=function(a){return new ck(this).edit(a,{edit:function(){if(2===arguments.length){var a=arguments[0];return this._coordinateSequenceFactory.create(a)}}})},qk.prototype.getPrecisionModel=function(){return this._precisionModel},qk.prototype.createLinearRing=function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var a=arguments[0];return this.createLinearRing(null!==a?this.getCoordinateSequenceFactory().create(a):null)}if(Ci(arguments[0],Mi)){var b=arguments[0];return new ak(b,this)}}},qk.prototype.createMultiPolygon=function(){if(0===arguments.length)return new bk(null,this);if(1===arguments.length){var a=arguments[0];return new bk(a,this)}},qk.prototype.createMultiPoint=function(){if(0===arguments.length)return new _j(null,this);if(1===arguments.length){if(arguments[0]instanceof Array){var a=arguments[0];return new _j(a,this)}if(arguments[0]instanceof Array){var b=arguments[0];return this.createMultiPoint(null!==b?this.getCoordinateSequenceFactory().create(b):null)}if(Ci(arguments[0],Mi)){var c=arguments[0];if(null===c)return this.createMultiPoint(new Array(0).fill(null));for(var d=new Array(c.size()).fill(null),e=0;e<c.size();e++){var f=this.getCoordinateSequenceFactory().create(1,c.getDimension());Vj.copy(c,e,f,0,1),d[e]=this.createPoint(f)}return this.createMultiPoint(d)}}},qk.prototype.interfaces_=function(){return[Ce]},qk.prototype.getClass=function(){return qk},qk.toMultiPolygonArray=function(a){var b=new Array(a.size()).fill(null);return a.toArray(b)},qk.toGeometryArray=function(a){if(null===a)return null;var b=new Array(a.size()).fill(null);return a.toArray(b)},qk.getDefaultCoordinateSequenceFactory=function(){return jk.instance()},qk.toMultiLineStringArray=function(a){var b=new Array(a.size()).fill(null);return a.toArray(b)},qk.toLineStringArray=function(a){var b=new Array(a.size()).fill(null);return a.toArray(b)},qk.toMultiPointArray=function(a){var b=new Array(a.size()).fill(null);return a.toArray(b)},qk.toLinearRingArray=function(a){var b=new Array(a.size()).fill(null);return a.toArray(b)},qk.toPointArray=function(a){var b=new Array(a.size()).fill(null);return a.toArray(b)},qk.toPolygonArray=function(a){var b=new Array(a.size()).fill(null);return a.toArray(b)},qk.createPointFromInternalCoord=function(a,b){return b.getPrecisionModel().makePrecise(a),b.getFactory().createPoint(a)},rk.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(qk,rk);var sk=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],tk=function(a){this.geometryFactory=a||new qk};tk.prototype.read=function(a){var b,c=(b="string"==typeof a?JSON.parse(a):a).type;if(!uk[c])throw new Error("Unknown GeoJSON type: "+b.type);return-1!==sk.indexOf(c)?uk[c].apply(this,[b.coordinates]):"GeometryCollection"===c?uk[c].apply(this,[b.geometries]):uk[c].apply(this,[b])},tk.prototype.write=function(a){var b=a.getGeometryType();if(!vk[b])throw new Error("Geometry is not supported");return vk[b].apply(this,[a])};var uk={Feature:function(a){var b={};for(var c in a)b[c]=a[c];if(a.geometry){var d=a.geometry.type;if(!uk[d])throw new Error("Unknown GeoJSON type: "+a.type);b.geometry=this.read(a.geometry)}return a.bbox&&(b.bbox=uk.bbox.apply(this,[a.bbox])),b},FeatureCollection:function(a){var b={};if(a.features){b.features=[];for(var c=0;c<a.features.length;++c)b.features.push(this.read(a.features[c]))}return a.bbox&&(b.bbox=this.parse.bbox.apply(this,[a.bbox])),b},coordinates:function(a){for(var b=[],c=0;c<a.length;++c){var d=a[c];b.push(new wi(d[0],d[1]))}return b},bbox:function(a){return this.geometryFactory.createLinearRing([new wi(a[0],a[1]),new wi(a[2],a[1]),new wi(a[2],a[3]),new wi(a[0],a[3]),new wi(a[0],a[1])])},Point:function(a){var b=new wi(a[0],a[1]);return this.geometryFactory.createPoint(b)},MultiPoint:function(a){for(var b=[],c=0;c<a.length;++c)b.push(uk.Point.apply(this,[a[c]]));return this.geometryFactory.createMultiPoint(b)},LineString:function(a){var b=uk.coordinates.apply(this,[a]);return this.geometryFactory.createLineString(b)},MultiLineString:function(a){for(var b=[],c=0;c<a.length;++c)b.push(uk.LineString.apply(this,[a[c]]));return this.geometryFactory.createMultiLineString(b)},Polygon:function(a){for(var b=uk.coordinates.apply(this,[a[0]]),c=this.geometryFactory.createLinearRing(b),d=[],e=1;e<a.length;++e){var f=a[e],g=uk.coordinates.apply(this,[f]),h=this.geometryFactory.createLinearRing(g);d.push(h)}return this.geometryFactory.createPolygon(c,d)},MultiPolygon:function(a){for(var b=[],c=0;c<a.length;++c){var d=a[c];b.push(uk.Polygon.apply(this,[d]))}return this.geometryFactory.createMultiPolygon(b)},GeometryCollection:function(a){for(var b=[],c=0;c<a.length;++c){var d=a[c];b.push(this.read(d))}return this.geometryFactory.createGeometryCollection(b)}},vk={coordinate:function(a){return[a.x,a.y]},Point:function(a){return{type:"Point",coordinates:vk.coordinate.apply(this,[a.getCoordinate()])}},MultiPoint:function(a){for(var b=[],c=0;c<a._geometries.length;++c){var d=a._geometries[c],e=vk.Point.apply(this,[d]);b.push(e.coordinates)}return{type:"MultiPoint",coordinates:b}},LineString:function(a){for(var b=[],c=a.getCoordinates(),d=0;d<c.length;++d){var e=c[d];b.push(vk.coordinate.apply(this,[e]))}return{type:"LineString",coordinates:b}},MultiLineString:function(a){for(var b=[],c=0;c<a._geometries.length;++c){var d=a._geometries[c],e=vk.LineString.apply(this,[d]);b.push(e.coordinates)}return{type:"MultiLineString",coordinates:b}},Polygon:function(a){var b=[],c=vk.LineString.apply(this,[a._shell]);b.push(c.coordinates);for(var d=0;d<a._holes.length;++d){var e=a._holes[d],f=vk.LineString.apply(this,[e]);b.push(f.coordinates)}return{type:"Polygon",coordinates:b}},MultiPolygon:function(a){for(var b=[],c=0;c<a._geometries.length;++c){var d=a._geometries[c],e=vk.Polygon.apply(this,[d]);b.push(e.coordinates)}return{type:"MultiPolygon",coordinates:b}},GeometryCollection:function(a){for(var b=[],c=0;c<a._geometries.length;++c){var d=a._geometries[c],e=d.getGeometryType();b.push(vk[e].apply(this,[d]))}return{type:"GeometryCollection",geometries:b}}},wk=function(a){this.geometryFactory=a||new qk,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new tk(this.geometryFactory)};wk.prototype.read=function(a){var b=this.parser.read(a);return this.precisionModel.getType()===mk.FIXED&&this.reducePrecision(b),b},wk.prototype.reducePrecision=function(a){var b,c;if(a.coordinate)this.precisionModel.makePrecise(a.coordinate);else if(a.points)for(b=0,c=a.points.length;c>b;b++)this.precisionModel.makePrecise(a.points[b]);else if(a.geometries)for(b=0,c=a.geometries.length;c>b;b++)this.reducePrecision(a.geometries[b])};var xk=function(){this.parser=new tk(this.geometryFactory)};xk.prototype.write=function(a){return this.parser.write(a)};var yk=function(){},zk={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};yk.prototype.interfaces_=function(){return[]},yk.prototype.getClass=function(){return yk},yk.opposite=function(a){return a===yk.LEFT?yk.RIGHT:a===yk.RIGHT?yk.LEFT:a},zk.ON.get=function(){return 0},zk.LEFT.get=function(){return 1},zk.RIGHT.get=function(){return 2},Object.defineProperties(yk,zk),(Pe.prototype=new Error).name="EmptyStackException",(Qe.prototype=new vj).add=function(a){return this.array_.push(a),!0},Qe.prototype.get=function(a){if(0>a||a>=this.size())throw new Error;return this.array_[a]},Qe.prototype.push=function(a){return this.array_.push(a),a},Qe.prototype.pop=function(a){if(0===this.array_.length)throw new Pe;return this.array_.pop()},Qe.prototype.peek=function(){if(0===this.array_.length)throw new Pe;return this.array_[this.array_.length-1]},Qe.prototype.empty=function(){return 0===this.array_.length},Qe.prototype.isEmpty=function(){return this.empty()},Qe.prototype.search=function(a){return this.array_.indexOf(a)},Qe.prototype.size=function(){return this.array_.length},Qe.prototype.toArray=function(){for(var a=[],b=0,c=this.array_.length;c>b;b++)a.push(this.array_[b]);return a};var Ak=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};Ak.prototype.getCoordinate=function(){return this._minCoord},Ak.prototype.getRightmostSide=function(a,b){var c=this.getRightmostSideOfSegment(a,b);return 0>c&&(c=this.getRightmostSideOfSegment(a,b-1)),0>c&&(this._minCoord=null,this.checkForRightmostCoordinate(a)),c},Ak.prototype.findRightmostEdgeAtVertex=function(){var a=this._minDe.getEdge().getCoordinates();_i.isTrue(this._minIndex>0&&this._minIndex<a.length,"rightmost point expected to be interior vertex of edge");var b=a[this._minIndex-1],c=a[this._minIndex+1],d=fj.computeOrientation(this._minCoord,c,b),e=!1;b.y<this._minCoord.y&&c.y<this._minCoord.y&&d===fj.COUNTERCLOCKWISE?e=!0:b.y>this._minCoord.y&&c.y>this._minCoord.y&&d===fj.CLOCKWISE&&(e=!0),e&&(this._minIndex=this._minIndex-1)},Ak.prototype.getRightmostSideOfSegment=function(a,b){var c=a.getEdge().getCoordinates();if(0>b||b+1>=c.length)return-1;if(c[b].y===c[b+1].y)return-1;var d=yk.LEFT;return c[b].y<c[b+1].y&&(d=yk.RIGHT),d},Ak.prototype.getEdge=function(){return this._orientedDe},Ak.prototype.checkForRightmostCoordinate=function(a){for(var b=a.getEdge().getCoordinates(),c=0;c<b.length-1;c++)(null===this._minCoord||b[c].x>this._minCoord.x)&&(this._minDe=a,this._minIndex=c,this._minCoord=b[c])},Ak.prototype.findRightmostEdgeAtNode=function(){var a=this._minDe.getNode().getEdges();this._minDe=a.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},Ak.prototype.findEdge=function(a){for(var b=a.iterator();b.hasNext();){var c=b.next();c.isForward()&&this.checkForRightmostCoordinate(c)}_i.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)===yk.LEFT&&(this._orientedDe=this._minDe.getSym())},Ak.prototype.interfaces_=function(){return[]},Ak.prototype.getClass=function(){return Ak};var Bk=function(a){function b(c,d){a.call(this,b.msgWithCoord(c,d)),this.pt=d?new wi(d):null,this.name="TopologyException"}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.getCoordinate=function(){return this.pt},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b.msgWithCoord=function(a,b){return b?a:a+" [ "+b+" ]"},b}(Zi),Ck=function(){this.array_=[]};Ck.prototype.addLast=function(a){this.array_.push(a)},Ck.prototype.removeFirst=function(){return this.array_.shift()},Ck.prototype.isEmpty=function(){return 0===this.array_.length};var Dk=function(){this._finder=null,this._dirEdgeList=new wj,this._nodes=new wj,this._rightMostCoord=null,this._env=null,this._finder=new Ak};Dk.prototype.clearVisitedEdges=function(){for(var a=this._dirEdgeList.iterator();a.hasNext();)a.next().setVisited(!1)},Dk.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},Dk.prototype.computeNodeDepth=function(a){for(var b=null,c=a.getEdges().iterator();c.hasNext();){var d=c.next();if(d.isVisited()||d.getSym().isVisited()){b=d;break}}if(null===b)throw new Bk("unable to find edge to compute depths at "+a.getCoordinate());a.getEdges().computeDepths(b);for(var e=a.getEdges().iterator();e.hasNext();){var f=e.next();f.setVisited(!0),this.copySymDepths(f)}},Dk.prototype.computeDepth=function(a){this.clearVisitedEdges();var b=this._finder.getEdge();b.setEdgeDepths(yk.RIGHT,a),this.copySymDepths(b),this.computeDepths(b)},Dk.prototype.create=function(a){this.addReachable(a),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},Dk.prototype.findResultEdges=function(){for(var a=this._dirEdgeList.iterator();a.hasNext();){var b=a.next();b.getDepth(yk.RIGHT)>=1&&b.getDepth(yk.LEFT)<=0&&!b.isInteriorAreaEdge()&&b.setInResult(!0)}},Dk.prototype.computeDepths=function(a){var b=new Fj,c=new Ck,d=a.getNode();for(c.addLast(d),b.add(d),a.setVisited(!0);!c.isEmpty();){var e=c.removeFirst();b.add(e),this.computeNodeDepth(e);for(var f=e.getEdges().iterator();f.hasNext();){var g=f.next().getSym();if(!g.isVisited()){var h=g.getNode();b.contains(h)||(c.addLast(h),b.add(h))}}}},Dk.prototype.compareTo=function(a){var b=a;return this._rightMostCoord.x<b._rightMostCoord.x?-1:this._rightMostCoord.x>b._rightMostCoord.x?1:0},Dk.prototype.getEnvelope=function(){if(null===this._env){for(var a=new Si,b=this._dirEdgeList.iterator();b.hasNext();)for(var c=b.next().getEdge().getCoordinates(),d=0;d<c.length-1;d++)a.expandToInclude(c[d]);this._env=a}return this._env},Dk.prototype.addReachable=function(a){var b=new Qe;for(b.add(a);!b.empty();){var c=b.pop();this.add(c,b)}},Dk.prototype.copySymDepths=function(a){var b=a.getSym();b.setDepth(yk.LEFT,a.getDepth(yk.RIGHT)),b.setDepth(yk.RIGHT,a.getDepth(yk.LEFT))},Dk.prototype.add=function(a,b){a.setVisited(!0),this._nodes.add(a);for(var c=a.getEdges().iterator();c.hasNext();){var d=c.next();this._dirEdgeList.add(d);var e=d.getSym().getNode();e.isVisited()||b.push(e)}},Dk.prototype.getNodes=function(){return this._nodes},Dk.prototype.getDirectedEdges=function(){return this._dirEdgeList},Dk.prototype.interfaces_=function(){return[ti]},Dk.prototype.getClass=function(){return Dk};var Ek=function Ko(){if(this.location=null,
1===arguments.length){if(arguments[0]instanceof Array){var a=arguments[0];this.init(a.length)}else if(Number.isInteger(arguments[0])){var b=arguments[0];this.init(1),this.location[yk.ON]=b}else if(arguments[0]instanceof Ko){var c=arguments[0];if(this.init(c.location.length),null!==c)for(var d=0;d<this.location.length;d++)this.location[d]=c.location[d]}}else if(3===arguments.length){var e=arguments[0],f=arguments[1],g=arguments[2];this.init(3),this.location[yk.ON]=e,this.location[yk.LEFT]=f,this.location[yk.RIGHT]=g}};Ek.prototype.setAllLocations=function(a){for(var b=0;b<this.location.length;b++)this.location[b]=a},Ek.prototype.isNull=function(){for(var a=0;a<this.location.length;a++)if(this.location[a]!==Ai.NONE)return!1;return!0},Ek.prototype.setAllLocationsIfNull=function(a){for(var b=0;b<this.location.length;b++)this.location[b]===Ai.NONE&&(this.location[b]=a)},Ek.prototype.isLine=function(){return 1===this.location.length},Ek.prototype.merge=function(a){if(a.location.length>this.location.length){var b=new Array(3).fill(null);b[yk.ON]=this.location[yk.ON],b[yk.LEFT]=Ai.NONE,b[yk.RIGHT]=Ai.NONE,this.location=b}for(var c=0;c<this.location.length;c++)this.location[c]===Ai.NONE&&c<a.location.length&&(this.location[c]=a.location[c])},Ek.prototype.getLocations=function(){return this.location},Ek.prototype.flip=function(){if(this.location.length<=1)return null;var a=this.location[yk.LEFT];this.location[yk.LEFT]=this.location[yk.RIGHT],this.location[yk.RIGHT]=a},Ek.prototype.toString=function(){var a=new Fi;return this.location.length>1&&a.append(Ai.toLocationSymbol(this.location[yk.LEFT])),a.append(Ai.toLocationSymbol(this.location[yk.ON])),this.location.length>1&&a.append(Ai.toLocationSymbol(this.location[yk.RIGHT])),a.toString()},Ek.prototype.setLocations=function(a,b,c){this.location[yk.ON]=a,this.location[yk.LEFT]=b,this.location[yk.RIGHT]=c},Ek.prototype.get=function(a){return a<this.location.length?this.location[a]:Ai.NONE},Ek.prototype.isArea=function(){return this.location.length>1},Ek.prototype.isAnyNull=function(){for(var a=0;a<this.location.length;a++)if(this.location[a]===Ai.NONE)return!0;return!1},Ek.prototype.setLocation=function(){if(1===arguments.length){var a=arguments[0];this.setLocation(yk.ON,a)}else if(2===arguments.length){var b=arguments[0],c=arguments[1];this.location[b]=c}},Ek.prototype.init=function(a){this.location=new Array(a).fill(null),this.setAllLocations(Ai.NONE)},Ek.prototype.isEqualOnSide=function(a,b){return this.location[b]===a.location[b]},Ek.prototype.allPositionsEqual=function(a){for(var b=0;b<this.location.length;b++)if(this.location[b]!==a)return!1;return!0},Ek.prototype.interfaces_=function(){return[]},Ek.prototype.getClass=function(){return Ek};var Fk=function Lo(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments[0])){var a=arguments[0];this.elt[0]=new Ek(a),this.elt[1]=new Ek(a)}else if(arguments[0]instanceof Lo){var b=arguments[0];this.elt[0]=new Ek(b.elt[0]),this.elt[1]=new Ek(b.elt[1])}}else if(2===arguments.length){var c=arguments[0],d=arguments[1];this.elt[0]=new Ek(Ai.NONE),this.elt[1]=new Ek(Ai.NONE),this.elt[c].setLocation(d)}else if(3===arguments.length){var e=arguments[0],f=arguments[1],g=arguments[2];this.elt[0]=new Ek(e,f,g),this.elt[1]=new Ek(e,f,g)}else if(4===arguments.length){var h=arguments[0],i=arguments[1],j=arguments[2],k=arguments[3];this.elt[0]=new Ek(Ai.NONE,Ai.NONE,Ai.NONE),this.elt[1]=new Ek(Ai.NONE,Ai.NONE,Ai.NONE),this.elt[h].setLocations(i,j,k)}};Fk.prototype.getGeometryCount=function(){var a=0;return this.elt[0].isNull()||a++,this.elt[1].isNull()||a++,a},Fk.prototype.setAllLocations=function(a,b){this.elt[a].setAllLocations(b)},Fk.prototype.isNull=function(a){return this.elt[a].isNull()},Fk.prototype.setAllLocationsIfNull=function(){if(1===arguments.length){var a=arguments[0];this.setAllLocationsIfNull(0,a),this.setAllLocationsIfNull(1,a)}else if(2===arguments.length){var b=arguments[0],c=arguments[1];this.elt[b].setAllLocationsIfNull(c)}},Fk.prototype.isLine=function(a){return this.elt[a].isLine()},Fk.prototype.merge=function(a){for(var b=0;2>b;b++)null===this.elt[b]&&null!==a.elt[b]?this.elt[b]=new Ek(a.elt[b]):this.elt[b].merge(a.elt[b])},Fk.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},Fk.prototype.getLocation=function(){if(1===arguments.length){var a=arguments[0];return this.elt[a].get(yk.ON)}if(2===arguments.length){var b=arguments[0],c=arguments[1];return this.elt[b].get(c)}},Fk.prototype.toString=function(){var a=new Fi;return null!==this.elt[0]&&(a.append("A:"),a.append(this.elt[0].toString())),null!==this.elt[1]&&(a.append(" B:"),a.append(this.elt[1].toString())),a.toString()},Fk.prototype.isArea=function(){if(0===arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1===arguments.length){var a=arguments[0];return this.elt[a].isArea()}},Fk.prototype.isAnyNull=function(a){return this.elt[a].isAnyNull()},Fk.prototype.setLocation=function(){if(2===arguments.length){var a=arguments[0],b=arguments[1];this.elt[a].setLocation(yk.ON,b)}else if(3===arguments.length){var c=arguments[0],d=arguments[1],e=arguments[2];this.elt[c].setLocation(d,e)}},Fk.prototype.isEqualOnSide=function(a,b){return this.elt[0].isEqualOnSide(a.elt[0],b)&&this.elt[1].isEqualOnSide(a.elt[1],b)},Fk.prototype.allPositionsEqual=function(a,b){return this.elt[a].allPositionsEqual(b)},Fk.prototype.toLine=function(a){this.elt[a].isArea()&&(this.elt[a]=new Ek(this.elt[a].location[0]))},Fk.prototype.interfaces_=function(){return[]},Fk.prototype.getClass=function(){return Fk},Fk.toLineLabel=function(a){for(var b=new Fk(Ai.NONE),c=0;2>c;c++)b.setLocation(c,a.getLocation(c));return b};var Gk=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new wj,this._pts=new wj,this._label=new Fk(Ai.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new wj,this._geometryFactory=null;var a=arguments[0],b=arguments[1];this._geometryFactory=b,this.computePoints(a),this.computeRing()};Gk.prototype.computeRing=function(){if(null!==this._ring)return null;for(var a=new Array(this._pts.size()).fill(null),b=0;b<this._pts.size();b++)a[b]=this._pts.get(b);this._ring=this._geometryFactory.createLinearRing(a),this._isHole=fj.isCCW(this._ring.getCoordinates())},Gk.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},Gk.prototype.computePoints=function(a){this._startDe=a;var b=a,c=!0;do{if(null===b)throw new Bk("Found null DirectedEdge");if(b.getEdgeRing()===this)throw new Bk("Directed Edge visited twice during ring-building at "+b.getCoordinate());this._edges.add(b);var d=b.getLabel();_i.isTrue(d.isArea()),this.mergeLabel(d),this.addPoints(b.getEdge(),b.isForward(),c),c=!1,this.setEdgeRing(b,this),b=this.getNext(b)}while(b!==this._startDe)},Gk.prototype.getLinearRing=function(){return this._ring},Gk.prototype.getCoordinate=function(a){return this._pts.get(a)},Gk.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var a=this._startDe;do{var b=a.getNode().getEdges().getOutgoingDegree(this);b>this._maxNodeDegree&&(this._maxNodeDegree=b),a=this.getNext(a)}while(a!==this._startDe);this._maxNodeDegree*=2},Gk.prototype.addPoints=function(a,b,c){var d=a.getCoordinates();if(b){var e=1;c&&(e=0);for(var f=e;f<d.length;f++)this._pts.add(d[f])}else{var g=d.length-2;c&&(g=d.length-1);for(var h=g;h>=0;h--)this._pts.add(d[h])}},Gk.prototype.isHole=function(){return this._isHole},Gk.prototype.setInResult=function(){var a=this._startDe;do a.getEdge().setInResult(!0),a=a.getNext();while(a!==this._startDe)},Gk.prototype.containsPoint=function(a){var b=this.getLinearRing();if(!b.getEnvelopeInternal().contains(a))return!1;if(!fj.isPointInRing(a,b.getCoordinates()))return!1;for(var c=this._holes.iterator();c.hasNext();)if(c.next().containsPoint(a))return!1;return!0},Gk.prototype.addHole=function(a){this._holes.add(a)},Gk.prototype.isShell=function(){return null===this._shell},Gk.prototype.getLabel=function(){return this._label},Gk.prototype.getEdges=function(){return this._edges},Gk.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Gk.prototype.getShell=function(){return this._shell},Gk.prototype.mergeLabel=function(){if(1===arguments.length){var a=arguments[0];this.mergeLabel(a,0),this.mergeLabel(a,1)}else if(2===arguments.length){var b=arguments[0],c=arguments[1],d=b.getLocation(c,yk.RIGHT);if(d===Ai.NONE)return null;if(this._label.getLocation(c)===Ai.NONE)return this._label.setLocation(c,d),null}},Gk.prototype.setShell=function(a){this._shell=a,null!==a&&a.addHole(this)},Gk.prototype.toPolygon=function(a){for(var b=new Array(this._holes.size()).fill(null),c=0;c<this._holes.size();c++)b[c]=this._holes.get(c).getLinearRing();return a.createPolygon(this.getLinearRing(),b)},Gk.prototype.interfaces_=function(){return[]},Gk.prototype.getClass=function(){return Gk};var Hk=function(a){function b(){var b=arguments[0],c=arguments[1];a.call(this,b,c)}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.setEdgeRing=function(a,b){a.setMinEdgeRing(b)},b.prototype.getNext=function(a){return a.getNextMin()},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b}(Gk),Ik=function(a){function b(){var b=arguments[0],c=arguments[1];a.call(this,b,c)}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.buildMinimalRings=function(){var a=new wj,b=this._startDe;do{if(null===b.getMinEdgeRing()){var c=new Hk(b,this._geometryFactory);a.add(c)}b=b.getNext()}while(b!==this._startDe);return a},b.prototype.setEdgeRing=function(a,b){a.setEdgeRing(b)},b.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var a=this._startDe;do a.getNode().getEdges().linkMinimalDirectedEdges(this),a=a.getNext();while(a!==this._startDe)},b.prototype.getNext=function(a){return a.getNext()},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b}(Gk),Jk=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 a=arguments[0];this._label=a}};Jk.prototype.setVisited=function(a){this._isVisited=a},Jk.prototype.setInResult=function(a){this._isInResult=a},Jk.prototype.isCovered=function(){return this._isCovered},Jk.prototype.isCoveredSet=function(){return this._isCoveredSet},Jk.prototype.setLabel=function(a){this._label=a},Jk.prototype.getLabel=function(){return this._label},Jk.prototype.setCovered=function(a){this._isCovered=a,this._isCoveredSet=!0},Jk.prototype.updateIM=function(a){_i.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(a)},Jk.prototype.isInResult=function(){return this._isInResult},Jk.prototype.isVisited=function(){return this._isVisited},Jk.prototype.interfaces_=function(){return[]},Jk.prototype.getClass=function(){return Jk};var Kk=function(a){function b(){a.call(this),this._coord=null,this._edges=null;var b=arguments[0],c=arguments[1];this._coord=b,this._edges=c,this._label=new Fk(0,Ai.NONE)}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.isIncidentEdgeInResult=function(){for(var a=this.getEdges().getEdges().iterator();a.hasNext();)if(a.next().getEdge().isInResult())return!0;return!1},b.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},b.prototype.getCoordinate=function(){return this._coord},b.prototype.print=function(a){a.println("node "+this._coord+" lbl: "+this._label)},b.prototype.computeIM=function(a){},b.prototype.computeMergedLocation=function(a,b){var c=Ai.NONE;if(c=this._label.getLocation(b),!a.isNull(b)){var d=a.getLocation(b);c!==Ai.BOUNDARY&&(c=d)}return c},b.prototype.setLabel=function(){if(2!==arguments.length)return a.prototype.setLabel.apply(this,arguments);var b=arguments[0],c=arguments[1];null===this._label?this._label=new Fk(b,c):this._label.setLocation(b,c)},b.prototype.getEdges=function(){return this._edges},b.prototype.mergeLabel=function(){if(arguments[0]instanceof b){var a=arguments[0];this.mergeLabel(a._label)}else if(arguments[0]instanceof Fk)for(var c=arguments[0],d=0;2>d;d++){var e=this.computeMergedLocation(c,d);this._label.getLocation(d)===Ai.NONE&&this._label.setLocation(d,e)}},b.prototype.add=function(a){this._edges.insert(a),a.setNode(this)},b.prototype.setLabelBoundary=function(a){if(null===this._label)return null;var b=Ai.NONE;null!==this._label&&(b=this._label.getLocation(a));var c=null;switch(b){case Ai.BOUNDARY:c=Ai.INTERIOR;break;case Ai.INTERIOR:default:c=Ai.BOUNDARY}this._label.setLocation(a,c)},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b}(Jk),Lk=function(){this.nodeMap=new Le,this.nodeFact=null;var a=arguments[0];this.nodeFact=a};Lk.prototype.find=function(a){return this.nodeMap.get(a)},Lk.prototype.addNode=function(){if(arguments[0]instanceof wi){var a=arguments[0],b=this.nodeMap.get(a);return null===b&&(b=this.nodeFact.createNode(a),this.nodeMap.put(a,b)),b}if(arguments[0]instanceof Kk){var c=arguments[0],d=this.nodeMap.get(c.getCoordinate());return null===d?(this.nodeMap.put(c.getCoordinate(),c),c):(d.mergeLabel(c),d)}},Lk.prototype.print=function(a){for(var b=this.iterator();b.hasNext();)b.next().print(a)},Lk.prototype.iterator=function(){return this.nodeMap.values().iterator()},Lk.prototype.values=function(){return this.nodeMap.values()},Lk.prototype.getBoundaryNodes=function(a){for(var b=new wj,c=this.iterator();c.hasNext();){var d=c.next();d.getLabel().getLocation(a)===Ai.BOUNDARY&&b.add(d)}return b},Lk.prototype.add=function(a){var b=a.getCoordinate();this.addNode(b).add(a)},Lk.prototype.interfaces_=function(){return[]},Lk.prototype.getClass=function(){return Lk};var Mk=function(){},Nk={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Mk.prototype.interfaces_=function(){return[]},Mk.prototype.getClass=function(){return Mk},Mk.isNorthern=function(a){return a===Mk.NE||a===Mk.NW},Mk.isOpposite=function(a,b){return a===b?!1:2===(a-b+4)%4},Mk.commonHalfPlane=function(a,b){if(a===b)return a;if(2===(a-b+4)%4)return-1;var c=b>a?a:b;return 0===c&&3===(a>b?a:b)?3:c},Mk.isInHalfPlane=function(a,b){return b===Mk.SE?a===Mk.SE||a===Mk.SW:a===b||a===b+1},Mk.quadrant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var a=arguments[0],b=arguments[1];if(0===a&&0===b)throw new qi("Cannot compute the quadrant for point ( "+a+", "+b+" )");return a>=0?b>=0?Mk.NE:Mk.SE:b>=0?Mk.NW:Mk.SW}if(arguments[0]instanceof wi&&arguments[1]instanceof wi){var c=arguments[0],d=arguments[1];if(d.x===c.x&&d.y===c.y)throw new qi("Cannot compute the quadrant for two identical points "+c);return d.x>=c.x?d.y>=c.y?Mk.NE:Mk.SE:d.y>=c.y?Mk.NW:Mk.SW}},Nk.NE.get=function(){return 0},Nk.NW.get=function(){return 1},Nk.SW.get=function(){return 2},Nk.SE.get=function(){return 3},Object.defineProperties(Mk,Nk);var Ok=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 a=arguments[0];this._edge=a}else if(3===arguments.length){var b=arguments[0],c=arguments[1],d=arguments[2];this._edge=b,this.init(c,d),this._label=null}else if(4===arguments.length){var e=arguments[0],f=arguments[1],g=arguments[2],h=arguments[3];this._edge=e,this.init(f,g),this._label=h}};Ok.prototype.compareDirection=function(a){return this._dx===a._dx&&this._dy===a._dy?0:this._quadrant>a._quadrant?1:this._quadrant<a._quadrant?-1:fj.computeOrientation(a._p0,a._p1,this._p1)},Ok.prototype.getDy=function(){return this._dy},Ok.prototype.getCoordinate=function(){return this._p0},Ok.prototype.setNode=function(a){this._node=a},Ok.prototype.print=function(a){var b=Math.atan2(this._dy,this._dx),c=this.getClass().getName(),d=c.lastIndexOf("."),e=c.substring(d+1);a.print("  "+e+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+b+"   "+this._label)},Ok.prototype.compareTo=function(a){var b=a;return this.compareDirection(b)},Ok.prototype.getDirectedCoordinate=function(){return this._p1},Ok.prototype.getDx=function(){return this._dx},Ok.prototype.getLabel=function(){return this._label},Ok.prototype.getEdge=function(){return this._edge},Ok.prototype.getQuadrant=function(){return this._quadrant},Ok.prototype.getNode=function(){return this._node},Ok.prototype.toString=function(){var a=Math.atan2(this._dy,this._dx),b=this.getClass().getName(),c=b.lastIndexOf(".");return"  "+b.substring(c+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+a+"   "+this._label},Ok.prototype.computeLabel=function(a){},Ok.prototype.init=function(a,b){this._p0=a,this._p1=b,this._dx=b.x-a.x,this._dy=b.y-a.y,this._quadrant=Mk.quadrant(this._dx,this._dy),_i.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},Ok.prototype.interfaces_=function(){return[ti]},Ok.prototype.getClass=function(){return Ok};var Pk=function(a){function b(){var b=arguments[0],c=arguments[1];if(a.call(this,b),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=c,c)this.init(b.getCoordinate(0),b.getCoordinate(1));else{var d=b.getNumPoints()-1;this.init(b.getCoordinate(d),b.getCoordinate(d-1))}this.computeDirectedLabel()}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.getNextMin=function(){return this._nextMin},b.prototype.getDepth=function(a){return this._depth[a]},b.prototype.setVisited=function(a){this._isVisited=a},b.prototype.computeDirectedLabel=function(){this._label=new Fk(this._edge.getLabel()),this._isForward||this._label.flip()},b.prototype.getNext=function(){return this._next},b.prototype.setDepth=function(a,b){if(-999!==this._depth[a]&&this._depth[a]!==b)throw new Bk("assigned depths do not match",this.getCoordinate());this._depth[a]=b},b.prototype.isInteriorAreaEdge=function(){for(var a=!0,b=0;2>b;b++)this._label.isArea(b)&&this._label.getLocation(b,yk.LEFT)===Ai.INTERIOR&&this._label.getLocation(b,yk.RIGHT)===Ai.INTERIOR||(a=!1);return a},b.prototype.setNextMin=function(a){this._nextMin=a},b.prototype.print=function(b){a.prototype.print.call(this,b),b.print(" "+this._depth[yk.LEFT]+"/"+this._depth[yk.RIGHT]),b.print(" ("+this.getDepthDelta()+")"),this._isInResult&&b.print(" inResult")},b.prototype.setMinEdgeRing=function(a){this._minEdgeRing=a},b.prototype.isLineEdge=function(){var a=this._label.isLine(0)||this._label.isLine(1),b=!this._label.isArea(0)||this._label.allPositionsEqual(0,Ai.EXTERIOR),c=!this._label.isArea(1)||this._label.allPositionsEqual(1,Ai.EXTERIOR);return a&&b&&c},b.prototype.setEdgeRing=function(a){this._edgeRing=a},b.prototype.getMinEdgeRing=function(){return this._minEdgeRing},b.prototype.getDepthDelta=function(){var a=this._edge.getDepthDelta();return this._isForward||(a=-a),a},b.prototype.setInResult=function(a){this._isInResult=a},b.prototype.getSym=function(){return this._sym},b.prototype.isForward=function(){return this._isForward},b.prototype.getEdge=function(){return this._edge},b.prototype.printEdge=function(a){this.print(a),a.print(" "),this._isForward?this._edge.print(a):this._edge.printReverse(a)},b.prototype.setSym=function(a){this._sym=a},b.prototype.setVisitedEdge=function(a){this.setVisited(a),this._sym.setVisited(a)},b.prototype.setEdgeDepths=function(a,b){var c=this.getEdge().getDepthDelta();this._isForward||(c=-c);var d=1;a===yk.LEFT&&(d=-1);var e=yk.opposite(a),f=b+c*d;this.setDepth(a,b),this.setDepth(e,f)},b.prototype.getEdgeRing=function(){return this._edgeRing},b.prototype.isInResult=function(){return this._isInResult},b.prototype.setNext=function(a){this._next=a},b.prototype.isVisited=function(){return this._isVisited},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b.depthFactor=function(a,b){return a===Ai.EXTERIOR&&b===Ai.INTERIOR?1:a===Ai.INTERIOR&&b===Ai.EXTERIOR?-1:0},b}(Ok),Qk=function(){};Qk.prototype.createNode=function(a){return new Kk(a,null)},Qk.prototype.interfaces_=function(){return[]},Qk.prototype.getClass=function(){return Qk};var Rk=function(){if(this._edges=new wj,this._nodes=null,this._edgeEndList=new wj,0===arguments.length)this._nodes=new Lk(new Qk);else if(1===arguments.length){var a=arguments[0];this._nodes=new Lk(a)}};Rk.prototype.printEdges=function(a){a.println("Edges:");for(var b=0;b<this._edges.size();b++){a.println("edge "+b+":");var c=this._edges.get(b);c.print(a),c.eiList.print(a)}},Rk.prototype.find=function(a){return this._nodes.find(a)},Rk.prototype.addNode=function(){if(arguments[0]instanceof Kk){var a=arguments[0];return this._nodes.addNode(a)}if(arguments[0]instanceof wi){var b=arguments[0];return this._nodes.addNode(b)}},Rk.prototype.getNodeIterator=function(){return this._nodes.iterator()},Rk.prototype.linkResultDirectedEdges=function(){for(var a=this._nodes.iterator();a.hasNext();)a.next().getEdges().linkResultDirectedEdges()},Rk.prototype.debugPrintln=function(a){Qi.out.println(a)},Rk.prototype.isBoundaryNode=function(a,b){var c=this._nodes.find(b);if(null===c)return!1;var d=c.getLabel();return null!==d&&d.getLocation(a)===Ai.BOUNDARY},Rk.prototype.linkAllDirectedEdges=function(){for(var a=this._nodes.iterator();a.hasNext();)a.next().getEdges().linkAllDirectedEdges()},Rk.prototype.matchInSameDirection=function(a,b,c,d){return!!a.equals(c)&&fj.computeOrientation(a,b,d)===fj.COLLINEAR&&Mk.quadrant(a,b)===Mk.quadrant(c,d)},Rk.prototype.getEdgeEnds=function(){return this._edgeEndList},Rk.prototype.debugPrint=function(a){Qi.out.print(a)},Rk.prototype.getEdgeIterator=function(){return this._edges.iterator()},Rk.prototype.findEdgeInSameDirection=function(a,b){for(var c=0;c<this._edges.size();c++){var d=this._edges.get(c),e=d.getCoordinates();if(this.matchInSameDirection(a,b,e[0],e[1]))return d;if(this.matchInSameDirection(a,b,e[e.length-1],e[e.length-2]))return d}return null},Rk.prototype.insertEdge=function(a){this._edges.add(a)},Rk.prototype.findEdgeEnd=function(a){for(var b=this.getEdgeEnds().iterator();b.hasNext();){var c=b.next();if(c.getEdge()===a)return c}return null},Rk.prototype.addEdges=function(a){for(var b=a.iterator();b.hasNext();){var c=b.next();this._edges.add(c);var d=new Pk(c,!0),e=new Pk(c,!1);d.setSym(e),e.setSym(d),this.add(d),this.add(e)}},Rk.prototype.add=function(a){this._nodes.add(a),this._edgeEndList.add(a)},Rk.prototype.getNodes=function(){return this._nodes.values()},Rk.prototype.findEdge=function(a,b){for(var c=0;c<this._edges.size();c++){var d=this._edges.get(c),e=d.getCoordinates();if(a.equals(e[0])&&b.equals(e[1]))return d}return null},Rk.prototype.interfaces_=function(){return[]},Rk.prototype.getClass=function(){return Rk},Rk.linkResultDirectedEdges=function(a){for(var b=a.iterator();b.hasNext();)b.next().getEdges().linkResultDirectedEdges()};var Sk=function(){this._geometryFactory=null,this._shellList=new wj;var a=arguments[0];this._geometryFactory=a};Sk.prototype.sortShellsAndHoles=function(a,b,c){for(var d=a.iterator();d.hasNext();){var e=d.next();e.isHole()?c.add(e):b.add(e)}},Sk.prototype.computePolygons=function(a){for(var b=new wj,c=a.iterator();c.hasNext();){var d=c.next().toPolygon(this._geometryFactory);b.add(d)}return b},Sk.prototype.placeFreeHoles=function(a,b){for(var c=b.iterator();c.hasNext();){var d=c.next();if(null===d.getShell()){var e=this.findEdgeRingContaining(d,a);if(null===e)throw new Bk("unable to assign hole to a shell",d.getCoordinate(0));d.setShell(e)}}},Sk.prototype.buildMinimalEdgeRings=function(a,b,c){for(var d=new wj,e=a.iterator();e.hasNext();){var f=e.next();if(f.getMaxNodeDegree()>2){f.linkDirectedEdgesForMinimalEdgeRings();var g=f.buildMinimalRings(),h=this.findShell(g);null!==h?(this.placePolygonHoles(h,g),b.add(h)):c.addAll(g)}else d.add(f)}return d},Sk.prototype.containsPoint=function(a){for(var b=this._shellList.iterator();b.hasNext();)if(b.next().containsPoint(a))return!0;return!1},Sk.prototype.buildMaximalEdgeRings=function(a){for(var b=new wj,c=a.iterator();c.hasNext();){var d=c.next();if(d.isInResult()&&d.getLabel().isArea()&&null===d.getEdgeRing()){var e=new Ik(d,this._geometryFactory);b.add(e),e.setInResult()}}return b},Sk.prototype.placePolygonHoles=function(a,b){for(var c=b.iterator();c.hasNext();){var d=c.next();d.isHole()&&d.setShell(a)}},Sk.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Sk.prototype.findEdgeRingContaining=function(a,b){for(var c=a.getLinearRing(),d=c.getEnvelopeInternal(),e=c.getCoordinateN(0),f=null,g=null,h=b.iterator();h.hasNext();){var i=h.next(),j=i.getLinearRing(),k=j.getEnvelopeInternal();null!==f&&(g=f.getLinearRing().getEnvelopeInternal());var l=!1;k.contains(d)&&fj.isPointInRing(e,j.getCoordinates())&&(l=!0),l&&(null===f||g.contains(k))&&(f=i)}return f},Sk.prototype.findShell=function(a){for(var b=0,c=null,d=a.iterator();d.hasNext();){var e=d.next();e.isHole()||(c=e,b++)}return _i.isTrue(1>=b,"found two shells in MinimalEdgeRing list"),c},Sk.prototype.add=function(){if(1===arguments.length){var a=arguments[0];this.add(a.getEdgeEnds(),a.getNodes())}else if(2===arguments.length){var b=arguments[0],c=arguments[1];Rk.linkResultDirectedEdges(c);var d=this.buildMaximalEdgeRings(b),e=new wj,f=this.buildMinimalEdgeRings(d,this._shellList,e);this.sortShellsAndHoles(f,this._shellList,e),this.placeFreeHoles(this._shellList,e)}},Sk.prototype.interfaces_=function(){return[]},Sk.prototype.getClass=function(){return Sk};var Tk=function(){};Tk.prototype.getBounds=function(){},Tk.prototype.interfaces_=function(){return[]},Tk.prototype.getClass=function(){return Tk};var Uk=function(){this._bounds=null,this._item=null;var a=arguments[0],b=arguments[1];this._bounds=a,this._item=b};Uk.prototype.getItem=function(){return this._item},Uk.prototype.getBounds=function(){return this._bounds},Uk.prototype.interfaces_=function(){return[Tk,Ce]},Uk.prototype.getClass=function(){return Uk};var Vk=function(){this._size=null,this._items=null,this._size=0,this._items=new wj,this._items.add(null)};Vk.prototype.poll=function(){if(this.isEmpty())return null;var a=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),a},Vk.prototype.size=function(){return this._size},Vk.prototype.reorder=function(a){for(var b=null,c=this._items.get(a);2*a<=this._size&&((b=2*a)!==this._size&&this._items.get(b+1).compareTo(this._items.get(b))<0&&b++,this._items.get(b).compareTo(c)<0);a=b)this._items.set(a,this._items.get(b));this._items.set(a,c)},Vk.prototype.clear=function(){this._size=0,this._items.clear()},Vk.prototype.isEmpty=function(){return 0===this._size},Vk.prototype.add=function(a){this._items.add(null),this._size+=1;var b=this._size;for(this._items.set(0,a);a.compareTo(this._items.get(Math.trunc(b/2)))<0;b/=2)this._items.set(b,this._items.get(Math.trunc(b/2)));this._items.set(b,a)},Vk.prototype.interfaces_=function(){return[]},Vk.prototype.getClass=function(){return Vk};var Wk=function(){};Wk.prototype.visitItem=function(a){},Wk.prototype.interfaces_=function(){return[]},Wk.prototype.getClass=function(){return Wk};var Xk=function(){};Xk.prototype.insert=function(a,b){},Xk.prototype.remove=function(a,b){},Xk.prototype.query=function(){},Xk.prototype.interfaces_=function(){return[]},Xk.prototype.getClass=function(){return Xk};var Yk=function(){if(this._childBoundables=new wj,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var a=arguments[0];this._level=a}},Zk={serialVersionUID:{configurable:!0}};Yk.prototype.getLevel=function(){return this._level},Yk.prototype.size=function(){return this._childBoundables.size()},Yk.prototype.getChildBoundables=function(){return this._childBoundables},Yk.prototype.addChildBoundable=function(a){_i.isTrue(null===this._bounds),this._childBoundables.add(a)},Yk.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Yk.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},Yk.prototype.interfaces_=function(){return[Tk,Ce]},Yk.prototype.getClass=function(){return Yk},Zk.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(Yk,Zk);var $k=function(){};$k.reverseOrder=function(){return{compare:function(a,b){return b.compareTo(a)}}},$k.min=function(a){return $k.sort(a),a.get(0)},$k.sort=function(a,b){var c=a.toArray();b?Kj.sort(c,b):Kj.sort(c);for(var d=a.iterator(),e=0,f=c.length;f>e;e++)d.next(),d.set(c[e])},$k.singletonList=function(a){var b=new wj;return b.add(a),b};var _k=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var a=arguments[0],b=arguments[1],c=arguments[2];this._boundable1=a,this._boundable2=b,this._itemDistance=c,this._distance=this.distance()};_k.prototype.expandToQueue=function(a,b){var c=_k.isComposite(this._boundable1),d=_k.isComposite(this._boundable2);if(c&&d)return _k.area(this._boundable1)>_k.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,a,b),null):(this.expand(this._boundable2,this._boundable1,a,b),null);if(c)return this.expand(this._boundable1,this._boundable2,a,b),null;if(d)return this.expand(this._boundable2,this._boundable1,a,b),null;throw new qi("neither boundable is composite")},_k.prototype.isLeaves=function(){return!(_k.isComposite(this._boundable1)||_k.isComposite(this._boundable2))},_k.prototype.compareTo=function(a){var b=a;return this._distance<b._distance?-1:this._distance>b._distance?1:0},_k.prototype.expand=function(a,b,c,d){for(var e=a.getChildBoundables().iterator();e.hasNext();){var f=e.next(),g=new _k(f,b,this._itemDistance);g.getDistance()<d&&c.add(g)}},_k.prototype.getBoundable=function(a){return 0===a?this._boundable1:this._boundable2},_k.prototype.getDistance=function(){return this._distance},_k.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},_k.prototype.interfaces_=function(){return[ti]},_k.prototype.getClass=function(){return _k},_k.area=function(a){return a.getBounds().getArea()},_k.isComposite=function(a){return a instanceof Yk};var al=function Mo(){if(this._root=null,this._built=!1,this._itemBoundables=new wj,this._nodeCapacity=null,0===arguments.length){var a=Mo.DEFAULT_NODE_CAPACITY;this._nodeCapacity=a}else if(1===arguments.length){var b=arguments[0];_i.isTrue(b>1,"Node capacity must be greater than 1"),this._nodeCapacity=b}},bl={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};al.prototype.getNodeCapacity=function(){return this._nodeCapacity},al.prototype.lastNode=function(a){return a.get(a.size()-1)},al.prototype.size=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var a=0,b=arguments[0].getChildBoundables().iterator();b.hasNext();){var c=b.next();c instanceof Yk?a+=this.size(c):c instanceof Uk&&(a+=1)}return a}},al.prototype.removeItem=function(a,b){for(var c=null,d=a.getChildBoundables().iterator();d.hasNext();){var e=d.next();e instanceof Uk&&e.getItem()===b&&(c=e)}return null!==c&&(a.getChildBoundables().remove(c),!0)},al.prototype.itemsTree=function(){if(0===arguments.length){this.build();var a=this.itemsTree(this._root);return null===a?new wj:a}if(1===arguments.length){for(var b=arguments[0],c=new wj,d=b.getChildBoundables().iterator();d.hasNext();){var e=d.next();if(e instanceof Yk){var f=this.itemsTree(e);null!==f&&c.add(f)}else e instanceof Uk?c.add(e.getItem()):_i.shouldNeverReachHere()}return c.size()<=0?null:c}},al.prototype.insert=function(a,b){_i.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Uk(a,b));
},al.prototype.boundablesAtLevel=function(){if(1===arguments.length){var a=arguments[0],b=new wj;return this.boundablesAtLevel(a,this._root,b),b}if(3===arguments.length){var c=arguments[0],d=arguments[1],e=arguments[2];if(_i.isTrue(c>-2),d.getLevel()===c)return e.add(d),null;for(var f=d.getChildBoundables().iterator();f.hasNext();){var g=f.next();g instanceof Yk?this.boundablesAtLevel(c,g,e):(_i.isTrue(g instanceof Uk),-1===c&&e.add(g))}return null}},al.prototype.query=function(){if(1===arguments.length){var a=arguments[0];this.build();var b=new wj;return this.isEmpty()?b:(this.getIntersectsOp().intersects(this._root.getBounds(),a)&&this.query(a,this._root,b),b)}if(2===arguments.length){var c=arguments[0],d=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),c)&&this.query(c,this._root,d)}else if(3===arguments.length)if(Ci(arguments[2],Wk)&&arguments[0]instanceof Object&&arguments[1]instanceof Yk)for(var e=arguments[0],f=arguments[1],g=arguments[2],h=f.getChildBoundables(),i=0;i<h.size();i++){var j=h.get(i);this.getIntersectsOp().intersects(j.getBounds(),e)&&(j instanceof Yk?this.query(e,j,g):j instanceof Uk?g.visitItem(j.getItem()):_i.shouldNeverReachHere())}else if(Ci(arguments[2],vj)&&arguments[0]instanceof Object&&arguments[1]instanceof Yk)for(var k=arguments[0],l=arguments[1],m=arguments[2],n=l.getChildBoundables(),o=0;o<n.size();o++){var p=n.get(o);this.getIntersectsOp().intersects(p.getBounds(),k)&&(p instanceof Yk?this.query(k,p,m):p instanceof Uk?m.add(p.getItem()):_i.shouldNeverReachHere())}},al.prototype.build=function(){return this._built?null:(this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0,void 0)},al.prototype.getRoot=function(){return this.build(),this._root},al.prototype.remove=function(){if(2===arguments.length){var a=arguments[0],b=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),a)&&this.remove(a,this._root,b)}if(3===arguments.length){var c=arguments[0],d=arguments[1],e=arguments[2],f=this.removeItem(d,e);if(f)return!0;for(var g=null,h=d.getChildBoundables().iterator();h.hasNext();){var i=h.next();if(this.getIntersectsOp().intersects(i.getBounds(),c)&&i instanceof Yk&&(f=this.remove(c,i,e))){g=i;break}}return null!==g&&g.getChildBoundables().isEmpty()&&d.getChildBoundables().remove(g),f}},al.prototype.createHigherLevels=function(a,b){_i.isTrue(!a.isEmpty());var c=this.createParentBoundables(a,b+1);return 1===c.size()?c.get(0):this.createHigherLevels(c,b+1)},al.prototype.depth=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var a=0,b=arguments[0].getChildBoundables().iterator();b.hasNext();){var c=b.next();if(c instanceof Yk){var d=this.depth(c);d>a&&(a=d)}}return a+1}},al.prototype.createParentBoundables=function(a,b){_i.isTrue(!a.isEmpty());var c=new wj;c.add(this.createNode(b));var d=new wj(a);$k.sort(d,this.getComparator());for(var e=d.iterator();e.hasNext();){var f=e.next();this.lastNode(c).getChildBoundables().size()===this.getNodeCapacity()&&c.add(this.createNode(b)),this.lastNode(c).addChildBoundable(f)}return c},al.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},al.prototype.interfaces_=function(){return[Ce]},al.prototype.getClass=function(){return al},al.compareDoubles=function(a,b){return a>b?1:b>a?-1:0},bl.IntersectsOp.get=function(){return cl},bl.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},bl.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(al,bl);var cl=function(){},dl=function(){};dl.prototype.distance=function(a,b){},dl.prototype.interfaces_=function(){return[]},dl.prototype.getClass=function(){return dl};var el=function(a){function b(c){c=c||b.DEFAULT_NODE_CAPACITY,a.call(this,c)}a&&(b.__proto__=a),(b.prototype=Object.create(a&&a.prototype)).constructor=b;var c={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return b.prototype.createParentBoundablesFromVerticalSlices=function(a,b){_i.isTrue(a.length>0);for(var c=new wj,d=0;d<a.length;d++)c.addAll(this.createParentBoundablesFromVerticalSlice(a[d],b));return c},b.prototype.createNode=function(a){return new fl(a)},b.prototype.size=function(){return 0===arguments.length?a.prototype.size.call(this):a.prototype.size.apply(this,arguments)},b.prototype.insert=function(){if(2!==arguments.length)return a.prototype.insert.apply(this,arguments);var b=arguments[0],c=arguments[1];return b.isNull()?null:void a.prototype.insert.call(this,b,c)},b.prototype.getIntersectsOp=function(){return b.intersectsOp},b.prototype.verticalSlices=function(a,b){for(var c=Math.trunc(Math.ceil(a.size()/b)),d=new Array(b).fill(null),e=a.iterator(),f=0;b>f;f++){d[f]=new wj;for(var g=0;e.hasNext()&&c>g;){var h=e.next();d[f].add(h),g++}}return d},b.prototype.query=function(){if(1===arguments.length){var b=arguments[0];return a.prototype.query.call(this,b)}if(2===arguments.length){var c=arguments[0],d=arguments[1];a.prototype.query.call(this,c,d)}else if(3===arguments.length)if(Ci(arguments[2],Wk)&&arguments[0]instanceof Object&&arguments[1]instanceof Yk){var e=arguments[0],f=arguments[1],g=arguments[2];a.prototype.query.call(this,e,f,g)}else if(Ci(arguments[2],vj)&&arguments[0]instanceof Object&&arguments[1]instanceof Yk){var h=arguments[0],i=arguments[1],j=arguments[2];a.prototype.query.call(this,h,i,j)}},b.prototype.getComparator=function(){return b.yComparator},b.prototype.createParentBoundablesFromVerticalSlice=function(b,c){return a.prototype.createParentBoundables.call(this,b,c)},b.prototype.remove=function(){if(2===arguments.length){var b=arguments[0],c=arguments[1];return a.prototype.remove.call(this,b,c)}return a.prototype.remove.apply(this,arguments)},b.prototype.depth=function(){return 0===arguments.length?a.prototype.depth.call(this):a.prototype.depth.apply(this,arguments)},b.prototype.createParentBoundables=function(a,c){_i.isTrue(!a.isEmpty());var d=Math.trunc(Math.ceil(a.size()/this.getNodeCapacity())),e=new wj(a);$k.sort(e,b.xComparator);var f=this.verticalSlices(e,Math.trunc(Math.ceil(Math.sqrt(d))));return this.createParentBoundablesFromVerticalSlices(f,c)},b.prototype.nearestNeighbour=function(){if(1===arguments.length){if(Ci(arguments[0],dl)){var a=arguments[0],c=new _k(this.getRoot(),this.getRoot(),a);return this.nearestNeighbour(c)}if(arguments[0]instanceof _k){var d=arguments[0];return this.nearestNeighbour(d,ri.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof b&&Ci(arguments[1],dl)){var e=arguments[0],f=arguments[1],g=new _k(this.getRoot(),e.getRoot(),f);return this.nearestNeighbour(g)}if(arguments[0]instanceof _k&&"number"==typeof arguments[1]){var h=arguments[0],i=arguments[1],j=null,k=new Vk;for(k.add(h);!k.isEmpty()&&i>0;){var l=k.poll(),m=l.getDistance();if(m>=i)break;l.isLeaves()?(i=m,j=l):l.expandToQueue(k,i)}return[j.getBoundable(0).getItem(),j.getBoundable(1).getItem()]}}else if(3===arguments.length){var n=arguments[0],o=arguments[1],p=arguments[2],q=new Uk(n,o),r=new _k(this.getRoot(),q,p);return this.nearestNeighbour(r)[0]}},b.prototype.interfaces_=function(){return[Xk,Ce]},b.prototype.getClass=function(){return b},b.centreX=function(a){return b.avg(a.getMinX(),a.getMaxX())},b.avg=function(a,b){return(a+b)/2},b.centreY=function(a){return b.avg(a.getMinY(),a.getMaxY())},c.STRtreeNode.get=function(){return fl},c.serialVersionUID.get=function(){return 0x39920f7d5f261e0},c.xComparator.get=function(){return{interfaces_:function(){return[vi]},compare:function(c,d){return a.compareDoubles(b.centreX(c.getBounds()),b.centreX(d.getBounds()))}}},c.yComparator.get=function(){return{interfaces_:function(){return[vi]},compare:function(c,d){return a.compareDoubles(b.centreY(c.getBounds()),b.centreY(d.getBounds()))}}},c.intersectsOp.get=function(){return{interfaces_:function(){return[a.IntersectsOp]},intersects:function(a,b){return a.intersects(b)}}},c.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(b,c),b}(al),fl=function(a){function b(){var b=arguments[0];a.call(this,b)}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.computeBounds=function(){for(var a=null,b=this.getChildBoundables().iterator();b.hasNext();){var c=b.next();null===a?a=new Si(c.getBounds()):a.expandToInclude(c.getBounds())}return a},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b}(Yk),gl=function(){};gl.prototype.interfaces_=function(){return[]},gl.prototype.getClass=function(){return gl},gl.relativeSign=function(a,b){return b>a?-1:a>b?1:0},gl.compare=function(a,b,c){if(b.equals2D(c))return 0;var d=gl.relativeSign(b.x,c.x),e=gl.relativeSign(b.y,c.y);switch(a){case 0:return gl.compareValue(d,e);case 1:return gl.compareValue(e,d);case 2:return gl.compareValue(e,-d);case 3:return gl.compareValue(-d,e);case 4:return gl.compareValue(-d,-e);case 5:return gl.compareValue(-e,-d);case 6:return gl.compareValue(-e,d);case 7:return gl.compareValue(d,-e)}return _i.shouldNeverReachHere("invalid octant value"),0},gl.compareValue=function(a,b){return 0>a?-1:a>0?1:0>b?-1:b>0?1:0};var hl=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var a=arguments[0],b=arguments[1],c=arguments[2],d=arguments[3];this._segString=a,this.coord=new wi(b),this.segmentIndex=c,this._segmentOctant=d,this._isInterior=!b.equals2D(a.getCoordinate(c))};hl.prototype.getCoordinate=function(){return this.coord},hl.prototype.print=function(a){a.print(this.coord),a.print(" seg # = "+this.segmentIndex)},hl.prototype.compareTo=function(a){var b=a;return this.segmentIndex<b.segmentIndex?-1:this.segmentIndex>b.segmentIndex?1:this.coord.equals2D(b.coord)?0:gl.compare(this._segmentOctant,this.coord,b.coord)},hl.prototype.isEndPoint=function(a){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===a},hl.prototype.isInterior=function(){return this._isInterior},hl.prototype.interfaces_=function(){return[ti]},hl.prototype.getClass=function(){return hl};var il=function(){this._nodeMap=new Le,this._edge=null;var a=arguments[0];this._edge=a};il.prototype.getSplitCoordinates=function(){var a=new yj;this.addEndpoints();for(var b=this.iterator(),c=b.next();b.hasNext();){var d=b.next();this.addEdgeCoordinates(c,d,a),c=d}return a.toCoordinateArray()},il.prototype.addCollapsedNodes=function(){var a=new wj;this.findCollapsesFromInsertedNodes(a),this.findCollapsesFromExistingVertices(a);for(var b=a.iterator();b.hasNext();){var c=b.next().intValue();this.add(this._edge.getCoordinate(c),c)}},il.prototype.print=function(a){a.println("Intersections:");for(var b=this.iterator();b.hasNext();)b.next().print(a)},il.prototype.findCollapsesFromExistingVertices=function(a){for(var b=0;b<this._edge.size()-2;b++){var c=this._edge.getCoordinate(b),d=this._edge.getCoordinate(b+2);c.equals2D(d)&&a.add(new Gi(b+1))}},il.prototype.addEdgeCoordinates=function(a,b,c){var d=this._edge.getCoordinate(b.segmentIndex),e=b.isInterior()||!b.coord.equals2D(d);c.add(new wi(a.coord),!1);for(var f=a.segmentIndex+1;f<=b.segmentIndex;f++)c.add(this._edge.getCoordinate(f));e&&c.add(new wi(b.coord))},il.prototype.iterator=function(){return this._nodeMap.values().iterator()},il.prototype.addSplitEdges=function(a){this.addEndpoints(),this.addCollapsedNodes();for(var b=this.iterator(),c=b.next();b.hasNext();){var d=b.next(),e=this.createSplitEdge(c,d);a.add(e),c=d}},il.prototype.findCollapseIndex=function(a,b,c){if(!a.coord.equals2D(b.coord))return!1;var d=b.segmentIndex-a.segmentIndex;return b.isInterior()||d--,1===d&&(c[0]=a.segmentIndex+1,!0)},il.prototype.findCollapsesFromInsertedNodes=function(a){for(var b=new Array(1).fill(null),c=this.iterator(),d=c.next();c.hasNext();){var e=c.next();this.findCollapseIndex(d,e,b)&&a.add(new Gi(b[0])),d=e}},il.prototype.getEdge=function(){return this._edge},il.prototype.addEndpoints=function(){var a=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(a),a)},il.prototype.createSplitEdge=function(a,b){var c=b.segmentIndex-a.segmentIndex+2,d=this._edge.getCoordinate(b.segmentIndex),e=b.isInterior()||!b.coord.equals2D(d);e||c--;var f=new Array(c).fill(null),g=0;f[g++]=new wi(a.coord);for(var h=a.segmentIndex+1;h<=b.segmentIndex;h++)f[g++]=this._edge.getCoordinate(h);return e&&(f[g]=new wi(b.coord)),new ml(f,this._edge.getData())},il.prototype.add=function(a,b){var c=new hl(this._edge,a,b,this._edge.getSegmentOctant(b)),d=this._nodeMap.get(c);return null!==d?(_i.isTrue(d.coord.equals2D(a),"Found equal nodes with different coordinates"),d):(this._nodeMap.put(c,c),c)},il.prototype.checkSplitEdgesCorrectness=function(a){var b=this._edge.getCoordinates(),c=a.get(0).getCoordinate(0);if(!c.equals2D(b[0]))throw new Zi("bad split edge start point at "+c);var d=a.get(a.size()-1).getCoordinates(),e=d[d.length-1];if(!e.equals2D(b[b.length-1]))throw new Zi("bad split edge end point at "+e)},il.prototype.interfaces_=function(){return[]},il.prototype.getClass=function(){return il};var jl=function(){};jl.prototype.interfaces_=function(){return[]},jl.prototype.getClass=function(){return jl},jl.octant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var a=arguments[0],b=arguments[1];if(0===a&&0===b)throw new qi("Cannot compute the octant for point ( "+a+", "+b+" )");var c=Math.abs(a),d=Math.abs(b);return a>=0?b>=0?c>=d?0:1:c>=d?7:6:b>=0?c>=d?3:2:c>=d?4:5}if(arguments[0]instanceof wi&&arguments[1]instanceof wi){var e=arguments[0],f=arguments[1],g=f.x-e.x,h=f.y-e.y;if(0===g&&0===h)throw new qi("Cannot compute the octant for two identical points "+e);return jl.octant(g,h)}};var kl=function(){};kl.prototype.getCoordinates=function(){},kl.prototype.size=function(){},kl.prototype.getCoordinate=function(a){},kl.prototype.isClosed=function(){},kl.prototype.setData=function(a){},kl.prototype.getData=function(){},kl.prototype.interfaces_=function(){return[]},kl.prototype.getClass=function(){return kl};var ll=function(){};ll.prototype.addIntersection=function(a,b){},ll.prototype.interfaces_=function(){return[kl]},ll.prototype.getClass=function(){return ll};var ml=function(){this._nodeList=new il(this),this._pts=null,this._data=null;var a=arguments[0],b=arguments[1];this._pts=a,this._data=b};ml.prototype.getCoordinates=function(){return this._pts},ml.prototype.size=function(){return this._pts.length},ml.prototype.getCoordinate=function(a){return this._pts[a]},ml.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},ml.prototype.getSegmentOctant=function(a){return a===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(a),this.getCoordinate(a+1))},ml.prototype.setData=function(a){this._data=a},ml.prototype.safeOctant=function(a,b){return a.equals2D(b)?0:jl.octant(a,b)},ml.prototype.getData=function(){return this._data},ml.prototype.addIntersection=function(){if(2===arguments.length){var a=arguments[0],b=arguments[1];this.addIntersectionNode(a,b)}else if(4===arguments.length){var c=arguments[0],d=arguments[1],e=arguments[3],f=new wi(c.getIntersection(e));this.addIntersection(f,d)}},ml.prototype.toString=function(){return Yi.toLineString(new hk(this._pts))},ml.prototype.getNodeList=function(){return this._nodeList},ml.prototype.addIntersectionNode=function(a,b){var c=b,d=c+1;if(d<this._pts.length){var e=this._pts[d];a.equals2D(e)&&(c=d)}return this._nodeList.add(a,c)},ml.prototype.addIntersections=function(a,b,c){for(var d=0;d<a.getIntersectionNum();d++)this.addIntersection(a,b,c,d)},ml.prototype.interfaces_=function(){return[ll]},ml.prototype.getClass=function(){return ml},ml.getNodedSubstrings=function(){if(1===arguments.length){var a=arguments[0],b=new wj;return ml.getNodedSubstrings(a,b),b}if(2===arguments.length)for(var c=arguments[0],d=arguments[1],e=c.iterator();e.hasNext();)e.next().getNodeList().addSplitEdges(d)};var nl=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new wi,this.p1=new wi;else if(1===arguments.length){var a=arguments[0];this.p0=new wi(a.p0),this.p1=new wi(a.p1)}else if(2===arguments.length)this.p0=arguments[0],this.p1=arguments[1];else if(4===arguments.length){var b=arguments[0],c=arguments[1],d=arguments[2],e=arguments[3];this.p0=new wi(b,c),this.p1=new wi(d,e)}},ol={serialVersionUID:{configurable:!0}};nl.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},nl.prototype.orientationIndex=function(){if(arguments[0]instanceof nl){var a=arguments[0],b=fj.orientationIndex(this.p0,this.p1,a.p0),c=fj.orientationIndex(this.p0,this.p1,a.p1);return b>=0&&c>=0?Math.max(b,c):0>=b&&0>=c?Math.max(b,c):0}if(arguments[0]instanceof wi){var d=arguments[0];return fj.orientationIndex(this.p0,this.p1,d)}},nl.prototype.toGeometry=function(a){return a.createLineString([this.p0,this.p1])},nl.prototype.isVertical=function(){return this.p0.x===this.p1.x},nl.prototype.equals=function(a){if(!(a instanceof nl))return!1;var b=a;return this.p0.equals(b.p0)&&this.p1.equals(b.p1)},nl.prototype.intersection=function(a){var b=new cj;return b.computeIntersection(this.p0,this.p1,a.p0,a.p1),b.hasIntersection()?b.getIntersection(0):null},nl.prototype.project=function(){if(arguments[0]instanceof wi){var a=arguments[0];if(a.equals(this.p0)||a.equals(this.p1))return new wi(a);var b=this.projectionFactor(a),c=new wi;return c.x=this.p0.x+b*(this.p1.x-this.p0.x),c.y=this.p0.y+b*(this.p1.y-this.p0.y),c}if(arguments[0]instanceof nl){var d=arguments[0],e=this.projectionFactor(d.p0),f=this.projectionFactor(d.p1);if(e>=1&&f>=1)return null;if(0>=e&&0>=f)return null;var g=this.project(d.p0);0>e&&(g=this.p0),e>1&&(g=this.p1);var h=this.project(d.p1);return 0>f&&(h=this.p0),f>1&&(h=this.p1),new nl(g,h)}},nl.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},nl.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},nl.prototype.getCoordinate=function(a){return 0===a?this.p0:this.p1},nl.prototype.distancePerpendicular=function(a){return fj.distancePointLinePerpendicular(a,this.p0,this.p1)},nl.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},nl.prototype.midPoint=function(){return nl.midPoint(this.p0,this.p1)},nl.prototype.projectionFactor=function(a){if(a.equals(this.p0))return 0;if(a.equals(this.p1))return 1;var b=this.p1.x-this.p0.x,c=this.p1.y-this.p0.y,d=b*b+c*c;return 0>=d?ri.NaN:((a.x-this.p0.x)*b+(a.y-this.p0.y)*c)/d},nl.prototype.closestPoints=function(a){var b=this.intersection(a);if(null!==b)return[b,b];var c=new Array(2).fill(null),d=ri.MAX_VALUE,e=null,f=this.closestPoint(a.p0);d=f.distance(a.p0),c[0]=f,c[1]=a.p0;var g=this.closestPoint(a.p1);(e=g.distance(a.p1))<d&&(d=e,c[0]=g,c[1]=a.p1);var h=a.closestPoint(this.p0);(e=h.distance(this.p0))<d&&(d=e,c[0]=this.p0,c[1]=h);var i=a.closestPoint(this.p1);return(e=i.distance(this.p1))<d&&(d=e,c[0]=this.p1,c[1]=i),c},nl.prototype.closestPoint=function(a){var b=this.projectionFactor(a);return b>0&&1>b?this.project(a):this.p0.distance(a)<this.p1.distance(a)?this.p0:this.p1},nl.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},nl.prototype.getLength=function(){return this.p0.distance(this.p1)},nl.prototype.compareTo=function(a){var b=a,c=this.p0.compareTo(b.p0);return 0!==c?c:this.p1.compareTo(b.p1)},nl.prototype.reverse=function(){var a=this.p0;this.p0=this.p1,this.p1=a},nl.prototype.equalsTopo=function(a){return this.p0.equals(a.p0)&&(this.p1.equals(a.p1)||this.p0.equals(a.p1))&&this.p1.equals(a.p0)},nl.prototype.lineIntersection=function(a){try{return Ri.intersection(this.p0,this.p1,a.p0,a.p1)}catch(a){if(!(a instanceof Pi))throw a}return null},nl.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},nl.prototype.pointAlongOffset=function(a,b){var c=this.p0.x+a*(this.p1.x-this.p0.x),d=this.p0.y+a*(this.p1.y-this.p0.y),e=this.p1.x-this.p0.x,f=this.p1.y-this.p0.y,g=Math.sqrt(e*e+f*f),h=0,i=0;if(0!==b){if(0>=g)throw new Error("Cannot compute offset from zero-length line segment");h=b*e/g,i=b*f/g}return new wi(c-i,d+h)},nl.prototype.setCoordinates=function(){if(1===arguments.length){var a=arguments[0];this.setCoordinates(a.p0,a.p1)}else if(2===arguments.length){var b=arguments[0],c=arguments[1];this.p0.x=b.x,this.p0.y=b.y,this.p1.x=c.x,this.p1.y=c.y}},nl.prototype.segmentFraction=function(a){var b=this.projectionFactor(a);return 0>b?b=0:(b>1||ri.isNaN(b))&&(b=1),b},nl.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},nl.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},nl.prototype.distance=function(){if(arguments[0]instanceof nl){var a=arguments[0];return fj.distanceLineLine(this.p0,this.p1,a.p0,a.p1)}if(arguments[0]instanceof wi){var b=arguments[0];return fj.distancePointLine(b,this.p0,this.p1)}},nl.prototype.pointAlong=function(a){var b=new wi;return b.x=this.p0.x+a*(this.p1.x-this.p0.x),b.y=this.p0.y+a*(this.p1.y-this.p0.y),b},nl.prototype.hashCode=function(){var a=ri.doubleToLongBits(this.p0.x);a^=31*ri.doubleToLongBits(this.p0.y);var b=Math.trunc(a)^Math.trunc(a>>32),c=ri.doubleToLongBits(this.p1.x);return c^=31*ri.doubleToLongBits(this.p1.y),b^(Math.trunc(c)^Math.trunc(c>>32))},nl.prototype.interfaces_=function(){return[ti,Ce]},nl.prototype.getClass=function(){return nl},nl.midPoint=function(a,b){return new wi((a.x+b.x)/2,(a.y+b.y)/2)},ol.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(nl,ol);var pl=function(){this.tempEnv1=new Si,this.tempEnv2=new Si,this._overlapSeg1=new nl,this._overlapSeg2=new nl};pl.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var a=arguments[0],b=arguments[1],c=arguments[2],d=arguments[3];a.getLineSegment(b,this._overlapSeg1),c.getLineSegment(d,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},pl.prototype.interfaces_=function(){return[]},pl.prototype.getClass=function(){return pl};var ql=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var a=arguments[0],b=arguments[1],c=arguments[2],d=arguments[3];this._pts=a,this._start=b,this._end=c,this._context=d};ql.prototype.getLineSegment=function(a,b){b.p0=this._pts[a],b.p1=this._pts[a+1]},ql.prototype.computeSelect=function(a,b,c,d){var e=this._pts[b],f=this._pts[c];if(d.tempEnv1.init(e,f),c-b==1)return d.select(this,b),null;if(!a.intersects(d.tempEnv1))return null;var g=Math.trunc((b+c)/2);g>b&&this.computeSelect(a,b,g,d),c>g&&this.computeSelect(a,g,c,d)},ql.prototype.getCoordinates=function(){for(var a=new Array(this._end-this._start+1).fill(null),b=0,c=this._start;c<=this._end;c++)a[b++]=this._pts[c];return a},ql.prototype.computeOverlaps=function(a,b){this.computeOverlapsInternal(this._start,this._end,a,a._start,a._end,b)},ql.prototype.setId=function(a){this._id=a},ql.prototype.select=function(a,b){this.computeSelect(a,this._start,this._end,b)},ql.prototype.getEnvelope=function(){if(null===this._env){var a=this._pts[this._start],b=this._pts[this._end];this._env=new Si(a,b)}return this._env},ql.prototype.getEndIndex=function(){return this._end},ql.prototype.getStartIndex=function(){return this._start},ql.prototype.getContext=function(){return this._context},ql.prototype.getId=function(){return this._id},ql.prototype.computeOverlapsInternal=function(a,b,c,d,e,f){var g=this._pts[a],h=this._pts[b],i=c._pts[d],j=c._pts[e];if(b-a==1&&e-d==1)return f.overlap(this,a,c,d),null;if(f.tempEnv1.init(g,h),f.tempEnv2.init(i,j),!f.tempEnv1.intersects(f.tempEnv2))return null;var k=Math.trunc((a+b)/2),l=Math.trunc((d+e)/2);k>a&&(l>d&&this.computeOverlapsInternal(a,k,c,d,l,f),e>l&&this.computeOverlapsInternal(a,k,c,l,e,f)),b>k&&(l>d&&this.computeOverlapsInternal(k,b,c,d,l,f),e>l&&this.computeOverlapsInternal(k,b,c,l,e,f))},ql.prototype.interfaces_=function(){return[]},ql.prototype.getClass=function(){return ql};var rl=function(){};rl.prototype.interfaces_=function(){return[]},rl.prototype.getClass=function(){return rl},rl.getChainStartIndices=function(a){var b=0,c=new wj;c.add(new Gi(b));do{var d=rl.findChainEnd(a,b);c.add(new Gi(d)),b=d}while(b<a.length-1);return rl.toIntArray(c)},rl.findChainEnd=function(a,b){for(var c=b;c<a.length-1&&a[c].equals2D(a[c+1]);)c++;if(c>=a.length-1)return a.length-1;for(var d=Mk.quadrant(a[c],a[c+1]),e=b+1;e<a.length&&(a[e-1].equals2D(a[e])||Mk.quadrant(a[e-1],a[e])===d);)e++;return e-1},rl.getChains=function(){if(1===arguments.length){var a=arguments[0];return rl.getChains(a,null)}if(2===arguments.length){for(var b=arguments[0],c=arguments[1],d=new wj,e=rl.getChainStartIndices(b),f=0;f<e.length-1;f++){var g=new ql(b,e[f],e[f+1],c);d.add(g)}return d}},rl.toIntArray=function(a){for(var b=new Array(a.size()).fill(null),c=0;c<b.length;c++)b[c]=a.get(c).intValue();return b};var sl=function(){};sl.prototype.computeNodes=function(a){},sl.prototype.getNodedSubstrings=function(){},sl.prototype.interfaces_=function(){return[]},sl.prototype.getClass=function(){return sl};var tl=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var a=arguments[0];this.setSegmentIntersector(a)}};tl.prototype.setSegmentIntersector=function(a){this._segInt=a},tl.prototype.interfaces_=function(){return[sl]},tl.prototype.getClass=function(){return tl};var ul=function(a){function b(b){b?a.call(this,b):a.call(this),this._monoChains=new wj,this._index=new el,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}a&&(b.__proto__=a),(b.prototype=Object.create(a&&a.prototype)).constructor=b;var c={SegmentOverlapAction:{configurable:!0}};return b.prototype.getMonotoneChains=function(){return this._monoChains},b.prototype.getNodedSubstrings=function(){return ml.getNodedSubstrings(this._nodedSegStrings)},b.prototype.getIndex=function(){return this._index},b.prototype.add=function(a){for(var b=rl.getChains(a.getCoordinates(),a).iterator();b.hasNext();){var c=b.next();c.setId(this._idCounter++),this._index.insert(c.getEnvelope(),c),this._monoChains.add(c)}},b.prototype.computeNodes=function(a){this._nodedSegStrings=a;for(var b=a.iterator();b.hasNext();)this.add(b.next());this.intersectChains()},b.prototype.intersectChains=function(){for(var a=new vl(this._segInt),b=this._monoChains.iterator();b.hasNext();)for(var c=b.next(),d=this._index.query(c.getEnvelope()).iterator();d.hasNext();){var e=d.next();if(e.getId()>c.getId()&&(c.computeOverlaps(e,a),this._nOverlaps++),this._segInt.isDone())return null}},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},c.SegmentOverlapAction.get=function(){return vl},Object.defineProperties(b,c),b}(tl),vl=function(a){function b(){a.call(this),this._si=null;var b=arguments[0];this._si=b}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.overlap=function(){if(4!==arguments.length)return a.prototype.overlap.apply(this,arguments);var b=arguments[0],c=arguments[1],d=arguments[2],e=arguments[3],f=b.getContext(),g=d.getContext();this._si.processIntersections(f,c,g,e)},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b}(pl),wl=function No(){if(this._quadrantSegments=No.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=No.CAP_ROUND,this._joinStyle=No.JOIN_ROUND,this._mitreLimit=No.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=No.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var a=arguments[0];this.setQuadrantSegments(a)}else if(2===arguments.length){var b=arguments[0],c=arguments[1];this.setQuadrantSegments(b),this.setEndCapStyle(c)}else if(4===arguments.length){var d=arguments[0],e=arguments[1],f=arguments[2],g=arguments[3];this.setQuadrantSegments(d),this.setEndCapStyle(e),this.setJoinStyle(f),this.setMitreLimit(g)}},xl={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}};wl.prototype.getEndCapStyle=function(){return this._endCapStyle},wl.prototype.isSingleSided=function(){return this._isSingleSided},wl.prototype.setQuadrantSegments=function(a){this._quadrantSegments=a,0===this._quadrantSegments&&(this._joinStyle=wl.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=wl.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),0>=a&&(this._quadrantSegments=1),this._joinStyle!==wl.JOIN_ROUND&&(this._quadrantSegments=wl.DEFAULT_QUADRANT_SEGMENTS)},wl.prototype.getJoinStyle=function(){return this._joinStyle},wl.prototype.setJoinStyle=function(a){this._joinStyle=a},wl.prototype.setSimplifyFactor=function(a){this._simplifyFactor=0>a?0:a},wl.prototype.getSimplifyFactor=function(){return this._simplifyFactor},wl.prototype.getQuadrantSegments=function(){return this._quadrantSegments},wl.prototype.setEndCapStyle=function(a){this._endCapStyle=a},wl.prototype.getMitreLimit=function(){return this._mitreLimit},wl.prototype.setMitreLimit=function(a){this._mitreLimit=a},wl.prototype.setSingleSided=function(a){this._isSingleSided=a},wl.prototype.interfaces_=function(){return[]},wl.prototype.getClass=function(){return wl},wl.bufferDistanceError=function(a){var b=Math.PI/2/a;return 1-Math.cos(b/2)},xl.CAP_ROUND.get=function(){return 1},xl.CAP_FLAT.get=function(){return 2},xl.CAP_SQUARE.get=function(){return 3},xl.JOIN_ROUND.get=function(){return 1},xl.JOIN_MITRE.get=function(){return 2},xl.JOIN_BEVEL.get=function(){return 3},xl.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},xl.DEFAULT_MITRE_LIMIT.get=function(){return 5},xl.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(wl,xl);var yl=function(a){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=fj.COUNTERCLOCKWISE,this._inputLine=a||null},zl={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};yl.prototype.isDeletable=function(a,b,c,d){var e=this._inputLine[a],f=this._inputLine[b],g=this._inputLine[c];return!!this.isConcave(e,f,g)&&!!this.isShallow(e,f,g,d)&&this.isShallowSampled(e,f,a,c,d)},yl.prototype.deleteShallowConcavities=function(){for(var a=1,b=this.findNextNonDeletedIndex(a),c=this.findNextNonDeletedIndex(b),d=!1;c<this._inputLine.length;){var e=!1;this.isDeletable(a,b,c,this._distanceTol)&&(this._isDeleted[b]=yl.DELETE,e=!0,d=!0),a=e?c:b,b=this.findNextNonDeletedIndex(a),c=this.findNextNonDeletedIndex(b)}return d},yl.prototype.isShallowConcavity=function(a,b,c,d){return fj.computeOrientation(a,b,c)!==this._angleOrientation?!1:fj.distancePointLine(b,a,c)<d},yl.prototype.isShallowSampled=function(a,b,c,d,e){var f=Math.trunc((d-c)/yl.NUM_PTS_TO_CHECK);0>=f&&(f=1);for(var g=c;d>g;g+=f)if(!this.isShallow(a,b,this._inputLine[g],e))return!1;return!0},yl.prototype.isConcave=function(a,b,c){var d=fj.computeOrientation(a,b,c)===this._angleOrientation;return d},yl.prototype.simplify=function(a){this._distanceTol=Math.abs(a),0>a&&(this._angleOrientation=fj.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var b=!1;do b=this.deleteShallowConcavities();while(b);return this.collapseLine()},yl.prototype.findNextNonDeletedIndex=function(a){for(var b=a+1;b<this._inputLine.length&&this._isDeleted[b]===yl.DELETE;)b++;return b},yl.prototype.isShallow=function(a,b,c,d){return fj.distancePointLine(b,a,c)<d},yl.prototype.collapseLine=function(){for(var a=new yj,b=0;b<this._inputLine.length;b++)this._isDeleted[b]!==yl.DELETE&&a.add(this._inputLine[b]);return a.toCoordinateArray()},yl.prototype.interfaces_=function(){return[]},yl.prototype.getClass=function(){
return yl},yl.simplify=function(a,b){return new yl(a).simplify(b)},zl.INIT.get=function(){return 0},zl.DELETE.get=function(){return 1},zl.KEEP.get=function(){return 1},zl.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(yl,zl);var Al=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new wj},Bl={COORDINATE_ARRAY_TYPE:{configurable:!0}};Al.prototype.getCoordinates=function(){return this._ptList.toArray(Al.COORDINATE_ARRAY_TYPE)},Al.prototype.setPrecisionModel=function(a){this._precisionModel=a},Al.prototype.addPt=function(a){var b=new wi(a);return this._precisionModel.makePrecise(b),this.isRedundant(b)?null:void this._ptList.add(b)},Al.prototype.revere=function(){},Al.prototype.addPts=function(a,b){if(b)for(var c=0;c<a.length;c++)this.addPt(a[c]);else for(var d=a.length-1;d>=0;d--)this.addPt(a[d])},Al.prototype.isRedundant=function(a){if(this._ptList.size()<1)return!1;var b=this._ptList.get(this._ptList.size()-1);return a.distance(b)<this._minimimVertexDistance},Al.prototype.toString=function(){return(new qk).createLineString(this.getCoordinates()).toString()},Al.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var a=new wi(this._ptList.get(0)),b=this._ptList.get(this._ptList.size()-1);return a.equals(b)?null:void this._ptList.add(a)},Al.prototype.setMinimumVertexDistance=function(a){this._minimimVertexDistance=a},Al.prototype.interfaces_=function(){return[]},Al.prototype.getClass=function(){return Al},Bl.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Al,Bl);var Cl=function(){},Dl={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};Cl.prototype.interfaces_=function(){return[]},Cl.prototype.getClass=function(){return Cl},Cl.toDegrees=function(a){return 180*a/Math.PI},Cl.normalize=function(a){for(;a>Math.PI;)a-=Cl.PI_TIMES_2;for(;a<=-Math.PI;)a+=Cl.PI_TIMES_2;return a},Cl.angle=function(){if(1===arguments.length){var a=arguments[0];return Math.atan2(a.y,a.x)}if(2===arguments.length){var b=arguments[0],c=arguments[1],d=c.x-b.x,e=c.y-b.y;return Math.atan2(e,d)}},Cl.isAcute=function(a,b,c){var d=a.x-b.x,e=a.y-b.y;return d*(c.x-b.x)+e*(c.y-b.y)>0},Cl.isObtuse=function(a,b,c){var d=a.x-b.x,e=a.y-b.y;return d*(c.x-b.x)+e*(c.y-b.y)<0},Cl.interiorAngle=function(a,b,c){var d=Cl.angle(b,a),e=Cl.angle(b,c);return Math.abs(e-d)},Cl.normalizePositive=function(a){if(0>a){for(;0>a;)a+=Cl.PI_TIMES_2;a>=Cl.PI_TIMES_2&&(a=0)}else{for(;a>=Cl.PI_TIMES_2;)a-=Cl.PI_TIMES_2;0>a&&(a=0)}return a},Cl.angleBetween=function(a,b,c){var d=Cl.angle(b,a),e=Cl.angle(b,c);return Cl.diff(d,e)},Cl.diff=function(a,b){var c=null;return(c=b>a?b-a:a-b)>Math.PI&&(c=2*Math.PI-c),c},Cl.toRadians=function(a){return a*Math.PI/180},Cl.getTurn=function(a,b){var c=Math.sin(b-a);return c>0?Cl.COUNTERCLOCKWISE:0>c?Cl.CLOCKWISE:Cl.NONE},Cl.angleBetweenOriented=function(a,b,c){var d=Cl.angle(b,a),e=Cl.angle(b,c)-d;return e<=-Math.PI?e+Cl.PI_TIMES_2:e>Math.PI?e-Cl.PI_TIMES_2:e},Dl.PI_TIMES_2.get=function(){return 2*Math.PI},Dl.PI_OVER_2.get=function(){return Math.PI/2},Dl.PI_OVER_4.get=function(){return Math.PI/4},Dl.COUNTERCLOCKWISE.get=function(){return fj.COUNTERCLOCKWISE},Dl.CLOCKWISE.get=function(){return fj.CLOCKWISE},Dl.NONE.get=function(){return fj.COLLINEAR},Object.defineProperties(Cl,Dl);var El=function Oo(){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 nl,this._seg1=new nl,this._offset0=new nl,this._offset1=new nl,this._side=0,this._hasNarrowConcaveAngle=!1;var a=arguments[0],b=arguments[1],c=arguments[2];this._precisionModel=a,this._bufParams=b,this._li=new cj,this._filletAngleQuantum=Math.PI/2/b.getQuadrantSegments(),b.getQuadrantSegments()>=8&&b.getJoinStyle()===wl.JOIN_ROUND&&(this._closingSegLengthFactor=Oo.MAX_CLOSING_SEG_LEN_FACTOR),this.init(c)},Fl={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}};El.prototype.addNextSegment=function(a,b){if(this._s0=this._s1,this._s1=this._s2,this._s2=a,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 c=fj.computeOrientation(this._s0,this._s1,this._s2),d=c===fj.CLOCKWISE&&this._side===yk.LEFT||c===fj.COUNTERCLOCKWISE&&this._side===yk.RIGHT;0===c?this.addCollinear(b):d?this.addOutsideTurn(c,b):this.addInsideTurn(c,b)},El.prototype.addLineEndCap=function(a,b){var c=new nl(a,b),d=new nl;this.computeOffsetSegment(c,yk.LEFT,this._distance,d);var e=new nl;this.computeOffsetSegment(c,yk.RIGHT,this._distance,e);var f=b.x-a.x,g=b.y-a.y,h=Math.atan2(g,f);switch(this._bufParams.getEndCapStyle()){case wl.CAP_ROUND:this._segList.addPt(d.p1),this.addFilletArc(b,h+Math.PI/2,h-Math.PI/2,fj.CLOCKWISE,this._distance),this._segList.addPt(e.p1);break;case wl.CAP_FLAT:this._segList.addPt(d.p1),this._segList.addPt(e.p1);break;case wl.CAP_SQUARE:var i=new wi;i.x=Math.abs(this._distance)*Math.cos(h),i.y=Math.abs(this._distance)*Math.sin(h);var j=new wi(d.p1.x+i.x,d.p1.y+i.y),k=new wi(e.p1.x+i.x,e.p1.y+i.y);this._segList.addPt(j),this._segList.addPt(k)}},El.prototype.getCoordinates=function(){return this._segList.getCoordinates()},El.prototype.addMitreJoin=function(a,b,c,d){var e=!0,f=null;try{f=Ri.intersection(b.p0,b.p1,c.p0,c.p1),(0>=d?1:f.distance(a)/Math.abs(d))>this._bufParams.getMitreLimit()&&(e=!1)}catch(a){if(!(a instanceof Pi))throw a;f=new wi(0,0),e=!1}e?this._segList.addPt(f):this.addLimitedMitreJoin(b,c,d,this._bufParams.getMitreLimit())},El.prototype.addFilletCorner=function(a,b,c,d,e){var f=b.x-a.x,g=b.y-a.y,h=Math.atan2(g,f),i=c.x-a.x,j=c.y-a.y,k=Math.atan2(j,i);d===fj.CLOCKWISE?k>=h&&(h+=2*Math.PI):h>=k&&(h-=2*Math.PI),this._segList.addPt(b),this.addFilletArc(a,h,k,d,e),this._segList.addPt(c)},El.prototype.addOutsideTurn=function(a,b){return this._offset0.p1.distance(this._offset1.p0)<this._distance*El.OFFSET_SEGMENT_SEPARATION_FACTOR?(this._segList.addPt(this._offset0.p1),null):void(this._bufParams.getJoinStyle()===wl.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===wl.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(b&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,a,this._distance),this._segList.addPt(this._offset1.p0)))},El.prototype.createSquare=function(a){this._segList.addPt(new wi(a.x+this._distance,a.y+this._distance)),this._segList.addPt(new wi(a.x+this._distance,a.y-this._distance)),this._segList.addPt(new wi(a.x-this._distance,a.y-this._distance)),this._segList.addPt(new wi(a.x-this._distance,a.y+this._distance)),this._segList.closeRing()},El.prototype.addSegments=function(a,b){this._segList.addPts(a,b)},El.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},El.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},El.prototype.initSideSegments=function(a,b,c){this._s1=a,this._s2=b,this._side=c,this._seg1.setCoordinates(a,b),this.computeOffsetSegment(this._seg1,c,this._distance,this._offset1)},El.prototype.addLimitedMitreJoin=function(a,b,c,d){var e=this._seg0.p1,f=Cl.angle(e,this._seg0.p0),g=Cl.angleBetweenOriented(this._seg0.p0,e,this._seg1.p1)/2,h=Cl.normalize(f+g),i=Cl.normalize(h+Math.PI),j=d*c,k=c-j*Math.abs(Math.sin(g)),l=e.x+j*Math.cos(i),m=e.y+j*Math.sin(i),n=new wi(l,m),o=new nl(e,n),p=o.pointAlongOffset(1,k),q=o.pointAlongOffset(1,-k);this._side===yk.LEFT?(this._segList.addPt(p),this._segList.addPt(q)):(this._segList.addPt(q),this._segList.addPt(p))},El.prototype.computeOffsetSegment=function(a,b,c,d){var e=b===yk.LEFT?1:-1,f=a.p1.x-a.p0.x,g=a.p1.y-a.p0.y,h=Math.sqrt(f*f+g*g),i=e*c*f/h,j=e*c*g/h;d.p0.x=a.p0.x-j,d.p0.y=a.p0.y+i,d.p1.x=a.p1.x-j,d.p1.y=a.p1.y+i},El.prototype.addFilletArc=function(a,b,c,d,e){var f=d===fj.CLOCKWISE?-1:1,g=Math.abs(b-c),h=Math.trunc(g/this._filletAngleQuantum+.5);if(1>h)return null;for(var i=g/h,j=0,k=new wi;g>j;){var l=b+f*j;k.x=a.x+e*Math.cos(l),k.y=a.y+e*Math.sin(l),this._segList.addPt(k),j+=i}},El.prototype.addInsideTurn=function(a,b){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*El.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var c=new wi((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(c);var d=new wi((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(d)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},El.prototype.createCircle=function(a){var b=new wi(a.x+this._distance,a.y);this._segList.addPt(b),this.addFilletArc(a,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},El.prototype.addBevelJoin=function(a,b){this._segList.addPt(a.p1),this._segList.addPt(b.p0)},El.prototype.init=function(a){this._distance=a,this._maxCurveSegmentError=a*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Al,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(a*El.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},El.prototype.addCollinear=function(a){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===wl.JOIN_BEVEL||this._bufParams.getJoinStyle()===wl.JOIN_MITRE?(a&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,fj.CLOCKWISE,this._distance))},El.prototype.closeRing=function(){this._segList.closeRing()},El.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},El.prototype.interfaces_=function(){return[]},El.prototype.getClass=function(){return El},Fl.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},Fl.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},Fl.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Fl.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(El,Fl);var Gl=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var a=arguments[0],b=arguments[1];this._precisionModel=a,this._bufParams=b};Gl.prototype.getOffsetCurve=function(a,b){if(this._distance=b,0===b)return null;var c=0>b,d=Math.abs(b),e=this.getSegGen(d);a.length<=1?this.computePointCurve(a[0],e):this.computeOffsetCurve(a,c,e);var f=e.getCoordinates();return c&&zj.reverse(f),f},Gl.prototype.computeSingleSidedBufferCurve=function(a,b,c){var d=this.simplifyTolerance(this._distance);if(b){c.addSegments(a,!0);var e=yl.simplify(a,-d),f=e.length-1;c.initSideSegments(e[f],e[f-1],yk.LEFT),c.addFirstSegment();for(var g=f-2;g>=0;g--)c.addNextSegment(e[g],!0)}else{c.addSegments(a,!1);var h=yl.simplify(a,d),i=h.length-1;c.initSideSegments(h[0],h[1],yk.LEFT),c.addFirstSegment();for(var j=2;i>=j;j++)c.addNextSegment(h[j],!0)}c.addLastSegment(),c.closeRing()},Gl.prototype.computeRingBufferCurve=function(a,b,c){var d=this.simplifyTolerance(this._distance);b===yk.RIGHT&&(d=-d);var e=yl.simplify(a,d),f=e.length-1;c.initSideSegments(e[f-1],e[0],b);for(var g=1;f>=g;g++){var h=1!==g;c.addNextSegment(e[g],h)}c.closeRing()},Gl.prototype.computeLineBufferCurve=function(a,b){var c=this.simplifyTolerance(this._distance),d=yl.simplify(a,c),e=d.length-1;b.initSideSegments(d[0],d[1],yk.LEFT);for(var f=2;e>=f;f++)b.addNextSegment(d[f],!0);b.addLastSegment(),b.addLineEndCap(d[e-1],d[e]);var g=yl.simplify(a,-c),h=g.length-1;b.initSideSegments(g[h],g[h-1],yk.LEFT);for(var i=h-2;i>=0;i--)b.addNextSegment(g[i],!0);b.addLastSegment(),b.addLineEndCap(g[1],g[0]),b.closeRing()},Gl.prototype.computePointCurve=function(a,b){switch(this._bufParams.getEndCapStyle()){case wl.CAP_ROUND:b.createCircle(a);break;case wl.CAP_SQUARE:b.createSquare(a)}},Gl.prototype.getLineCurve=function(a,b){if(this._distance=b,0>b&&!this._bufParams.isSingleSided())return null;if(0===b)return null;var c=Math.abs(b),d=this.getSegGen(c);if(a.length<=1)this.computePointCurve(a[0],d);else if(this._bufParams.isSingleSided()){var e=0>b;this.computeSingleSidedBufferCurve(a,e,d)}else this.computeLineBufferCurve(a,d);return d.getCoordinates()},Gl.prototype.getBufferParameters=function(){return this._bufParams},Gl.prototype.simplifyTolerance=function(a){return a*this._bufParams.getSimplifyFactor()},Gl.prototype.getRingCurve=function(a,b,c){if(this._distance=c,a.length<=2)return this.getLineCurve(a,c);if(0===c)return Gl.copyCoordinates(a);var d=this.getSegGen(c);return this.computeRingBufferCurve(a,b,d),d.getCoordinates()},Gl.prototype.computeOffsetCurve=function(a,b,c){var d=this.simplifyTolerance(this._distance);if(b){var e=yl.simplify(a,-d),f=e.length-1;c.initSideSegments(e[f],e[f-1],yk.LEFT),c.addFirstSegment();for(var g=f-2;g>=0;g--)c.addNextSegment(e[g],!0)}else{var h=yl.simplify(a,d),i=h.length-1;c.initSideSegments(h[0],h[1],yk.LEFT),c.addFirstSegment();for(var j=2;i>=j;j++)c.addNextSegment(h[j],!0)}c.addLastSegment()},Gl.prototype.getSegGen=function(a){return new El(this._precisionModel,this._bufParams,a)},Gl.prototype.interfaces_=function(){return[]},Gl.prototype.getClass=function(){return Gl},Gl.copyCoordinates=function(a){for(var b=new Array(a.length).fill(null),c=0;c<b.length;c++)b[c]=new wi(a[c]);return b};var Hl=function(){this._subgraphs=null,this._seg=new nl,this._cga=new fj;var a=arguments[0];this._subgraphs=a},Il={DepthSegment:{configurable:!0}};Hl.prototype.findStabbedSegments=function(){if(1===arguments.length){for(var a=arguments[0],b=new wj,c=this._subgraphs.iterator();c.hasNext();){var d=c.next(),e=d.getEnvelope();a.y<e.getMinY()||a.y>e.getMaxY()||this.findStabbedSegments(a,d.getDirectedEdges(),b)}return b}if(3===arguments.length)if(Ci(arguments[2],vj)&&arguments[0]instanceof wi&&arguments[1]instanceof Pk){for(var f=arguments[0],g=arguments[1],h=arguments[2],i=g.getEdge().getCoordinates(),j=0;j<i.length-1;j++)if(this._seg.p0=i[j],this._seg.p1=i[j+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<f.x||this._seg.isHorizontal()||f.y<this._seg.p0.y||f.y>this._seg.p1.y||fj.computeOrientation(this._seg.p0,this._seg.p1,f)===fj.RIGHT)){var k=g.getDepth(yk.LEFT);this._seg.p0.equals(i[j])||(k=g.getDepth(yk.RIGHT));var l=new Jl(this._seg,k);h.add(l)}}else if(Ci(arguments[2],vj)&&arguments[0]instanceof wi&&Ci(arguments[1],vj))for(var m=arguments[0],n=arguments[1],o=arguments[2],p=n.iterator();p.hasNext();){var q=p.next();q.isForward()&&this.findStabbedSegments(m,q,o)}},Hl.prototype.getDepth=function(a){var b=this.findStabbedSegments(a);return 0===b.size()?0:$k.min(b)._leftDepth},Hl.prototype.interfaces_=function(){return[]},Hl.prototype.getClass=function(){return Hl},Il.DepthSegment.get=function(){return Jl},Object.defineProperties(Hl,Il);var Jl=function(){this._upwardSeg=null,this._leftDepth=null;var a=arguments[0],b=arguments[1];this._upwardSeg=new nl(a),this._leftDepth=b};Jl.prototype.compareTo=function(a){var b=a;if(this._upwardSeg.minX()>=b._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=b._upwardSeg.minX())return-1;var c=this._upwardSeg.orientationIndex(b._upwardSeg);return 0!==c?c:0!=(c=-1*b._upwardSeg.orientationIndex(this._upwardSeg))?c:this._upwardSeg.compareTo(b._upwardSeg)},Jl.prototype.compareX=function(a,b){var c=a.p0.compareTo(b.p0);return 0!==c?c:a.p1.compareTo(b.p1)},Jl.prototype.toString=function(){return this._upwardSeg.toString()},Jl.prototype.interfaces_=function(){return[ti]},Jl.prototype.getClass=function(){return Jl};var Kl=function(a,b,c){this.p0=a||null,this.p1=b||null,this.p2=c||null};Kl.prototype.area=function(){return Kl.area(this.p0,this.p1,this.p2)},Kl.prototype.signedArea=function(){return Kl.signedArea(this.p0,this.p1,this.p2)},Kl.prototype.interpolateZ=function(a){if(null===a)throw new qi("Supplied point is null.");return Kl.interpolateZ(a,this.p0,this.p1,this.p2)},Kl.prototype.longestSideLength=function(){return Kl.longestSideLength(this.p0,this.p1,this.p2)},Kl.prototype.isAcute=function(){return Kl.isAcute(this.p0,this.p1,this.p2)},Kl.prototype.circumcentre=function(){return Kl.circumcentre(this.p0,this.p1,this.p2)},Kl.prototype.area3D=function(){return Kl.area3D(this.p0,this.p1,this.p2)},Kl.prototype.centroid=function(){return Kl.centroid(this.p0,this.p1,this.p2)},Kl.prototype.inCentre=function(){return Kl.inCentre(this.p0,this.p1,this.p2)},Kl.prototype.interfaces_=function(){return[]},Kl.prototype.getClass=function(){return Kl},Kl.area=function(a,b,c){return Math.abs(((c.x-a.x)*(b.y-a.y)-(b.x-a.x)*(c.y-a.y))/2)},Kl.signedArea=function(a,b,c){return((c.x-a.x)*(b.y-a.y)-(b.x-a.x)*(c.y-a.y))/2},Kl.det=function(a,b,c,d){return a*d-b*c},Kl.interpolateZ=function(a,b,c,d){var e=b.x,f=b.y,g=c.x-e,h=d.x-e,i=c.y-f,j=d.y-f,k=g*j-h*i,l=a.x-e,m=a.y-f,n=(j*l-h*m)/k,o=(-i*l+g*m)/k;return b.z+n*(c.z-b.z)+o*(d.z-b.z)},Kl.longestSideLength=function(a,b,c){var d=a.distance(b),e=b.distance(c),f=c.distance(a),g=d;return e>g&&(g=e),f>g&&(g=f),g},Kl.isAcute=function(a,b,c){return!!Cl.isAcute(a,b,c)&&!!Cl.isAcute(b,c,a)&&!!Cl.isAcute(c,a,b)},Kl.circumcentre=function(a,b,c){var d=c.x,e=c.y,f=a.x-d,g=a.y-e,h=b.x-d,i=b.y-e,j=2*Kl.det(f,g,h,i),k=Kl.det(g,f*f+g*g,i,h*h+i*i),l=Kl.det(f,f*f+g*g,h,h*h+i*i);return new wi(d-k/j,e+l/j)},Kl.perpendicularBisector=function(a,b){var c=b.x-a.x,d=b.y-a.y,e=new Ri(a.x+c/2,a.y+d/2,1),f=new Ri(a.x-d+c/2,a.y+c+d/2,1);return new Ri(e,f)},Kl.angleBisector=function(a,b,c){var d=b.distance(a),e=d/(d+b.distance(c)),f=c.x-a.x,g=c.y-a.y;return new wi(a.x+e*f,a.y+e*g)},Kl.area3D=function(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=b.z-a.z,g=c.x-a.x,h=c.y-a.y,i=c.z-a.z,j=e*i-f*h,k=f*g-d*i,l=d*h-e*g,m=j*j+k*k+l*l,n=Math.sqrt(m)/2;return n},Kl.centroid=function(a,b,c){var d=(a.x+b.x+c.x)/3,e=(a.y+b.y+c.y)/3;return new wi(d,e)},Kl.inCentre=function(a,b,c){var d=b.distance(c),e=a.distance(c),f=a.distance(b),g=d+e+f,h=(d*a.x+e*b.x+f*c.x)/g,i=(d*a.y+e*b.y+f*c.y)/g;return new wi(h,i)};var Ll=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new wj;var a=arguments[0],b=arguments[1],c=arguments[2];this._inputGeom=a,this._distance=b,this._curveBuilder=c};Ll.prototype.addPoint=function(a){if(this._distance<=0)return null;var b=a.getCoordinates(),c=this._curveBuilder.getLineCurve(b,this._distance);this.addCurve(c,Ai.EXTERIOR,Ai.INTERIOR)},Ll.prototype.addPolygon=function(a){var b=this._distance,c=yk.LEFT;this._distance<0&&(b=-this._distance,c=yk.RIGHT);var d=a.getExteriorRing(),e=zj.removeRepeatedPoints(d.getCoordinates());if(this._distance<0&&this.isErodedCompletely(d,this._distance))return null;if(this._distance<=0&&e.length<3)return null;this.addPolygonRing(e,b,c,Ai.EXTERIOR,Ai.INTERIOR);for(var f=0;f<a.getNumInteriorRing();f++){var g=a.getInteriorRingN(f),h=zj.removeRepeatedPoints(g.getCoordinates());this._distance>0&&this.isErodedCompletely(g,-this._distance)||this.addPolygonRing(h,b,yk.opposite(c),Ai.INTERIOR,Ai.EXTERIOR)}},Ll.prototype.isTriangleErodedCompletely=function(a,b){var c=new Kl(a[0],a[1],a[2]),d=c.inCentre();return fj.distancePointLine(d,c.p0,c.p1)<Math.abs(b)},Ll.prototype.addLineString=function(a){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var b=zj.removeRepeatedPoints(a.getCoordinates()),c=this._curveBuilder.getLineCurve(b,this._distance);this.addCurve(c,Ai.EXTERIOR,Ai.INTERIOR)},Ll.prototype.addCurve=function(a,b,c){if(null===a||a.length<2)return null;var d=new ml(a,new Fk(0,Ai.BOUNDARY,b,c));this._curveList.add(d)},Ll.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Ll.prototype.addPolygonRing=function(a,b,c,d,e){if(0===b&&a.length<ak.MINIMUM_VALID_SIZE)return null;var f=d,g=e;a.length>=ak.MINIMUM_VALID_SIZE&&fj.isCCW(a)&&(f=e,g=d,c=yk.opposite(c));var h=this._curveBuilder.getRingCurve(a,c,b);this.addCurve(h,f,g)},Ll.prototype.add=function(a){return a.isEmpty()?null:void(a instanceof $j?this.addPolygon(a):a instanceof Wj?this.addLineString(a):a instanceof Yj?this.addPoint(a):a instanceof _j?this.addCollection(a):a instanceof Qj?this.addCollection(a):a instanceof bk?this.addCollection(a):a instanceof Pj&&this.addCollection(a))},Ll.prototype.isErodedCompletely=function(a,b){var c=a.getCoordinates();if(c.length<4)return 0>b;if(4===c.length)return this.isTriangleErodedCompletely(c,b);var d=a.getEnvelopeInternal(),e=Math.min(d.getHeight(),d.getWidth());return 0>b&&2*Math.abs(b)>e},Ll.prototype.addCollection=function(a){for(var b=0;b<a.getNumGeometries();b++){var c=a.getGeometryN(b);this.add(c)}},Ll.prototype.interfaces_=function(){return[]},Ll.prototype.getClass=function(){return Ll};var Ml=function(){};Ml.prototype.locate=function(a){},Ml.prototype.interfaces_=function(){return[]},Ml.prototype.getClass=function(){return Ml};var Nl=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var a=arguments[0];this._parent=a,this._atStart=!0,this._index=0,this._max=a.getNumGeometries()};Nl.prototype.next=function(){if(this._atStart)return this._atStart=!1,Nl.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 De;var a=this._parent.getGeometryN(this._index++);return a instanceof Pj?(this._subcollectionIterator=new Nl(a),this._subcollectionIterator.next()):a},Nl.prototype.remove=function(){throw new Error(this.getClass().getName())},Nl.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)},Nl.prototype.interfaces_=function(){return[uj]},Nl.prototype.getClass=function(){return Nl},Nl.isAtomic=function(a){return!(a instanceof Pj)};var Ol=function(){this._geom=null;var a=arguments[0];this._geom=a};Ol.prototype.locate=function(a){return Ol.locate(a,this._geom)},Ol.prototype.interfaces_=function(){return[Ml]},Ol.prototype.getClass=function(){return Ol},Ol.isPointInRing=function(a,b){return!!b.getEnvelopeInternal().intersects(a)&&fj.isPointInRing(a,b.getCoordinates())},Ol.containsPointInPolygon=function(a,b){if(b.isEmpty())return!1;var c=b.getExteriorRing();if(!Ol.isPointInRing(a,c))return!1;for(var d=0;d<b.getNumInteriorRing();d++){var e=b.getInteriorRingN(d);if(Ol.isPointInRing(a,e))return!1}return!0},Ol.containsPoint=function(a,b){if(b instanceof $j)return Ol.containsPointInPolygon(a,b);if(b instanceof Pj)for(var c=new Nl(b);c.hasNext();){var d=c.next();if(d!==b&&Ol.containsPoint(a,d))return!0}return!1},Ol.locate=function(a,b){return b.isEmpty()?Ai.EXTERIOR:Ol.containsPoint(a,b)?Ai.INTERIOR:Ai.EXTERIOR};var Pl=function(){this._edgeMap=new Le,this._edgeList=null,this._ptInAreaLocation=[Ai.NONE,Ai.NONE]};Pl.prototype.getNextCW=function(a){this.getEdges();var b=this._edgeList.indexOf(a),c=b-1;return 0===b&&(c=this._edgeList.size()-1),this._edgeList.get(c)},Pl.prototype.propagateSideLabels=function(a){for(var b=Ai.NONE,c=this.iterator();c.hasNext();){var d=c.next().getLabel();d.isArea(a)&&d.getLocation(a,yk.LEFT)!==Ai.NONE&&(b=d.getLocation(a,yk.LEFT))}if(b===Ai.NONE)return null;for(var e=b,f=this.iterator();f.hasNext();){var g=f.next(),h=g.getLabel();if(h.getLocation(a,yk.ON)===Ai.NONE&&h.setLocation(a,yk.ON,e),h.isArea(a)){var i=h.getLocation(a,yk.LEFT),j=h.getLocation(a,yk.RIGHT);if(j!==Ai.NONE){if(j!==e)throw new Bk("side location conflict",g.getCoordinate());i===Ai.NONE&&_i.shouldNeverReachHere("found single null side (at "+g.getCoordinate()+")"),e=i}else _i.isTrue(h.getLocation(a,yk.LEFT)===Ai.NONE,"found single null side"),h.setLocation(a,yk.RIGHT,e),h.setLocation(a,yk.LEFT,e)}}},Pl.prototype.getCoordinate=function(){var a=this.iterator();return a.hasNext()?a.next().getCoordinate():null},Pl.prototype.print=function(a){Qi.out.println("EdgeEndStar:   "+this.getCoordinate());for(var b=this.iterator();b.hasNext();)b.next().print(a)},Pl.prototype.isAreaLabelsConsistent=function(a){return this.computeEdgeEndLabels(a.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},Pl.prototype.checkAreaLabelsConsistent=function(a){var b=this.getEdges();if(b.size()<=0)return!0;var c=b.size()-1,d=b.get(c).getLabel().getLocation(a,yk.LEFT);_i.isTrue(d!==Ai.NONE,"Found unlabelled area edge");for(var e=d,f=this.iterator();f.hasNext();){var g=f.next().getLabel();_i.isTrue(g.isArea(a),"Found non-area edge");var h=g.getLocation(a,yk.LEFT),i=g.getLocation(a,yk.RIGHT);if(h===i)return!1;if(i!==e)return!1;e=h}return!0},Pl.prototype.findIndex=function(a){this.iterator();for(var b=0;b<this._edgeList.size();b++)if(this._edgeList.get(b)===a)return b;return-1},Pl.prototype.iterator=function(){return this.getEdges().iterator()},Pl.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new wj(this._edgeMap.values())),this._edgeList},Pl.prototype.getLocation=function(a,b,c){return this._ptInAreaLocation[a]===Ai.NONE&&(this._ptInAreaLocation[a]=Ol.locate(b,c[a].getGeometry())),this._ptInAreaLocation[a]},Pl.prototype.toString=function(){var a=new Fi;a.append("EdgeEndStar:   "+this.getCoordinate()),a.append("\n");for(var b=this.iterator();b.hasNext();){var c=b.next();a.append(c),a.append("\n")}return a.toString()},Pl.prototype.computeEdgeEndLabels=function(a){for(var b=this.iterator();b.hasNext();)b.next().computeLabel(a)},Pl.prototype.computeLabelling=function(a){this.computeEdgeEndLabels(a[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var b=[!1,!1],c=this.iterator();c.hasNext();)for(var d=c.next().getLabel(),e=0;2>e;e++)d.isLine(e)&&d.getLocation(e)===Ai.BOUNDARY&&(b[e]=!0);for(var f=this.iterator();f.hasNext();)for(var g=f.next(),h=g.getLabel(),i=0;2>i;i++)if(h.isAnyNull(i)){var j=Ai.NONE;if(b[i])j=Ai.EXTERIOR;else{var k=g.getCoordinate();j=this.getLocation(i,k,a)}h.setAllLocationsIfNull(i,j)}},Pl.prototype.getDegree=function(){return this._edgeMap.size()},Pl.prototype.insertEdgeEnd=function(a,b){this._edgeMap.put(a,b),this._edgeList=null},Pl.prototype.interfaces_=function(){return[]},Pl.prototype.getClass=function(){return Pl};var Ql=function(a){function b(){a.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var a=null,b=null,c=this._SCANNING_FOR_INCOMING,d=0;d<this._resultAreaEdgeList.size();d++){var e=this._resultAreaEdgeList.get(d),f=e.getSym();if(e.getLabel().isArea())switch(null===a&&e.isInResult()&&(a=e),c){case this._SCANNING_FOR_INCOMING:if(!f.isInResult())continue;b=f,c=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!e.isInResult())continue;b.setNext(e),c=this._SCANNING_FOR_INCOMING}}if(c===this._LINKING_TO_OUTGOING){if(null===a)throw new Bk("no outgoing dirEdge found",this.getCoordinate());_i.isTrue(a.isInResult(),"unable to link last incoming dirEdge"),b.setNext(a)}},b.prototype.insert=function(a){var b=a;this.insertEdgeEnd(b,b)},b.prototype.getRightmostEdge=function(){var a=this.getEdges(),b=a.size();if(1>b)return null;var c=a.get(0);if(1===b)return c;var d=a.get(b-1),e=c.getQuadrant(),f=d.getQuadrant();return Mk.isNorthern(e)&&Mk.isNorthern(f)?c:Mk.isNorthern(e)||Mk.isNorthern(f)?0!==c.getDy()?c:0!==d.getDy()?d:(_i.shouldNeverReachHere("found two horizontal edges incident on node"),null):d},b.prototype.print=function(a){Qi.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var b=this.iterator();b.hasNext();){var c=b.next();a.print("out "),c.print(a),a.println(),a.print("in "),c.getSym().print(a),a.println()}},b.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new wj;for(var a=this.iterator();a.hasNext();){var b=a.next();(b.isInResult()||b.getSym().isInResult())&&this._resultAreaEdgeList.add(b)}return this._resultAreaEdgeList},b.prototype.updateLabelling=function(a){for(var b=this.iterator();b.hasNext();){var c=b.next().getLabel();c.setAllLocationsIfNull(0,a.getLocation(0)),c.setAllLocationsIfNull(1,a.getLocation(1))}},b.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var a=null,b=null,c=this._edgeList.size()-1;c>=0;c--){var d=this._edgeList.get(c),e=d.getSym();null===b&&(b=e),null!==a&&e.setNext(a),a=d}b.setNext(a)},b.prototype.computeDepths=function(){if(1===arguments.length){var a=arguments[0],b=this.findIndex(a),c=a.getDepth(yk.LEFT),d=a.getDepth(yk.RIGHT),e=this.computeDepths(b+1,this._edgeList.size(),c);if(this.computeDepths(0,b,e)!==d)throw new Bk("depth mismatch at "+a.getCoordinate())}else if(3===arguments.length){for(var f=arguments[0],g=arguments[1],h=arguments[2],i=f;g>i;i++){var j=this._edgeList.get(i);j.setEdgeDepths(yk.RIGHT,h),h=j.getDepth(yk.LEFT)}return h}},b.prototype.mergeSymLabels=function(){for(var a=this.iterator();a.hasNext();){var b=a.next();b.getLabel().merge(b.getSym().getLabel())}},b.prototype.linkMinimalDirectedEdges=function(a){for(var b=null,c=null,d=this._SCANNING_FOR_INCOMING,e=this._resultAreaEdgeList.size()-1;e>=0;e--){var f=this._resultAreaEdgeList.get(e),g=f.getSym();switch(null===b&&f.getEdgeRing()===a&&(b=f),d){case this._SCANNING_FOR_INCOMING:if(g.getEdgeRing()!==a)continue;c=g,d=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(f.getEdgeRing()!==a)continue;c.setNextMin(f),d=this._SCANNING_FOR_INCOMING}}d===this._LINKING_TO_OUTGOING&&(_i.isTrue(null!==b,"found null for first outgoing dirEdge"),_i.isTrue(b.getEdgeRing()===a,"unable to link last incoming dirEdge"),c.setNextMin(b))},b.prototype.getOutgoingDegree=function(){if(0===arguments.length){for(var a=0,b=this.iterator();b.hasNext();)b.next().isInResult()&&a++;return a}if(1===arguments.length){for(var c=arguments[0],d=0,e=this.iterator();e.hasNext();)e.next().getEdgeRing()===c&&d++;return d}},b.prototype.getLabel=function(){return this._label},b.prototype.findCoveredLineEdges=function(){for(var a=Ai.NONE,b=this.iterator();b.hasNext();){var c=b.next(),d=c.getSym();if(!c.isLineEdge()){if(c.isInResult()){a=Ai.INTERIOR;break}if(d.isInResult()){a=Ai.EXTERIOR;break}}}if(a===Ai.NONE)return null;for(var e=a,f=this.iterator();f.hasNext();){var g=f.next(),h=g.getSym();g.isLineEdge()?g.getEdge().setCovered(e===Ai.INTERIOR):(g.isInResult()&&(e=Ai.EXTERIOR),h.isInResult()&&(e=Ai.INTERIOR))}},b.prototype.computeLabelling=function(b){a.prototype.computeLabelling.call(this,b),this._label=new Fk(Ai.NONE);for(var c=this.iterator();c.hasNext();)for(var d=c.next().getEdge().getLabel(),e=0;2>e;e++){var f=d.getLocation(e);f!==Ai.INTERIOR&&f!==Ai.BOUNDARY||this._label.setLocation(e,Ai.INTERIOR)}},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b}(Pl),Rl=function(a){function b(){a.apply(this,arguments)}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),
b.prototype.constructor=b,b.prototype.createNode=function(a){return new Kk(a,new Ql)},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b}(Qk),Sl=function Po(){this._pts=null,this._orientation=null;var a=arguments[0];this._pts=a,this._orientation=Po.orientation(a)};Sl.prototype.compareTo=function(a){var b=a;return Sl.compareOriented(this._pts,this._orientation,b._pts,b._orientation)},Sl.prototype.interfaces_=function(){return[ti]},Sl.prototype.getClass=function(){return Sl},Sl.orientation=function(a){return 1===zj.increasingDirection(a)},Sl.compareOriented=function(a,b,c,d){for(var e=b?1:-1,f=d?1:-1,g=b?a.length:-1,h=d?c.length:-1,i=b?0:a.length-1,j=d?0:c.length-1;;){var k=a[i].compareTo(c[j]);if(0!==k)return k;var l=(i+=e)===g,m=(j+=f)===h;if(l&&!m)return-1;if(!l&&m)return 1;if(l&&m)return 0}};var Tl=function(){this._edges=new wj,this._ocaMap=new Le};Tl.prototype.print=function(a){a.print("MULTILINESTRING ( ");for(var b=0;b<this._edges.size();b++){var c=this._edges.get(b);b>0&&a.print(","),a.print("(");for(var d=c.getCoordinates(),e=0;e<d.length;e++)e>0&&a.print(","),a.print(d[e].x+" "+d[e].y);a.println(")")}a.print(")  ")},Tl.prototype.addAll=function(a){for(var b=a.iterator();b.hasNext();)this.add(b.next())},Tl.prototype.findEdgeIndex=function(a){for(var b=0;b<this._edges.size();b++)if(this._edges.get(b).equals(a))return b;return-1},Tl.prototype.iterator=function(){return this._edges.iterator()},Tl.prototype.getEdges=function(){return this._edges},Tl.prototype.get=function(a){return this._edges.get(a)},Tl.prototype.findEqualEdge=function(a){var b=new Sl(a.getCoordinates());return this._ocaMap.get(b)},Tl.prototype.add=function(a){this._edges.add(a);var b=new Sl(a.getCoordinates());this._ocaMap.put(b,a)},Tl.prototype.interfaces_=function(){return[]},Tl.prototype.getClass=function(){return Tl};var Ul=function(){};Ul.prototype.processIntersections=function(a,b,c,d){},Ul.prototype.isDone=function(){},Ul.prototype.interfaces_=function(){return[]},Ul.prototype.getClass=function(){return Ul};var Vl=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 a=arguments[0];this._li=a};Vl.prototype.isTrivialIntersection=function(a,b,c,d){if(a===c&&1===this._li.getIntersectionNum()){if(Vl.isAdjacentSegments(b,d))return!0;if(a.isClosed()){var e=a.size()-1;if(0===b&&d===e||0===d&&b===e)return!0}}return!1},Vl.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Vl.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Vl.prototype.getLineIntersector=function(){return this._li},Vl.prototype.hasProperIntersection=function(){return this._hasProper},Vl.prototype.processIntersections=function(a,b,c,d){if(a===c&&b===d)return null;this.numTests++;var e=a.getCoordinates()[b],f=a.getCoordinates()[b+1],g=c.getCoordinates()[d],h=c.getCoordinates()[d+1];this._li.computeIntersection(e,f,g,h),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(a,b,c,d)||(this._hasIntersection=!0,a.addIntersections(this._li,b,0),c.addIntersections(this._li,d,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Vl.prototype.hasIntersection=function(){return this._hasIntersection},Vl.prototype.isDone=function(){return!1},Vl.prototype.hasInteriorIntersection=function(){return this._hasInterior},Vl.prototype.interfaces_=function(){return[Ul]},Vl.prototype.getClass=function(){return Vl},Vl.isAdjacentSegments=function(a,b){return 1===Math.abs(a-b)};var Wl=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var a=arguments[0],b=arguments[1],c=arguments[2];this.coord=new wi(a),this.segmentIndex=b,this.dist=c};Wl.prototype.getSegmentIndex=function(){return this.segmentIndex},Wl.prototype.getCoordinate=function(){return this.coord},Wl.prototype.print=function(a){a.print(this.coord),a.print(" seg # = "+this.segmentIndex),a.println(" dist = "+this.dist)},Wl.prototype.compareTo=function(a){var b=a;return this.compare(b.segmentIndex,b.dist)},Wl.prototype.isEndPoint=function(a){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===a},Wl.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Wl.prototype.getDistance=function(){return this.dist},Wl.prototype.compare=function(a,b){return this.segmentIndex<a?-1:this.segmentIndex>a?1:this.dist<b?-1:this.dist>b?1:0},Wl.prototype.interfaces_=function(){return[ti]},Wl.prototype.getClass=function(){return Wl};var Xl=function(){this._nodeMap=new Le,this.edge=null;var a=arguments[0];this.edge=a};Xl.prototype.print=function(a){a.println("Intersections:");for(var b=this.iterator();b.hasNext();)b.next().print(a)},Xl.prototype.iterator=function(){return this._nodeMap.values().iterator()},Xl.prototype.addSplitEdges=function(a){this.addEndpoints();for(var b=this.iterator(),c=b.next();b.hasNext();){var d=b.next(),e=this.createSplitEdge(c,d);a.add(e),c=d}},Xl.prototype.addEndpoints=function(){var a=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[a],a,0)},Xl.prototype.createSplitEdge=function(a,b){var c=b.segmentIndex-a.segmentIndex+2,d=this.edge.pts[b.segmentIndex],e=b.dist>0||!b.coord.equals2D(d);e||c--;var f=new Array(c).fill(null),g=0;f[g++]=new wi(a.coord);for(var h=a.segmentIndex+1;h<=b.segmentIndex;h++)f[g++]=this.edge.pts[h];return e&&(f[g]=b.coord),new am(f,new Fk(this.edge._label))},Xl.prototype.add=function(a,b,c){var d=new Wl(a,b,c),e=this._nodeMap.get(d);return null!==e?e:(this._nodeMap.put(d,d),d)},Xl.prototype.isIntersection=function(a){for(var b=this.iterator();b.hasNext();)if(b.next().coord.equals(a))return!0;return!1},Xl.prototype.interfaces_=function(){return[]},Xl.prototype.getClass=function(){return Xl};var Yl=function(){};Yl.prototype.getChainStartIndices=function(a){var b=0,c=new wj;c.add(new Gi(b));do{var d=this.findChainEnd(a,b);c.add(new Gi(d)),b=d}while(b<a.length-1);return Yl.toIntArray(c)},Yl.prototype.findChainEnd=function(a,b){for(var c=Mk.quadrant(a[b],a[b+1]),d=b+1;d<a.length&&Mk.quadrant(a[d-1],a[d])===c;)d++;return d-1},Yl.prototype.interfaces_=function(){return[]},Yl.prototype.getClass=function(){return Yl},Yl.toIntArray=function(a){for(var b=new Array(a.size()).fill(null),c=0;c<b.length;c++)b[c]=a.get(c).intValue();return b};var Zl=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new Si,this.env2=new Si;var a=arguments[0];this.e=a,this.pts=a.getCoordinates();var b=new Yl;this.startIndex=b.getChainStartIndices(this.pts)};Zl.prototype.getCoordinates=function(){return this.pts},Zl.prototype.getMaxX=function(a){var b=this.pts[this.startIndex[a]].x,c=this.pts[this.startIndex[a+1]].x;return b>c?b:c},Zl.prototype.getMinX=function(a){var b=this.pts[this.startIndex[a]].x,c=this.pts[this.startIndex[a+1]].x;return c>b?b:c},Zl.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var a=arguments[0],b=arguments[1],c=arguments[2],d=arguments[3];this.computeIntersectsForChain(this.startIndex[a],this.startIndex[a+1],b,b.startIndex[c],b.startIndex[c+1],d)}else if(6===arguments.length){var e=arguments[0],f=arguments[1],g=arguments[2],h=arguments[3],i=arguments[4],j=arguments[5],k=this.pts[e],l=this.pts[f],m=g.pts[h],n=g.pts[i];if(f-e==1&&i-h==1)return j.addIntersections(this.e,e,g.e,h),null;if(this.env1.init(k,l),this.env2.init(m,n),!this.env1.intersects(this.env2))return null;var o=Math.trunc((e+f)/2),p=Math.trunc((h+i)/2);o>e&&(p>h&&this.computeIntersectsForChain(e,o,g,h,p,j),i>p&&this.computeIntersectsForChain(e,o,g,p,i,j)),f>o&&(p>h&&this.computeIntersectsForChain(o,f,g,h,p,j),i>p&&this.computeIntersectsForChain(o,f,g,p,i,j))}},Zl.prototype.getStartIndexes=function(){return this.startIndex},Zl.prototype.computeIntersects=function(a,b){for(var c=0;c<this.startIndex.length-1;c++)for(var d=0;d<a.startIndex.length-1;d++)this.computeIntersectsForChain(c,a,d,b)},Zl.prototype.interfaces_=function(){return[]},Zl.prototype.getClass=function(){return Zl};var $l=function Qo(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var a=0;2>a;a++)for(var b=0;3>b;b++)this._depth[a][b]=Qo.NULL_VALUE},_l={NULL_VALUE:{configurable:!0}};$l.prototype.getDepth=function(a,b){return this._depth[a][b]},$l.prototype.setDepth=function(a,b,c){this._depth[a][b]=c},$l.prototype.isNull=function(){if(0===arguments.length){for(var a=0;2>a;a++)for(var b=0;3>b;b++)if(this._depth[a][b]!==$l.NULL_VALUE)return!1;return!0}if(1===arguments.length){var c=arguments[0];return this._depth[c][1]===$l.NULL_VALUE}if(2===arguments.length){var d=arguments[0],e=arguments[1];return this._depth[d][e]===$l.NULL_VALUE}},$l.prototype.normalize=function(){for(var a=0;2>a;a++)if(!this.isNull(a)){var b=this._depth[a][1];this._depth[a][2]<b&&(b=this._depth[a][2]),0>b&&(b=0);for(var c=1;3>c;c++){var d=0;this._depth[a][c]>b&&(d=1),this._depth[a][c]=d}}},$l.prototype.getDelta=function(a){return this._depth[a][yk.RIGHT]-this._depth[a][yk.LEFT]},$l.prototype.getLocation=function(a,b){return this._depth[a][b]<=0?Ai.EXTERIOR:Ai.INTERIOR},$l.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},$l.prototype.add=function(){if(1===arguments.length)for(var a=arguments[0],b=0;2>b;b++)for(var c=1;3>c;c++){var d=a.getLocation(b,c);d!==Ai.EXTERIOR&&d!==Ai.INTERIOR||(this.isNull(b,c)?this._depth[b][c]=$l.depthAtLocation(d):this._depth[b][c]+=$l.depthAtLocation(d))}else if(3===arguments.length){var e=arguments[0],f=arguments[1];arguments[2]===Ai.INTERIOR&&this._depth[e][f]++}},$l.prototype.interfaces_=function(){return[]},$l.prototype.getClass=function(){return $l},$l.depthAtLocation=function(a){return a===Ai.EXTERIOR?0:a===Ai.INTERIOR?1:$l.NULL_VALUE},_l.NULL_VALUE.get=function(){return-1},Object.defineProperties($l,_l);var am=function(a){function b(){if(a.call(this),this.pts=null,this._env=null,this.eiList=new Xl(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new $l,this._depthDelta=0,1===arguments.length){var c=arguments[0];b.call(this,c,null)}else if(2===arguments.length){var d=arguments[0],e=arguments[1];this.pts=d,this._label=e}}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.getDepth=function(){return this._depth},b.prototype.getCollapsedEdge=function(){var a=new Array(2).fill(null);return a[0]=this.pts[0],a[1]=this.pts[1],new b(a,Fk.toLineLabel(this._label))},b.prototype.isIsolated=function(){return this._isIsolated},b.prototype.getCoordinates=function(){return this.pts},b.prototype.setIsolated=function(a){this._isIsolated=a},b.prototype.setName=function(a){this._name=a},b.prototype.equals=function(a){if(!(a instanceof b))return!1;var c=a;if(this.pts.length!==c.pts.length)return!1;for(var d=!0,e=!0,f=this.pts.length,g=0;g<this.pts.length;g++)if(this.pts[g].equals2D(c.pts[g])||(d=!1),this.pts[g].equals2D(c.pts[--f])||(e=!1),!d&&!e)return!1;return!0},b.prototype.getCoordinate=function(){if(0===arguments.length)return this.pts.length>0?this.pts[0]:null;if(1===arguments.length){var a=arguments[0];return this.pts[a]}},b.prototype.print=function(a){a.print("edge "+this._name+": "),a.print("LINESTRING (");for(var b=0;b<this.pts.length;b++)b>0&&a.print(","),a.print(this.pts[b].x+" "+this.pts[b].y);a.print(")  "+this._label+" "+this._depthDelta)},b.prototype.computeIM=function(a){b.updateIM(this._label,a)},b.prototype.isCollapsed=function(){return!!this._label.isArea()&&3===this.pts.length&&!!this.pts[0].equals(this.pts[2])},b.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},b.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},b.prototype.getDepthDelta=function(){return this._depthDelta},b.prototype.getNumPoints=function(){return this.pts.length},b.prototype.printReverse=function(a){a.print("edge "+this._name+": ");for(var b=this.pts.length-1;b>=0;b--)a.print(this.pts[b]+" ");a.println("")},b.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new Zl(this)),this._mce},b.prototype.getEnvelope=function(){if(null===this._env){this._env=new Si;for(var a=0;a<this.pts.length;a++)this._env.expandToInclude(this.pts[a])}return this._env},b.prototype.addIntersection=function(a,b,c,d){var e=new wi(a.getIntersection(d)),f=b,g=a.getEdgeDistance(c,d),h=f+1;if(h<this.pts.length){var i=this.pts[h];e.equals2D(i)&&(f=h,g=0)}this.eiList.add(e,f,g)},b.prototype.toString=function(){var a=new Fi;a.append("edge "+this._name+": "),a.append("LINESTRING (");for(var b=0;b<this.pts.length;b++)b>0&&a.append(","),a.append(this.pts[b].x+" "+this.pts[b].y);return a.append(")  "+this._label+" "+this._depthDelta),a.toString()},b.prototype.isPointwiseEqual=function(a){if(this.pts.length!==a.pts.length)return!1;for(var b=0;b<this.pts.length;b++)if(!this.pts[b].equals2D(a.pts[b]))return!1;return!0},b.prototype.setDepthDelta=function(a){this._depthDelta=a},b.prototype.getEdgeIntersectionList=function(){return this.eiList},b.prototype.addIntersections=function(a,b,c){for(var d=0;d<a.getIntersectionNum();d++)this.addIntersection(a,b,c,d)},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b.updateIM=function(){if(2!==arguments.length)return a.prototype.updateIM.apply(this,arguments);var b=arguments[0],c=arguments[1];c.setAtLeastIfValid(b.getLocation(0,yk.ON),b.getLocation(1,yk.ON),1),b.isArea()&&(c.setAtLeastIfValid(b.getLocation(0,yk.LEFT),b.getLocation(1,yk.LEFT),2),c.setAtLeastIfValid(b.getLocation(0,yk.RIGHT),b.getLocation(1,yk.RIGHT),2))},b}(Jk),bm=function(a){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Tl,this._bufParams=a||null};bm.prototype.setWorkingPrecisionModel=function(a){this._workingPrecisionModel=a},bm.prototype.insertUniqueEdge=function(a){var b=this._edgeList.findEqualEdge(a);if(null!==b){var c=b.getLabel(),d=a.getLabel();b.isPointwiseEqual(a)||(d=new Fk(a.getLabel())).flip(),c.merge(d);var e=bm.depthDelta(d),f=b.getDepthDelta()+e;b.setDepthDelta(f)}else this._edgeList.add(a),a.setDepthDelta(bm.depthDelta(a.getLabel()))},bm.prototype.buildSubgraphs=function(a,b){for(var c=new wj,d=a.iterator();d.hasNext();){var e=d.next(),f=e.getRightmostCoordinate(),g=new Hl(c).getDepth(f);e.computeDepth(g),e.findResultEdges(),c.add(e),b.add(e.getDirectedEdges(),e.getNodes())}},bm.prototype.createSubgraphs=function(a){for(var b=new wj,c=a.getNodes().iterator();c.hasNext();){var d=c.next();if(!d.isVisited()){var e=new Dk;e.create(d),b.add(e)}}return $k.sort(b,$k.reverseOrder()),b},bm.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},bm.prototype.getNoder=function(a){if(null!==this._workingNoder)return this._workingNoder;var b=new ul,c=new cj;return c.setPrecisionModel(a),b.setSegmentIntersector(new Vl(c)),b},bm.prototype.buffer=function(a,b){var c=this._workingPrecisionModel;null===c&&(c=a.getPrecisionModel()),this._geomFact=a.getFactory();var d=new Gl(c,this._bufParams),e=new Ll(a,b,d).getCurves();if(e.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(e,c),this._graph=new Rk(new Rl),this._graph.addEdges(this._edgeList.getEdges());var f=this.createSubgraphs(this._graph),g=new Sk(this._geomFact);this.buildSubgraphs(f,g);var h=g.getPolygons();return h.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(h)},bm.prototype.computeNodedEdges=function(a,b){var c=this.getNoder(b);c.computeNodes(a);for(var d=c.getNodedSubstrings().iterator();d.hasNext();){var e=d.next(),f=e.getCoordinates();if(2!==f.length||!f[0].equals2D(f[1])){var g=e.getData(),h=new am(e.getCoordinates(),new Fk(g));this.insertUniqueEdge(h)}}},bm.prototype.setNoder=function(a){this._workingNoder=a},bm.prototype.interfaces_=function(){return[]},bm.prototype.getClass=function(){return bm},bm.depthDelta=function(a){var b=a.getLocation(0,yk.LEFT),c=a.getLocation(0,yk.RIGHT);return b===Ai.INTERIOR&&c===Ai.EXTERIOR?1:b===Ai.EXTERIOR&&c===Ai.INTERIOR?-1:0},bm.convertSegStrings=function(a){for(var b=new qk,c=new wj;a.hasNext();){var d=a.next(),e=b.createLineString(d.getCoordinates());c.add(e)}return b.buildGeometry(c)};var cm=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){var a=arguments[0],b=arguments[1];this._noder=a,this._scaleFactor=b,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(4===arguments.length){var c=arguments[0],d=arguments[1],e=arguments[2],f=arguments[3];this._noder=c,this._scaleFactor=d,this._offsetX=e,this._offsetY=f,this._isScaled=!this.isIntegerPrecision()}};cm.prototype.rescale=function(){if(Ci(arguments[0],sj))for(var a=arguments[0].iterator();a.hasNext();){var b=a.next();this.rescale(b.getCoordinates())}else if(arguments[0]instanceof Array){for(var c=arguments[0],d=0;d<c.length;d++)c[d].x=c[d].x/this._scaleFactor+this._offsetX,c[d].y=c[d].y/this._scaleFactor+this._offsetY;2===c.length&&c[0].equals2D(c[1])&&Qi.out.println(c)}},cm.prototype.scale=function(){if(Ci(arguments[0],sj)){for(var a=arguments[0],b=new wj,c=a.iterator();c.hasNext();){var d=c.next();b.add(new ml(this.scale(d.getCoordinates()),d.getData()))}return b}if(arguments[0]instanceof Array){for(var e=arguments[0],f=new Array(e.length).fill(null),g=0;g<e.length;g++)f[g]=new wi(Math.round((e[g].x-this._offsetX)*this._scaleFactor),Math.round((e[g].y-this._offsetY)*this._scaleFactor),e[g].z);return zj.removeRepeatedPoints(f)}},cm.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},cm.prototype.getNodedSubstrings=function(){var a=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(a),a},cm.prototype.computeNodes=function(a){var b=a;this._isScaled&&(b=this.scale(a)),this._noder.computeNodes(b)},cm.prototype.interfaces_=function(){return[sl]},cm.prototype.getClass=function(){return cm};var dm=function(){this._li=new cj,this._segStrings=null;var a=arguments[0];this._segStrings=a},em={fact:{configurable:!0}};dm.prototype.checkEndPtVertexIntersections=function(){if(0===arguments.length)for(var a=this._segStrings.iterator();a.hasNext();){var b=a.next().getCoordinates();this.checkEndPtVertexIntersections(b[0],this._segStrings),this.checkEndPtVertexIntersections(b[b.length-1],this._segStrings)}else if(2===arguments.length)for(var c=arguments[0],d=arguments[1].iterator();d.hasNext();)for(var e=d.next().getCoordinates(),f=1;f<e.length-1;f++)if(e[f].equals(c))throw new Zi("found endpt/interior pt intersection at index "+f+" :pt "+c)},dm.prototype.checkInteriorIntersections=function(){if(0===arguments.length)for(var a=this._segStrings.iterator();a.hasNext();)for(var b=a.next(),c=this._segStrings.iterator();c.hasNext();){var d=c.next();this.checkInteriorIntersections(b,d)}else if(2===arguments.length)for(var e=arguments[0],f=arguments[1],g=e.getCoordinates(),h=f.getCoordinates(),i=0;i<g.length-1;i++)for(var j=0;j<h.length-1;j++)this.checkInteriorIntersections(e,i,f,j);else if(4===arguments.length){var k=arguments[0],l=arguments[1],m=arguments[2],n=arguments[3];if(k===m&&l===n)return null;var o=k.getCoordinates()[l],p=k.getCoordinates()[l+1],q=m.getCoordinates()[n],r=m.getCoordinates()[n+1];if(this._li.computeIntersection(o,p,q,r),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,o,p)||this.hasInteriorIntersection(this._li,q,r)))throw new Zi("found non-noded intersection at "+o+"-"+p+" and "+q+"-"+r)}},dm.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},dm.prototype.checkCollapses=function(){if(0===arguments.length)for(var a=this._segStrings.iterator();a.hasNext();){var b=a.next();this.checkCollapses(b)}else if(1===arguments.length)for(var c=arguments[0].getCoordinates(),d=0;d<c.length-2;d++)this.checkCollapse(c[d],c[d+1],c[d+2])},dm.prototype.hasInteriorIntersection=function(a,b,c){for(var d=0;d<a.getIntersectionNum();d++){var e=a.getIntersection(d);if(!e.equals(b)&&!e.equals(c))return!0}return!1},dm.prototype.checkCollapse=function(a,b,c){if(a.equals(c))throw new Zi("found non-noded collapse at "+dm.fact.createLineString([a,b,c]))},dm.prototype.interfaces_=function(){return[]},dm.prototype.getClass=function(){return dm},em.fact.get=function(){return new qk},Object.defineProperties(dm,em);var fm=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 a=arguments[0],b=arguments[1],c=arguments[2];if(this._originalPt=a,this._pt=a,this._scaleFactor=b,this._li=c,0>=b)throw new qi("Scale factor must be non-zero");1!==b&&(this._pt=new wi(this.scale(a.x),this.scale(a.y)),this._p0Scaled=new wi,this._p1Scaled=new wi),this.initCorners(this._pt)},gm={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};fm.prototype.intersectsScaled=function(a,b){var c=Math.min(a.x,b.x),d=Math.max(a.x,b.x),e=Math.min(a.y,b.y),f=Math.max(a.y,b.y),g=this._maxx<c||this._minx>d||this._maxy<e||this._miny>f;if(g)return!1;var h=this.intersectsToleranceSquare(a,b);return _i.isTrue(!(g&&h),"Found bad envelope test"),h},fm.prototype.initCorners=function(a){this._minx=a.x-.5,this._maxx=a.x+.5,this._miny=a.y-.5,this._maxy=a.y+.5,this._corner[0]=new wi(this._maxx,this._maxy),this._corner[1]=new wi(this._minx,this._maxy),this._corner[2]=new wi(this._minx,this._miny),this._corner[3]=new wi(this._maxx,this._miny)},fm.prototype.intersects=function(a,b){return 1===this._scaleFactor?this.intersectsScaled(a,b):(this.copyScaled(a,this._p0Scaled),this.copyScaled(b,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},fm.prototype.scale=function(a){return Math.round(a*this._scaleFactor)},fm.prototype.getCoordinate=function(){return this._originalPt},fm.prototype.copyScaled=function(a,b){b.x=this.scale(a.x),b.y=this.scale(a.y)},fm.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var a=fm.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Si(this._originalPt.x-a,this._originalPt.x+a,this._originalPt.y-a,this._originalPt.y+a)}return this._safeEnv},fm.prototype.intersectsPixelClosure=function(a,b){return this._li.computeIntersection(a,b,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(a,b,this._corner[1],this._corner[2]),this._li.hasIntersection()||(this._li.computeIntersection(a,b,this._corner[2],this._corner[3]),this._li.hasIntersection()||(this._li.computeIntersection(a,b,this._corner[3],this._corner[0]),this._li.hasIntersection()))))},fm.prototype.intersectsToleranceSquare=function(a,b){var c=!1,d=!1;return this._li.computeIntersection(a,b,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(a,b,this._corner[1],this._corner[2]),this._li.isProper()||(this._li.hasIntersection()&&(c=!0),this._li.computeIntersection(a,b,this._corner[2],this._corner[3]),this._li.isProper()||(this._li.hasIntersection()&&(d=!0),this._li.computeIntersection(a,b,this._corner[3],this._corner[0]),this._li.isProper()||c&&d||a.equals(this._pt)||b.equals(this._pt)))))},fm.prototype.addSnappedNode=function(a,b){var c=a.getCoordinate(b),d=a.getCoordinate(b+1);return!!this.intersects(c,d)&&(a.addIntersection(this.getCoordinate(),b),!0)},fm.prototype.interfaces_=function(){return[]},fm.prototype.getClass=function(){return fm},gm.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(fm,gm);var hm=function(){this.tempEnv1=new Si,this.selectedSegment=new nl};hm.prototype.select=function(){if(1===arguments.length);else if(2===arguments.length){var a=arguments[0],b=arguments[1];a.getLineSegment(b,this.selectedSegment),this.select(this.selectedSegment)}},hm.prototype.interfaces_=function(){return[]},hm.prototype.getClass=function(){return hm};var im=function(){this._index=null;var a=arguments[0];this._index=a},jm={HotPixelSnapAction:{configurable:!0}};im.prototype.snap=function(){if(1===arguments.length){var a=arguments[0];return this.snap(a,null,-1)}if(3===arguments.length){var b=arguments[0],c=arguments[1],d=arguments[2],e=b.getSafeEnvelope(),f=new km(b,c,d);return this._index.query(e,{interfaces_:function(){return[Wk]},visitItem:function(a){a.select(e,f)}}),f.isNodeAdded()}},im.prototype.interfaces_=function(){return[]},im.prototype.getClass=function(){return im},jm.HotPixelSnapAction.get=function(){return km},Object.defineProperties(im,jm);var km=function(a){function b(){a.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var b=arguments[0],c=arguments[1],d=arguments[2];this._hotPixel=b,this._parentEdge=c,this._hotPixelVertexIndex=d}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.isNodeAdded=function(){return this._isNodeAdded},b.prototype.select=function(){if(2!==arguments.length)return a.prototype.select.apply(this,arguments);var b=arguments[0],c=arguments[1],d=b.getContext();return null!==this._parentEdge&&d===this._parentEdge&&c===this._hotPixelVertexIndex?null:void(this._isNodeAdded=this._hotPixel.addSnappedNode(d,c))},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b}(hm),lm=function(){this._li=null,this._interiorIntersections=null;var a=arguments[0];this._li=a,this._interiorIntersections=new wj};lm.prototype.processIntersections=function(a,b,c,d){if(a===c&&b===d)return null;var e=a.getCoordinates()[b],f=a.getCoordinates()[b+1],g=c.getCoordinates()[d],h=c.getCoordinates()[d+1];if(this._li.computeIntersection(e,f,g,h),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var i=0;i<this._li.getIntersectionNum();i++)this._interiorIntersections.add(this._li.getIntersection(i));a.addIntersections(this._li,b,0),c.addIntersections(this._li,d,1)}},lm.prototype.isDone=function(){return!1},lm.prototype.getInteriorIntersections=function(){return this._interiorIntersections},lm.prototype.interfaces_=function(){return[Ul]},lm.prototype.getClass=function(){return lm};var mm=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var a=arguments[0];this._pm=a,this._li=new cj,this._li.setPrecisionModel(a),this._scaleFactor=a.getScale()};mm.prototype.checkCorrectness=function(a){var b=ml.getNodedSubstrings(a),c=new dm(b);try{c.checkValid()}catch(a){if(!(a instanceof Oi))throw a;a.printStackTrace()}},mm.prototype.getNodedSubstrings=function(){return ml.getNodedSubstrings(this._nodedSegStrings)},mm.prototype.snapRound=function(a,b){var c=this.findInteriorIntersections(a,b);this.computeIntersectionSnaps(c),this.computeVertexSnaps(a)},mm.prototype.findInteriorIntersections=function(a,b){var c=new lm(b);return this._noder.setSegmentIntersector(c),this._noder.computeNodes(a),c.getInteriorIntersections()},mm.prototype.computeVertexSnaps=function(){if(Ci(arguments[0],sj))for(var a=arguments[0].iterator();a.hasNext();){var b=a.next();this.computeVertexSnaps(b)}else if(arguments[0]instanceof ml)for(var c=arguments[0],d=c.getCoordinates(),e=0;e<d.length;e++){var f=new fm(d[e],this._scaleFactor,this._li);this._pointSnapper.snap(f,c,e)&&c.addIntersection(d[e],e)}},mm.prototype.computeNodes=function(a){this._nodedSegStrings=a,this._noder=new ul,this._pointSnapper=new im(this._noder.getIndex()),this.snapRound(a,this._li)},mm.prototype.computeIntersectionSnaps=function(a){for(var b=a.iterator();b.hasNext();){var c=b.next(),d=new fm(c,this._scaleFactor,this._li);this._pointSnapper.snap(d)}},mm.prototype.interfaces_=function(){return[sl]},mm.prototype.getClass=function(){return mm};var nm=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new wl,this._resultGeometry=null,this._saveException=null,1===arguments.length){var a=arguments[0];this._argGeom=a}else if(2===arguments.length){var b=arguments[0],c=arguments[1];this._argGeom=b,this._bufParams=c}},om={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};nm.prototype.bufferFixedPrecision=function(a){var b=new cm(new mm(new mk(1)),a.getScale()),c=new bm(this._bufParams);c.setWorkingPrecisionModel(a),c.setNoder(b),this._resultGeometry=c.buffer(this._argGeom,this._distance)},nm.prototype.bufferReducedPrecision=function(){var a=this;if(0===arguments.length){for(var b=nm.MAX_PRECISION_DIGITS;b>=0;b--){try{a.bufferReducedPrecision(b)}catch(b){if(!(b instanceof Bk))throw b;a._saveException=b}if(null!==a._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var c=arguments[0],d=nm.precisionScaleFactor(this._argGeom,this._distance,c),e=new mk(d);this.bufferFixedPrecision(e)}},nm.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var a=this._argGeom.getFactory().getPrecisionModel();a.getType()===mk.FIXED?this.bufferFixedPrecision(a):this.bufferReducedPrecision()},nm.prototype.setQuadrantSegments=function(a){this._bufParams.setQuadrantSegments(a)},nm.prototype.bufferOriginalPrecision=function(){try{var a=new bm(this._bufParams);this._resultGeometry=a.buffer(this._argGeom,this._distance)}catch(a){if(!(a instanceof Zi))throw a;this._saveException=a}},nm.prototype.getResultGeometry=function(a){return this._distance=a,this.computeGeometry(),this._resultGeometry},nm.prototype.setEndCapStyle=function(a){this._bufParams.setEndCapStyle(a)},nm.prototype.interfaces_=function(){return[]},nm.prototype.getClass=function(){return nm},nm.bufferOp=function(){if(2===arguments.length){var a=arguments[0],b=arguments[1];return new nm(a).getResultGeometry(b)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof ij&&"number"==typeof arguments[1]){var c=arguments[0],d=arguments[1],e=arguments[2],f=new nm(c);return f.setQuadrantSegments(e),f.getResultGeometry(d)}if(arguments[2]instanceof wl&&arguments[0]instanceof ij&&"number"==typeof arguments[1]){var g=arguments[0],h=arguments[1],i=arguments[2];return new nm(g,i).getResultGeometry(h)}}else if(4===arguments.length){var j=arguments[0],k=arguments[1],l=arguments[2],m=arguments[3],n=new nm(j);return n.setQuadrantSegments(l),n.setEndCapStyle(m),n.getResultGeometry(k)}},nm.precisionScaleFactor=function(a,b,c){var d=a.getEnvelopeInternal(),e=Di.max(Math.abs(d.getMaxX()),Math.abs(d.getMaxY()),Math.abs(d.getMinX()),Math.abs(d.getMinY()))+2*(b>0?b:0),f=c-Math.trunc(Math.log(e)/Math.log(10)+1);return Math.pow(10,f)},om.CAP_ROUND.get=function(){return wl.CAP_ROUND},om.CAP_BUTT.get=function(){return wl.CAP_FLAT},om.CAP_FLAT.get=function(){return wl.CAP_FLAT},om.CAP_SQUARE.get=function(){return wl.CAP_SQUARE},om.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(nm,om);var pm=function(){this._pt=[new wi,new wi],this._distance=ri.NaN,this._isNull=!0};pm.prototype.getCoordinates=function(){return this._pt},pm.prototype.getCoordinate=function(a){return this._pt[a]},pm.prototype.setMinimum=function(){if(1===arguments.length){var a=arguments[0];this.setMinimum(a._pt[0],a._pt[1])}else if(2===arguments.length){var b=arguments[0],c=arguments[1];if(this._isNull)return this.initialize(b,c),null;var d=b.distance(c);d<this._distance&&this.initialize(b,c,d)}},pm.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var a=arguments[0],b=arguments[1];this._pt[0].setCoordinate(a),this._pt[1].setCoordinate(b),this._distance=a.distance(b),this._isNull=!1}else if(3===arguments.length){
var c=arguments[0],d=arguments[1],e=arguments[2];this._pt[0].setCoordinate(c),this._pt[1].setCoordinate(d),this._distance=e,this._isNull=!1}},pm.prototype.getDistance=function(){return this._distance},pm.prototype.setMaximum=function(){if(1===arguments.length){var a=arguments[0];this.setMaximum(a._pt[0],a._pt[1])}else if(2===arguments.length){var b=arguments[0],c=arguments[1];if(this._isNull)return this.initialize(b,c),null;var d=b.distance(c);d>this._distance&&this.initialize(b,c,d)}},pm.prototype.interfaces_=function(){return[]},pm.prototype.getClass=function(){return pm};var qm=function(){};qm.prototype.interfaces_=function(){return[]},qm.prototype.getClass=function(){return qm},qm.computeDistance=function(){if(arguments[2]instanceof pm&&arguments[0]instanceof Wj&&arguments[1]instanceof wi)for(var a=arguments[0],b=arguments[1],c=arguments[2],d=a.getCoordinates(),e=new nl,f=0;f<d.length-1;f++){e.setCoordinates(d[f],d[f+1]);var g=e.closestPoint(b);c.setMinimum(g,b)}else if(arguments[2]instanceof pm&&arguments[0]instanceof $j&&arguments[1]instanceof wi){var h=arguments[0],i=arguments[1],j=arguments[2];qm.computeDistance(h.getExteriorRing(),i,j);for(var k=0;k<h.getNumInteriorRing();k++)qm.computeDistance(h.getInteriorRingN(k),i,j)}else if(arguments[2]instanceof pm&&arguments[0]instanceof ij&&arguments[1]instanceof wi){var l=arguments[0],m=arguments[1],n=arguments[2];if(l instanceof Wj)qm.computeDistance(l,m,n);else if(l instanceof $j)qm.computeDistance(l,m,n);else if(l instanceof Pj)for(var o=l,p=0;p<o.getNumGeometries();p++){var q=o.getGeometryN(p);qm.computeDistance(q,m,n)}else n.setMinimum(l.getCoordinate(),m)}else if(arguments[2]instanceof pm&&arguments[0]instanceof nl&&arguments[1]instanceof wi){var r=arguments[0],s=arguments[1],t=arguments[2],u=r.closestPoint(s);t.setMinimum(u,s)}};var rm=function(a){this._maxPtDist=new pm,this._inputGeom=a||null},sm={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};rm.prototype.computeMaxMidpointDistance=function(a){var b=new um(this._inputGeom);a.apply(b),this._maxPtDist.setMaximum(b.getMaxPointDistance())},rm.prototype.computeMaxVertexDistance=function(a){var b=new tm(this._inputGeom);a.apply(b),this._maxPtDist.setMaximum(b.getMaxPointDistance())},rm.prototype.findDistance=function(a){return this.computeMaxVertexDistance(a),this.computeMaxMidpointDistance(a),this._maxPtDist.getDistance()},rm.prototype.getDistancePoints=function(){return this._maxPtDist},rm.prototype.interfaces_=function(){return[]},rm.prototype.getClass=function(){return rm},sm.MaxPointDistanceFilter.get=function(){return tm},sm.MaxMidpointDistanceFilter.get=function(){return um},Object.defineProperties(rm,sm);var tm=function(a){this._maxPtDist=new pm,this._minPtDist=new pm,this._geom=a||null};tm.prototype.filter=function(a){this._minPtDist.initialize(),qm.computeDistance(this._geom,a,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},tm.prototype.getMaxPointDistance=function(){return this._maxPtDist},tm.prototype.interfaces_=function(){return[lj]},tm.prototype.getClass=function(){return tm};var um=function(a){this._maxPtDist=new pm,this._minPtDist=new pm,this._geom=a||null};um.prototype.filter=function(a,b){if(0===b)return null;var c=a.getCoordinate(b-1),d=a.getCoordinate(b),e=new wi((c.x+d.x)/2,(c.y+d.y)/2);this._minPtDist.initialize(),qm.computeDistance(this._geom,e,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},um.prototype.isDone=function(){return!1},um.prototype.isGeometryChanged=function(){return!1},um.prototype.getMaxPointDistance=function(){return this._maxPtDist},um.prototype.interfaces_=function(){return[Oj]},um.prototype.getClass=function(){return um};var vm=function(a){this._comps=a||null};vm.prototype.filter=function(a){a instanceof $j&&this._comps.add(a)},vm.prototype.interfaces_=function(){return[Nj]},vm.prototype.getClass=function(){return vm},vm.getPolygons=function(){if(1===arguments.length){var a=arguments[0];return vm.getPolygons(a,new wj)}if(2===arguments.length){var b=arguments[0],c=arguments[1];return b instanceof $j?c.add(b):b instanceof Pj&&b.apply(new vm(c)),c}};var wm=function(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var a=arguments[0];this._lines=a}else if(2===arguments.length){var b=arguments[0],c=arguments[1];this._lines=b,this._isForcedToLineString=c}};wm.prototype.filter=function(a){if(this._isForcedToLineString&&a instanceof ak){var b=a.getFactory().createLineString(a.getCoordinateSequence());return this._lines.add(b),null}a instanceof Wj&&this._lines.add(a)},wm.prototype.setForceToLineString=function(a){this._isForcedToLineString=a},wm.prototype.interfaces_=function(){return[hj]},wm.prototype.getClass=function(){return wm},wm.getGeometry=function(){if(1===arguments.length){var a=arguments[0];return a.getFactory().buildGeometry(wm.getLines(a))}if(2===arguments.length){var b=arguments[0],c=arguments[1];return b.getFactory().buildGeometry(wm.getLines(b,c))}},wm.getLines=function(){if(1===arguments.length){var a=arguments[0];return wm.getLines(a,!1)}if(2===arguments.length){if(Ci(arguments[0],sj)&&Ci(arguments[1],sj)){for(var b=arguments[0],c=arguments[1],d=b.iterator();d.hasNext();){var e=d.next();wm.getLines(e,c)}return c}if(arguments[0]instanceof ij&&"boolean"==typeof arguments[1]){var f=arguments[0],g=arguments[1],h=new wj;return f.apply(new wm(h,g)),h}if(arguments[0]instanceof ij&&Ci(arguments[1],sj)){var i=arguments[0],j=arguments[1];return i instanceof Wj?j.add(i):i.apply(new wm(j)),j}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&Ci(arguments[0],sj)&&Ci(arguments[1],sj)){for(var k=arguments[0],l=arguments[1],m=arguments[2],n=k.iterator();n.hasNext();){var o=n.next();wm.getLines(o,l,m)}return l}if("boolean"==typeof arguments[2]&&arguments[0]instanceof ij&&Ci(arguments[1],sj)){var p=arguments[0],q=arguments[1],r=arguments[2];return p.apply(new wm(q,r)),q}}};var xm=function(){if(this._boundaryRule=mj.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){var a=arguments[0];if(null===a)throw new qi("Rule must be non-null");this._boundaryRule=a}};xm.prototype.locateInternal=function(){if(arguments[0]instanceof wi&&arguments[1]instanceof $j){var a=arguments[0],b=arguments[1];if(b.isEmpty())return Ai.EXTERIOR;var c=b.getExteriorRing(),d=this.locateInPolygonRing(a,c);if(d===Ai.EXTERIOR)return Ai.EXTERIOR;if(d===Ai.BOUNDARY)return Ai.BOUNDARY;for(var e=0;e<b.getNumInteriorRing();e++){var f=b.getInteriorRingN(e),g=this.locateInPolygonRing(a,f);if(g===Ai.INTERIOR)return Ai.EXTERIOR;if(g===Ai.BOUNDARY)return Ai.BOUNDARY}return Ai.INTERIOR}if(arguments[0]instanceof wi&&arguments[1]instanceof Wj){var h=arguments[0],i=arguments[1];if(!i.getEnvelopeInternal().intersects(h))return Ai.EXTERIOR;var j=i.getCoordinates();return i.isClosed()||!h.equals(j[0])&&!h.equals(j[j.length-1])?fj.isOnLine(h,j)?Ai.INTERIOR:Ai.EXTERIOR:Ai.BOUNDARY}if(arguments[0]instanceof wi&&arguments[1]instanceof Yj){var k=arguments[0];return arguments[1].getCoordinate().equals2D(k)?Ai.INTERIOR:Ai.EXTERIOR}},xm.prototype.locateInPolygonRing=function(a,b){return b.getEnvelopeInternal().intersects(a)?fj.locatePointInRing(a,b.getCoordinates()):Ai.EXTERIOR},xm.prototype.intersects=function(a,b){return this.locate(a,b)!==Ai.EXTERIOR},xm.prototype.updateLocationInfo=function(a){a===Ai.INTERIOR&&(this._isIn=!0),a===Ai.BOUNDARY&&this._numBoundaries++},xm.prototype.computeLocation=function(a,b){if(b instanceof Yj&&this.updateLocationInfo(this.locateInternal(a,b)),b instanceof Wj)this.updateLocationInfo(this.locateInternal(a,b));else if(b instanceof $j)this.updateLocationInfo(this.locateInternal(a,b));else if(b instanceof Qj)for(var c=b,d=0;d<c.getNumGeometries();d++){var e=c.getGeometryN(d);this.updateLocationInfo(this.locateInternal(a,e))}else if(b instanceof bk)for(var f=b,g=0;g<f.getNumGeometries();g++){var h=f.getGeometryN(g);this.updateLocationInfo(this.locateInternal(a,h))}else if(b instanceof Pj)for(var i=new Nl(b);i.hasNext();){var j=i.next();j!==b&&this.computeLocation(a,j)}},xm.prototype.locate=function(a,b){return b.isEmpty()?Ai.EXTERIOR:b instanceof Wj?this.locateInternal(a,b):b instanceof $j?this.locateInternal(a,b):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(a,b),this._boundaryRule.isInBoundary(this._numBoundaries)?Ai.BOUNDARY:this._numBoundaries>0||this._isIn?Ai.INTERIOR:Ai.EXTERIOR)},xm.prototype.interfaces_=function(){return[]},xm.prototype.getClass=function(){return xm};var ym=function Ro(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length){var a=arguments[0],b=arguments[1];Ro.call(this,a,Ro.INSIDE_AREA,b)}else if(3===arguments.length){var c=arguments[0],d=arguments[1],e=arguments[2];this._component=c,this._segIndex=d,this._pt=e}},zm={INSIDE_AREA:{configurable:!0}};ym.prototype.isInsideArea=function(){return this._segIndex===ym.INSIDE_AREA},ym.prototype.getCoordinate=function(){return this._pt},ym.prototype.getGeometryComponent=function(){return this._component},ym.prototype.getSegmentIndex=function(){return this._segIndex},ym.prototype.interfaces_=function(){return[]},ym.prototype.getClass=function(){return ym},zm.INSIDE_AREA.get=function(){return-1},Object.defineProperties(ym,zm);var Am=function(a){this._pts=a||null};Am.prototype.filter=function(a){a instanceof Yj&&this._pts.add(a)},Am.prototype.interfaces_=function(){return[Nj]},Am.prototype.getClass=function(){return Am},Am.getPoints=function(){if(1===arguments.length){var a=arguments[0];return a instanceof Yj?$k.singletonList(a):Am.getPoints(a,new wj)}if(2===arguments.length){var b=arguments[0],c=arguments[1];return b instanceof Yj?c.add(b):b instanceof Pj&&b.apply(new Am(c)),c}};var Bm=function(){this._locations=null;var a=arguments[0];this._locations=a};Bm.prototype.filter=function(a){(a instanceof Yj||a instanceof Wj||a instanceof $j)&&this._locations.add(new ym(a,0,a.getCoordinate()))},Bm.prototype.interfaces_=function(){return[Nj]},Bm.prototype.getClass=function(){return Bm},Bm.getLocations=function(a){var b=new wj;return a.apply(new Bm(b)),b};var Cm=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new xm,this._minDistanceLocation=null,this._minDistance=ri.MAX_VALUE,2===arguments.length){var a=arguments[0],b=arguments[1];this._geom=[a,b],this._terminateDistance=0}else if(3===arguments.length){var c=arguments[0],d=arguments[1],e=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=c,this._geom[1]=d,this._terminateDistance=e}};Cm.prototype.computeContainmentDistance=function(){if(0===arguments.length){var a=new Array(2).fill(null);if(this.computeContainmentDistance(0,a),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,a)}else if(2===arguments.length){var b=arguments[0],c=arguments[1],d=1-b,e=vm.getPolygons(this._geom[b]);if(e.size()>0){var f=Bm.getLocations(this._geom[d]);if(this.computeContainmentDistance(f,e,c),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[d]=c[0],this._minDistanceLocation[b]=c[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&Ci(arguments[0],vj)&&Ci(arguments[1],vj)){for(var g=arguments[0],h=arguments[1],i=arguments[2],j=0;j<g.size();j++)for(var k=g.get(j),l=0;l<h.size();l++)if(this.computeContainmentDistance(k,h.get(l),i),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof ym&&arguments[1]instanceof $j){var m=arguments[0],n=arguments[1],o=arguments[2],p=m.getCoordinate();if(Ai.EXTERIOR!==this._ptLocator.locate(p,n))return this._minDistance=0,o[0]=m,o[1]=new ym(n,p),null}},Cm.prototype.computeMinDistanceLinesPoints=function(a,b,c){for(var d=0;d<a.size();d++)for(var e=a.get(d),f=0;f<b.size();f++){var g=b.get(f);if(this.computeMinDistance(e,g,c),this._minDistance<=this._terminateDistance)return null}},Cm.prototype.computeFacetDistance=function(){var a=new Array(2).fill(null),b=wm.getLines(this._geom[0]),c=wm.getLines(this._geom[1]),d=Am.getPoints(this._geom[0]),e=Am.getPoints(this._geom[1]);return this.computeMinDistanceLines(b,c,a),this.updateMinDistance(a,!1),this._minDistance<=this._terminateDistance?null:(a[0]=null,a[1]=null,this.computeMinDistanceLinesPoints(b,e,a),this.updateMinDistance(a,!1),this._minDistance<=this._terminateDistance?null:(a[0]=null,a[1]=null,this.computeMinDistanceLinesPoints(c,d,a),this.updateMinDistance(a,!0),this._minDistance<=this._terminateDistance?null:(a[0]=null,a[1]=null,this.computeMinDistancePoints(d,e,a),void this.updateMinDistance(a,!1))))},Cm.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},Cm.prototype.updateMinDistance=function(a,b){return null===a[0]?null:void(b?(this._minDistanceLocation[0]=a[1],this._minDistanceLocation[1]=a[0]):(this._minDistanceLocation[0]=a[0],this._minDistanceLocation[1]=a[1]))},Cm.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},Cm.prototype.computeMinDistance=function(){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 Wj&&arguments[1]instanceof Yj){var a=arguments[0],b=arguments[1],c=arguments[2];if(a.getEnvelopeInternal().distance(b.getEnvelopeInternal())>this._minDistance)return null;for(var d=a.getCoordinates(),e=b.getCoordinate(),f=0;f<d.length-1;f++){var g=fj.distancePointLine(e,d[f],d[f+1]);if(g<this._minDistance){this._minDistance=g;var h=new nl(d[f],d[f+1]).closestPoint(e);c[0]=new ym(a,f,h),c[1]=new ym(b,0,e)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof Wj&&arguments[1]instanceof Wj){var i=arguments[0],j=arguments[1],k=arguments[2];if(i.getEnvelopeInternal().distance(j.getEnvelopeInternal())>this._minDistance)return null;for(var l=i.getCoordinates(),m=j.getCoordinates(),n=0;n<l.length-1;n++)for(var o=0;o<m.length-1;o++){var p=fj.distanceLineLine(l[n],l[n+1],m[o],m[o+1]);if(p<this._minDistance){this._minDistance=p;var q=new nl(l[n],l[n+1]),r=new nl(m[o],m[o+1]),s=q.closestPoints(r);k[0]=new ym(i,n,s[0]),k[1]=new ym(j,o,s[1])}if(this._minDistance<=this._terminateDistance)return null}}},Cm.prototype.computeMinDistancePoints=function(a,b,c){for(var d=0;d<a.size();d++)for(var e=a.get(d),f=0;f<b.size();f++){var g=b.get(f),h=e.getCoordinate().distance(g.getCoordinate());if(h<this._minDistance&&(this._minDistance=h,c[0]=new ym(e,0,e.getCoordinate()),c[1]=new ym(g,0,g.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},Cm.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new qi("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},Cm.prototype.computeMinDistanceLines=function(a,b,c){for(var d=0;d<a.size();d++)for(var e=a.get(d),f=0;f<b.size();f++){var g=b.get(f);if(this.computeMinDistance(e,g,c),this._minDistance<=this._terminateDistance)return null}},Cm.prototype.interfaces_=function(){return[]},Cm.prototype.getClass=function(){return Cm},Cm.distance=function(a,b){return new Cm(a,b).distance()},Cm.isWithinDistance=function(a,b,c){return new Cm(a,b,c).distance()<=c},Cm.nearestPoints=function(a,b){return new Cm(a,b).nearestPoints()};var Dm=function(){this._pt=[new wi,new wi],this._distance=ri.NaN,this._isNull=!0};Dm.prototype.getCoordinates=function(){return this._pt},Dm.prototype.getCoordinate=function(a){return this._pt[a]},Dm.prototype.setMinimum=function(){if(1===arguments.length){var a=arguments[0];this.setMinimum(a._pt[0],a._pt[1])}else if(2===arguments.length){var b=arguments[0],c=arguments[1];if(this._isNull)return this.initialize(b,c),null;var d=b.distance(c);d<this._distance&&this.initialize(b,c,d)}},Dm.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var a=arguments[0],b=arguments[1];this._pt[0].setCoordinate(a),this._pt[1].setCoordinate(b),this._distance=a.distance(b),this._isNull=!1}else if(3===arguments.length){var c=arguments[0],d=arguments[1],e=arguments[2];this._pt[0].setCoordinate(c),this._pt[1].setCoordinate(d),this._distance=e,this._isNull=!1}},Dm.prototype.toString=function(){return Yi.toLineString(this._pt[0],this._pt[1])},Dm.prototype.getDistance=function(){return this._distance},Dm.prototype.setMaximum=function(){if(1===arguments.length){var a=arguments[0];this.setMaximum(a._pt[0],a._pt[1])}else if(2===arguments.length){var b=arguments[0],c=arguments[1];if(this._isNull)return this.initialize(b,c),null;var d=b.distance(c);d>this._distance&&this.initialize(b,c,d)}},Dm.prototype.interfaces_=function(){return[]},Dm.prototype.getClass=function(){return Dm};var Em=function(){};Em.prototype.interfaces_=function(){return[]},Em.prototype.getClass=function(){return Em},Em.computeDistance=function(){if(arguments[2]instanceof Dm&&arguments[0]instanceof Wj&&arguments[1]instanceof wi)for(var a=arguments[0],b=arguments[1],c=arguments[2],d=new nl,e=a.getCoordinates(),f=0;f<e.length-1;f++){d.setCoordinates(e[f],e[f+1]);var g=d.closestPoint(b);c.setMinimum(g,b)}else if(arguments[2]instanceof Dm&&arguments[0]instanceof $j&&arguments[1]instanceof wi){var h=arguments[0],i=arguments[1],j=arguments[2];Em.computeDistance(h.getExteriorRing(),i,j);for(var k=0;k<h.getNumInteriorRing();k++)Em.computeDistance(h.getInteriorRingN(k),i,j)}else if(arguments[2]instanceof Dm&&arguments[0]instanceof ij&&arguments[1]instanceof wi){var l=arguments[0],m=arguments[1],n=arguments[2];if(l instanceof Wj)Em.computeDistance(l,m,n);else if(l instanceof $j)Em.computeDistance(l,m,n);else if(l instanceof Pj)for(var o=l,p=0;p<o.getNumGeometries();p++){var q=o.getGeometryN(p);Em.computeDistance(q,m,n)}else n.setMinimum(l.getCoordinate(),m)}else if(arguments[2]instanceof Dm&&arguments[0]instanceof nl&&arguments[1]instanceof wi){var r=arguments[0],s=arguments[1],t=arguments[2],u=r.closestPoint(s);t.setMinimum(u,s)}};var Fm=function(){this._g0=null,this._g1=null,this._ptDist=new Dm,this._densifyFrac=0;var a=arguments[0],b=arguments[1];this._g0=a,this._g1=b},Gm={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};Fm.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},Fm.prototype.setDensifyFraction=function(a){if(a>1||0>=a)throw new qi("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=a},Fm.prototype.compute=function(a,b){this.computeOrientedDistance(a,b,this._ptDist),this.computeOrientedDistance(b,a,this._ptDist)},Fm.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Fm.prototype.computeOrientedDistance=function(a,b,c){var d=new Hm(b);if(a.apply(d),c.setMaximum(d.getMaxPointDistance()),this._densifyFrac>0){var e=new Im(b,this._densifyFrac);a.apply(e),c.setMaximum(e.getMaxPointDistance())}},Fm.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Fm.prototype.interfaces_=function(){return[]},Fm.prototype.getClass=function(){return Fm},Fm.distance=function(){if(2===arguments.length){var a=arguments[0],b=arguments[1];return new Fm(a,b).distance()}if(3===arguments.length){var c=arguments[0],d=arguments[1],e=arguments[2],f=new Fm(c,d);return f.setDensifyFraction(e),f.distance()}},Gm.MaxPointDistanceFilter.get=function(){return Hm},Gm.MaxDensifiedByFractionDistanceFilter.get=function(){return Im},Object.defineProperties(Fm,Gm);var Hm=function(){this._maxPtDist=new Dm,this._minPtDist=new Dm,this._euclideanDist=new Em,this._geom=null;var a=arguments[0];this._geom=a};Hm.prototype.filter=function(a){this._minPtDist.initialize(),Em.computeDistance(this._geom,a,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Hm.prototype.getMaxPointDistance=function(){return this._maxPtDist},Hm.prototype.interfaces_=function(){return[lj]},Hm.prototype.getClass=function(){return Hm};var Im=function(){this._maxPtDist=new Dm,this._minPtDist=new Dm,this._geom=null,this._numSubSegs=0;var a=arguments[0],b=arguments[1];this._geom=a,this._numSubSegs=Math.trunc(Math.round(1/b))};Im.prototype.filter=function(a,b){if(0===b)return null;for(var c=a.getCoordinate(b-1),d=a.getCoordinate(b),e=(d.x-c.x)/this._numSubSegs,f=(d.y-c.y)/this._numSubSegs,g=0;g<this._numSubSegs;g++){var h=c.x+g*e,i=c.y+g*f,j=new wi(h,i);this._minPtDist.initialize(),Em.computeDistance(this._geom,j,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},Im.prototype.isDone=function(){return!1},Im.prototype.isGeometryChanged=function(){return!1},Im.prototype.getMaxPointDistance=function(){return this._maxPtDist},Im.prototype.interfaces_=function(){return[Oj]},Im.prototype.getClass=function(){return Im};var Jm=function(a,b,c){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=a||null,this._bufDistance=b||null,this._result=c||null},Km={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Jm.prototype.checkMaximumDistance=function(a,b,c){var d=new Fm(b,a);if(d.setDensifyFraction(.25),this._maxDistanceFound=d.orientedDistance(),this._maxDistanceFound>c){this._isValid=!1;var e=d.getCoordinates();this._errorLocation=e[1],this._errorIndicator=a.getFactory().createLineString(e),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Yi.toLineString(e[0],e[1])+")"}},Jm.prototype.isValid=function(){var a=Math.abs(this._bufDistance),b=Jm.MAX_DISTANCE_DIFF_FRAC*a;return this._minValidDistance=a-b,this._maxValidDistance=a+b,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Jm.VERBOSE&&Qi.out.println("Min Dist= "+this._minDistanceFound+"  err= "+(1-this._minDistanceFound/this._bufDistance)+"  Max Dist= "+this._maxDistanceFound+"  err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Jm.prototype.checkNegativeValid=function(){if(!(this._input instanceof $j||this._input instanceof bk||this._input instanceof Pj))return null;var a=this.getPolygonLines(this._input);return this.checkMinimumDistance(a,this._result,this._minValidDistance),this._isValid?void this.checkMaximumDistance(a,this._result,this._maxValidDistance):null},Jm.prototype.getErrorIndicator=function(){return this._errorIndicator},Jm.prototype.checkMinimumDistance=function(a,b,c){var d=new Cm(a,b,c);if(this._minDistanceFound=d.distance(),this._minDistanceFound<c){this._isValid=!1;var e=d.nearestPoints();this._errorLocation=d.nearestPoints()[1],this._errorIndicator=a.getFactory().createLineString(e),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+Yi.toLineString(e[0],e[1])+" )"}},Jm.prototype.checkPositiveValid=function(){var a=this._result.getBoundary();return this.checkMinimumDistance(this._input,a,this._minValidDistance),this._isValid?void this.checkMaximumDistance(this._input,a,this._maxValidDistance):null},Jm.prototype.getErrorLocation=function(){return this._errorLocation},Jm.prototype.getPolygonLines=function(a){for(var b=new wj,c=new wm(b),d=vm.getPolygons(a).iterator();d.hasNext();)d.next().apply(c);return a.getFactory().buildGeometry(b)},Jm.prototype.getErrorMessage=function(){return this._errMsg},Jm.prototype.interfaces_=function(){return[]},Jm.prototype.getClass=function(){return Jm},Km.VERBOSE.get=function(){return!1},Km.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(Jm,Km);var Lm=function(a,b,c){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=a||null,this._distance=b||null,this._result=c||null},Mm={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};Lm.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},Lm.prototype.checkEnvelope=function(){if(this._distance<0)return null;var a=this._distance*Lm.MAX_ENV_DIFF_FRAC;0===a&&(a=.001);var b=new Si(this._input.getEnvelopeInternal());b.expandBy(this._distance);var c=new Si(this._result.getEnvelopeInternal());c.expandBy(a),c.contains(b)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(c)),this.report("Envelope")},Lm.prototype.checkDistance=function(){var a=new Jm(this._input,this._distance,this._result);a.isValid()||(this._isValid=!1,this._errorMsg=a.getErrorMessage(),this._errorLocation=a.getErrorLocation(),this._errorIndicator=a.getErrorIndicator()),this.report("Distance")},Lm.prototype.checkArea=function(){var a=this._input.getArea(),b=this._result.getArea();this._distance>0&&a>b&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&b>a&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},Lm.prototype.checkPolygonal=function(){this._result instanceof $j||this._result instanceof bk||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},Lm.prototype.getErrorIndicator=function(){return this._errorIndicator},Lm.prototype.getErrorLocation=function(){return this._errorLocation},Lm.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2?null:this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},Lm.prototype.report=function(a){return Lm.VERBOSE?void Qi.out.println("Check "+a+": "+(this._isValid?"passed":"FAILED")):null},Lm.prototype.getErrorMessage=function(){return this._errorMsg},Lm.prototype.interfaces_=function(){return[]},Lm.prototype.getClass=function(){return Lm},Lm.isValidMsg=function(a,b,c){var d=new Lm(a,b,c);return d.isValid()?null:d.getErrorMessage()},Lm.isValid=function(a,b,c){return!!new Lm(a,b,c).isValid()},Mm.VERBOSE.get=function(){return!1},Mm.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(Lm,Mm);var Nm=function(){this._pts=null,this._data=null;var a=arguments[0],b=arguments[1];this._pts=a,this._data=b};Nm.prototype.getCoordinates=function(){return this._pts},Nm.prototype.size=function(){return this._pts.length},Nm.prototype.getCoordinate=function(a){return this._pts[a]},Nm.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Nm.prototype.getSegmentOctant=function(a){return a===this._pts.length-1?-1:jl.octant(this.getCoordinate(a),this.getCoordinate(a+1))},Nm.prototype.setData=function(a){this._data=a},Nm.prototype.getData=function(){return this._data},Nm.prototype.toString=function(){return Yi.toLineString(new hk(this._pts))},Nm.prototype.interfaces_=function(){return[kl]},Nm.prototype.getClass=function(){return Nm};var Om=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new wj,this._intersectionCount=0,this._keepIntersections=!0;var a=arguments[0];this._li=a,this._interiorIntersection=null};Om.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Om.prototype.setCheckEndSegmentsOnly=function(a){this._isCheckEndSegmentsOnly=a},Om.prototype.getIntersectionSegments=function(){return this._intSegments},Om.prototype.count=function(){return this._intersectionCount},Om.prototype.getIntersections=function(){return this._intersections},Om.prototype.setFindAllIntersections=function(a){this._findAllIntersections=a},Om.prototype.setKeepIntersections=function(a){this._keepIntersections=a},Om.prototype.processIntersections=function(a,b,c,d){if(!this._findAllIntersections&&this.hasIntersection())return null;if(a===c&&b===d)return null;if(this._isCheckEndSegmentsOnly&&!this.isEndSegment(a,b)&&!this.isEndSegment(c,d))return null;var e=a.getCoordinates()[b],f=a.getCoordinates()[b+1],g=c.getCoordinates()[d],h=c.getCoordinates()[d+1];this._li.computeIntersection(e,f,g,h),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=e,this._intSegments[1]=f,this._intSegments[2]=g,this._intSegments[3]=h,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},Om.prototype.isEndSegment=function(a,b){return 0===b||b>=a.size()-2},Om.prototype.hasIntersection=function(){return null!==this._interiorIntersection},Om.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},Om.prototype.interfaces_=function(){return[Ul]},Om.prototype.getClass=function(){return Om},Om.createAllIntersectionsFinder=function(a){var b=new Om(a);return b.setFindAllIntersections(!0),b},Om.createAnyIntersectionFinder=function(a){return new Om(a)},Om.createIntersectionCounter=function(a){var b=new Om(a);return b.setFindAllIntersections(!0),b.setKeepIntersections(!1),b};var Pm=function(){this._li=new cj,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var a=arguments[0];this._segStrings=a};Pm.prototype.execute=function(){return null!==this._segInt?null:void this.checkInteriorIntersections()},Pm.prototype.getIntersections=function(){return this._segInt.getIntersections()},Pm.prototype.isValid=function(){return this.execute(),this._isValid},Pm.prototype.setFindAllIntersections=function(a){this._findAllIntersections=a},Pm.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Om(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var a=new ul;return a.setSegmentIntersector(this._segInt),a.computeNodes(this._segStrings),this._segInt.hasIntersection()?(this._isValid=!1,null):void 0},Pm.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Bk(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Pm.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var a=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Yi.toLineString(a[0],a[1])+" and "+Yi.toLineString(a[2],a[3])},Pm.prototype.interfaces_=function(){return[]},Pm.prototype.getClass=function(){return Pm},Pm.computeIntersections=function(a){var b=new Pm(a);return b.setFindAllIntersections(!0),b.isValid(),b.getIntersections()};var Qm=function So(){this._nv=null;var a=arguments[0];this._nv=new Pm(So.toSegmentStrings(a))};Qm.prototype.checkValid=function(){this._nv.checkValid()},Qm.prototype.interfaces_=function(){return[]},Qm.prototype.getClass=function(){return Qm},Qm.toSegmentStrings=function(a){for(var b=new wj,c=a.iterator();c.hasNext();){var d=c.next();b.add(new Nm(d.getCoordinates(),d))}return b},Qm.checkValid=function(a){new Qm(a).checkValid()};var Rm=function(a){this._mapOp=a};Rm.prototype.map=function(a){for(var b=new wj,c=0;c<a.getNumGeometries();c++){var d=this._mapOp.map(a.getGeometryN(c));d.isEmpty()||b.add(d)}return a.getFactory().createGeometryCollection(qk.toGeometryArray(b))},Rm.prototype.interfaces_=function(){return[]},Rm.prototype.getClass=function(){return Rm},Rm.map=function(a,b){return new Rm(b).map(a)};var Sm=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new wj,this._resultLineList=new wj;
var a=arguments[0],b=arguments[1],c=arguments[2];this._op=a,this._geometryFactory=b,this._ptLocator=c};Sm.prototype.collectLines=function(a){for(var b=this._op.getGraph().getEdgeEnds().iterator();b.hasNext();){var c=b.next();this.collectLineEdge(c,a,this._lineEdgesList),this.collectBoundaryTouchEdge(c,a,this._lineEdgesList)}},Sm.prototype.labelIsolatedLine=function(a,b){var c=this._ptLocator.locate(a.getCoordinate(),this._op.getArgGeometry(b));a.getLabel().setLocation(b,c)},Sm.prototype.build=function(a){return this.findCoveredLineEdges(),this.collectLines(a),this.buildLines(a),this._resultLineList},Sm.prototype.collectLineEdge=function(a,b,c){var d=a.getLabel(),e=a.getEdge();a.isLineEdge()&&(a.isVisited()||!zn.isResultOfOp(d,b)||e.isCovered()||(c.add(e),a.setVisitedEdge(!0)))},Sm.prototype.findCoveredLineEdges=function(){for(var a=this._op.getGraph().getNodes().iterator();a.hasNext();)a.next().getEdges().findCoveredLineEdges();for(var b=this._op.getGraph().getEdgeEnds().iterator();b.hasNext();){var c=b.next(),d=c.getEdge();if(c.isLineEdge()&&!d.isCoveredSet()){var e=this._op.isCoveredByA(c.getCoordinate());d.setCovered(e)}}},Sm.prototype.labelIsolatedLines=function(a){for(var b=a.iterator();b.hasNext();){var c=b.next(),d=c.getLabel();c.isIsolated()&&(d.isNull(0)?this.labelIsolatedLine(c,0):this.labelIsolatedLine(c,1))}},Sm.prototype.buildLines=function(a){for(var b=this._lineEdgesList.iterator();b.hasNext();){var c=b.next(),d=this._geometryFactory.createLineString(c.getCoordinates());this._resultLineList.add(d),c.setInResult(!0)}},Sm.prototype.collectBoundaryTouchEdge=function(a,b,c){var d=a.getLabel();return a.isLineEdge()?null:a.isVisited()?null:a.isInteriorAreaEdge()?null:a.getEdge().isInResult()?null:(_i.isTrue(!(a.isInResult()||a.getSym().isInResult())||!a.getEdge().isInResult()),void(zn.isResultOfOp(d,b)&&b===zn.INTERSECTION&&(c.add(a.getEdge()),a.setVisitedEdge(!0))))},Sm.prototype.interfaces_=function(){return[]},Sm.prototype.getClass=function(){return Sm};var Tm=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new wj;var a=arguments[0],b=arguments[1];this._op=a,this._geometryFactory=b};Tm.prototype.filterCoveredNodeToPoint=function(a){var b=a.getCoordinate();if(!this._op.isCoveredByLA(b)){var c=this._geometryFactory.createPoint(b);this._resultPointList.add(c)}},Tm.prototype.extractNonCoveredResultNodes=function(a){for(var b=this._op.getGraph().getNodes().iterator();b.hasNext();){var c=b.next();if(!(c.isInResult()||c.isIncidentEdgeInResult()||0!==c.getEdges().getDegree()&&a!==zn.INTERSECTION)){var d=c.getLabel();zn.isResultOfOp(d,a)&&this.filterCoveredNodeToPoint(c)}}},Tm.prototype.build=function(a){return this.extractNonCoveredResultNodes(a),this._resultPointList},Tm.prototype.interfaces_=function(){return[]},Tm.prototype.getClass=function(){return Tm};var Um=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};Um.prototype.transformPoint=function(a,b){return this._factory.createPoint(this.transformCoordinates(a.getCoordinateSequence(),a))},Um.prototype.transformPolygon=function(a,b){var c=!0,d=this.transformLinearRing(a.getExteriorRing(),a);null!==d&&d instanceof ak&&!d.isEmpty()||(c=!1);for(var e=new wj,f=0;f<a.getNumInteriorRing();f++){var g=this.transformLinearRing(a.getInteriorRingN(f),a);null===g||g.isEmpty()||(g instanceof ak||(c=!1),e.add(g))}if(c)return this._factory.createPolygon(d,e.toArray([]));var h=new wj;return null!==d&&h.add(d),h.addAll(e),this._factory.buildGeometry(h)},Um.prototype.createCoordinateSequence=function(a){return this._factory.getCoordinateSequenceFactory().create(a)},Um.prototype.getInputGeometry=function(){return this._inputGeom},Um.prototype.transformMultiLineString=function(a,b){for(var c=new wj,d=0;d<a.getNumGeometries();d++){var e=this.transformLineString(a.getGeometryN(d),a);null!==e&&(e.isEmpty()||c.add(e))}return this._factory.buildGeometry(c)},Um.prototype.transformCoordinates=function(a,b){return this.copy(a)},Um.prototype.transformLineString=function(a,b){return this._factory.createLineString(this.transformCoordinates(a.getCoordinateSequence(),a))},Um.prototype.transformMultiPoint=function(a,b){for(var c=new wj,d=0;d<a.getNumGeometries();d++){var e=this.transformPoint(a.getGeometryN(d),a);null!==e&&(e.isEmpty()||c.add(e))}return this._factory.buildGeometry(c)},Um.prototype.transformMultiPolygon=function(a,b){for(var c=new wj,d=0;d<a.getNumGeometries();d++){var e=this.transformPolygon(a.getGeometryN(d),a);null!==e&&(e.isEmpty()||c.add(e))}return this._factory.buildGeometry(c)},Um.prototype.copy=function(a){return a.copy()},Um.prototype.transformGeometryCollection=function(a,b){for(var c=new wj,d=0;d<a.getNumGeometries();d++){var e=this.transform(a.getGeometryN(d));null!==e&&(this._pruneEmptyGeometry&&e.isEmpty()||c.add(e))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(qk.toGeometryArray(c)):this._factory.buildGeometry(c)},Um.prototype.transform=function(a){if(this._inputGeom=a,this._factory=a.getFactory(),a instanceof Yj)return this.transformPoint(a,null);if(a instanceof _j)return this.transformMultiPoint(a,null);if(a instanceof ak)return this.transformLinearRing(a,null);if(a instanceof Wj)return this.transformLineString(a,null);if(a instanceof Qj)return this.transformMultiLineString(a,null);if(a instanceof $j)return this.transformPolygon(a,null);if(a instanceof bk)return this.transformMultiPolygon(a,null);if(a instanceof Pj)return this.transformGeometryCollection(a,null);throw new qi("Unknown Geometry subtype: "+a.getClass().getName())},Um.prototype.transformLinearRing=function(a,b){var c=this.transformCoordinates(a.getCoordinateSequence(),a);if(null===c)return this._factory.createLinearRing(null);var d=c.size();return d>0&&4>d&&!this._preserveType?this._factory.createLineString(c):this._factory.createLinearRing(c)},Um.prototype.interfaces_=function(){return[]},Um.prototype.getClass=function(){return Um};var Vm=function To(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new nl,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Wj&&"number"==typeof arguments[1]){var a=arguments[0],b=arguments[1];To.call(this,a.getCoordinates(),b)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var c=arguments[0],d=arguments[1];this._srcPts=c,this._isClosed=To.isClosed(c),this._snapTolerance=d}};Vm.prototype.snapVertices=function(a,b){for(var c=this._isClosed?a.size()-1:a.size(),d=0;c>d;d++){var e=a.get(d),f=this.findSnapForVertex(e,b);null!==f&&(a.set(d,new wi(f)),0===d&&this._isClosed&&a.set(a.size()-1,new wi(f)))}},Vm.prototype.findSnapForVertex=function(a,b){for(var c=0;c<b.length;c++){if(a.equals2D(b[c]))return null;if(a.distance(b[c])<this._snapTolerance)return b[c]}return null},Vm.prototype.snapTo=function(a){var b=new yj(this._srcPts);return this.snapVertices(b,a),this.snapSegments(b,a),b.toCoordinateArray()},Vm.prototype.snapSegments=function(a,b){if(0===b.length)return null;var c=b.length;b[0].equals2D(b[b.length-1])&&(c=b.length-1);for(var d=0;c>d;d++){var e=b[d],f=this.findSegmentIndexToSnap(e,a);f>=0&&a.add(f+1,new wi(e),!1)}},Vm.prototype.findSegmentIndexToSnap=function(a,b){for(var c=ri.MAX_VALUE,d=-1,e=0;e<b.size()-1;e++){if(this._seg.p0=b.get(e),this._seg.p1=b.get(e+1),this._seg.p0.equals2D(a)||this._seg.p1.equals2D(a)){if(this._allowSnappingToSourceVertices)continue;return-1}var f=this._seg.distance(a);f<this._snapTolerance&&c>f&&(c=f,d=e)}return d},Vm.prototype.setAllowSnappingToSourceVertices=function(a){this._allowSnappingToSourceVertices=a},Vm.prototype.interfaces_=function(){return[]},Vm.prototype.getClass=function(){return Vm},Vm.isClosed=function(a){return!(a.length<=1)&&a[0].equals2D(a[a.length-1])};var Wm=function(a){this._srcGeom=a||null},Xm={SNAP_PRECISION_FACTOR:{configurable:!0}};Wm.prototype.snapTo=function(a,b){var c=this.extractTargetCoordinates(a);return new Ym(b,c).transform(this._srcGeom)},Wm.prototype.snapToSelf=function(a,b){var c=this.extractTargetCoordinates(this._srcGeom),d=new Ym(a,c,!0).transform(this._srcGeom),e=d;return b&&Ci(e,Zj)&&(e=d.buffer(0)),e},Wm.prototype.computeSnapTolerance=function(a){return this.computeMinimumSegmentLength(a)/10},Wm.prototype.extractTargetCoordinates=function(a){for(var b=new Ne,c=a.getCoordinates(),d=0;d<c.length;d++)b.add(c[d]);return b.toArray(new Array(0).fill(null))},Wm.prototype.computeMinimumSegmentLength=function(a){for(var b=ri.MAX_VALUE,c=0;c<a.length-1;c++){var d=a[c].distance(a[c+1]);b>d&&(b=d)}return b},Wm.prototype.interfaces_=function(){return[]},Wm.prototype.getClass=function(){return Wm},Wm.snap=function(a,b,c){var d=new Array(2).fill(null),e=new Wm(a);d[0]=e.snapTo(b,c);var f=new Wm(b);return d[1]=f.snapTo(d[0],c),d},Wm.computeOverlaySnapTolerance=function(){if(1===arguments.length){var a=arguments[0],b=Wm.computeSizeBasedSnapTolerance(a),c=a.getPrecisionModel();if(c.getType()===mk.FIXED){var d=1/c.getScale()*2/1.415;d>b&&(b=d)}return b}if(2===arguments.length){var e=arguments[0],f=arguments[1];return Math.min(Wm.computeOverlaySnapTolerance(e),Wm.computeOverlaySnapTolerance(f))}},Wm.computeSizeBasedSnapTolerance=function(a){var b=a.getEnvelopeInternal();return Math.min(b.getHeight(),b.getWidth())*Wm.SNAP_PRECISION_FACTOR},Wm.snapToSelf=function(a,b,c){return new Wm(a).snapToSelf(b,c)},Xm.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Wm,Xm);var Ym=function(a){function b(b,c,d){a.call(this),this._snapTolerance=b||null,this._snapPts=c||null,this._isSelfSnap=void 0!==d&&d}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.snapLine=function(a,b){var c=new Vm(a,this._snapTolerance);return c.setAllowSnappingToSourceVertices(this._isSelfSnap),c.snapTo(b)},b.prototype.transformCoordinates=function(a,b){var c=a.toCoordinateArray(),d=this.snapLine(c,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(d)},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b}(Um),Zm=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Zm.prototype.getCommon=function(){return ri.longBitsToDouble(this._commonBits)},Zm.prototype.add=function(a){var b=ri.doubleToLongBits(a);return this._isFirst?(this._commonBits=b,this._commonSignExp=Zm.signExpBits(this._commonBits),this._isFirst=!1,null):Zm.signExpBits(b)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=Zm.numCommonMostSigMantissaBits(this._commonBits,b),void(this._commonBits=Zm.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},Zm.prototype.toString=function(){if(1===arguments.length){var a=arguments[0],b=ri.longBitsToDouble(a),c="0000000000000000000000000000000000000000000000000000000000000000"+ri.toBinaryString(a),d=c.substring(c.length-64);return d.substring(0,1)+"  "+d.substring(1,12)+"(exp) "+d.substring(12)+" [ "+b+" ]"}},Zm.prototype.interfaces_=function(){return[]},Zm.prototype.getClass=function(){return Zm},Zm.getBit=function(a,b){return 0!=(a&1<<b)?1:0},Zm.signExpBits=function(a){return a>>52},Zm.zeroLowerBits=function(a,b){return a&~((1<<b)-1)},Zm.numCommonMostSigMantissaBits=function(a,b){for(var c=0,d=52;d>=0;d--){if(Zm.getBit(a,d)!==Zm.getBit(b,d))return c;c++}return 52};var $m=function(){this._commonCoord=null,this._ccFilter=new an},_m={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};$m.prototype.addCommonBits=function(a){var b=new bn(this._commonCoord);a.apply(b),a.geometryChanged()},$m.prototype.removeCommonBits=function(a){if(0===this._commonCoord.x&&0===this._commonCoord.y)return a;var b=new wi(this._commonCoord);b.x=-b.x,b.y=-b.y;var c=new bn(b);return a.apply(c),a.geometryChanged(),a},$m.prototype.getCommonCoordinate=function(){return this._commonCoord},$m.prototype.add=function(a){a.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},$m.prototype.interfaces_=function(){return[]},$m.prototype.getClass=function(){return $m},_m.CommonCoordinateFilter.get=function(){return an},_m.Translater.get=function(){return bn},Object.defineProperties($m,_m);var an=function(){this._commonBitsX=new Zm,this._commonBitsY=new Zm};an.prototype.filter=function(a){this._commonBitsX.add(a.x),this._commonBitsY.add(a.y)},an.prototype.getCommonCoordinate=function(){return new wi(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},an.prototype.interfaces_=function(){return[lj]},an.prototype.getClass=function(){return an};var bn=function(){this.trans=null;var a=arguments[0];this.trans=a};bn.prototype.filter=function(a,b){var c=a.getOrdinate(b,0)+this.trans.x,d=a.getOrdinate(b,1)+this.trans.y;a.setOrdinate(b,0,c),a.setOrdinate(b,1,d)},bn.prototype.isDone=function(){return!1},bn.prototype.isGeometryChanged=function(){return!0},bn.prototype.interfaces_=function(){return[Oj]},bn.prototype.getClass=function(){return bn};var cn=function(a,b){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=a,this._geom[1]=b,this.computeSnapTolerance()};cn.prototype.selfSnap=function(a){return new Wm(a).snapTo(a,this._snapTolerance)},cn.prototype.removeCommonBits=function(a){this._cbr=new $m,this._cbr.add(a[0]),this._cbr.add(a[1]);var b=new Array(2).fill(null);return b[0]=this._cbr.removeCommonBits(a[0].copy()),b[1]=this._cbr.removeCommonBits(a[1].copy()),b},cn.prototype.prepareResult=function(a){return this._cbr.addCommonBits(a),a},cn.prototype.getResultGeometry=function(a){var b=this.snap(this._geom),c=zn.overlayOp(b[0],b[1],a);return this.prepareResult(c)},cn.prototype.checkValid=function(a){a.isValid()||Qi.out.println("Snapped geometry is invalid")},cn.prototype.computeSnapTolerance=function(){this._snapTolerance=Wm.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},cn.prototype.snap=function(a){var b=this.removeCommonBits(a);return Wm.snap(b[0],b[1],this._snapTolerance)},cn.prototype.interfaces_=function(){return[]},cn.prototype.getClass=function(){return cn},cn.overlayOp=function(a,b,c){return new cn(a,b).getResultGeometry(c)},cn.union=function(a,b){return cn.overlayOp(a,b,zn.UNION)},cn.intersection=function(a,b){return cn.overlayOp(a,b,zn.INTERSECTION)},cn.symDifference=function(a,b){return cn.overlayOp(a,b,zn.SYMDIFFERENCE)},cn.difference=function(a,b){return cn.overlayOp(a,b,zn.DIFFERENCE)};var dn=function(a,b){this._geom=new Array(2).fill(null),this._geom[0]=a,this._geom[1]=b};dn.prototype.getResultGeometry=function(a){var b=null,c=!1,d=null;try{b=zn.overlayOp(this._geom[0],this._geom[1],a),c=!0}catch(a){if(!(a instanceof Zi))throw a;d=a}if(!c)try{b=cn.overlayOp(this._geom[0],this._geom[1],a)}catch(a){throw a instanceof Zi?d:a}return b},dn.prototype.interfaces_=function(){return[]},dn.prototype.getClass=function(){return dn},dn.overlayOp=function(a,b,c){return new dn(a,b).getResultGeometry(c)},dn.union=function(a,b){return dn.overlayOp(a,b,zn.UNION)},dn.intersection=function(a,b){return dn.overlayOp(a,b,zn.INTERSECTION)},dn.symDifference=function(a,b){return dn.overlayOp(a,b,zn.SYMDIFFERENCE)},dn.difference=function(a,b){return dn.overlayOp(a,b,zn.DIFFERENCE)};var en=function(){this.mce=null,this.chainIndex=null;var a=arguments[0],b=arguments[1];this.mce=a,this.chainIndex=b};en.prototype.computeIntersections=function(a,b){this.mce.computeIntersectsForChain(this.chainIndex,a.mce,a.chainIndex,b)},en.prototype.interfaces_=function(){return[]},en.prototype.getClass=function(){return en};var fn=function Uo(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var a=arguments[0],b=arguments[1];this._eventType=Uo.DELETE,this._xValue=a,this._insertEvent=b}else if(3===arguments.length){var c=arguments[0],d=arguments[1],e=arguments[2];this._eventType=Uo.INSERT,this._label=c,this._xValue=d,this._obj=e}},gn={INSERT:{configurable:!0},DELETE:{configurable:!0}};fn.prototype.isDelete=function(){return this._eventType===fn.DELETE},fn.prototype.setDeleteEventIndex=function(a){this._deleteEventIndex=a},fn.prototype.getObject=function(){return this._obj},fn.prototype.compareTo=function(a){var b=a;return this._xValue<b._xValue?-1:this._xValue>b._xValue?1:this._eventType<b._eventType?-1:this._eventType>b._eventType?1:0},fn.prototype.getInsertEvent=function(){return this._insertEvent},fn.prototype.isInsert=function(){return this._eventType===fn.INSERT},fn.prototype.isSameLabel=function(a){return null!==this._label&&this._label===a._label},fn.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},fn.prototype.interfaces_=function(){return[ti]},fn.prototype.getClass=function(){return fn},gn.INSERT.get=function(){return 1},gn.DELETE.get=function(){return 2},Object.defineProperties(fn,gn);var hn=function(){};hn.prototype.interfaces_=function(){return[]},hn.prototype.getClass=function(){return hn};var jn=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 a=arguments[0],b=arguments[1],c=arguments[2];this._li=a,this._includeProper=b,this._recordIsolated=c};jn.prototype.isTrivialIntersection=function(a,b,c,d){if(a===c&&1===this._li.getIntersectionNum()){if(jn.isAdjacentSegments(b,d))return!0;if(a.isClosed()){var e=a.getNumPoints()-1;if(0===b&&d===e||0===d&&b===e)return!0}}return!1},jn.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},jn.prototype.setIsDoneIfProperInt=function(a){this._isDoneWhenProperInt=a},jn.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},jn.prototype.isBoundaryPointInternal=function(a,b){for(var c=b.iterator();c.hasNext();){var d=c.next().getCoordinate();if(a.isIntersection(d))return!0}return!1},jn.prototype.hasProperIntersection=function(){return this._hasProper},jn.prototype.hasIntersection=function(){return this._hasIntersection},jn.prototype.isDone=function(){return this._isDone},jn.prototype.isBoundaryPoint=function(a,b){return!(null===b||!this.isBoundaryPointInternal(a,b[0])&&!this.isBoundaryPointInternal(a,b[1]))},jn.prototype.setBoundaryNodes=function(a,b){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=a,this._bdyNodes[1]=b},jn.prototype.addIntersections=function(a,b,c,d){if(a===c&&b===d)return null;this.numTests++;var e=a.getCoordinates()[b],f=a.getCoordinates()[b+1],g=c.getCoordinates()[d],h=c.getCoordinates()[d+1];this._li.computeIntersection(e,f,g,h),this._li.hasIntersection()&&(this._recordIsolated&&(a.setIsolated(!1),c.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(a,b,c,d)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(a.addIntersections(this._li,b,0),c.addIntersections(this._li,d,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))))},jn.prototype.interfaces_=function(){return[]},jn.prototype.getClass=function(){return jn},jn.isAdjacentSegments=function(a,b){return 1===Math.abs(a-b)};var kn=function(a){function b(){a.call(this),this.events=new wj,this.nOverlaps=null}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.prepareEvents=function(){$k.sort(this.events);for(var a=0;a<this.events.size();a++){var b=this.events.get(a);b.isDelete()&&b.getInsertEvent().setDeleteEventIndex(a)}},b.prototype.computeIntersections=function(){if(1===arguments.length){var a=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var b=0;b<this.events.size();b++){var c=this.events.get(b);if(c.isInsert()&&this.processOverlaps(b,c.getDeleteEventIndex(),c,a),a.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof jn&&Ci(arguments[0],vj)&&Ci(arguments[1],vj)){var d=arguments[0],e=arguments[1],f=arguments[2];this.addEdges(d,d),this.addEdges(e,e),this.computeIntersections(f)}else if("boolean"==typeof arguments[2]&&Ci(arguments[0],vj)&&arguments[1]instanceof jn){var g=arguments[0],h=arguments[1];arguments[2]?this.addEdges(g,null):this.addEdges(g),this.computeIntersections(h)}},b.prototype.addEdge=function(a,b){for(var c=a.getMonotoneChainEdge(),d=c.getStartIndexes(),e=0;e<d.length-1;e++){var f=new en(c,e),g=new fn(b,c.getMinX(e),f);this.events.add(g),this.events.add(new fn(c.getMaxX(e),g))}},b.prototype.processOverlaps=function(a,b,c,d){for(var e=c.getObject(),f=a;b>f;f++){var g=this.events.get(f);if(g.isInsert()){var h=g.getObject();c.isSameLabel(g)||(e.computeIntersections(h,d),this.nOverlaps++)}}},b.prototype.addEdges=function(){if(1===arguments.length)for(var a=arguments[0].iterator();a.hasNext();){var b=a.next();this.addEdge(b,b)}else if(2===arguments.length)for(var c=arguments[0],d=arguments[1],e=c.iterator();e.hasNext();){var f=e.next();this.addEdge(f,d)}},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b}(hn),ln=function(){this._min=ri.POSITIVE_INFINITY,this._max=ri.NEGATIVE_INFINITY},mn={NodeComparator:{configurable:!0}};ln.prototype.getMin=function(){return this._min},ln.prototype.intersects=function(a,b){return!(this._min>b||this._max<a)},ln.prototype.getMax=function(){return this._max},ln.prototype.toString=function(){return Yi.toLineString(new wi(this._min,0),new wi(this._max,0))},ln.prototype.interfaces_=function(){return[]},ln.prototype.getClass=function(){return ln},mn.NodeComparator.get=function(){return nn},Object.defineProperties(ln,mn);var nn=function(){};nn.prototype.compare=function(a,b){var c=a,d=b,e=(c._min+c._max)/2,f=(d._min+d._max)/2;return f>e?-1:e>f?1:0},nn.prototype.interfaces_=function(){return[vi]},nn.prototype.getClass=function(){return nn};var on=function(a){function b(){a.call(this),this._item=null;var b=arguments[0],c=arguments[1],d=arguments[2];this._min=b,this._max=c,this._item=d}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.query=function(a,b,c){return this.intersects(a,b)?void c.visitItem(this._item):null},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b}(ln),pn=function(a){function b(){a.call(this),this._node1=null,this._node2=null;var b=arguments[0],c=arguments[1];this._node1=b,this._node2=c,this.buildExtent(this._node1,this._node2)}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.buildExtent=function(a,b){this._min=Math.min(a._min,b._min),this._max=Math.max(a._max,b._max)},b.prototype.query=function(a,b,c){return this.intersects(a,b)?(null!==this._node1&&this._node1.query(a,b,c),void(null!==this._node2&&this._node2.query(a,b,c))):null},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b}(ln),qn=function(){this._leaves=new wj,this._root=null,this._level=0};qn.prototype.buildTree=function(){$k.sort(this._leaves,new ln.NodeComparator);for(var a=this._leaves,b=null,c=new wj;;){if(this.buildLevel(a,c),1===c.size())return c.get(0);b=a,a=c,c=b}},qn.prototype.insert=function(a,b,c){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new on(a,b,c))},qn.prototype.query=function(a,b,c){this.init(),this._root.query(a,b,c)},qn.prototype.buildRoot=function(){return null!==this._root?null:void(this._root=this.buildTree())},qn.prototype.printNode=function(a){Qi.out.println(Yi.toLineString(new wi(a._min,this._level),new wi(a._max,this._level)))},qn.prototype.init=function(){return null!==this._root?null:void this.buildRoot()},qn.prototype.buildLevel=function(a,b){this._level++,b.clear();for(var c=0;c<a.size();c+=2){var d=a.get(c);if(null===(c+1<a.size()?a.get(c):null))b.add(d);else{var e=new pn(a.get(c),a.get(c+1));b.add(e)}}},qn.prototype.interfaces_=function(){return[]},qn.prototype.getClass=function(){return qn};var rn=function(){this._items=new wj};rn.prototype.visitItem=function(a){this._items.add(a)},rn.prototype.getItems=function(){return this._items},rn.prototype.interfaces_=function(){return[Wk]},rn.prototype.getClass=function(){return rn};var sn=function(){this._index=null;var a=arguments[0];if(!Ci(a,Zj))throw new qi("Argument must be Polygonal");this._index=new vn(a)},tn={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};sn.prototype.locate=function(a){var b=new ej(a),c=new un(b);return this._index.query(a.y,a.y,c),b.getLocation()},sn.prototype.interfaces_=function(){return[Ml]},sn.prototype.getClass=function(){return sn},tn.SegmentVisitor.get=function(){return un},tn.IntervalIndexedGeometry.get=function(){return vn},Object.defineProperties(sn,tn);var un=function(){this._counter=null;var a=arguments[0];this._counter=a};un.prototype.visitItem=function(a){var b=a;this._counter.countSegment(b.getCoordinate(0),b.getCoordinate(1))},un.prototype.interfaces_=function(){return[Wk]},un.prototype.getClass=function(){return un};var vn=function(){this._index=new qn;var a=arguments[0];this.init(a)};vn.prototype.init=function(a){for(var b=wm.getLines(a).iterator();b.hasNext();){var c=b.next().getCoordinates();this.addLine(c)}},vn.prototype.addLine=function(a){for(var b=1;b<a.length;b++){var c=new nl(a[b-1],a[b]),d=Math.min(c.p0.y,c.p1.y),e=Math.max(c.p0.y,c.p1.y);this._index.insert(d,e,c)}},vn.prototype.query=function(){if(2===arguments.length){var a=arguments[0],b=arguments[1],c=new rn;return this._index.query(a,b,c),c.getItems()}if(3===arguments.length){var d=arguments[0],e=arguments[1],f=arguments[2];this._index.query(d,e,f)}},vn.prototype.interfaces_=function(){return[]},vn.prototype.getClass=function(){return vn};var wn=function(a){function b(){if(a.call(this),this._parentGeom=null,this._lineEdgeMap=new lk,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new xm,2===arguments.length){var b=arguments[0],c=arguments[1],d=mj.OGC_SFS_BOUNDARY_RULE;this._argIndex=b,this._parentGeom=c,this._boundaryNodeRule=d,null!==c&&this.add(c)}else if(3===arguments.length){var e=arguments[0],f=arguments[1],g=arguments[2];this._argIndex=e,this._parentGeom=f,this._boundaryNodeRule=g,null!==f&&this.add(f)}}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.insertBoundaryPoint=function(a,c){var d=this._nodes.addNode(c).getLabel(),e=1;Ai.NONE,d.getLocation(a,yk.ON)===Ai.BOUNDARY&&e++;var f=b.determineBoundary(this._boundaryNodeRule,e);d.setLocation(a,f)},b.prototype.computeSelfNodes=function(){if(2===arguments.length){var a=arguments[0],b=arguments[1];return this.computeSelfNodes(a,b,!1)}if(3===arguments.length){var c=arguments[0],d=arguments[1],e=arguments[2],f=new jn(c,!0,!1);f.setIsDoneIfProperInt(e);var g=this.createEdgeSetIntersector(),h=this._parentGeom instanceof ak||this._parentGeom instanceof $j||this._parentGeom instanceof bk,i=d||!h;return g.computeIntersections(this._edges,f,i),this.addSelfIntersectionNodes(this._argIndex),f}},b.prototype.computeSplitEdges=function(a){for(var b=this._edges.iterator();b.hasNext();)b.next().eiList.addSplitEdges(a)},b.prototype.computeEdgeIntersections=function(a,b,c){var d=new jn(b,c,!0);return d.setBoundaryNodes(this.getBoundaryNodes(),a.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,a._edges,d),d},b.prototype.getGeometry=function(){return this._parentGeom},b.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},b.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},b.prototype.addPoint=function(){if(arguments[0]instanceof Yj){var a=arguments[0].getCoordinate();this.insertPoint(this._argIndex,a,Ai.INTERIOR)}else if(arguments[0]instanceof wi){var b=arguments[0];this.insertPoint(this._argIndex,b,Ai.INTERIOR)}},b.prototype.addPolygon=function(a){this.addPolygonRing(a.getExteriorRing(),Ai.EXTERIOR,Ai.INTERIOR);for(var b=0;b<a.getNumInteriorRing();b++){var c=a.getInteriorRingN(b);this.addPolygonRing(c,Ai.INTERIOR,Ai.EXTERIOR)}},b.prototype.addEdge=function(a){this.insertEdge(a);var b=a.getCoordinates();this.insertPoint(this._argIndex,b[0],Ai.BOUNDARY),this.insertPoint(this._argIndex,b[b.length-1],Ai.BOUNDARY)},b.prototype.addLineString=function(a){var b=zj.removeRepeatedPoints(a.getCoordinates());if(b.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=b[0],null;var c=new am(b,new Fk(this._argIndex,Ai.INTERIOR));this._lineEdgeMap.put(a,c),this.insertEdge(c),_i.isTrue(b.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,b[0]),this.insertBoundaryPoint(this._argIndex,b[b.length-1])},b.prototype.getInvalidPoint=function(){return this._invalidPoint},b.prototype.getBoundaryPoints=function(){for(var a=this.getBoundaryNodes(),b=new Array(a.size()).fill(null),c=0,d=a.iterator();d.hasNext();){var e=d.next();b[c++]=e.getCoordinate().copy()}return b},b.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},b.prototype.addSelfIntersectionNode=function(a,b,c){return this.isBoundaryNode(a,b)?null:void(c===Ai.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(a,b):this.insertPoint(a,b,c))},b.prototype.addPolygonRing=function(a,b,c){if(a.isEmpty())return null;var d=zj.removeRepeatedPoints(a.getCoordinates());if(d.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=d[0],null;var e=b,f=c;fj.isCCW(d)&&(e=c,f=b);var g=new am(d,new Fk(this._argIndex,Ai.BOUNDARY,e,f));this._lineEdgeMap.put(a,g),this.insertEdge(g),this.insertPoint(this._argIndex,d[0],Ai.BOUNDARY)},b.prototype.insertPoint=function(a,b,c){var d=this._nodes.addNode(b),e=d.getLabel();null===e?d._label=new Fk(a,c):e.setLocation(a,c)},b.prototype.createEdgeSetIntersector=function(){return new kn},b.prototype.addSelfIntersectionNodes=function(a){for(var b=this._edges.iterator();b.hasNext();)for(var c=b.next(),d=c.getLabel().getLocation(a),e=c.eiList.iterator();e.hasNext();){var f=e.next();this.addSelfIntersectionNode(a,f.coord,d)}},b.prototype.add=function(){if(1!==arguments.length)return a.prototype.add.apply(this,arguments);var b=arguments[0];if(b.isEmpty())return null;if(b instanceof bk&&(this._useBoundaryDeterminationRule=!1),b instanceof $j)this.addPolygon(b);else if(b instanceof Wj)this.addLineString(b);else if(b instanceof Yj)this.addPoint(b);else if(b instanceof _j)this.addCollection(b);else if(b instanceof Qj)this.addCollection(b);else if(b instanceof bk)this.addCollection(b);else{if(!(b instanceof Pj))throw new Error(b.getClass().getName());this.addCollection(b)}},b.prototype.addCollection=function(a){for(var b=0;b<a.getNumGeometries();b++){var c=a.getGeometryN(b);this.add(c)}},b.prototype.locate=function(a){return Ci(this._parentGeom,Zj)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new sn(this._parentGeom)),this._areaPtLocator.locate(a)):this._ptLocator.locate(a,this._parentGeom)},b.prototype.findEdge=function(){if(1===arguments.length){var b=arguments[0];return this._lineEdgeMap.get(b)}return a.prototype.findEdge.apply(this,arguments)},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b.determineBoundary=function(a,b){return a.isInBoundary(b)?Ai.BOUNDARY:Ai.INTERIOR},b}(Rk),xn=function(){if(this._li=new cj,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){var a=arguments[0];this.setComputationPrecision(a.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new wn(0,a)}else if(2===arguments.length){
var b=arguments[0],c=arguments[1],d=mj.OGC_SFS_BOUNDARY_RULE;b.getPrecisionModel().compareTo(c.getPrecisionModel())>=0?this.setComputationPrecision(b.getPrecisionModel()):this.setComputationPrecision(c.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new wn(0,b,d),this._arg[1]=new wn(1,c,d)}else if(3===arguments.length){var e=arguments[0],f=arguments[1],g=arguments[2];e.getPrecisionModel().compareTo(f.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(f.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new wn(0,e,g),this._arg[1]=new wn(1,f,g)}};xn.prototype.getArgGeometry=function(a){return this._arg[a].getGeometry()},xn.prototype.setComputationPrecision=function(a){this._resultPrecisionModel=a,this._li.setPrecisionModel(this._resultPrecisionModel)},xn.prototype.interfaces_=function(){return[]},xn.prototype.getClass=function(){return xn};var yn=function(){};yn.prototype.interfaces_=function(){return[]},yn.prototype.getClass=function(){return yn},yn.map=function(){if(arguments[0]instanceof ij&&Ci(arguments[1],yn.MapOp)){for(var a=arguments[0],b=arguments[1],c=new wj,d=0;d<a.getNumGeometries();d++){var e=b.map(a.getGeometryN(d));null!==e&&c.add(e)}return a.getFactory().buildGeometry(c)}if(Ci(arguments[0],sj)&&Ci(arguments[1],yn.MapOp)){for(var f=arguments[0],g=arguments[1],h=new wj,i=f.iterator();i.hasNext();){var j=i.next(),k=g.map(j);null!==k&&h.add(k)}return h}},yn.MapOp=function(){};var zn=function(a){function b(){var b=arguments[0],c=arguments[1];a.call(this,b,c),this._ptLocator=new xm,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Tl,this._resultPolyList=new wj,this._resultLineList=new wj,this._resultPointList=new wj,this._graph=new Rk(new Rl),this._geomFact=b.getFactory()}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.insertUniqueEdge=function(a){var b=this._edgeList.findEqualEdge(a);if(null!==b){var c=b.getLabel(),d=a.getLabel();b.isPointwiseEqual(a)||(d=new Fk(a.getLabel())).flip();var e=b.getDepth();e.isNull()&&e.add(c),e.add(d),c.merge(d)}else this._edgeList.add(a)},b.prototype.getGraph=function(){return this._graph},b.prototype.cancelDuplicateResultEdges=function(){for(var a=this._graph.getEdgeEnds().iterator();a.hasNext();){var b=a.next(),c=b.getSym();b.isInResult()&&c.isInResult()&&(b.setInResult(!1),c.setInResult(!1))}},b.prototype.isCoveredByLA=function(a){return!!this.isCovered(a,this._resultLineList)||!!this.isCovered(a,this._resultPolyList)},b.prototype.computeGeometry=function(a,c,d,e){var f=new wj;return f.addAll(a),f.addAll(c),f.addAll(d),f.isEmpty()?b.createEmptyResult(e,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(f)},b.prototype.mergeSymLabels=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();)a.next().getEdges().mergeSymLabels()},b.prototype.isCovered=function(a,b){for(var c=b.iterator();c.hasNext();){var d=c.next();if(this._ptLocator.locate(a,d)!==Ai.EXTERIOR)return!0}return!1},b.prototype.replaceCollapsedEdges=function(){for(var a=new wj,b=this._edgeList.iterator();b.hasNext();){var c=b.next();c.isCollapsed()&&(b.remove(),a.add(c.getCollapsedEdge()))}this._edgeList.addAll(a)},b.prototype.updateNodeLabelling=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();){var b=a.next(),c=b.getEdges().getLabel();b.getLabel().merge(c)}},b.prototype.getResultGeometry=function(a){return this.computeOverlay(a),this._resultGeom},b.prototype.insertUniqueEdges=function(a){for(var b=a.iterator();b.hasNext();){var c=b.next();this.insertUniqueEdge(c)}},b.prototype.computeOverlay=function(a){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 b=new wj;this._arg[0].computeSplitEdges(b),this._arg[1].computeSplitEdges(b),this.insertUniqueEdges(b),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),Qm.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(a),this.cancelDuplicateResultEdges();var c=new Sk(this._geomFact);c.add(this._graph),this._resultPolyList=c.getPolygons();var d=new Sm(this,this._geomFact,this._ptLocator);this._resultLineList=d.build(a);var e=new Tm(this,this._geomFact,this._ptLocator);this._resultPointList=e.build(a),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,a)},b.prototype.labelIncompleteNode=function(a,b){var c=this._ptLocator.locate(a.getCoordinate(),this._arg[b].getGeometry());a.getLabel().setLocation(b,c)},b.prototype.copyPoints=function(a){for(var b=this._arg[a].getNodeIterator();b.hasNext();){var c=b.next();this._graph.addNode(c.getCoordinate()).setLabel(a,c.getLabel().getLocation(a))}},b.prototype.findResultAreaEdges=function(a){for(var c=this._graph.getEdgeEnds().iterator();c.hasNext();){var d=c.next(),e=d.getLabel();e.isArea()&&!d.isInteriorAreaEdge()&&b.isResultOfOp(e.getLocation(0,yk.RIGHT),e.getLocation(1,yk.RIGHT),a)&&d.setInResult(!0)}},b.prototype.computeLabelsFromDepths=function(){for(var a=this._edgeList.iterator();a.hasNext();){var b=a.next(),c=b.getLabel(),d=b.getDepth();if(!d.isNull()){d.normalize();for(var e=0;2>e;e++)c.isNull(e)||!c.isArea()||d.isNull(e)||(0===d.getDelta(e)?c.toLine(e):(_i.isTrue(!d.isNull(e,yk.LEFT),"depth of LEFT side has not been initialized"),c.setLocation(e,yk.LEFT,d.getLocation(e,yk.LEFT)),_i.isTrue(!d.isNull(e,yk.RIGHT),"depth of RIGHT side has not been initialized"),c.setLocation(e,yk.RIGHT,d.getLocation(e,yk.RIGHT))))}}},b.prototype.computeLabelling=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();)a.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},b.prototype.labelIncompleteNodes=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();){var b=a.next(),c=b.getLabel();b.isIsolated()&&(c.isNull(0)?this.labelIncompleteNode(b,0):this.labelIncompleteNode(b,1)),b.getEdges().updateLabelling(c)}},b.prototype.isCoveredByA=function(a){return!!this.isCovered(a,this._resultPolyList)},b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b}(xn);zn.overlayOp=function(a,b,c){return new zn(a,b).getResultGeometry(c)},zn.intersection=function(a,b){if(a.isEmpty()||b.isEmpty())return zn.createEmptyResult(zn.INTERSECTION,a,b,a.getFactory());if(a.isGeometryCollection()){var c=b;return Rm.map(a,{interfaces_:function(){return[yn.MapOp]},map:function(a){return a.intersection(c)}})}return a.checkNotGeometryCollection(a),a.checkNotGeometryCollection(b),dn.overlayOp(a,b,zn.INTERSECTION)},zn.symDifference=function(a,b){if(a.isEmpty()||b.isEmpty()){if(a.isEmpty()&&b.isEmpty())return zn.createEmptyResult(zn.SYMDIFFERENCE,a,b,a.getFactory());if(a.isEmpty())return b.copy();if(b.isEmpty())return a.copy()}return a.checkNotGeometryCollection(a),a.checkNotGeometryCollection(b),dn.overlayOp(a,b,zn.SYMDIFFERENCE)},zn.resultDimension=function(a,b,c){var d=b.getDimension(),e=c.getDimension(),f=-1;switch(a){case zn.INTERSECTION:f=Math.min(d,e);break;case zn.UNION:f=Math.max(d,e);break;case zn.DIFFERENCE:f=d;break;case zn.SYMDIFFERENCE:f=Math.max(d,e)}return f},zn.createEmptyResult=function(a,b,c,d){var e=null;switch(zn.resultDimension(a,b,c)){case-1:e=d.createGeometryCollection(new Array(0).fill(null));break;case 0:e=d.createPoint();break;case 1:e=d.createLineString();break;case 2:e=d.createPolygon()}return e},zn.difference=function(a,b){return a.isEmpty()?zn.createEmptyResult(zn.DIFFERENCE,a,b,a.getFactory()):b.isEmpty()?a.copy():(a.checkNotGeometryCollection(a),a.checkNotGeometryCollection(b),dn.overlayOp(a,b,zn.DIFFERENCE))},zn.isResultOfOp=function(){if(2===arguments.length){var a=arguments[0],b=arguments[1],c=a.getLocation(0),d=a.getLocation(1);return zn.isResultOfOp(c,d,b)}if(3===arguments.length){var e=arguments[0],f=arguments[1],g=arguments[2];switch(e===Ai.BOUNDARY&&(e=Ai.INTERIOR),f===Ai.BOUNDARY&&(f=Ai.INTERIOR),g){case zn.INTERSECTION:return e===Ai.INTERIOR&&f===Ai.INTERIOR;case zn.UNION:return e===Ai.INTERIOR||f===Ai.INTERIOR;case zn.DIFFERENCE:return e===Ai.INTERIOR&&f!==Ai.INTERIOR;case zn.SYMDIFFERENCE:return e===Ai.INTERIOR&&f!==Ai.INTERIOR||e!==Ai.INTERIOR&&f===Ai.INTERIOR}return!1}},zn.INTERSECTION=1,zn.UNION=2,zn.DIFFERENCE=3,zn.SYMDIFFERENCE=4;var An=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new xm,this._seg=new nl;var a=arguments[0],b=arguments[1];this._g=a,this._boundaryDistanceTolerance=b,this._linework=this.extractLinework(a)};An.prototype.isWithinToleranceOfBoundary=function(a){for(var b=0;b<this._linework.getNumGeometries();b++)for(var c=this._linework.getGeometryN(b).getCoordinateSequence(),d=0;d<c.size()-1;d++)if(c.getCoordinate(d,this._seg.p0),c.getCoordinate(d+1,this._seg.p1),this._seg.distance(a)<=this._boundaryDistanceTolerance)return!0;return!1},An.prototype.getLocation=function(a){return this.isWithinToleranceOfBoundary(a)?Ai.BOUNDARY:this._ptLocator.locate(a,this._g)},An.prototype.extractLinework=function(a){var b=new Bn;a.apply(b);var c=b.getLinework(),d=qk.toLineStringArray(c);return a.getFactory().createMultiLineString(d)},An.prototype.interfaces_=function(){return[]},An.prototype.getClass=function(){return An};var Bn=function(){this._linework=null,this._linework=new wj};Bn.prototype.getLinework=function(){return this._linework},Bn.prototype.filter=function(a){if(a instanceof $j){var b=a;this._linework.add(b.getExteriorRing());for(var c=0;c<b.getNumInteriorRing();c++)this._linework.add(b.getInteriorRingN(c))}},Bn.prototype.interfaces_=function(){return[Nj]},Bn.prototype.getClass=function(){return Bn};var Cn=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var a=arguments[0];this._g=a};Cn.prototype.extractPoints=function(a,b,c){for(var d=a.getCoordinates(),e=0;e<d.length-1;e++)this.computeOffsetPoints(d[e],d[e+1],b,c)},Cn.prototype.setSidesToGenerate=function(a,b){this._doLeft=a,this._doRight=b},Cn.prototype.getPoints=function(a){for(var b=new wj,c=wm.getLines(this._g).iterator();c.hasNext();){var d=c.next();this.extractPoints(d,a,b)}return b},Cn.prototype.computeOffsetPoints=function(a,b,c,d){var e=b.x-a.x,f=b.y-a.y,g=Math.sqrt(e*e+f*f),h=c*e/g,i=c*f/g,j=(b.x+a.x)/2,k=(b.y+a.y)/2;if(this._doLeft){var l=new wi(j-i,k+h);d.add(l)}if(this._doRight){var m=new wi(j+i,k-h);d.add(m)}},Cn.prototype.interfaces_=function(){return[]},Cn.prototype.getClass=function(){return Cn};var Dn=function Vo(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=Vo.TOLERANCE,this._testCoords=new wj;var a=arguments[0],b=arguments[1],c=arguments[2];this._boundaryDistanceTolerance=Vo.computeBoundaryDistanceTolerance(a,b),this._geom=[a,b,c],this._locFinder=[new An(this._geom[0],this._boundaryDistanceTolerance),new An(this._geom[1],this._boundaryDistanceTolerance),new An(this._geom[2],this._boundaryDistanceTolerance)]},En={TOLERANCE:{configurable:!0}};Dn.prototype.reportResult=function(a,b,c){Qi.out.println("Overlay result invalid - A:"+Ai.toLocationSymbol(b[0])+" B:"+Ai.toLocationSymbol(b[1])+" expected:"+(c?"i":"e")+" actual:"+Ai.toLocationSymbol(b[2]))},Dn.prototype.isValid=function(a){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var b=this.checkValid(a);return b},Dn.prototype.checkValid=function(){if(1===arguments.length){for(var a=arguments[0],b=0;b<this._testCoords.size();b++){var c=this._testCoords.get(b);if(!this.checkValid(a,c))return this._invalidLocation=c,!1}return!0}if(2===arguments.length){var d=arguments[0],e=arguments[1];return this._location[0]=this._locFinder[0].getLocation(e),this._location[1]=this._locFinder[1].getLocation(e),this._location[2]=this._locFinder[2].getLocation(e),!!Dn.hasLocation(this._location,Ai.BOUNDARY)||this.isValidResult(d,this._location)}},Dn.prototype.addTestPts=function(a){var b=new Cn(a);this._testCoords.addAll(b.getPoints(5*this._boundaryDistanceTolerance))},Dn.prototype.isValidResult=function(a,b){var c=zn.isResultOfOp(b[0],b[1],a),d=!(c^b[2]===Ai.INTERIOR);return d||this.reportResult(a,b,c),d},Dn.prototype.getInvalidLocation=function(){return this._invalidLocation},Dn.prototype.interfaces_=function(){return[]},Dn.prototype.getClass=function(){return Dn},Dn.hasLocation=function(a,b){for(var c=0;3>c;c++)if(a[c]===b)return!0;return!1},Dn.computeBoundaryDistanceTolerance=function(a,b){return Math.min(Wm.computeSizeBasedSnapTolerance(a),Wm.computeSizeBasedSnapTolerance(b))},Dn.isValid=function(a,b,c,d){return new Dn(a,b,d).isValid(c)},En.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(Dn,En);var Fn=function Wo(a){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=Wo.extractFactory(a),this._inputGeoms=a};Fn.prototype.extractElements=function(a,b){if(null===a)return null;for(var c=0;c<a.getNumGeometries();c++){var d=a.getGeometryN(c);this._skipEmpty&&d.isEmpty()||b.add(d)}},Fn.prototype.combine=function(){for(var a=new wj,b=this._inputGeoms.iterator();b.hasNext();){var c=b.next();this.extractElements(c,a)}return 0===a.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(a)},Fn.prototype.interfaces_=function(){return[]},Fn.prototype.getClass=function(){return Fn},Fn.combine=function(){if(1===arguments.length){var a=arguments[0];return new Fn(a).combine()}if(2===arguments.length){var b=arguments[0],c=arguments[1];return new Fn(Fn.createList(b,c)).combine()}if(3===arguments.length){var d=arguments[0],e=arguments[1],f=arguments[2];return new Fn(Fn.createList(d,e,f)).combine()}},Fn.extractFactory=function(a){return a.isEmpty()?null:a.iterator().next().getFactory()},Fn.createList=function(){if(2===arguments.length){var a=arguments[0],b=arguments[1],c=new wj;return c.add(a),c.add(b),c}if(3===arguments.length){var d=arguments[0],e=arguments[1],f=arguments[2],g=new wj;return g.add(d),g.add(e),g.add(f),g}};var Gn=function(){this._inputPolys=null,this._geomFactory=null;var a=arguments[0];this._inputPolys=a,null===this._inputPolys&&(this._inputPolys=new wj)},Hn={STRTREE_NODE_CAPACITY:{configurable:!0}};Gn.prototype.reduceToGeometries=function(a){for(var b=new wj,c=a.iterator();c.hasNext();){var d=c.next(),e=null;Ci(d,vj)?e=this.unionTree(d):d instanceof ij&&(e=d),b.add(e)}return b},Gn.prototype.extractByEnvelope=function(a,b,c){for(var d=new wj,e=0;e<b.getNumGeometries();e++){var f=b.getGeometryN(e);f.getEnvelopeInternal().intersects(a)?d.add(f):c.add(f)}return this._geomFactory.buildGeometry(d)},Gn.prototype.unionOptimized=function(a,b){var c=a.getEnvelopeInternal(),d=b.getEnvelopeInternal();if(!c.intersects(d))return Fn.combine(a,b);if(a.getNumGeometries()<=1&&b.getNumGeometries()<=1)return this.unionActual(a,b);var e=c.intersection(d);return this.unionUsingEnvelopeIntersection(a,b,e)},Gn.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 a=new el(Gn.STRTREE_NODE_CAPACITY),b=this._inputPolys.iterator();b.hasNext();){var c=b.next();a.insert(c.getEnvelopeInternal(),c)}this._inputPolys=null;var d=a.itemsTree();return this.unionTree(d)},Gn.prototype.binaryUnion=function(){if(1===arguments.length){var a=arguments[0];return this.binaryUnion(a,0,a.size())}if(3===arguments.length){var b=arguments[0],c=arguments[1],d=arguments[2];if(1>=d-c){var e=Gn.getGeometry(b,c);return this.unionSafe(e,null)}if(d-c==2)return this.unionSafe(Gn.getGeometry(b,c),Gn.getGeometry(b,c+1));var f=Math.trunc((d+c)/2),g=this.binaryUnion(b,c,f),h=this.binaryUnion(b,f,d);return this.unionSafe(g,h)}},Gn.prototype.repeatedUnion=function(a){for(var b=null,c=a.iterator();c.hasNext();){var d=c.next();b=null===b?d.copy():b.union(d)}return b},Gn.prototype.unionSafe=function(a,b){return null===a&&null===b?null:null===a?b.copy():null===b?a.copy():this.unionOptimized(a,b)},Gn.prototype.unionActual=function(a,b){return Gn.restrictToPolygons(a.union(b))},Gn.prototype.unionTree=function(a){var b=this.reduceToGeometries(a);return this.binaryUnion(b)},Gn.prototype.unionUsingEnvelopeIntersection=function(a,b,c){var d=new wj,e=this.extractByEnvelope(c,a,d),f=this.extractByEnvelope(c,b,d),g=this.unionActual(e,f);return d.add(g),Fn.combine(d)},Gn.prototype.bufferUnion=function(){if(1===arguments.length){var a=arguments[0];return a.get(0).getFactory().buildGeometry(a).buffer(0)}if(2===arguments.length){var b=arguments[0],c=arguments[1];return b.getFactory().createGeometryCollection([b,c]).buffer(0)}},Gn.prototype.interfaces_=function(){return[]},Gn.prototype.getClass=function(){return Gn},Gn.restrictToPolygons=function(a){if(Ci(a,Zj))return a;var b=vm.getPolygons(a);return 1===b.size()?b.get(0):a.getFactory().createMultiPolygon(qk.toPolygonArray(b))},Gn.getGeometry=function(a,b){return b>=a.size()?null:a.get(b)},Gn.union=function(a){return new Gn(a).union()},Hn.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Gn,Hn);var In=function(){};In.prototype.interfaces_=function(){return[]},In.prototype.getClass=function(){return In},In.union=function(a,b){if(a.isEmpty()||b.isEmpty()){if(a.isEmpty()&&b.isEmpty())return zn.createEmptyResult(zn.UNION,a,b,a.getFactory());if(a.isEmpty())return b.copy();if(b.isEmpty())return a.copy()}return a.checkNotGeometryCollection(a),a.checkNotGeometryCollection(b),dn.overlayOp(a,b,zn.UNION)};var Jn=function(){return new Se};Se.prototype={constructor:Se,reset:function(){this.s=this.t=0},add:function(a){Te(Kn,a,this.t),Te(this,Kn.s,this.s),this.s?this.t+=Kn.t:this.s=Kn.t},valueOf:function(){return this.s}};var Kn=new Se,Ln=1e-6,Mn=Math.PI,Nn=Mn/2,On=Mn/4,Pn=2*Mn,Qn=180/Mn,Rn=Mn/180,Sn=Math.abs,Tn=Math.atan,Un=Math.atan2,Vn=Math.cos,Wn=Math.exp,Xn=Math.log,Yn=Math.sin,Zn=Math.sqrt,$n=Math.tan,_n={Feature:function(a,b){We(a.geometry,b)},FeatureCollection:function(a,b){for(var c=a.features,d=-1,e=c.length;++d<e;)We(c[d].geometry,b)}},ao={Sphere:function(a,b){b.sphere()},Point:function(a,b){a=a.coordinates,b.point(a[0],a[1],a[2])},MultiPoint:function(a,b){for(var c=a.coordinates,d=-1,e=c.length;++d<e;)a=c[d],b.point(a[0],a[1],a[2])},LineString:function(a,b){Xe(a.coordinates,b,0)},MultiLineString:function(a,b){for(var c=a.coordinates,d=-1,e=c.length;++d<e;)Xe(c[d],b,0)},Polygon:function(a,b){Ye(a.coordinates,b)},MultiPolygon:function(a,b){for(var c=a.coordinates,d=-1,e=c.length;++d<e;)Ye(c[d],b)},GeometryCollection:function(a,b){for(var c=a.geometries,d=-1,e=c.length;++d<e;)We(c[d],b)}},bo=function(a,b){a&&_n.hasOwnProperty(a.type)?_n[a.type](a,b):We(a,b)},co=(Jn(),Jn(),Jn(),function(a,b){function c(c,d){return c=a(c,d),b(c[0],c[1])}return a.invert&&b.invert&&(c.invert=function(c,d){return(c=b.invert(c,d))&&a.invert(c[0],c[1])}),c});ef.invert=ef;var eo=function(a){function b(b){return b=a(b[0]*Rn,b[1]*Rn),b[0]*=Qn,b[1]*=Qn,b}return a=ff(a[0]*Rn,a[1]*Rn,a.length>2?a[2]*Rn:0),b.invert=function(b){return b=a.invert(b[0]*Rn,b[1]*Rn),b[0]*=Qn,b[1]*=Qn,b},b},fo=function(){var a,b=[];return{point:function(b,c){a.push([b,c])},lineStart:function(){b.push(a=[])},lineEnd:Ve,rejoin:function(){b.length>1&&b.push(b.pop().concat(b.shift()))},result:function(){var c=b;return b=[],a=null,c}}},go=function(a,b,c,d,e,f){var g,h=a[0],i=a[1],j=0,k=1,l=b[0]-h,m=b[1]-i;if(g=c-h,l||!(g>0)){if(g/=l,0>l){if(j>g)return;k>g&&(k=g)}else if(l>0){if(g>k)return;g>j&&(j=g)}if(g=e-h,l||!(0>g)){if(g/=l,0>l){if(g>k)return;g>j&&(j=g)}else if(l>0){if(j>g)return;k>g&&(k=g)}if(g=d-i,m||!(g>0)){if(g/=m,0>m){if(j>g)return;k>g&&(k=g)}else if(m>0){if(g>k)return;g>j&&(j=g)}if(g=f-i,m||!(0>g)){if(g/=m,0>m){if(g>k)return;g>j&&(j=g)}else if(m>0){if(j>g)return;k>g&&(k=g)}return j>0&&(a[0]=h+j*l,a[1]=i+j*m),1>k&&(b[0]=h+k*l,b[1]=i+k*m),!0}}}}},ho=function(a,b){return Sn(a[0]-b[0])<Ln&&Sn(a[1]-b[1])<Ln},io=function(a,b,c,d,e){var f,g,h=[],i=[];if(a.forEach(function(a){if(!((b=a.length-1)<=0)){var b,c,d=a[0],g=a[b];if(ho(d,g)){for(e.lineStart(),f=0;b>f;++f)e.point((d=a[f])[0],d[1]);e.lineEnd()}else h.push(c=new lf(d,a,null,!0)),i.push(c.o=new lf(d,null,c,!1)),h.push(c=new lf(g,a,null,!1)),i.push(c.o=new lf(g,null,c,!0))}}),h.length){for(i.sort(b),mf(h),mf(i),f=0,g=i.length;g>f;++f)i[f].e=c=!c;for(var j,k,l=h[0];;){for(var m=l,n=!0;m.v;)if((m=m.n)===l)return;j=m.z,e.lineStart();do{if(m.v=m.o.v=!0,m.e){if(n)for(f=0,g=j.length;g>f;++f)e.point((k=j[f])[0],k[1]);else d(m.x,m.n.x,1,e);m=m.n}else{if(n)for(j=m.p.z,f=j.length-1;f>=0;--f)e.point((k=j[f])[0],k[1]);else d(m.x,m.p.x,-1,e);m=m.p}j=(m=m.o).z,n=!n}while(!m.v);e.lineEnd()}}},jo=function(a,b){return b>a?-1:a>b?1:a>=b?0:NaN},ko=(function(a){1===a.length&&(a=function(a){return function(b,c){return jo(a(b),c)}}(a))}(jo),function(a){for(var b,c,d,e=a.length,f=-1,g=0;++f<e;)g+=a[f].length;for(c=new Array(g);--e>=0;)for(b=(d=a[e]).length;--b>=0;)c[--g]=d[b];return c}),lo=1e9,mo=-lo,no=Jn(),oo=(Jn(),function(a){return a}),po=(Jn(),Jn(),1/0),qo=po,ro=-po,so=ro,to={point:function(a,b){po>a&&(po=a),a>ro&&(ro=a),qo>b&&(qo=b),b>so&&(so=b)},lineStart:Ve,lineEnd:Ve,polygonStart:Ve,polygonEnd:Ve,result:function(){var a=[[po,qo],[ro,so]];return ro=so=-(qo=po=1/0),a}},uo=(Jn(),function(a,b,c,d){return function(e,f){function g(b,c){var d=e(b,c);a(b=d[0],c=d[1])&&f.point(b,c)}function h(a,b){var c=e(a,b);q.point(c[0],c[1])}function i(){v.point=h,q.lineStart()}function j(){v.point=g,q.lineEnd()}function k(a,b){p.push([a,b]);var c=e(a,b);t.point(c[0],c[1])}function l(){t.lineStart(),p=[]}function m(){k(p[0][0],p[0][1]),t.lineEnd();var a,b,c,d,e=t.clean(),g=s.result(),h=g.length;if(p.pop(),n.push(p),p=null,h)if(1&e){if(c=g[0],(b=c.length-1)>0){for(u||(f.polygonStart(),u=!0),f.lineStart(),a=0;b>a;++a)f.point((d=c[a])[0],d[1]);f.lineEnd()}}else h>1&&2&e&&g.push(g.pop().concat(g.shift())),o.push(g.filter(of))}var n,o,p,q=b(f),r=e.invert(d[0],d[1]),s=fo(),t=b(s),u=!1,v={point:g,lineStart:i,lineEnd:j,polygonStart:function(){v.point=k,v.lineStart=l,v.lineEnd=m,o=[],n=[]},polygonEnd:function(){v.point=g,v.lineStart=i,v.lineEnd=j,o=ko(o);var a=function(a,b){var c=b[0],d=b[1],e=[Yn(c),-Vn(c),0],f=0,g=0;no.reset();for(var h=0,i=a.length;i>h;++h)if(k=(j=a[h]).length)for(var j,k,l=j[k-1],m=l[0],n=l[1]/2+On,o=Yn(n),p=Vn(n),q=0;k>q;++q,m=s,o=u,p=v,l=r){var r=j[q],s=r[0],t=r[1]/2+On,u=Yn(t),v=Vn(t),w=s-m,x=w>=0?1:-1,y=x*w,z=y>Mn,A=o*u;if(no.add(Un(A*x*Yn(y),p*v+A*Vn(y))),f+=z?w+x*Pn:w,z^m>=c^s>=c){var B=af($e(l),$e(r));df(B);var C=af(e,B);df(C);var D=(z^w>=0?-1:1)*Ue(C[2]);(d>D||d===D&&(B[0]||B[1]))&&(g+=z^w>=0?1:-1)}}return(-Ln>f||Ln>f&&-Ln>no)^1&g}(n,r);o.length?(u||(f.polygonStart(),u=!0),io(o,pf,a,c,f)):a&&(u||(f.polygonStart(),u=!0),f.lineStart(),c(null,null,1,f),f.lineEnd()),u&&(f.polygonEnd(),u=!1),o=n=null},sphere:function(){f.polygonStart(),f.lineStart(),c(null,null,1,f),f.lineEnd(),f.polygonEnd()}};return v}}),vo=uo(function(){return!0},function(a){var b,c=NaN,d=NaN,e=NaN;return{lineStart:function(){a.lineStart(),b=1},point:function(f,g){var h=f>0?Mn:-Mn,i=Sn(f-c);Sn(i-Mn)<Ln?(a.point(c,d=(d+g)/2>0?Nn:-Nn),a.point(e,d),a.lineEnd(),a.lineStart(),a.point(h,d),a.point(f,d),b=0):e!==h&&i>=Mn&&(Sn(c-e)<Ln&&(c-=e*Ln),Sn(f-h)<Ln&&(f-=h*Ln),d=function(a,b,c,d){var e,f,g=Yn(a-c);return Sn(g)>Ln?Tn((Yn(b)*(f=Vn(d))*Yn(c)-Yn(d)*(e=Vn(b))*Yn(a))/(e*f*g)):(b+d)/2}(c,d,f,g),a.point(e,d),a.lineEnd(),a.lineStart(),a.point(h,d),b=0),a.point(c=f,d=g),e=h},lineEnd:function(){a.lineEnd(),c=d=NaN},clean:function(){return 2-b}}},function(a,b,c,d){var e;if(null==a)e=c*Nn,d.point(-Mn,e),d.point(0,e),d.point(Mn,e),d.point(Mn,0),d.point(Mn,-e),d.point(0,-e),d.point(-Mn,-e),d.point(-Mn,0),d.point(-Mn,e);else if(Sn(a[0]-b[0])>Ln){var f=a[0]<b[0]?Mn:-Mn;e=c*f/2,d.point(-f,e),d.point(0,e),d.point(f,e)}else d.point(b[0],b[1])},[-Mn,-Nn]),wo=function(a,b){function c(a,b){return Vn(a)*Vn(b)>f}function d(a,b,c){var d=[1,0,0],e=af($e(a),$e(b)),g=_e(e,e),h=e[0],i=g-h*h;if(!i)return!c&&a;var j=f*g/i,k=-f*h/i,l=af(d,e),m=cf(d,j);bf(m,cf(e,k));var n=l,o=_e(m,n),p=_e(n,n),q=o*o-p*(_e(m,m)-1);if(!(0>q)){var r=Zn(q),s=cf(n,(-o-r)/p);if(bf(s,m),s=Ze(s),!c)return s;var t,u=a[0],v=b[0],w=a[1],x=b[1];u>v&&(t=u,u=v,v=t);var y=v-u,z=Sn(y-Mn)<Ln;if(!z&&w>x&&(t=w,w=x,x=t),z||Ln>y?z?w+x>0^s[1]<(Sn(s[0]-u)<Ln?w:x):w<=s[1]&&s[1]<=x:y>Mn^(u<=s[0]&&s[0]<=v)){var A=cf(n,(-o+r)/p);return bf(A,m),[s,Ze(A)]}}}function e(b,c){var d=g?a:Mn-a,e=0;return-d>b?e|=1:b>d&&(e|=2),-d>c?e|=4:c>d&&(e|=8),e}var f=Vn(a),g=f>0,h=Sn(f)>Ln;return uo(c,function(a){var b,f,i,j,k;return{lineStart:function(){j=i=!1,k=1},point:function(l,m){var n,o=[l,m],p=c(l,m),q=g?p?0:e(l,m):p?e(l+(0>l?Mn:-Mn),m):0;if(!b&&(j=i=p)&&a.lineStart(),p!==i&&(!(n=d(b,o))||ho(b,n)||ho(o,n))&&(o[0]+=Ln,o[1]+=Ln,p=c(o[0],o[1])),p!==i)k=0,p?(a.lineStart(),n=d(o,b),a.point(n[0],n[1])):(n=d(b,o),a.point(n[0],n[1]),a.lineEnd()),b=n;else if(h&&b&&g^p){var r;q&f||!(r=d(o,b,!0))||(k=0,g?(a.lineStart(),a.point(r[0][0],r[0][1]),a.point(r[1][0],r[1][1]),a.lineEnd()):(a.point(r[1][0],r[1][1]),a.lineEnd(),a.lineStart(),a.point(r[0][0],r[0][1])))}!p||b&&ho(b,o)||a.point(o[0],o[1]),b=o,i=p,f=q},lineEnd:function(){i&&a.lineEnd(),b=null},clean:function(){return k|(j&&i)<<1}}},function(c,d,e,f){!function(a,b,c,d,e,f){if(c){var g=Vn(b),h=Yn(b),i=d*c;null==e?(e=b+d*Pn,f=b-i/2):(e=kf(g,e),f=kf(g,f),(d>0?f>e:e>f)&&(e+=d*Pn));for(var j,k=e;d>0?k>f:f>k;k-=i)j=Ze([g,-h*Vn(k),-h*Yn(k)]),a.point(j[0],j[1])}}(f,a,b,e,c,d)},g?[0,-a]:[-Mn,a-Mn])};rf.prototype={constructor:rf,point:function(a,b){this.stream.point(a,b)},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 xo=16,yo=Vn(30*Rn),zo=function(a,b){return+b?function(a,b){function c(d,e,f,g,h,i,j,k,l,m,n,o,p,q){var r=j-d,s=k-e,t=r*r+s*s;if(t>4*b&&p--){var u=g+m,v=h+n,w=i+o,x=Zn(u*u+v*v+w*w),y=Ue(w/=x),z=Sn(Sn(w)-1)<Ln||Sn(f-l)<Ln?(f+l)/2:Un(v,u),A=a(z,y),B=A[0],C=A[1],D=B-d,E=C-e,F=s*D-r*E;(F*F/t>b||Sn((r*D+s*E)/t-.5)>.3||yo>g*m+h*n+i*o)&&(c(d,e,f,g,h,i,B,C,z,u/=x,v/=x,w,p,q),q.point(B,C),c(B,C,z,u,v,w,j,k,l,m,n,o,p,q))}}return function(b){function d(c,d){c=a(c,d),b.point(c[0],c[1])}function e(){r=NaN,w.point=f,b.lineStart()}function f(d,e){var f=$e([d,e]),g=a(d,e);c(r,s,q,t,u,v,r=g[0],s=g[1],q=d,t=f[0],u=f[1],v=f[2],xo,b),b.point(r,s)}function g(){w.point=d,b.lineEnd()}function h(){e(),w.point=i,w.lineEnd=j}function i(a,b){f(k=a,b),l=r,m=s,n=t,o=u,p=v,w.point=f}function j(){c(r,s,q,t,u,v,l,m,k,n,o,p,xo,b),w.lineEnd=g,g()}var k,l,m,n,o,p,q,r,s,t,u,v,w={point:d,lineStart:e,lineEnd:g,polygonStart:function(){b.polygonStart(),w.lineStart=h},polygonEnd:function(){b.polygonEnd(),w.lineStart=e}};return w}}(a,b):function(a){return qf({point:function(b,c){b=a(b,c),this.stream.point(b[0],b[1])}})}(a)},Ao=qf({point:function(a,b){this.stream.point(a*Rn,b*Rn)}});uf.invert=function(a,b){return[a,2*Tn(Wn(b))-Nn]},vf.invert=function(a,b){return[-b,2*Tn(Wn(a))-Nn]};var Bo=function(){var a=function(a){function b(){var b=Mn*h(),g=f(eo(f.rotate()).invert([0,0]));return j(null==k?[[g[0]-b,g[1]-b],[g[0]+b,g[1]+b]]:a===uf?[[Math.max(g[0]-b,k),c],[Math.min(g[0]+b,d),e]]:[[k,Math.max(g[1]-b,c)],[d,Math.min(g[1]+b,e)]])}var c,d,e,f=tf(a),g=f.center,h=f.scale,i=f.translate,j=f.clipExtent,k=null;return f.scale=function(a){return arguments.length?(h(a),b()):h()},f.translate=function(a){return arguments.length?(i(a),b()):i()},f.center=function(a){return arguments.length?(g(a),b()):g()},f.clipExtent=function(a){return arguments.length?(null==a?k=c=d=e=null:(k=+a[0][0],c=+a[0][1],d=+a[1][0],e=+a[1][1]),b()):null==k?null:[[k,c],[d,e]]},b()}(vf),b=a.center,c=a.rotate;return a.center=function(a){return arguments.length?b([-a[1],a[0]]):(a=b(),[a[1],-a[0]])},a.rotate=function(a){return arguments.length?c([a[0],a[1],a.length>2?a[2]+90:90]):(a=c(),[a[0],a[1],a[2]-90])},c([0,0,90]).scale(159.155)};a.projection=zg,a.random=ni,a.clusters=oi,a.helpers=Nf,a.invariant=Pf,a.meta=Of,a.isolines=function(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var d=c.zProperty||"elevation",e=c.commonProperties||{},f=c.breaksProperties||[];if(W(a,"Point","Input must contain Points"),!b)throw new Error("breaks is required");if(!Array.isArray(b))throw new Error("breaks must be an Array");if(!y(e))throw new Error("commonProperties must be an Object");if(!Array.isArray(f))throw new Error("breaksProperties must be an Array");var g=da(a,{zProperty:d,flip:!0});return j(function(a,b,c){var d=Q(c),e=d[2]-d[0],f=d[3]-d[1],g=d[0],h=d[1],i=b[0].length-1,j=b.length-1,k=e/i,l=f/j,m=function(a){a[0]=a[0]*k+g,a[1]=a[1]*l+h};return a.forEach(function(a){B(a,m)}),a}(function(a,b,c,d,e){for(var f=[],g=1;g<b.length;g++){var h=+b[g],i=Object.assign({},d,e[g]);i[c]=h;var j=k($(a,h),i);f.push(j)}return f}(g,b,d,e,f),g,a))},a.convex=Da,a.pointsWithinPolygon=Ga,a.concave=function(a,c){if(c=c||{},!y(c))throw new Error("options is invalid");if(!a)throw new Error("points is required");var d=c.maxEdge||1/0;if(!x(d))throw new Error("maxEdge is invalid");var e=Ha(function(a){var b=[],c={};return F(a,function(a){if(a.geometry){var d=a.geometry.coordinates.join("-");c.hasOwnProperty(d)||(b.push(a),c[d]=!0)}}),j(b)}(a));if(e.features=e.features.filter(function(a){var b=a.geometry.coordinates[0][0],e=a.geometry.coordinates[0][1],f=a.geometry.coordinates[0][2],g=La(b,e,c),h=La(e,f,c),i=La(b,f,c);return d>=g&&d>=h&&d>=i}),e.features.length<1)return null;var f=_a(e,c);return 1===f.coordinates.length&&(f.coordinates=f.coordinates[0],f.type="Polygon"),b(f)},a.collect=function(a,b,c,d){var e=Tf(6),f=b.features.map(function(a){return{minX:a.geometry.coordinates[0],minY:a.geometry.coordinates[1],maxX:a.geometry.coordinates[0],maxY:a.geometry.coordinates[1],property:a.properties[c]}});return e.load(f),a.features.forEach(function(a){a.properties||(a.properties={});var b=Q(a),c=[];e.search({minX:b[0],minY:b[1],maxX:b[2],maxY:b[3]}).forEach(function(b){Ea([b.minX,b.minY],a)&&c.push(b.property)}),a.properties[d]=c}),a},a.flip=function(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.mutate;if(!a)throw new Error("geojson is required");return!1!==c&&void 0!==c||(a=Ma(a)),B(a,function(a){var b=a[0],c=a[1];a[0]=c,a[1]=b}),a},a.simplify=function(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=void 0!==b.tolerance?b.tolerance:1,d=b.highQuality||!1,e=b.mutate||!1;if(!a)throw new Error("geojson is required");if(c&&0>c)throw new Error("invalid tolerance");return!0!==e&&(a=Ma(a)),I(a,function(a){!function(a,b,c){var d=a.type;if("Point"===d||"MultiPoint"===d)return a;ab(a,!0);var e=a.coordinates;switch(d){case"LineString":a.coordinates=gb(e,b,c);break;case"MultiLineString":a.coordinates=e.map(function(a){return gb(a,b,c)});break;case"Polygon":a.coordinates=hb(e,b,c);break;case"MultiPolygon":a.coordinates=e.map(function(a){return hb(a,b,c)})}}(a,c,d)}),a},a.bezierSpline=ib,a.tag=function(a,b,c,d){return a=Ma(a),b=Ma(b),F(a,function(a){a.properties||(a.properties={}),F(b,function(b){void 0===a.properties[d]&&Ea(a,b)&&(a.properties[d]=b.properties[c])})}),a},a.sample=function(a,b){if(!a)throw new Error("featurecollection is required");if(null===b||void 0===b)throw new Error("num is required");if("number"!=typeof b)throw new Error("num must be a number");return j(function(a,b){for(var c,d,e=a.slice(0),f=a.length,g=f-b;f-->g;)d=Math.floor((f+1)*Math.random()),c=e[d],e[d]=e[f],e[f]=c;return e.slice(g)}(a.features,b))},a.envelope=kb,a.square=lb,a.circle=nb,a.midpoint=function(a,b){return mb(a,La(a,b)/2,ob(a,b))},a.center=pb,a.centerOfMass=rb,a.centroid=qb,a.combine=function(a){function c(a,b,c){c?d[b].coordinates=d[b].coordinates.concat(a.geometry.coordinates):d[b].coordinates.push(a.geometry.coordinates),d[b].properties.push(a.properties);
}var d={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}},e=Object.keys(d).reduce(function(a,b){return a[b.replace("Multi","")]=b,a},{});return F(a,function(a){a.geometry&&(d[a.geometry.type]?c(a,a.geometry.type,!0):e[a.geometry.type]&&c(a,e[a.geometry.type],!1))}),j(Object.keys(d).filter(function(a){return d[a].coordinates.length}).sort().map(function(a){return b({type:a,coordinates:d[a].coordinates},{collectedProperties:d[a].properties})}))},a.distance=La,a.explode=sb,a.bbox=Q,a.tesselate=function(a){if(!a.geometry||"Polygon"!==a.geometry.type&&"MultiPolygon"!==a.geometry.type)throw new Error("input must be a Polygon or MultiPolygon");var b={type:"FeatureCollection",features:[]};return"Polygon"===a.geometry.type?b.features=Jb(a.geometry.coordinates):a.geometry.coordinates.forEach(function(a){b.features=b.features.concat(Jb(a))}),b},a.bboxPolygon=jb,a.booleanPointInPolygon=Ea,a.nearestPoint=Kb,a.nearestPointOnLine=ec,a.nearestPointToLine=function(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var d=c.units,e=c.properties||{};if(!a)throw new Error("points is required");if(!(a=function(a){var b=[];switch(a.geometry?a.geometry.type:a.type){case"GeometryCollection":return I(a,function(a){"Point"===a.type&&b.push({type:"Feature",properties:{},geometry:a})}),{type:"FeatureCollection",features:b};case"FeatureCollection":return a.features=a.features.filter(function(a){return"Point"===a.geometry.type}),a;default:throw new Error("points must be a Point Collection")}}(a)).features.length)throw new Error("points must contain features");if(!b)throw new Error("line is required");if("LineString"!==Z(b))throw new Error("line must be a LineString");var f=1/0,g=null;return F(a,function(a){var c=nc(a,b,{units:d});f>c&&(f=c,g=a)}),g&&(g.properties=Object.assign({dist:f},g.properties,e)),g},a.planepoint=function(a,b){var c=R(a),d=X(b).coordinates[0];if(d.length<4)throw new Error("OuterRing of a Polygon must have 4 or more Positions.");var e=b.properties||{},f=e.a,g=e.b,h=e.c,i=c[0],j=c[1],k=d[0][0],l=d[0][1],m=void 0!==f?f:d[0][2],n=d[1][0],o=d[1][1],p=void 0!==g?g:d[1][2],q=d[2][0],r=d[2][1],s=void 0!==h?h:d[2][2];return(s*(i-k)*(j-o)+m*(i-n)*(j-r)+p*(i-q)*(j-l)-p*(i-k)*(j-r)-s*(i-n)*(j-l)-m*(i-q)*(j-o))/((i-k)*(j-o)+(i-n)*(j-r)+(i-q)*(j-l)-(i-k)*(j-r)-(i-n)*(j-l)-(i-q)*(j-o))},a.tin=Ha,a.bearing=ob,a.destination=mb,a.kinks=function(a){var b,c,e={type:"FeatureCollection",features:[]};if("LineString"===(c="Feature"===a.type?a.geometry:a).type)b=[c.coordinates];else if("MultiLineString"===c.type)b=c.coordinates;else if("MultiPolygon"===c.type)b=[].concat.apply([],c.coordinates);else{if("Polygon"!==c.type)throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");b=c.coordinates}return b.forEach(function(a){b.forEach(function(b){for(var c=0;c<a.length-1;c++)for(var f=c;f<b.length-1;f++){if(a===b){if(1===Math.abs(c-f))continue;if(0===c&&f===a.length-2&&a[c][0]===a[a.length-1][0]&&a[c][1]===a[a.length-1][1])continue}var g=function(a,b,c,d,e,f,g,h){var i,j,k,l,m,n={x:null,y:null,onLine1:!1,onLine2:!1};return 0==(i=(h-f)*(c-a)-(g-e)*(d-b))?null!==n.x&&null!==n.y&&n:(j=b-f,k=a-e,l=(g-e)*j-(h-f)*k,m=(c-a)*j-(d-b)*k,j=l/i,k=m/i,n.x=a+j*(c-a),n.y=b+j*(d-b),j>=0&&1>=j&&(n.onLine1=!0),k>=0&&1>=k&&(n.onLine2=!0),!(!n.onLine1||!n.onLine2)&&[n.x,n.y])}(a[c][0],a[c][1],a[c+1][0],a[c+1][1],b[f][0],b[f][1],b[f+1][0],b[f+1][1]);g&&e.features.push(d([g[0],g[1]]))}})}),e},a.pointOnFeature=pc,a.area=rc,a.along=function(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var e;if("Feature"===a.type)e=a.geometry.coordinates;else{if("LineString"!==a.type)throw new Error("input must be a LineString Feature or Geometry");e=a.coordinates}if(!x(b))throw new Error("distance must be a number");for(var f=0,g=0;g<e.length&&!(b>=f&&g===e.length-1);g++){if(f>=b){var h=b-f;if(h){var i=ob(e[g],e[g-1])-180;return mb(e[g],h,i,c)}return d(e[g])}f+=La(e[g],e[g+1],c)}return d(e[e.length-1])},a.length=wc,a.lineSlice=function(a,b,c){var d=S(c);if("LineString"!==Z(c))throw new Error("line must be a LineString");for(var e,f=ec(c,a),g=ec(c,b),i=[(e=f.properties.index<=g.properties.index?[f,g]:[g,f])[0].geometry.coordinates],j=e[0].properties.index+1;j<e[1].properties.index+1;j++)i.push(d[j]);return i.push(e[1].geometry.coordinates),h(i,c.properties)},a.lineSliceAlong=xc,a.pointGrid=Cc,a.truncate=Dc,a.flatten=function(a){if(!a)throw new Error("geojson is required");var b=[];return K(a,function(a){b.push(a)}),j(b)},a.lineIntersect=cc,a.lineChunk=function(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var d=c.units,e=c.reverse;if(!a)throw new Error("geojson is required");if(0>=b)throw new Error("segmentLength must be greater than 0");var f=[];return K(a,function(a){e&&(a.geometry.coordinates=a.geometry.coordinates.reverse()),function(a,b,c,d){var e=wc(a,{units:c});if(b>=e)return d(a);var f=e/b;Number.isInteger(f)||(f=Math.floor(f)+1);for(var g=0;f>g;g++){var h=xc(a,b*g,b*(g+1),{units:c});d(h,g)}}(a,b,d,function(a){f.push(a)})}),j(f)},a.unkinkPolygon=function(a){var b=[];return K(a,function(a){"Polygon"===a.geometry.type&&F(Cg(a),function(c){b.push(f(c.geometry.coordinates,a.properties))})}),j(b)},a.greatCircle=function(a,b,c){if("object"!=typeof(c=c||{}))throw new Error("options is invalid");var d=c.properties,e=c.npoints,f=c.offset;return a=R(a),b=R(b),d=d||{},e=e||100,f=f||10,new Kg({x:a[0],y:a[1]},{x:b[0],y:b[1]},d).Arc(e,{offset:f}).json()},a.lineSegment=bc,a.lineSplit=function(a,b){if(!a)throw new Error("line is required");if(!b)throw new Error("splitter is required");var c=Z(a),d=Z(b);if("LineString"!==c)throw new Error("line must be LineString");if("FeatureCollection"===d)throw new Error("splitter cannot be a FeatureCollection");if("GeometryCollection"===d)throw new Error("splitter cannot be a GeometryCollection");var e=Dc(b,{precision:7});switch(d){case"Point":return Ic(a,e);case"MultiPoint":return Hc(a,e);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return Hc(a,cc(a,e))}},a.lineArc=Lc,a.polygonToLine=Nc,a.lineToPolygon=Pc,a.bboxClip=function(a,b){var c=function(a){return a.geometry?a.geometry.type:a.type}(a),d=S(a),e=a.properties;switch(c){case"LineString":case"MultiLineString":var g=[];return"LineString"===c&&(d=[d]),d.forEach(function(a){Lg(a,b,g)}),1===g.length?h(g[0],e):k(g,e);case"Polygon":return f(Vc(d,b),e);case"MultiPolygon":return m(d.map(function(a){return Vc(a,b)}),e);default:throw new Error("geometry "+c+" not supported")}},a.lineOverlap=$c,a.sector=function(a,b,c,d,e){if(e=e||{},!y(e))throw new Error("options is invalid");if(!a)throw new Error("center is required");if(void 0===c||null===c)throw new Error("bearing1 is required");if(void 0===d||null===d)throw new Error("bearing2 is required");if(!b)throw new Error("radius is required");if("object"!=typeof e)throw new Error("options must be an object");if(ad(c)===ad(d))return nb(a,b,e);var g=S(a),h=[[g]];return B(Lc(a,b,c,d,e),function(a){h[0].push(a)}),h[0].push(g),f(h)},a.rhumbBearing=fc,a.rhumbDistance=hc,a.rhumbDestination=bd,a.polygonTangents=function(a,b){var c,e,f,g=S(a),h=S(b);switch(Z(b)){case"Polygon":c=h[0][0],e=h[0][0],f=dd(h[0][0],h[0][h[0].length-1],g);var i=cd(h[0],g,f,void 0,c,e);c=i[0],e=i[1];break;case"MultiPolygon":c=h[0][0][0],e=h[0][0][0],f=dd(h[0][0][0],h[0][0][h[0][0].length-1],g),h.forEach(function(a){var b=cd(a[0],g,f,void 0,c,e);c=b[0],e=b[1]})}return j([d(c),d(e)])},a.rewind=function(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.reverse||!1,d=b.mutate||!1;if(!a)throw new Error("<geojson> is required");if("boolean"!=typeof c)throw new Error("<reverse> must be a boolean");if("boolean"!=typeof d)throw new Error("<mutate> must be a boolean");!1===d&&(a=Ma(a));var e=[];switch(a.type){case"GeometryCollection":return I(a,function(a){fd(a,c)}),a;case"FeatureCollection":return F(a,function(a){F(fd(a,c),function(a){e.push(a)})}),j(e)}return fd(a,c)},a.isobands=function(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var d=c.zProperty||"elevation",e=c.commonProperties||{},g=c.breaksProperties||[];if(W(a,"Point","Input must contain Points"),!b)throw new Error("breaks is required");if(!Array.isArray(b))throw new Error("breaks is not an Array");if(!y(e))throw new Error("commonProperties is not an Object");if(!Array.isArray(g))throw new Error("breaksProperties is not an Array");var h=id(a,{zProperty:d,flip:!0}),i=function(a,b,c){for(var d=[],e=1;e<b.length;e++){var g=+b[e-1],h=+b[e],i=jd(a,g,h-g),j=function(a){var b=[],c=[];a.forEach(function(a){var d=rc(f([a]));c.push(d),b.push({ring:a,area:d})}),c.sort(function(a,b){return b-a});var d=[];return c.forEach(function(a){for(var c=0;c<b.length;c++)if(b[c].area===a){d.push(b[c].ring),b.splice(c,1);break}}),d}(i),k=function(a){for(var b=a.map(function(a){return{lrCoordinates:a,grouped:!1}}),c=[];!function(a){for(var b=0;b<a.length;b++)if(!1===a[b].grouped)return!1;return!0}(b);)for(var d=0;d<b.length;d++)if(!b[d].grouped){var e=[];e.push(b[d].lrCoordinates),b[d].grouped=!0;for(var g=f([b[d].lrCoordinates]),h=d+1;h<b.length;h++)if(!b[h].grouped){var i=f([b[h].lrCoordinates]);(function(a,b){for(var c=sb(a),d=0;d<c.features.length;d++)if(!Ea(c.features[d],b))return!1;return!0})(i,g)&&(e.push(b[h].lrCoordinates),b[h].grouped=!0)}c.push(e)}return c}(j),l={};l.groupedRings=k,l[c]=g+"-"+h,d.push(l)}return d}(h,b,d);return j((i=function(a,b,c){var d=Q(c),e=d[2]-d[0],f=d[3]-d[1],g=d[0],h=d[1],i=b[0].length-1,j=b.length-1,k=e/i,l=f/j,m=function(a){a[0]=a[0]*k+g,a[1]=a[1]*l+h};return a.forEach(function(a){a.groupedRings.forEach(function(a){a.forEach(function(a){a.forEach(m)})})}),a}(i,h,a)).map(function(a,b){if(g[b]&&!y(g[b]))throw new Error("Each mappedProperty is required to be an Object");var c=Object.assign({},e,g[b]);return c[d]=a[d],m(a.groupedRings,c)}))},a.transformRotate=md,a.transformScale=nd,a.transformTranslate=function(a,b,c,d){if(d=d||{},!y(d))throw new Error("options is invalid");var e=d.units,f=d.zTranslation,g=d.mutate;if(!a)throw new Error("geojson is required");if(void 0===b||null===b||isNaN(b))throw new Error("distance is required");if(f&&"number"!=typeof f&&isNaN(f))throw new Error("zTranslation is not a number");if(f=void 0!==f?f:0,0===b&&0===f)return a;if(void 0===c||null===c||isNaN(c))throw new Error("direction is required");return 0>b&&(b=-b,c=-c),!1!==g&&void 0!==g||(a=Ma(a)),B(a,function(a){var d=S(bd(a,b,c,{units:e}));a[0]=d[0],a[1]=d[1],f&&3===a.length&&(a[2]+=f)}),a},a.lineOffset=function(a,b,c){if(c=c||{},!y(c))throw new Error("options is invalid");var d=c.units;if(!a)throw new Error("geojson is required");if(void 0===b||null===b||isNaN(b))throw new Error("distance is required");var e=Z(a),f=a.properties;switch(e){case"LineString":return sd(a,b,d);case"MultiLineString":var g=[];return K(a,function(a){g.push(sd(a,b,d).geometry.coordinates)}),k(g,f);default:throw new Error("geometry "+e+" is not supported")}},a.polygonize=function(a){var b=Kh.fromGeoJson(a);b.deleteDangles(),b.deleteCutEdges();var c=[],d=[];return b.getEdgeRings().filter(function(a){return a.isValid()}).forEach(function(a){a.isHole()?c.push(a):d.push(a)}),c.forEach(function(a){Ih.findEdgeRingContaining(a,d)&&d.push(a)}),j(d.map(function(a){return a.toPolygon()}))},a.booleanDisjoint=function(a,b){var c;return K(a,function(a){K(b,function(b){return!1===c?!1:void(c=function(a,b){switch(a.type){case"Point":switch(b.type){case"Point":return!function(a,b){return a[0]===b[0]&&a[1]===b[1]}(a.coordinates,b.coordinates);case"LineString":return!vd(b,a);case"Polygon":return!Ea(a,b)}break;case"LineString":switch(b.type){case"Point":return!vd(a,b);case"LineString":return!function(a,b){return cc(a,b).features.length>0}(a,b);case"Polygon":return!wd(b,a)}break;case"Polygon":switch(b.type){case"Point":return!Ea(b,a);case"LineString":return!wd(a,b);case"Polygon":return!function(a,b){for(var c=0;c<a.coordinates[0].length;c++)if(Ea(a.coordinates[0][c],b))return!0;for(var d=0;d<b.coordinates[0].length;d++)if(Ea(b.coordinates[0][d],a))return!0;return!1}(b,a)}}}(a.geometry,b.geometry))})}),c},a.booleanContains=function(a,b){var c=Z(a),d=Z(b),e=X(a),f=X(b),g=S(a),h=S(b);switch(c){case"Point":switch(d){case"Point":return yd(g,h);default:throw new Error("feature2 "+d+" geometry not supported")}case"MultiPoint":switch(d){case"Point":return function(a,b){var c,d=!1;for(c=0;c<a.coordinates.length;c++)if(yd(a.coordinates[c],b.coordinates)){d=!0;break}return d}(e,f);case"MultiPoint":return function(a,b){for(var c=0;c<b.coordinates.length;c++){for(var d=!1,e=0;e<a.coordinates.length;e++)if(yd(b.coordinates[c],a.coordinates[e])){d=!0;break}if(!d)return!1}return!0}(e,f);default:throw new Error("feature2 "+d+" geometry not supported")}case"LineString":switch(d){case"Point":return yc(f,e,{ignoreEndVertices:!0});case"LineString":return function(a,b){for(var c=!1,d=0;d<b.coordinates.length;d++)if(yc({type:"Point",coordinates:b.coordinates[d]},a,{ignoreEndVertices:!0})&&(c=!0),!yc({type:"Point",coordinates:b.coordinates[d]},a,{ignoreEndVertices:!1}))return!1;return c}(e,f);case"MultiPoint":return function(a,b){for(var c=!1,d=0;d<b.coordinates.length;d++)if(yc(b.coordinates[d],a,{ignoreEndVertices:!0})&&(c=!0),!yc(b.coordinates[d],a))return!1;return!!c}(e,f);default:throw new Error("feature2 "+d+" geometry not supported")}case"Polygon":switch(d){case"Point":return Ea(f,e,{ignoreBoundary:!0});case"LineString":return function(a,b){var c=!1,d=0,e=Q(a),f=Q(b);if(!xd(e,f))return!1;for(;d<b.coordinates.length-1;d++){var g=function(a,b){return[(a[0]+b[0])/2,(a[1]+b[1])/2]}(b.coordinates[d],b.coordinates[d+1]);if(Ea({type:"Point",coordinates:g},a,{ignoreBoundary:!0})){c=!0;break}}return c}(e,f);case"Polygon":return function(a,b){var c=Q(a),d=Q(b);if(!xd(c,d))return!1;for(var e=0;e<b.coordinates[0].length;e++)if(!Ea(b.coordinates[0][e],a))return!1;return!0}(e,f);case"MultiPoint":return function(a,b){for(var c=0;c<b.coordinates.length;c++)if(!Ea(b.coordinates[c],a,{ignoreBoundary:!0}))return!1;return!0}(e,f);default:throw new Error("feature2 "+d+" geometry not supported")}default:throw new Error("feature1 "+c+" geometry not supported")}},a.booleanCrosses=function(a,b){var c=Z(a),d=Z(b),e=X(a),f=X(b);switch(c){case"MultiPoint":switch(d){case"LineString":return zd(e,f);case"Polygon":return Bd(e,f);default:throw new Error("feature2 "+d+" geometry not supported")}case"LineString":switch(d){case"MultiPoint":return zd(f,e);case"LineString":return function(a,b){if(cc(a,b).features.length>0)for(var c=0;c<a.coordinates.length-1;c++)for(var d=0;d<b.coordinates.length-1;d++){var e=!0;if(0!==d&&d!==b.coordinates.length-2||(e=!1),Cd(a.coordinates[c],a.coordinates[c+1],b.coordinates[d],e))return!0}return!1}(e,f);case"Polygon":return Ad(e,f);default:throw new Error("feature2 "+d+" geometry not supported")}case"Polygon":switch(d){case"MultiPoint":return Bd(f,e);case"LineString":return Ad(f,e);default:throw new Error("feature2 "+d+" geometry not supported")}default:throw new Error("feature1 "+c+" geometry not supported")}},a.booleanClockwise=ed,a.booleanOverlap=Gd,a.booleanPointOnLine=yc,a.booleanEqual=function(a,b){if(!a)throw new Error("feature1 is required");if(!b)throw new Error("feature2 is required");return Z(a)===Z(b)&&new Ph({precision:6}).compare(ab(a),ab(b))},a.booleanWithin=zc,a.clone=Ma,a.cleanCoords=ab,a.clustersDbscan=function(a,b,c){if("object"!=typeof(c=c||{}))throw new Error("options is invalid");var d=c.minPoints,e=c.units;if(W(a,"Point","Input must contain Points"),null===b||void 0===b)throw new Error("maxDistance is required");if(!(Math.sign(b)>0))throw new Error("Invalid maxDistance");if(!(void 0===d||null===d||Math.sign(d)>0))throw new Error("Invalid minPoints");a=Ma(a),d=d||3;var f=new Uh.DBSCAN,g=-1;return f.run(H(a),v(b,e),d,La).forEach(function(b){g++,b.forEach(function(b){var c=a.features[b];c.properties||(c.properties={}),c.properties.cluster=g,c.properties.dbscan="core"})}),f.noise.forEach(function(b){var c=a.features[b];c.properties||(c.properties={}),c.properties.cluster?c.properties.dbscan="edge":c.properties.dbscan="noise"}),a},a.clustersKmeans=function(a,b){if("object"!=typeof(b=b||{}))throw new Error("options is invalid");var c=b.numberOfClusters,d=b.mutate;W(a,"Point","Input must contain Points");var e=a.features.length;(c=c||Math.round(Math.sqrt(e/2)))>e&&(c=e),!1!==d&&void 0!==d||(a=Ma(a));var f=H(a),g=f.slice(0,c),h=ai(f,c,g),i={};return h.centroids.forEach(function(a,b){i[b]=a}),F(a,function(a,b){var c=h.idxs[b];a.properties.cluster=c,a.properties.centroid=i[c]}),a},a.pointToLineDistance=nc,a.booleanParallel=function(a,b){if(!a)throw new Error("line1 is required");if(!b)throw new Error("line2 is required");if("LineString"!==Id(a,"line1"))throw new Error("line1 must be a LineString");if("LineString"!==Id(b,"line2"))throw new Error("line2 must be a LineString");for(var c=bc(ab(a)).features,d=bc(ab(b)).features,e=0;e<c.length;e++){var f=c[e].geometry.coordinates;if(!d[e])break;if(!function(a,b){var c=s(fc(a[0],a[1])),d=s(fc(b[0],b[1]));return c===d}(f,d[e].geometry.coordinates))return!1}return!0},a.shortestPath=function(a,c,e){if(e=e||{},!y(e))throw new Error("options is invalid");var f=e.resolution,g=e.minDistance,i=e.obstacles||j([]);if(!a)throw new Error("start is required");if(!c)throw new Error("end is required");if(f&&!x(f)||0>=f)throw new Error("options.resolution must be a number, greater than 0");if(g)throw new Error("options.minDistance is not yet implemented");var k=R(a),l=R(c);switch(a=d(k),c=d(l),Z(i)){case"FeatureCollection":if(0===i.features.length)return h([k,l]);break;case"Polygon":i=j([b(X(i))]);break;default:throw new Error("invalid obstacles")}var m=i;m.features.push(a),m.features.push(c);var n=Q(nd(jb(Q(m)),1.15));f||(f=La([n[0],n[1]],[n[2],n[1]],e)/100),m.features.pop(),m.features.pop();for(var o=n[0],p=n[1],q=n[2],r=n[3],s=f/La([o,p],[q,p],e)*(q-o),t=f/La([o,p],[o,r],e)*(r-p),u=q-o,v=r-p,w=(u-Math.floor(u/s)*s)/2,z=[],A=[],B=[],C=[],D=1/0,E=1/0,F=r-(v-Math.floor(v/t)*t)/2,G=0;F>=p;){for(var H=[],I=[],J=o+w,K=0;q>=J;){var L=d([J,F]),M=function(a,b){for(var c=0;c<b.features.length;c++)if(Ea(a,b.features[c]))return!0;return!1}(L,i);H.push(M?0:1),I.push(J+"|"+F);var N=La(L,a);!M&&D>N&&(D=N,B={x:K,y:G});var O=La(L,c);!M&&E>O&&(E=O,C={x:K,y:G}),J+=s,K++}A.push(H),z.push(I),F-=t,G++}var P=new Kd(A,{diagonal:!0}),S=P.grid[B.y][B.x],T=P.grid[C.y][C.x],U=[k];return bi.search(P,S,T).forEach(function(a){var b=z[a.x][a.y].split("|");U.push([+b[0],+b[1]])}),U.push(l),ab(h(U))},a.voronoi=function(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.bbox||[-180,-85,180,85];if(!a)throw new Error("points is required");if(!Array.isArray(c))throw new Error("bbox is invalid");return W(a,"Point","points"),j(mi().x(function(a){return a.geometry.coordinates[0]}).y(function(a){return a.geometry.coordinates[1]}).extent([[c[0],c[1]],[c[2],c[3]]]).polygons(a.features).map(ke))},a.ellipse=le,a.centerMean=ne,a.centerMedian=function(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.counter||10;if(!x(c))throw new Error("counter must be a number");var d=b.weight,e=ne(a,{weight:b.weight}),f=j([]);return F(a,function(a){f.features.push(qb(a,{weight:a.properties[d]}))}),f.properties={tolerance:b.tolerance,medianCandidates:[]},oe(e.geometry.coordinates,[0,0],f,c)},a.standardDeviationalEllipse=function(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.steps||64,d=b.weight,e=b.properties||{};if(!x(c))throw new Error("steps must be a number");if(!y(e))throw new Error("properties must be a number");var f=H(a).length,g=ne(a,{weight:d}),h=0,i=0,k=0;F(a,function(a){var b=a.properties[d]||1,c=pe(S(a),S(g));h+=Math.pow(c.x,2)*b,i+=Math.pow(c.y,2)*b,k+=c.x*c.y*b});var l=h-i,m=Math.sqrt(Math.pow(l,2)+4*Math.pow(k,2)),n=2*k,o=Math.atan((l+m)/n),p=180*o/Math.PI,q=0,r=0,s=0;F(a,function(a){var b=a.properties[d]||1,c=pe(S(a),S(g));q+=Math.pow(c.x*Math.cos(o)-c.y*Math.sin(o),2)*b,r+=Math.pow(c.x*Math.sin(o)+c.y*Math.cos(o),2)*b,s+=b});var t=Math.sqrt(2*q/s),u=Math.sqrt(2*r/s),v=le(g,t,u,{units:"degrees",angle:p,steps:c,properties:e}),w=Ga(a,j([v])),z={meanCenterCoordinates:S(g),semiMajorAxis:t,semiMinorAxis:u,numberOfFeatures:f,angle:p,percentageWithinEllipse:100*H(w).length/f};return v.properties.standardDeviationalEllipse=z,v},a.difference=function(a,c){var d=X(a),e=X(c),f=a.properties||{};if(d=Re(d),e=Re(e),!d)return null;if(!e)return b(d,f);var g=new wk,h=g.read(d),i=g.read(e),j=zn.difference(h,i);return j.isEmpty()?null:b((new xk).write(j),f)},a.buffer=function(a,b,c){var d=(c=c||{}).units,e=c.steps||64;if(!a)throw new Error("geojson is required");if("object"!=typeof c)throw new Error("options must be an object");if("number"!=typeof e)throw new Error("steps must be an number");if(void 0===b)throw new Error("radius is required");if(0>=e)throw new Error("steps must be greater than 0");e=e||64,d=d||"kilometers";var f=[];switch(a.type){case"GeometryCollection":return I(a,function(a){var c=wf(a,b,d,e);c&&f.push(c)}),j(f);case"FeatureCollection":return F(a,function(a){var c=wf(a,b,d,e);c&&F(c,function(a){a&&f.push(a)})}),j(f)}return wf(a,b,d,e)},a.union=Bf,a.intersect=Cf,a.dissolve=function(a,b){if(b=b||{},!y(b))throw new Error("options is invalid");var c=b.propertyName;W(a,"Polygon","dissolve");var d=Ma(a),e=d.features,f=[];e.forEach(function(a,b){a.properties.origIndexPosition=b});var g=$b();g.load(d);for(var i in e){var j=e[i],k=!1;if(g.search(j).features.forEach(function(a){j=e[i];var b=a.properties.origIndexPosition;if(f.length>0&&0!==b)if(b>f[f.length-1])b-=f.length;else{var d=Df(b,f);0!==d&&(b-=d)}if(b!==+i){var l=e[b];l&&j&&(void 0!==c&&l.properties[c]!==j.properties[c]||Gd(j,l)&&function(a,b){var c=h(H(a)),d=h(H(b));return cc(c,d).features.length>0}(j,l)&&(e[i]=Bf(j,l),f.push(a.properties.origIndexPosition),f.sort(function(a,b){return a-b}),g.remove(a),e.splice(b,1),j.properties.origIndexPosition=i,g.remove(j,function(a,b){return a.properties.origIndexPosition===b.properties.origIndexPosition}),k=!0))}}),k){if(!j)continue;j.properties.origIndexPosition=i,g.insert(j),i--}}return e.forEach(function(a){delete a.properties.origIndexPosition,delete a.bbox}),d},a.hexGrid=Ef,a.mask=function(a,b){var c=function(a){return f(a&&a.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]])}(b),d=function(a){var b=[],c=[];return K(a,function(a){var d=a.geometry.coordinates,e=d[0],g=d.slice(1);b.push(f([e])),g.forEach(function(a){c.push(f([a]))})}),[j(b),j(c)]}(a),e=d[0],g=d[1];return function(a,b,c){var d=[];return d.push(a.geometry.coordinates[0]),K(b,function(a){d.push(a.geometry.coordinates[0])}),K(c,function(a){d.push(a.geometry.coordinates[0])}),f(d)}(c,e=Ff(e),g=Ff(g))},a.squareGrid=Hf,a.triangleGrid=If,a.interpolate=function(a,b,c){if("object"!=typeof(c=c||{}))throw new Error("options is invalid");var d=c.gridType,e=c.property,f=c.weight;if(!a)throw new Error("points is required");if(W(a,"Point","input must contain Points"),!b)throw new Error("cellSize is required");if(void 0!==f&&"number"!=typeof f)throw new Error("weight must be a number");e=e||"elevation",d=d||"square",f=f||1;var g,h=Q(a);switch(d){case"point":case"points":g=Cc(h,b,c);break;case"square":case"squares":g=Hf(h,b,c);break;case"hex":case"hexes":g=Ef(h,b,c);break;case"triangle":case"triangles":g=If(h,b,c);break;default:throw new Error("invalid gridType")}var i=[];return F(g,function(b){var g=0,h=0;F(a,function(a){var i,j=La("point"===d?b:qb(b),a,c);if(void 0!==e&&(i=a.properties[e]),void 0===i&&(i=a.geometry.coordinates[2]),void 0===i)throw new Error("zValue is missing");0===j&&(g=i);var k=1/Math.pow(j,f);h+=k,g+=k*i});var j=Ma(b);j.properties[e]=g/h,i.push(j)}),j(i)},a.pointOnSurface=pc,a.polygonToLineString=Nc,a.lineStringToPolygon=Pc,a.inside=Ea,a.within=Ga,a.bezier=ib,a.nearest=Kb,a.pointOnLine=ec,a.lineDistance=wc,a.radians2degrees=t,a.degrees2radians=u,a.distanceToDegrees=r,a.distanceToRadians=q,a.radiansToDistance=p,a.bearingToAngle=s,a.convertDistance=v,a.toMercator=ic,a.toWgs84=jc,a.randomPosition=qe,a.randomPoint=re,a.randomPolygon=se,a.randomLineString=te,a.getCluster=ve,a.clusterEach=we,a.clusterReduce=xe,a.createBins=ye,a.applyFilter=ze,a.propertiesContainsFilter=Ae,a.filterProperties=Be,a.earthRadius=Jf,a.factors=Kf,a.unitsFactors=Lf,a.areaFactors=Mf,a.feature=b,a.geometry=c,a.point=d,a.points=e,a.polygon=f,a.polygons=g,a.lineString=h,a.lineStrings=i,a.featureCollection=j,a.multiLineString=k,a.multiPoint=l,a.multiPolygon=m,a.geometryCollection=n,a.round=o,a.radiansToLength=p,a.lengthToRadians=q,a.lengthToDegrees=r,a.bearingToAzimuth=s,a.radiansToDegrees=t,a.degreesToRadians=u,a.convertLength=v,a.convertArea=w,a.isNumber=x,a.isObject=y,a.validateBBox=z,a.validateId=A,a.getCoord=R,a.getCoords=S,a.containsNumber=T,a.geojsonType=U,a.featureOf=V,a.collectionOf=W,a.getGeom=X,a.getGeomType=Y,a.getType=Z,a.coordEach=B,a.coordReduce=C,a.propEach=D,a.propReduce=E,a.featureEach=F,a.featureReduce=G,a.coordAll=H,a.geomEach=I,a.geomReduce=J,a.flattenEach=K,a.flattenReduce=L,a.segmentEach=M,a.segmentReduce=N,a.lineEach=O,a.lineReduce=P,Object.defineProperty(a,"__esModule",{value:!0})});


psrk = window.psrk || {};

psrk.url = {
	base: 'https://www.propertyshark.com',
	webservice: 'https://www.propertyshark.com',
	cdn: (window.location.protocol == "https:" ? '//cdn.sharketyprop.com' : '//cdn.sharketyprop.com'),
	cdn_search: '//search.sharketyprop.com'
};


psrk=window.psrk||{},psrk.ShowHideStates=new Object,psrk.console=function(a){window.console&&console.log(a)},psrk.include_script=function(a,b,c){var d=$(psrk.gE(b));if(d[0]&&d.attr("src")!=a&&d.remove(),!$(psrk.gE(b))[0]){var e=document.getElementsByTagName("head").item(0);return d=document.createElement("script"),d.setAttribute("type","text/javascript"),d.setAttribute("src",a),d.setAttribute("id",b),c&&(d.onreadystatechange=function(){var a=d.readyState;c.done||a&&!/loaded|complete/.test(a)||(c.done=!0,c())},d.onload=c),e.appendChild(d),!0}return!1},psrk.include_css=function(a,b,c){if(!document.getElementById(b)){var d=document.getElementsByTagName("head").item(0);css=document.createElement("link"),css.setAttribute("rel","stylesheet"),css.setAttribute("type","text/css"),css.setAttribute("id",b),css.setAttribute("href",a),c&&css.setAttribute("media",c),d.appendChild(css)}},psrk.include_style=function(a,b,c){var d=document.createElement("style");if(d.setAttribute("type","text/css"),d.setAttribute("id",b),c&&d.setAttribute("media",c),d.styleSheet)d.styleSheet.cssText=a;else{var e=document.createTextNode(a);d.appendChild(e)}document.getElementsByTagName("head").item(0).appendChild(d)},psrk.ajaxLoader=function(a,b,c,d){for(var e=[],f=4;f<arguments.length;f++)e.push(arguments[f]);var g=$(psrk.gE(b));c=c||"GET";var h=new RegExp("[?].+"),i=""+h.exec(a);a=a.replace(i,""),i=i.replace("?",""),$.ajax({type:c,url:a,data:i,success:function(a){if(e.splice(0,0,a),g[0]&&g.html(a),d){var b=d.apply(null,e);b&&g[0]&&g.html(b)}}})},psrk.ui={mode:null,setBreakpointCallback:function(a,b){function c(){var c=psrk.cE("div");c.id=(b||"psrk")+"-mq-listener",document.body.appendChild(c);var d,e=function(){var c=window.getComputedStyle(psrk.gE((b||"psrk")+"-mq-listener"),":after").getPropertyValue("content").replace(/\"|\'/g,"");d!=c&&(psrk.ui.mode=c,d=c,psrk.ui.closePopups(),psrk.ui.adapt(),a(c))};document.attachEvent?window.addEventListener("resize",e,!0):(c.addEventListener("webkitTransitionEnd",e,!0),c.addEventListener("MSTransitionEnd",e,!0),c.addEventListener("oTransitionEnd",e,!0),c.addEventListener("transitionend",e,!0)),e()}document.addEventListener&&document.addEventListener("DOMContentLoaded",c,!0)},adapt:function(){var a=this;a.moved_els||(a.moved_els={}),"base"==psrk.ui.mode?$(".dom-adapt").each(function(){var b=$(this);if($(this).attr("data-target")){if(a.moved_els[$(this).attr("data-target")])return;$(".dom-adapt").each(function(){if($(this).attr("data-source")==b.attr("data-target")){var c=$('<div class="dom-adapt-moved-dummy" move-target='+b.attr("data-target")+"></div>");if(b.wrap(c),b.attr("data-popup")){if(b.hide(),!$(this).children("a")[0]){var d=$('<a href="javascript:void(0);">'+b.attr("data-popup")+"</a>");$(this).append(d),d.click(function(){psrk.popup.open("",{source_id:b.attr("id"),title:b.attr("data-popup")})})}}else $(this).append(b);return b.addClass("dom-adapt-moved"),a.moved_els[b.attr("data-target")]=1,!1}})}else b.attr("data-toggle")&&(b.attr("data-toggle").match(/mob-show/)&&b.removeClass("hide"),b.attr("data-toggle").match(/mob-hide/)&&b.addClass("hide"))}):(a.moved_els={},$(".dom-adapt-moved-dummy").each(function(){var a=$(this);$(".dom-adapt-moved").each(function(){var b=$(this);return b.attr("data-target")==a.attr("move-target")?(a.after(b),b.removeClass("dom-adapt-moved").show(),a.remove(),b.attr("data-popup")&&($("#popup_"+b.attr("id")).remove(),$(".dom-adapt").each(function(){return $(this).attr("data-source")==b.attr("data-target")?($(this).find("a").remove(),!1):void 0})),!1):void 0})}),$(".dom-adapt").each(function(){var a=$(this);a.attr("data-toggle")&&(a.attr("data-toggle").match(/non-mob-show/)&&a.removeClass("hide"),a.attr("data-toggle").match(/non-mob-hide/)&&a.addClass("hide"))}))},closePopups:function(){$(".psrk-popup").each(function(){$(this).hasClass("visible")&&psrk.popup.close($(this).attr("id"))}),$(".psrk-custom-list").hide(),$(".psrk-iwo").removeClass("focus open")}},psrk.events=function(a){var b=this;this.set_run=function(a,b,c){b.params.splice(0,0,a[0]),psrk.safeClick(a,function(){a.attr("psrk-tip")&&psrk.popup.close("popup_"+a.attr("psrk-tip")),b.fn.apply(!1,b.params)},!0)},this.set_hover=function(a,c,d){if("touch"!=d||!a.attr("psrk-run")){var e={fn:function(b){var e=c.params.slice();e.splice(0,0,a[0]),e.splice(0,0,b),c.fn.apply(!1,e),"touch"==d&&("mouseover"==b?setTimeout(function(){psrk.popup.overlay(!0,!0)},500):"mouseout"==b&&setTimeout(function(){psrk.popup.overlay()},500))},params:[]};b.set_handler(a,"mouseover",e,!0),b.set_handler(a,"mouseout",e,!0)}},this.set_tip=function(a,b,c){var d=a.attr("psrk-tip-message"),e=a.attr("psrk-tip-id"),f="popup_"+a.attr("psrk-tip"),g=this,h={fn:function(b){"mouseout"==b?"mouse"==c?($("#"+f).one("mouseover",function(){g.timeout&&clearTimeout(g.timeout);var a=$("#"+f).on("mouseout",function(b){var c=b.toElement||b.relatedTarget;return $(c).parents("#"+f)[0]?!1:($("#"+f).off("mouseout",a),void(g.timeout=setTimeout(function(){psrk.popup.close(f)},200)))})}),g.timeout=setTimeout(function(){psrk.popup.close(f)},200)):psrk.popup.close(f):psrk.popup.open(a[0],{id:f,source_id:e,message:d,overlay:!1,type:"tip"})},params:[]};g.set_hover(a,h,c)},this.parse_attr=function(a){for(var b=a.split("|"),c=b[0].split("."),d=window,e=0;e<c.length;e++)d=d[c[e]];return{fn:d,params:b.slice(1)}},this.set_handler=function(a,b,c,d){var e=c.params.slice();d&&e.splice(0,0,b),a.on(b,function(a){c.fn.apply(a.target,e),a.preventDefault()})},this.init=function(){var c=["run","hover","tip"],d=a?$(document.getElementById(a)).find(".psrk-events"):$(".psrk-events"),e=$("html").hasClass("psrk-touch")?"touch":"mouse";d.each(function(){for(var a=this,d=0;d<c.length;d++)!function(d){var f=$(a).attr("psrk-"+c[d]);if(f&&!a[c[d]+"_bound"]){var g=b.parse_attr(f);b["set_"+c[d]]($(a),g,e),a[c[d]+"_bound"]=1}}(d)})},this.init()},$(function(){setTimeout(function(){psrk.events()},0)}),psrk.drag=function(){var a=function(){this.dragObj={},this.register=function(a,b,c){var d=this;"object"!=typeof a&&(a=psrk.gE(a));var e=b||a;"object"!=typeof e&&(e=psrk.gE(e)),c&&"object"!=typeof c&&(c=psrk.gE(c)),$(e).mouseover(function(){$(e).css("cursor","move"),$(e).bind("mousedown.drag",function(b){b.preventDefault(),d.dragInit(b,$(a),c?$(c):null)}),document.attachEvent&&document.attachEvent("onselectstart",d.dragNull),$(e).bind("mouseup.drag",function(a){d.dragRelease})}),$(e).mouseout(function(){$(e).css("cursor","auto"),$(e).unbind("mousedown.drag"),document.detachEvent&&document.detachEvent("onselectstart",d.dragNull),$(e).unbind("mouseup.drag")})},this.dragInit=function(a,b,c){var d=this;d.dragObj.obj&&d.dragObj.obj.css("z-index",d.dragObj.z),d.dragObj.obj=b,d.dragObj.z=b.css("z-index"),b.css("z-index",1e4),d.dragObj.click_position_obj={x:a.pageX,y:a.pageY},d.dragObj.el_position_obj={x:d.dragObj.obj.offset().left,y:d.dragObj.obj.offset().top},d.dragObj.pt_position_obj=c&&c[0]?{x:c.offset().left,y:c.offset().top}:null,$(document).bind("mousemove.drag",function(a){d.drag(a)}),$(document).bind("mouseup.drag",function(){d.dragRelease()})},this.drag=function(a){var b=this;b.dragObj.mouse_position_obj={x:a.pageX,y:a.pageY},b.dragObj.obj.css("left",b.dragObj.el_position_obj.x+b.dragObj.mouse_position_obj.x-b.dragObj.click_position_obj.x-(b.dragObj.pt_position_obj?b.dragObj.pt_position_obj.x:0)+"px"),b.dragObj.obj.css("top",b.dragObj.el_position_obj.y+b.dragObj.mouse_position_obj.y-b.dragObj.click_position_obj.y-(b.dragObj.pt_position_obj?b.dragObj.pt_position_obj.y:0)+"px")},this.dragRelease=function(){$(document).unbind("mousemove.drag"),$(document).unbind("mouseup.drag")},this.dragNull=function(){return!1}};return new a}(),psrk.photosWidget={inst:[],mode:void 0,init:function(a){this.inst.push(new this.widget(a))},widget:function(a){this.mode=psrk.photosWidget.mode,this.id=void 0,this.pw=void 0,this.ready=!1,this.swipeready=!1,this.photos_fullsrc=[],this.photos_src=[],this.forceMode=void 0,this.init=function(a){"function"==typeof a||"undefined"==typeof a?this.pw=$($(".photos_widget").get(0)):this.pw="string"==typeof a?$("#"+a):$(a).closest(".photos_widget"),this.pw.attr("data-pwid")||this.pw.attr("data-pwid",(new Date).getTime()),this.id=this.pw.attr("data-pwid"),this.forceMode=this.pw.attr("data-mode");var b=this;this.pw.find(".thumbs img").each(function(){$(this).attr("data-fullsrc")&&b.photos_fullsrc.push($(this).attr("data-fullsrc")),$(this).attr("data-src")&&b.photos_src.push($(this).attr("data-src"))}),"undefined"==typeof this.mode&&(this.mode=$(window).width()<=480?"base":"none"),"base"==this.mode&&"click"!=this.forceMode||"swipe"==this.forceMode?this.setupSwipe():this.setup()},this.select=function(a){var b=this.pw;b.find(".thumbs a").attr("class",""),a.addClass("sel");var c=b.find(".photo");c.addClass("loading"),c.html($("<img/>",{src:a.find("img").attr("data-src"),alt:a.find("img").attr("alt"),style:"visibility:hidden",title:a.find("img").attr("data-caption"),load:function(){a.find("img").attr("data-fullsrc")&&$(this).parent().addClass("fullscreen"),b.find(".shape").length?$(this).parent().removeClass("loading"):$(this).parent().height($(this).outerHeight()).removeClass("loading"),$(this).css({visibility:"inherit"}).hide().fadeIn(),a.find("img").attr("data-caption")&&c.append("<div class='caption' style='max-width:"+$(this).width()+"px'>"+a.find("img").attr("data-caption")+"</div>")}}))},this.move=function(){this.blur();var a=this.className.match(/next/)?1:-1,b=$(this).closest(".photos_widget"),c=b.find(".thumbs")[0].clientWidth,d=b.find(".thumbs div"),e=parseFloat(d.css("left"))||0,f=b.find(".thumbs div a"),g=parseInt($(f[0]).css("marginLeft").replace("px",""))+parseInt($(f[0]).css("marginRight").replace("px","")),h=f[0].clientWidth+g,i=f.length*h,j=b.find(".thumbs div a.sel"),k=a>0?j.next():j.prev();k.trigger("click");var l=1;if(a>0){if(i>c){l=e-h,0>i-c+l&&(l=c-i);var m=$($(".thumbs img")[Math.floor((c-l)/h)+1]);m[0]&&!m.attr("src")&&m.attr("src",m.attr("data-thumbsrc"))}}else l=e+h,l>0&&(l=0);0>=l&&d.animate({left:l},300,function(){})},this.setMode=function(a){"undefined"==typeof this.forceMode&&("base"==a?this.setupSwipe():this.setup(),this.mode=a)},this.getIndex=function(){for(var a=this.pw.find(".thumbs a"),b=0;b<a.length;b++)if($(a[b]).hasClass("sel"))return b;return 0},this.setupSwipe=function(){this.pw.addClass("swipe");var a=this.getIndex();if(this.swipeready)this.swipeGallery.setPhoto(a);else{var b=$("[data-pwid='"+this.id+"']").find(".photo_outer");"true"==$("[data-pwid='"+this.id+"']").attr("data-fit")&&b.addClass("fit"),this.swipeGallery=new psrk.swipeGallery(b,this.id,this.photos_src,a),this.swipeready=!0}this.pw.find(".photo > img").remove()},this.setup=function(){var a=this.swipeready?this.swipeGallery.getIndex(this.id):0,b=this,c=this.pw;if(c.removeClass("swipe"),!this.ready){$(!1).prettyPhoto({social_tools:!1,slideshow:!1}),c.find(".controls a[class^=btn_]").on("click",b.move),c.find(".thumbs a").on("click",function(a){b.select($(this))});var d=[],e=[];c.find(".thumbs img").each(function(){e.push($(this).attr("data-caption"))}),c.find(".photo").click(function(){if(0!=b.photos_fullsrc.length){var a=0,f=0;c.find(".controls .thumbs a").each(function(){$(this).find("img").attr("data-fullsrc")&&$(this).hasClass("sel")&&(a=f),f++}),$.prettyPhoto.open(b.photos_fullsrc,d,e,0,b.id),$.prettyPhoto.changePage(a)}}),this.ready=!0}var f=c.find(".thumbs").find("img:first"),g=c.find(".thumbs img"),h=c.find(".thumbs")[0].clientWidth;f.attr("src")?b.getImageSize(f[0])*g.length<h?c.find(".controls").addClass("non-scrollable"):c.find(".controls").removeClass("non-scrollable"):(f.attr("src",f.attr("data-thumbsrc")),f.load(function(){var a=b.getImageSize(this);a*g.length<h?c.find(".controls").addClass("non-scrollable"):c.find(".controls").removeClass("non-scrollable");for(var d=1;d<g.length;d++)h>(d-1)*a&&$(g[d]).attr("src",$(g[d]).attr("data-thumbsrc"))}));var i=this.pw.find(".thumbs a");i.removeClass("sel"),$(i[a]).addClass("sel").trigger("click")},this.getImageSize=function(a){var b=parseInt($(a).parent().css("marginLeft").replace("px",""))+parseInt($(a).parent().css("marginRight").replace("px","")),c=a.clientWidth+b;return c},this.isMobile=function(){return"base"==this.mode},this.init(a)},setMode:function(a){"none"==a&&$(window).width()<=480&&(a="base");for(var b=0;b<psrk.photosWidget.inst.length;b++)psrk.photosWidget.inst[b].setMode(a);psrk.photosWidget.mode=a}},psrk.ui.setBreakpointCallback(psrk.photosWidget.setMode),psrk.swipeGallery=function(a,b,c,d){this.pw=void 0,this.tray=void 0,this.counter=void 0,this.touchstartx=void 0,this.touchstarty=void 0,this.movex=0,this.movey=0,this.longTouch=void 0,this.photo_array=[],this.direction=void 0,this.index=d?d:0,this.photos=0,this.maxPhotos=100,this.id=void 0,this.init=function(a,b,c){$("#psg-gallery-"+b).remove(),this.fit=c.hasClass("fit");for(var d=0;d<a.length;d++)this.photo_array.push({src:a[d],inDOM:!1,loaded:!1});this.id=b,this.counter=$('<div class="psg-counter" id="psg-counter-'+b+'">'+(this.index+1)+" of "+this.photo_array.length+"</div>"),this.prev_photo=$('<a href="#" class="psg-prev"></a>'),this.next_photo=$('<a href="#" class="psg-next"></a>'),this.pw=$('<div id="psg-gallery-'+this.id+'" class="psg-gallery"></div>'),c.append(this.pw),this.pw.append(this.counter),this.pw.append(this.prev_photo),this.pw.append(this.next_photo),this.pw.addClass("loading");var e=document.all?3*this.pw.width()/4+"px":"auto";this.tray=$("<div class='tray' style='width:"+100*this.maxPhotos+"%; overflow-y:hidden;height:"+e+";'></div>"),this.setPhoto(this.index),this.moveTray(100*this.index/this.maxPhotos),this.pw.append(this.tray);var f=this;this.tray.on("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(a){a.originalEvent.propertyName.indexOf("margin")>=0&&f.transformEnd(a)}),this.bindUIEvents(),this.setNavigation()},this.bindUIEvents=function(){var a=this;this.pw.on("touchstart",function(b){a.touchstart(b)}),this.pw.on("touchmove",function(b){a.touchmove(b)}),this.pw.on("touchend",function(b){a.touchend(b)}),this.prev_photo.on("click",function(){return a.flip(-1),this.blur(),!1}),this.next_photo.on("click",function(){return a.flip(1),this.blur(),!1})},this.touchstart=function(a){this.direction=void 0,this.tray.removeClass("psg-animate"),this.longTouch=!1;var b=this;return setTimeout(function(){b.longTouch=!0},250),this.touchstartx=a.originalEvent.touches[0].pageX,this.touchstarty=a.originalEvent.touches[0].pageY,!1},this.touchmove=function(a){if("vertical"!=this.direction){var b=this.touchstartx-a.originalEvent.touches[0].pageX,c=this.touchstarty-a.originalEvent.touches[0].pageY;if(0==this.movex&&0==this.movey){if(Math.abs(c)>Math.abs(b))return void(this.direction="vertical");this.pw.removeClass("loading")}this.movex=b;var d=(this.index*this.pw.width()+this.movex)/this.pw.width();return this.tray.css("margin-left","-"+100*d+"%"),a.preventDefault(),!1}},this.touchend=function(a){var b=Math.abs(this.movex);b>2&&((b>this.pw.width()/4||this.longTouch===!1)&&(this.movex>0&&this.index<this.photos-1?this.index++:this.movex<0&&this.index>0&&this.index--),this.moveTray(100*this.index/this.maxPhotos)),this.touchstartx=this.touchstarty=this.movex=this.movey=0},this.transformEnd=function(a){this.index==this.photos-1&&this.appendPhoto(1);var b=this.tray.find("> div");this.index>0&&!this.photo_array[this.index-1].loaded&&this.setImgSrc($(b[this.index-1]).find(".frame img"),this.photo_array[this.index-1].src),this.setNavigation(),this.counter.html(this.index+1+" of "+this.photo_array.length),this.fit&&this.setFrameRatio($(b[this.index]).find("img")[0]),this.tray.removeClass("psg-animate"),this.photo_array[this.index].loaded||this.pw.addClass("loading")},this.moveTray=function(a){document.all?(this.tray.css("margin-left","-"+100*a+"%"),this.transformEnd()):this.tray.addClass("psg-animate").css("margin-left","-"+100*a+"%")},this.flip=function(a){this.index+a<this.photos&&(this.index=Math.min(Math.max(0,this.index+a),this.photo_array.length+1),this.moveTray(100*this.index/this.maxPhotos))},this.setPhoto=function(a){this.index=Math.min(this.maxPhotos-1,a);for(var b=this.photos;b<this.index;b++){var c=b==this.index-1?this.photo_array[b].src:"";this.insertPhoto(b,c)}this.photos=Math.max(this.index,this.photos),this.appendPhoto(2),this.moveTray(100*this.index/this.maxPhotos)},this.appendPhoto=function(a){void 0===typeof a&&(a=1);for(var b=0;a>b;b++)this.photos<this.photo_array.length&&(this.insertPhoto(this.photos,this.photo_array[this.photos].src),this.photos++)},this.insertPhoto=function(a,b){var c=$('<img src="" style="display: inline-block; width: 20%; opacity: 0;" />');c.attr("idx",a),b&&this.setImgSrc(c,b),this.tray.append(c),c.wrap('<div><div><div class="frame"></div></div></div>'),c.after("<span></span>"),this.photoInDOM(a)},this.setImgSrc=function(a,b){a.attr("src",b);var c=this;a.one("load",function(a){var b=this.naturalHeight||this.height,d=this.naturalWidth||this.width,e=c.fit?b/d:Math.min(.75,b/d);this.setAttribute("data-ratio",e);var f=this.getAttribute("idx");this.style.opacity=1,c.photoLoaded(f),(c.fit&&f==c.index||0==f)&&c.setFrameRatio(this),f==c.index&&c.pw.removeClass("loading")})},this.photoLoaded=function(a){this.photo_array[a].loaded=!0},this.photoInDOM=function(a){this.photo_array[this.photos].inDOM=!0},this.setFrameRatio=function(a){var c=a.getAttribute("data-ratio"),d=1;c&&(c>d&&(a.style.width=20/c+"%",c=d),$("#psg-gallery-"+b).siblings(".shape").css("padding-top",100*c+"%"),this.pw.find(".tray").css("height",this.pw.width()*c+"px"),this.counter.css("display","block"))},this.setNavigation=function(){this.prev_photo.toggle(0!=this.index),this.next_photo.toggle(this.index!=this.photo_array.length-1)},this.getIndex=function(){return this.index},this.init(c,b,a)},psrk.popup={},psrk.popup.open=function(a,b){var c=5,d=5,e=1,f=5,g=20,h=18,i=33,j="undefined"==typeof b.overlay||b.overlay?!0:!1,k=b.id||"popup_"+(b.source_id||b.source_comp.replace(/[\.\\\/]/g,"")),l=$("#"+k);if(b.width=b.width?b.width.match&&b.width.match(/%/)?parseInt(b.width.replace("%",""))/100:parseInt(b.width):"",b.height=b.height?b.height.match&&b.height.match(/%/)?parseInt(b.height.replace("%",""))/100:parseInt(b.height):"",l[0])l.appendTo(document.body),j&&psrk.popup.overlay(!0);else{var m=b.width?b.width<=1?parseInt(b.width*$(window).width())-2*f-2*e:b.width+g+"px":"";l=$(psrk.cE("div")).attr({id:k,"class":"psrk-popup"}).css({position:"absolute",top:"0",left:"-1000px",width:m,display:"none"}).appendTo(document.body),b.type&&l.addClass("psrk-"+b.type);var n=$(psrk.cE("div")).addClass("psrk-popup-inner"),o=$(psrk.cE("div")).addClass("psrk-popup-header").appendTo(n);b.title&&($(psrk.cE("h3")).attr("id",k+"_h").html(b.title).appendTo(o),$(psrk.cE("a")).attr("title","Close").click(function(){return psrk.popup.close(k),b.close_handler&&b.close_handler(),!1}).appendTo(o));var p=b.height?b.height<=1?parseInt(b.height*$(window).height())-2*f-2*e-2*i-10:b.height+h:"",q=$(psrk.cE("div")).attr({"class":"psrk-popup-content"}).css({height:p}),r=$(psrk.cE("div")).attr({id:k+"_c","class":"psrk-popup-content-inner"}).appendTo(q);b.source_id&&$("#"+b.source_id).show().appendTo(r),b.message&&r.html(b.message),n.append(q),l.append(n),j&&psrk.popup.overlay(!0),b.source_comp&&(r.html('<div class="psrk-loading-txt">Loading ...</div>'),psrk.ajaxLoader(b.source_comp,r.attr("id"),null,function(){psrk.popup.open(null,b)}))}l.find(".psrk-popup-header").on("touchmove",function(a){a.preventDefault()}),psrk.mobile.iOS_popup_open(l,function(a){psrk.popup.close(a)},k),navigator.userAgent.match(/(iPhone|iPod)/)&&psrk.mobile.is_iOS_no_toolbar()&&(l.attr("data-iosfix","full"),l.on("touchstart",function(){return psrk.mobile.is_iOS_no_toolbar()||"full"!=l.attr("data-iosfix")||"fixed"!=l.css("position")?void 0:(l.removeAttr("data-iosfix"),l.removeClass("psrk-popup"),l.css("cssText","position:relative !important"),setTimeout(function(){l.css("cssText","position:fixed !important"),l.addClass("psrk-popup")},50),l.off("touchstart",arguments.callee),!1)}));var s=l.find(".psrk-popup-scrollable-content");s.length?l.addClass("complex"):s=l.find(".psrk-popup-content"),s.on("touchstart",psrk.popup.scroll_ontouchstart),s.on("touchmove",psrk.popup.scroll_ontouchmove),s.on("touchend",psrk.popup.scroll_ontouchend);var t=$(window).width(),u=$(window).height(),o=$(".psrk-popup-header",l);l.show().addClass("visible"),l[0].offsetWidth>t&&(!b.width||b.width>1)&&(b.width=t-(l[0].offsetWidth-l.width())-2*f,l.css("width",b.width+"px")),l[0].offsetHeight>u&&(!b.height||b.height>1)&&(b.height=u-(l[0].offsetHeight-l.height())-o[0].offsetHeight-2*f,l.find(".psrk-popup-content").css("height",b.height+"px"));var v=$(document).scrollLeft()+c,w=$(document).scrollTop();if(a){var x=$(a).offset();x.left+a.offsetWidth+l[0].offsetWidth+c<$(window).width()+v?l.css("left",x.left+a.offsetWidth+c+"px"):l.css("left",Math.max(v,x.left-c-l[0].offsetWidth)+"px"),x.top+a.offsetHeight+l[0].offsetHeight+d<$(window).height()+w?l.css("top",x.top+a.offsetHeight+d+"px"):x.top-l[0].offsetHeight-d>w?l.css("top",x.top-l[0].offsetHeight-d+"px"):l.css("top",Math.max(w,$(window).height()+w-d-l[0].offsetHeight)+"px")}else l.css({left:v+(t-l[0].offsetWidth)/2+"px",top:w+(u-l[0].offsetHeight)/2+"px"});b.script_src&&b.script_id&&!psrk.include_script(b.script_src,b.script_id)&&b.script_src_fallback&&b.script_src_fallback(b)},psrk.popup.close=function(a){var b=$("#"+a);return psrk.mobile.iOS_popup_close(b)?!1:(b.removeClass("visible"),b.removeAttr("data-iosfix"),void $(document).off("touchmove",psrk.popup.doc_ontouchmove))},psrk.popup.overlay=function(a,b){var c="psrk-popup-overlay",d=$("#"+c);a?$(document.body).append(d[0]?d:"<div id='"+c+"'"+(b?' class="dummy" onclick=""':"")+"/>"):d.remove()},psrk.popup.scroll_ontouchstart=function(a){$(document).on("touchmove",psrk.popup.doc_ontouchmove),psrk.popup.touchstart_y=a.originalEvent.touches?a.originalEvent.touches[0].clientY:a.clientY},psrk.popup.doc_ontouchmove=function(a){a.preventDefault()},psrk.popup.scroll_ontouchmove=function(a){var b=$(a.currentTarget),c=a.originalEvent.touches?a.originalEvent.touches[0].clientY:a.clientY;b.scrollTop()+b.height()>=b.prop("scrollHeight")-b.find(".android-scroll").height()&&c<=psrk.popup.touchstart_y&&a.preventDefault(),a.stopPropagation()},psrk.popup.scroll_ontouchend=function(){$(document).off("touchmove",psrk.popup.doc_ontouchmove)},psrk.message=function(a,b){b=b||{};var c="psrk-message",d=$("#"+c);if(!d[0]&&document.body&&(d=$(psrk.cE("div",document.body)).attr({id:c,"class":"psrk-popup"})),d.attr({"class":"psrk-popup"}),a){"undefined"==typeof b.overlay||b.overlay?psrk.popup.overlay(!0):psrk.popup.overlay(),setTimeout(function(){d.addClass("visible")},0),a=decodeURI(a),b.type&&$(d).addClass("psrk-"+b.type),b.title||b.confirm?d.removeClass("psrk-status"):(b.title=a,d.addClass("psrk-status")),a=b.confirm||b.title?a:"<b>"+a+"</b>";var e=b.confirm?"<button onClick='psrk.message()'>Ok</button>":"",f="<div class='psrk-popup-header'><h3>"+(b.title||"Warning")+"</h3>";f+=b.close?"":"<a title='Close' onClick='psrk.message()'></a>",f+="</div>";var g="<div class='psrk-popup-content'><div class='psrk-popup-content-inner'>"+a+e+"</div></div>";if(d.html(f+g).css({width:b.width?b.width+"px":""}),b.target){var h=$("#"+b.target);d.css({top:h.offset().top+h.outerHeight(!0)+20+"px",left:h.offset().left+"px",width:h.outerWidth(!0)+"px"})}else if(b.parent){var i=$("#"+b.parent);d.css({top:i.offset().top+"px",left:i.offset().left+(i.outerWidth()-d.outerWidth())/2+"px"})}else d.css({top:$(window).scrollTop()+($(window).height()-d.outerHeight())/2+"px",left:$(window).scrollLeft()+($(window).width()-d.outerWidth())/2+"px"});setTimeout(function(){$("#"+c+" button").focus()},100),b.close&&setTimeout(function(){d.removeClass("visible")},2e3)}},psrk.size=function(a){var b=0;for(var c in a)a.hasOwnProperty(c)&&b++;return b},psrk.cE=function(a,b){var c=document.createElement(a);return b&&b.appendChild(c),c},psrk.gE=function(a){return document.getElementById(a)},psrk.debug=function(a){$("#debug").html(a)},psrk.cancelBubble=function(a){var a=a||window.event;a.cancelBubble=!0,a.stopPropagation&&a.stopPropagation()},psrk.safeClick=function(a,b,c){var d=this;a.on("touchend",function(a){clearTimeout(d.clickTimeout),d.touch=1,d.clickTimeout=setTimeout(function(){d.touch=0},500),b(a),c&&a.preventDefault()}),a.click(function(a){return d.touch?(clearTimeout(d.clickTimeout),d.touch=0,!1):(b(a),void(c&&a.preventDefault()))})},psrk.engNotation=function(a){for(var b=[{divider:1e6,suffix:"M"},{divider:1e3,suffix:"K"}],c=0;c<b.length;c++)if(a>=b[c].divider){a=(a/b[c].divider).toFixed(2).replace(".00",""),a.indexOf(".")&&(a=a.replace(/0$/,"")),a+=b[c].suffix;break}return a},psrk.get_viewport=function(){var a=window,b="inner";return"innerWidth"in window||(b="client",a=document.documentElement||document.body),{width:a[b+"Width"],height:a[b+"Height"]}},psrk.geocode=function(a,b){var c=psrk.url.cdn+"/webservices/geopicker/geocoder.d.js?callback=?&location="+a;$.getJSON(c,function(a){b(a)})},psrk.autoFormat=function(a,b){function c(b){if(a){b[0].value.length<b.format_max_size&&b.format_groups.length>1&&a(1,b);var c=function(a,b){var c=1;switch(a){case"a":var d=/[A-Za-z0-9 \-\'\.]/;d.test(b)||(c=0);break;case"d":var d=/[0-9\.]/;d.test(b)||(c=0);break;case"c":var d=/[A-Za-z \-\'\.]/;d.test(b)||(c=0)}return c},d=b.no_format?b[0].value.split(""):b[0].value.split(b.format_separator),e=1;if(b.no_format)for(var f=0;f<d.length&&(e=c(b.no_format,d[f]),e);f++);else for(var g=1==b.format_groups.length?d.length:b.format_groups.length,f=0;g>f&&e;f++)if(d[f])for(var h=1==b.format_groups.length?b.format_groups[0].type:b.format_groups[f].type,i=0;i<d[f].length&&(e=c(h,d[f][i]),e);i++);e||(a(2,b),setTimeout(function(){b[0].focus(),b[0].select()},0))}}function d(a){if("undefined"!=typeof a.selectionStart)return a.selectionStart;var b=document.selection.createRange().duplicate();return b.moveEnd("character",a.value.length),""==b.text?a.value.length:a.value.lastIndexOf(b.text)}function e(a){if("undefined"!=typeof a.selectionEnd)return a.selectionEnd;var b=document.selection.createRange().duplicate();return b.moveStart("character",-a.value.length),b.text.length}function f(a,b){if(a.createTextRange){var c=a.createTextRange();c.move("character",b),c.select()}else a.selectionStart=b,a.selectionEnd=b}var g;g=b?"object"==typeof b?$(b).find('input[type="text"]'):$("#"+b+' input[type="text"]'):$('input[type="text"]'),g.each(function(){function b(a){if(a[0].value&&!a.no_format){var b=void 0;1==a.format_groups.length&&"d"==a.format_groups[0].type&&-1!=g[0].value.indexOf(".")&&(b=g[0].value.split(".")[1],g[0].value=g[0].value.split(".")[0]);var c=new RegExp(a.format_separator,"g");a[0].value=a[0].value.replace(c,"");var d=a[0].value.split("");if(1==a.format_groups.length)for(var e=d.length;e-a.format_groups[0].size>0;)d.splice(e-a.format_groups[0].size,0,a.format_separator),e-=a.format_groups[0].size;else for(var f=0;f<a.format_groups.length-1;f++)d.splice(a.format_groups[f].stop+1,0,a.format_separator);a[0].value=d.join("")+(b?"."+b:"")}}var g=$(this),h=$(this).attr("data-format");if(h){h.indexOf("{")&&(g.format_max_size=parseInt(h.substr(h.indexOf("{")+1,h.indexOf("}"))),h=h.replace(/\{.+\}/,"")),g.format_groups=[];var i=0;if(-1!=h.indexOf("[")){for(;-1!=h.indexOf("\\");){h=h.replace("\\","");var j=h.substr(0,-1!=h.indexOf("\\")?h.indexOf("\\"):h.indexOf("["));h=-1!=h.indexOf("\\")?h.replace(j+"\\","\\"):h.replace(j+"[","[");var k={type:j[0],size:parseInt(j.substr(1)),stop:0==i?parseInt(j.substr(1))-1:g.format_groups[i-1].stop+parseInt(j.substr(1))+1};g.format_groups.push(k),i++}h=h.replace("[",""),h=h.replace("]",""),g.format_separator=h}else g.no_format=h.replace("\\","");if(!g.format_max_size&&g.format_groups.length>1)for(g.format_max_size=0,i=0;i<g.format_groups.length;i++)g.format_max_size+=g.format_groups[i].size,i!=g.format_groups.length-1&&g.format_max_size++;else g.format_max_size||(g.format_max_size=9999999);1==h.length||g.no_format?(b(g),g.keypress(function(a){if(13==a.keyCode)return void c(g);var b=a.charCode?a.charCode>=48&&a.charCode<=57:a.keyCode>=48&&a.keyCode<=57,h=0;1==g.format_groups.length&&"d"==g.format_groups[0].type&&46==a.which&&-1==g[0].value.indexOf(".")&&(h=1);var i=a.charCode?a.charCode>=65&&a.charCode<=90||a.charCode>=97&&a.charCode<=122:a.keyCode>=65&&a.keyCode<=90||a.keyCode>=97&&a.keyCode<=122,j=b||i||h,k=a.charCode?String.fromCharCode(a.charCode)==g.format_separator:String.fromCharCode(a.keyCode)==g.format_separator,l=8==a.keyCode||9==a.keyCode||a.keyCode>=35&&a.keyCode<=40||46==a.keyCode&&!a.which;if((!g.no_format||9999999!=g.format_max_size)&&(l||a.preventDefault(),j||k)){var m=1,n=0,o=0;1==g.format_groups.length&&"d"==g.format_groups[0].type&&-1!=g[0].value.indexOf(".")&&(o=g[0].value.split(".")[1].length+1);var p=g[0].value.split(""),q=d(a.target),r=e(a.target);(p.length<=g.format_max_size+o||1==g.format_groups.length)&&(q==e(a.target)?(a.charCode?p.splice(q,0,String.fromCharCode(a.charCode)):p.splice(q,0,String.fromCharCode(a.keyCode)),p.length>g.format_max_size+o&&(m=0)):a.charCode?p.splice(q,r-q,String.fromCharCode(a.charCode)):p.splice(q,r-q,String.fromCharCode(a.keyCode)));var s=q+1;if(1==g.format_groups.length){var t=p.length;for(n=0;n<p.length;n++)p[n]==g.format_separator&&(s--,t--);if(!g.format_max_size||t<=g.format_max_size+o){g[0].value=p.join("");var u=void 0;1==g.format_groups.length&&"d"==g.format_groups[0].type&&-1!=g[0].value.indexOf(".")&&(u=g[0].value.split(".")[1],g[0].value=g[0].value.split(".")[0],t-=u.length+1);var v=new RegExp(g.format_separator,"g");for(p=g[0].value.replace(v,"").split("");t-g.format_groups[0].size>0;)p.splice(t-g.format_groups[0].size,0,g.format_separator),t-=g.format_groups[0].size,s++;g[0].value=p.join(""),"undefined"!=typeof u&&(g[0].value=g[0].value+"."+u),f(a.target,s)}}else if(p.length<=g.format_max_size+o){for(n=0;n<p.length;n++)p[n]==g.format_separator&&p.splice(n,1);for(n=0;n<g.format_groups.length-1;n++)p.length>=g.format_groups[n].stop+1&&p.splice(g.format_groups[n].stop+1,0,g.format_separator),s==g.format_groups[n].stop+1&&s++;p.length>g.format_max_size+o&&(m=0),m&&(g[0].value=p.join(""),f(a.target,s))}}}),1==g.format_groups.length&&g.keyup(function(a){if(8==a.keyCode||46==a.keyCode&&!g.no_format){var b=d(a.target),c=new RegExp(g.format_separator,"g"),e=void 0;1==g.format_groups.length&&"d"==g.format_groups[0].type&&-1!=g[0].value.indexOf(".")&&(e=g[0].value.split(".")[1],g[0].value=g[0].value.split(".")[0]),g[0].value=g[0].value.replace(c,"");for(var h=g[0].value.split(""),i=h.length;i-g.format_groups[0].size>0;)h.splice(i-g.format_groups[0].size,0,g.format_separator),i-=g.format_groups[0].size;g[0].value=h.join(""),"undefined"!=typeof e&&(g[0].value=g[0].value+"."+e),f(a.target,b)}}),a&&g.blur(function(a){c(g)})):alert("data-format is incorrect")}})},psrk.cookie={set:function(a,b,c,d,e,f){document.cookie=a+"="+escape(b)+(c?"; expires="+c.toGMTString():"")+(d?"; path="+d:"")+(e?"; domain="+e:"")+(f?";secure":"")},get:function(a){for(var b=a+"=",c=b.length,d=document.cookie.length,e=0;d>e;){var f=e+c;if(document.cookie.substring(e,f)==b)return this.getCookieVal(f);if(e=document.cookie.indexOf(" ",e)+1,0==e)break}return null},getCookieVal:function(a){var b=document.cookie.indexOf(";",a);return-1==b&&(b=document.cookie.length),unescape(document.cookie.substring(a,b))}},psrk.support={},psrk.support.touch=function(){if("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)$("html").addClass("psrk-touch");else{var a="modernizr",b=" -webkit- -moz- -o- -ms- ".split(" "),c=function(b,c,d,e){var f,g,h,i=document.createElement("div"),j=document.body,k=j?j:document.createElement("body");if(parseInt(d,10))for(;d--;)h=document.createElement("div"),h.id=e?e[d]:a+(d+1),i.appendChild(h);return f=["&#173;",'<style id="s',a,'">',b,"</style>"].join(""),i.id=a,(j?i:k).innerHTML+=f,k.appendChild(i),j||(k.style.background="",docElement.appendChild(k)),
g=c(i,b),j?i.parentNode.removeChild(i):k.parentNode.removeChild(k),!!g};c(["@media (",b.join("touch-enabled),("),a,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){bool=9===a.offsetTop,bool&&$("html").addClass("psrk-touch")})}},$(function(){psrk.support.touch()}),psrk.iwo={fields:{},current_field_id:!1,init_comboboxes:function(){for(var a=$(".input_with_options"),b=0;b<a.length;b++)this.fields[a[b].id]=this.getField(a[b]);this.inputFromSelect();for(id in this.fields){var c=document.getElementById(id);if(c&&"INPUT"==c.tagName&&!$(c).hasClass("rendered")){var d=this,e=document.getElementById(c.id+"-options");if(!e){e=this.fields[id].options.length?document.createElement("UL"):document.createElement("DIV"),e.id=c.id+"-options";for(var b=0;b<this.fields[id].options.length;b++){var f=d.setOption(id,this.fields[id].options[b]);e.appendChild(f)}if("UL"==e.tagName&&("select"!=$(c).attr("data-type")||$(c).attr("data-iwo-any"))){var f=d.setOption(id,"select"!=$(c).attr("data-type")||$(c).attr("data-editable")?"Other":"Any");e.appendChild(f)}}e.className="psrk-custom-list",$(c).attr("data-iwo-close")||$(e).click(function(a){var b=a.target;if("A"==b.tagName){a.preventDefault();var c=b.getAttribute("data-field-id");if(c){d.setCurrentID(b.getAttribute("data-field-id"));var e=$("#"+b.getAttribute("data-field-id")),f="Other"==$(b).text()&&"select"!=e.attr("data-type")?"":$(b).text();return e.val(f),e.change(),d.closeOptions(),d.setFocusOnInput(),!1}d.closeOptions()}}),$(c).focus(function(){var a=d.getCurrentID();this.id!=a&&$("#"+a+"-options").is(":visible")&&d.closeOptions(),d.setCurrentID(this.id),$(this).parent().parent().addClass("focus")}),$(c).blur(function(){$(this).removeAttr("idx"),$("#"+$(this).attr("id")+"-options a").removeClass("hover"),$(this).parent().parent().removeClass("focus")}),!$(c).attr("data-no-keyboard")&&this.fields[id].options.length&&$(c).keydown(function(a){var b=this;if(setTimeout(function(){$(b).change()},5),"38"==a.keyCode||"40"==a.keyCode){d.openOptions(),$("#"+$(this).attr("id")+"-options a").removeClass("hover"),d.addDocClickHandler();var c=$(this).attr("idx");$(this).attr("idx",c?parseInt(c)+("40"==a.keyCode?1:-1):"1"),$("#"+$(this).attr("id")+"-options li:nth-child("+$(this).attr("idx")+") a")[0]||$(this).attr("idx",parseInt(c));var e=$(this).attr("id")+"-options li:nth-child("+$(this).attr("idx")+") a";$(this).val($("#"+e).html()),$("#"+e).addClass("hover")}else if("13"==a.keyCode)$("#"+$(this).attr("id")+"-options").is(":visible")&&(a.preventDefault(),d.closeOptions());else{if("9"!=a.keyCode)return;d.closeOptions()}});var g=document.createElement("DIV");if(g.className="psrk-iwo","select"!=$(c).attr("data-type")||$(c).attr("data-editable")||$(g).addClass("non-editable"),c.parentNode.insertBefore(g,c),g.appendChild(c),this.fields[id]["location-api"]&&navigator.geolocation){var h=document.createElement("SPAN");h.innerHTML="",h.className="unit pre location-api",h.setAttribute("data-field-id",id);var a=this.fields[id]["location-api"];h.onclick=function(){func=window;for(var b=a.split("."),c=0;c<b.length;c++)func=func[b[c]];func(document.getElementById($(this).attr("data-field-id")))},c.parentNode.insertBefore(h,c)}if(this.fields[id].prefix)for(var b=0;b<this.fields[id].prefix.length;b++)if(this.fields[id].prefix[b]){var h=document.createElement("SPAN");h.innerHTML=this.fields[id].prefix[b],h.className="unit pre",c.parentNode.insertBefore(h,c)}var h=document.createElement("A");h.className="activator";var i=1;if($(e).children().length||(i=0),$(e).children().each(function(){$(this).hasClass("psrk-mobileonly")||(i=0)}),i&&$(h).addClass("psrk-mobileonly"),h.setAttribute("data-field-id",id),c.parentNode.insertBefore(h,c),$.each([h,c],function(a,b){("INPUT"!=b.tagName||"select"==$(b).attr("data-type")&&!$(b).attr("data-editable"))&&(b.onclick=function(a){var b=psrk.iwo.getCurrentID(),c="select"==$(this).attr("data-type")?$(this).attr("id"):$(this).attr("data-field-id");c!=b&&d.closeOptions(),d.setCurrentID(c);var e=(document.getElementById(c),document.getElementById(c+"-options"));$(e).is(":visible")?d.closeOptions():(d.openOptions(),d.addDocClickHandler())})}),$(e).html()||$(h).addClass("hide"),this.fields[id].postfix)for(var b=this.fields[id].postfix.length-1;b>=0;b--){var h=document.createElement("SPAN");h.innerHTML=this.fields[id].postfix[b],h.className="unit",c.parentNode.insertBefore(h,c)}var g=document.createElement("SPAN");g.className="input_wrapper",c.parentNode.insertBefore(g,c),g.appendChild(c),$(c).parents(".input_with_label").length&&$(c.parentNode.parentNode).addClass("overflow"),$("body").append(e),$(c).addClass("rendered"),$(c).attr("data-iwo-chtree")&&this.checkboxTree.init($(c).attr("id"),$(c).attr("id")+"-options")}}},getField:function(el){var obj={prefix:[],postfix:[],options:[]};for(key in obj){var val=$(el).data("iwo-"+key)||!1;val&&(0==val.indexOf("[")&&val.indexOf("]")==val.length-1&&(val=eval(val)),obj[key].push(val))}for(var arr=["location-api"],i=0;i<arr.length;i++){var val=$(el).data("iwo-"+arr[i]);val&&(obj[arr[i]]=val)}return obj},setOption:function(a,b){var c=document.createElement("LI"),d=document.createElement("A");return d.setAttribute("data-field-id",a),c.appendChild(d),d.innerHTML=b,c},addDocClickHandler:function(){var a=this;$(document).bind("click.iwo",function(b){a.clickIsOutsideOptions(b)&&($(document).unbind("click.iwo"),a.closeOptions())})},clickIsOutsideOptions:function(a){id=psrk.iwo.getCurrentID();var b;document.getElementById(id);if(!a)var a=window.event;if(a.target&&(b=a.target),$(b).closest($("#"+id+"-options")).length)return!1;if("select"==$("#"+id).attr("data-type")){if($(b).closest($("#"+id).closest($(".psrk-iwo"))).length)return!1}else if($(b).hasClass("activator"))return!1;return!0},closeOptions:function(){id=this.getCurrentID(),$("#"+id+"-options").hide();var a=$("#"+id).closest(".psrk-iwo");a.removeClass("focus open")},setFocusOnInput:function(){id=this.getCurrentID();var a=document.getElementById(id);a&&(""==a.value||document.all?a.focus():$(a).is("[readonly]")?a.focus(!0):(a.setAttribute("readonly","readonly"),a.focus(!0),a.removeAttribute("readonly")))},openOptions:function(){var a=this.getCurrentID(),b=$("#"+a+"-options"),c=$("#"+a).closest(".psrk-iwo"),d=0;c.hasClass("overflow")&&b.css({left:c.position().left+"px"});var e=this.parentInFixed(c);e?(e.append(b),d+=e.scrollTop()-e.offset().top):$("body").append(b),b.show(),b.css({position:"absolute",left:Math.round(c.offset().left)+"px",top:Math.round(c.offset().top+c[0].offsetHeight)+d+"px",width:Math.round(c[0].offsetWidth)+"px"});var f=$(window).height()+$(window).scrollTop()-c.offset().top-20+"px";if(e){var g=e.height()+parseInt(e.css("padding-bottom"))-c.outerHeight(),h=g+e.offset().top-c.offset().top;f=.8*g+"px"}if(b.css("max-height",f),c.addClass("focus open"),e&&b.outerHeight()>h){var i=b.outerHeight()-h+10;e.animate({scrollTop:e.scrollTop()+i},500)}},setCurrentID:function(a){this.current_field_id=a},getCurrentID:function(){return this.current_field_id},changeOptions:function(a,b){var c=$("#"+a+"-options");c.html(b);var d=$('.activator[data-field-id="'+a+'"]');b?d.removeClass("hide"):d.addClass("hide");var e=1;c.children().each(function(){$(this).hasClass("psrk-mobileonly")||(e=0)}),e?d.addClass("psrk-mobileonly"):d.removeClass("psrk-mobileonly")},inputFromSelect:function(){var a=this;$('select[class="iwo_select"]').each(function(){var b=$(this),c=b.attr("id"),d=[],e=$("#"+c+" option");e.each(function(){$(this).val()&&$(this).val()!=b.attr("data-iwo-default")&&d.push($(this).html())});var f=c+"_input";a.fields[f]={prefix:b.attr("data-iwo-prefix"),suffix:b.attr("data-iwo-suffix"),options:d};var g=$('<input id="'+f+'" type="text" data-type="select"'+(b.attr("data-editable")?' data-editable="1"':' readonly=""')+" >").appendTo(b.parent());b.each(function(){$.each(this.attributes,function(){if(this.specified){if(this.name.match(/^class|id|name|style|data-editable$/))return;g.attr(this.name,this.value)}})}),g.val(b.find(":selected").text()),g.change(function(){var a=$(this).val();if($(this).attr("data-editable")){var d=0;$("#"+c+" option").each(function(){return $(this).text()==a?(d=1,!1):void 0}),d||($("#"+c+" option").filter(function(){return $(this).attr("data-iwo-added")}).remove(),$('<option value="'+a+'" data-iwo-added=1>'+a+"</option>").appendTo(b))}return"Any"==a?void b.val(""):"Other"==a&&b.attr("data-editable")?(b.val(""),void g.val("")):($("#"+c+" option").filter(function(){return $(this).text()==a}).attr("selected",!0),void $("#"+c).change())}),b.addClass("rendered").hide()})},setSelectValue:function(a,b){var c=$(a).attr("id"),d=$("#"+c+"_input");b?($(a).val(b),d.val($("#"+c+' option[value="'+b+'"]').html())):($(a).val(""),$("#"+c+" option").removeAttr("selected"),d.val(d.attr("data-editable")?"":"Any")),$(a).change()},disable:function(){$(".rendered").each(function(){var a=$(this);if("select"==$(this).attr("data-type")){var b=$("#"+a.attr("id")+"-hidden");b[0]?(a.attr({"data-crit-link":b.attr("data-crit-link"),name:b.attr("name")}),a.parents(".psrk-iwo:first")[0]&&a.parents(".psrk-iwo:first").after($(this)).remove(),b.remove()):a.parents(".psrk-iwo:first").remove()}else a.parents(".psrk-iwo:first")[0]&&a.parents(".psrk-iwo:first").after($(this)).remove();a.val("").removeClass("rendered")})},parentInFixed:function(a){for(var b=a.parent(),c=!1;!b.is("body");){if("fixed"===b.css("position"))return c||b;c||"auto"!==b.css("overflow")&&"scroll"!==b.css("overflow")&&"y-scroll"!==b.css("overflow")||(c=b),b=b.parent()}return!1},toggleLocationApi:function(a,b){var c=a.parents(".psrk-iwo:first").find(".location-api");b?c.show():c.hide()},checkboxTree:function(){var a=function(){this.init=function(a,b){var c=this,d=$("#"+a),e=$("#"+b);d[0]&&(e.find('input[type="checkbox"]').click(function(){c.checkBox(this,1,a)}),e.find("a").bind("click.widget",function(){c.showHide(this)}),$('<input type="hidden" id="'+a+'-hidden" name="'+d.attr("name")+'" data-crit-link="'+d.attr("data-crit-link")+'" />').insertAfter(d),$(d).removeAttr("name").removeAttr("data-crit-link").addClass("customwidget"),$(window).bind("statechange",function(){c.setState(a,b)}),d.is("[readonly]")||d.keyup(function(){$("#"+a+"-hidden").val($(this).val());var b=new RegExp(/, | ,/g),d=$(this).val().replace(b,",").toLowerCase().split(",");e.find('input[type="checkbox"]').each(function(){var b=$(this).parents("li:first").parents("li:first"),e=b[0]?b.find('input[type="checkbox"]:first'):void 0,f=$(this).siblings("label").html().toLowerCase(),g=(e?e.siblings("label").html().toLowerCase()+" - ":"")+$(this).siblings("label").html().toLowerCase();-1==$.inArray(f,d)&&-1==$.inArray(g,d)||$(this).is(":checked")?-1==$.inArray(f,d)&&-1==$.inArray(g,d)&&$(this).is(":checked")&&(!e||e&&!e.is(":checked"))&&($(this).removeAttr("checked"),c.checkBox(this,1,a,1)):($(this).attr("checked","checked"),c.checkBox(this,1,a,1))})}))},this.checkBox=function(a,b,c,d){var e=this,f=$(a);f=f.is("li")?f:f.parents("li").first();var g=f.find('input[type="checkbox"]:first').is(":checked");if(b){var h=f.find('input[type="checkbox"]');g?(h.attr("checked","checked"),f.find('input[type="checkbox"]').removeClass("indeterminate")):h.removeAttr("checked")}var i=f.parent().parent("li");if(i[0]){var j=g;j?i.find('input[type="checkbox"]:first').addClass("indeterminate"):i.find('input[type="checkbox"]:first').removeClass("indeterminate"),f.siblings().each(function(){$(this).find('input[type="checkbox"]:first').is(":checked")?i.find('input[type="checkbox"]:first').addClass("indeterminate"):j=0}),j?i.find('input[type="checkbox"]:first').attr("checked","checked").removeClass("indeterminate"):i.find('input[type="checkbox"]:first').removeAttr("checked"),e.checkBox(i[0],0,c,d)}else d||e.setValues(f.parent(),1,c)},this.setValues=function(a,b,c){var d=this,e=$("#"+c),f=$("#"+c+"-hidden"),g=new RegExp(/, | ,/g),h=e.val().replace(g,",").split(",");h[0]||(h=[]);var i=f.val().replace(g,",").split(",");i[0]||(i=[]);var j=a.parent("li"),k=j[0]?j.find('input[type="checkbox"]:first'):void 0;a.children("li").each(function(){for(var a=$(this).find('input[type="checkbox"]:first'),b="no",j=0;j<h.length;j++){var l=(k&&!e.attr("data-wparent")?k.siblings("label").html()+" - ":"")+$(this).find("label").html();$.trim(l.toLowerCase())==$.trim(h[j].toLowerCase())&&(b=j)}if(k&&k.is(":checked")||!a.is(":checked")){if("no"!=b){h.splice(b,1),e.val(h.join(", "));for(var m=a.val().replace(g,",").split(","),j=0;j<m.length;j++){var n=$.inArray(m[j],i);i.splice(n,1)}f.val(i.join(", "))}}else a.is(":checked")&&"no"==b&&(h.push((k&&!e.attr("data-wparent")?k.siblings("label").html()+" - ":"")+a.siblings("label").html()),e.val(h.join(", ")),i.push(a.val()),f.val(i.join(", ")));$(this).children("ul")[0]&&d.setValues($(this).children("ul"),0,c)})},this.showHide=function(a){$(a).parent().find("ul").toggle(),$(a).toggleClass("open")},this.setState=function(a,b){var c=this,d=$("#"+b),e=window.History&&History.getState&&History.getState().cleanUrl.split("?")[1]?decodeURIComponent(History.getState().cleanUrl.split("?")[1]):null,f=[],g=$("#"+a),h=$("#"+a+"-hidden"),i=h.attr("name").toLowerCase(),j=g.val();g.is("[readonly]")&&(g.val(""),h.val(""));var k=new RegExp(/, | ,/g);if(e&&-1!=e.indexOf("ajax=1")){e=e.replace(/\+/g," "),e=e.replace(k,",").toLowerCase();var l=P2H.lib.URItoJSON(e);f=l[i]?l[i].split(","):[]}else j&&(f=j.replace(k,",").toLowerCase().split(","),$("#"+a+"-hidden").val(""),d.find('input[type="checkbox"]').removeAttr("checked"));var m=function(a,b,d,e){if(-1!=$.inArray($(a).val().toLowerCase(),b))$(a).attr("checked","checked"),c.checkBox(a,1,d);else{e&&($(a).removeAttr("checked"),c.checkBox(a,1,d));var f=$(a).parents("li:first").children("ul");f[0]&&f.children("li").find('input[type="checkbox"]:first').each(function(){m(this,b,d,e)})}};f.length&&(d.find("ul:first").children("li").find('input[type="checkbox"]:first').each(function(){m(this,f,a,e)}),g.is("[readonly]")||($.each(f,function(a,b){f[a]=b.charAt(0).toUpperCase()+b.slice(1)}),g.val(f.join(", ")),h.val(f.join(", "))))},this.deselectAll=function(a){var b=this;$("#"+a+"-hidden").val(""),$("#"+a+"-options").find('input[type="checkbox"]').each(function(){$(this).removeAttr("checked"),b.checkBox(this,1,a,1)})}};return new a}()},psrk.selectWidget={toggle:function(a,b){var c="string"==typeof a?$("#"+a):$(a).closest(".select-widget"),d="undefined"!=typeof b?b:!c.hasClass("active");d?(c.addClass("active"),this.addDocClickHandler(c),this.adjustHeight(c)):(c.removeClass("active"),$(document).off("click.select"))},setOption:function(a,b){var c,d;"string"==typeof a?(c=$("#"+a),d=c.find('a[data-option="'+b+'"]')):(c=$(a).closest(".select-widget"),d=$(a)),c&&d&&(c.find("li").each(function(){var a=$(this);if(a.removeClass("selected"),a.is(d.parent())){var b=$(c.find("a")[0]),e=b.attr("data-prefix")||"",f=d.html();0==f.indexOf(e)?b.html(" "+f):b.html(e+" "+f),$(this).addClass("selected")}}),this.toggle(a,!1))},addDocClickHandler:function(a){var b=this;$(document).on("click.select",function(c){b.clickOutside(c,a)&&($(document).off("click.select"),b.toggle(a))})},clickOutside:function(a,b){if(!a)var a=window.event;return $(a.target).closest(b).length<1},adjustHeight:function(a){var b=10,c=a.find("ul");c.css({top:"auto",height:"auto"});var d=c.offset().top-$(document).scrollTop(),e=$(window).height()-(d+c.outerHeight());b>e&&(2*b>d+e?c.css({top:c.position().top-d+b+"px",height:$(window).height()-2*b+"px"}):c.css({top:c.position().top+e-b+"px"}))}},psrk.autocomplete=function(){var a=function(){this.enable=function(a,b,c,d){var e=this;b&&(e.country=b.country,e.region=b.region,e.types=b.types,e.include_parents=b.include_parents),e.res_window=$("#psrk-autocomplete"),0==e.res_window.length&&(e.res_window=$('<ul id="psrk-autocomplete">').addClass("psrk-custom-list").appendTo($("body"))),e.obj=$(a),c&&(e.obj.attr("data-geoidfield",c),e.geoIdField=e.obj.parents("form").find("[name="+e.obj.attr("data-geoidfield")+"]")),d&&(e.obj.attr("data-parentsfield",d),e.parentsField=e.obj.parents("form").find("[name="+e.obj.attr("data-parentsfield")+"]")),e.obj.attr("autocomplete","off"),e.obj.blur(function(){window.autocomplete_timeout&&clearTimeout(autocomplete_timeout),e.res_window.hide()}),e.obj.keyup(function(a){if(e.obj=$(this),!a.altKey&&!a.ctrlKey)if(38==a.keyCode||40==a.keyCode){if(!e.res_window.is(":visible"))return;e.arrow_navigation=1,e.res_window.find("a").removeClass("hover");var b=e.obj.attr("idx");e.obj.attr("idx",b?parseInt(b)+("40"==a.keyCode?1:-1):"1"),e.res_window.find("li:nth-child("+e.obj.attr("idx")+") a")[0]||e.obj.attr("idx",parseInt(b));var c=e.res_window.find("li:nth-child("+e.obj.attr("idx")+") a");e.obj.attr("data-geoidfield")&&e.geoIdField.val(c.attr("data-geoid")),e.obj.attr("data-parentsfield")&&e.parentsField.val(c.attr("data-parentsfield")),e.obj.val(c.html()),c.addClass("hover")}else if(13==a.keyCode){if(e.enter_pressed=1,window.autocomplete_timeout&&clearTimeout(autocomplete_timeout),e.res_window.is(":visible"))return e.res_window.hide(),!1}else{e.arrow_navigation=0;var d=new RegExp("17|109|110|222|173|188|32|46|8");if(!(a.keyCode>=48&&a.keyCode<=90||a.keyCode>=96&&a.keyCode<=105||d.test(a.keyCode)))return;if(e.enter_pressed=0,("46"==a.keyCode||"8"==a.keyCode)&&(e.del=1),window.autocomplete_timeout&&clearTimeout(autocomplete_timeout),e.obj.val().length<3)return e.obj.val().length||e.res_window.hide(),void(e.del=0);autocomplete_timeout=setTimeout(function(){if(e.obj.val()){var a=psrk.url.cdn_search+"/autocomplete/get?string="+e.obj.val()+"&types="+(e.types||"")+"&country="+(e.country||"")+"&parent="+(e.region||"")+"&include_parents="+(e.include_parents||"")+"&callback=psrk.autocomplete.callback&_="+(new Date).getTime();psrk.include_script(a,"autocomplete_script")}else e.res_window.hide()},400)}}),e.obj.keydown(function(a){e.arrow_navigation&&13==a.keyCode&&(e.arrow_navigation=0,a.preventDefault())})},this.callback=function(a){var b=this;if(!b.enter_pressed&&b.obj.is(":focus")){if(b.res_window.html(""),b.obj.attr("data-geoidfield")&&(b.geoIdField=b.obj.parents("form").find("[name="+b.obj.attr("data-geoidfield")+"]"),b.geoIdField.val("")),b.obj.attr("data-parentsfield")&&(b.parentsField=b.obj.parents("form").find("[name="+b.obj.attr("data-parentsfield")+"]"),b.parentsField.val("")),b.obj.removeAttr("idx"),!a.results.length)return void b.res_window.hide();for(var c=0;c<a.results.length;c++){var d=psrk.cE("li",b.res_window[0]);$(psrk.cE("a",d)).mousedown(function(){return b.arrow_navigation=0,b.obj.val($(this).html()),b.obj.attr("data-geoidfield")&&b.geoIdField.val($(this).attr("data-geoid")),b.obj.attr("data-parentsfield")&&b.parentsField.val($(this).attr("data-parents")),b.res_window.hide(),b.obj.focus(),!1}).attr("href","#").attr("data-geoid",a.results[c].id).attr("data-parents",a.results[c].parents_string).html(a.results[c].pretty_name)}if(b.res_window.css({position:"absolute",width:b.obj.outerWidth(),top:b.obj.offset().top+b.obj.outerHeight(!0)+"px",left:b.obj.offset().left+"px"}).show(),a.results[0]){if(!b.del){var e=a.results[0].pretty_name,f=b.obj.val().length,g=e.length;if(b.obj.val().toLowerCase()!=e.substr(0,f).toLowerCase()||b.obj.val().toLowerCase()==e.toLowerCase())return;if(b.obj.val(b.obj.val()+e.substr(f)),b.obj.val($("<div>").html(b.obj.val()).text()),b.obj[0].createTextRange){var h=b.obj[0].createTextRange();h.moveStart("character",f),h.moveEnd("character",g),h.select()}else b.obj[0].selectionStart=f,b.obj[0].selectionEnd=g;b.obj.attr("data-geoidfield")&&b.geoIdField.val(a.results[0].id),b.obj.attr("data-parentsfield")&&b.parentsField.val(a.results[0].parents_string)}b.del=0}}}};return new a}(),psrk.printVersion=function(a){for(var b=a?"psrk.screenVersion()":"history.go(-1)",c=["link","style"],d=0;d<c.length;d++)for(var e=document.getElementsByTagName(c[d]),f=0;f<e.length;f++)if("print"==e[f].getAttribute("media"))if("link"==c[d]){var g=e[f].getAttribute("href");psrk.include_css(g,"print_version_css_"+d+"_"+f,"all")}else e[f].media="all",e[f].className="media_was_print";var h=document.getElementById("print_version");h?h.style.display="block":(psrk.include_style("#print_version {display:none};","print_version_css","print"),h=document.createElement("div"),h.setAttribute("id","print_version"),h.innerHTML="<div class='print_version_inner'>This is the printable version of the current page <div><a href='javascript:void(0)' onClick='javascript:window.print()'><b>Print page</b></a> &nbsp;-&nbsp; <a href='javascript:void(0)' onClick='"+b+"'><b>Back to original page</b></a></div></div>",document.body.insertBefore(h,document.body.firstChild)),scroll(0,0),window.print()},psrk.screenVersion=function(){for(var a=["link","style"],b=0;b<a.length;b++)for(var c=document.getElementsByTagName(a[b]),d=c.length-1;d>=0;d--)"link"==a[b]?0==c[d].id.indexOf("print_version_css")&&(c[d].media="print",c[d].parentNode.removeChild(c[d])):"media_was_print"==c[d].className&&(c[d].media="print",c[d].className="");var e=document.getElementById("print_version");e&&e.parentNode.removeChild(e);var f=document.getElementById("print_version_css");f&&f.parentNode.removeChild(f)},psrk.toggleDropDown=function(a,b){"none"==$("#"+b).css("display")?($("#"+b).show(),$(document).bind("click",function(c){if(!c)var c=window.event;return c.target&&(element=c.target),element==a?!1:$(element).closest($(a)).length?!1:($(document).unbind("click"),void $("#"+b).hide())})):($(document).unbind("click"),$("#"+b).hide());var c=$(a).position(),d=$(a).outerHeight();$("#"+b).css({position:"absolute",top:c.top+d+"px"})},psrk.mobile={is_iOS_no_toolbar:function(){return window.innerHeight-document.documentElement.clientHeight>59},iOS_popup_open:function(){if(navigator.userAgent.match(/(iPhone|iPod)/)){var a=arguments[0],b=arguments[1],c=Array.prototype.slice.call(arguments,2);"open-popup"!=history.state&&(history.replaceState("close-popup",document.title,document.location.href),history.pushState("open-popup",document.title),$(window).one("popstate",function(){a.removeAttr("data-history"),"function"==typeof b&&b(c)}),a.attr("data-history","1"))}},iOS_popup_close:function(a){return"1"==a.attr("data-history")&&"open-popup"==history.state?(window.history.back(),!0):!1}};

psrk=window.psrk||{},psrk.geopicker={conf:{},obj:{output:$("< >"),type:$("< >"),output_printable:$("< >"),output_full:$("< >"),layer:$("< >")},errorMessage:"",updateObjReferences:function(a){for(var b in a)this.obj[b]=$("#"+a[b])},load:function(a){var b=this;"preloaded"==a.presentation?a.seed=(new Date).getTime():b.buildInterface(a);for(var c in b.obj)b.obj[c]=$("#gp_"+c);if(b.conf_old=b.conf,b.conf=a,a.script_src=psrk.url.cdn+"/webservices/geopicker/load.d.js?&"+$.param(a),this.load_callback&&(a.script_src+="&load_callback=1"),a.script_id="gp_loader","popup"==a.presentation){if(a.source_id="gp_container",a.location_input){var d=$("#"+a.location_input);if(!d[0])return;d.attr("data-previous")!=d.val()||b.conf_old.hidden?(a.script_src=a.script_src.replace(/&location_string=[^&]*/,"")+"&location_string="+d.val(),d.attr("data-previous",d.val())):a.script_src=null,a.script_src_fallback=function(){var a=b.obj.output,c=b.obj.type;a[0]&&c[0]&&"pshark"==b.conf.engine&&("polygontool"==c.val()?a.val()||GeoPickerMap.clearPolygon():GeoPickerMap.updateCanvasTileSelections(a.val().split(",")))}}a.close_handler=function(){psrk.geopicker.closeHandler()},a.hidden?b.setHiddenMode(a):(psrk.popup.open(null,a),b.conf.autocomplete_checkboxes&&(b.updateOutputPrintable(),psrk.popup.open(null,a)))}else psrk.include_script(a.script_src,a.script_id)},inline:function(a){a.presentation="inline",this.load(a)},popup:function(a){a.presentation="popup",this.load(a)},enable:function(a){a.presentation="preloaded",this.load(a)},disable:function(){if(psrk.geopicker.conf.engine){this.removeViewportCallback(),window.GeoPickerMap&&"google"==this.conf.engine&&(GeoPickerMap.geo_toggle(!1),GeoPickerMap.geo_clearModes(),GeoPickerMap.exitDrawMode()),"popup"==this.conf.presentation&&(GeoPickerMap=null,$("#"+this.conf.location_input).attr("data-previous",""),$("#popup_gp_container, #gp_container, #gp_loader, #gp_geo_areas").remove(),delete this.popup.input);var a=this;$.each(this.obj,function(b){a.obj[b].val(null).html(""),"preloaded"!=psrk.geopicker.conf.presentation&&a.obj[b].remove()})}},setLoadCallback:function(a){this.load_callback=a},buildInterface:function(a){if(a.container_output){var b=$("#"+a.container_output);b.children("#gp_output").length||b.append('<input type="hidden" name="'+(a.name_output||"geopicker_output")+'" id="gp_output" />').append('<input type="hidden" name="'+(a.name_output_full||"geopicker_output_full")+'" id="gp_output_full" />').append('<input type="hidden" name="'+(a.name_type||"geopicker_type")+'" id="gp_type" />').append('<input type="hidden" name="'+(a.name_layer||"geopicker_layer")+'" id="gp_layer" />')}if(a.container_output_printable){var b=$("#"+a.container_output_printable);b.children("#gp_output_printable").length||b.append('<ul id="gp_output_printable"></ul>')}if(!a.hidden&&!$("#gp_container")[0]){var c=$(psrk.cE("div")).attr("id","gp_container");a.hide_tabs||$("<div/>").attr("id","gp_tabs").appendTo(c),$("<div/>").attr("id","gp_mode_toggle").appendTo(c).html(this.buildToggle());var d=psrk.cE("table",c[0]),e=psrk.cE("tbody",d),f=psrk.cE("tr",e),g=psrk.cE("td",f);g.id="gp_table_map",g.className="selected";var h=$(psrk.cE("div",g)).css({border:"1px solid #A5B8C8"}),i=a.height.indexOf("%")>0?parseInt(parseInt(a.height.replace("%",""))/100*$(window).height()):a.height;if("popup"==a.presentation){i=Math.min(i,$(window).height());var j=38,k=28,l=18,m=5,n=1,o=38,p=1;i=i-("on"==a.hide_tabs?0:j)-k-2*p-o-(a.height.indexOf("%")>0?l+2*m+2*n+o:l)}var q=a.hide_checkboxes?0:240,r="popup"==a.presentation?"100%":a.width?a.width.indexOf("%")>0?a.width:a.width-q+"px":"";$("<div/>").css({height:i+"px",width:r}).attr({id:"gp_map"}).appendTo(h),a.hide_checkboxes||$(psrk.cE("td",f)).css("width",q).html('<div id="gp_checkboxes" style="height:'+i+"px; width:"+q+'px"></div>').attr("id","gp_table_list"),"popup"==a.presentation&&$('<input type="button"/>').attr({id:"gp_popup_done",value:"Done"}).appendTo(c).click(function(){psrk.popup.close("popup_gp_container"),psrk.geopicker.closeHandlerAndOutput()}),"popup"==a.presentation?c.hide().appendTo(document.body):c.appendTo($("#"+a.container_input))}},setHiddenMode:function(a){var b=this.obj;if(a&&(b.type.val(a.type),b.output.val(a.input),b.output_full.val(a.input_full)),b.type.val().match(/polygontool|radius/))b.output_printable.html(b.output.val()?"<li>User defined shape <span title='remove' class='remove'><a onclick=\"psrk.geopicker.removeOutputItemHiddenMode(); return false;\" href='#'>&#215;</a></span></li>":"");else{for(var c=b.output_full.val()?b.output_full.val().split(","):[],d=[],e=0;e<c.length;e++){var f=c[e].split("|"),g=f[2]?" <span class='suffix'>("+f[2]+")</span>":"";d.push("<li>"+f[1]+g+" <span title='remove' class='remove'><a onclick=\"psrk.geopicker.removeOutputItemHiddenMode('"+f[0]+"');return false\" href='#'>&#215;</a></span></li>")}b.output_printable.html(d.join(""))}b.output_printable.toggle(Boolean(b.output_printable.html())),this.resetOnLocationChanged()},removeOutputItemHiddenMode:function(a){var b=this.obj.output,c=this.obj.output_full,d=b.val().split(","),e=c.val().split(",");if(a){for(var f=0;f<d.length;f++)if(d[f]==a)return d.splice(f,1),e.splice(f,1),this.popup.input=d.join(","),b.val(d.join(",")),c.val(e.join(",")),this.setHiddenMode(),void(window.GeoPickerMap&&this.removeSelectedArea(a))}else this.popup.input="",b.val(""),c.val(""),this.setHiddenMode(),window.GeoPickerMap&&this.removeDrawnShapeAndOutput()},closeHandler:function(a){if(this.obj.type.val().match(/polygontool|radius/)){var b=this.getOutputStructureShape();b.output||this.removeDrawnShape()}},closeHandlerAndOutput:function(){this.closeHandler(),this.updateOutput(!0),this.conf.autocomplete_checkboxes&&this.updateOutputPrintable()},loadCheckboxes:function(a,b,c,d,e){psrk.geopicker.loadRegionsHierarchy(a,b,c,d,"psrk.geopicker.loadCheckboxes_callback"),e&&(psrk.geopicker.hierarchy_callback=function(){GeoPickerMap.setCanvasTiles(a,e)})},loadRegionsHierarchy:function(a,b,c,d,e){var f=psrk.url.cdn+"/webservices/geopicker/get_areas.d.js?layer_type="+a+"&callback="+e+"&engine="+c;this.conf.adv_search_mode&&(f+="&new_struct=1"),b.geo_id&&"undefined"!=b.geo_id&&(f+="&geo_id="+b.geo_id),b.locale&&"undefined"!=b.locale&&(f+="&locale="+b.locale),d&&"undefined"!=d&&(f+="&app="+d);for(var g=5;g<arguments.length;g++)f+="&callback_param"+(g-4)+"="+arguments[g];psrk.include_script(f,"gp_geo_areas")},loadCheckboxes_callback:function(a){GeoPickerMap.setRegionsHierarchy(a);var b=$("#gp_checkboxes");if(this.hierarchy_callback&&(this.hierarchy_callback(),this.hierarchy_callback=null),b[0]){b.html("");var c=psrk.geopicker.getRegionsCheckboxes(a,!1,0);if(c&&(b.append(c),this.conf.autocomplete_checkboxes&&!b.parent().find(".autocomplete_input")[0])){var d=$('<div class="field"></div>');this.obj.autocomplete_field=$('<input type="text" class="autocomplete_input"></input>');var e=this.obj.autocomplete_field;d.append($("#_gp_output_printable")),d.append(e),b.before(d),e.keyup(function(){var a=e.val();if(a){var c=new RegExp(a,"gi");b.addClass("autocomplete_active"),b.find("label").each(function(){var a=$(this);a.html().match(c)?(a.parent().removeClass("hidden"),a.parents("a:first").removeClass("hidden")):(a.parent().addClass("hidden"),a.parents("a:first").addClass("hidden"))})}else b.find(".hidden").removeClass("hidden"),b.removeClass("autocomplete_active")}),this.updateCheckBoxesSize(),this.updateAutocompletePlaceholder()}}},getRegionsCheckboxes:function(a,b,c){c++;var d=GeoPickerMap,e=this,f=$(psrk.cE("ul")).attr("id",b?"checkboxes-"+b:"gp_regions_list");c>2&&f.css("display","none"),a=b?a.children:[a];for(var g=0;g<a.length;g++)if(a[g].id&&a[g].name){var h=$(psrk.cE("li")).addClass(g%2?"even":"odd"),i=$(psrk.cE("input")).attr({type:"checkbox",name:"geopicker_"+a[g].type,id:"geo_area_check_"+a[g].id,"data-id":a[g].id,value:a[g].name}).bind("click",function(a){GeoPickerMap.area_select(this.getAttribute("data-id"),this.value,this.checked),e.conf.autocomplete_checkboxes&&($("#gp_checkboxes").parent().find(".autocomplete_input").val("").trigger("keyup"),psrk.geopicker.updateOutputPrintable()),psrk.cancelBubble(a)});if(d.area_is_selected(a[g].id)&&i.prop("checked",!0),a[g].children&&a[g].children.length){var j=e.conf.adv_search_mode?'<span class="ps-checkbox"><label for="geo_area_check_'+a[g].id+'">'+a[g].name+"</label></span>":"<label>"+a[g].name+"</label>",k=$(psrk.cE("A")).html(j).attr({href:"javascript:void(0)","class":"checkbox-section"+(c>1?" closed":""),"data-id":a[g].id}).bind("click",function(){$("#checkboxes-"+this.getAttribute("data-id")).toggle(),$(this).toggleClass("closed"),this.blur()});a[g].county_name||i.insertBefore(k.find("label:first")),h.append(k).append(psrk.geopicker.getRegionsCheckboxes(a[g],a[g].id,c))}else{var l=$(psrk.cE("label")).attr("for","geo_area_check_"+a[g].id).html(a[g].name);$(psrk.cE("span")).addClass(e.conf.adv_search_mode?"ps-checkbox":"").append(i).append(l).appendTo(h)}d.area_is_partially_selected&&d.area_is_partially_selected(a[g].id)&&h.find("label:first").addClass("ps-ic-partial-checked"),e.conf.adv_search_mode&&h.find("label:first").click(function(a){var b=$("#"+$(this).attr("for"));b[0]&&(psrk.cancelBubble(a),b.is(":checked")?b.removeAttr("checked"):b.attr("checked",!0),a.preventDefault(),b.triggerHandler("click"))}),f.append(h)}return f[0]},updateAutocompletePlaceholder:function(){var a={nhood:"Neighborhood/Borough",zipcode:"Zipcode",community:"Community District"};this.obj.type&&this.obj.autocomplete_field&&this.obj.autocomplete_field.attr("placeholder",a[this.obj.type.val()])},updateCheckBoxesSize:function(){var a=$("#gp_checkboxes"),b=$("#gp_map");a.css("height",b.outerHeight()-a.parent().find(".field").outerHeight()+1+"px")},updateOutput:function(a){var b=this;if($("#popup_gp_container").hasClass("visible")&&"popup"==this.conf.presentation&&!a)return void(b.conf.autocomplete_checkboxes&&b.updateOutputPrintable());if(this.obj.type.val().match(/polygontool|radius/)){var c=b.getOutputStructureShape();this.obj.output.val(c.output),this.obj.output_printable.html(c.html)}else{var c=psrk.gmap&&GeoPickerMap instanceof psrk.gmap||psrk.boxmap&&GeoPickerMap instanceof psrk.boxmap?b.getOutputStructureFlat(psrk.boxmap&&GeoPickerMap instanceof psrk.boxmap?!0:!1):b.getOutputStructure(GeoPickerMap.getRegionsTree());this.obj.output.val(c.output.join(",")),this.obj.output_full.val(c.full.join(",")),this.obj.output_printable.html(c.html)}this.obj.output_printable.toggle(Boolean(this.obj.output_printable.html())),(this.obj.output.val()||this.conf.adv_search_mode)&&this.obj.output.trigger("change"),this.resetOnLocationChanged(),this.old_output&&this.old_output==this.obj.output.val()||(this.old_output=this.obj.output.val(),b.conf.on_output&&b.conf.on_output())},updateOutputPrintable:function(){if(window.GeoPickerMap){var a=psrk.gmap&&GeoPickerMap instanceof psrk.gmap?this.getOutputStructureFlat():this.getOutputStructure(GeoPickerMap.getRegionsTree(),this.conf.autocomplete_checkboxes?!0:!1);this.obj.output_printable.html(a.html),this.conf.autocomplete_checkboxes&&this.updateCheckBoxesSize()}},resetOnLocationChanged:function(){var a=this,b=$("#"+a.conf.location_input);if(b[0]&&(a.location_current=b.val(),!b.attr("old_location"))){b.attr("old_location",b.val());var c=[];b.parents("form").data("events")&&$.each(b.parents("form").data("events"),function(a,b){$.each(b,function(a,b){c.push(b.handler)})}),b.parents("form").unbind("submit").submit(function(){b.attr("old_location")&&b.attr("old_location")!=b.val()&&a.location_current!=b.val()&&(a.reset(),a.conf.on_output&&a.conf.on_output()),b.attr("old_location",b.val());for(var d=0;d<c.length;d++)c[d]();return!1})}},getOutputStructure:function(a,b){var c="",d=[],e={nhood:"micro",zipcode:"zipcode",community:"community"},f=e[this.obj.type.val()],g=this.conf.adv_search_mode&&f&&!b?a.selected&&a.type==f:a.selected;if(g)c+="<li>"+a.name+" ",c+=" <span title='remove' class='remove'><a onclick=\"psrk.geopicker.removeSelectedArea('"+a.id+"',"+(b?"true, true":"false")+");return false\" href='#'>&#215;</a></span>",c+="</li>",d.push(a.id);else{var h="";for(var i in a.children){var j=psrk.geopicker.getOutputStructure(a.children[i],b);h+=j.html,d.push.apply(d,j.output)}h&&"macro"==a.type&&!b?(c+='<li class="parent">'+a.name+" ",c+="<ul>"+h+"</ul>",c+="</li>"):c=h}return b&&d.length>10&&(c="<li>More than 10 regions selected",c+="<span title='remove' class='remove'><a onclick=\"psrk.geopicker.removeAllSelectedAreasPrintable();return false\" href='#'>&#215;</a></span>",c+="</li>",this.temp_printable_output=d),{html:c,output:d,full:[]}},getOutputStructureFlat:function(a){var b={html:"",full:[],output:[]},c=GeoPickerMap.getSelectedRegions(),d=GeoPickerMap.getRegionsHierarchy(),e=GeoPickerMap.getRegionsName(),f=GeoPickerMap.getRegionsPath(),g=GeoPickerMap.getRegionsCurrentLayer(),h=GeoPickerMap.geo_getRegionsLayer();for(var i in c)if(0!=i&&d[i]){if(h){if(d[i].type!=h)continue}else if(d[i].pid){for(var j=!1,k=0;k<d[i].pid.length;k++)if(c[d[i].pid[k]]){j=1;break}if(j)continue}var l="";if("zipcode"==this.obj.type.val()){var m=$.map(GeoPickerMap.getRegionChildren(d[i].id),function(a){return a>=0?a:void 0});m.length&&$.inArray(g,f)==f.length-2&&(l=m.length+" "+e.zipcode.txt)}else l=d[i].pid&&d[d[i].pid[0]]?d[d[i].pid[0]].name:"";var n=l?" <span class='suffix'>("+l+")</span>":"";b.html+="<li>"+d[i].name+n+" <span title='remove' class='remove'><a onclick=\"psrk.geopicker.removeSelectedArea('"+d[i].id+"');return false\" href='#'>&#215;</a></span></li>",b.full.push(d[i].id+"|"+d[i].name+(l?"|"+l:"")),b.output.push(d[i].id+(a?"_"+d[i].type:""))}return b},getOutputStructureComplex:function(a){var b="",c="",d=[],e=[],f=0,g=0;if(a.children)for(var h in a.children){var i=psrk.geopicker.getOutputStructure(a.children[h]);c+=i.html,e.push.apply(e,i.output),f++,a.children[h].selected&&g++}return a.selected?(b+="<li style='color:#000;' id='eccbc_"+a.id+"'>"+a.name+" ",f&&(b+=e.length+" of "+f),b+=" <span title='remove' class='remove'><a onclick=\"psrk.geopicker.removeSelectedArea('"+a.id+"');return false\" href='#'>X</a></span>",f&&(b+=" <span title='toggle_children'><a onclick=\"psrk.geopicker.toggleChildRegions('"+a.id+"');return false\" href='#'>T</a></span>"),e.length&&(b+="<ul style='display:none;' id='ceccbc_"+a.id+"'>"+c+"</ul>"),b+="</li>"):e.length?"macro"==a.type?(b+=g==f?"<li style='color:#000;' id='eccbc_"+a.id+"'>"+a.name+" "+e.length+" of "+f:"<li style='color:#ccc;' id='eccbc_"+a.id+"'>"+a.name+" "+e.length+" of "+f,b+=" <span title='remove'><a onclick=\"psrk.geopicker.removeSelectedArea('"+a.id+"');return false\" href='#'>X</a></span>",f&&(b+=" <span title='toggle_children'><a onclick=\"psrk.geopicker.toggleChildRegions('"+a.id+"');return false\" href='#'>T</a></span>"),e.length&&(b+="<ul id='ceccbc_"+a.id+"'>"+c+"</ul>"),b+="</li>"):(b+="<li style='color:#ccc;'>"+a.name,e.length&&(b+="<ul id='ceccbc_"+a.id+"'>"+c+"</ul>"),b+="</li>"):"micro"==a.type&&(b+="<li style='color:#cc0;'>"+a.name,e.length&&(b+="<ul>"+c+"</ul>"),b+="</li>"),a.selected?d.push(a.id):d=e,{html:b,output:d}},getOutputStructureShape:function(){var a,b=GeoPickerMap.getDrawnShape(),c=[];if(b&&b.type&&b.shape)if("polygon"==b.type)for(var d=0;d<b.shape.length;d++)c.push(b.shape[d].x+","+b.shape[d].y);else"circle"==b.type&&(c=[b.shape.x,b.shape.y,b.shape.r]);return a=c.join(","),{html:a?"<li>User defined shape <span title='remove' class='remove'><a onclick=\"psrk.geopicker.removeDrawnShapeAndOutput(); return false;\" href='#'>&#215;</a></span></li>":"",output:a}},toggleChildRegions:function(a){$("#ceccbc_"+a).toggle()},removeSelectedArea:function(a,b,c){GeoPickerMap.area_select(a,"",!1),c||psrk.geopicker.updateOutput(!0),b&&psrk.geopicker.updateOutputPrintable()},removeAllSelectedAreasPrintable:function(){if(this.temp_printable_output&&this.temp_printable_output.length){for(var a=this.temp_printable_output,b=0;b<a.length;b++)this.removeSelectedArea(a[b],!0,!0);a.length=0}},removeDrawnShape:function(){GeoPickerMap.clearDrawnShape&&GeoPickerMap.clearDrawnShape(),GeoPickerMap.clearPolygon&&GeoPickerMap.clearPolygon()},removeDrawnShapeAndOutput:function(){this.removeDrawnShape(),this.updateOutput(!0)},loadShapePoints:function(a){psrk.geopicker.updateOutput(),a&&a.type&&a.shape&&psrk.geopicker.runGeoCallback()},setTabs:function(a){var b=$("#gp_tabs");if(b[0]){b.html("");for(var c="",d=$(psrk.cE("UL")).attr("id","tabs").addClass("psrk-custom-list tabs"),e=0;e<a.length;e++){var f=$(psrk.cE("LI")).addClass("tab"+(a[e].current?" cur":""));a[e].current&&(c=a[e].pretty_name),$(psrk.cE("A")).html(a[e].pretty_name).attr({"data-name":a[e].name,"data-layer":a[e].layer,"data-zoom_min":a[e].zoom_min,"data-zoom_max":a[e].zoom_max,href:"#"}).click(function(){return psrk.geopicker.enableTab(this),this.blur(),!1}).appendTo(f),d.append(f)}var g=$(psrk.cE("DIV")).addClass("select-widget tab-widget").append($(psrk.cE("A")).html(c).addClass("psrk-iwo").css("display","none").click(function(){return psrk.selectWidget.toggle(this),!1}));g.append(d),b.append(g)}},enableTab:function(a,b){"object"!=typeof a&&(a=$('[data-name="'+a+'"]')[0]),psrk.selectWidget.setOption(a),GeoPickerMap.geo_setRegionsLayer&&GeoPickerMap.geo_setRegionsLayer($(a).attr("data-layer"));var c=$(a).attr("data-name");c.match(/polygontool|radius|viewport/)||GeoPickerMap.setZoomLimit&&GeoPickerMap.setZoomLimit({min:$(a).attr("data-zoom_min")}),psrk.geopicker.selectCurrentTab(a),psrk.geopicker.setCurrentMode(c,b)},selectCurrentTab:function(a){$("#gp_tabs ul li").attr("class","tab"),$(a).parent().attr("class","tab cur")},removeViewportCallback:function(){this.viewport_callback&&GeoPickerMap.removeActiveViewport(this.viewport_callback),this.viewport_callback=null},setCurrentMode:function(a,b){psrk.geopicker.reset(),psrk.geopicker.setType(a),$("#gp_container").removeClass("hide").css("display","block"),psrk.gmap&&GeoPickerMap instanceof psrk.gmap?(GeoPickerMap.geo_setType(a),GeoPickerMap.exitDrawMode(),this.removeViewportCallback(),"viewport"==a?(GeoPickerMap.geo_toggle(!1),GeoPickerMap.wizard.set("Pan/Zoom map to trigger new search"),this.viewport_callback=GeoPickerMap.setActiveViewport(psrk.geopicker.runGeoCallback,{grid:1,run_deferred:0}),$("#gp_checkboxes").html('<div class="txt"><h3>How to use current map</h3><ul><li>Pan or zoom the map and the current visible map area will be used as search criteria</li></ul></div>')):"polygontool"==a?(GeoPickerMap.geo_toggle(!1),GeoPickerMap.enterDrawMode("polygon",psrk.geopicker.loadShapePoints,!1),$("#gp_checkboxes").html('<div class="txt"><h3>How to define a polygon on the map</h3><ol><li>Click on the map to define the points of the polygon</li><li>Double-click to close the polygon</li></ol></div>')):"radius"==a?(GeoPickerMap.geo_toggle(!1),GeoPickerMap.enterDrawMode("circle",psrk.geopicker.loadShapePoints,!1),$("#gp_checkboxes").html('<div class="txt"><h3>How to define a circle on the map</h3><ol><li>Click on the map to define the center of the circle</li><li>Click again to define the radius of the circle</li></ol></div>')):a?(GeoPickerMap.geo_toggle(!0),GeoPickerMap.wizard.set("Click on the map to select a region."),this.viewport_callback=GeoPickerMap.setActiveViewport(GeoPickerMap.geo_regionsRequest,{loading:1,run_on_autopan:1}),psrk.geopicker.loadCheckboxes(a,{geo_id:GeoPickerMap.geo_reference},"google",GeoPickerMap.geo_getApp()),psrk.geopicker.runGeoCallback()):(GeoPickerMap.geo_toggle(!1),GeoPickerMap.wizard.set(),$("#gp_checkboxes").html(""),psrk.geopicker.runGeoCallback()),a&&GeoPickerMap.setFocusRegion()):psrk.boxmap&&GeoPickerMap instanceof psrk.boxmap?(GeoPickerMap.geo_setType(a),GeoPickerMap.exitDrawMode(),GeoPickerMap.clearDrawnPolygons(),this.removeViewportCallback(),"viewport"==a?(GeoPickerMap.geo_toggle(!1),b&&(psrk.geopicker.obj.output.val(b),GeoPickerMap.setCurrentViewport(b)),this.viewport_callback=GeoPickerMap.setActiveViewport(function(){psrk.geopicker.runGeoCallback(GeoPickerMap.getCurrentViewport())},{run_deferred:b?1:0})):"polygontool"==a||"radius"==a?(GeoPickerMap.geo_toggle(!1),GeoPickerMap.enterDrawMode(a,psrk.geopicker.loadShapePoints,b)):a?(GeoPickerMap.geo_toggle(!0),this.viewport_callback=GeoPickerMap.setActiveViewport(GeoPickerMap.geo_regionsRequest),b&&GeoPickerMap.geo_setInput(b),psrk.geopicker.runGeoCallback()):(GeoPickerMap.removeActiveViewport(),GeoPickerMap.geo_toggle(!1))):"polygontool"==a?(GeoPickerMap.disableCanvasTiles(),GeoPickerMap.showPolygon(psrk.geopicker.loadShapePoints),GeoPickerMap.zoomMapPanel(0),$("#gp_checkboxes").html('<div class="txt"><h3>How to define a polygon on the map</h3><ol><li>Click on the map to define the points of the polygon</li><li>Click on the first point or double-click on the map to close the polygon</li></ol></div>')):(GeoPickerMap.hidePolygon(),GeoPickerMap.changeCanvasTiles(a,!1,b)),b&&"viewport"==a&&psrk.boxmap&&GeoPickerMap instanceof psrk.boxmap||(psrk.geopicker.updateOutput(),this.conf.autocomplete_checkboxes&&this.updateOutputPrintable())},runGeoCallback:function(a){var b=GeoPickerMap;psrk.geopicker.obj.type.val(),psrk.geopicker.obj.output.val();if(b.geo_callback)return b.wizard&&b.wizard.set(),b.geo_callback.deferred?void(b.geo_callback.deferred=!1):void b.geo_callback(a)},setType:function(a){this.obj.type.val(a),this.conf.adv_search_mode&&this.obj.type.change(),this.conf.autocomplete_checkboxes&&this.updateAutocompletePlaceholder()},setLayer:function(a){this.obj.layer.val(a)},setInfoError:function(a){this.errorMessage=a},getInfoError:function(){return this.errorMessage},reset:function(){window.GeoPickerMap&&(GeoPickerMap.clearDrawnShape&&GeoPickerMap.clearDrawnShape(),GeoPickerMap.clearSelectedRegions&&GeoPickerMap.clearSelectedRegions()),delete this.popup.input;var a=this;$.each(this.obj,function(b){"type"!=b&&a.obj[b].val(null).html("")})},buildToggle:function(){var a=$("<div>"),b=$(psrk.cE("A")).html("Map").attr({href:"#"}).addClass("cur").bind("click",function(){return $("#gp_table_map").addClass("selected"),$("#gp_table_list").removeClass("selected"),$("#gp_mode_toggle").find("a").removeClass("cur"),this.className="cur",!1}),c=$(psrk.cE("A")).html("List").attr({href:"#"}).bind("click",function(){return $("#gp_table_list").addClass("selected"),$("#gp_table_map").removeClass("selected"),$("#gp_mode_toggle").find("a").removeClass("cur"),this.className="cur",!1});return a.append(b).append(c)}};
psrk=window.psrk||{},psrk.rs_states=[],psrk.report={goto_section:function(a){var b=$("#psrk-report-navigation")[0]?$("#psrk-report-navigation")[0].offsetHeight:0,c=$('.psrk-report[data-section="'+a+'"]').parents(".psrk-report-container");$(window).scrollTop(c.offset().top-b)},toggle_general:function(a,b){$("#"+a).toggle();var c=$("#"+b);c.html("[+] See"==c.html()?"[-] Hide":"[+] See")},toggle_titledocs:function(a){psrk.report.toggle_general("parties_"+a,"showHide_"+a)},responsive:function(){var a=function(){this.cnt=0,this.enable=function(a){function b(a){a.find(".responsive").each(function(a){var b="rt_"+d.cnt;$(this).addClass(b),c("."+b),d.cnt++})}function c(a){var b='<style type="text/css"> @media screen and (max-width: '+e+"px) { \n";$(a+" th").each(function(c){c++,b+=a+" > tbody > tr > td:nth-child("+c+"):before {content: '"+$.trim($(this).text())+"';}  \n"}),b+="} </style>",$(b).insertBefore($(a))}var d=this,e="480",f="";a?"object"==typeof a?f=$(a).parents(".psrk-report"):(f=$(psrk.gE(a)),f.hasClass("psrk-report")||(f=f.find(".psrk-report"))):f=$(document.body),b(f)}};return new a}(),popupshow:function(a,b){var c=25,d=11,e=0,f=0,g=0,h=0,i={contenttype:"",width:"200",height:"",direction:"",popid:"",classname:"section",loc:"nyc2",url:0,nolink:0,reposition:1,stayopen:0,call_event:"mouseover",title:"",arg1:"",arg2:"",center:0,margin:0,align:!1,valign:!1,popup_drag:0,enable_polygon:!1,obj_name:!1,focusarea_radius:0,backlight:0,geopicker:0};"string"==typeof a&&(a=document.getElementById(a));for(var j=[a,b],k=2;k<arguments.length;k++)if(arguments[k]){j.push(arguments[k]);var l=arguments[k].split("="),m=l[0];"type"==m&&(m="contenttype"),"class"==m&&(m="classname");var n=l[1]||1;i[m]=n}if(a&&(!window.options_no_tips||"tip"!=i.contenttype||!i.popid)){if(a.getAttribute("id")||a.setAttribute("id","popup"+Math.round(999999*Math.random())),popperid=a.getAttribute("id"),c=a.offsetWidth+2,"tip"==i.contenttype&&!document.getElementById(b)&&!i.width){var o=document.createElement("span");o.style.font="10px verdana",o.innerHTML=b,document.body.appendChild(o),i.width=o.offsetWidth.toString(),document.body.removeChild(o)}if(i.height.indexOf("%")>0&&(i.height=parseInt(i.height,10)*psrk.report.getAvailHeight()/100-22),i.width.indexOf("%")>0&&(i.width=parseInt(i.width,10)*psrk.report.getAvailWidth()/100-24),i.center){var p=document.getElementById(b);i.width=p.clientWidth,i.height=p.style.height}i.margin&&(i.width=i.width-2*i.margin,i.height=i.height-2*i.margin);var q,r=""!=i.popid?i.popid:popperid+"pop",s=document.getElementById(r);if(!s){if(s=document.createElement("div"),s.id=r,$(s).addClass("popup_outer"),i.backlight&&$(s).addClass("transparent"),s.style.top=0,s.style.left="-1000px",s.style.display="none",poppee_inner=document.createElement("div"),$(poppee_inner).addClass("popup_inner"),s.appendChild(poppee_inner),"click"==i.call_event){var t=document.createElement("h3");q=t,$(t).addClass("popup_header"),t.innerHTML=unescape(i.title);var u=document.createElement("a");u.href="#",u.innerHTML="Close",u.style.width="30px",$(u).addClass("popup_close"),u.onclick=function(){return psrk.report.instant_popuphide(r),!1},t.appendChild(u),poppee_inner.appendChild(t)}var v=document.createElement("div");$(v).addClass("popup_content"),v.id=r+"_content",v.style.width=isNaN(parseInt(i.width))?"auto":parseInt(i.width)+"px",v.style.height=isNaN(parseInt(i.height))?"auto":parseInt(i.height)+"px",v.style.padding="click"==i.call_event?"7px":"10px",poppee_inner.appendChild(v),psrk.report.popup_content(a,s,v,b,i,j),1==i.popup_drag&&q&&psrk.drag.register(s,q)}"click"!=i.call_event&&(s.onmouseover=function(){psrk.report.popuppreserve(r),i.url&&(s.style.cursor="pointer",window.status=i.url)},s.onmouseout=function(){i.stayopen||psrk.report.popuphide(a,r)}),i.url&&(s.onclick=function(){return location.href=i.url,!1}),i.stayopen||(psrk.report.instant_popuphide(psrk.current_popup_id),psrk.current_popup_id=r),s.style.display="block",s.style.visibility="visible",i.height||(i.height=s.clientHeight);var w=s.offsetHeight+22,x=s.offsetWidth;e=psrk.report.getAvailWidth(),f=psrk.report.getAvailHeight(),g=psrk.report.getScrollLeft(),h=psrk.report.getScrollTop();var y=psrk.report.getPosleft(a),z=psrk.report.getPostop(a),A=$("#"+r+"_content")[0],B=52,C=i.height>=psrk.report.getAvailHeight()-B&&!i.contenttype.match("^(photo|map)$");C&&(A.style.height=psrk.report.getAvailHeight()-B+"px");var D=30,E=i.width>=psrk.report.getAvailWidth()-D&&!i.contenttype.match("^(photo|map)$");if(E&&(A.style.width=psrk.report.getAvailWidth()-D+"px"),(C||E)&&(A.style.margin="4px",A.style.overflow="auto"),i.ancestorID){var F=document.getElementById(i.ancestorID);F&&(y-=psrk.report.getPosleft(F),z-=psrk.report.getPostop(F))}if(1==i.reposition&&(e+g>y+x+c&&"left"!=i.direction?s.style.left=y+c+"px":s.style.left=Math.max(g,y-x-4)+"px",f+h>z+w+d?s.style.top=z+d+"px":s.style.top=Math.max(h,f+h+d-w)+"px"),i.center&&(s.style.top="0px",s.style.left=E?g+"px":(e-i.width)/2+"px"),i.align)switch(i.align){case"left":s.style.left="0px";break;case"center":s.style.left=E?g+"px":g+(e-i.width)/2+"px";break;case"right":s.style.left=E?g+D+"px":e-i.width+"px"}if(i.valign)switch(i.valign){case"top":s.style.top=h+"px";break;case"middle":s.style.top=f>i.height?h+(f-i.height)/2+"px":h+"px";break;case"bottom":s.style.top=h+(f-i.height)+"px"}i.margin,i.backlight&&psrk.report.setBacklight(r)}},popup_content:function(popper,poppee,c,content,p,args){switch(p.contenttype){case"photo":c.style.textAlign="center",c.innerHTML='<img src="'+content+'" style="border: 1px solid #333;" />';break;case"tip":$(poppee).addClass("tip");var o=document.getElementById(content);o&&(content=o.innerHTML),c.innerHTML=content;break;case"map":c.style.fontSize="10px",this.drawMap(content,p.width,p.width,c.id);break;case"psharkmap":if(p.geopicker){var contentObj=document.getElementById("geopicker_map_container");contentObj.style.display="block",c.appendChild(contentObj);break}c.innerHTML="<img src='"+psrk.url.base+"/img/spacer.gif' width='"+p.width+"' height='"+p.height+"' />";break;case"contentLoader":var contentObj=document.getElementById(content);contentObj.style.display="block",c.appendChild(contentObj);break;case"ajaxLoader":this.popup_loading(c);break;default:c.innerHTML=content,c.style.fontSize="10px"}p.appendAsSibling?popper.parentNode.appendChild(poppee):document.body.appendChild(poppee),"ajaxmap"==p.contenttype&&(p.arg1=1,psrk.report.loadAJAXPSharkMap(content,c.id,p.width,p.width,!1,!1,p)),"psharkmap"==p.contenttype&&(p.enable_polygon?psrk.report.loadAJAXPSharkMap(content,c.id,p.width,p.height,!1,!1,p):p.geopicker?psrk.report.loadAJAXPSharkMap(content,c.id,p.width-245,p.height-100,!1,!0,p):psrk.report.loadAJAXPSharkMap(content,c.id,p.width,p.height,!1,!0,p)),"ajaxLoader"==p.contenttype&&psrk.ajaxLoader(content,c.id,"POST",function(r){return setTimeout(function(){psrk.report.popupshow.apply(null,args)},300),p.delegate?eval(p.delegate)(r):r})},popup_loading:function(a){a.innerHTML="<div class='ajaxLoading'>Loading ...</div>",a.style.fontSize="10px",a.style.textAlign="left"},popuphide:function(a,b){b?2==b.split("=").length&&(b=b.split("=")[1]):b=popperid+"pop",psrk.current_popup_timer=setTimeout("psrk.report.instant_popuphide('"+b+"')",100)},popuppreserve:function(a){a==psrk.current_popup_id&&clearTimeout(psrk.current_popup_timer)},instant_popuphide:function(a){clearTimeout(psrk.current_popup_timer),poppee=document.getElementById(a),poppee&&(poppee.style.display="none",poppee.style.visibility="hidden",psrk.report.hideBacklight())},showSection:function(a){var b=document.getElementById(a),c=document.getElementById("verb_"+a);c.innerHTML.match("Hide ")&&(psrk.ShowHideStates[a]=1),0!=psrk.ShowHideStates[a]&&psrk.ShowHideStates[a]?(b.style.display="none",c.innerHTML="Show",psrk.ShowHideStates[a]=0):(b.style.display="block",c.innerHTML="Hide",psrk.ShowHideStates[a]=1)},getPathToImg:function(a,b,c,d,e,f,g,h){return src=f,g&&0!=g||(src="https://s"+h+".propertyshark.com"),src+"/map_"+a+"_"+b.replace("/","_")+c+"_"+d+"_"+e+".png"},getPathToLayer:function(a,b,c,d,e,f,g){return src=e,f&&0!=f||(src="https://s"+g+".propertyshark.com"),src+"/map_"+a.replace("/","_")+"_"+b+"_"+c+"_"+d+".png"},initializeMapConfig:function(a){psrk.g.map_config=psrk.g.map_config||{};var b=a.map_locale;psrk.g.map_config[b]=a},drawMap:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u=a.split("&");h=21,q="";for(var v=0;v<u.length;v++){var w=u[v].split("=")[0],x=u[v].split("=")[1];switch(w){case"x":i=x;break;case"y":j=x;break;case"map":k=x;break;case"theme":n=x;break;case"zoom":m=parseInt(x);break;case"overlay":o=x;break;case"mapid":q=' id="'+x+'"';break;case"source":r=x;break;case"devel_env":s=x}}if(!psrk.g.map_config||!psrk.g.map_config[k])return psrk.include_script("https://www.propertyshark.com/mason/Maps/js/config.js?map="+k+"&callback=psrk.report.initializeMapConfig","map_config"),void setTimeout("psrk.report.drawMap('"+a+"','"+b+"','"+c+"','"+d+"',"+e+")",300);var y=psrk.g.map_config[k],z=y.zl;if(l=z.length-1,isNaN(m)||(l=m),!r){var A="Error drawing map. No source specified.";$("#"+d).html(A)}var f="";x_tile_size=z[l].x_tile_size,y_tile_size=z[l].y_tile_size,x_tiles=z[l].x_tiles,y_tiles=z[l].y_tiles,folder=z[l].folder,n?folder=n+"/"+folder:n="default",o=o?o:!1,k||(k="nyc2");var B="";e?B="javascript:void(0)":(B="/mason/Maps/?map="+k+"&x="+i+"&y="+j+"&zoom="+(l+1)+"&basemap="+n,o&&(B+="&overlay="+o),B+="&star=1&report=1"),click_action="document.location.href="+B,b=parseInt(b),c=parseInt(c);var C=x_tile_size*x_tiles*i-b/2,D=y_tile_size*y_tiles*j-c/2,E=parseInt(C/x_tile_size),F=parseInt(D/y_tile_size),G=parseInt((C+b)/x_tile_size),H=parseInt((D+c)/y_tile_size),I=C-x_tile_size*E,J=D-y_tile_size*F,K=(G-E+1)*x_tile_size,L=(H-F+1)*y_tile_size;g="",t=1;for(var M=F;H>=M;M++)if(M<z[l].y_tiles){g+="<nobr>";for(var v=E;G>=v;v++)v<z[l].x_tiles&&(g+='<img src="'+psrk.report.getPathToImg(k,n+"/",l,v,M,r,s,t)+'" border="0" galleryimg="no">',t++,t>=5&&(t=1));g+="</nobr><br>"}if(f+='<div style="position: absolute; z-index: 10; left: '+-1*parseInt(I)+"px; top: "+-1*parseInt(J)+"px; width: "+K+"px; height: "+L+"px;",e||(f+="cursor:pointer;"),f+='">',f+='<a href="'+B+'"',e&&(f+=' style="cursor:default;"'),f+=">",f+=g,f+="</a></div>",o){for(var p=o.split(","),N=0;N<p.length;N++){g="";for(var M=F;H>=M;M++)if(M<z[l].y_tiles){g+="<nobr>";for(var v=E;G>=v;v++)if(v<z[l].x_tiles){var O=psrk.report.getPathToLayer(k+"/"+p[N],l,v,M,r,s,t);g+=document.all?'<img src="https://www.propertyshark.com/maps/images/spacer.gif" border="0"  galleryimg="no" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+O+"', sizingMethod='scale');\" height=\""+y_tile_size+'" width="'+x_tile_size+'">':'<img src="'+O+'" border="0" galleryimg="no">',t++,t>=5&&(t=1)}g+="</nobr><br>"}f+='<div style="position: absolute; z-index: '+(11+N)+"; left: "+-1*parseInt(I)+"px; top: "+-1*parseInt(J)+"px; width: "+K+"px; height: "+L+'px;cursor:pointer;">',f+='<a href="'+B+'"',e&&(f+=' style="cursor:default;"'),f+=">",f+=g,f+="</a></div>"}h+=p.length}f='<div class="minimap" style="width: '+b+"px; height: "+c+'px; overflow: hidden;position: relative; border: 1px solid #000;"'+q+">"+f,f+='<div style="position: absolute;',f+=" z-index: "+h+";",f+=" top: "+parseInt((c-24)/2)+"px;",f+=" left: "+parseInt((b-24)/2)+"px;",f+=' padding: 0; margin: 0; width: 24px;"',f+=" >",f+='<a href="'+B+'"',e&&(f+=' style="cursor:default;"'),f+=">",f+='<img src="/maps/images/asterisk.gif" border="0">',f+="</a>",f+=" </div>",f+="</div>",$("#"+d).html(f)},getRemoteContent:function(a,b,c,d,e){var f=c,g=window.location.host.match(/.+\.psrk\.com|propertyshark\.com|stage(-data)?-web-core/)?"ajax":"include";if("ajax"==g){var h="/mason/Maps/mapparams.html?"+a+"&loc="+d;psrk.ajaxLoader(h,b,"GET",psrk.report.drawMap,c,c,b,e)}else{var h="https://www.propertyshark.com/mason/Maps/mapparams.js?"+a+"&loc="+d+"&display_legend=false&callback=psrk.report.drawMap";h+="&id="+b+"&width="+c+"&height="+f+"&link_to_main_map="+e,psrk.include_script(h,"script_"+b)}},loadAJAXPSharkMap:function(a,b,c,d,e,f,g){for(var h=window.location.host.match(/.+\.psrk\.com|propertyshark\.com|stage(-data)?-web-core/)?"ajax":"include",i=[],j=0;j<arguments.length;j++)i.push(arguments[j]);if(window.psharkmap_loader){var k=psharkmap_loader(g.loc,function(){psrk.report.loadAJAXPSharkMap(i[0],i[1],i[2],i[3],i[4],i[5],i[6])});if(k)return}if(a.indexOf("propkey")>=0)if("ajax"==h){var l="/mason/Maps/mapparams.html?"+a+"&loc="+g.loc+"&display_legend=check";psrk.ajaxLoader(l,null,"GET",psrk.report.drawAJAXPSharkMap,c,d,b,f,e,g)}else{var l="https://www.propertyshark.com/mason/Maps/mapparams.js?"+a+"&loc="+g.loc+"&display_legend=check&callback=psrk.report.drawAJAXPSharkMap";l+="&id="+b+"&width="+c+"&height="+d+"&display_legend="+e+"&remote=1&p="+escape(JSON.stringify(g)),psrk.include_script(l,"script_"+b)}else if(g.geopicker){var l="/mason/Maps/geo/geo_map.js?"+decodeURIComponent(g.geopicker)+"&seed="+Math.floor(1e5*Math.random());psrk.include_script(l,"geopickerLocation")}else psrk.report.drawAJAXPSharkMap(a,c,d,b,"ajax"==h?f:!1,e,g,"ajax"==h?!1:!0)},drawAJAXPSharkMap:function(arg,width,height,id,link_to_main_map,display_legend,p,remote){"false"==display_legend&&(display_legend=!1);var obj=document.getElementById(id);if(obj){obj.innerHTML="",obj.align="left";for(var pairs=arg.split("&"),zoom=3,theme="default",overlay="",propkey=!1,j=0;j<pairs.length;j++){var key=pairs[j].split("=")[0],val=pairs[j].split("=")[1];switch(key){case"x":x=val;break;case"y":y=val;break;case"map":mapname=val;break;case"theme":theme=val;break;case"propkey":propkey=val;break;case"zoom":var temp_zoom=parseInt(val);isNaN(temp_zoom)||(zoom=temp_zoom);break;case"overlay":overlay=val;break;case"display_legend":display_legend="false"==val?!1:val;break;case"mapid":mapid=' id="'+val+'"'}}var url="/mason/Maps/?map="+mapname+"&x="+x+"&y="+y+"&zoom="+(zoom+1)+"&basemap="+theme+"&overlay="+overlay+"&star=1&report=1",current_loc=window.location;if(!remote){var url_track="/mason/tracker/map_track.html?map="+mapname+"/"+theme+"&popup=ajaxmap&source="+current_loc;psrk.ajaxLoader(url_track)}var map_obj=document.createElement("div");if(map_obj.className="psharkmap",map_obj.id=Math.random().toString().replace(/\./,""),map_obj.style.width="100%",map_obj.style.height=$("#"+id).height()-(link_to_main_map?16:0)+"px",map_obj.style.padding="0",map_obj.style.margin="0",map_obj.style.position="absolute",obj.appendChild(map_obj),map_obj){var map=new psrk.map(map_obj.id,psrk.map.g.mapLocale(mapname));remote&&map.setRemoteLoad({load_layers_callback:function(){},subscriber:1}),theme&&map.setBasemap(theme),overlay&&map.setOverlays(overlay),map.setMapCenter(x,y),p.arg1&&map.createPOI(p.arg1,x,y,remote?"":"<a href='"+url+"'>View full size map</a>"),map.setMapZoom(zoom),map.disableReports(),map.setKeymap(100,100),p.enable_polygon?map.enablePolygon(showpoints,20):map.legendDropdown(display_legend),p.focusarea_radius&&(map.setFocusAreaType("circle",p.focusarea_radius),map.setFocusArea(x,y)),p.obj_name?(map.setInstanceName(p.obj_name),eval(p.obj_name+" = map")):(map.setInstanceName("map_instance"),eval(map.get_instance_name()+" = map")),map.displayMap()}if(link_to_main_map){var link_obj=document.createElement("div");link_obj.style.height="16px",link_obj.style.width="100%",link_obj.style.textAlign="right",link_obj.innerHTML='<a href="'+url+'">View full size map</a>',obj.appendChild(link_obj)}}},getAvailWidth:function(){return $(window).width()},getAvailHeight:function(){return $(window).height()},getScrollLeft:function(){return $(window).scrollLeft()},getScrollTop:function(){return $(window).scrollTop()},getPosleft:function(a){return $(a).offset().left},getPostop:function(a){return $(a).offset().top},setBacklight:function(a){if(window.XMLHttpRequest){var b=document.getElementById(a),c=document.getElementById("backlight");c||(c=document.createElement("DIV"),c.id="backlight",document.body.appendChild(c)),$(c).addClass("backlight"),c.style.display="block",c.style.height=$(document).height()+"px",c.style.width=$(document).width()+"px",c.style.zIndex=psrk.report.getStyle(b,"zIndex")-1}},hideBacklight:function(a){var b=document.getElementById("backlight");b&&(b.style.display="none")},getStyle:function(a,b){return a.currentStyle?a.currentStyle[b]:document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(a,"")[b]:a.style[b]},navigateTable:function(a,b,c,d){var e=document.getElementById("tbody"+a);e.parentNode.scrollIntoView();for(var f=stop=-1,g=0;g<e.rows.length;g++){var h=e.rows[g].className;h.match(/hide/)||(-1==f&&("+"==d&&(0==g?(f=b,stop=f+c-1):(f=g+c,stop=f+c-1)),"-"==d&&(c>g?(f=0,stop=b-1):(f=g-c,stop=f+c-1))),e.rows[g].className=h+" hide")}for(var g=0;g<e.rows.length;g++){var h=e.rows[g].className;g>=f&&g<=stop&&(e.rows[g].className=h.replace(/\shide/,""))}if(f>b-1)var i=Math.floor((f+c-2)/c)+1;else var i=1;var j=document.getElementById("navPrev"+a),k=document.getElementById("navNext"+a);0==f?(j.className="hide",k.className=""):e.rows[e.rows.length-1].className.match(/hide/)?(j.className="",k.className=""):(j.className="",k.className="hide");var l=document.getElementById("currentPage"+a);l.innerHTML=i},navigateTableFull:function(a){var b=document.getElementById("tbody"+a);b.parentNode.scrollIntoView();for(var c=0;c<b.rows.length;c++){var d=b.rows[c].className;b.rows[c].className=d.replace(/\shide/,"")}var e=document.getElementById("currentPage"+a);e.innerHTML="all",document.getElementById("pager"+a).style.display="none"},toggleExpand:function(a){var b=document.getElementById(a),c=document.getElementById("verb_"+a);"none"==b.style.display?(b.style.display="",c.innerHTML="Hide details",$(c).attr("title","Hide details"),$(c).addClass("open")):(b.style.display="none",c.innerHTML="Show details",$(c).attr("title","Show details"),$(c).removeClass("open"))},navigateTableSetState:function(a,b,c){if(b){var d=document.getElementById("currentPage"+a),e=d.innerHTML,f=document.getElementById(b+"_view_params");if(f){for(var g=f.value?f.value.split(","):[],h=!1,i=0;i<g.length;i++){var j=g[i].split(":");j[0]==c&&(g[i]=c+":"+e,h=!0)}h||g.push(c+":"+e),f.value=g.join(",")}}},setAsCurrentSibling:function(a){for(var b=0;b<a.parentNode.childNodes.length;b++)$(a.parentNode.childNodes[b]).removeClass("cur");$(a).addClass("cur"),a.blur()},postForm:function(a,b,c){var d=a.split("&"),e=document.createElement("form");e.action=b,e.method="POST","self"==c?e.target="_self":e.target="_blank";for(var f=0;f<d.length;f++)if(""!=d[f]){var g=d[f].split("="),h="";h=document.createElement("input"),h.setAttribute("name",g[0]),h.setAttribute("value",g[1]),e.appendChild(h)}document.body.appendChild(e),e.submit(),document.body.removeChild(e)},toggle_extra:function(a,b,c,d){if(a.match(/show/i)){if(c&&d){document.getElementById("show_extra_"+b).style.display="none";for(var e=c;d>e;e++)document.getElementById("extra_"+b+"-"+e).style.display=""}else if("A"==document.getElementById("show_extra_"+b).tagName)document.getElementById("show_extra_"+b).setAttribute("onclick","psrk.report.toggle_extra('hide', '"+b+"')"),document.getElementById("show_extra_"+b).setAttribute("onmouseover","psrk.report.popupshow(this,'Hide owned properties','type=tip','popid=0.002', 'width=150')"),document.getElementById("show_extra_"+b).setAttribute("onmouseout","psrk.report.popuphide(this, '0.002')");else if("list"==document.getElementById("show_extra_"+b).title)document.getElementById("show_extra_"+b).style.display="none";else{var f=a.replace("Show ","");document.getElementById("show_extra_"+b).innerHTML='<a href="javascript:void(0)" onClick="psrk.report.toggle_extra(\'Hide '+f+"', '"+b+"')\">Hide "+f+"</a>",$("#show_extra_"+b).parent().addClass("active_trigger")}document.getElementById("extra_"+b).style.display="",$("#extra_"+b).addClass("active")}else{if(c&&d){document.getElementById("show_extra_"+b).style.display="";for(var e=c;d>e;e++)document.getElementById("extra_"+b+"-"+e).style.display="none"}else if("A"==document.getElementById("show_extra_"+b).tagName)document.getElementById("show_extra_"+b).setAttribute("onclick","psrk.report.toggle_extra('show', '"+b+"')"),document.getElementById("show_extra_"+b).setAttribute("onmouseover","psrk.report.popupshow(this,'Show other owned properties','type=tip','popid=0.001', 'width=150')"),document.getElementById("show_extra_"+b).setAttribute("onmouseout","psrk.report.popuphide(this, '0.001')");else if("list"==document.getElementById("show_extra_"+b).title)document.getElementById("show_extra_"+b).style.display="inline";else{var f=a.replace("Hide ","");document.getElementById("show_extra_"+b).innerHTML='<a href="javascript:void(0)" onClick="psrk.report.toggle_extra(\'Show '+f+"', '"+b+"')\">Show "+f+"</a>",$("#show_extra_"+b).parent().removeClass("active_trigger")}document.getElementById("extra_"+b).style.display="none",$("#extra_"+b).removeClass("active")}},rs_tabs_toggle:function(a,b,c,d,e,f,g,h){for(var i=document.getElementById(b+"_addrid"),j=i?i.value:"",k=a.id,l=!1,m=a.parentNode;"UL"!=m.nodeName&&"BODY"!=m.nodeName;)"LI"==m.nodeName&&(k=m.id),m=m.parentNode;if(!(m.className.indexOf("tabs")<0)){$(a).closest("ul").toggleClass("open");for(var n=0;n<m.childNodes.length;n++)if("LI"==m.childNodes[n].nodeName){var o=m.childNodes[n].id,p=m.childNodes[n],q=o.replace("_tab","")+"_content",r=document.getElementById(q);if(!r){r=document.createElement("DIV"),r.className="rtabs_display",r.id=q;var s=document.getElementById(b+"_"+q.replace("_tab_"+b,""));if(!s)return;s.appendChild(r)}if(j){q+="_"+j;var t=document.getElementById(q);t||(t=document.createElement("DIV"),t.className="rtabs_display",t.id=q,r.parentNode.appendChild(t)),r=t}for(var u=0;u<r.parentNode.childNodes.length;u++)"DIV"==r.parentNode.childNodes[u].nodeName&&"none"!=r.parentNode.childNodes[u].style.display&&(r.parentNode.childNodes[u].style.display="none");if(k==o&&"none"==r.style.display){if(h&&!$(p).hasClass("cur"))return;r.style.display="block",$(p).addClass("cur"),p.childNodes[0]&&"A"==p.childNodes[0].tagName&&(p.childNodes[0].innerHTML=p.childNodes[0].innerHTML.replace("Display","Hide"));var v=document.getElementById(b+"_hide_tab");if(v&&(v.className="show"),l=!0,g&&!$(r).hasClass("loaded")&&f){if(g.indexOf("&addrid=")>0){for(var w=g.split("?"),x=w[1],y=x.split("&"),n=0;n<y.length;n++)0==y[n].indexOf("addrid=")&&(j?y[n]="addrid="+j:y.splice(n,1));g=w[0]+"?"+y.join("&")}else j&&(g+="&addrid="+j);loading_msg_s(r),psrk.ajaxLoader(g,q),$(r).addClass("loaded")}}else $(p).removeClass("cur")}l||(c=!1,d=""),a.blur()}},ajaxLoad:function(a,b,c,d,e){c.comp=c.comp||a;var f=$('[data-section="'+a+'"]').find("#"+b);"TABLE"==f.prop("tagName")?$(d).addClass("loading"):f.html('<div class="loading">Loading...</div>');var g=window.location.host,h=g.match(/.+\.psrk\.com|propertyshark\.com|stage(-data)?-web-core/)?0:1;c.external=h,$.ajax({url:g.match(/.+\.psrk\.com|stage(-data)?-web-core/)?"http://"+g+"/mason/Property-Report/ajax.html":"https://www.propertyshark.com/mason/Property-Report/ajax.html",data:c,dataType:h?"jsonp":"json",success:function(a){if("TABLE"==f.prop("tagName")?$(d).removeClass("loading"):f.html(""),a.content)f.append($(""+a.content)),e&&e(),$("html").attr("psrk-mobile-app")&&(psrk.report.updated_frame=$('<iframe src="jstonative://updated"/>').appendTo(f),psrk.report.updated_frame.remove());else if(alert(a.error),$("html").attr("psrk-mobile-app")){var b=a.error?encodeURIComponent(a.error):"";psrk.report.updated_frame=$('<iframe src="jstonative://error/'+b+'"/>').appendTo(f),psrk.report.updated_frame.remove()}},error:function(a,b){if($("html").attr("psrk-mobile-app")){var c=b?encodeURIComponent(b):"";psrk.report.updated_frame=$('<iframe src="jstonative://error/'+c+'"/>').appendTo(f),psrk.report.updated_frame.remove()}}})},widget:{table:{full_view:function(a,b,c){$("#"+b+"_pager")[0]&&$("#"+b+"_pager").removeClass("hide");var d=0;$("#"+b).children("tbody").children("tr").each(function(){d++,c>=d&&$(this).show()}),$(a).remove()},navigate:function(a,b,c,d,e,f,g){var h=0;if(g||(g={}),$(a).parents("table").find("a").each(function(){$(this).hasClass("loading")&&(h=1)}),!h){var i=$(a).parents("div.psrk-report").find("#"+b+":first"),j=i.children("tbody").children("tr"),k=i.hasClass("expandtable")||i.hasClass("extratable")?1:0;f=f||15,f=k?2*f:f,e=e||$(a).parents("div.psrk-report").attr("data-section");var l=0,m=0;j.each(function(){l++,!m&&$(this).is(":visible")&&(m=l)}),m=-1==c?m-f:m+f;var n=m+f-1,o=$(a).parents("table").find("td span").first(),p=parseInt(o.html())+c,q=function(){$(a).parents(".psrk-report-widget").find("#"+$(a).parents(".psrk-report-widget").attr("id")+"_status").val((m-1)/f+1);for(var h=-1==c?n+1:m-f;(-1==c?n+f+1:m)>h;h++){j.eq(h-1).hide();var l=j.eq(h-1).find("td.control,.details_link").children("a");l[0]&&l.removeClass("open")}o.html(p),-1==c?$(a).parents("table").find("td").last().html('<a href="" class="pager_next" onclick="psrk.report.widget.table.navigate(this, \''+b+"', 1, "+d+", '"+e+"', "+f/(k?2:1)+", "+JSON.stringify(g).replace(/'/g,"\\'").replace(/"/g,"'")+'); return false;">Next</a>'):$(a).parents("table").find("td").first().html('<a href="" class="pager_prev" onclick="psrk.report.widget.table.navigate(this, \''+b+"', -1, "+d+", '"+e+"', "+f/(k?2:1)+", "+JSON.stringify(g).replace(/'/g,"\\'").replace(/"/g,"'")+'); return false;">Previous</a>'),p==(-1==c?1:Math.ceil(i.attr("data-records")*(k?2:1)/f))&&$(a).parent().html(""),i.children("thead").offset().top<$(window).scrollTop()&&i[0].scrollIntoView()};if(j.eq(m-1)[0]){for(var r=m;n+1>r;r++)(!k||r%2)&&j.eq(r-1).show();q()}else psrk.report.ajaxLoad(e,b,$.extend({min:m,max:n,propkey:d,ajax_target_id:b},g),a,function(){q()})}},show_all:function(a,b,c,d,e,f){var g=0;if(f||(f={}),$(a).parents("table").find("a").each(function(){$(this).hasClass("loading")&&(g=1)}),!g){var h=$(a).parents("div.psrk-report:first").find("#"+b+":first"),i=h.children("tbody").children("tr"),j=h.hasClass("expandtable")||h.hasClass("extratable")?1:0;c=c||$(a).parents("div.psrk-report").attr("data-section");var k=h.attr("data-records"),l=0;i.each(function(){l++});var m=k*(j?2:1)==l?-1:k,n=function(){for(var g=0;g<i.length;g++){(!j||g%2)&&i.eq(g-1).show(),!j||g%2||i.eq(g-1).hide();var k=i.eq(g-1).find("td.control,.details_link").children("a");k[0]&&k.removeClass("open")}$('<span class="top_hideall"><a href="" onclick="psrk.report.widget.table.hide_all(this, \''+b+"', "+(e||15)+'); return false;">Page view</a></span>').insertBefore(h),$('<span class="bottom_hideall"><a href="" onclick="psrk.report.widget.table.hide_all(this, \''+b+"', "+(e||15)+'); return false;">Page view</a></span>').insertAfter(h),$(a).parents("table:first").find("td").first().html(""),$(a).parents("table:first").find("td span").first().html("1"),$(a).parents("table:first").find("td").last().html('<a href="" class="pager_next" onclick="psrk.report.widget.table.navigate(this, \''+b+"', 1, "+d+", '"+c+"', "+(e||15)+", "+JSON.stringify(f).replace(/"/g,"'")+'); return false;">Next</a>'),$(a).parents("table:first").hide(),$(a).parents(".psrk-report-widget").find("#"+$(a).parents(".psrk-report-widget").attr("id")+"_status").val("all"),h.children("thead").offset().top<$(window).scrollTop()&&h[0].scrollIntoView()};-1==m?n():psrk.report.ajaxLoad(c,b,$.extend({min:parseInt(l)+1,max:m,propkey:d,ajax_target_id:b},f),a,function(){n()})}},hide_all:function(a,b,c){var d=$(a).parents("div.psrk-report").find("#"+b+":first"),e=d.children("tbody").children("tr"),f=d.hasClass("expandtable")||d.hasClass("extratable")?1:0;c=c||15,c=f?2*c:c;var g=0;e.each(function(){g++,(g>c||f&&!(g%2))&&$(this).hide();var a=$(this).find("td.control,.details_link").children("a");a[0]&&a.removeClass("open")}),$(a).parents(".psrk-report-widget").find("#"+b+"_pager").show(),$(a).parents(".psrk-report-widget").find("#"+$(a).parents(".psrk-report-widget").attr("id")+"_status").val("1"),$(a).parent().siblings("span").remove(),$(a).parent().remove(),d.children("thead").offset().top<$(window).scrollTop()&&d[0].scrollIntoView()},expand:function(a){var b=0,c=$(a).parents("table:first"),d=c.children("tbody").children("tr");if($(a).parent().is("th"))b="all";else for(var e=$(a).parents("tr:first"),f=0;f<d.length&&(b++,d[f]!==e[0]);f+=2);if("all"==b)for(var f=1;f<d.length;f+=2){var g=d.eq(f).prev().find("td.control,.details_link").children("a");$(a).hasClass("open")?(d.eq(f).hide(),g.removeClass("open")):(d.eq(f).show(),g.addClass("open"))}else $(a).parents("tr:first").next().toggle();$(a).toggleClass("open");var h=$(a).parents(".psrk-report-widget").find("#"+$(a).parents(".psrk-report-widget").attr("id")+"_status"),i="",j="",k=h.val().split("-");if(k[0]?(j=k[0],i=k[1]):j=1,"all"==b)i=$(a).hasClass("open")?"all":"";else if(i&&"all"!=i){for(var l=i.split(","),m=0,f=0;f<l.length;f++)if(l[f]==b){l.splice(f,1),m=1;break}m||l.push(b),i=l.join(",")}else if("all"==i){i="";var n=0,o=[];$(a).parents("table:first").find("td.control,.details_link").children("a").each(function(){n++,$(this).hasClass("open")&&o.push(n)}),i=o.join(",")}else i=b;var o=[];j&&o.push(j),i&&o.push(i),h.val(o.join("-"))}},tabs:function(a,b,c,d,e){d=d||$(a).parents("div.psrk-report").attr("data-section"),e||(e={}),$("#"+b).siblings("div").hide(),$("#"+b).show(),$(a).parent().siblings("li").removeClass("cur"),$(a).parent().addClass("cur"),$(a).closest("ul").toggleClass("open"),$.trim($("#"+b).html())||(e.ajax_target_id=b,e.propkey=c,psrk.report.ajaxLoad(d,b,e)),$("#"+$(a).parents(".psrk-report-widget").attr("id")+"_status").val(b)}}};
psrk=window.psrk||{},psrk.boxmap=function(a,b){if(this.map_conf={},b)for(var c in b)this.map_conf[c]=b[c];this.map_conf.type&&(this.map_conf.dynamic_type=!1),this.map_container=psrk.gE(a),this.pins=[],this.viewport_callback=[],this.geo_mode="nhood",this.geo_modes=!1,this.geo_callback=!1,this.app=null,this.geo=!1,this.geo_localized=!1,this.geo_regions=[],this.geo_regions_selected=[],this.geo_input=[],this.geo_regions_hierarchy=[],this.geo_regions_path=[],this.geo_regions_types=[],this.geo_grid=[],this.geo_grid_loading=0,this.geo_regions_name={nhood:{txt:"Neighborhoods"},zipcode:{txt:"Zip codes",layers:{zipcode:"Zip codes"}},schooldist:{txt:"School districts"},community:{txt:"Community districts"}},this.focus_region=null,this.status={dragging:0,idle_dragging:0,last_action:null,auto_panning:0,loaded:0},this.message={no_regions_available:"",no_regions_available_ignore:{}},this.init()},psrk.boxmap.prototype={init:function(){var a=this;mapboxgl.accessToken="pk.eyJ1IjoiYW5kcmVpZDIwIiwiYSI6ImNqbzVkbHJoMjA4aHIzcnBxZ24yM3cwd2oifQ.fHabZqIAuYw37Z-OTgqiKA",this.map=new mapboxgl.Map({container:$(a.map_container).attr("id"),style:"mapbox://styles/andreid20/cjujvj3eb0a4z1fpk8lwgbyup",maxZoom:17}),this.map.on("dragend",function(){a.status.last_action="pan"}),this.map.on("zoomend",function(){a.status.last_action="zoom"})},setInstanceName:function(a){this.instance_name=a},getInstanceName:function(){return this.instance_name},setActiveViewport:function(a,b){if(a){var c=this;return b&&b.run_deferred||a.call(c),this.activeViewport=function(){a.call(c)},this.map.on("moveend",this.activeViewport),a}},removeActiveViewport:function(){this.activeViewport&&(this.map.off("moveend",this.activeViewport),this.activeViewport=null)},attachToRegionsHierarchyRoot:function(a){if(!this.geo_regions_hierarchy[0]){var b=[];b.id=0,b.name=!1,b.type="root",b.pid=[],b.children=[],this.geo_regions_hierarchy[0]=b}this.geo_regions_hierarchy[0].children.push(a)},geo_setLocalized:function(a){this.geo_localized=a?!0:!1},geo_setType:function(a){this.geo_mode=a,this.geo_regions_current_layer=null,this.geo_regions_selected=[]},geo_setRegionsLayer:function(a,b){this.geo_regions_layer=a,this.geo_regions_layer_reset=b},geo_getRegionsLayer:function(){return this.geo_regions_layer},geo_setRegionsParams:function(a){this.geo_regions_params=a},geo_setRegionsSelectable:function(a){this.geo_regions_selectable=a},geo_setReference:function(a){this.geo_reference=a},geo_setApp:function(a){this.app=a},geo_getApp:function(){return this.app},geo_setInput:function(a){this.geo_input=a?a.split(","):[]},geo_getInput:function(){return this.geo_input},addToRegionsHierarchy:function(a){for(var b=0;b<a.features.length;b++){var c=a.features[b],d=this.geo_regions_hierarchy[c.id];if(d){if(c.parent&&$.inArray(c.parent,d.pid)<0&&d.pid.push(c.parent),c.children&&c.children.length>d.children.length)for(var e=0;e<c.children.length;e++)$.inArray(c.children[e],d.children)<0&&d.children.push(c.children[e])}else{var d=[];d.id=c.id,d.name=c.name,d.type=a.layer,d.pid=c.parent?[c.parent]:[],d.children=c.children||[],this.geo_regions_hierarchy[c.id]=d,this.attachToRegionsHierarchyRoot(c.id)}}},geo_regionRequest:function(a,b,c,d){var e=psrk.url.cdn.replace(/cdn\./,"s"+Math.abs((a+b)%3)+"-cdn.");e+="/webservices/geopicker/get_polygons_google.d.js?",e+="&tile="+a+","+b,e+="&zoom="+c,e+="&layer_type="+this.geo_mode,e+=d?"&layer="+d:"",e+=this.geo_regions_params?"&"+$.param(this.geo_regions_params):"",e+=this.geo_reference&&this.geo_localized?"&geo_id="+this.geo_reference:"",e+="&callback="+this.instance_name+".geo_regionsShow",e+=this.app?"&app="+this.app:"",$.ajax({url:e,dataType:"jsonp",jsonp:!1,cache:!0})},geo_regionsRequest:function(a){var b=this.getCurrentViewport(),c=b.z,d=360/Math.pow(2,c),e=180/Math.pow(2,c);"zoom"!=this.status.last_action||a||(this.geo_regions_current_layer=null);var f=null;if(this.geo_regions_layer?f=this.geo_regions_layer:this.geo_regions_current_layer&&("pan"==this.status.last_action||a)&&(f=this.geo_regions_current_layer),this.geo_regions_current_layer){this.geo_limitCachedPolygons(),this.geo_regionsCleanup();for(var g=Math.floor(b.xmin/d),h=Math.floor(b.ymin/e),i=Math.ceil(b.xmax/d),j=Math.ceil(b.ymax/e),k=i-g,l=j-h,m=0;k>m;m++)for(var n=0;l>n;n++){var o=g+m,p=h+n;this.geo_grid_loading++;var q=this.geo_grid[this.geo_mode+"_"+this.geo_regions_current_layer+"_"+o+"_"+p+"_"+c];q?(q.cached=!0,this.geo_regionsShow(q)):this.geo_regionRequest(o,p,c,this.geo_regions_current_layer)}}else{var o=Math.floor((b.xmin+b.xmax)/(2*d)),p=Math.floor((b.ymin+b.ymax)/(2*e));this.geo_grid_loading++;var q=this.geo_grid[this.geo_mode+"_"+o+"_"+p+"_"+c];q?(q.cached=!0,this.geo_regionsShow(q)):this.geo_regionRequest(o,p,c)}},geo_regionsCleanup:function(){if(this.map.getLayer("geopicker")){var a=this.map.queryRenderedFeatures({layers:["geopicker"]});if(a){var b=this.getUniqueFeatures(a).map(function(a){return a.id}),c=function(a){return-1!=b.indexOf(a)?!0:!1};this.geo_regions=this.geo_regions.filter(function(a){c(a.id)}),this.features_source=this.features_source.filter(function(a){c(a.id)}),this.map.getSource("geopicker").setData({features:this.features_source,type:"FeatureCollection"})}}},getUniqueFeatures:function(a){var b={},c=a.filter(function(a){return b[a.id]?!1:(b[a.id]=!0,!0)});return c},geo_limitCachedPolygons:function(){psrk.size(this.geo_grid)>500&&(this.geo_grid=[])},geo_setCachedPolygons:function(a){var b=$.extend({},a);b.focus=0;var c=a.layer_type,d=a.layer,e=a.xtile,f=a.ytile,g=a.zoom;this.geo_grid[c+"_"+d+"_"+e+"_"+f+"_"+g]=b,a.focus&&(this.geo_grid[c+"_"+e+"_"+f+"_"+g]=a)},geo_regionsShow:function(a){this.geo&&(this.geo_grid_loading--,a.cached||(a=this.geo_convertPxToLatLong(a),this.geo_setCachedPolygons(a),this.addToRegionsHierarchy(a)),a.zoom==this.getGeopickerZoom()&&a.layer_type==this.geo_mode&&(this.geo_regions_current_layer=a.layer,psrk.geopicker.setLayer(a.layer),a.focus?a.layer&&this.geo_regionsRequest(!0):this.geo_regionsDraw(a)))},geo_regionsDraw:function(a){var b=this;this.features_source||(this.features_source=[]);for(var c={features:[],type:"FeatureCollection"},d=0;d<a.features.length;d++){var e=a.features[d],f=e.id;if(!this.geo_regions[e.id]){for(var g=e.geometry.coords.length>1?!0:!1,h={geometry:{coordinates:[],type:g?"MultiPolygon":"Polygon"},properties:{name:e.name,parent:e.parent,bbox:e.bbox},id:f,type:"Feature"},i=[],j=0;j<e.geometry.coords.length;j++)for(var k=e.geometry.coords[j],l=0;l<k.length;l++){for(var m=[],n=k[l],o=0;o<n.length;o++)m.push([n[o][0],n[o][1]]);i.push(g?[m]:m)}h.geometry.coordinates=i,this.features_source.push(h),this.geo_regions[f]={id:f},this.geo_regions_selected[f]&&this.geo_regionToggle(f,"",!0),this.geo_regionPartialSelected(f)&&this.geo_regionPartialSelect(f)}}if(c.features=this.features_source,this.map.getSource("geopicker")?this.map.getSource("geopicker").setData(c):this.map.addSource("geopicker",{type:"geojson",data:c}),this.map.getLayer("outlines")||this.map.addLayer({id:"outlines",type:"line",source:"geopicker",layout:{},paint:{"line-color":["case",["boolean",["feature-state","partial"],!1],"#cc2b2b","#33689d"],"line-width":3}}),this.map.getLayer("geopicker")||(this.map.addLayer({id:"geopicker",type:"fill",source:"geopicker",layout:{},paint:{"fill-color":["case",["boolean",["feature-state","selected"],!1],"#3d7ab8",["boolean",["feature-state","hover"],!1],"#3d7ab8","transparent"],"fill-opacity":["case",["boolean",["feature-state","selected"],!1],.5,["boolean",["feature-state","hover"],!1],.2,.5]}},"state-label-lg"),this.hoveredStateId=null,this.regionClick=function(a){b.geo_regionToggleManual(a.features[0].id)},this.regionHover=function(a){if(a.features.length>0){var c=a.features[0],d=c.id;this.hoveredStateId&&b.map.setFeatureState({source:"geopicker",id:this.hoveredStateId},{hover:!1}),this.hoveredStateId=d,b.map.setFeatureState({source:"geopicker",id:this.hoveredStateId},{hover:!0}),c.properties&&c.properties.name&&b.showLabel(a)}},this.regionLeave=function(){this.hoveredStateId&&b.map.setFeatureState({source:"geopicker",id:this.hoveredStateId},{hover:!1}),this.hoveredStateId=null,b.removeLabel()},this.map.on("click","geopicker",this.regionClick),this.map.on("mousemove","geopicker",this.regionHover),this.map.on("mouseleave","geopicker",this.regionLeave)),this.geo_input.length)for(var d=0;d<this.geo_input.length;d++)this.geo_regions[this.geo_input[d]]&&(this.geo_regionToggle(this.geo_input[d],"",!0),this.geo_input.splice(d,1),d--)},showLabel:function(a){if(!this.labels_disabled){$("#map_geopicker_label")[0]||(this.geo_label=$('<div id="map_geopicker_label"></div>').appendTo("body"));var b=$.map(this.getRegionChildren(a.features[0].id),function(a){return a>=0?a:void 0}),c=a.features[0].properties.name;if(b.length>1&&!this.geo_regions_layer){var d=this.geo_regions_name[this.geo_mode].txt.toLowerCase(),e=$.inArray(this.geo_regions_current_layer,this.geo_regions_path),f=this.geo_getAllSelectedChildren(a.features[0].id,"zipcode"==this.geo_mode?this.geo_mode:!1).length;c=f?"<b>"+f+"</b> "+(f>1?d:d.replace(/s$/,""))+" selected":"Zoom in for <b>"+(e?b.length:"")+"</b> "+d,c=a.features[0].properties.name+"<div>"+c+"</div>"}this.geo_label.html(c).css({position:"fixed",top:a.originalEvent.clientY+10+"px",left:a.originalEvent.clientX+10+"px"})}},removeLabel:function(){this.geo_label&&(this.geo_label.remove(),this.geo_label=null)},disableLabels:function(){this.removeLabel(),this.labels_disabled=!0},enableLabels:function(){this.labels_disabled=!1},geo_convertPxToLatLong:function(a){for(var b=360/Math.pow(2,a.zoom),c=180/Math.pow(2,a.zoom),d={x:b,y:c},e={x:256,y:256},f={x:d.x/e.x,y:d.y/e.y},g=0;g<a.features.length;g++)for(var h=a.features[g],i=0;i<h.geometry.coords.length;i++)for(var j=h.geometry.coords[i],k=0;k<j.length;k++)for(var l=j[k],m=0;m<l.length;m++)l[m][0]=a.xtile*b+f.x*l[m][0],l[m][1]=a.ytile*c-f.y*l[m][1]+d.y;return a},setInitCallback:function(a){this.map.once("moveend",function(){a()})},geo_setCallback:function(a,b){a.deferred=b,this.geo_callback=a},geo_toggle:function(a){this.geo=a,this.geo_grid=[],this.geo_grid_loading=0,this.geo_regions_label&&(this.geo_regions_labels&&(this.geo_regions_labels.setMap(null),this.geo_regions_labels=null),a&&(this.geo_regions_labels=new psrk.gmap.label_overlay({map:this.map}))),this.clearRegionsHierarchy(),this.geomode_msg&&this.map.removeControl(this.geomode_msg),this.geomode_msg=null},geo_regionToggle:function(a,b,c){c="undefined"==typeof c?!this.area_is_selected(a):c,this.geo_doRegionToggle(a,c),this.geo_regionParentToggle(a,c),this.geo_regionChildrenToggle(a,c),this.geo_regionsPartialSelect(),psrk.geopicker.updateOutput()},geo_regionToggleManual:function(a,b,c){this.geo_regionToggle(a,b,c),psrk.geopicker.runGeoCallback(a)},geo_doRegionToggle:function(a,b){if("ghost"!=this.getRegionType(a)){b?this.geo_regions_selected[a]=this.geo_regions_hierarchy[a]?this.geo_regions_hierarchy[a].name:!0:delete this.geo_regions_selected[a],this.geo_regions_label&&this.geo_regions_labels.toggleClass(a,"selected",b);var c=this.geo_regions[a];c&&(c.selected=b,this.geo_regionStatus(c,b?"select":"normal")),$("[id=geo_area_check_"+a+"]").attr("checked",b?!0:!1)}},geo_regionParentToggle:function(a,b){var c=this.getRegionParent(a);if(c&&c.length)for(var d=0;d<c.length;d++){var e=this.geo_regions_hierarchy[c[d]];if(e){for(var f=!0,g=0;g<e.children.length;g++)this.area_is_selected(e.children[g])||(f=!1);b?f&&this.geo_doRegionToggle(e.id,!0):this.geo_doRegionToggle(e.id,!1),this.geo_regionParentToggle(e.id,b)}}},geo_regionChildrenToggle:function(a,b){var c=this.getRegionChildren(a);if(c)for(var d=0;d<c.length;d++)this.geo_doRegionToggle(c[d],b),this.geo_regionChildrenToggle(c[d],b)},geo_regionPartialSelected:function(a,b){if(this.geo_regions_selected[a]&&!b)return!1;var c=this.geo_regions_hierarchy[a];if(c&&c.children&&c.children.length){for(var d=0;d<c.children.length;d++){if(this.geo_regions_selected[c.children[d]])return!0;if(this.geo_regionPartialSelected(c.children[d],!0))return!0}return!1}return!1},geo_getAllSelectedChildren:function(a,b){if(!b&&this.geo_regions_selected[a])return[];var c=this.geo_regions_hierarchy[a],d=[];if(c&&c.children&&c.children.length){for(var e=0;e<c.children.length;e++){if(this.geo_regions_selected[c.children[e]])if(b){var f=this.geo_regions_hierarchy[c.children[e]];f&&f.type==b&&d.push(c.children[e])}else d.push(c.children[e]);var g=this.geo_getAllSelectedChildren(c.children[e],b);g&&$.merge(d,g)}return d=$.grep(d,function(a,b){return b==$.inArray(a,d)})}},geo_regionsPartialSelect:function(){for(var a in this.geo_regions)this.geo_regionPartialSelected(a)?this.geo_regionPartialSelect(a):this.area_is_selected(a)||this.geo_regionStatus(this.geo_regions[a],"normal")},geo_regionPartialSelect:function(a){var b=this.geo_regions[a];b&&this.geo_regionStatus(b,"partial")},geo_regionStatus:function(a,b){a.partial="partial"==b?!0:!1,this.map.setFeatureState({source:"geopicker",id:a.id},{partial:"partial"==b?!0:!1}),this.map.setFeatureState({source:"geopicker",id:a.id},{selected:a.selected?!0:!1})},geo_setModes:function(a){if(a){var b=this,c=$("<div/>").attr("id","geo_modes").addClass("mapboxgl-ctrl");this.geo_modes_toggle=$('<a class="t" title="Hide">Geopicker</a>').click(function(){b.geo_toggleModes()}).appendTo(c);for(var d=0;d<a.length;d++){a[d].geo&&this.geo_regions_types.push(a[d].name);var e=$("<a/>").html(a[d].pretty_name).appendTo(c).attr({"data-name":a[d].name,"data-layer":a[d].layer,"data-zoom_min":a[d].zoom_min,"data-zoom_max":a[d].zoom_max,"data-tip":a[d].tip,href:"javascript:void(0)"});!function(a){psrk.safeClick(a,function(){var c=a.attr("class");b.geo_modes_radio&&c||(a.parent().children().not(":first").attr("class",""),a.attr("class",c?"":"sel").blur(),b.geo_setRegionsLayer(a.attr("data-layer")),psrk.geopicker.setCurrentMode(c?null:a.attr("data-name")))})}(e)}this.map.geo_modes_obj=c[0],mapboxgl.geoModes=function(){},mapboxgl.geoModes.prototype.onAdd=function(a){return this._map=a,this._container=a.geo_modes_obj,this._container},mapboxgl.geoModes.prototype.onRemove=function(){this._container.parentNode.removeChild(this._container),this._map=void 0},this.geo_modes=new mapboxgl.geoModes,this.map.addControl(this.geo_modes)}},geo_toggleModes:function(a){var b=this.geo_modes_toggle;b.toggleClass("off").attr("title",b.hasClass("off")?"Show":"Hide"),b.siblings().toggle(),b.hasClass("off")?$("#geomode_msg").addClass("minimized"):$("#geomode_msg").removeClass("minimized")},geo_setModesLoading:function(a){var b=$(".sel",$(this.geo_modes));a?b.addClass("pending"):b.removeClass("pending")},area_is_selected:function(a){return this.geo_regions_selected[a]?!0:!1},area_select:function(a,b,c){this.geo_regionToggleManual(a,b,c)},getSelectedRegions:function(){return this.geo_regions_selected},clearSelectedRegions:function(){for(var a in this.geo_regions_selected)this.geo_doRegionToggle(a,!1);psrk.geopicker.updateOutput()},clearRegionsHierarchy:function(){this.geo_regions_hierarchy=[]},clearDrawnPolygons:function(){this.map.getLayer("geopicker")&&this.map.removeLayer("geopicker"),this.map.getLayer("outlines")&&this.map.removeLayer("outlines"),this.map.getSource("geopicker")&&this.map.removeSource("geopicker"),this.features_source&&this.features_source.length&&(this.features_source=[]),this.regionClick&&(this.map.off("click","geopicker",this.regionClick),this.regionClick=null),this.regionHover&&(this.map.off("mousemove","geopicker",this.regionHover),this.regionHover=null),this.regionLeave&&(this.map.off("mouseleave","geopicker",this.regionLeave),this.regionLeave=null)},getRegionsTree:function(a){a=a||0;var b=[];b.id=a,b.selected=this.area_is_selected(a),b.name=this.getRegionName(a),b.type=this.getRegionType(a);var c=this.getRegionChildren(a);if(c.length>0){b.children=[];for(var d=0;d<c.length;d++)b.children[c[d]]=this.getRegionsTree(c[d])}return b},getRegionParameter:function(a,b){return this.geo_regions_hierarchy&&this.geo_regions_hierarchy[b]?this.geo_regions_hierarchy[b][a]:null},getRegionName:function(a){return this.getRegionParameter("name",a)},getRegionType:function(a){return this.getRegionParameter("type",a)},getRegionParent:function(a){return this.getRegionParameter("pid",a)},getRegionChildren:function(a){var b=this.getRegionParameter("children",a);return b?b.slice():[]},getRegionShowChildren:function(a){return this.getRegionParameter("show_children",a)},getRegionsName:function(){return this.geo_regions_name},getRegionsPath:function(){return this.geo_regions_path},getRegionsHierarchy:function(){return this.geo_regions_hierarchy},getRegionsCurrentLayer:function(){return this.geo_regions_current_layer},clearRegionsHierarchy:function(){this.geo_regions_hierarchy=[]},setRegionParameter:function(a,b,c){return this.geo_regions_hierarchy&&this.geo_regions_hierarchy[b]?(this.geo_regions_hierarchy[b][a]=c,!0):!1},setCurrentViewport:function(a){"object"!=typeof a&&(a=a.split(",")),this.map.fitBounds([[a[0],a[1]],[a[2],a[3]]])},getCurrentViewport:function(){var a=this.map.getBounds();if(a){var b={xmin:a.getSouthWest().lng,xmax:a.getNorthEast().lng,ymin:a.getSouthWest().lat,ymax:a.getNorthEast().lat,z:this.getGeopickerZoom()};return b}},getGeopickerZoom:function(){return Math.ceil(this.map.getZoom())},buildGeoModeMessage:function(a,b){mapboxgl.geoModeMsg||(mapboxgl.geoModeMsg=function(){},mapboxgl.geoModeMsg.prototype.onAdd=function(a){return this._map=a,this._container=a.geomode_msg_container[0],this._container},mapboxgl.geoModeMsg.prototype.onRemove=function(){this._container.parentNode.removeChild(this._container),this._map=void 0});var c=this;c.geomode_msg&&c.map.removeControl(c.geomode_msg),c.map.geomode_msg_container=$('<div id="geomode_msg" class="mapboxgl-ctrl"></div>'),$('<span id="geomode_msg_minimize" class="ps-ic-collapse-sp"></span>').click(function(){$("#geomode_msg").addClass("minimized")}).appendTo(c.map.geomode_msg_container),$('<span id="geomode_msg_maximize" class="ps-ic-info" aria-hidden="true"></span>').click(function(){$("#geomode_msg").removeClass("minimized")}).appendTo(c.map.geomode_msg_container),$('<div id="geomode_msg_text">'+a+'<div id="geomode_info_message"></div><div id="additional_message"></div></div>').appendTo(c.map.geomode_msg_container),b&&b.length&&b.forEach(function(a){a.appendTo(c.map.geomode_msg_container)}),c.geomode_msg=new mapboxgl.geoModeMsg,c.map.addControl(c.geomode_msg)},enterDrawMode:function(a,b,c){var d=this;if(this.drawmode)return void setTimeout(function(){d.enterDrawMode(a,b,c)},100);var e="polygontool"==a?"Use the map to draw a polygon around your desired area. Close the polygon either by returning to your starting point or by double-clicking to close automatically.":"Click on the map to set the center of the circle. Click again to set the circle's radius and click <b>Search</b>. (Note: the circle's radius is limited to 5 miles)",f=$('<span class="btn disabled">Delete current '+("polygontool"==a?"polygon":"circle")+"</span>").click(function(){$(this).hasClass("disabled")||(d.clearDrawnShape(),$("#geomode_msg .btn").addClass("disabled"),d.drawmode.circle?(d.drawmode.circle.center_set=!1,$(document).trigger("drawing_circle")):(d.drawmode.polygon={coords:[],vertices:[]},$(document).trigger("drawing_polygon"),d.map.doubleClickZoom.disable()),$(".mapboxgl-map").addClass("mouse-add"),$(".mapboxgl-canvas-container").addClass("mapboxgl-interactive"),d.drawmode.drawing=!0)});this.buildGeoModeMessage(e,[f]),"polygontool"==a?d.initPolygonDrawing(b,c):d.initCircleDrawing(b,c)},exitDrawMode:function(){this.drawmode&&(this.clearDrawnShape(),this.drawmode.circle?(this.map.off("mousemove",this.drawmode_events.move_handler),this.map.off("click",this.drawmode_events.click_handler),$(document).trigger("finished_drawing_circle"),this.drawmode=null):(this.map.off("mousemove",this.drawmode_events.move_handler),this.map.off("click",this.drawmode_events.click_handler),this.map.off("dblclick",this.drawmode_events.dblclick_handler),this.map.doubleClickZoom.enable(),$(document).trigger("finished_drawing_polygon"),this.drawmode=null),this.drawmode_events=null,this.geomode_msg&&this.map.removeControl(this.geomode_msg),this.geomode_msg=null)},shapeUpdated:function(){this.drawmode&&this.drawmode.callback&&this.drawmode.callback()},getDrawnShape:function(){return this.drawmode?this.drawmode.circle?{type:"circle",shape:{x:this.drawmode.circle.clng,y:this.drawmode.circle.clat,r:this.drawmode.circle.rad}}:{type:"polygon",shape:this.drawmode.polygon.coords}:void 0},clearDrawnShape:function(){this.drawmode&&(this.drawmode.circle?(this.map.getLayer("geopicker-circle")&&this.map.removeLayer("geopicker-circle"),this.map.getLayer("geopicker-circle-outline")&&this.map.removeLayer("geopicker-circle-outline"),this.map.getSource("geopicker-circle")&&this.map.removeSource("geopicker-circle"),this.map.getLayer("circle-points")&&this.map.removeLayer("circle-points"),this.map.getSource("circle-points")&&this.map.removeSource("circle-points"),$.extend(this.drawmode,{circle:{},allCirclePoints:[],visiblePointsOnCircle:[]}),this.canvas.style.cursor="",$("#geomode_info_message").text("")):(this.map.getLayer("geopicker-polygon")&&this.map.removeLayer("geopicker-polygon"),this.map.getLayer("geopicker-polygon-outline")&&this.map.removeLayer("geopicker-polygon-outline"),this.map.getLayer("polygon-vertices")&&this.map.removeLayer("polygon-vertices"),this.map.getSource("geopicker-polygon")&&this.map.removeSource("geopicker-polygon"),this.map.getSource("polygon-vertices")&&this.map.removeSource("polygon-vertices"),this.drawmode.polygon={coords:[],vertices:[]},this.canvas.style.cursor="",this.map.on("mousemove",this.drawmode_events.move_handler),this.map.on("click",this.drawmode_events.click_handler),this.map.on("dblclick",this.drawmode_events.dblclick_handler),$("#geomode_info_message").text("")),this.shapeUpdated())},initPolygonDrawing:function(a,b){var c=this;$(document).trigger("drawing_polygon"),c.map.doubleClickZoom.disable(),$("#geomode_msg .btn").addClass("disabled"),$(".mapboxgl-map").addClass("mouse-add"),$(".mapboxgl-canvas-container").addClass("mapboxgl-interactive"),this.drawmode={polygon:{coords:[],vertices:[]},callback:a,drawing:!0},this.canvas=this.map.getCanvasContainer();var d=null;this.lastCoords={},this.drawmode_events={},this.drawmode_events.click_handler=function(a){c.drawmode.drawing&&(c.checkIfPolygonClosed(a)?(c.drawmode.polygon.coords.pop(),c.map.getSource("geopicker-polygon").setData(c.createGeoJSONPolygon().data),c.closePolygon()):c.addPointToPolygon(a,!1))},this.map.on("click",this.drawmode_events.click_handler),this.drawmode_events.move_handler=function(a){if(c.drawmode.drawing&&c.drawmode.polygon.coords.length){var b=c.drawmode.polygon.vertices.length-1;c.lastCoords=c.drawmode.polygon.vertices[b],c.addPointToPolygon(a,!0)}},this.map.on("mousemove",this.drawmode_events.move_handler),this.drawmode_events.dblclick_handler=function(a){c.closePolygon(),c.lastCoords=null},this.map.on("dblclick",this.drawmode_events.dblclick_handler),this.polygon_events={},this.polygon_events.ongrab_handler=function(a){var b=a.lngLat;c.canvas.style.cursor="grabbing";var e=c.drawmode.polygon.vertices.length-1;if(d==e){var f=c.drawmode.polygon.vertices[d],g=b.lat-f[1];moveByLng=b.lng-f[0],c.movePolygon(moveByLng,g),c.moveVertices(moveByLng,g),c.drawmode.polygon.vertices[d]=[b.lng,b.lat]}else c.lastCoords=c.drawmode.polygon.vertices[e],c.drawmode.polygon.coords[d]={x:b.lat,y:b.lng},c.drawmode.polygon.vertices[d]=[b.lng,b.lat],c.drawmode.polygon.coords.pop(),c.drawmode.polygon.coords.push(c.drawmode.polygon.coords[0]),c.drawmode.polygon.vertices.pop(),c.updateCentroidCoords();c.map.getSource("polygon-vertices").setData(c.createGeoJSONPoints(c.drawmode.polygon.vertices).data),c.map.getSource("geopicker-polygon").setData(c.createGeoJSONPolygon().data)},this.polygon_events.onrelease_handler=function(){c.map.off("mousemove",c.polygon_events.ongrab_handler),c.map.off("touchmove",c.polygon_events.ongrab_handler),psrk.geopicker.updateOutput(),c.setInfoMessage()},this.polygon_events.mouseenter_handler=function(a){c.map.getLayer("polygon-vertices")&&(c.map.moveLayer("geopicker-polygon","polygon-vertices"),c.map.setLayoutProperty("polygon-vertices","visibility","visible"),c.map.setPaintProperty("polygon-vertices","circle-color","#3bb2d0"),c.canvas.style.cursor="move")},this.map.on("mouseenter","geopicker-polygon",this.polygon_events.mouseenter_handler),this.polygon_events.mouseleave_handler=function(a){c.map.getLayer("polygon-vertices")?c.map.setLayoutProperty("polygon-vertices","visibility","none"):c.map.getLayer("polygon-vertices")&&(c.map.setPaintProperty("polygon-vertices","circle-color","#cce7e8"),c.canvas.style.cursor=""),c.setInfoMessage()},this.map.on("mouseleave","geopicker-polygon",this.polygon_events.mouseleave_handler),this.map.on("mousedown","polygon-vertices",function(a){d=a.features[0].properties.id,a.preventDefault(),c.canvas.style.cursor="grab",c.map.on("mousemove",c.polygon_events.ongrab_handler),c.map.once("mouseup",c.polygon_events.onrelease_handler)}),this.map.on("touchstart","geopicker-polygon",function(a){1===a.points.length&&(a.preventDefault(),c.map.on("touchmove",c.polygon_events.ongrab_handler),c.map.once("touchend",c.polygon_events.onrelease_handler))}),this.geo_input=[],b&&setTimeout(function(){for(var a=b.split(","),d=0;d<a.length;d+=2)c.drawmode.polygon.coords.push({x:a[d],y:a[d+1]});c.map.getSource("geopicker-polygon")||c.updatePolygonLayer(),c.closePolygon()},500)},addPointToPolygon:function(a,b){var c=a.lngLat;if(b&&this.drawmode.polygon.coords.length>1&&this.drawmode.polygon.coords.pop(),!b){this.drawmode.polygon.vertices.push([c.lng,c.lat]);var d=this.drawmode.polygon.vertices.length;d>1&&this.addMidPoint(d-1,!1)}this.drawmode.polygon.coords.push({x:c.lat,y:c.lng}),this.updatePolygonLayer()},updatePolygonLayer:function(){this.map.getSource("geopicker-polygon")?this.map.getSource("geopicker-polygon").setData(this.createGeoJSONPolygon().data):this.map.addSource("geopicker-polygon",this.createGeoJSONPolygon()),!this.map.getLayer("geopicker-polygon")&&this.drawmode.polygon.coords.length>2&&this.map.addLayer({id:"geopicker-polygon",type:"fill",source:"geopicker-polygon",layout:{},paint:{"fill-color":"#00bf6d","fill-outline-color":"#00bf6d","fill-opacity":.1}}),!this.map.getLayer("geopicker-polygon-outline")&&this.drawmode.polygon.coords.length>1&&this.map.addLayer({id:"geopicker-polygon-outline",type:"line",source:"geopicker-polygon",layout:{},paint:{"line-color":"#00bf6d","line-width":2}})},setInfoMessage:function(){var a=psrk.geopicker.getInfoError();$("#geomode_info_message").text(a),$("#additional_message").text("Then click Search to apply your selection.")},updateCentroidCoords:function(){var a=this.drawmode.polygon.coords.map(function(a){return[parseFloat(a.y),parseFloat(a.x)]}),b=turf.polygon([a]),c=turf.center(b).geometry.coordinates;this.drawmode.polygon.vertices.push([c[0],c[1]])},addMidPoint:function(a,b){var c=turf.point(this.drawmode.polygon.vertices[b?0:a-1]),d=turf.point(this.drawmode.polygon.vertices[a]),e=turf.midpoint(c,d).geometry.coordinates,f=this.drawmode.polygon.coords.pop();this.drawmode.polygon.coords.push({x:e[1],y:e[0]}),this.drawmode.polygon.coords.push(f)},movePolygon:function(a,b){this.drawmode.polygon.coords=this.drawmode.polygon.coords.map(function(c){return{x:c.x+b,y:c.y+a}})},moveVertices:function(a,b){this.drawmode.polygon.vertices=this.drawmode.polygon.vertices.map(function(c){return[c[0]+a,c[1]+b]})},checkIfPolygonClosed:function(a){if(this.drawmode.polygon.coords.length<3)return!1;var b=this.drawmode.polygon.coords[0];return b=this.map.project([b.y,b.x]),Math.abs(a.point.x-b.x)<=30&&Math.abs(a.point.y-b.y)<=30?!0:!1},closePolygon:function(){for(var a=this,b=this.drawmode.polygon.coords.length,c=b-1;c>0;c--)this.drawmode.polygon.coords[c].x==this.drawmode.polygon.coords[c-1].x&&this.drawmode.polygon.coords[c].y==this.drawmode.polygon.coords[c-1].y&&(this.drawmode.polygon.coords.pop(),b--);3>b||(a.drawmode.drawing=!1,a.drawmode.polygon.coords.push(a.drawmode.polygon.coords[0]),a.shapeUpdated(),$("#geomode_msg .btn").removeClass("disabled"),$(".mapboxgl-map").removeClass("mouse-add"),$(document).trigger("finished_drawing_polygon"),setTimeout(function(){a.map.doubleClickZoom.enable()},10),a.map.setPaintProperty("geopicker-polygon","fill-color","#33689d"),a.map.setPaintProperty("geopicker-polygon","fill-outline-color","#33689d"),a.map.setPaintProperty("geopicker-polygon-outline","line-color","#33689d"),a.map.off("mousemove",this.drawmode_events.move_handler),a.map.off("click",this.drawmode_events.click_handler),a.map.off("dblclick",this.drawmode_events.dblclick_handler),a.setInfoMessage(),a.updateCentroidCoords(),a.addMidPoint(a.drawmode.polygon.vertices.length-1,!0),a.addVertices())},addVertices:function(){this.drawmode.polygon.vertices=[],this.drawmode.polygon.vertices=this.drawmode.polygon.coords.map(function(a){return[a.y,a.x]}),this.drawmode.polygon.vertices.pop(),this.updateCentroidCoords(),this.map.addSource("polygon-vertices",this.createGeoJSONPoints(this.drawmode.polygon.vertices)),this.map.addLayer({id:"polygon-vertices",type:"circle",source:"polygon-vertices",layout:{visibility:"none"},paint:{"circle-blur":.2,"circle-color":"#C6D5E1","circle-stroke-width":2,"circle-stroke-color":"#33689d"}})},createGeoJSONPolygon:function(){var a=this.drawmode.polygon.coords.slice();return a=a.map(function(a){return[a.y,a.x]}),this.drawmode.polygon.coords.length>2&&a.push(a[0]),{type:"geojson",data:{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:this.drawmode.polygon.coords.length>2?"Polygon":"LineString",coordinates:this.drawmode.polygon.coords.length>2?[a]:a}}]}}},initCircleDrawing:function(a,b){var c=this;$(document).trigger("drawing_circle"),$(".mapboxgl-map").addClass("mouse-add"),$(".mapboxgl-canvas-container").addClass("mapboxgl-interactive"),this.drawmode={circle:{},allCirclePoints:[],visiblePointsOnCircle:[],callback:a,drawing:!0},this.canvas=this.map.getCanvasContainer();var d=null;this.drawmode_events={},this.drawmode_events.click_handler=function(a){c.drawmode.drawing&&($("#geomode_msg .btn").addClass("disabled"),c.drawmode.circle.center_set?(c.drawmode.drawing=!1,c.shapeUpdated(),$("#geomode_msg .btn").removeClass("disabled"),$(".mapboxgl-map").removeClass("mouse-add"),$(document).trigger("finished_drawing_circle"),c.map.setPaintProperty("geopicker-circle","fill-color","#33689d"),c.map.setPaintProperty("geopicker-circle","fill-outline-color","#33689d"),c.map.setPaintProperty("geopicker-circle-outline","line-color","#33689d"),c.addCirclePoints()):c.setCircleCenter(a))},this.map.on("click",this.drawmode_events.click_handler),this.drawmode_events.move_handler=function(a){c.drawmode.drawing&&c.drawmode.circle.center_set&&c.updateCircleRadius(a)},this.map.on("mousemove",this.drawmode_events.move_handler),this.circle_events={},this.circle_events.ongrab_handler=function(a){var b=a.lngLat;c.canvas.style.cursor="grabbing",c.drawmode.visiblePointsOnCircle[d][0]==c.drawmode.circle.clng&&c.drawmode.visiblePointsOnCircle[d][1]==c.drawmode.circle.clat?($.extend(c.drawmode.circle,{clng:b.lng,clat:b.lat}),c.drawmode.visiblePointsOnCircle[d]=[b.lng,b.lat],c.map.getSource("geopicker-circle").setData(c.createGeoJSONCircle([c.drawmode.circle.clng,c.drawmode.circle.clat],c.drawmode.circle.rad).data),c.drawmode.visiblePointsOnCircle[d+1]=c.drawmode.allCirclePoints[0]):(c.updateCircleRadius(a),c.drawmode.visiblePointsOnCircle[d]=c.drawmode.allCirclePoints[0]),c.map.getSource("circle-points").setData(c.createGeoJSONPoints(c.drawmode.visiblePointsOnCircle).data)},this.circle_events.onrelease_handler=function(){c.map.off("mousemove",c.circle_events.ongrab_handler),c.map.off("touchmove",c.circle_events.ongrab_handler),psrk.geopicker.updateOutput()},this.circle_events.mouseenter_handler=function(a){c.map.getLayer("circle-points")&&(c.map.setLayoutProperty("circle-points","visibility","visible"),c.map.setPaintProperty("circle-points","circle-color","#3bb2d0"),
c.canvas.style.cursor="move")},this.map.on("mouseenter","geopicker-circle",this.circle_events.mouseenter_handler),this.circle_events.mouseleave_handler=function(a){if(c.map.getLayer("circle-points")){var b=c.distHaversine({lat:a.lngLat.lat,lng:a.lngLat.lng},{lat:c.drawmode.circle.clat,lng:c.drawmode.circle.clng});b<=c.drawmode.circle.rad&&c.map.setLayoutProperty("circle-points","visibility","none"),c.map.setPaintProperty("circle-points","circle-color","#cce7e8"),c.canvas.style.cursor=""}},this.map.on("mouseleave","geopicker-circle",this.circle_events.mouseleave_handler),this.map.on("mousedown","circle-points",function(a){d=a.features[0].properties.id,a.preventDefault(),c.canvas.style.cursor="grab",c.map.on("mousemove",c.circle_events.ongrab_handler),c.map.once("mouseup",c.circle_events.onrelease_handler)}),this.geo_input=[],b&&setTimeout(function(){var a=b.split(",");c.setCircleCenter({lngLat:{lng:parseFloat(a[0]),lat:parseFloat(a[1])}});var d=c.pointOnCircle(parseFloat(a[0]),parseFloat(a[1]),parseFloat(a[2]/1e3));c.updateCircleRadius({lngLat:{lng:d.lng,lat:d.lat}}),c.drawmode.drawing=!1,c.shapeUpdated(),$("#geomode_msg .btn").removeClass("disabled"),$(".mapboxgl-map").removeClass("mouse-add"),$(document).trigger("finished_drawing_circle")},500)},setCircleCenter:function(a){var b=a.lngLat;this.map.addSource("geopicker-circle",this.createGeoJSONCircle([b.lng,b.lat],1)),this.map.addLayer({id:"geopicker-circle",type:"fill",source:"geopicker-circle",layout:{},paint:{"fill-color":"#00bf6d","fill-outline-color":"#00bf6d","fill-opacity":.1}}),this.map.addLayer({id:"geopicker-circle-outline",type:"line",source:"geopicker-circle",layout:{},paint:{"line-color":"#00bf6d","line-width":2}}),this.drawmode.circle={clng:b.lng,clat:b.lat,rad:1},this.drawmode.circle.center_set=!0},updateCircleRadius:function(a){var b=this.distHaversine({lat:a.lngLat.lat,lng:a.lngLat.lng},{lat:this.drawmode.circle.clat,lng:this.drawmode.circle.clng});b>8046&&(b=8046),this.drawmode.circle.rad=b;var c=6215e-7*b;$("#geomode_info_message").text("Radius: "+c.toFixed(2)+" Miles"),this.map.getSource("geopicker-circle").setData(this.createGeoJSONCircle([this.drawmode.circle.clng,this.drawmode.circle.clat],b).data)},createGeoJSONCircle:function(a,b){var c=256,d={latitude:a[1],longitude:a[0]},e=[],f=b/1e3/(111.32*Math.cos(d.latitude*Math.PI/180)),g=b/1e3/110.574;this.drawmode.allCirclePoints=[];for(var h,i,j,k=0;c>k;k++)h=k/c*(2*Math.PI),i=f*Math.cos(h),j=g*Math.sin(h),e.push([d.longitude+i,d.latitude+j]),this.drawmode.allCirclePoints.push([d.longitude+i,d.latitude+j]);return e.push(e[0]),{type:"geojson",data:{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Polygon",coordinates:[e]}}]}}},createGeoJSONPoints:function(a){for(var b=a.length,c=[],d=0;b>d;d++)c.push({type:"Feature",geometry:{type:"Point",coordinates:a[d]},properties:{id:d}});return{type:"geojson",data:{type:"FeatureCollection",features:c}}},addCirclePoints:function(){this.drawmode.visiblePointsOnCircle.push([this.drawmode.circle.clng,this.drawmode.circle.clat],this.drawmode.allCirclePoints[0]),this.map.addSource("circle-points",this.createGeoJSONPoints(this.drawmode.visiblePointsOnCircle)),this.map.addLayer({id:"circle-points",type:"circle",source:"circle-points",layout:{visibility:"none"},paint:{"circle-blur":.2,"circle-color":"#C6D5E1","circle-stroke-width":2,"circle-stroke-color":"#33689d"}})},distHaversine:function(a,b){var c=function(a){return a*Math.PI/180},d=6371e3,e=c(b.lat-a.lat),f=c(b.lng-a.lng),g=Math.sin(e/2)*Math.sin(e/2)+Math.cos(c(a.lat))*Math.cos(c(b.lat))*Math.sin(f/2)*Math.sin(f/2),h=2*Math.atan2(Math.sqrt(g),Math.sqrt(1-g)),i=d*h;return i.toFixed(0)},pointOnCircle:function(a,b,c){var d=function(a){return a*Math.PI/180},e=function(a){return 180*a/Math.PI},f=6371,g=1.57;return b=d(b),a=d(a),lat2=Math.asin(Math.sin(b)*Math.cos(c/f)+Math.cos(b)*Math.sin(c/f)*Math.cos(g)),lng2=a+Math.atan2(Math.sin(g)*Math.sin(c/f)*Math.cos(b),Math.cos(c/f)-Math.sin(b)*Math.sin(lat2)),{lng:e(lng2),lat:e(lat2)}}};

$('<link rel="stylesheet" type="text/css">')
	.prependTo($('head'))
	.attr('href', psrk.url.cdn + "/webservices/index.d.css?v=t1.0.0&modules=report,geopicker,mapbox");
