var Zh=Object.defineProperty;var Wh=(e,t,i)=>t in e?Zh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var ge=(e,t,i)=>(Wh(e,typeof t!="symbol"?t+"":t,i),i);import{ag as to,a4 as jh,S as _r,i as xr,s as Wn,a as zt,p as Go,u as Bo,g as Uo,D as Jh,v as tt,w as ot,y as Yo,j as hr,W as Kh,k as gr,z as fn,A as hn,B as gn,C as dn,q as Xo,I as Qh,e as qt,F as Jl,G as Kl,h as Ht,a5 as $h,J as Vh,P as eg,ah as tg,o as Sn,c as j,X as ng,f as xe,l as It,Y as rg,Z as za,b as Ne,n as Bi,d as Ui,r as Ql,m as Bt,t as qa,L as Q}from"./index-aa6be1a1.js";import{L as zo,U as zn,a as $l,S as Ha}from"./UIEventSource-92ac4fe9.js";import{C as Br}from"./Constants-78dfb500.js";import{w as Vl}from"./Loading-38202d52.js";import{F as ig,a as Un}from"./Frame-be472814.js";function sg(e){return e<.5 ec t="e-1;return" jx math.abs og h='getComputedStyle(e),f=+h.opacity,m=h.filter==="none"?"":h.filter,p=f*(1-l),[y,_]=to(u);return{delay:t,duration:i,easing:s,css:(I,T)='>`opacity: ${f-p*T}; filter: ${m} blur(${T*y}${_});`}}function ag(e,{delay:t=0,duration:i=400,easing:s=jh}={}){const u=+getComputedStyle(e).opacity;return{delay:t,duration:i,easing:s,css:l=>`opacity: ${l*u}`}}function ug(e,{delay:t=0,duration:i=400,easing:s=ec,x:u=0,y:l=0,opacity:h=0}={}){const f=getComputedStyle(e),m=+f.opacity,p=f.transform==="none"?"":f.transform,y=m*(1-h),[_,I]=to(u),[T,w]=to(l);return{delay:t,duration:i,easing:s,css:(z,Y)=>`
transform: ${p} translate(${(1-z)*_}${I}, ${(1-z)*T}${w});
opacity: ${m-y*Y}`}}function lg(e,{delay:t=0,duration:i=400,easing:s=ec,axis:u="y"}={}){const l=getComputedStyle(e),h=+l.opacity,f=u==="y"?"height":"width",m=parseFloat(l[f]),p=u==="y"?["top","bottom"]:["left","right"],y=p.map(Z=>`${Z[0].toUpperCase()}${Z.slice(1)}`),_=parseFloat(l[`padding${y[0]}`]),I=parseFloat(l[`padding${y[1]}`]),T=parseFloat(l[`margin${y[0]}`]),w=parseFloat(l[`margin${y[1]}`]),z=parseFloat(l[`border${y[0]}Width`]),Y=parseFloat(l[`border${y[1]}Width`]);return{delay:t,duration:i,easing:s,css:Z=>`overflow: hidden;opacity: ${Math.min(Z*20,1)*h};${f}: ${Z*m}px;padding-${p[0]}: ${Z*_}px;padding-${p[1]}: ${Z*I}px;margin-${p[0]}: ${Z*T}px;margin-${p[1]}: ${Z*w}px;border-${p[0]}-width: ${Z*z}px;border-${p[1]}-width: ${Z*Y}px;`}}function cg(e){let t;const i=e[9].default,s=fn(i,e,e[10],null);return{c(){s&&s.c()},m(u,l){s&&s.m(u,l),t=!0},p(u,l){s&&s.p&&(!t||l&1024)&&hn(s,i,u,u[10],t?dn(i,u[10],l,null):gn(u[10]),null)},i(u){t||(tt(s,u),t=!0)},o(u){ot(s,u),t=!1},d(u){s&&s.d(u)}}}function fg(e){let t,i;const s=[e[1],{class:e[0]},{color:"none"}];let u={$$slots:{default:[cg]},$$scope:{ctx:e}};for(let l=0;l{i(12,t=zt(zt({},t),gr(Y))),i(1,u=hr(t,s)),"multiple"in Y&&i(2,f=Y.multiple),"flush"in Y&&i(3,m=Y.flush),"activeClass"in Y&&i(4,p=Y.activeClass),"inactiveClass"in Y&&i(5,y=Y.inactiveClass),"defaultClass"in Y&&i(6,_=Y.defaultClass),"classActive"in Y&&i(7,I=Y.classActive),"classInactive"in Y&&i(8,T=Y.classInactive),"$$scope"in Y&&i(10,h=Y.$$scope)},e.$$.update=()=>{i(0,z=Un(_,t.class))},t=gr(t),[z,u,f,m,p,y,_,I,T,l,h]}class gg extends _r{constructor(t){super(),xr(this,t,hg,fg,Wn,{multiple:2,flush:3,activeClass:4,inactiveClass:5,defaultClass:6,classActive:7,classInactive:8})}}const dg=e=>({}),Za=e=>({}),mg=e=>({}),Wa=e=>({}),pg=e=>({}),ja=e=>({});function yg(e){let t;const i=e[23].arrowdown,s=fn(i,e,e[22],Za),u=s||_g();return{c(){u&&u.c()},m(l,h){u&&u.m(l,h),t=!0},p(l,h){s&&s.p&&(!t||h&4194304)&&hn(s,i,l,l[22],t?dn(i,l[22],h,dg):gn(l[22]),Za)},i(l){t||(tt(u,l),t=!0)},o(l){ot(u,l),t=!1},d(l){u&&u.d(l)}}}function vg(e){let t;const i=e[23].arrowup,s=fn(i,e,e[22],Wa),u=s||xg();return{c(){u&&u.c()},m(l,h){u&&u.m(l,h),t=!0},p(l,h){s&&s.p&&(!t||h&4194304)&&hn(s,i,l,l[22],t?dn(i,l[22],h,mg):gn(l[22]),Wa)},i(l){t||(tt(u,l),t=!0)},o(l){ot(u,l),t=!1},d(l){u&&u.d(l)}}}function _g(e){let t,i;return{c(){t=Ne("svg"),i=Ne("path"),j(i,"stroke","currentColor"),j(i,"stroke-linecap","round"),j(i,"stroke-linejoin","round"),j(i,"stroke-width","2"),j(i,"d","m1 1 4 4 4-4"),j(t,"class","w-3 h-3 text-gray-800 dark:text-white"),j(t,"aria-hidden","true"),j(t,"xmlns","http://www.w3.org/2000/svg"),j(t,"fill","none"),j(t,"viewBox","0 0 10 6")},m(s,u){qt(s,t,u),xe(t,i)},p:Bi,d(s){s&&Ht(t)}}}function xg(e){let t,i;return{c(){t=Ne("svg"),i=Ne("path"),j(i,"stroke","currentColor"),j(i,"stroke-linecap","round"),j(i,"stroke-linejoin","round"),j(i,"stroke-width","2"),j(i,"d","M9 5 5 1 1 5"),j(t,"class","w-3 h-3 text-gray-800 dark:text-white"),j(t,"aria-hidden","true"),j(t,"xmlns","http://www.w3.org/2000/svg"),j(t,"fill","none"),j(t,"viewBox","0 0 10 6")},m(s,u){qt(s,t,u),xe(t,i)},p:Bi,d(s){s&&Ht(t)}}}function bs(e){let t,i,s,u,l,h,f,m;const p=e[23].header,y=fn(p,e,e[22],ja),_=[vg,yg],I=[];function T(w,z){return w[0]?0:1}return u=T(e),l=I[u]=_[u](e),{c(){t=Sn(e[1]),i=Sn("button"),y&&y.c(),s=Xo(),l.c(),j(i,"type","button"),j(i,"class",e[3]),j(i,"aria-expanded",e[0]),ng(e[1])(t,{class:"group"})},m(w,z){qt(w,t,z),xe(t,i),y&&y.m(i,null),xe(i,s),I[u].m(i,null),h=!0,f||(m=It(i,"click",e[7]),f=!0)},p(w,z){y&&y.p&&(!h||z&4194304)&&hn(y,p,w,w[22],h?dn(p,w[22],z,pg):gn(w[22]),ja);let Y=u;u=T(w),u===Y?I[u].p(w,z):(Jl(),ot(I[Y],1,1,()=>{I[Y]=null}),Kl(),l=I[u],l?l.p(w,z):(l=I[u]=_[u](w),l.c()),tt(l,1),l.m(i,null)),(!h||z&8)&&j(i,"class",w[3]),(!h||z&1)&&j(i,"aria-expanded",w[0])},i(w){h||(tt(y,w),tt(l),h=!0)},o(w){ot(y,w),ot(l),h=!1},d(w){w&&Ht(t),y&&y.d(w),I[u].d(),f=!1,m()}}}function Ja(e){let t,i,s,u;const l=e[23].default,h=fn(l,e,e[22],null);return{c(){t=Sn("div"),i=Sn("div"),h&&h.c(),j(i,"class",e[4])},m(f,m){qt(f,t,m),xe(t,i),h&&h.m(i,null),u=!0},p(f,m){e=f,h&&h.p&&(!u||m&4194304)&&hn(h,l,e,e[22],u?dn(l,e[22],m,null):gn(e[22]),null),(!u||m&16)&&j(i,"class",e[4])},i(f){u||(tt(h,f),rg(()=>{u&&(s||(s=za(t,e[5],e[2],!0)),s.run(1))}),u=!0)},o(f){ot(h,f),s||(s=za(t,e[5],e[2],!1)),s.run(0),u=!1},d(f){f&&Ht(t),h&&h.d(f),f&&s&&s.end()}}}function Eg(e){let t=e[1],i,s,u,l=e[1]&&bs(e),h=e[0]&&Ja(e);return{c(){l&&l.c(),i=Xo(),h&&h.c(),s=Qh()},m(f,m){l&&l.m(f,m),qt(f,i,m),h&&h.m(f,m),qt(f,s,m),u=!0},p(f,[m]){f[1]?t?Wn(t,f[1])?(l.d(1),l=bs(f),t=f[1],l.c(),l.m(i.parentNode,i)):l.p(f,m):(l=bs(f),t=f[1],l.c(),l.m(i.parentNode,i)):t&&(l.d(1),l=null,t=f[1]),f[0]?h?(h.p(f,m),m&1&&tt(h,1)):(h=Ja(f),h.c(),tt(h,1),h.m(s.parentNode,s)):h&&(Jl(),ot(h,1,1,()=>{h=null}),Kl())},i(f){u||(tt(l),tt(h),u=!0)},o(f){ot(l),ot(h),u=!1},d(f){l&&l.d(f),f&&Ht(i),h&&h.d(f),f&&Ht(s)}}}function Ig(e,t,i){let s,u,{$$slots:l={},$$scope:h}=t,{tag:f="h2"}=t,{open:m=!1}=t,{activeClass:p=void 0}=t,{inactiveClass:y=void 0}=t,{defaultClass:_="flex items-center justify-between w-full font-medium text-left group-first:rounded-t-xl border-gray-200 dark:border-gray-700"}=t,{transitionType:I="slide"}=t,{transitionParams:T={}}=t,{paddingFlush:w="py-5"}=t,{paddingDefault:z="p-5"}=t,{textFlushOpen:Y="text-gray-900 dark:text-white"}=t,{textFlushDefault:Z="text-gray-500 dark:text-gray-400"}=t,{borderClass:S="border-s border-e group-first:border-t"}=t,{borderOpenClass:b="border-s border-e"}=t,{borderBottomClass:R="border-b"}=t,{borderSharedClass:U="border-gray-200 dark:border-gray-700"}=t,{classActive:X=void 0}=t,{classInactive:G=void 0}=t,E=Un(p,X),v=Un(y,G);const k=(F,q)=>{switch(I){case"blur":return og(F,q);case"fly":return ug(F,q);case"fade":return ag(F,q);default:return lg(F,q)}},C=$h("ctx")??{},L={},P=C.selected??Vl();Vh(e,P,F=>i(24,u=F));let M=m;m=!1,eg(()=>(M&&tg(P,u=L,u),P.subscribe(F=>i(0,m=F===L))));const A=F=>P.set(m?{}:L);let B;return e.$$set=F=>{i(30,t=zt(zt({},t),gr(F))),"tag"in F&&i(1,f=F.tag),"open"in F&&i(0,m=F.open),"activeClass"in F&&i(8,p=F.activeClass),"inactiveClass"in F&&i(9,y=F.inactiveClass),"defaultClass"in F&&i(10,_=F.defaultClass),"transitionType"in F&&i(11,I=F.transitionType),"transitionParams"in F&&i(2,T=F.transitionParams),"paddingFlush"in F&&i(12,w=F.paddingFlush),"paddingDefault"in F&&i(13,z=F.paddingDefault),"textFlushOpen"in F&&i(14,Y=F.textFlushOpen),"textFlushDefault"in F&&i(15,Z=F.textFlushDefault),"borderClass"in F&&i(16,S=F.borderClass),"borderOpenClass"in F&&i(17,b=F.borderOpenClass),"borderBottomClass"in F&&i(18,R=F.borderBottomClass),"borderSharedClass"in F&&i(19,U=F.borderSharedClass),"classActive"in F&&i(20,X=F.classActive),"classInactive"in F&&i(21,G=F.classInactive),"$$scope"in F&&i(22,h=F.$$scope)},e.$$.update=()=>{i(3,B=Un([_,C.flush||S,R,U,C.flush?w:z,m&&(C.flush?Y:E||C.activeClass),!m&&(C.flush?Z:v||C.inactiveClass),t.class])),e.$$.dirty&929792&&i(4,s=Un([C.flush?w:z,C.flush?"":b,R,U]))},t=gr(t),[m,f,T,B,s,k,P,A,p,y,_,I,w,z,Y,Z,S,b,R,U,X,G,h,l]}class Sg extends _r{constructor(t){super(),xr(this,t,Ig,Eg,Wn,{tag:1,open:0,activeClass:8,inactiveClass:9,defaultClass:10,transitionType:11,transitionParams:2,paddingFlush:12,paddingDefault:13,textFlushOpen:14,textFlushDefault:15,borderClass:16,borderOpenClass:17,borderBottomClass:18,borderSharedClass:19,classActive:20,classInactive:21})}}function kg(e){let t,i,s,u,l;const h=e[2].default,f=fn(h,e,e[1],null);let m=[{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 20 20"},{fill:"currentColor"},{"aria-hidden":"true"},e[0]],p={};for(let y=0;y{t=zt(zt({},t),gr(I)),i(0,u=hr(t,s)),"$$scope"in I&&i(1,h=I.$$scope)},[u,h,l,f,m,p,y,_]}class Kx extends _r{constructor(t){super(),xr(this,t,Ng,kg,Wn,{})}}class Be{static MapRange(t,i){const s=[];if(t.total>1e5)throw`Tilerange too big (z is ${t.zoomlevel}, total tiles needed: ${t.total})`;for(let l=t.xstart;l1e5)throw`Tilerange too big (z is ${t.zoomlevel}, total tiles needed: ${t.total})`;for(let l=t.xstart;lm||w>p||z>y){f=_,m=s,p=w,y=z,l=0;return}var Y=wg([f,_],i.properties);if(t(Y,s,u,z,l)===!1)return!1;l++,f=_})===!1)return!1}}})}function Lg(e,t,i){var s=i,u=!1;return Cg(e,function(l,h,f,m,p){u===!1&&i===void 0?s=l:s=t(s,l,h,f,m,p),u=!0}),s}function mt(e,t={}){if(e.bbox!=null&&t.recompute!==!0)return e.bbox;const i=[1/0,1/0,-1/0,-1/0];return Er(e,s=>{i[0]>s[0]&&(i[0]=s[0]),i[1]>s[1]&&(i[1]=s[1]),i[2]t.maxLon?!1:this.minLatt.maxLon||this.maxLat>t.maxLat||this.minLon=u&&$t.distanceBetween(t,[s,this.minLat])=s&&$t.distanceBetween(t,[this.minLon,u])90){const t="Invalid BBOX detected: latitude is out of range. Did you swap lat & lon somewhere? min:"+this.minLat+"; max:"+this.maxLat;throw console.trace(t),t}}overlapsWithFeature(t){return $t.calculateOverlap(this.asGeoJson({}),[t]).length>0}center(){return[(this.minLon+this.maxLon)/2,(this.minLat+this.maxLat)/2]}static dropFullyContained(t,i){const s=[],u=[];i??(i=l=>l);for(const l of t){const h=i(l);if(!u.some(f=>h.isContainedIn(f))){for(let f=s.length-1;f>=0;f--)u[f].isContainedIn(h)&&(s.splice(f,1),u.splice(f,1));u.push(h),s.push(l)}}return s}};ge(ht,"global",new ht([[-180,-90],[180,90]]));let Yn=ht;function Pg(e){return e%(2*Math.PI)*180/Math.PI}function li(e){return e%360*Math.PI/180}function Ka(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return[...e.geometry.coordinates];if(e.type==="Point")return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Dn(e,t,i={}){if(i.final===!0)return Ag(e,t);const s=Ka(e),u=Ka(t),l=li(s[0]),h=li(u[0]),f=li(s[1]),m=li(u[1]),p=Math.sin(h-l)*Math.cos(m),y=Math.cos(f)*Math.sin(m)-Math.sin(f)*Math.cos(m)*Math.cos(h-l);return Pg(Math.atan2(p,y))}function Ag(e,t){let i=Dn(t,e);return i=(i+180)%360,i}var xt=63710088e-1,Og={centimeters:xt*100,centimetres:xt*100,degrees:360/(2*Math.PI),feet:xt*3.28084,inches:xt*39.37,kilometers:xt/1e3,kilometres:xt/1e3,meters:xt,metres:xt,miles:xt/1609.344,millimeters:xt*1e3,millimetres:xt*1e3,nauticalmiles:xt/1852,radians:1,yards:xt*1.0936};function Mg(e,t,i={}){const s={type:"Feature"};return(i.id===0||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=t||{},s.geometry=e,s}function Rg(e,t,i={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function tc(e,t,i,s={}){const u=Dg(e),l=Cs(u[0]),h=Cs(u[1]),f=Cs(i),m=Fg(t,s.units),p=Math.asin(Math.sin(h)*Math.cos(m)+Math.cos(h)*Math.sin(m)*Math.cos(f)),y=l+Math.atan2(Math.sin(f)*Math.sin(m)*Math.cos(h),Math.cos(m)-Math.sin(h)*Math.sin(p)),_=Qa(y),I=Qa(p);return Rg([_,I],s.properties)}var Et=63710088e-1,Gg={centimeters:Et*100,centimetres:Et*100,degrees:360/(2*Math.PI),feet:Et*3.28084,inches:Et*39.37,kilometers:Et/1e3,kilometres:Et/1e3,meters:Et,metres:Et,miles:Et/1609.344,millimeters:Et*1e3,millimetres:Et*1e3,nauticalmiles:Et/1852,radians:1,yards:Et*1.0936};function Bg(e,t="kilometers"){const i=Gg[t];if(!i)throw new Error(t+" units is invalid");return e*i}function ci(e){return e%360*Math.PI/180}function Va(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return[...e.geometry.coordinates];if(e.type==="Point")return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function At(e,t,i={}){var s=Va(e),u=Va(t),l=ci(u[1]-s[1]),h=ci(u[0]-s[0]),f=ci(s[1]),m=ci(u[1]),p=Math.pow(Math.sin(l/2),2)+Math.pow(Math.sin(h/2),2)*Math.cos(f)*Math.cos(m);return Bg(2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p)),i.units)}function Ug(e,t,i={}){const s={type:"Feature"};return(i.id===0||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=t||{},s.geometry=e,s}function eu(e,t,i={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length=l&&h===u.length-1);h++)if(l>=t){const f=t-l;if(f){const m=Dn(u[h],u[h-1])-180;return tc(u[h],f,m,i)}else return eu(u[h])}else l+=At(u[h],u[h+1],i);return eu(u[u.length-1])}var nu=63710088e-1;function Ls(e){return bg(e,(t,i)=>t+zg(i),0)}function zg(e){let t=0,i;switch(e.type){case"Polygon":return ru(e.coordinates);case"MultiPolygon":for(i=0;i0){t+=Math.abs(iu(e[0]));for(let i=1;i=t?(s+2)%t:s+2],f=u[0]*Ps,m=l[1]*Ps,p=h[0]*Ps;i+=(p-f)*Math.sin(m),s++}return i*qg}const an=11102230246251565e-32,ut=134217729,Hg=(3+8*an)*an;function As(e,t,i,s,u){let l,h,f,m,p=t[0],y=s[0],_=0,I=0;y>p==y>-p?(l=p,p=t[++_]):(l=y,y=s[++I]);let T=0;if(_p==y>-p?(h=p+l,f=l-(h-p),p=t[++_]):(h=y+l,f=l-(h-y),y=s[++I]),l=h,f!==0&&(u[T++]=f);_p==y>-p?(h=l+p,m=h-l,f=l-(h-m)+(p-m),p=t[++_]):(h=l+y,m=h-l,f=l-(h-m)+(y-m),y=s[++I]),l=h,f!==0&&(u[T++]=f);for(;_=M||-P>=M||(_=e-v,f=e-(v+_)+(_-u),_=i-k,p=i-(k+_)+(_-u),_=t-C,m=t-(C+_)+(_-l),_=s-L,y=s-(L+_)+(_-l),f===0&&m===0&&p===0&&y===0)||(M=Jg*h+Hg*Math.abs(P),P+=v*y+L*f-(C*p+k*m),P>=M||-P>=M))return P;R=f*L,I=ut*f,T=I-(I-f),w=f-T,I=ut*L,z=I-(I-L),Y=L-z,U=w*Y-(R-T*z-w*z-T*Y),X=m*k,I=ut*m,T=I-(I-m),w=m-T,I=ut*k,z=I-(I-k),Y=k-z,G=w*Y-(X-T*z-w*z-T*Y),Z=U-G,_=U-Z,ft[0]=U-(Z+_)+(_-G),S=R+Z,_=S-R,b=R-(S-_)+(Z-_),Z=b-X,_=b-Z,ft[1]=b-(Z+_)+(_-X),E=S+Z,_=E-S,ft[2]=S-(E-_)+(Z-_),ft[3]=E;const A=As(4,rr,4,ft,su);R=v*y,I=ut*v,T=I-(I-v),w=v-T,I=ut*y,z=I-(I-y),Y=y-z,U=w*Y-(R-T*z-w*z-T*Y),X=C*p,I=ut*C,T=I-(I-C),w=C-T,I=ut*p,z=I-(I-p),Y=p-z,G=w*Y-(X-T*z-w*z-T*Y),Z=U-G,_=U-Z,ft[0]=U-(Z+_)+(_-G),S=R+Z,_=S-R,b=R-(S-_)+(Z-_),Z=b-X,_=b-Z,ft[1]=b-(Z+_)+(_-X),E=S+Z,_=E-S,ft[2]=S-(E-_)+(Z-_),ft[3]=E;const B=As(A,su,4,ft,ou);R=f*y,I=ut*f,T=I-(I-f),w=f-T,I=ut*y,z=I-(I-y),Y=y-z,U=w*Y-(R-T*z-w*z-T*Y),X=m*p,I=ut*m,T=I-(I-m),w=m-T,I=ut*p,z=I-(I-p),Y=p-z,G=w*Y-(X-T*z-w*z-T*Y),Z=U-G,_=U-Z,ft[0]=U-(Z+_)+(_-G),S=R+Z,_=S-R,b=R-(S-_)+(Z-_),Z=b-X,_=b-Z,ft[1]=b-(Z+_)+(_-X),E=S+Z,_=E-S,ft[2]=S-(E-_)+(Z-_),ft[3]=E;const F=As(B,ou,4,ft,au);return au[F-1]}function Qg(e,t,i,s,u,l){const h=(t-l)*(i-u),f=(e-u)*(s-l),m=h-f,p=Math.abs(h+f);return Math.abs(m)>=Wg*p?m:-Kg(e,t,i,s,u,l,p)}function $g(e,t){var i,s,u=0,l,h,f,m,p,y,_,I=e[0],T=e[1],w=t.length;for(i=0;i=0||h=0)return 0}else if(p>=0&&f=0){if(l=Qg(h,m,f,p,0,0),l===0)return 0;(l>0&&p>0&&f0)&&u++}y=_,f=p,h=m}}return u%2!==0}function Vg(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return[...e.geometry.coordinates];if(e.type==="Point")return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function ed(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Yi(e,t,i={}){const s=Vg(e),u=ed(t);for(let l=0;l"u"?null:i.epsilon))return!0}return!1}function td(e,t,i,s,u){const l=i[0],h=i[1],f=e[0],m=e[1],p=t[0],y=t[1],_=i[0]-f,I=i[1]-m,T=p-f,w=y-m,z=_*w-I*T;if(u!==null){if(Math.abs(z)>u)return!1}else if(z!==0)return!1;if(Math.abs(T)===Math.abs(w)&&Math.abs(T)===0)return s?!1:i[0]===e[0]&&i[1]===e[1];if(s){if(s==="start")return Math.abs(T)>=Math.abs(w)?T>0?f0?m=Math.abs(w)?T>0?f0?m=Math.abs(w)?T>0?f0?m=Math.abs(w)?T>0?f0?m0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const t=this.data[0],i=this.data.pop();return this.length--,this.length>0&&(this.data[0]=i,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:i,compare:s}=this,u=i[t];for(;t>0;){const l=t-1>>1,h=i[l];if(s(u,h)>=0)break;i[t]=h,t=l}i[t]=u}_down(t){const{data:i,compare:s}=this,u=this.length>>1,l=i[t];for(;t=0)break;i[t]=f,t=h}i[t]=l}};function rd(e,t){return et?1:0}function rc(e,t){return e.p.x>t.p.x?1:e.p.xt.p.y?1:-1:1}function id(e,t){return e.rightSweepEvent.p.x>t.rightSweepEvent.p.x?1:e.rightSweepEvent.p.x0?(y.isLeftEndpoint=!0,p.isLeftEndpoint=!1):(p.isLeftEndpoint=!0,y.isLeftEndpoint=!1),t.push(p),t.push(y),h=f,gi=gi+1}}fi=fi+1}let od=class{constructor(t){this.leftSweepEvent=t,this.rightSweepEvent=t.otherEvent}};function ad(e,t){if(e===null||t===null||e.leftSweepEvent.ringId===t.leftSweepEvent.ringId&&(e.rightSweepEvent.isSamePoint(t.leftSweepEvent)||e.rightSweepEvent.isSamePoint(t.leftSweepEvent)||e.rightSweepEvent.isSamePoint(t.rightSweepEvent)||e.leftSweepEvent.isSamePoint(t.leftSweepEvent)||e.leftSweepEvent.isSamePoint(t.rightSweepEvent)))return!1;const i=e.leftSweepEvent.p.x,s=e.leftSweepEvent.p.y,u=e.rightSweepEvent.p.x,l=e.rightSweepEvent.p.y,h=t.leftSweepEvent.p.x,f=t.leftSweepEvent.p.y,m=t.rightSweepEvent.p.x,p=t.rightSweepEvent.p.y,y=(p-f)*(u-i)-(m-h)*(l-s),_=(m-h)*(s-f)-(p-f)*(i-h),I=(u-i)*(s-f)-(l-s)*(i-h);if(y===0)return!1;const T=_/y,w=I/y;if(T>=0&&T=0&&w{const y=p.join(",");m[y]||(m[y]=!0,f.push(p))})}else f=h;return uu(f.map(m=>nd(m)))}function fd(e,t,i,s,u){ic(e,t,i||0,s||e.length-1,u||hd)}function ic(e,t,i,s,u){for(;s>i;){if(s-i>600){var l=s-i+1,h=t-i+1,f=Math.log(l),m=.5*Math.exp(2*f/3),p=.5*Math.sqrt(f*m*(l-m)/l)*(h-l/20&&Or(e,i,s);T0;)w--}u(e[i],I)===0?Or(e,i,w):(w++,Or(e,w,s)),wt?1:0}let Kt=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let i=this.data;const s=[];if(!mi(t,i))return s;const u=this.toBBox,l=[];for(;i;){for(let h=0;h=0&&l[i].children.length>this._maxEntries;)this._split(l,i),i--;this._adjustParentBBoxes(u,l,i)}_split(t,i){const s=t[i],u=s.children.length,l=this._minEntries;this._chooseSplitAxis(s,l,u);const h=this._chooseSplitIndex(s,l,u),f=ar(s.children.splice(h,s.children.length-h));f.height=s.height,f.leaf=s.leaf,ir(s,this.toBBox),ir(f,this.toBBox),i?t[i-1].children.push(f):this._splitRoot(s,f)}_splitRoot(t,i){this.data=ar([t,i]),this.data.height=t.height+1,this.data.leaf=!1,ir(this.data,this.toBBox)}_chooseSplitIndex(t,i,s){let u,l=1/0,h=1/0;for(let f=i;f=i;p--){const y=t.children[p];Yr(f,t.leaf?l(y):y),m+=di(f)}return m}_adjustParentBBoxes(t,i,s){for(let u=s;u>=0;u--)Yr(i[u],t)}_condense(t){for(let i=t.length-1,s;i>=0;i--)t[i].children.length===0?i>0?(s=t[i-1].children,s.splice(s.indexOf(t[i]),1)):this.clear():ir(t[i],this.toBBox)}};function gd(e,t,i){if(!i)return t.indexOf(e);for(let s=0;s=e.minX&&t.maxY>=e.minY}function ar(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function hu(e,t,i,s,u){const l=[t,i];for(;l.length;){if(i=l.pop(),t=l.pop(),i-t{Id(i,t)}),xd(t)}function Id(e,t){let i=[];const s=e.geometry;if(s!==null){switch(s.type){case"Polygon":i=du(s);break;case"LineString":i=[du(s)]}i.forEach(u=>{Sd(u,e.properties).forEach(h=>{h.id=t.length,t.push(h)})})}}function Sd(e,t){const i=[];return e.reduce((s,u)=>{const l=_d([s,u],t);return l.bbox=kd(s,u),i.push(l),u}),i}function kd(e,t){const i=e[0],s=e[1],u=t[0],l=t[1],h=iu?i:u,p=s>l?s:l;return[h,f,m,p]}function Nd(e,t,i={}){const s={type:"Feature"};return(i.id===0||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=t||{},s.geometry=e,s}function pi(e,t,i={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function wd(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}var Td=Object.defineProperty,bd=Object.defineProperties,Cd=Object.getOwnPropertyDescriptors,vu=Object.getOwnPropertySymbols,Ld=Object.prototype.hasOwnProperty,Pd=Object.prototype.propertyIsEnumerable,_u=(e,t,i)=>t in e?Td(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,xu=(e,t)=>{for(var i in t||(t={}))Ld.call(t,i)&&_u(e,i,t[i]);if(vu)for(var i of vu(t))Pd.call(t,i)&&_u(e,i,t[i]);return e},Eu=(e,t)=>bd(e,Cd(t));function Xi(e,t,i={}){if(!e||!t)throw new Error("lines and pt are required arguments");const s=yi(t);let u=pi([1/0,1/0],{dist:1/0,index:-1,multiFeatureIndex:-1,location:-1}),l=0;return ns(e,function(h,f,m){const p=wd(h);for(let y=0;yU||Mn(u,k)>U?At(Rn(k),Rn(s))=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function so(e){return e.type==="Feature"?e.geometry:e}function qn(e,t,i={}){if(!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");const s=Dd(e),u=so(t),l=u.type,h=t.bbox;let f=u.coordinates;if(h&&Gd(s,h)===!1)return!1;l==="Polygon"&&(f=[f]);let m=!1;for(var p=0;p=e[0]&&t[3]>=e[1]}function Fs(e,t){var i=so(e),s=so(t),u=i.type,l=s.type;switch(u){case"Point":switch(l){case"MultiPoint":return Bd(i,s);case"LineString":return Yi(i,s,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return qn(i,s,{ignoreBoundary:!0});default:throw new Error("feature2 "+l+" geometry not supported")}case"MultiPoint":switch(l){case"MultiPoint":return Ud(i,s);case"LineString":return Yd(i,s);case"Polygon":case"MultiPolygon":return Xd(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}case"LineString":switch(l){case"LineString":return zd(i,s);case"Polygon":case"MultiPolygon":return qd(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}case"Polygon":switch(l){case"Polygon":case"MultiPolygon":return Hd(i,s);default:throw new Error("feature2 "+l+" geometry not supported")}default:throw new Error("feature1 "+u+" geometry not supported")}}function Bd(e,t){var i,s=!1;for(i=0;it[0]||e[2]t[1]||e[3]a.length)&&(n=a.length);for(var r=0,o=Array(n);r=a.length?{done:!0}:{done:!1,value:a[o++]}},e:function(N){throw N},f:c}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var g,d=!0,x=!1;return{s:function(){r=r.call(a)},n:function(){var N=r.next();return d=N.done,N},e:function(N){x=!0,g=N},f:function(){try{d||r.return==null||r.return()}finally{if(x)throw g}}}}function p(){return p=typeof Reflect0;n>>>=1)r+=(a.high&n)===n?"1":"0";for(n=2147483648;n>0;n>>>=1)r+=(a.low&n)===n?"1":"0";return r}}])}();function W(){}function se(){}W.NaN=NaN,W.isNaN=function(a){return Number.isNaN(a)},W.isInfinite=function(a){return!Number.isFinite(a)},W.MAX_VALUE=Number.MAX_VALUE,W.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,W.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,typeof Float64Array=="function"&&typeof Int32Array=="function"?(A=2146435072,B=new Float64Array(1),F=new Int32Array(B.buffer),W.doubleToLongBits=function(a){B[0]=a;var n=0|F[0],r=0|F[1];return(r&A)===A&&1048575&r&&n!==0&&(n=0,r=2146959360),new ee(r,n)},W.longBitsToDouble=function(a){return F[0]=a.low,F[1]=a.high,B[0]}):(k=1023,C=Math.log2,L=Math.floor,P=Math.pow,M=function(){for(var a=53;a>0;a--){var n=P(2,a)-1;if(L(C(n))+1===a)return n}return 0}(),W.doubleToLongBits=function(a){var n,r,o,c,g,d,x,N,O;if(a1)if(n>>=1,O|=(1&N)>>=1,r!==o&&(N|=524288);if(x=c+k,g=n===0,n=a-n,c=1?(n=r-1,g?(x--,g=!1):(o>20)-k,c=0,r=1>>=1;for(r=1>>=1;if(o===-1023){if(c===0)return 0*x;o=-1022}else{if(o===1024)return c===0?x/0:NaN;c+=1}return x*c*P(2,o)});var J=function(a){function n(r){var o;return u(this,n),(o=s(this,n,[r])).name=Object.keys({RuntimeException:n})[0],o}return _(n,a),f(n)}(R),$=function(a){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return _(n,a),f(n,null,[{key:"constructor_",value:function(){if(arguments.length===0)J.constructor_.call(this);else if(arguments.length===1){var r=arguments[0];J.constructor_.call(this,r)}}}])}(J),te=function(){function a(){u(this,a)}return f(a,null,[{key:"shouldNeverReachHere",value:function(){if(arguments.length===0)a.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new $("Should never reach here"+(n!==null?": "+n:""))}}},{key:"isTrue",value:function(){if(arguments.length===1){var n=arguments[0];a.isTrue(n,null)}else if(arguments.length===2){var r=arguments[1];if(!arguments[0])throw r===null?new $:new $(r)}}},{key:"equals",value:function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];a.equals(n,r,null)}else if(arguments.length===3){var o=arguments[0],c=arguments[1],g=arguments[2];if(!c.equals(o))throw new $("Expected "+o+" but encountered "+c+(g!==null?": "+g:""))}}}])}(),ae=new ArrayBuffer(8),oe=new Float64Array(ae),me=new Int32Array(ae),H=function(){function a(){u(this,a),a.constructor_.apply(this,arguments)}return f(a,[{key:"getM",value:function(){return W.NaN}},{key:"setOrdinate",value:function(n,r){switch(n){case a.X:this.x=r;break;case a.Y:this.y=r;break;case a.Z:this.setZ(r);break;default:throw new U("Invalid ordinate index: "+n)}}},{key:"equals2D",value:function(){if(arguments.length===1){var n=arguments[0];return this.x===n.x&&this.y===n.y}if(arguments.length===2){var r=arguments[0],o=arguments[1];return!!q.equalsWithTolerance(this.x,r.x,o)&&!!q.equalsWithTolerance(this.y,r.y,o)}}},{key:"setM",value:function(n){throw new U("Invalid ordinate index: "+a.M)}},{key:"getZ",value:function(){return this.z}},{key:"getOrdinate",value:function(n){switch(n){case a.X:return this.x;case a.Y:return this.y;case a.Z:return this.getZ()}throw new U("Invalid ordinate index: "+n)}},{key:"equals3D",value:function(n){return this.x===n.x&&this.y===n.y&&(this.getZ()===n.getZ()||W.isNaN(this.getZ())&&W.isNaN(n.getZ()))}},{key:"equals",value:function(n){return n instanceof a&&this.equals2D(n)}},{key:"equalInZ",value:function(n,r){return q.equalsWithTolerance(this.getZ(),n.getZ(),r)}},{key:"setX",value:function(n){this.x=n}},{key:"compareTo",value:function(n){var r=n;return this.xr.x?1:this.yr.y?1:0}},{key:"getX",value:function(){return this.x}},{key:"setZ",value:function(n){this.z=n}},{key:"clone",value:function(){try{return null}catch(n){if(n instanceof CloneNotSupportedException)return te.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw n}}},{key:"copy",value:function(){return new a(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}},{key:"distance3D",value:function(n){var r=this.x-n.x,o=this.y-n.y,c=this.getZ()-n.getZ();return Math.sqrt(r*r+o*o+c*c)}},{key:"getY",value:function(){return this.y}},{key:"setY",value:function(n){this.y=n}},{key:"distance",value:function(n){var r=this.x-n.x,o=this.y-n.y;return Math.sqrt(r*r+o*o)}},{key:"hashCode",value:function(){var n=17;return n=37*(n=37*n+a.hashCode(this.x))+a.hashCode(this.y)}},{key:"setCoordinate",value:function(n){this.x=n.x,this.y=n.y,this.z=n.getZ()}},{key:"interfaces_",get:function(){return[G,E,v]}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)a.constructor_.call(this,0,0);else if(arguments.length===1){var n=arguments[0];a.constructor_.call(this,n.x,n.y,n.getZ())}else if(arguments.length===2){var r=arguments[0],o=arguments[1];a.constructor_.call(this,r,o,a.NULL_ORDINATE)}else if(arguments.length===3){var c=arguments[0],g=arguments[1],d=arguments[2];this.x=c,this.y=g,this.z=d}}},{key:"hashCode",value:function(n){return oe[0]=n,me[0]^me[1]}}])}(),Pe=function(){function a(){u(this,a),a.constructor_.apply(this,arguments)}return f(a,[{key:"compare",value:function(n,r){var o=a.compare(n.x,r.x);if(o!==0)return o;var c=a.compare(n.y,r.y);return c!==0?c:this._dimensionsToTestr?1:W.isNaN(n)?W.isNaN(r)?0:-1:W.isNaN(r)?1:0}}])}();H.DimensionalComparator=Pe,H.NULL_ORDINATE=W.NaN,H.X=0,H.Y=1,H.Z=2,H.M=3;var ce=function(){function a(){u(this,a),a.constructor_.apply(this,arguments)}return f(a,[{key:"getArea",value:function(){return this.getWidth()*this.getHeight()}},{key:"equals",value:function(n){if(!(n instanceof a))return!1;var r=n;return this.isNull()?r.isNull():this._maxx===r.getMaxX()&&this._maxy===r.getMaxY()&&this._minx===r.getMinX()&&this._miny===r.getMinY()}},{key:"intersection",value:function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new a;var r=this._minx>n._minx?this._minx:n._minx,o=this._miny>n._miny?this._miny:n._miny;return new a(r,this._maxx=this._minx&&r.getMaxX()=this._miny&&r.getMaxY()=this._minx&&o=this._miny&&cthis._maxx||n._maxxthis._maxy||n._maxythis._maxx)&&!((o.x>c.x?o.x:c.x)this._maxy)&&!((o.y>c.y?o.y:c.y)this._maxx||gthis._maxy||dthis._maxx&&(this._maxx=r._maxx),r._minythis._maxy&&(this._maxy=r._maxy))}}else if(arguments.length===2){var o=arguments[0],c=arguments[1];this.isNull()?(this._minx=o,this._maxx=o,this._miny=c,this._maxy=c):(othis._maxx&&(this._maxx=o),cthis._maxy&&(this._maxy=c))}}},{key:"minExtent",value:function(){if(this.isNull())return 0;var n=this.getWidth(),r=this.getHeight();return nr._minx?1:this._minyr._miny?1:this._maxxr._maxx?1:this._maxyr._maxy?1:0}},{key:"translate",value:function(n,r){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+r,this.getMaxY()+r)}},{key:"copy",value:function(){return new a(this)}},{key:"toString",value:function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}},{key:"setToNull",value:function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}},{key:"disjoint",value:function(n){return!(!this.isNull()&&!n.isNull())||n._minx>this._maxx||n._maxxthis._maxy||n._maxyr?n:r}},{key:"expandBy",value:function(){if(arguments.length===1){var n=arguments[0];this.expandBy(n,n)}else if(arguments.length===2){var r=arguments[0],o=arguments[1];if(this.isNull())return null;this._minx-=r,this._maxx+=r,this._miny-=o,this._maxy+=o,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}}},{key:"contains",value:function(){if(arguments.length===1){if(arguments[0]instanceof a){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof H){var r=arguments[0];return this.covers(r)}}else if(arguments.length===2){var o=arguments[0],c=arguments[1];return this.covers(o,c)}}},{key:"centre",value:function(){return this.isNull()?null:new H((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}},{key:"init",value:function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof H){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof a){var r=arguments[0];this._minx=r._minx,this._maxx=r._maxx,this._miny=r._miny,this._maxy=r._maxy}}else if(arguments.length===2){var o=arguments[0],c=arguments[1];this.init(o.x,c.x,o.y,c.y)}else if(arguments.length===4){var g=arguments[0],d=arguments[1],x=arguments[2],N=arguments[3];gn._maxx&&(r=this._minx-n._maxx);var o=0;return this._maxyn._maxy&&(o=this._miny-n._maxy),r===0?o:o===0?r:Math.sqrt(r*r+o*o)}},{key:"hashCode",value:function(){var n=17;return n=37*(n=37*(n=37*(n=37*n+H.hashCode(this._minx))+H.hashCode(this._maxx))+H.hashCode(this._miny))+H.hashCode(this._maxy)}},{key:"interfaces_",get:function(){return[G,v]}}],[{key:"constructor_",value:function(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof H){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof a){var r=arguments[0];this.init(r)}}else if(arguments.length===2){var o=arguments[0],c=arguments[1];this.init(o.x,c.x,o.y,c.y)}else if(arguments.length===4){var g=arguments[0],d=arguments[1],x=arguments[2],N=arguments[3];this.init(g,d,x,N)}}},{key:"intersects",value:function(){if(arguments.length===3){var n=arguments[0],r=arguments[1],o=arguments[2];return o.x>=(n.xr.x?n.x:r.x)&&o.y>=(n.yr.y?n.y:r.y)}if(arguments.length===4){var c=arguments[0],g=arguments[1],d=arguments[2],x=arguments[3],N=Math.min(d.x,x.x),O=Math.max(d.x,x.x),K=Math.min(c.x,g.x),V=Math.max(c.x,g.x);return!(K>O)&&!(VO)&&!(V=this.size())throw new Ie;return this.array[r]}},{key:"push",value:function(r){return this.array.push(r),r}},{key:"pop",value:function(){if(this.array.length===0)throw new Oe;return this.array.pop()}},{key:"peek",value:function(){if(this.array.length===0)throw new Oe;return this.array[this.array.length-1]}},{key:"empty",value:function(){return this.array.length===0}},{key:"isEmpty",value:function(){return this.empty()}},{key:"search",value:function(r){return this.array.indexOf(r)}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}}])}(qe);function ke(a,n){return a.interfaces_&&a.interfaces_.indexOf(n)>-1}var Fe=function(){return f(function a(n){u(this,a),this.str=n},[{key:"append",value:function(a){this.str+=a}},{key:"setCharAt",value:function(a,n){this.str=this.str.substr(0,a)+n+this.str.substr(a+1)}},{key:"toString",value:function(){return this.str}}])}(),Qe=function(){function a(n){u(this,a),this.value=n}return f(a,[{key:"intValue",value:function(){return this.value}},{key:"compareTo",value:function(n){return this.valuen?1:0}}],[{key:"compare",value:function(n,r){return nr?1:0}},{key:"isNan",value:function(n){return Number.isNaN(n)}},{key:"valueOf",value:function(n){return new a(n)}}])}(),mn=function(){return f(function a(){u(this,a)},null,[{key:"isWhitespace",value:function(a){return a=0||a===127}},{key:"toUpperCase",value:function(a){return a.toUpperCase()}}])}(),ve=function(){function a(){u(this,a),a.constructor_.apply(this,arguments)}return f(a,[{key:"le",value:function(n){return this._hi9?(V=!0,ue="9"):ue="0"+K,x.append(ue),o=o.subtract(a.valueOf(K)).multiply(a.TEN),V&&o.selfAdd(a.TEN);var de=!0,pe=a.magnitude(o._hi);if(pe=N-O&&(de=!1),!de)break}return r[0]=c,x.toString()}},{key:"sqr",value:function(){return this.multiply(this)}},{key:"doubleValue",value:function(){return this._hi+this._lo}},{key:"subtract",value:function(){if(arguments[0]instanceof a){var n=arguments[0];return this.add(n.negate())}if(typeof arguments[0]=="number"){var r=arguments[0];return this.add(-r)}}},{key:"equals",value:function(){if(arguments.length===1&&arguments[0]instanceof a){var n=arguments[0];return this._hi===n._hi&&this._lo===n._lo}}},{key:"isZero",value:function(){return this._hi===0&&this._lo===0}},{key:"selfSubtract",value:function(){if(arguments[0]instanceof a){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n._hi,-n._lo)}if(typeof arguments[0]=="number"){var r=arguments[0];return this.isNaN()?this:this.selfAdd(-r,0)}}},{key:"getSpecialNumberString",value:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}},{key:"min",value:function(n){return this.le(n)?this:n}},{key:"selfDivide",value:function(){if(arguments.length===1){if(arguments[0]instanceof a){var n=arguments[0];return this.selfDivide(n._hi,n._lo)}if(typeof arguments[0]=="number"){var r=arguments[0];return this.selfDivide(r,0)}}else if(arguments.length===2){var o,c,g,d,x=arguments[0],N=arguments[1],O=null,K=null,V=null,ue=null;return g=this._hi/x,ue=(O=(V=a.SPLIT*g)-(O=V-g))*(K=(ue=a.SPLIT*x)-(K=ue-x))-(d=g*x)+O*(c=x-K)+(o=g-O)*K+o*c,ue=g+(V=(this._hi-d-ue+this._lo-g*N)/x),this._hi=ue,this._lo=g-ue+V,this}}},{key:"dump",value:function(){return"DD"}},{key:"divide",value:function(){if(arguments[0]instanceof a){var n,r,o,c,g=arguments[0],d=null,x=null,N=null,O=null;return n=(o=this._hi/g._hi)-(d=(N=a.SPLIT*o)-(d=N-o)),O=d*(x=(O=a.SPLIT*g._hi)-(x=O-g._hi))-(c=o*g._hi)+d*(r=g._hi-x)+n*x+n*r,new a(O=o+(N=(this._hi-c-O+this._lo-o*g._lo)/g._hi),o-O+N)}if(typeof arguments[0]=="number"){var K=arguments[0];return W.isNaN(K)?a.createNaN():a.copy(this).selfDivide(K,0)}}},{key:"ge",value:function(n){return this._hi>n._hi||this._hi===n._hi&&this._lo>=n._lo}},{key:"pow",value:function(n){if(n===0)return a.valueOf(1);var r=new a(this),o=a.valueOf(1),c=Math.abs(n);if(c>1)for(;c>0;)c%2==1&&o.selfMultiply(r),(c/=2)>0&&(r=r.sqr());else o=r;return nr._hi?1:this._lor._lo?1:0}},{key:"rint",value:function(){return this.isNaN()?this:this.add(.5).floor()}},{key:"setValue",value:function(){if(arguments[0]instanceof a){var n=arguments[0];return this.init(n),this}if(typeof arguments[0]=="number"){var r=arguments[0];return this.init(r),this}}},{key:"max",value:function(n){return this.ge(n)?this:n}},{key:"sqrt",value:function(){if(this.isZero())return a.valueOf(0);if(this.isNegative())return a.NaN;var n=1/Math.sqrt(this._hi),r=this._hi*n,o=a.valueOf(r),c=this.subtract(o.sqr())._hi*(.5*n);return o.add(c)}},{key:"selfAdd",value:function(){if(arguments.length===1){if(arguments[0]instanceof a){var n=arguments[0];return this.selfAdd(n._hi,n._lo)}if(typeof arguments[0]=="number"){var r,o,c,g,d,x=arguments[0],N=null;return N=(c=this._hi+x)-(g=c-this._hi),o=(d=(N=x-g+(this._hi-N))+this._lo)+(c-(r=c+d)),this._hi=r+o,this._lo=o+(r-this._hi),this}}else if(arguments.length===2){var O,K,V,ue,de=arguments[0],pe=arguments[1],Ee=null,Ge=null,De=null;V=this._hi+de,K=this._lo+pe,Ge=V-(De=V-this._hi),Ee=K-(ue=K-this._lo);var ze=(O=V+(De=(Ge=de-De+(this._hi-Ge))+K))+(De=(Ee=pe-ue+(this._lo-Ee))+(De+(V-O))),it=De+(O-ze);return this._hi=ze,this._lo=it,this}}},{key:"selfMultiply",value:function(){if(arguments.length===1){if(arguments[0]instanceof a){var n=arguments[0];return this.selfMultiply(n._hi,n._lo)}if(typeof arguments[0]=="number"){var r=arguments[0];return this.selfMultiply(r,0)}}else if(arguments.length===2){var o,c,g=arguments[0],d=arguments[1],x=null,N=null,O=null,K=null;x=(O=a.SPLIT*this._hi)-this._hi,K=a.SPLIT*g,x=O-x,o=this._hi-x,N=K-g;var V=(O=this._hi*g)+(K=x*(N=K-N)-O+x*(c=g-N)+o*N+o*c+(this._hi*d+this._lo*g)),ue=K+(x=O-V);return this._hi=V,this._lo=ue,this}}},{key:"selfSqr",value:function(){return this.selfMultiply(this)}},{key:"floor",value:function(){if(this.isNaN())return a.NaN;var n=Math.floor(this._hi),r=0;return n===this._hi&&(r=Math.floor(this._lo)),new a(n,r)}},{key:"negate",value:function(){return this.isNaN()?this:new a(-this._hi,-this._lo)}},{key:"clone",value:function(){try{return null}catch(n){if(n instanceof CloneNotSupportedException)return null;throw n}}},{key:"multiply",value:function(){if(arguments[0]instanceof a){var n=arguments[0];return n.isNaN()?a.createNaN():a.copy(this).selfMultiply(n)}if(typeof arguments[0]=="number"){var r=arguments[0];return W.isNaN(r)?a.createNaN():a.copy(this).selfMultiply(r,0)}}},{key:"isNaN",value:function(){return W.isNaN(this._hi)}},{key:"intValue",value:function(){return Math.trunc(this._hi)}},{key:"toString",value:function(){var n=a.magnitude(this._hi);return n>=-3&&n1&&(g=o.substring(1));var d=o.charAt(0)+"."+g;return this.isNegative()?"-"+d+c:d+c}},{key:"abs",value:function(){return this.isNaN()?a.NaN:this.isNegative()?this.negate():new a(this)}},{key:"isPositive",value:function(){return this._hi>0||this._hi===0&&this._lo>0}},{key:"lt",value:function(n){return this._hin._hi||this._hi===n._hi&&this._lo>n._lo}},{key:"isNegative",value:function(){return this._hi0?1:this._hi0?1:this._lo=o);){var V=n.charAt(r);if(r++,mn.isDigit(V)){var ue=V-"0";d.selfMultiply(a.TEN),d.selfAdd(ue),x++}else{if(V!=="."){if(V==="e"||V==="E"){var de=n.substring(r);try{O=Qe.parseInt(de)}catch(ze){throw ze instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+de+" in string "+n):ze}break}throw new NumberFormatException("Unexpected character '"+V+"' at position "+r+" in string "+n)}N=x,K=!0}}var pe=d;K||(N=x);var Ee=x-N-O;if(Ee===0)pe=d;else if(Ee>0){var Ge=a.TEN.pow(Ee);pe=d.divide(Ge)}else if(Ee0){if(d=0)return a.signum(x);c=-g-d}var N=a.DP_SAFE_EPSILON*c;return x>=N||-x>=N?a.signum(x):2}},{key:"signum",value:function(n){return n>0?1:n0}},{key:"getX",value:function(a){}},{key:"hasZ",value:function(){return this.getDimension()-this.getMeasures()>2}},{key:"getMeasures",value:function(){return 0}},{key:"expandEnvelope",value:function(a){}},{key:"copy",value:function(){}},{key:"getY",value:function(a){}},{key:"toCoordinateArray",value:function(){}},{key:"interfaces_",get:function(){return[E]}}])}();Ae.X=0,Ae.Y=1,Ae.Z=2,Ae.M=3;var _e=function(){function a(){u(this,a)}return f(a,null,[{key:"noindex",value:function(n,r,o){return Rt.orientationIndex(n,r,o)}},{key:"isCCW",value:function(){if(arguments[0]instanceof Array){var n=arguments[0],r=n.length-1;if(ro.y&&(o=d,c=g)}var x=c;do(x-=1)K.x:V>0}if(ke(arguments[0],Ae)){var ue=arguments[0],de=ue.size()-1;if(depe.y&&(pe=De,Ee=Ge)}var ze=null,it=Ee;do(it-=1)at.x:Ar>0}}}])}();_e.CLOCKWISE=-1,_e.RIGHT=_e.CLOCKWISE,_e.COUNTERCLOCKWISE=1,_e.LEFT=_e.COUNTERCLOCKWISE,_e.COLLINEAR=0,_e.STRAIGHT=_e.COLLINEAR;var wn=function(){return f(function a(){u(this,a),a.constructor_.apply(this,arguments)},[{key:"getCoordinate",value:function(){return this._minCoord}},{key:"getRightmostSide",value:function(a,n){var r=this.getRightmostSideOfSegment(a,n);return r0&&this._minIndexthis._minCoord.y&&r.y>this._minCoord.y&&o===_e.CLOCKWISE)&&(c=!0),c&&(this._minIndex=this._minIndex-1)}},{key:"getRightmostSideOfSegment",value:function(a,n){var r=a.getEdge().getCoordinates();if(n=r.length||r[n].y===r[n+1].y)return-1;var o=re.LEFT;return r[n].ythis._minCoord.x)&&(this._minDe=a,this._minIndex=r,this._minCoord=n[r])}},{key:"findRightmostEdgeAtNode",value: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)}},{key:"findEdge",value:function(a){for(var n=a.iterator();n.hasNext();){var r=n.next();r.isForward()&&this.checkForRightmostCoordinate(r)}te.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===re.LEFT&&(this._orientedDe=this._minDe.getSym())}}],[{key:"constructor_",value:function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}}])}(),rt=function(a){function n(r,o){var c;return u(this,n),(c=s(this,n,[o?r+" [ "+o+" ]":r])).pt=o?new H(o):void 0,c.name=Object.keys({TopologyException:n})[0],c}return _(n,a),f(n,[{key:"getCoordinate",value:function(){return this.pt}}])}(J),zf=function(){return f(function a(){u(this,a),this.array=[]},[{key:"addLast",value:function(a){this.array.push(a)}},{key:"removeFirst",value:function(){return this.array.shift()}},{key:"isEmpty",value:function(){return this.array.length===0}}])}(),we=function(a){function n(r){var o;return u(this,n),(o=s(this,n)).array=[],r instanceof Se&&o.addAll(r),o}return _(n,a),f(n,[{key:"interfaces_",get:function(){return[qe,Se]}},{key:"ensureCapacity",value:function(){}},{key:"add",value:function(r){return arguments.length===1?this.array.push(r):this.array.splice(arguments[0],0,arguments[1]),!0}},{key:"clear",value:function(){this.array=[]}},{key:"addAll",value:function(r){var o,c=m(r);try{for(c.s();!(o=c.n()).done;){var g=o.value;this.array.push(g)}}catch(d){c.e(d)}finally{c.f()}}},{key:"set",value:function(r,o){var c=this.array[r];return this.array[r]=o,c}},{key:"iterator",value:function(){return new qf(this)}},{key:"get",value:function(r){if(r=this.size())throw new Ie;return this.array[r]}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"sort",value:function(r){r?this.array.sort(function(o,c){return r.compare(o,c)}):this.array.sort()}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}},{key:"remove",value:function(r){for(var o=0,c=this.array.length;o=1&&n.getDepth(re.LEFT)n._rightMostCoord.x?1:0}},{key:"getEnvelope",value:function(){if(this._env===null){for(var a=new ce,n=this._dirEdgeList.iterator();n.hasNext();)for(var r=n.next().getEdge().getCoordinates(),o=0;on.x?a.x:n.x,x=a.y>n.y?a.y:n.y,N=r.xo.x?r.x:o.x,V=r.y>o.y?r.y:o.y,ue=((c>N?c:N)+(dO?g:O)+(xo?o:n}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var c=arguments[0],g=arguments[1],d=arguments[2];return cd?d:c}}},{key:"wrap",value:function(n,r){return no&&(o=n),r>o&&(o=r),o}if(arguments.length===4){var c=arguments[1],g=arguments[2],d=arguments[3],x=arguments[0];return c>x&&(x=c),g>x&&(x=g),d>x&&(x=d),x}}},{key:"average",value:function(n,r){return(n+r)/2}}])}();kr.LOG_10=Math.log(10);var Zt=function(){function a(){u(this,a)}return f(a,null,[{key:"segmentToSegment",value:function(n,r,o,c){if(n.equals(r))return a.pointToSegment(n,o,c);if(o.equals(c))return a.pointToSegment(c,n,r);var g=!1;if(ce.intersects(n,r,o,c)){var d=(r.x-n.x)*(c.y-o.y)-(r.y-n.y)*(c.x-o.x);if(d===0)g=!0;else{var x=(n.y-o.y)*(c.x-o.x)-(n.x-o.x)*(c.y-o.y),N=((n.y-o.y)*(r.x-n.x)-(n.x-o.x)*(r.y-n.y))/d,O=x/d;(O1||N1)&&(g=!0)}}else g=!0;return g?kr.min(a.pointToSegment(n,o,c),a.pointToSegment(r,o,c),a.pointToSegment(o,n,r),a.pointToSegment(c,n,r)):0}},{key:"pointToSegment",value:function(n,r,o){if(r.x===o.x&&r.y===o.y)return n.distance(r);var c=(o.x-r.x)*(o.x-r.x)+(o.y-r.y)*(o.y-r.y),g=((n.x-r.x)*(o.x-r.x)+(n.y-r.y)*(o.y-r.y))/c;if(g=1)return n.distance(o);var d=((r.y-n.y)*(o.x-r.x)-(r.x-n.x)*(o.y-r.y))/c;return Math.abs(d)*Math.sqrt(c)}},{key:"pointToLinePerpendicular",value:function(n,r,o){var c=(o.x-r.x)*(o.x-r.x)+(o.y-r.y)*(o.y-r.y),g=((r.y-n.y)*(o.x-r.x)-(r.x-n.x)*(o.y-r.y))/c;return Math.abs(g)*Math.sqrt(c)}},{key:"pointToSegmentString",value:function(n,r){if(r.length===0)throw new U("Line array must contain at least one vertex");for(var o=n.distance(r[0]),c=0;c0)&&(g=x,c=d)}return c}}},{key:"extend",value:function(n,r,o){var c=n.create(o,r.getDimension()),g=r.size();if(a.copy(r,0,c,0,g),g>0)for(var d=g;d0)&&(r=c)}return r}}])}(),he=function(){function a(){u(this,a)}return f(a,null,[{key:"toDimensionSymbol",value:function(n){switch(n){case a.FALSE:return a.SYM_FALSE;case a.TRUE:return a.SYM_TRUE;case a.DONTCARE:return a.SYM_DONTCARE;case a.P:return a.SYM_P;case a.L:return a.SYM_L;case a.A:return a.SYM_A}throw new U("Unknown dimension value: "+n)}},{key:"toDimensionValue",value:function(n){switch(mn.toUpperCase(n)){case a.SYM_FALSE:return a.FALSE;case a.SYM_TRUE:return a.TRUE;case a.SYM_DONTCARE:return a.DONTCARE;case a.SYM_P:return a.P;case a.SYM_L:return a.L;case a.SYM_A:return a.A}throw new U("Unknown dimension symbol: "+n)}}])}();he.P=0,he.L=1,he.A=2,he.FALSE=-1,he.TRUE=-2,he.DONTCARE=-3,he.SYM_FALSE="F",he.SYM_TRUE="T",he.SYM_DONTCARE="*",he.SYM_P="0",he.SYM_L="1",he.SYM_A="2";var ei=function(){return f(function a(){u(this,a)},[{key:"filter",value:function(a){}}])}(),ti=function(){return f(function a(){u(this,a)},[{key:"filter",value:function(a,n){}},{key:"isDone",value:function(){}},{key:"isGeometryChanged",value:function(){}}])}(),Nr=function(a){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return _(n,a),f(n,[{key:"computeEnvelopeInternal",value:function(){return this.isEmpty()?new ce:this._points.expandEnvelope(new ce)}},{key:"isRing",value:function(){return this.isClosed()&&this.isSimple()}},{key:"getCoordinates",value:function(){return this._points.toCoordinateArray()}},{key:"copyInternal",value:function(){return new n(this._points.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof le){var r=arguments[0],o=arguments[1];if(!this.isEquivalentClass(r))return!1;var c=r;if(this._points.size()!==c._points.size())return!1;for(var g=0;g0){var c=this._points.copy();Tn.reverse(c),this._points=c}return null}}}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._points.getCoordinate(0)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?he.FALSE:0}},{key:"isClosed",value:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}},{key:"reverseInternal",value:function(){var r=this._points.copy();return Tn.reverse(r),this.getFactory().createLineString(r)}},{key:"getEndPoint",value:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}},{key:"getTypeCode",value:function(){return le.TYPECODE_LINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getLength",value:function(){return Zf.ofLine(this._points)}},{key:"getNumPoints",value:function(){return this._points.size()}},{key:"compareToSameClass",value:function(){if(arguments.length===1){for(var r=arguments[0],o=0,c=0;o= 2)");this._points=r}},{key:"isCoordinate",value:function(r){for(var o=0;o=1&&this.getCoordinateSequence().size()= 4)")}},{key:"getGeometryType",value:function(){return le.TYPENAME_LINEARRING}}],[{key:"constructor_",value:function(){var r=arguments[0],o=arguments[1];Nr.constructor_.call(this,r,o),this.validateConstruction()}}])}(Nr);wr.MINIMUM_VALID_SIZE=4;var Cn=function(a){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return _(n,a),f(n,[{key:"setOrdinate",value:function(r,o){switch(r){case n.X:this.x=o;break;case n.Y:this.y=o;break;default:throw new U("Invalid ordinate index: "+r)}}},{key:"getZ",value:function(){return H.NULL_ORDINATE}},{key:"getOrdinate",value:function(r){switch(r){case n.X:return this.x;case n.Y:return this.y}throw new U("Invalid ordinate index: "+r)}},{key:"setZ",value:function(r){throw new U("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new n(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+")"}},{key:"setCoordinate",value:function(r){this.x=r.x,this.y=r.y,this.z=r.getZ()}}],[{key:"constructor_",value:function(){if(arguments.length===0)H.constructor_.call(this);else if(arguments.length===1){if(arguments[0]instanceof n){var r=arguments[0];H.constructor_.call(this,r.x,r.y)}else if(arguments[0]instanceof H){var o=arguments[0];H.constructor_.call(this,o.x,o.y)}}else if(arguments.length===2){var c=arguments[0],g=arguments[1];H.constructor_.call(this,c,g,H.NULL_ORDINATE)}}}])}(H);Cn.X=0,Cn.Y=1,Cn.Z=-1,Cn.M=-1;var Ln=function(a){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return _(n,a),f(n,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(r,o){switch(r){case n.X:this.x=o;break;case n.Y:this.y=o;break;case n.M:this._m=o;break;default:throw new U("Invalid ordinate index: "+r)}}},{key:"setM",value:function(r){this._m=r}},{key:"getZ",value:function(){return H.NULL_ORDINATE}},{key:"getOrdinate",value:function(r){switch(r){case n.X:return this.x;case n.Y:return this.y;case n.M:return this._m}throw new U("Invalid ordinate index: "+r)}},{key:"setZ",value:function(r){throw new U("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new n(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(r){this.x=r.x,this.y=r.y,this.z=r.getZ(),this._m=r.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)H.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof n){var r=arguments[0];H.constructor_.call(this,r.x,r.y),this._m=r._m}else if(arguments[0]instanceof H){var o=arguments[0];H.constructor_.call(this,o.x,o.y),this._m=this.getM()}}else if(arguments.length===3){var c=arguments[0],g=arguments[1],d=arguments[2];H.constructor_.call(this,c,g,H.NULL_ORDINATE),this._m=d}}}])}(H);Ln.X=0,Ln.Y=1,Ln.Z=-1,Ln.M=2;var gs=function(a){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return _(n,a),f(n,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(r,o){switch(r){case H.X:this.x=o;break;case H.Y:this.y=o;break;case H.Z:this.z=o;break;case H.M:this._m=o;break;default:throw new U("Invalid ordinate index: "+r)}}},{key:"setM",value:function(r){this._m=r}},{key:"getOrdinate",value:function(r){switch(r){case H.X:return this.x;case H.Y:return this.y;case H.Z:return this.getZ();case H.M:return this.getM()}throw new U("Invalid ordinate index: "+r)}},{key:"copy",value:function(){return new n(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(r){this.x=r.x,this.y=r.y,this.z=r.getZ(),this._m=r.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)H.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof n){var r=arguments[0];H.constructor_.call(this,r),this._m=r._m}else if(arguments[0]instanceof H){var o=arguments[0];H.constructor_.call(this,o),this._m=this.getM()}}else if(arguments.length===4){var c=arguments[0],g=arguments[1],d=arguments[2],x=arguments[3];H.constructor_.call(this,c,g,d),this._m=x}}}])}(H),ri=function(){function a(){u(this,a)}return f(a,null,[{key:"measures",value:function(n){return n instanceof Cn?0:n instanceof Ln||n instanceof gs?1:0}},{key:"dimension",value:function(n){return n instanceof Cn?2:n instanceof Ln?3:n instanceof gs?4:3}},{key:"create",value:function(){if(arguments.length===1){var n=arguments[0];return a.create(n,0)}if(arguments.length===2){var r=arguments[0],o=arguments[1];return r===2?new Cn:r===3&&o===0?new H:r===3&&o===1?new Ln:r===4&&o===1?new gs:new H}}}])}(),Tr=function(a){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return _(n,a),f(n,[{key:"getCoordinate",value:function(r){return this.get(r)}},{key:"addAll",value:function(){if(arguments.length===2&&typeof arguments[1]=="boolean"&&ke(arguments[0],Se)){for(var r=arguments[1],o=!1,c=arguments[0].iterator();c.hasNext();)this.add(c.next(),r),o=!0;return o}return w(n,"addAll",this,1).apply(this,arguments)}},{key:"clone",value:function(){for(var r=w(n,"clone",this,1).call(this),o=0;o=1&&this.get(this.size()-1).equals2D(g))return null;w(n,"add",this,1).call(this,g)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var d=arguments[0],x=arguments[1];return this.add(d,x),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var N=arguments[0],O=arguments[1];if(arguments[2])for(var K=0;K=0;V--)this.add(N[V],O);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof H){var ue=arguments[0],de=arguments[1];if(!arguments[2]){var pe=this.size();if(pe>0&&(ue>0&&this.get(ue-1).equals2D(de)||ueze&&(it=-1);for(var at=De;at!==ze;at+=it)this.add(Ee[at],Ge);return!0}}},{key:"closeRing",value:function(){if(this.size()>0){var r=this.get(0).copy();this.add(r,!1)}}}],[{key:"constructor_",value:function(){if(arguments.length!==0){if(arguments.length===1){var r=arguments[0];this.ensureCapacity(r.length),this.add(r,!0)}else if(arguments.length===2){var o=arguments[0],c=arguments[1];this.ensureCapacity(o.length),this.add(o,c)}}}}])}(we);Tr.coordArrayType=new Array(0).fill(null);var Ve=function(){function a(){u(this,a)}return f(a,null,[{key:"isRing",value:function(n){return!(n.length=n?r:[]}},{key:"noindexOf",value:function(n,r){for(var o=0;o0)&&(r=n[o]);return r}},{key:"extract",value:function(n,r,o){r=kr.clamp(r,0,n.length);var c=(o=kr.clamp(o,-1,n.length))-r+1;o=n.length&&(c=0),oo.length)return 1;if(r.length===0)return 0;var c=Ve.compare(r,o);return Ve.isEqualReversed(r,o)?0:c}},{key:"OLDcompare",value:function(a,n){var r=a,o=n;if(r.lengtho.length)return 1;if(r.length===0)return 0;for(var c=Ve.increasingDirection(r),g=Ve.increasingDirection(o),d=c>0?0:r.length-1,x=g>0?0:r.length-1,N=0;N0){var n=new ii(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var r=1;r3&&(n=3),n1&&(r=1),o>3&&(o=3),o=0?n:r}}])}(),Kn=function(){function a(){u(this,a),a.constructor_.apply(this,arguments)}return f(a,[{key:"readResolve",value:function(){return a.nameToTypeMap.get(this._name)}},{key:"toString",value:function(){return this._name}},{key:"interfaces_",get:function(){return[v]}}],[{key:"constructor_",value:function(){this._name=null;var n=arguments[0];this._name=n,a.nameToTypeMap.put(n,this)}}])}();Kn.nameToTypeMap=new Qf,Ft.Type=Kn,Ft.FIXED=new Kn("FIXED"),Ft.FLOATING=new Kn("FLOATING"),Ft.FLOATING_SINGLE=new Kn("FLOATING SINGLE"),Ft.maximumPreciseValue=9007199254740992;var ps=function(a){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return _(n,a),f(n,[{key:"copyInternal",value:function(){for(var r=new Array(this._geometries.length).fill(null),o=0;o1){if(N instanceof ni)return this.createMultiPolygon(a.toPolygonArray(n));if(N instanceof Nr)return this.createMultiLineString(a.toLineStringArray(n));if(N instanceof fs)return this.createMultiPoint(a.toPointArray(n));te.shouldNeverReachHere("Unhandled geometry type: "+N.getGeometryType())}return N}},{key:"createMultiPointFromCoords",value:function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}},{key:"createPoint",value:function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof H){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if(ke(arguments[0],Ae))return new fs(arguments[0],this)}}},{key:"getCoordinateSequenceFactory",value:function(){return this._coordinateSequenceFactory}},{key:"createPolygon",value:function(){if(arguments.length===0)return this.createPolygon(null,null);if(arguments.length===1){if(ke(arguments[0],Ae)){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}if(arguments[0]instanceof Array){var r=arguments[0];return this.createPolygon(this.createLinearRing(r))}if(arguments[0]instanceof wr){var o=arguments[0];return this.createPolygon(o,null)}}else if(arguments.length===2)return new ni(arguments[0],arguments[1],this)}},{key:"getSRID",value:function(){return this._SRID}},{key:"createGeometryCollection",value:function(){return arguments.length===0?new yt(null,this):arguments.length===1?new yt(arguments[0],this):void 0}},{key:"getPrecisionModel",value:function(){return this._precisionModel}},{key:"createLinearRing",value:function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLinearRing(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(ke(arguments[0],Ae))return new wr(arguments[0],this)}}},{key:"createMultiPolygon",value:function(){return arguments.length===0?new ms(null,this):arguments.length===1?new ms(arguments[0],this):void 0}},{key:"createMultiPoint",value:function(){if(arguments.length===0)return new hs(null,this);if(arguments.length===1){if(arguments[0]instanceof Array)return new hs(arguments[0],this);if(ke(arguments[0],Ae)){var n=arguments[0];if(n===null)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(n.size()).fill(null),o=0;o="a"&&a="A"&&a="0"&&a1?a.createPolygon(Ge[0],Ge.slice(1)):a.createPolygon(Ge[0])},o=this.token_;if(this.match(si)){var c=o.value;if(this.layout_=this.parseGeometryLayout_(),c=="GEOMETRYCOLLECTION"){var g=this.parseGeometryCollectionText_();return a.createGeometryCollection(g)}switch(c){case"POINT":var d=this.parsePointText_();return d?a.createPoint(l(H,z(d))):a.createPoint();case"LINESTRING":var x=this.parseLineStringText_().map(n);return a.createLineString(x);case"LINEARRING":var N=this.parseLineStringText_().map(n);return a.createLinearRing(N);case"POLYGON":var O=this.parsePolygonText_();return O&&O.length!==0?r(O):a.createPolygon();case"MULTIPOINT":var K=this.parseMultiPointText_();if(!K||K.length===0)return a.createMultiPoint();var V=K.map(n).map(function(Ee){return a.createPoint(Ee)});return a.createMultiPoint(V);case"MULTILINESTRING":var ue=this.parseMultiLineStringText_().map(function(Ee){return a.createLineString(Ee.map(n))});return a.createMultiLineString(ue);case"MULTIPOLYGON":var de=this.parseMultiPolygonText_();if(!de||de.length===0)return a.createMultiPolygon();var pe=de.map(r);return a.createMultiPolygon(pe);default:throw new Error("Invalid geometry type: "+c)}}throw new Error(this.formatErrorMessage_())}}])}();function ua(a){if(a.isEmpty())return"";var n=a.getCoordinate(),r=[n.x,n.y];return n.z===void 0||Number.isNaN(n.z)||r.push(n.z),n.m===void 0||Number.isNaN(n.m)||r.push(n.m),r.join(" ")}function Cr(a){for(var n=a.getCoordinates().map(function(g){var d=[g.x,g.y];return g.z===void 0||Number.isNaN(g.z)||d.push(g.z),g.m===void 0||Number.isNaN(g.m)||d.push(g.m),d}),r=[],o=0,c=n.length;o0&&(n+=" "+o),a.isEmpty()?n+" "+oa:n+" ("+r(a)+")"}var oh=function(){return f(function a(n){u(this,a),this.geometryFactory=n||new Qn,this.precisionModel=this.geometryFactory.getPrecisionModel()},[{key:"read",value:function(a){var n=new rh(a);return new ih(n,this.geometryFactory).parse()}},{key:"write",value:function(a){return ca(a)}}])}(),vs=function(){return f(function a(n){u(this,a),this.parser=new oh(n)},[{key:"write",value:function(a){return this.parser.write(a)}}],[{key:"toLineString",value:function(a,n){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+a.x+" "+a.y+", "+n.x+" "+n.y+" )"}}])}(),Ze=function(){function a(){u(this,a),a.constructor_.apply(this,arguments)}return f(a,[{key:"getIndexAlongSegment",value:function(n,r){return this.computeIntLineIndex(),this._intLineIndex[n][r]}},{key:"getTopologySummary",value:function(){var n=new ii;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()}},{key:"computeIntersection",value:function(n,r,o,c){this._inputLines[0][0]=n,this._inputLines[0][1]=r,this._inputLines[1][0]=o,this._inputLines[1][1]=c,this._result=this.computeIntersect(n,r,o,c)}},{key:"getIntersectionNum",value:function(){return this._result}},{key:"computeIntLineIndex",value:function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var n=arguments[0];this.getEdgeDistance(n,0)>this.getEdgeDistance(n,1)?(this._intLineIndex[n][0]=0,this._intLineIndex[n][1]=1):(this._intLineIndex[n][0]=1,this._intLineIndex[n][1]=0)}}},{key:"isProper",value:function(){return this.hasIntersection()&&this._isProper}},{key:"setPrecisionModel",value:function(n){this._precisionModel=n}},{key:"isInteriorIntersection",value:function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var n=arguments[0],r=0;rg?c:g;else{var x=Math.abs(n.x-r.x),N=Math.abs(n.y-r.y);(d=c>g?x:N)!==0||n.equals(r)||(d=Math.max(x,N))}return te.isTrue(!(d===0&&!n.equals(r)),"Bad distance calculation"),d}},{key:"nonRobustComputeEdgeDistance",value:function(n,r,o){var c=n.x-r.x,g=n.y-r.y,d=Math.sqrt(c*c+g*g);return te.isTrue(!(d===0&&!n.equals(r)),"Invalid distance calculation"),d}}])}();Ze.DONT_INTERSECT=0,Ze.DO_INTERSECT=1,Ze.COLLINEAR=2,Ze.NO_INTERSECTION=0,Ze.POINT_INTERSECTION=1,Ze.COLLINEAR_INTERSECTION=2;var Pn=function(a){function n(){return u(this,n),s(this,n)}return _(n,a),f(n,[{key:"isInSegmentEnvelopes",value:function(r){var o=new ce(this._inputLines[0][0],this._inputLines[0][1]),c=new ce(this._inputLines[1][0],this._inputLines[1][1]);return o.contains(r)&&c.contains(r)}},{key:"computeIntersection",value:function(){if(arguments.length!==3)return w(n,"computeIntersection",this,1).apply(this,arguments);var r=arguments[0],o=arguments[1],c=arguments[2];if(this._isProper=!1,ce.intersects(o,c,r)&&_e.index(o,c,r)===0&&_e.index(c,o,r)===0)return this._isProper=!0,(r.equals(o)||r.equals(c))&&(this._isProper=!1),this._result=Ze.POINT_INTERSECTION,null;this._result=Ze.NO_INTERSECTION}},{key:"intersection",value:function(r,o,c,g){var d=this.intersectionSafe(r,o,c,g);return this.isInSegmentEnvelopes(d)||(d=new H(n.nearestEndpoint(r,o,c,g))),this._precisionModel!==null&&this._precisionModel.makePrecise(d),d}},{key:"checkDD",value:function(r,o,c,g,d){var x=Rt.intersection(r,o,c,g),N=this.isInSegmentEnvelopes(x);St.out.println("DD in env = "+N+" --------------------- "+x),d.distance(x)>1e-4&&St.out.println("Distance = "+d.distance(x))}},{key:"intersectionSafe",value:function(r,o,c,g){var d=cs.intersection(r,o,c,g);return d===null&&(d=n.nearestEndpoint(r,o,c,g)),d}},{key:"computeCollinearIntersection",value:function(r,o,c,g){var d=ce.intersects(r,o,c),x=ce.intersects(r,o,g),N=ce.intersects(c,g,r),O=ce.intersects(c,g,o);return d&&x?(this._intPt[0]=c,this._intPt[1]=g,Ze.COLLINEAR_INTERSECTION):N&&O?(this._intPt[0]=r,this._intPt[1]=o,Ze.COLLINEAR_INTERSECTION):d&&N?(this._intPt[0]=c,this._intPt[1]=r,!c.equals(r)||x||O?Ze.COLLINEAR_INTERSECTION:Ze.POINT_INTERSECTION):d&&O?(this._intPt[0]=c,this._intPt[1]=o,!c.equals(o)||x||N?Ze.COLLINEAR_INTERSECTION:Ze.POINT_INTERSECTION):x&&N?(this._intPt[0]=g,this._intPt[1]=r,!g.equals(r)||d||O?Ze.COLLINEAR_INTERSECTION:Ze.POINT_INTERSECTION):x&&O?(this._intPt[0]=g,this._intPt[1]=o,!g.equals(o)||d||N?Ze.COLLINEAR_INTERSECTION:Ze.POINT_INTERSECTION):Ze.NO_INTERSECTION}},{key:"computeIntersect",value:function(r,o,c,g){if(this._isProper=!1,!ce.intersects(r,o,c,g))return Ze.NO_INTERSECTION;var d=_e.index(r,o,c),x=_e.index(r,o,g);if(d>0&&x>0||d0&&O>0||Nc&&(o=r.x,c=n.x),this._p.x>=o&&this._p.xthis._p.y&&r.ythis._p.y&&n.ythis.location.length){var r=new Array(3).fill(null);r[re.ON]=this.location[re.ON],r[re.LEFT]=D.NONE,r[re.RIGHT]=D.NONE,this.location=r}for(var o=0;o1&&n.append(D.toLocationSymbol(this.location[re.LEFT])),n.append(D.toLocationSymbol(this.location[re.ON])),this.location.length>1&&n.append(D.toLocationSymbol(this.location[re.RIGHT])),n.toString()}},{key:"setLocations",value:function(n,r,o){this.location[re.ON]=n,this.location[re.LEFT]=r,this.location[re.RIGHT]=o}},{key:"get",value:function(n){return n1}},{key:"isAnyNull",value:function(){for(var n=0;nthis._maxNodeDegree&&(this._maxNodeDegree=n),a=this.getNext(a)}while(a!==this._startDe);this._maxNodeDegree*=2}},{key:"addPoints",value:function(a,n,r){var o=a.getCoordinates();if(n){var c=1;r&&(c=0);for(var g=c;g=0;x--)this._pts.add(o[x])}}},{key:"isHole",value:function(){return this._isHole}},{key:"setInResult",value:function(){var a=this._startDe;do a.getEdge().setInResult(!0),a=a.getNext();while(a!==this._startDe)}},{key:"containsPoint",value:function(a){var n=this.getLinearRing();if(!n.getEnvelopeInternal().contains(a)||!_s.isInRing(a,n.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();)if(r.next().containsPoint(a))return!1;return!0}},{key:"addHole",value:function(a){this._holes.add(a)}},{key:"isShell",value:function(){return this._shell===null}},{key:"getLabel",value:function(){return this._label}},{key:"getEdges",value:function(){return this._edges}},{key:"getMaxNodeDegree",value:function(){return this._maxNodeDegree=2,"found partial label"),this.computeIM(a)}},{key:"isInResult",value:function(){return this._isInResult}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var a=arguments[0];this._label=a}}}}])}(),ai=function(a){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return _(n,a),f(n,[{key:"isIncidentEdgeInResult",value:function(){for(var r=this.getEdges().getEdges().iterator();r.hasNext();)if(r.next().getEdge().isInResult())return!0;return!1}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"getCoordinate",value:function(){return this._coord}},{key:"print",value:function(r){r.println("node "+this._coord+" lbl: "+this._label)}},{key:"computeIM",value:function(r){}},{key:"computeMergedLocation",value:function(r,o){var c=D.NONE;if(c=this._label.getLocation(o),!r.isNull(o)){var g=r.getLocation(o);c!==D.BOUNDARY&&(c=g)}return c}},{key:"setLabel",value:function(){if(arguments.length!==2||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return w(n,"setLabel",this,1).apply(this,arguments);var r=arguments[0],o=arguments[1];this._label===null?this._label=new Nt(r,o):this._label.setLocation(r,o)}},{key:"getEdges",value:function(){return this._edges}},{key:"mergeLabel",value:function(){if(arguments[0]instanceof n){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof Nt)for(var o=arguments[0],c=0;c0))return o.value;o=o.right}}return null}},{key:"put",value:function(r,o){if(this.root_===null)return this.root_={key:r,value:o,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var c,g,d=this.root_;do if(c=d,(g=r.compareTo(d.key))0)){var x=d.value;return d.value=o,x}d=d.right}while(d!==null);var N={key:r,left:null,right:null,value:o,parent:c,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return g0))return!0;o=o.right}}return!1}}],[{key:"successor",value:function(r){var o;if(r===null)return null;if(r.right!==null){for(o=r.right;o.left!==null;)o=o.left;return o}o=r.parent;for(var c=r;o!==null&&c===o.right;)c=o,o=o.parent;return o}}])}(ch),da=function(){return f(function a(){u(this,a),a.constructor_.apply(this,arguments)},[{key:"find",value:function(a){return this.nodeMap.get(a)}},{key:"addNode",value:function(){if(arguments[0]instanceof H){var a=arguments[0],n=this.nodeMap.get(a);return n===null&&(n=this.nodeFact.createNode(a),this.nodeMap.put(a,n)),n}if(arguments[0]instanceof ai){var r=arguments[0],o=this.nodeMap.get(r.getCoordinate());return o===null?(this.nodeMap.put(r.getCoordinate(),r),r):(o.mergeLabel(r),o)}}},{key:"print",value:function(a){for(var n=this.iterator();n.hasNext();)n.next().print(a)}},{key:"iterator",value:function(){return this.nodeMap.values().iterator()}},{key:"values",value:function(){return this.nodeMap.values()}},{key:"getBoundaryNodes",value:function(a){for(var n=new we,r=this.iterator();r.hasNext();){var o=r.next();o.getLabel().getLocation(a)===D.BOUNDARY&&n.add(o)}return n}},{key:"add",value:function(a){var n=a.getCoordinate();this.addNode(n).add(a)}}],[{key:"constructor_",value:function(){this.nodeMap=new Lr,this.nodeFact=null;var a=arguments[0];this.nodeFact=a}}])}(),ct=function(){function a(){u(this,a)}return f(a,null,[{key:"isNorthern",value:function(n){return n===a.NE||n===a.NW}},{key:"isOpposite",value:function(n,r){return n!==r&&(n-r+4)%4===2}},{key:"commonHalfPlane",value:function(n,r){if(n===r)return n;if((n-r+4)%4===2)return-1;var o=nr?n:r)===3?3:o}},{key:"isInHalfPlane",value:function(n,r){return r===a.SE?n===a.SE||n===a.SW:n===r||n===r+1}},{key:"quadrant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],r=arguments[1];if(n===0&&r===0)throw new U("Cannot compute the quadrant for point ( "+n+", "+r+" )");return n>=0?r>=0?a.NE:a.SE:r>=0?a.NW:a.SW}if(arguments[0]instanceof H&&arguments[1]instanceof H){var o=arguments[0],c=arguments[1];if(c.x===o.x&&c.y===o.y)throw new U("Cannot compute the quadrant for two identical points "+o);return c.x>=o.x?c.y>=o.y?a.NE:a.SE:c.y>=o.y?a.NW:a.SW}}}])}();ct.NE=0,ct.NW=1,ct.SW=2,ct.SE=3;var ma=function(){function a(){u(this,a),a.constructor_.apply(this,arguments)}return f(a,[{key:"compareDirection",value:function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant2){d.linkDirectedEdgesForMinimalEdgeRings();var x=d.buildMinimalRings(),N=this.findShell(x);N!==null?(this.placePolygonHoles(N,x),r.add(N)):o.addAll(x)}else c.add(d)}return c}},{key:"buildMaximalEdgeRings",value:function(n){for(var r=new we,o=n.iterator();o.hasNext();){var c=o.next();if(c.isInResult()&&c.getLabel().isArea()&&c.getEdgeRing()===null){var g=new lh(c,this._geometryFactory);r.add(g),g.setInResult()}}return r}},{key:"placePolygonHoles",value:function(n,r){for(var o=r.iterator();o.hasNext();){var c=o.next();c.isHole()&&c.setShell(n)}}},{key:"getPolygons",value:function(){return this.computePolygons(this._shellList)}},{key:"findShell",value:function(n){for(var r=0,o=null,c=n.iterator();c.hasNext();){var g=c.next();g.isHole()||(o=g,r++)}return te.isTrue(ra.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,n,r),null):(this.expand(this._boundable2,this._boundable1,!0,n,r),null);if(o)return this.expand(this._boundable1,this._boundable2,!1,n,r),null;if(c)return this.expand(this._boundable2,this._boundable1,!0,n,r),null;throw new U("neither boundable is composite")}},{key:"isLeaves",value:function(){return!(a.isComposite(this._boundable1)||a.isComposite(this._boundable2))}},{key:"compareTo",value:function(n){var r=n;return this._distancer._distance?1:0}},{key:"expand",value:function(n,r,o,c,g){for(var d=n.getChildBoundables().iterator();d.hasNext();){var x=d.next(),N=null;(N=o?new a(r,x,this._itemDistance):new a(x,r,this._itemDistance)).getDistance()-2),c.getLevel()===o)return g.add(c),null;for(var d=c.getChildBoundables().iterator();d.hasNext();){var x=d.next();x instanceof wt?this.boundablesAtLevel(o,x,g):(te.isTrue(x instanceof rn),o===-1&&g.add(x))}return null}}},{key:"query",value:function(){if(arguments.length===1){var n=arguments[0];this.build();var r=new we;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.queryInternal(n,this._root,r),r}if(arguments.length===2){var o=arguments[0],c=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),o)&&this.queryInternal(o,this._root,c)}}},{key:"build",value:function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0}},{key:"getRoot",value:function(){return this.build(),this._root}},{key:"remove",value:function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.remove(n,this._root,r)}if(arguments.length===3){var o=arguments[0],c=arguments[1],g=arguments[2],d=this.removeItem(c,g);if(d)return!0;for(var x=null,N=c.getChildBoundables().iterator();N.hasNext();){var O=N.next();if(this.getIntersectsOp().intersects(O.getBounds(),o)&&O instanceof wt&&(d=this.remove(o,O,g))){x=O;break}}return x!==null&&x.getChildBoundables().isEmpty()&&c.getChildBoundables().remove(x),d}}},{key:"createHigherLevels",value:function(n,r){te.isTrue(!n.isEmpty());var o=this.createParentBoundables(n,r+1);return o.size()===1?o.get(0):this.createHigherLevels(o,r+1)}},{key:"depth",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var n=0,r=arguments[0].getChildBoundables().iterator();r.hasNext();){var o=r.next();if(o instanceof wt){var c=this.depth(o);c>n&&(n=c)}}return n+1}}},{key:"createParentBoundables",value:function(n,r){te.isTrue(!n.isEmpty());var o=new we;o.add(this.createNode(r));var c=new we(n);Vn.sort(c,this.getComparator());for(var g=c.iterator();g.hasNext();){var d=g.next();this.lastNode(o).getChildBoundables().size()===this.getNodeCapacity()&&o.add(this.createNode(r)),this.lastNode(o).addChildBoundable(d)}return o}},{key:"isEmpty",value:function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}},{key:"interfaces_",get:function(){return[v]}}],[{key:"constructor_",value:function(){if(this._root=null,this._built=!1,this._itemBoundables=new we,this._nodeCapacity=null,arguments.length===0)a.constructor_.call(this,a.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var n=arguments[0];te.isTrue(n>1,"Node capacity must be greater than 1"),this._nodeCapacity=n}}},{key:"compareDoubles",value:function(n,r){return n>r?1:n0);for(var c=new we,g=0;g=0;){var O=x.poll(),K=O.getDistance();if(K>=d)break;O.isLeaves()?N.size()K&&(N.poll(),N.add(O)),d=N.peek().getDistance()):O.expandToQueue(x,d)}return n.getItems(N)}}},{key:"createNode",value:function(r){return new xa(r)}},{key:"size",value:function(){return arguments.length===0?w(n,"size",this,1).call(this):w(n,"size",this,1).apply(this,arguments)}},{key:"insert",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof ce))return w(n,"insert",this,1).apply(this,arguments);var r=arguments[0],o=arguments[1];if(r.isNull())return null;w(n,"insert",this,1).call(this,r,o)}},{key:"getIntersectsOp",value:function(){return n.intersectsOp}},{key:"verticalSlices",value:function(r,o){for(var c=Math.trunc(Math.ceil(r.size()/o)),g=new Array(o).fill(null),d=r.iterator(),x=0;x0;){var N=x.poll(),O=N.getDistance();if(O>=g)break;N.isLeaves()?(g=O,d=N):N.expandToQueue(x,g)}return d===null?null:[d.getBoundable(0).getItem(),d.getBoundable(1).getItem()]}}else{if(arguments.length===2){var K=arguments[0],V=arguments[1];if(this.isEmpty()||K.isEmpty())return null;var ue=new er(this.getRoot(),K.getRoot(),V);return this.nearestNeighbour(ue)}if(arguments.length===3){var de=arguments[2],pe=new rn(arguments[0],arguments[1]),Ee=new er(this.getRoot(),pe,de);return this.nearestNeighbour(Ee)[0]}if(arguments.length===4){var Ge=arguments[2],De=arguments[3],ze=new rn(arguments[0],arguments[1]),it=new er(this.getRoot(),ze,Ge);return this.nearestNeighbourK(it,De)}}}},{key:"isWithinDistance",value:function(){if(arguments.length===2){var r=arguments[0],o=arguments[1],c=W.POSITIVE_INFINITY,g=new ui;for(g.add(r);!g.isEmpty();){var d=g.poll(),x=d.getDistance();if(x>o)return!1;if(d.maximumDistance()r?1:0}},{key:"compare",value:function(n,r,o){if(r.equals2D(o))return 0;var c=a.relativeSign(r.x,o.x),g=a.relativeSign(r.y,o.y);switch(n){case 0:return a.compareValue(c,g);case 1:return a.compareValue(g,c);case 2:return a.compareValue(g,-c);case 3:return a.compareValue(-c,g);case 4:return a.compareValue(-c,-g);case 5:return a.compareValue(-g,-c);case 6:return a.compareValue(-g,c);case 7:return a.compareValue(c,-g)}return te.shouldNeverReachHere("invalid octant value"),0}},{key:"compareValue",value:function(n,r){return n0?1:r0?1:0}}])}(),ph=function(){return f(function a(){u(this,a),a.constructor_.apply(this,arguments)},[{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(a){a.print(this.coord),a.print(" seg # = "+this.segmentIndex)}},{key:"compareTo",value:function(a){var n=a;return this.segmentIndexn.segmentIndex?1:this.coord.equals2D(n.coord)?0:this._isInterior?n._isInterior?mh.compare(this._segmentOctant,this.coord,n.coord):1:-1}},{key:"isEndPoint",value:function(a){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===a}},{key:"toString",value:function(){return this.segmentIndex+":"+this.coord.toString()}},{key:"isInterior",value:function(){return this._isInterior}},{key:"interfaces_",get:function(){return[G]}}],[{key:"constructor_",value:function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var a=arguments[0],n=arguments[1],r=arguments[2],o=arguments[3];this._segString=a,this.coord=new H(n),this.segmentIndex=r,this._segmentOctant=o,this._isInterior=!n.equals2D(a.getCoordinate(r))}}])}(),yh=function(){return f(function a(){u(this,a)},[{key:"hasNext",value:function(){}},{key:"next",value:function(){}},{key:"remove",value:function(){}}])}(),vh=function(){return f(function a(){u(this,a),a.constructor_.apply(this,arguments)},[{key:"getSplitCoordinates",value:function(){var a=new Tr;this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var o=n.next();this.addEdgeCoordinates(r,o,a),r=o}return a.toCoordinateArray()}},{key:"addCollapsedNodes",value:function(){var a=new we;this.findCollapsesFromInsertedNodes(a),this.findCollapsesFromExistingVertices(a);for(var n=a.iterator();n.hasNext();){var r=n.next().intValue();this.add(this._edge.getCoordinate(r),r)}}},{key:"createSplitEdgePts",value:function(a,n){var r=n.segmentIndex-a.segmentIndex+2;if(r===2)return[new H(a.coord),new H(n.coord)];var o=this._edge.getCoordinate(n.segmentIndex),c=n.isInterior()||!n.coord.equals2D(o);c||r--;var g=new Array(r).fill(null),d=0;g[d++]=new H(a.coord);for(var x=a.segmentIndex+1;x=0?r>=0?o>=c?0:1:o>=c?7:6:r>=0?o>=c?3:2:o>=c?4:5}if(arguments[0]instanceof H&&arguments[1]instanceof H){var g=arguments[0],d=arguments[1],x=d.x-g.x,N=d.y-g.y;if(x===0&&N===0)throw new U("Cannot compute the octant for two identical points "+g);return a.octant(x,N)}}}])}(),xh=function(){return f(function a(){u(this,a)},[{key:"getCoordinates",value:function(){}},{key:"size",value:function(){}},{key:"getCoordinate",value:function(a){}},{key:"isClosed",value:function(){}},{key:"setData",value:function(a){}},{key:"getData",value:function(){}}])}(),Eh=function(){return f(function a(){u(this,a)},[{key:"addIntersection",value:function(a,n){}},{key:"interfaces_",get:function(){return[xh]}}])}(),An=function(){function a(){u(this,a),a.constructor_.apply(this,arguments)}return f(a,[{key:"getCoordinates",value:function(){return this._pts}},{key:"size",value:function(){return this._pts.length}},{key:"getCoordinate",value:function(n){return this._pts[n]}},{key:"isClosed",value:function(){return this._pts[0].equals(this._pts[this._pts.length-1])}},{key:"getSegmentOctant",value:function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))}},{key:"setData",value:function(n){this._data=n}},{key:"safeOctant",value:function(n,r){return n.equals2D(r)?0:_h.octant(n,r)}},{key:"getData",value:function(){return this._data}},{key:"addIntersection",value:function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];this.addIntersectionNode(n,r)}else if(arguments.length===4){var o=arguments[1],c=arguments[3],g=new H(arguments[0].getIntersection(c));this.addIntersection(g,o)}}},{key:"toString",value:function(){return vs.toLineString(new br(this._pts))}},{key:"getNodeList",value:function(){return this._nodeList}},{key:"addIntersectionNode",value:function(n,r){var o=r,c=o+1;if(c=0&&o>=0||r=1&&d>=1||g1&&(x=this.p1);var N=this.project(c.p1);return d1&&(N=this.p1),new a(x,N)}}},{key:"normalize",value:function(){this.p1.compareTo(this.p0)0&&r1||W.isNaN(r))&&(r=1),r}},{key:"toString",value:function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}},{key:"isHorizontal",value:function(){return this.p0.y===this.p1.y}},{key:"reflect",value:function(n){var r=this.p1.getY()-this.p0.getY(),o=this.p0.getX()-this.p1.getX(),c=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),g=r*r+o*o,d=r*r-o*o,x=n.getX(),N=n.getY();return new H((-d*x-2*r*o*N-2*r*c)/g,(d*N-2*r*o*x-2*o*c)/g)}},{key:"distance",value:function(){if(arguments[0]instanceof a){var n=arguments[0];return Zt.segmentToSegment(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof H){var r=arguments[0];return Zt.pointToSegment(r,this.p0,this.p1)}}},{key:"pointAlong",value:function(n){var r=new H;return r.x=this.p0.x+n*(this.p1.x-this.p0.x),r.y=this.p0.y+n*(this.p1.y-this.p0.y),r}},{key:"hashCode",value:function(){var n=W.doubleToLongBits(this.p0.x);n^=31*W.doubleToLongBits(this.p0.y);var r=Math.trunc(n)^Math.trunc(n>>32),o=W.doubleToLongBits(this.p1.x);return o^=31*W.doubleToLongBits(this.p1.y),r^(Math.trunc(o)^Math.trunc(o>>32))}},{key:"interfaces_",get:function(){return[G,v]}}],[{key:"constructor_",value:function(){if(this.p0=null,this.p1=null,arguments.length===0)a.constructor_.call(this,new H,new H);else if(arguments.length===1){var n=arguments[0];a.constructor_.call(this,n.p0,n.p1)}else if(arguments.length===2){var r=arguments[0],o=arguments[1];this.p0=r,this.p1=o}else if(arguments.length===4){var c=arguments[0],g=arguments[1],d=arguments[2],x=arguments[3];a.constructor_.call(this,new H(c,g),new H(d,x))}}},{key:"midPoint",value:function(n,r){return new H((n.x+r.x)/2,(n.y+r.y)/2)}}])}(),Ih=function(){return f(function a(){u(this,a),a.constructor_.apply(this,arguments)},[{key:"overlap",value:function(){if(arguments.length!==2){if(arguments.length===4){var a=arguments[1],n=arguments[2],r=arguments[3];arguments[0].getLineSegment(a,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}}],[{key:"constructor_",value:function(){this._overlapSeg1=new vt,this._overlapSeg2=new vt}}])}(),Ea=function(){return f(function a(){u(this,a),a.constructor_.apply(this,arguments)},[{key:"getLineSegment",value:function(a,n){n.p0=this._pts[a],n.p1=this._pts[a+1]}},{key:"computeSelect",value:function(a,n,r,o){var c=this._pts[n],g=this._pts[r];if(r-n==1)return o.select(this,n),null;if(!a.intersects(c,g))return null;var d=Math.trunc((n+r)/2);n=n.length-1)return n.length-1;for(var c=ct.quadrant(n[o],n[o+1]),g=r+1;gc.getId()&&(c.computeOverlaps(d,r),this._nOverlaps++),this._segInt.isDone())return null}}}],[{key:"constructor_",value:function(){if(this._monoChains=new we,this._index=new jt,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,arguments.length!==0){if(arguments.length===1){var r=arguments[0];Ia.constructor_.call(this,r)}}}}])}(Ia),Sa=function(a){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return _(n,a),f(n,[{key:"overlap",value:function(){if(arguments.length!==4)return w(n,"overlap",this,1).apply(this,arguments);var r=arguments[1],o=arguments[2],c=arguments[3],g=arguments[0].getContext(),d=o.getContext();this._si.processIntersections(g,r,d,c)}}],[{key:"constructor_",value:function(){this._si=null;var r=arguments[0];this._si=r}}])}(Ih);Ss.SegmentOverlapAction=Sa;var Dt=function(){function a(){u(this,a),a.constructor_.apply(this,arguments)}return f(a,[{key:"isDeletable",value:function(n,r,o,c){var g=this._inputLine[n],d=this._inputLine[r],x=this._inputLine[o];return!!this.isConcave(g,d,x)&&!!this.isShallow(g,d,x,c)&&this.isShallowSampled(g,d,n,o,c)}},{key:"deleteShallowConcavities",value:function(){for(var n=1,r=this.findNextNonDeletedIndex(n),o=this.findNextNonDeletedIndex(r),c=!1;o=0;c--)this.addPt(n[c])}},{key:"isRedundant",value:function(n){if(this._ptList.size()Math.PI;)n-=a.PI_TIMES_2;for(;n0}},{key:"isObtuse",value:function(n,r,o){var c=n.x-r.x,g=n.y-r.y;return c*(o.x-r.x)+g*(o.y-r.y)=a.PI_TIMES_2&&(n=0)}else{for(;n>=a.PI_TIMES_2;)n-=a.PI_TIMES_2;nMath.PI&&(o=2*Math.PI-o),o}},{key:"toRadians",value:function(n){return n*Math.PI/180}},{key:"getTurn",value:function(n,r){var o=Math.sin(r-n);return o>0?a.COUNTERCLOCKWISE:oMath.PI?g-a.PI_TIMES_2:g}}])}();_t.PI_TIMES_2=2*Math.PI,_t.PI_OVER_2=Math.PI/2,_t.PI_OVER_4=Math.PI/4,_t.COUNTERCLOCKWISE=_e.COUNTERCLOCKWISE,_t.CLOCKWISE=_e.CLOCKWISE,_t.NONE=_e.COLLINEAR;var Pr=function(){function a(){u(this,a),a.constructor_.apply(this,arguments)}return f(a,[{key:"addNextSegment",value:function(n,r){if(this._s0=this._s1,this._s1=this._s2,this._s2=n,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 o=_e.index(this._s0,this._s1,this._s2),c=o===_e.CLOCKWISE&&this._side===re.LEFT||o===_e.COUNTERCLOCKWISE&&this._side===re.RIGHT;o===0?this.addCollinear(r):c?this.addOutsideTurn(o,r):this.addInsideTurn(o,r)}},{key:"addLineEndCap",value:function(n,r){var o=new vt(n,r),c=new vt;this.computeOffsetSegment(o,re.LEFT,this._distance,c);var g=new vt;this.computeOffsetSegment(o,re.RIGHT,this._distance,g);var d=r.x-n.x,x=r.y-n.y,N=Math.atan2(x,d);switch(this._bufParams.getEndCapStyle()){case b.CAP_ROUND:this._segList.addPt(c.p1),this.addDirectedFillet(r,N+Math.PI/2,N-Math.PI/2,_e.CLOCKWISE,this._distance),this._segList.addPt(g.p1);break;case b.CAP_FLAT:this._segList.addPt(c.p1),this._segList.addPt(g.p1);break;case b.CAP_SQUARE:var O=new H;O.x=Math.abs(this._distance)*Math.cos(N),O.y=Math.abs(this._distance)*Math.sin(N);var K=new H(c.p1.x+O.x,c.p1.y+O.y),V=new H(g.p1.x+O.x,g.p1.y+O.y);this._segList.addPt(K),this._segList.addPt(V)}}},{key:"getCoordinates",value:function(){return this._segList.getCoordinates()}},{key:"addMitreJoin",value:function(n,r,o,c){var g=cs.intersection(r.p0,r.p1,o.p0,o.p1);if(g!==null&&(c=V&&(N-=2*Math.PI),this._segList.addPt(r),this.addDirectedFillet(n,N,V,c,g),this._segList.addPt(o)}},{key:"addLastSegment",value:function(){this._segList.addPt(this._offset1.p1)}},{key:"initSideSegments",value:function(n,r,o){this._s1=n,this._s2=r,this._side=o,this._seg1.setCoordinates(n,r),this.computeOffsetSegment(this._seg1,o,this._distance,this._offset1)}},{key:"addLimitedMitreJoin",value:function(n,r,o,c){var g=this._seg0.p1,d=_t.angle(g,this._seg0.p0),x=_t.angleBetweenOriented(this._seg0.p0,g,this._seg1.p1)/2,N=_t.normalize(d+x),O=_t.normalize(N+Math.PI),K=c*o,V=o-K*Math.abs(Math.sin(x)),ue=g.x+K*Math.cos(O),de=g.y+K*Math.sin(O),pe=new H(ue,de),Ee=new vt(g,pe),Ge=Ee.pointAlongOffset(1,V),De=Ee.pointAlongOffset(1,-V);this._side===re.LEFT?(this._segList.addPt(Ge),this._segList.addPt(De)):(this._segList.addPt(De),this._segList.addPt(Ge))}},{key:"addDirectedFillet",value:function(n,r,o,c,g){var d=c===_e.CLOCKWISE?-1:1,x=Math.abs(r-o),N=Math.trunc(x/this._filletAngleQuantum+.5);if(N0){var o=new H((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(o);var c=new H((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(c)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}},{key:"createCircle",value:function(n){var r=new H(n.x+this._distance,n.y);this._segList.addPt(r),this.addDirectedFillet(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}},{key:"addBevelJoin",value:function(n,r){this._segList.addPt(n.p1),this._segList.addPt(r.p0)}},{key:"init",value:function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new ka,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*a.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}},{key:"addCollinear",value:function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===b.JOIN_BEVEL||this._bufParams.getJoinStyle()===b.JOIN_MITRE?(n&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,_e.CLOCKWISE,this._distance))}},{key:"closeRing",value:function(){this._segList.closeRing()}},{key:"hasNarrowConcaveAngle",value:function(){return this._hasNarrowConcaveAngle}}],[{key:"constructor_",value:function(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new vt,this._seg1=new vt,this._offset0=new vt,this._offset1=new vt,this._side=0,this._hasNarrowConcaveAngle=!1;var n=arguments[0],r=arguments[1],o=arguments[2];this._precisionModel=n,this._bufParams=r,this._li=new Pn,this._filletAngleQuantum=Math.PI/2/r.getQuadrantSegments(),r.getQuadrantSegments()>=8&&r.getJoinStyle()===b.JOIN_ROUND&&(this._closingSegLengthFactor=a.MAX_CLOSING_SEG_LEN_FACTOR),this.init(o)}}])}();Pr.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,Pr.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,Pr.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,Pr.MAX_CLOSING_SEG_LEN_FACTOR=80;var kh=function(){function a(){u(this,a),a.constructor_.apply(this,arguments)}return f(a,[{key:"getOffsetCurve",value:function(n,r){if(this._distance=r,r===0)return null;var o=r=0;x--)o.addNextSegment(g[x],!0)}else{o.addSegments(n,!1);var N=Dt.simplify(n,c),O=N.length-1;o.initSideSegments(N[0],N[1],re.LEFT),o.addFirstSegment();for(var K=2;K=0;O--)r.addNextSegment(x[O],!0);r.addLastSegment(),r.addLineEndCap(x[1],x[0]),r.closeRing()}},{key:"computePointCurve",value:function(n,r){switch(this._bufParams.getEndCapStyle()){case b.CAP_ROUND:r.createCircle(n);break;case b.CAP_SQUARE:r.createSquare(n)}}},{key:"getLineCurve",value:function(n,r){if(this._distance=r,this.isLineOffsetEmpty(r))return null;var o=Math.abs(r),c=this.getSegGen(o);if(n.length=0;x--)o.addNextSegment(g[x],!0)}else{var N=Dt.simplify(n,c),O=N.length-1;o.initSideSegments(N[0],N[1],re.LEFT),o.addFirstSegment();for(var K=2;Kc.getMaxY()||this.findStabbedSegments(a,o.getDirectedEdges(),n)}return n}if(arguments.length===3){if(ke(arguments[2],qe)&&arguments[0]instanceof H&&arguments[1]instanceof Es){for(var g=arguments[0],d=arguments[1],x=arguments[2],N=d.getEdge().getCoordinates(),O=0;Othis._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)this._seg.p1.y||_e.index(this._seg.p0,this._seg.p1,g)===_e.RIGHT)){var K=d.getDepth(re.LEFT);this._seg.p0.equals(N[O])||(K=d.getDepth(re.RIGHT));var V=new wa(this._seg,K);x.add(V)}}else if(ke(arguments[2],qe)&&arguments[0]instanceof H&&ke(arguments[1],qe))for(var ue=arguments[0],de=arguments[2],pe=arguments[1].iterator();pe.hasNext();){var Ee=pe.next();Ee.isForward()&&this.findStabbedSegments(ue,Ee,de)}}}},{key:"getDepth",value:function(a){var n=this.findStabbedSegments(a);return n.size()===0?0:Vn.min(n)._leftDepth}}],[{key:"constructor_",value:function(){this._subgraphs=null,this._seg=new vt;var a=arguments[0];this._subgraphs=a}}])}(),wa=function(){return f(function a(){u(this,a),a.constructor_.apply(this,arguments)},[{key:"compareTo",value:function(a){var n=a;if(this._upwardSeg.minX()>=n._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()x&&(x=g),d>x&&(x=d),x}},{key:"circumcentreDD",value:function(n,r,o){var c=ve.valueOf(n.x).subtract(o.x),g=ve.valueOf(n.y).subtract(o.y),d=ve.valueOf(r.x).subtract(o.x),x=ve.valueOf(r.y).subtract(o.y),N=ve.determinant(c,g,d,x).multiply(2),O=c.sqr().add(g.sqr()),K=d.sqr().add(x.sqr()),V=ve.determinant(g,O,x,K),ue=ve.determinant(c,O,d,K),de=ve.valueOf(o.x).subtract(V.divide(N)).doubleValue(),pe=ve.valueOf(o.y).add(ue.divide(N)).doubleValue();return new H(de,pe)}},{key:"isAcute",value:function(n,r,o){return!!_t.isAcute(n,r,o)&&!!_t.isAcute(r,o,n)&&!!_t.isAcute(o,n,r)}},{key:"circumcentre",value:function(n,r,o){var c=o.x,g=o.y,d=n.x-c,x=n.y-g,N=r.x-c,O=r.y-g,K=2*a.det(d,x,N,O),V=a.det(x,d*d+x*x,O,N*N+O*O),ue=a.det(d,d*d+x*x,N,N*N+O*O);return new H(c-V/K,g+ue/K)}},{key:"perpendicularBisector",value:function(n,r){var o=r.x-n.x,c=r.y-n.y,g=new ks(n.x+o/2,n.y+c/2,1),d=new ks(n.x-c+o/2,n.y+o+c/2,1);return new ks(g,d)}},{key:"angleBisector",value:function(n,r,o){var c=r.distance(n),g=c/(c+r.distance(o)),d=o.x-n.x,x=o.y-n.y;return new H(n.x+g*d,n.y+g*x)}},{key:"area3D",value:function(n,r,o){var c=r.x-n.x,g=r.y-n.y,d=r.getZ()-n.getZ(),x=o.x-n.x,N=o.y-n.y,O=o.getZ()-n.getZ(),K=g*O-d*N,V=d*x-c*O,ue=c*N-g*x,de=K*K+V*V+ue*ue,pe=Math.sqrt(de)/2;return pe}},{key:"centroid",value:function(n,r,o){var c=(n.x+r.x+o.x)/3,g=(n.y+r.y+o.y)/3;return new H(c,g)}},{key:"inCentre",value:function(n,r,o){var c=r.distance(o),g=n.distance(o),d=n.distance(r),x=c+g+d,N=(c*n.x+g*r.x+d*o.x)/x,O=(c*n.y+g*r.y+d*o.y)/x;return new H(N,O)}}])}(),wh=function(){return f(function a(){u(this,a),a.constructor_.apply(this,arguments)},[{key:"addRingSide",value:function(a,n,r,o,c){if(n===0&&a.length=wr.MINIMUM_VALID_SIZE&&_e.isCCW(a)&&(g=c,d=o,r=re.opposite(r));var x=this._curveBuilder.getRingCurve(a,r,n);this.addCurve(x,g,d)}},{key:"addRingBothSides",value:function(a,n){this.addRingSide(a,n,re.LEFT,D.EXTERIOR,D.INTERIOR),this.addRingSide(a,n,re.RIGHT,D.INTERIOR,D.EXTERIOR)}},{key:"addPoint",value:function(a){if(this._distance0&&this.isErodedCompletely(d,-this._distance)||this.addRingSide(x,n,re.opposite(r),D.INTERIOR,D.EXTERIOR)}}},{key:"isTriangleErodedCompletely",value:function(a,n){var r=new Nh(a[0],a[1],a[2]),o=r.inCentre();return Zt.pointToSegment(o,r.p0,r.p1)c}},{key:"addCollection",value:function(a){for(var n=0;n=this._max)throw new Te;var n=this._parent.getGeometryN(this._index++);return n instanceof yt?(this._subcollectionIterator=new a(n),this._subcollectionIterator.next()):n}},{key:"remove",value:function(){throw new ye(this.getClass().getName())}},{key:"hasNext",value:function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}},{key:"interfaces_",get:function(){return[yh]}}],[{key:"constructor_",value:function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var n=arguments[0];this._parent=n,this._atStart=!0,this._index=0,this._max=n.getNumGeometries()}},{key:"isAtomic",value:function(n){return!(n instanceof yt)}}])}(),Ch=function(){function a(){u(this,a),a.constructor_.apply(this,arguments)}return f(a,[{key:"locate",value:function(n){return a.locate(n,this._geom)}},{key:"interfaces_",get:function(){return[Th]}}],[{key:"constructor_",value:function(){this._geom=null;var n=arguments[0];this._geom=n}},{key:"locatePointInPolygon",value:function(n,r){if(r.isEmpty())return D.EXTERIOR;var o=r.getExteriorRing(),c=a.locatePointInRing(n,o);if(c!==D.INTERIOR)return c;for(var g=0;g=0;c--){var g=this._edgeList.get(c),d=g.getSym();o===null&&(o=d),r!==null&&d.setNext(r),r=g}o.setNext(r)}},{key:"computeDepths",value:function(){if(arguments.length===1){var r=arguments[0],o=this.findIndex(r),c=r.getDepth(re.LEFT),g=r.getDepth(re.RIGHT),d=this.computeDepths(o+1,this._edgeList.size(),c);if(this.computeDepths(0,o,d)!==g)throw new rt("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var x=arguments[1],N=arguments[2],O=arguments[0];O=0;d--){var x=this._resultAreaEdgeList.get(d),N=x.getSym();switch(o===null&&x.getEdgeRing()===r&&(o=x),g){case this._SCANNING_FOR_INCOMING:if(N.getEdgeRing()!==r)continue;c=N,g=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(x.getEdgeRing()!==r)continue;c.setNextMin(x),g=this._SCANNING_FOR_INCOMING}}g===this._LINKING_TO_OUTGOING&&(te.isTrue(o!==null,"found null for first outgoing dirEdge"),te.isTrue(o.getEdgeRing()===r,"unable to link last incoming dirEdge"),c.setNextMin(o))}},{key:"getOutgoingDegree",value:function(){if(arguments.length===0){for(var r=0,o=this.iterator();o.hasNext();)o.next().isInResult()&&r++;return r}if(arguments.length===1){for(var c=arguments[0],g=0,d=this.iterator();d.hasNext();)d.next().getEdgeRing()===c&&g++;return g}}},{key:"getLabel",value:function(){return this._label}},{key:"findCoveredLineEdges",value:function(){for(var r=D.NONE,o=this.iterator();o.hasNext();){var c=o.next(),g=c.getSym();if(!c.isLineEdge()){if(c.isInResult()){r=D.INTERIOR;break}if(g.isInResult()){r=D.EXTERIOR;break}}}if(r===D.NONE)return null;for(var d=r,x=this.iterator();x.hasNext();){var N=x.next(),O=N.getSym();N.isLineEdge()?N.getEdge().setCovered(d===D.INTERIOR):(N.isInResult()&&(d=D.EXTERIOR),O.isInResult()&&(d=D.INTERIOR))}}},{key:"computeLabelling",value:function(r){w(n,"computeLabelling",this,1).call(this,r),this._label=new Nt(D.NONE);for(var o=this.iterator();o.hasNext();)for(var c=o.next().getEdge().getLabel(),g=0;g0&&a.print(","),a.print("(");for(var o=r.getCoordinates(),c=0;c0&&a.print(","),a.print(o[c].x+" "+o[c].y);a.println(")")}a.print(") ")}},{key:"addAll",value:function(a){for(var n=a.iterator();n.hasNext();)this.add(n.next())}},{key:"findEdgeIndex",value:function(a){for(var n=0;na?1:this.distn?1:0}},{key:"interfaces_",get:function(){return[G]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var a=arguments[0],n=arguments[1],r=arguments[2];this.coord=new H(a),this.segmentIndex=n,this.dist=r}}])}(),Fh=function(){return f(function a(){u(this,a),a.constructor_.apply(this,arguments)},[{key:"print",value:function(a){a.println("Intersections:");for(var n=this.iterator();n.hasNext();)n.next().print(a)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(a){this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var o=n.next(),c=this.createSplitEdge(r,o);a.add(c),r=o}}},{key:"addEndpoints",value:function(){var a=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[a],a,0)}},{key:"createSplitEdge",value:function(a,n){var r=n.segmentIndex-a.segmentIndex+2,o=this.edge.pts[n.segmentIndex],c=n.dist>0||!n.coord.equals2D(o);c||r--;var g=new Array(r).fill(null),d=0;g[d++]=new H(a.coord);for(var x=a.segmentIndex+1;x=0&&r>=0&&this.setAtLeast(n,r,o)}},{key:"isWithin",value:function(){return a.isTrue(this._matrix[D.INTERIOR][D.INTERIOR])&&this._matrix[D.INTERIOR][D.EXTERIOR]===he.FALSE&&this._matrix[D.BOUNDARY][D.EXTERIOR]===he.FALSE}},{key:"isTouches",value:function(n,r){return n>r?this.isTouches(r,n):(n===he.A&&r===he.A||n===he.L&&r===he.L||n===he.L&&r===he.A||n===he.P&&r===he.A||n===he.P&&r===he.L)&&this._matrix[D.INTERIOR][D.INTERIOR]===he.FALSE&&(a.isTrue(this._matrix[D.INTERIOR][D.BOUNDARY])||a.isTrue(this._matrix[D.BOUNDARY][D.INTERIOR])||a.isTrue(this._matrix[D.BOUNDARY][D.BOUNDARY]))}},{key:"isOverlaps",value:function(n,r){return n===he.P&&r===he.P||n===he.A&&r===he.A?a.isTrue(this._matrix[D.INTERIOR][D.INTERIOR])&&a.isTrue(this._matrix[D.INTERIOR][D.EXTERIOR])&&a.isTrue(this._matrix[D.EXTERIOR][D.INTERIOR]):n===he.L&&r===he.L&&this._matrix[D.INTERIOR][D.INTERIOR]===1&&a.isTrue(this._matrix[D.INTERIOR][D.EXTERIOR])&&a.isTrue(this._matrix[D.EXTERIOR][D.INTERIOR])}},{key:"isEquals",value:function(n,r){return n===r&&a.isTrue(this._matrix[D.INTERIOR][D.INTERIOR])&&this._matrix[D.INTERIOR][D.EXTERIOR]===he.FALSE&&this._matrix[D.BOUNDARY][D.EXTERIOR]===he.FALSE&&this._matrix[D.EXTERIOR][D.INTERIOR]===he.FALSE&&this._matrix[D.EXTERIOR][D.BOUNDARY]===he.FALSE}},{key:"toString",value:function(){for(var n=new ii("123456789"),r=0;r=0||n===he.TRUE)||r===he.SYM_FALSE&&n===he.FALSE||r===he.SYM_P&&n===he.P||r===he.SYM_L&&n===he.L||r===he.SYM_A&&n===he.A}if(typeof arguments[0]=="string"&&typeof arguments[1]=="string"){var o=arguments[1];return new a(arguments[0]).matches(o)}}},{key:"isTrue",value:function(n){return n>=0||n===he.TRUE}}])}(),Gh=function(){function a(){u(this,a),a.constructor_.apply(this,arguments)}return f(a,[{key:"size",value:function(){return this._size}},{key:"addAll",value:function(n){return n===null||n.length===0?null:(this.ensureCapacity(this._size+n.length),St.arraycopy(n,0,this._data,this._size,n.length),void(this._size+=n.length))}},{key:"ensureCapacity",value:function(n){if(nr?n:r}},{key:"getMinX",value:function(a){var n=this.pts[this.startIndex[a]].x,r=this.pts[this.startIndex[a+1]].x;return nr&&(c=1),this._depth[n][o]=c}}}},{key:"getDelta",value:function(n){return this._depth[n][re.RIGHT]-this._depth[n][re.LEFT]}},{key:"getLocation",value:function(n,r){return this._depth[n][r]0?this.pts[0]:null;if(arguments.length===1){var r=arguments[0];return this.pts[r]}}},{key:"print",value:function(r){r.print("edge "+this._name+": "),r.print("LINESTRING (");for(var o=0;o0&&r.print(","),r.print(this.pts[o].x+" "+this.pts[o].y);r.print(") "+this._label+" "+this._depthDelta)}},{key:"computeIM",value:function(r){n.updateIM(this._label,r)}},{key:"isCollapsed",value:function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])}},{key:"isClosed",value:function(){return this.pts[0].equals(this.pts[this.pts.length-1])}},{key:"getMaximumSegmentIndex",value:function(){return this.pts.length-1}},{key:"getDepthDelta",value:function(){return this._depthDelta}},{key:"getNumPoints",value:function(){return this.pts.length}},{key:"printReverse",value:function(r){r.print("edge "+this._name+": ");for(var o=this.pts.length-1;o>=0;o--)r.print(this.pts[o]+" ");r.println("")}},{key:"getMonotoneChainEdge",value:function(){return this._mce===null&&(this._mce=new Uh(this)),this._mce}},{key:"getEnvelope",value:function(){if(this._env===null){this._env=new ce;for(var r=0;r0&&r.append(","),r.append(this.pts[o].x+" "+this.pts[o].y);return r.append(") "+this._label+" "+this._depthDelta),r.toString()}},{key:"isPointwiseEqual",value:function(r){if(this.pts.length!==r.pts.length)return!1;for(var o=0;oc||this._maxyd;if(x)return!1;var N=this.intersectsToleranceSquare(n,r);return te.isTrue(!(x&&N),"Found bad envelope test"),N}},{key:"initCorners",value:function(n){var r=.5;this._minx=n.x-r,this._maxx=n.x+r,this._miny=n.y-r,this._maxy=n.y+r,this._corner[0]=new H(this._maxx,this._maxy),this._corner[1]=new H(this._minx,this._maxy),this._corner[2]=new H(this._minx,this._miny),this._corner[3]=new H(this._maxx,this._miny)}},{key:"intersects",value:function(n,r){return this._scaleFactor===1?this.intersectsScaled(n,r):(this.copyScaled(n,this._p0Scaled),this.copyScaled(r,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}},{key:"scale",value:function(n){return Math.round(n*this._scaleFactor)}},{key:"getCoordinate",value:function(){return this._originalPt}},{key:"copyScaled",value:function(n,r){r.x=this.scale(n.x),r.y=this.scale(n.y)}},{key:"getSafeEnvelope",value:function(){if(this._safeEnv===null){var n=a.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new ce(this._originalPt.x-n,this._originalPt.x+n,this._originalPt.y-n,this._originalPt.y+n)}return this._safeEnv}},{key:"intersectsPixelClosure",value:function(n,r){return this._li.computeIntersection(n,r,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,r,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,r,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,r,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))}},{key:"intersectsToleranceSquare",value:function(n,r){var o=!1,c=!1;return this._li.computeIntersection(n,r,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(n,r,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(o=!0),this._li.computeIntersection(n,r,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(c=!0),this._li.computeIntersection(n,r,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!o||!c)||!!n.equals(this._pt)||!!r.equals(this._pt))))}},{key:"addSnappedNode",value:function(n,r){var o=n.getCoordinate(r),c=n.getCoordinate(r+1);return!!this.intersects(o,c)&&(n.addIntersection(this.getCoordinate(),r),!0)}}],[{key:"constructor_",value: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 n=arguments[0],r=arguments[1],o=arguments[2];if(this._originalPt=n,this._pt=n,this._scaleFactor=r,this._li=o,r=0;n--){try{this.bufferReducedPrecision(n)}catch(g){if(!(g instanceof rt))throw g;this._saveException=g}if(this._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var r=arguments[0],o=a.precisionScaleFactor(this._argGeom,this._distance,r),c=new Ft(o);this.bufferFixedPrecision(c)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var n=this._argGeom.getFactory().getPrecisionModel();n.getType()===Ft.FIXED?this.bufferFixedPrecision(n):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(n){this._bufParams.setQuadrantSegments(n)}},{key:"bufferOriginalPrecision",value:function(){try{var n=new Aa(this._bufParams);this._resultGeometry=n.buffer(this._argGeom,this._distance)}catch(r){if(!(r instanceof J))throw r;this._saveException=r}}},{key:"getResultGeometry",value:function(n){return this._distance=n,this.computeGeometry(),this._resultGeometry}},{key:"setEndCapStyle",value:function(n){this._bufParams.setEndCapStyle(n)}}],[{key:"constructor_",value:function(){if(this._argGeom=null,this._distance=null,this._bufParams=new b,this._resultGeometry=null,this._saveException=null,arguments.length===1){var n=arguments[0];this._argGeom=n}else if(arguments.length===2){var r=arguments[0],o=arguments[1];this._argGeom=r,this._bufParams=o}}},{key:"bufferOp",value:function(){if(arguments.length===2){var n=arguments[1];return new a(arguments[0]).getResultGeometry(n)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof le&&typeof arguments[1]=="number"){var r=arguments[1],o=arguments[2],c=new a(arguments[0]);return c.setQuadrantSegments(o),c.getResultGeometry(r)}if(arguments[2]instanceof b&&arguments[0]instanceof le&&typeof arguments[1]=="number"){var g=arguments[1];return new a(arguments[0],arguments[2]).getResultGeometry(g)}}else if(arguments.length===4){var d=arguments[1],x=arguments[2],N=arguments[3],O=new a(arguments[0]);return O.setQuadrantSegments(x),O.setEndCapStyle(N),O.getResultGeometry(d)}}},{key:"precisionScaleFactor",value:function(n,r,o){var c=n.getEnvelopeInternal(),g=kr.max(Math.abs(c.getMaxX()),Math.abs(c.getMaxY()),Math.abs(c.getMinX()),Math.abs(c.getMinY()))+2*(r>0?r:0),d=o-Math.trunc(Math.log(g)/Math.log(10)+1);return Math.pow(10,d)}}])}();nr.CAP_ROUND=b.CAP_ROUND,nr.CAP_BUTT=b.CAP_FLAT,nr.CAP_FLAT=b.CAP_FLAT,nr.CAP_SQUARE=b.CAP_SQUARE,nr.MAX_PRECISION_DIGITS=12;var Hh=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Fa=function(){return f(function a(n){u(this,a),this.geometryFactory=n||new Qn},[{key:"read",value:function(a){var n,r=(n=typeof a=="string"?JSON.parse(a):a).type;if(!Tt[r])throw new Error("Unknown GeoJSON type: "+n.type);return Hh.indexOf(r)!==-1?Tt[r].call(this,n.coordinates):r==="GeometryCollection"?Tt[r].call(this,n.geometries):Tt[r].call(this,n)}},{key:"write",value:function(a){var n=a.getGeometryType();if(!Jt[n])throw new Error("Geometry is not supported");return Jt[n].call(this,a)}}])}(),Tt={Feature:function(a){var n={};for(var r in a)n[r]=a[r];if(a.geometry){var o=a.geometry.type;if(!Tt[o])throw new Error("Unknown GeoJSON type: "+a.type);n.geometry=this.read(a.geometry)}return a.bbox&&(n.bbox=Tt.bbox.call(this,a.bbox)),n},FeatureCollection:function(a){var n={};if(a.features){n.features=[];for(var r=0;r1?0:e1?Vt:eUe?e-tn:eUe?t-tn:t0?ul)&&(u+=s*tn));for(var p,y=u;s>0?y>l:y1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function tm(e,t,i,s,u,l){var h=e[0],f=e[1],m=t[0],p=t[1],y=0,_=1,I=m-h,T=p-f,w;if(w=i-h,!(!I&&w>0)){if(w/=I,I0){if(w>_)return;w>y&&(y=w)}if(w=u-h,!(!I&&w_)return;w>y&&(y=w)}else if(I>0){if(w0)){if(w/=T,T0){if(w>_)return;w>y&&(y=w)}if(w=l-f,!(!T&&w_)return;w>y&&(y=w)}else if(T>0){if(w0&&(e[0]=h+y*I,e[1]=f+y*T),_=0;--f)u.point((_=y[f])[0],_[1]);else s(I.x,I.p.x,-1,u);I=I.p}I=I.o,y=I.z,T=!T}while(!I.v);u.lineEnd()}}}function Ru(e){if(t=e.length){for(var t,i=0,s=e[0],u;++it?1:e>=t?0:NaN}function nm(e){return e.length===1&&(e=rm(e)),{left:function(t,i,s,u){for(s==null&&(s=0),u==null&&(u=t.length);s>>1;e(t[l],i)>>1;e(t[l],i)>0?u=l:s=l+1}return s}}}function rm(e){return function(t,i){return dc(e(t),i)}}nm(dc);function mc(e){for(var t=e.length,i,s=-1,u=0,l,h;++s=0;)for(h=e[t],i=h.length;--i>=0;)l[--u]=h[i];return l}var zr=1e9,Ii=-zr;function im(e,t,i,s){function u(p,y){return e0)do I.point(T===0||T===3?e:i,T>1?s:t);while((T=(T+_+4)%4)!==w);else I.point(y[0],y[1])}function h(p,y){return nt(p[0]-e)0?0:3:nt(p[0]-i)0?2:1:nt(p[1]-t)0?1:0:y>0?3:2}function f(p,y){return m(p.x,y.x)}function m(p,y){var _=h(p,1),I=h(y,1);return _!==I?_-I:_===0?y[1]-p[1]:_===1?p[0]-y[0]:_===2?p[1]-y[1]:y[0]-p[0]}return function(p){var y=p,_=hc(),I,T,w,z,Y,Z,S,b,R,U,X,G={point:E,lineStart:L,lineEnd:P,polygonStart:k,polygonEnd:C};function E(A,B){u(A,B)&&y.point(A,B)}function v(){for(var A=0,B=0,F=T.length;Bs&&(te-J)*(s-$)>(ae-$)*(e-J)&&++A:ae=0?1:-1,E=G*X,v=E>Ue,k=w*R;if(Gs.add(mr(k*G*Ke(E),z*U+k*Je(E))),l+=v?X+G*tn:X,v^I>=i^S>=i){var C=Hi(pr(_),pr(Z));lo(C);var L=Hi(u,C);lo(L);var P=(v^X>=0?-1:1)*Hn(L[2]);(s>P||s===P&&(C[0]||C[1]))&&(h+=v^X>=0?1:-1)}}return(lJr&&(Jr=e),tWi&&(Wi=t)}kn();function pc(e,t,i,s){return function(u,l){var h=t(l),f=u.invert(s[0],s[1]),m=hc(),p=t(m),y=!1,_,I,T,w={point:z,lineStart:Z,lineEnd:S,polygonStart:function(){w.point=b,w.lineStart=R,w.lineEnd=U,I=[],_=[]},polygonEnd:function(){w.point=z,w.lineStart=Z,w.lineEnd=S,I=mc(I);var X=sm(_,f);I.length?(y||(l.polygonStart(),y=!0),gc(I,um,X,i,l)):X&&(y||(l.polygonStart(),y=!0),l.lineStart(),i(null,null,1,l),l.lineEnd()),y&&(l.polygonEnd(),y=!1),I=_=null},sphere:function(){l.polygonStart(),l.lineStart(),i(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function z(X,G){var E=u(X,G);e(X=E[0],G=E[1])&&l.point(X,G)}function Y(X,G){var E=u(X,G);h.point(E[0],E[1])}function Z(){w.point=Y,h.lineStart()}function S(){w.point=z,h.lineEnd()}function b(X,G){T.push([X,G]);var E=u(X,G);p.point(E[0],E[1])}function R(){p.lineStart(),T=[]}function U(){b(T[0][0],T[0][1]),p.lineEnd();var X=p.clean(),G=m.result(),E,v=G.length,k,C,L;if(T.pop(),_.push(T),T=null,!!v){if(X&1){if(C=G[0],(k=C.length-1)>0){for(y||(l.polygonStart(),y=!0),l.lineStart(),E=0;E1&&X&2&&G.push(G.pop().concat(G.shift())),I.push(G.filter(am))}}return w}}function am(e){return e.length>1}function um(e,t){return((e=e.x)[0]0?Ue:-Ue,m=nt(l-t);nt(m-Ue)0?Vt:-Vt),e.point(s,i),e.lineEnd(),e.lineStart(),e.point(f,i),e.point(l,i),u=0):s!==f&&m>=Ue&&(nt(t-s)He?Qd((Ke(t)*(l=Je(s))*Ke(i)-Ke(s)*(u=Je(t))*Ke(e))/(u*l*h)):(t+s)/2}function fm(e,t,i,s){var u;if(e==null)u=i*Vt,s.point(-Ue,u),s.point(0,u),s.point(Ue,u),s.point(Ue,0),s.point(Ue,-u),s.point(0,-u),s.point(-Ue,-u),s.point(-Ue,0),s.point(-Ue,u);else if(nt(e[0]-t[0])>He){var l=e[0]0,u=nt(i)>He;function l(y,_,I,T){em(T,e,t,I,y,_)}function h(y,_){return Je(y)*Je(_)>i}function f(y){var _,I,T,w,z;return{lineStart:function(){w=T=!1,z=1},point:function(Y,Z){var S=[Y,Z],b,R=h(Y,Z),U=s?R?0:p(Y,Z):R?p(Y+(Y0^M[1]Ue^(AI&&(T|=2),_I&&(T|=8),T}return pc(h,f,l,s?[0,-e]:[-Ue,e-Ue])}function yc(e){return function(t){var i=new fo;for(var s in e)i[s]=e[s];return i.stream=t,i}}function fo(){}fo.prototype={constructor:fo,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function vc(e,t,i){var s=t[1][0]-t[0][0],u=t[1][1]-t[0][1],l=e.clipExtent&&e.clipExtent();e.scale(150).translate([0,0]),l!=null&&e.clipExtent(null),$d(i,e.stream(Du));var h=Du.result(),f=Math.min(s/(h[1][0]-h[0][0]),u/(h[1][1]-h[0][1])),m=+t[0][0]+(s-f*(h[1][0]+h[0][0]))/2,p=+t[0][1]+(u-f*(h[1][1]+h[0][1]))/2;return l!=null&&e.clipExtent(l),e.scale(f*150).translate([m,p])}function gm(e,t,i){return vc(e,[[0,0],t],i)}var Bu=16,dm=Je(30*Pt);function Uu(e,t){return+t?pm(e,t):mm(e)}function mm(e){return yc({point:function(t,i){t=e(t,i),this.stream.point(t[0],t[1])}})}function pm(e,t){function i(s,u,l,h,f,m,p,y,_,I,T,w,z,Y){var Z=p-s,S=y-u,b=Z*Z+S*S;if(b>4*t&&z--){var R=h+I,U=f+T,X=m+w,G=Sr(R*R+U*U+X*X),E=Hn(X/=G),v=nt(nt(X)-1)t||nt((Z*P+S*M)/b-.5)>.3||h*I+f*T+m*w2?M[2]%360*Pt:0,L()):[p*yn,y*yn,_*yn]},v.precision=function(M){return arguments.length?(X=Uu(C,U=M*M),P()):Sr(U)},v.fitExtent=function(M,A){return vc(v,M,A)},v.fitSize=function(M,A){return gm(v,M,A)};function L(){T=fc(I=Vd(p,y,_),t);var M=t(f,m);return l=s-M[0]*i,h=u+M[1]*i,P()}function P(){return G=E=null,v}return function(){return t=e.apply(this,arguments),v.invert=t.invert&&k,L()}}function _c(e){return function(t,i){var s=Je(t),u=Je(i),l=e(s*u);return[l*u*Ke(t),l*Ke(i)]}}function xc(e){return function(t,i){var s=Sr(t*t+i*i),u=e(s),l=Ke(u),h=Je(u);return[mr(t*l,s*h),Hn(s&&i*l/s)]}}var xm=_c(function(e){return Sr(2/(1+e))});xm.invert=xc(function(e){return 2*Hn(e/2)});var Ec=_c(function(e){return(e=cc(e))&&e/Ke(e)});Ec.invert=xc(function(e){return e});function Em(){return vm(Ec).scale(79.4188).clipAngle(180-.001)}function Yu(e,t){return[e,t]}Yu.invert=Yu;var gt=63710088e-1,Ic={centimeters:gt*100,centimetres:gt*100,degrees:360/(2*Math.PI),feet:gt*3.28084,inches:gt*39.37,kilometers:gt/1e3,kilometres:gt/1e3,meters:gt,metres:gt,miles:gt/1609.344,millimeters:gt*1e3,millimetres:gt*1e3,nauticalmiles:gt/1852,radians:1,yards:gt*1.0936};function Im(e,t,i={}){const s={type:"Feature"};return(i.id===0||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=t||{},s.geometry=e,s}function ho(e,t={}){const i={type:"FeatureCollection"};return t.id&&(i.id=t.id),t.bbox&&(i.bbox=t.bbox),i.features=e,i}function Sm(e,t="kilometers"){const i=Ic[t];if(!i)throw new Error(t+" units is invalid");return e*i}function km(e,t="kilometers"){const i=Ic[t];if(!i)throw new Error(t+" units is invalid");return e/i}var{BufferOp:Nm,GeoJSONReader:wm,GeoJSONWriter:Tm}=Kd;function bm(e,t,i){i=i||{};var s=i.units||"kilometers",u=i.steps||8;if(!e)throw new Error("geojson is required");if(typeof i!="object")throw new Error("options must be an object");if(typeof u!="number")throw new Error("steps must be an number");if(t===void 0)throw new Error("radius is required");if(uk;){if(C-k>600){var P=C-k+1,M=v-k+1,A=Math.log(P),B=.5*Math.exp(2*A/3),F=.5*Math.sqrt(A*B*(P-B)/P)*(M-P/20&&s(E,k,C);se0;)J--}L(E[k],W)===0?s(E,k,J):s(E,++J,C),Jb?1:0}var l=function(S){S===void 0&&(S=9),this._maxEntries=Math.max(4,S),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function h(S,b,R){if(!R)return b.indexOf(S);for(var U=0;U=S.minX&&b.maxY>=S.minY}function Y(S){return{children:S,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Z(S,b,R,U,X){for(var G=[b,R];G.length;)if(!((R=G.pop())-(b=G.pop())=0&&X[b].children.length>this._maxEntries;)this._split(X,b),b--;this._adjustParentBBoxes(U,X,b)},l.prototype._split=function(S,b){var R=S[b],U=R.children.length,X=this._minEntries;this._chooseSplitAxis(R,X,U);var G=this._chooseSplitIndex(R,X,U),E=Y(R.children.splice(G,R.children.length-G));E.height=R.height,E.leaf=R.leaf,f(R,this.toBBox),f(E,this.toBBox),b?S[b-1].children.push(E):this._splitRoot(R,E)},l.prototype._splitRoot=function(S,b){this.data=Y([S,b]),this.data.height=S.height+1,this.data.leaf=!1,f(this.data,this.toBBox)},l.prototype._chooseSplitIndex=function(S,b,R){for(var U,X,G,E,v,k,C,L=1/0,P=1/0,M=b;M=b;L--){var P=S.children[L];p(E,S.leaf?X(P):P),v+=T(E)}return v},l.prototype._adjustParentBBoxes=function(S,b,R){for(var U=R;U>=0;U--)p(b[U],S)},l.prototype._condense=function(S){for(var b=S.length-1,R=void 0;b>=0;b--)S[b].children.length===0?b>0?(R=S[b-1].children).splice(R.indexOf(S[b]),1):this.clear():f(S[b],this.toBBox)},l})})(wc);var Am=wc.exports;class Om{constructor(t=[],i=Mm){if(this.data=t,this.length=this.data.length,this.compare=i,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const t=this.data[0],i=this.data.pop();return this.length--,this.length>0&&(this.data[0]=i,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:i,compare:s}=this,u=i[t];for(;t>0;){const l=t-1>>1,h=i[l];if(s(u,h)>=0)break;i[t]=h,t=l}i[t]=u}_down(t){const{data:i,compare:s}=this,u=this.length>>1,l=i[t];for(;t=0)break;i[t]=f,t=h}i[t]=l}}function Mm(e,t){return et?1:0}const Rm=Object.freeze(Object.defineProperty({__proto__:null,default:Om},Symbol.toStringTag,{value:"Module"})),Fm=Rd(Rm);var rs={exports:{}},Dm=function(t,i,s,u){var l=t[0],h=t[1],f=!1;s===void 0&&(s=0),u===void 0&&(u=i.length);for(var m=(u-s)/2,p=0,y=m-1;ph!=w>h&&lh!=w>h&&l0&&Array.isArray(i[0])?bc(t,i,s,u):Tc(t,i,s,u)};rs.exports.nested=bc;rs.exports.flat=Tc;var Bm=rs.exports,go={exports:{}};(function(e,t){(function(i,s){s(t)})(un,function(i){const u=33306690738754706e-32;function l(z,Y,Z,S,b){let R,U,X,G,E=Y[0],v=S[0],k=0,C=0;v>E==v>-E?(R=E,E=Y[++k]):(R=v,v=S[++C]);let L=0;if(kE==v>-E?(X=R-((U=E+R)-E),E=Y[++k]):(X=R-((U=v+R)-v),v=S[++C]),R=U,X!==0&&(b[L++]=X);kE==v>-E?(X=R-((U=R+E)-(G=U-R))+(E-G),E=Y[++k]):(X=R-((U=R+v)-(G=U-R))+(v-G),v=S[++C]),R=U,X!==0&&(b[L++]=X);for(;k0!=X>0)return G;const E=Math.abs(U+X);return Math.abs(G)>=f*E?G:-function(v,k,C,L,P,M,A){let B,F,q,ee,W,se,J,$,te,ae,oe,me,H,Pe,ce,le,D,Se;const Te=v-P,ye=C-P,Ye=k-M,ne=L-M;W=(ce=($=Te-(J=(se=134217729*Te)-(se-Te)))*(ae=ne-(te=(se=134217729*ne)-(se-ne)))-((Pe=Te*ne)-J*te-$*te-J*ae))-(oe=ce-(D=($=Ye-(J=(se=134217729*Ye)-(se-Ye)))*(ae=ye-(te=(se=134217729*ye)-(se-ye)))-((le=Ye*ye)-J*te-$*te-J*ae))),y[0]=ce-(oe+W)+(W-D),W=(H=Pe-((me=Pe+oe)-(W=me-Pe))+(oe-W))-(oe=H-le),y[1]=H-(oe+W)+(W-le),W=(Se=me+oe)-me,y[2]=me-(Se-W)+(oe-W),y[3]=Se;let ie=function(pt,ke){let Fe=ke[0];for(let Qe=1;Qe=re||-ie>=re||(B=v-(Te+(W=v-Te))+(W-P),q=C-(ye+(W=C-ye))+(W-P),F=k-(Ye+(W=k-Ye))+(W-M),ee=L-(ne+(W=L-ne))+(W-M),B===0&&F===0&&q===0&&ee===0)||(re=p*A+u*Math.abs(ie),(ie+=Te*ee+ne*B-(Ye*q+ye*F))>=re||-ie>=re))return ie;W=(ce=($=B-(J=(se=134217729*B)-(se-B)))*(ae=ne-(te=(se=134217729*ne)-(se-ne)))-((Pe=B*ne)-J*te-$*te-J*ae))-(oe=ce-(D=($=F-(J=(se=134217729*F)-(se-F)))*(ae=ye-(te=(se=134217729*ye)-(se-ye)))-((le=F*ye)-J*te-$*te-J*ae))),w[0]=ce-(oe+W)+(W-D),W=(H=Pe-((me=Pe+oe)-(W=me-Pe))+(oe-W))-(oe=H-le),w[1]=H-(oe+W)+(W-le),W=(Se=me+oe)-me,w[2]=me-(Se-W)+(oe-W),w[3]=Se;const Oe=l(4,y,4,w,_);W=(ce=($=Te-(J=(se=134217729*Te)-(se-Te)))*(ae=ee-(te=(se=134217729*ee)-(se-ee)))-((Pe=Te*ee)-J*te-$*te-J*ae))-(oe=ce-(D=($=Ye-(J=(se=134217729*Ye)-(se-Ye)))*(ae=q-(te=(se=134217729*q)-(se-q)))-((le=Ye*q)-J*te-$*te-J*ae))),w[0]=ce-(oe+W)+(W-D),W=(H=Pe-((me=Pe+oe)-(W=me-Pe))+(oe-W))-(oe=H-le),w[1]=H-(oe+W)+(W-le),W=(Se=me+oe)-me,w[2]=me-(Se-W)+(oe-W),w[3]=Se;const Ie=l(Oe,_,4,w,I);W=(ce=($=B-(J=(se=134217729*B)-(se-B)))*(ae=ee-(te=(se=134217729*ee)-(se-ee)))-((Pe=B*ee)-J*te-$*te-J*ae))-(oe=ce-(D=($=F-(J=(se=134217729*F)-(se-F)))*(ae=q-(te=(se=134217729*q)-(se-q)))-((le=F*q)-J*te-$*te-J*ae))),w[0]=ce-(oe+W)+(W-D),W=(H=Pe-((me=Pe+oe)-(W=me-Pe))+(oe-W))-(oe=H-le),w[1]=H-(oe+W)+(W-le),W=(Se=me+oe)-me,w[2]=me-(Se-W)+(oe-W),w[3]=Se;const qe=l(Ie,I,4,w,T);return T[qe-1]}(z,Y,Z,S,b,R,E)},i.orient2dfast=function(z,Y,Z,S,b,R){return(Y-R)*(Z-b)-(z-b)*(S-R)},Object.defineProperty(i,"__esModule",{value:!0})})})(go,go.exports);var Um=go.exports,Xu=Am,Oi=Fm,Ym=Bm,Xm=Um.orient2d;Oi.default&&(Oi=Oi.default);qo.exports=Cc;qo.exports.default=Cc;function Cc(e,t,i){t=Math.max(0,t===void 0?2:t),i=i||0;var s=Wm(e),u=new Xu(16);u.toBBox=function(S){return{minX:S[0],minY:S[1],maxX:S[0],maxY:S[1]}},u.compareMinX=function(S,b){return S[0]-b[0]},u.compareMinY=function(S,b){return S[1]-b[1]},u.load(e);for(var l=[],h=0,f;hl||f.push({node:y,dist:_})}for(;f.length&&!f.peek().node.children;){var I=f.pop(),T=I.node,w=Ys(T,t,i),z=Ys(T,s,u);if(I.dist=t.minX&&e[0]=t.minY&&e[1]0!=fr(e,t,s)>0&&fr(i,s,e)>0!=fr(i,s,t)>0}function Bs(e){var t=e.p,i=e.next.p;return e.minX=Math.min(t[0],i[0]),e.minY=Math.min(t[1],i[1]),e.maxX=Math.max(t[0],i[0]),e.maxY=Math.max(t[1],i[1]),e}function Wm(e){for(var t=e[0],i=e[0],s=e[0],u=e[0],l=0;ls[0]&&(s=h),h[1]u[1]&&(u=h)}var f=[t,i,s,u],m=f.slice();for(l=0;l1?(s=i[0],u=i[1]):f>0&&(s+=l*f,u+=h*f)}return l=e[0]-s,h=e[1]-u,l*l+h*h}function Si(e,t,i,s,u,l,h,f){var m=i-e,p=s-t,y=h-u,_=f-l,I=e-u,T=t-l,w=m*m+p*p,z=m*y+p*_,Y=y*y+_*_,Z=m*I+p*T,S=y*I+_*T,b=w*Y-z*z,R,U,X,G,E=b,v=b;b===0?(U=0,E=1,G=S,v=Y):(U=z*S-Y*Z,G=w*S-z*Z,UE&&(U=E,G=S+z,v=Y)),Gw?U=E:(U=-Z,E=w)):G>v&&(G=v,-Z+zw?U=E:(U=-Z+z,E=w)),R=U===0?0:U/E,X=G===0?0:G/v;var k=(1-R)*e+R*i,C=(1-R)*t+R*s,L=(1-X)*u+X*h,P=(1-X)*l+X*f,M=L-k,A=P-C;return M*M+A*A}function jm(e,t){return e[0]===t[0]?e[1]-t[1]:e[0]-t[0]}function Jm(e){e.sort(jm);for(var t=[],i=0;i=2&&fr(t[t.length-2],t[t.length-1],e[i])=0;u--){for(;s.length>=2&&fr(s[s.length-2],s[s.length-1],e[u]){i.push([u[0],u[1]])}),!i.length)return null;const s=Qm(i,t.concavity);return s.length>3?Pm([s]):null}function Vm(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return Lc(e);case"FeatureCollection":return e0(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Ho(e);default:throw new Error("unknown GeoJSON type")}}function Lc(e){const t={type:"Feature"};return Object.keys(e).forEach(i=>{switch(i){case"type":case"properties":case"geometry":return;default:t[i]=e[i]}}),t.properties=Pc(e.properties),e.geometry==null?t.geometry=null:t.geometry=Ho(e.geometry),t}function Pc(e){const t={};return e&&Object.keys(e).forEach(i=>{const s=e[i];typeof s=="object"?s===null?t[i]=null:Array.isArray(s)?t[i]=s.map(u=>u):t[i]=Pc(s):t[i]=s}),t}function e0(e){const t={type:"FeatureCollection"};return Object.keys(e).forEach(i=>{switch(i){case"type":case"features":return;default:t[i]=e[i]}}),t.features=e.features.map(i=>Lc(i)),t}function Ho(e){const t={type:e.type};return e.bbox&&(t.bbox=e.bbox),e.type==="GeometryCollection"?(t.geometries=e.geometries.map(i=>Ho(i)),t):(t.coordinates=Ac(e.coordinates),t)}function Ac(e){const t=e;return typeof t[0]!="object"?t.slice():t.map(i=>Ac(i))}var t0=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Xs=Math.ceil,Ct=Math.floor,dt="[BigNumber Error] ",Zu=dt+"Number primitive has more than 15 significant digits: ",Gt=1e14,be=14,zs=9007199254740991,qs=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],vn=1e7,et=1e9;function Oc(e){var t,i,s,u=S.prototype={constructor:S,toString:null,valueOf:null},l=new S(1),h=20,f=4,m=-7,p=21,y=-1e7,_=1e7,I=!1,T=1,w=0,z={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},Y="0123456789abcdefghijklmnopqrstuvwxyz",Z=!0;function S(E,v){var k,C,L,P,M,A,B,F,q=this;if(!(q instanceof S))return new S(E,v);if(v==null){if(E&&E._isBigNumber===!0){q.s=E.s,!E.c||E.e>_?q.c=q.e=null:E.e=10;M/=10,P++);P>_?q.c=q.e=null:(q.e=P,q.c=[E]);return}F=String(E)}else{if(!t0.test(F=String(E)))return s(q,F,A);q.s=F.charCodeAt(0)==45?(F=F.slice(1),-1):1}(P=F.indexOf("."))>-1&&(F=F.replace(".","")),(M=F.search(/e/i))>0?(P15)throw Error(Zu+E)}else q.s=F.charCodeAt(0)===45?(F=F.slice(1),-1):1;for(k=Y.slice(0,v),P=M=0,B=F.length;MP){P=B;continue}}else if(!L&&(F==F.toUpperCase()&&(F=F.toLowerCase())||F==F.toLowerCase()&&(F=F.toUpperCase()))){L=!0,M=-1,P=0;continue}return s(q,String(E),A,v)}A=!1,F=i(F,v,10,q.s),(P=F.indexOf("."))>-1?F=F.replace(".",""):P=F.length}for(M=0;F.charCodeAt(M)===48;M++);for(B=F.length;F.charCodeAt(--B)===48;);if(F=F.slice(M,++B)){if(B-=M,A&&S.DEBUG&&B>15&&(E>zs||E!==Ct(E)))throw Error(Zu+q.s*E);if((P=P-M-1)>_)q.c=q.e=null;else if(P=-et&&L=Gt||k!==Ct(k))break e;if(k!==0)return!0}}}else if(C===null&&L===null&&(P===null||P===1||P===-1))return!0;throw Error(dt+"Invalid BigNumber: "+E)},S.maximum=S.max=function(){return R(arguments,-1)},S.minimum=S.min=function(){return R(arguments,1)},S.random=function(){var E=9007199254740992,v=Math.random()*E&2097151?function(){return Ct(Math.random()*E)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(k){var C,L,P,M,A,B=0,F=[],q=new S(l);if(k==null?k=h:We(k,0,et),M=Xs(k/be),I)if(crypto.getRandomValues){for(C=crypto.getRandomValues(new Uint32Array(M*=2));B>>11),A>=9e15?(L=crypto.getRandomValues(new Uint32Array(2)),C[B]=L[0],C[B+1]=L[1]):(F.push(A%1e14),B+=2);B=M/2}else if(crypto.randomBytes){for(C=crypto.randomBytes(M*=7);B=9e15?crypto.randomBytes(7).copy(C,B):(F.push(A%1e14),B+=7);B=M/7}else throw I=!1,Error(dt+"crypto unavailable");if(!I)for(;B=10;A/=10,B++);BL-1&&(A[M+1]==null&&(A[M+1]=0),A[M+1]+=A[M]/L|0,A[M]%=L)}return A.reverse()}return function(k,C,L,P,M){var A,B,F,q,ee,W,se,J,$=k.indexOf("."),te=h,ae=f;for($>=0&&(q=w,w=0,k=k.replace(".",""),J=new S(C),W=J.pow(k.length-$),w=q,J.c=v(sn(bt(W.c),W.e,"0"),10,L,E),J.e=J.c.length),se=v(k,C,L,M?(A=Y,E):(A=E,Y)),F=q=se.length;se[--q]==0;se.pop());if(!se[0])return A.charAt(0);if($q||$==q&&(ae==4||ee||ae==6&&se[B-1]&1||ae==(W.sL;)se[B]=0,B||(++F,se=[1].concat(se));for(q=se.length;!se[--q];);for($=0,k="";$M?1:-1;else for(A=B=0;AL[A]?1:-1;break}return B}function k(C,L,P,M){for(var A=0;P--;)C[P]-=A,A=C[P]1;C.splice(0,1));}return function(C,L,P,M,A){var B,F,q,ee,W,se,J,$,te,ae,oe,me,H,Pe,ce,le,D,Se=C.s==L.s?1:-1,Te=C.c,ye=L.c;if(!Te||!Te[0]||!ye||!ye[0])return new S(!C.s||!L.s||(Te?ye&&Te[0]==ye[0]:!ye)?NaN:Te&&Te[0]==0||!ye?Se*0:Se/0);for($=new S(Se),te=$.c=[],F=C.e-L.e,Se=P+F+1,A||(A=Gt,F=Lt(C.e/be)-Lt(L.e/be),Se=Se/be|0),q=0;ye[q]==(Te[q]||0);q++);if(ye[q]>(Te[q]||0)&&F--,Se1&&(ye=E(ye,W,A),Te=E(Te,W,A),le=ye.length,Pe=Te.length),H=le,ae=Te.slice(0,le),oe=ae.length;oe=A/2&&ce++;do{if(W=0,B=v(ye,ae,le,oe),B1)for(W>=A&&(W=A-1),se=E(ye,W,A),J=se.length,oe=ae.length;v(se,ae,J,oe)==1;)W--,k(se,le=10;Se/=10,q++);X($,P+($.e=q+F*be-1)+1,M,ee)}else $.e=F,$.r=+ee;return $}}();function b(E,v,k,C){var L,P,M,A,B;if(k==null?k=f:We(k,0,8),!E.c)return E.toString();if(L=E.c[0],M=E.e,v==null)B=bt(E.c),B=C==1||C==2&&(M=p)?Ni(B,M):sn(B,M,"0");else if(E=X(new S(E),v,k),P=E.e,B=bt(E.c),A=B.length,C==1||C==2&&(vA){if(--v>0)for(B+=".";v--;B+="0");}else if(v+=P-A,v>0)for(P+1==A&&(B+=".");v--;B+="0");return E.s=10;L/=10,C++);return(k=C+k*be-1)>_?E.c=E.e=null:k=10;A/=10,L++);if(P=v-L,P=ee.length)if(C){for(;ee.length=10;A/=10,L++);P%=be,M=P-be+L,q=M5||q==5&&(k==4||C||k==6&&(P>0?M>0?B/W[L-M]:0:ee[F-1])%10&1||k==(E.s0?Ct(B/W[L-M]%W[M])*A:0),C)for(;;)if(F==0){for(P=1,M=ee[0];M>=10;M/=10,P++);for(M=ee[0]+=A,A=1;M>=10;M/=10,A++);P!=A&&(E.e++,ee[0]==Gt&&(ee[0]=1));break}else{if(ee[F]+=A,ee[F]!=Gt)break;ee[F--]=0,A=1}for(P=ee.length;ee[--P]===0;ee.pop());}E.e>_?E.c=E.e=null:E.e=p?Ni(v,k):sn(v,k,"0"),E.s14,!ee.c||!ee.c[0]||ee.c[0]==1&&!ee.e&&ee.c.length==1||!E.c||!E.c[0])return q=new S(Math.pow(+G(ee),A?E.s*(2-ki(E)):+G(E))),v?q.mod(v):q;if(B=E.s9&&(ee.e>0||ee.e1||A&&ee.c[1]>=24e7:ee.c[0]-1&&(P=1/P),new S(B?1/P:P);w&&(P=Xs(w/be+2))}for(A?(k=new S(.5),B&&(E.s=1),F=ki(E)):(L=Math.abs(+G(E)),F=L%2),q=new S(l);;){if(F){if(q=q.times(ee),!q.c)break;P?q.c.length>P&&(q.c.length=P):C&&(q=q.mod(v))}if(L){if(L=Ct(L/2),L===0)break;F=L%2}else if(E=E.times(k),X(E,E.e+1,1),E.e>14)F=ki(E);else{if(L=+G(E),L===0)break;F=L%2}ee=ee.times(ee),P?ee.c&&ee.c.length>P&&(ee.c.length=P):C&&(ee=ee.mod(v))}return C?q:(B&&(q=l.div(q)),v?q.mod(v):P?X(q,w,f,M):q)},u.integerValue=function(E){var v=new S(this);return E==null?E=f:We(E,0,8),X(v,v.e+1,E)},u.isEqualTo=u.eq=function(E,v){return Fn(this,new S(E,v))===0},u.isFinite=function(){return!!this.c},u.isGreaterThan=u.gt=function(E,v){return Fn(this,new S(E,v))>0},u.isGreaterThanOrEqualTo=u.gte=function(E,v){return(v=Fn(this,new S(E,v)))===1||v===0},u.isInteger=function(){return!!this.c&&Lt(this.e/be)>this.c.length-2},u.isLessThan=u.lt=function(E,v){return Fn(this,new S(E,v))0},u.isZero=function(){return!!this.c&&this.c[0]==0},u.minus=function(E,v){var k,C,L,P,M=this,A=M.s;if(E=new S(E,v),v=E.s,!A||!v)return new S(NaN);if(A!=v)return E.s=-v,M.plus(E);var B=M.e/be,F=E.e/be,q=M.c,ee=E.c;if(!B||!F){if(!q||!ee)return q?(E.s=-v,E):new S(ee?M:NaN);if(!q[0]||!ee[0])return ee[0]?(E.s=-v,E):new S(q[0]?M:f==3?-0:0)}if(B=Lt(B),F=Lt(F),q=q.slice(),A=B-F){for((P=A0)for(;v--;q[k++]=0);for(v=Gt-1;C>A;){if(q[--C]=0;){for(k=0,W=me[L]%te,se=me[L]/te|0,M=B,P=L+M;P>L;)F=oe[--M]%te,q=oe[M]/te|0,A=se*F+q*W,F=W*F+A%te*te+J[P]+k,k=(F/$|0)+(A/te|0)+se*q,J[P--]=F%$;J[P]=k}return k?++C:J.splice(0,1),U(E,J,C)},u.negated=function(){var E=new S(this);return E.s=-E.s||null,E},u.plus=function(E,v){var k,C=this,L=C.s;if(E=new S(E,v),v=E.s,!L||!v)return new S(NaN);if(L!=v)return E.s=-v,C.minus(E);var P=C.e/be,M=E.e/be,A=C.c,B=E.c;if(!P||!M){if(!A||!B)return new S(L/0);if(!A[0]||!B[0])return B[0]?E:new S(A[0]?C:L*0)}if(P=Lt(P),M=Lt(M),A=A.slice(),L=P-M){for(L>0?(M=P,k=B):(L=-L,k=A),k.reverse();L--;k.push(0));k.reverse()}for(L=A.length,v=B.length,L-v=10;L/=10,C++);}return E&&P.e+1>C&&(C=P.e+1),C},u.shiftedBy=function(E){return We(E,-zs,zs),this.times("1e"+E)},u.squareRoot=u.sqrt=function(){var E,v,k,C,L,P=this,M=P.c,A=P.s,B=P.e,F=h+4,q=new S("0.5");if(A!==1||!M||!M[0])return new S(!A||A0&&J>0){for(P=J%A||A,q=se.substr(0,P);P0&&(q+=F+se.slice(P)),W&&(q="-"+q)}C=ee?q+(k.decimalSeparator||"")+((B=+k.fractionGroupSize)?ee.replace(new RegExp("\\d{"+B+"}\\B","g"),"$&"+(k.fractionGroupSeparator||"")):ee):q}return(k.prefix||"")+C+(k.suffix||"")},u.toFraction=function(E){var v,k,C,L,P,M,A,B,F,q,ee,W,se=this,J=se.c;if(E!=null&&(A=new S(E),!A.isInteger()&&(A.c||A.s!==1)||A.lt(l)))throw Error(dt+"Argument "+(A.isInteger()?"out of range: ":"not an integer: ")+G(A));if(!J)return new S(se);for(v=new S(l),F=k=new S(l),C=B=new S(l),W=bt(J),P=v.e=W.length-se.e-1,v.c[0]=qs[(M=P%be)0?P>0?v:F:A,M=_,_=1/0,A=new S(W),B.c[0]=0;q=t(A,v,0,1),L=k.plus(q.times(C)),L.comparedTo(E)!=1;)k=C,C=L,F=B.plus(q.times(L=F)),B=L,v=A.minus(q.times(L=v)),A=L;return L=t(E.minus(k),C,0,1),B=B.plus(L.times(F)),k=k.plus(L.times(C)),B.s=F.s=se.s,P=P*2,ee=t(F,C,P,f).minus(se).abs().comparedTo(t(B,k,P,f).minus(se).abs())=p?Ni(bt(k.c),L):sn(bt(k.c),L,"0"):E===10&&Z?(k=X(new S(k),h+L+1,f),v=sn(bt(k.c),k.e,"0")):(We(E,2,Y.length,"Base"),v=i(sn(bt(k.c),L,"0"),10,E,C,!0)),C0||e===t?t:t-1}function bt(e){for(var t,i,s=1,u=e.length,l=e[0]+"";sp^i?1:-1;for(f=(m=u.length)l[h]^i?1:-1;return m==p?0:m>p^i?1:-1}function We(e,t,i,s){if(ei||e!==Ct(e))throw Error(dt+(s||"Argument")+(typeof e=="number"?ei?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function ki(e){var t=e.c.length-1;return Lt(e.e/be)==t&&e.c[t]%2!=0}function Ni(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(ts){for(u=i,t-=s;--t;u+=i);e+=u}else t0){let p=h.left;if(p==null||(m=f(p.key,e),m>0&&(h.left=p.right,p.right=h,h=p,p=h.left,p==null)))break;i==null?s=h:i.left=h,i=h,h=p}else if(met?1:0}wrap(){return{getRoot:()=>this.root,setRoot:e=>{this.root=e},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:e=>{this.splayCount=e},splay:e=>this.splay(e),has:e=>this.has(e)}}},Xx,In,ji=(In=class extends r0{constructor(i,s){super();ge(this,"root",null);ge(this,"compare");ge(this,"validKey");ge(this,Xx,"[object Set]");this.compare=i??this.defaultCompare(),this.validKey=s??(u=>u!=null&&u!=null)}delete(i){return this.validKey(i)?this._delete(i)!=null:!1}deleteAll(i){for(const s of i)this.delete(s)}forEach(i){const s=this[Symbol.iterator]();let u;for(;u=s.next(),!u.done;)i(u.value,u.value,this)}add(i){const s=this.splay(i);return s!=0&&this.addNewRoot(new Rr(i),s),this}addAndReturn(i){const s=this.splay(i);return s!=0&&this.addNewRoot(new Rr(i),s),this.root.key}addAll(i){for(const s of i)this.add(s)}isEmpty(){return this.root==null}isNotEmpty(){return this.root!=null}single(){if(this.size==0)throw"Bad state: No element";if(this.size>1)throw"Bad state: Too many element";return this.root.key}first(){if(this.size==0)throw"Bad state: No element";return this._first().key}last(){if(this.size==0)throw"Bad state: No element";return this._last().key}lastBefore(i){if(i==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(i)0)return this.root.key;let u=this.root.right;if(u==null)return null;let l=u.left;for(;l!=null;)u=l,l=u.left;return u.key}retainAll(i){const s=new In(this.compare,this.validKey),u=this.modificationCount;for(const l of i){if(u!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(l)&&this.splay(l)==0&&s.add(this.root.key)}s.size!=this.size&&(this.root=s.root,this.size=s.size,this.modificationCount++)}lookup(i){return!this.validKey(i)||this.splay(i)!=0?null:this.root.key}intersection(i){const s=new In(this.compare,this.validKey);for(const u of this)i.has(u)&&s.add(u);return s}difference(i){const s=new In(this.compare,this.validKey);for(const u of this)i.has(u)||s.add(u);return s}union(i){const s=this.clone();return s.addAll(i),s}clone(){const i=new In(this.compare,this.validKey);return i.size=this.size,i.root=this.copyNode(this.root),i}copyNode(i){if(i==null)return null;function s(l,h){let f,m;do{if(f=l.left,m=l.right,f!=null){const p=new Rr(f.key);h.left=p,s(f,p)}if(m!=null){const p=new Rr(m.key);h.right=p,l=m,h=p}}while(m!=null)}const u=new Rr(i.key);return s(i,u),u}toSet(){return this.clone()}entries(){return new s0(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[Symbol.iterator](){return new i0(this.wrap())}},Xx=Symbol.toStringTag,In),Mc=class{constructor(e){ge(this,"tree");ge(this,"path",new Array);ge(this,"modificationCount",null);ge(this,"splayCount");this.tree=e,this.splayCount=e.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;const e=this.path[this.path.length-1];return this.getValue(e)}rebuildPath(e){this.path.splice(0,this.path.length),this.tree.splay(e),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(e){for(;e!=null;)this.path.push(e),e=e.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(this.modificationCount==null){this.modificationCount=this.tree.getModificationCount();let i=this.tree.getRoot();for(;i!=null;)this.path.push(i),i=i.left;return this.path.length>0}throw"Concurrent modification during iteration."}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let e=this.path[this.path.length-1],t=e.right;if(t!=null){for(;t!=null;)this.path.push(t),t=t.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===e;)e=this.path.pop();return this.path.length>0}},i0=class extends Mc{getValue(e){return e.key}},s0=class extends Mc{getValue(e){return[e.key,e.key]}},Rc=e=>()=>e,mo=e=>{const t=e?(i,s)=>s.minus(i).abs().isLessThanOrEqualTo(e):Rc(!1);return(i,s)=>t(i,s)?0:i.comparedTo(s)};function o0(e){const t=e?(i,s,u,l,h)=>i.exponentiatedBy(2).isLessThanOrEqualTo(l.minus(s).exponentiatedBy(2).plus(h.minus(u).exponentiatedBy(2)).times(e)):Rc(!1);return(i,s,u)=>{const l=i.x,h=i.y,f=u.x,m=u.y,p=h.minus(m).times(s.x.minus(f)).minus(l.minus(f).times(s.y.minus(m)));return t(p,l,h,f,m)?0:p.comparedTo(0)}}var a0=e=>e,u0=e=>{if(e){const t=new ji(mo(e)),i=new ji(mo(e)),s=(l,h)=>h.addAndReturn(l),u=l=>({x:s(l.x,t),y:s(l.y,i)});return u({x:new Ot(0),y:new Ot(0)}),u}return a0},po=e=>({set:t=>{ln=po(t)},reset:()=>po(e),compare:mo(e),snap:u0(e),orient:o0(e)}),ln=po(),Fr=(e,t)=>e.ll.x.isLessThanOrEqualTo(t.x)&&t.x.isLessThanOrEqualTo(e.ur.x)&&e.ll.y.isLessThanOrEqualTo(t.y)&&t.y.isLessThanOrEqualTo(e.ur.y),yo=(e,t)=>{if(t.ur.x.isLessThan(e.ll.x)||e.ur.x.isLessThan(t.ll.x)||t.ur.y.isLessThan(e.ll.y)||e.ur.y.isLessThan(t.ll.y))return null;const i=e.ll.x.isLessThan(t.ll.x)?t.ll.x:e.ll.x,s=e.ur.x.isLessThan(t.ur.x)?e.ur.x:t.ur.x,u=e.ll.y.isLessThan(t.ll.y)?t.ll.y:e.ll.y,l=e.ur.y.isLessThan(t.ur.y)?e.ur.y:t.ur.y;return{ll:{x:i,y:u},ur:{x:s,y:l}}},Mi=(e,t)=>e.x.times(t.y).minus(e.y.times(t.x)),Fc=(e,t)=>e.x.times(t.x).plus(e.y.times(t.y)),Ji=e=>Fc(e,e).sqrt(),l0=(e,t,i)=>{const s={x:t.x.minus(e.x),y:t.y.minus(e.y)},u={x:i.x.minus(e.x),y:i.y.minus(e.y)};return Mi(u,s).div(Ji(u)).div(Ji(s))},c0=(e,t,i)=>{const s={x:t.x.minus(e.x),y:t.y.minus(e.y)},u={x:i.x.minus(e.x),y:i.y.minus(e.y)};return Fc(u,s).div(Ji(u)).div(Ji(s))},Wu=(e,t,i)=>t.y.isZero()?null:{x:e.x.plus(t.x.div(t.y).times(i.minus(e.y))),y:i},ju=(e,t,i)=>t.x.isZero()?null:{x:i,y:e.y.plus(t.y.div(t.x).times(i.minus(e.x)))},f0=(e,t,i,s)=>{if(t.x.isZero())return ju(i,s,e.x);if(s.x.isZero())return ju(e,t,i.x);if(t.y.isZero())return Wu(i,s,e.y);if(s.y.isZero())return Wu(e,t,i.y);const u=Mi(t,s);if(u.isZero())return null;const l={x:i.x.minus(e.x),y:i.y.minus(e.y)},h=Mi(l,t).div(u),f=Mi(l,s).div(u),m=e.x.plus(f.times(t.x)),p=i.x.plus(h.times(s.x)),y=e.y.plus(f.times(t.y)),_=i.y.plus(h.times(s.y)),I=m.plus(p).div(2),T=y.plus(_).div(2);return{x:I,y:T}},Qt=class Dc{constructor(t,i){ge(this,"point");ge(this,"isLeft");ge(this,"segment");ge(this,"otherSE");ge(this,"consumedBy");t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=i}static compare(t,i){const s=Dc.comparePoints(t.point,i.point);return s!==0?s:(t.point!==i.point&&t.link(i),t.isLeft!==i.isLeft?t.isLeft?1:-1:Ki.compare(t.segment,i.segment))}static comparePoints(t,i){return t.x.isLessThan(i.x)?-1:t.x.isGreaterThan(i.x)?1:t.y.isLessThan(i.y)?-1:t.y.isGreaterThan(i.y)?1:0}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");const i=t.point.events;for(let s=0,u=i.length;s{const l=u.otherSE;i.set(u,{sine:l0(this.point,t.point,l.point),cosine:c0(this.point,t.point,l.point)})};return(u,l)=>{i.has(u)||s(u),i.has(l)||s(l);const{sine:h,cosine:f}=i.get(u),{sine:m,cosine:p}=i.get(l);return h.isGreaterThanOrEqualTo(0)&&m.isGreaterThanOrEqualTo(0)?f.isLessThan(p)?1:f.isGreaterThan(p)?-1:0:h.isLessThan(0)&&m.isLessThan(0)?f.isLessThan(p)?-1:f.isGreaterThan(p)?1:0:m.isLessThan(h)?-1:m.isGreaterThan(h)?1:0}}},h0=class vo{constructor(t){ge(this,"events");ge(this,"poly");ge(this,"_isExteriorRing");ge(this,"_enclosingRing");this.events=t;for(let i=0,s=t.length;i0&&(t=m)}let i=t.segment.prevInResult(),s=i?i.prevInResult():null;for(;;){if(!i)return null;if(!s)return i.ringOut;if(s.ringOut!==i.ringOut)return((u=s.ringOut)==null?void 0:u.enclosingRing())!==i.ringOut?i.ringOut:(l=i.ringOut)==null?void 0:l.enclosingRing();i=s.prevInResult(),s=i?i.prevInResult():null}}},Ju=class{constructor(e){ge(this,"exteriorRing");ge(this,"interiorRings");this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){const e=this.exteriorRing.getGeom();if(e===null)return null;const t=[e];for(let i=0,s=this.interiorRings.length;i0?(this.tree.delete(t),i.push(e)):(this.segments.push(t),t.prev=s)}else{if(s&&u){const l=s.getIntersection(u);if(l!==null){if(!s.isAnEndpoint(l)){const h=this._splitSafely(s,l);for(let f=0,m=h.length;f0)return-1;const I=i.comparePoint(t.rightSE.point);return I!==0?I:-1}if(s.isGreaterThan(u)){if(f.isLessThan(m)&&f.isLessThan(y))return-1;if(f.isGreaterThan(m)&&f.isGreaterThan(y))return 1;const _=i.comparePoint(t.leftSE.point);if(_!==0)return _;const I=t.comparePoint(i.rightSE.point);return I0?-1:1}if(f.isLessThan(m))return-1;if(f.isGreaterThan(m))return 1;if(l.isLessThan(h)){const _=i.comparePoint(t.rightSE.point);if(_!==0)return _}if(l.isGreaterThan(h)){const _=t.comparePoint(i.rightSE.point);if(_0)return-1}if(!l.eq(h)){const _=p.minus(f),I=l.minus(s),T=y.minus(m),w=h.minus(u);if(_.isGreaterThan(I)&&T.isLessThan(w))return 1;if(_.isLessThan(I)&&T.isGreaterThan(w))return-1}return l.isGreaterThan(h)?1:l.isLessThan(h)||p.isLessThan(y)?-1:p.isGreaterThan(y)?1:t.idi.id?1:0}static fromRing(t,i,s){let u,l,h;const f=Qt.comparePoints(t,i);if(f0)u=i,l=t,h=-1;else throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);const m=new Qt(u,!0),p=new Qt(l,!1);return new Ri(m,p,[s],[h])}replaceRightSE(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const t=this.leftSE.point.y,i=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t.isLessThan(i)?t:i},ur:{x:this.rightSE.point.x,y:t.isGreaterThan(i)?t:i}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(t){return t.x.eq(this.leftSE.point.x)&&t.y.eq(this.leftSE.point.y)||t.x.eq(this.rightSE.point.x)&&t.y.eq(this.rightSE.point.y)}comparePoint(t){return ln.orient(this.leftSE.point,t,this.rightSE.point)}getIntersection(t){const i=this.bbox(),s=t.bbox(),u=yo(i,s);if(u===null)return null;const l=this.leftSE.point,h=this.rightSE.point,f=t.leftSE.point,m=t.rightSE.point,p=Fr(i,f)&&this.comparePoint(f)===0,y=Fr(s,l)&&t.comparePoint(l)===0,_=Fr(i,m)&&this.comparePoint(m)===0,I=Fr(s,h)&&t.comparePoint(h)===0;if(y&&p)return I&&!_?h:!I&&_?m:null;if(y)return _&&l.x.eq(m.x)&&l.y.eq(m.y)?null:l;if(p)return I&&h.x.eq(f.x)&&h.y.eq(f.y)?null:f;if(I&&_)return null;if(I)return h;if(_)return m;const T=f0(l,this.vector(),f,t.vector());return T===null||!Fr(u,T)?null:ln.snap(T)}split(t){const i=[],s=t.events!==void 0,u=new Qt(t,!0),l=new Qt(t,!1),h=this.rightSE;this.replaceRightSE(l),i.push(l),i.push(u);const f=new Ri(u,h,this.rings.slice(),this.windings.slice());return Qt.comparePoints(f.leftSE.point,f.rightSE.point)>0&&f.swapEvents(),Qt.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),s&&(u.checkForConsuming(),l.checkForConsuming()),i}swapEvents(){const t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let i=0,s=this.windings.length;i0){const l=i;i=s,s=l}if(i.prev===s){const l=i;i=s,s=l}for(let l=0,h=s.rings.length;lu.length===1&&u[0].isSubject;this._isInResult=s(t)!==s(i);break}}return this._isInResult}},Ku=class{constructor(e,t,i){ge(this,"poly");ge(this,"isExterior");ge(this,"segments");ge(this,"bbox");if(!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=t,this.isExterior=i,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const s=ln.snap({x:new Ot(e[0][0]),y:new Ot(e[0][1])});this.bbox={ll:{x:s.x,y:s.y},ur:{x:s.x,y:s.y}};let u=s;for(let l=1,h=e.length;lKr.run("union",e,t),_0=(e,...t)=>Kr.run("intersection",e,t),tE=(e,...t)=>Kr.run("difference",e,t);ln.set;function Gc(e,t,i={}){const s={type:"Feature"};return(i.id===0||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=t||{},s.geometry=e,s}function x0(e,t,i={}){for(const u of e){if(u.length{i.push(u.coordinates)}),i.length{const u=s.geometry.coordinates;return i+At(u[0],u[1],t)},0)}function I0(e,t,i={}){const s={type:"Feature"};return(i.id===0||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=t||{},s.geometry=e,s}function S0(e,t,i={}){if(e.length=h){var f=(i+u)/2;return[t,f-(s-t)/2,s,f+(s-t)/2]}else{var m=(t+s)/2;return[m-(u-i)/2,i,m+(u-i)/2,u]}}function b0(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function _o(e,t){if(t=t??{},!b0(t))throw new Error("options is invalid");var i=t.precision,s=t.coordinates,u=t.mutate;if(i=i==null||isNaN(i)?6:i,s=s==null||isNaN(s)?3:s,!e)throw new Error(" is required");if(typeof i!="number")throw new Error(" must be a number");if(typeof s!="number")throw new Error(" must be a number");(u===!1||u===void 0)&&(e=JSON.parse(JSON.stringify(e)));var l=Math.pow(10,i);return Er(e,function(h){C0(h,l,s)}),e}function C0(e,t,i){e.length>i&&e.splice(i,e.length);for(var s=0;s=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Zs(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function el(e,t){return e.type==="FeatureCollection"?"FeatureCollection":e.type==="GeometryCollection"?"GeometryCollection":e.type==="Feature"&&e.geometry!==null?e.geometry.type:e.type}function tl(e,t){if(!e)throw new Error("line is required");if(!t)throw new Error("splitter is required");var i=el(e),s=el(t);if(i!=="LineString")throw new Error("line must be LineString");if(s==="FeatureCollection")throw new Error("splitter cannot be a FeatureCollection");if(s==="GeometryCollection")throw new Error("splitter cannot be a GeometryCollection");var u=_o(t,{precision:7});switch(s){case"Point":return xo(e,u);case"MultiPoint":return nl(e,u);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return nl(e,io(e,u,{ignoreSelfIntersections:!0}))}}function nl(e,t){var i=[],s=sc();return ns(t,function(u){if(i.forEach(function(f,m){f.id=m}),!i.length)i=xo(e,u).features,i.forEach(function(f){f.bbox||(f.bbox=T0(mt(f)))}),s.load(Wr(i));else{var l=s.search(u);if(l.features.length){var h=Bc(u,l);i=i.filter(function(f){return f.id!==h.id}),s.remove(h),dr(xo(h,u),function(f){i.push(f),s.insert(f)})}}}),Wr(i)}function xo(e,t){var i=[],s=Zs(e)[0],u=Zs(e)[e.geometry.coordinates.length-1];if(Ws(s,Hs(t))||Ws(u,Hs(t)))return Wr([e]);var l=sc(),h=Ed(e);l.load(h);var f=l.search(t);if(!f.features.length)return Wr([e]);var m=Bc(t,f),p=[s],y=Tg(h,function(_,I,T){var w=Zs(I)[1],z=Hs(t);return T===m.id?(_.push(z),i.push(Vu(_)),Ws(z,w)?[z]:[z,w]):(_.push(w),_)},p);return y.length>1&&i.push(Vu(y)),Wr(i)}function Bc(e,t){if(!t.features.length)throw new Error("lines must contain features");if(t.features.length===1)return t.features[0];var i,s=1/0;return dr(t,function(u){var l=Xi(u,e),h=l.properties.dist;hs&&(l[0]=s),l[0]s&&(l[1]=s),l[1]0?1:0}function Uc(e,t,i={}){const s={type:"Feature"};return(i.id===0||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=t||{},s.geometry=e,s}function R0(e,t,i={}){for(const u of e){if(u.length{i.push(u.coordinates)}),i.length
`+t.geometry.coordinates.map(s=>this.createGpxSegment(s)).join(`
`)+`
`:`
`+this.createGpxSegment(t.geometry.coordinates)+`
`}static createGpxTrackFromPoints(t){const i=[];for(const s of t){let u=` `;s.properties.date&&(u+=` `),s.properties.altitude&&(u+=` ${s.properties.altitude}`),u+=" ",i.push(u)}return`
`+i.join(`
`)+`
`}static createGpxSegment(t){return`
`+t.map(([s,u])=>` `).join(`
`)+`
`}static toGpx(t,i){i=i==null?void 0:i.trim(),(i===void 0||i==="")&&(i="Uploaded with MapComplete"),i=zn.encodeXmlValue(i);let s;if(Array.isArray(t)){if(t[0].geometry.type==="Point")return this.createGpxTrackFromPoints(t);s=t.map(l=>this.createGpxTrack(l)).join(`
`)}else s=this.createGpxTrack(t);return jr.header+`
`+i+`
`+s+""}static toGpxPoints(t,i){i=(i==null?void 0:i.trim())||"Created with MapComplete",i=zn.encodeXmlValue(i);const s=[];for(const u of t){let l=` `;for(const h in u.properties){const f=h.replaceAll(":","__");l+=` ${u.properties[h]}${f}>
`,h==="website"&&(l+=` ${u.properties[h]}
`)}l+=`
`,s.push(l)}return jr.header+`
`+i+`
`+s.join(`
`)+`
`}};ge(jr,"header",'');let Qi=jr;const Me=class Me{static union(t,i){return D0(Mr([t,i]))}static intersect(t,i){return wi(Mr([t,i]))}static surfaceAreaInSqMeters(t){return Ls(t)}static centerpoint(t){const i=oo(t);return i.properties=t.properties,i.id=t.id,i}static centerpointCoordinates(t){if(t!=null)return oo(t).geometry.coordinates}static distanceBetween(t,i){return At(t,i,{units:"meters"})}static destination(t,i,s=90){return tc(t,i,s,{units:"meters"}).geometry.coordinates}static convexHull(t,i){return $m(t,i)}static calculateOverlap(t,i){const s=Yn.get(t),u=[];if(t.geometry.type==="Point"){const l=t.geometry.coordinates;for(const h of i)if(!(t.properties.id!==void 0&&t.properties.id===h.properties.id)){if(h.geometry===void 0)throw console.error("No geometry for feature ",t),"List of other features contains a feature without geometry an undefined";Me.inside(l,h)&&u.push({feat:h,overlap:void 0})}return u}if(t.geometry.type==="LineString"){for(const l of i){if(t.properties.id!==void 0&&t.properties.id===l.properties.id)continue;const h=Me.calculateIntersection(t,l,s);h!==null&&u.push({feat:l,overlap:h})}return u}if(t.geometry.type==="Polygon"||t.geometry.type==="MultiPolygon"){for(const l of i){if(t.properties.id!==void 0&&t.properties.id===l.properties.id)continue;if(l.geometry.type==="Point"){this.inside(l,t)&&u.push({feat:l,overlap:void 0});continue}const h=this.calculateIntersection(t,l,s);h!==null&&u.push({feat:l,overlap:h})}return u}return console.error("Could not correctly calculate the overlap of ",t,": unsupported type"),u}static inside(t,i){if(i.geometry.type==="Point")return!1;t.geometry!==void 0&&(t=t.geometry.coordinates);const s=t[0],u=t[1];if(i.geometry.type==="MultiPolygon"){const l=i.geometry.coordinates;for(const h of l)if(Me.pointInPolygonCoordinates(s,u,h))return!0;return!1}if(i.geometry.type==="Polygon")return Me.pointInPolygonCoordinates(s,u,i.geometry.coordinates);throw"GeoOperations.inside: unsupported geometry type "+i.geometry.type}static lengthInMeters(t){return $u(t)*1e3}static buffer(t,i){return bm(t,i/1e3,{units:"kilometers"})}static bbox(t){const[i,s,u,l]=mt(t);return{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[[i,s],[u,s],[u,l],[i,l],[i,s]]}}}static nearestPoint(t,i){return Xi(t,i,{units:"kilometers"})}static forceLineString(t){if(t.geometry.type==="Polygon")return t.geometry.coordinates.map(s=>({type:"Feature",geometry:{type:"LineString",coordinates:s},properties:t.properties}));if(t.geometry.type==="MultiPolygon"){const i=t;return[].concat(...i.geometry.coordinates.map(s=>[].concat(...s.map(u=>({type:"Feature",geometry:{type:"LineString",coordinates:u},properties:t.properties})))))}if(t.geometry.type==="LineString")return[t];if(t.geometry.type==="MultiLineString")return[t];throw"Invalid geometry to create a way from this"}static toCSV(t,i){const s=new Set,u=[];function l(m){i!=null&&i.ignoreTags&&m.match(i.ignoreTags)||s.has(m)||(s.add(m),u.push(m))}l("_lat"),l("_lon");const h=[];let f;Array.isArray(t)?f=t:f=t.features;for(const m of f){const p=m.properties;for(const y in p)l(y)}u.sort();for(const m of f){const p=m.properties;let y="";for(const _ of u){const I=p[_];I===void 0?y+=",":y+=JSON.stringify(I)+","}h.push(y)}return u.map(m=>JSON.stringify(m)).join(",")+`
`+h.join(`
`)}static ConvertWgs84To900913(t){const i=t[0],s=t[1],u=i*Me._originShift/180;let l=Math.log(Math.tan((90+s)*Math.PI/360))/(Math.PI/180);return l=l*Me._originShift/180,[u,l]}static Convert900913ToWgs84(t){const i=t[0],s=t[1],u=180*i/Me._originShift;let l=180*s/Me._originShift;return l=180/Math.PI*(2*Math.atan(Math.exp(l*Math.PI/180))-Math.PI/2),[u,l]}static GeoJsonToWGS84(t){return A0(t)}static SimplifyCoordinates(t){const i=[];for(let s=1;ss.geometry.coordinates)}static spreadIntoBboxes(t,i){const s=new Map,u=i;for(const l of t){if(l.geometry.type==="Point"){const[m,p]=l.geometry.coordinates,y=Be.embedded_tile(p,m,u),_=Be.tile_index(u,y.x,y.y);let I=s.get(_);I===void 0&&(I=[],s.set(_,I)),I.push(l);continue}const f=Yn.get(l).expandToTileBounds(i).containingTileRange(i);Be.MapRange(f,(m,p)=>{const y=Be.tile_index(i,m,p);let _=s.get(y);_===void 0&&(_=[],s.set(y,_)),_.push(l)})}return s}static clipAllInBox(t,i){var l;const s=Be.asGeojson(i),u=[];for(const h of t){const f=Me.clipWith(h,s);for(let m=0;m0&&(y+="_part_"+m),p.properties={...h.properties,id:y},u.push(p)}}return zo.noNull(u)}static removeOvernoding(t){if(t.geometry.type!=="LineString"&&t.geometry.type!=="Polygon")throw"Overnode removal is only supported on linestrings and polygons";const i={...t,geometry:{...t.geometry}};let s;t.geometry.type==="LineString"?(s=[...t.geometry.coordinates],i.geometry.coordinates=s):(s=[...t.geometry.coordinates[0]],i.geometry.coordinates[0]=s);for(let u=s.length-2;u>=1;u--){const l=s[u],h=s[u+1],f=s[u-1];if(Me.distanceBetween(l,f)<.1 p="Dn(l,h),y=Dn(f,l),_=Math.abs(p-y);(_<4||360-_<4)&&s.splice(u,1)}return" i bearing dn along xg completelywithin t.geometry.type='=="MultiPolygon"?t.geometry.coordinates.map(u='>({type:"Feature",geometry:{type:"Polygon",coordinates:u}})).every(u=>Fs(u,i)):t.geometry.type==="MultiLineString"?t.geometry.coordinates.map(u=>({type:"Feature",geometry:{type:"LineString",coordinates:u}})).every(u=>Fs(u,i)):Fs(t,i)}static toGpx(t,i){return Qi.toGpx(t,i)}static toGpxPoints(t,i){return Qi.toGpxPoints(t,i)}static clipWith(t,i){if(t.geometry.type==="Point"){const s=t;return Me.inside(s.geometry.coordinates,i)?[s]:[]}if(t.geometry.type==="LineString"){const s=tl(t,i).features,u=[];for(const l of s)Me.inside(Me.centerpointCoordinates(l),i)&&(l.properties={...t.properties},u.push(l));return u}if(t.geometry.type==="MultiLineString"){const s=t.geometry.coordinates.map(h=>tl({type:"LineString",coordinates:h},i).features),u=[].concat(...s),l=[];for(const h of u)Me.inside(Me.centerpointCoordinates(h),i)&&(h.properties={...t.properties},l.push(h));return l}if(t.geometry.type==="Polygon"||t.geometry.type=="MultiPolygon"){const s=wi(Mr([t,i]));return s===null?Me.completelyWithin(t,i)?[t]:Me.completelyWithin(i,t)?[{type:"Feature",properties:{...t.properties},geometry:i.geometry,bbox:i.bbox}]:[]:(s.properties={...t.properties},[s])}throw"Invalid geometry type with GeoOperations.clipWith: "+t.geometry.type}static featureToCoordinateWithRenderingType(t,i){switch(i){case"point":return t.geometry.type==="Point"?t.geometry.coordinates:void 0;case"centroid":return t.geometry.type==="Point"?void 0:Me.centerpointCoordinates(t);case"polygon_centroid":return t.geometry.type==="Polygon"?Me.centerpointCoordinates(t):void 0;case"projected_centerpoint":if(t.geometry.type==="LineString"||t.geometry.type==="MultiLineString"){const s=Me.centerpointCoordinates(t);return Me.nearestPoint(t,s).geometry.coordinates}return;case"start":return t.geometry.type==="LineString"?t.geometry.coordinates[0]:void 0;case"end":return t.geometry.type==="LineString"?t.geometry.coordinates.at(-1):void 0;default:throw"Unknown location type: "+i+" for feature "+t.properties.id}}static outerRing(t){return t.geometry.type!=="Polygon"?t:{type:"Feature",properties:t.properties,geometry:{type:"LineString",coordinates:t.geometry.coordinates[0]}}}static centerpointCoordinatesObj(t){Array.isArray(t)&&(t={type:"FeatureCollection",features:t});const[i,s]=Me.centerpointCoordinates(t);return{lon:i,lat:s}}static SplitSelfIntersectingWays(t){const i=[];for(const s of t)if(s.geometry.type==="LineString"){let u=s.geometry.coordinates;for(let l=u.length-1;l>=0;l--){const h=u[l];for(let f=l+1;f=1e4)return zn.roundHuman(Math.round(t/1e3))+"km";t=Math.round(t/100);const i=""+t;return i.substring(0,i.length-1)+"."+i.substring(i.length-1)+"km"}static parseBearing(t){let i;if(typeof t=="string"?(t=t.trim(),t.endsWith("°")&&(t=t.substring(0,t.length-1).trim()),i=Number(t)):i=t,!isNaN(i)){for(;i=0;s--){const u=i[s][0];for(let l=0;li!=I>i&&ty.geometry.coordinates);if(i.geometry.type==="LineString")return f.length>0?0:null;if(f.length==1){const y=t.geometry.coordinates,_=y[0];this.inside(_,i)?f.push(_):f.push(y[y.length-1])}const m=w0(Su(f[0]),Su(f[1]),t);return m==null?null:$u(m)*1e3}if(t.geometry.type==="Polygon"||t.geometry.type==="MultiPolygon"){const l=Yn.get(i);if(!s.overlapsWith(l))return null;if(i.geometry.type==="LineString")return this.calculateIntersection(i,t,l,s);try{const f=wi(Mr([t,i]));return f==null?null:Ls(f)}catch(f){if(f.message==="Each LinearRing of a Polygon must have 4 or more Positions.")return null;if(f.message.indexOf("SweepLine tree")>=0){console.log("Applying fallback intersection...");const m=wi(Mr([_o(t),_o(i)]));return m==null?null:Ls(m)}throw f}}throw"CalculateIntersection fallthrough: can not calculate an intersection between features"}};ge(Me,"_earthRadius",6378137),ge(Me,"_originShift",2*Math.PI*Me._earthRadius/2),ge(Me,"directions",["N","NE","E","SE","S","SW","W","NW"]),ge(Me,"directionsRelative",["straight","slight_right","right","sharp_right","behind","sharp_left","left","slight_left"]),ge(Me,"reverseBearing",{N:0,NNE:22.5,NE:45,ENE:67.5,E:90,ESE:112.5,SE:135,SSE:157.5,S:180,SSW:202.5,SW:225,WSW:247.5,W:270,WNW:292.5,NW:315,NNW:337.5});let $t=Me;class G0{async getRelevantUrlsFor(t,i){var l,h;const s=[],u=new Set;for(const f in t){if(!i.some(p=>f===p||f.match(new RegExp("^"+p+":[0-9]+"))))continue;const m=zo.noEmpty(((h=(l=t[f])==null?void 0:l.split(";"))==null?void 0:h.map(p=>p.trim()))??[]);for(const p of m){if(u.has(p))continue;u.add(p);let y=this.ExtractUrls(f,p);Array.isArray(y)||(y=await y),y&&s.push(...y)}}return s}getRelevantUrls(t,i){return $l.fromPromise(this.getRelevantUrlsFor(t,i))}static async offerImageAsDownload(t){const s=await(await fetch(t.url_hd??t.url)).blob();zn.offerContentsAsDownloadableFile(s,new URL(t.url).pathname.split("/").at(-1),{mimetype:"image/jpg"})}}function B0(e){let t,i,s,u,l,h;const f=e[4].default,m=fn(f,e,e[3],null);return{c(){t=Sn("label"),i=Sn("input"),s=Xo(),m&&m.c(),j(i,"type","checkbox"),j(i,"id",e[1]),j(t,"class","no-image-background flex items-center gap-1")},m(p,y){qt(p,t,y),xe(t,i),i.checked=e[0],xe(t,s),m&&m.m(t,null),u=!0,l||(h=It(i,"change",e[5]),l=!0)},p(p,[y]){y&1&&(i.checked=p[0]),m&&m.p&&(!u||y&8)&&hn(m,f,p,p[3],u?dn(f,p[3],y,null):gn(p[3]),null)},i(p){u||(tt(m,p),u=!0)},o(p){ot(m,p),u=!1},d(p){p&&Ht(t),m&&m.d(p),l=!1,h()}}}function U0(e,t,i){let{$$slots:s={},$$scope:u}=t,{selected:l}=t,h=l.data??!0,f=`checkbox-input-${Math.round(Math.random()*1e8)}`;l.addCallbackD(p=>{i(0,h=p)});function m(){h=this.checked,i(0,h)}return e.$$set=p=>{"selected"in p&&i(2,l=p.selected),"$$scope"in p&&i(3,u=p.$$scope)},e.$$.update=()=>{e.$$.dirty&5&&l.set(h)},[h,f,l,u,s,m]}class nE extends _r{constructor(t){super(),xr(this,t,U0,B0,Wn,{selected:2})}}let Yc=class{constructor(t){if(Y0(t))throw new Error("DataView: Passed buffer type is unsupported.");this.buffer=t,this.byteLength=this.buffer.length}getUint8(t){return this.buffer.readUInt8(t)}getUint16(t,i){return i?this.buffer.readUInt16LE(t):this.buffer.readUInt16BE(t)}getUint32(t,i){return i?this.buffer.readUInt32LE(t):this.buffer.readUInt32BE(t)}getInt32(t,i){return i?this.buffer.readInt32LE(t):this.buffer.readInt32BE(t)}};function Y0(e){return typeof e!="object"||e.length===void 0||e.readUInt8===void 0||e.readUInt16LE===void 0||e.readUInt16BE===void 0||e.readUInt32LE===void 0||e.readUInt32BE===void 0||e.readInt32LE===void 0||e.readInt32BE===void 0}function sl(e,t,i){try{return new DataView(e,t,i)}catch{return new Yc(e,t,i)}}function Le(e,t,i){const s=[];for(let u=0;uString.fromCharCode(t)).join("")}function Re(){for(let e=1;et+String.fromCharCode(i),""));if(!(typeof Buffer>"u"))return typeof Buffer.froms.charCodeAt(0)).buffer:typeof Buffer>"u"?void 0:typeof Buffer.froms.charCodeAt(0)).buffer}function q0(e,t,i){return Hc(i,t-e.length)+e}function H0(e,t){return parseInt(e.replace(".",""),t)/Math.pow(t,(e.split(".")[1]||"").length)}function Hc(e,t){return new Array(t+1).join(e)}const $i=void 0,Zc=0;function Wc(e,t,i,s="string"){if(t===Zc&&typeof DecompressionStream=="function"){const u=new DecompressionStream("deflate"),l=new Blob([e]).stream().pipeThrough(u);return s==="dataview"?new Response(l).arrayBuffer().then(h=>new DataView(h)):new Response(l).arrayBuffer().then(h=>new TextDecoder(i).decode(h))}return t!==void 0?Promise.reject(`Unknown compression method ${t}.`):e}const ol={USE_FILE:!0,USE_JFIF:!0,USE_PNG_FILE:!0,USE_EXIF:!0,USE_IPTC:!0,USE_XMP:!0,USE_ICC:!0,USE_MPF:!0,USE_PHOTOSHOP:!0,USE_THUMBNAIL:!0,USE_TIFF:!0,USE_JPEG:!0,USE_PNG:!0,USE_HEIC:!0,USE_AVIF:!0,USE_WEBP:!0,USE_GIF:!0,USE_MAKER_NOTES:!0};function $e(e){return e.map(t=>String.fromCharCode(t)).join("")}function Eo(e){if(e.length>=8){const t=$e(e.slice(0,8));if(t==="ASCII\0\0\0")return $e(e.slice(8));if(t==="JIS\0\0\0\0\0")return"[JIS encoded text]";if(t==="UNICODE\0")return"[Unicode encoded text]";if(t==="\0\0\0\0\0\0\0\0")return"[Undefined encoding]"}return"Undefined"}function Vi(e){return e[0][0]/e[0][1]+e[1][0]/e[1][1]/60+e[2][0]/e[2][1]/3600}const Io=18761,So=19789,jn={BIG_ENDIAN:So,LITTLE_ENDIAN:Io,getByteOrder:Z0};function Z0(e,t){if(e.getUint16(t)===Io)return Io;if(e.getUint16(t)===So)return So;throw new Error("Illegal byte order value. Faulty image.")}const al={isTiffFile:W0,findTiffOffsets:J0};function W0(e){return!!e&&e.byteLength>=4&&j0(e)}function j0(e){const s=e.getUint16(0)===jn.LITTLE_ENDIAN;return e.getUint16(2,s)===42}function J0(){return{hasAppMarkers:!0,tiffHeaderOffset:0}}const ul={isJpegFile:fp,findJpegOffsets:hp},K0=2,Q0=65496,ll=2,Mt=4,lt=2,$0=2,V0=10,ep=18,cl=33,fl=79,hl=18,tp=8,ko="ICC_PROFILE\0",jc=Mt+ko.length,np=jc+1,gl="MPF\0",Jc=65472,Kc=65474,rp=65476,ip=65499,sp=65501,op=65498,Qc=65504,Zo=65505,$c=65506,ap=65517,up=65519,lp=65534,cp=65535,dl="JFIF",ml="Exif",pl="http://ns.adobe.com/xap/1.0/\0",yl="http://ns.adobe.com/xmp/extension/\0",vl="Photoshop 3.0";function fp(e){return!!e&&e.byteLength>=K0&&e.getUint16(0)===Q0}function hp(e){let t=ll,i,s,u,l,h,f,m,p,y;for(;t+Mt+5ll,fileDataOffset:s||u,jfifDataOffset:l,tiffHeaderOffset:h,iptcDataOffset:f,xmpChunks:m,iccChunks:p,mpfDataOffset:y}}function gp(e,t){return e.getUint16(t)===Jc}function dp(e,t){return e.getUint16(t)===Kc}function mp(e,t){const i=ko.length;return e.getUint16(t)===$c&&Le(e,t+Mt,i)===ko}function pp(e,t){const i=gl.length;return e.getUint16(t)===$c&&Le(e,t+Mt,i)===gl}function yp(e,t){const i=dl.length;return e.getUint16(t)===Qc&&Le(e,t+Mt,i)===dl&&e.getUint8(t+Mt+i)===0}function vp(e,t){const i=ml.length;return e.getUint16(t)===Zo&&Le(e,t+Mt,i)===ml&&e.getUint8(t+Mt+i)===0}function _p(e,t){return e.getUint16(t)===Zo&&xp(e,t)}function xp(e,t){const i=pl.length;return Le(e,t+Mt,i)===pl}function Ep(e,t){return e.getUint16(t)===Zo&&Ip(e,t)}function Ip(e,t){const i=yl.length;return Le(e,t+Mt,i)===yl}function Sp(e,t){return{dataOffset:e+cl,length:t-(cl-lt)}}function kp(e,t){return{dataOffset:e+fl,length:t-(fl-lt)}}function Np(e,t){const i=vl.length;return e.getUint16(t)===ap&&Le(e,t+Mt,i)===vl&&e.getUint8(t+Mt+i)===0}function wp(e,t){const i=e.getUint16(t);return i>=Qc&&i
`,es=4,Xt=4,lr=0,Nn=es,st=es+Xt,wo="XML:com.adobe.xmp\0",Wo="tEXt",Zn="iTXt",is="zTXt",Vc="pHYs",ef="tIME",bp="eXIf",Cp="iCCP";function Lp(e){return!!e&&Le(e,0,No.length)===No}function Pp(e,t){const s={hasAppMarkers:!1};let u=No.length;for(;u+es+Xt>4;h.item.extent.extentOffset=f;const m=e.getUint8(l.lengthSize)&15;h.item.extent.extentLength=m;const p=e.getUint8(l.baseOffsetSize)>>4;h.item.baseOffset=p;const y=zp(e,l.indexSize,t);h.item.extent.extentIndex=y!==void 0?y:0;const _=qp(e,l.itemCount,t);return{type:"iloc",items:Hp(e,t,l,h,f,m,y,_),length:s}}function Xp(e,t){const i={item:{dataReferenceIndex:2,extentCount:2,extent:{}}};e0)return Fi(e,i,s)}function Fi(e,t,i){return i===4?e.getUint32(t):i===8?(console.warn("This file uses an 8-bit offset which is currently not supported by ExifReader. Contact the maintainer to get it fixed."),Up(e,t)):0}const jp=1718909296,Jp=1768977008,Kp=1835365473,Qp=1768714083,$p=1768517222,Vp=1768842853,ey=1768973167,ty=1668246642,tf=1165519206,jo=1835625829,ny=1970432288;function ss(e,t){const{length:l,contentOffset:h}=ry(e,t);if(lt.type==="iinf").itemInfos.find(t=>t.itemType===tf)}function To(e,t){return e.subBoxes.find(i=>i.type==="iloc").items.find(i=>i.itemId===t)}function cy(e,t){return t+4+e.getUint32(t)}function fy(e){try{const t=hy(e).itemId,i=To(e,t),s=To(e,t).extents[0];return[{dataOffset:i.baseOffset+s.extentOffset,length:s.extentLength}]}catch{return}}function hy(e){return e.subBoxes.find(t=>t.type==="iinf").itemInfos.find(t=>t.itemType===jo&&t.contentType==="application/rdf+xml")}function gy(e){try{const t=e.subBoxes.find(i=>i.type==="iprp").subBoxes.find(i=>i.type==="ipco").properties.find(i=>i.type==="colr").icc;if(t)return[t]}catch{}}function dy(e,t,i){return{type:"ftyp",majorBrand:Le(e,t,4),length:i}}function my(e,t,i,s){return{type:"iprp",subBoxes:os(e,i,s-(i-t)),length:s}}function py(e,t,i,s){return{type:"ipco",properties:os(e,i,s-(i-t)),length:s}}function yy(e,t,i){return{type:"colr",icc:vy(e,t),length:i}}function vy(e,t){const s=Le(e,t,4);if(!(s!=="prof"&&s!=="rICC"))return{offset:t+4,length:e.getUint32(t+4),chunkNumber:1,chunksTotal:1}}function _y(e,t,i,s){return{type:"meta",subBoxes:os(e,i+3,s-(i+3-t)),length:s}}function os(e,t,i){const s=[tf,jo],u=[];let l=t;for(;l=2&&(i===2?(h.itemId=e.getUint16(s),s+=2):i===3&&(h.itemId=e.getUint32(s),s+=4),h.itemProtectionIndex=e.getUint16(s),s+=2,h.itemType=e.getUint32(s),s+=4,h.itemName=ur(e,s),s+=h.itemName.length+1,h.itemType===jo?(h.contentType=ur(e,s),s+=h.contentType.length+1,t+u>s&&(h.contentEncoding=ur(e,s),s+=h.contentEncoding.length+1)):h.itemType===ny&&(h.itemUri=ur(e,s),s+=h.itemUri.length+1)),h}const xl={isHeicFile:Sy,findHeicOffsets:ky};function Sy(e){if(!e)return!1;const t=["heic","heix","hevc","hevx","heim","heis","hevm","hevs","mif1"];try{const i=ss(e,0);return i&&t.indexOf(i.majorBrand)!==-1}catch{return!1}}function ky(e){return nf(e)}const El={isAvifFile:Ny,findAvifOffsets:wy};function Ny(e){if(!e)return!1;try{const t=ss(e,0);return t&&t.majorBrand==="avif"}catch{return!1}}function wy(e){return nf(e)}const Il={isWebpFile:Ty,findOffsets:by};function Ty(e){const i="RIFF",u="WEBP";return!!e&&Le(e,0,i.length)===i&&Le(e,8,u.length)===u}function by(e){const s="Exif\0\0";let l=12,h=!1,f,m,p,y;for(;l+8Math.pow(Math.sqrt(2),e[0]/e[1]).toFixed(2),ColorSpace(e){return e===1?"sRGB":e===65535?"Uncalibrated":"Unknown"},ComponentsConfiguration(e){return e.map(t=>{if(t===49)return"Y";if(t===50)return"Cb";if(t===51)return"Cr";if(t===52)return"R";if(t===53)return"G";if(t===54)return"B"}).join("")},Contrast(e){return e===0?"Normal":e===1?"Soft":e===2?"Hard":"Unknown"},CustomRendered(e){return e===0?"Normal process":e===1?"Custom process":"Unknown"},ExposureMode(e){return e===0?"Auto exposure":e===1?"Manual exposure":e===2?"Auto bracket":"Unknown"},ExposureProgram(e){return e===0?"Undefined":e===1?"Manual":e===2?"Normal program":e===3?"Aperture priority":e===4?"Shutter priority":e===5?"Creative program":e===6?"Action program":e===7?"Portrait mode":e===8?"Landscape mode":e===9?"Bulb":"Unknown"},ExposureTime(e){if(e[0]/e[1]>.25){const t=e[0]/e[1];return Number.isInteger(t)?""+t:t.toFixed(1)}return e[0]!==0?`1/${Math.round(e[1]/e[0])}`:`0/${e[1]}`},FNumber:e=>`f/${e[0]/e[1]}`,FocalLength:e=>e[0]/e[1]+" mm",FocalPlaneResolutionUnit(e){return e===2?"inches":e===3?"centimeters":"Unknown"},LightSource:e=>e===1?"Daylight":e===2?"Fluorescent":e===3?"Tungsten (incandescent light)":e===4?"Flash":e===9?"Fine weather":e===10?"Cloudy weather":e===11?"Shade":e===12?"Daylight fluorescent (D 5700 – 7100K)":e===13?"Day white fluorescent (N 4600 – 5400K)":e===14?"Cool white fluorescent (W 3900 – 4500K)":e===15?"White fluorescent (WW 3200 – 3700K)":e===17?"Standard light A":e===18?"Standard light B":e===19?"Standard light C":e===20?"D55":e===21?"D65":e===22?"D75":e===23?"D50":e===24?"ISO studio tungsten":e===255?"Other light source":"Unknown",MeteringMode(e){return e===1?"Average":e===2?"CenterWeightedAverage":e===3?"Spot":e===4?"MultiSpot":e===5?"Pattern":e===6?"Partial":e===255?"Other":"Unknown"},ResolutionUnit(e){return e===2?"inches":e===3?"centimeters":"Unknown"},Saturation(e){return e===0?"Normal":e===1?"Low saturation":e===2?"High saturation":"Unknown"},SceneCaptureType(e){return e===0?"Standard":e===1?"Landscape":e===2?"Portrait":e===3?"Night scene":"Unknown"},Sharpness(e){return e===0?"Normal":e===1?"Soft":e===2?"Hard":"Unknown"},ShutterSpeedValue(e){const t=Math.pow(2,e[0]/e[1]);return t""+Math.round(e[0]/e[1]),YResolution:e=>""+Math.round(e[0]/e[1])},sf={11:"ProcessingSoftware",254:{name:"SubfileType",description:e=>({0:"Full-resolution image",1:"Reduced-resolution image",2:"Single page of multi-page image",3:"Single page of multi-page reduced-resolution image",4:"Transparency mask",5:"Transparency mask of reduced-resolution image",6:"Transparency mask of multi-page image",7:"Transparency mask of reduced-resolution multi-page image",65537:"Alternate reduced-resolution image",4294967295:"Invalid"})[e]||"Unknown"},255:{name:"OldSubfileType",description:e=>({0:"Full-resolution image",1:"Reduced-resolution image",2:"Single page of multi-page image"})[e]||"Unknown"},256:"ImageWidth",257:"ImageLength",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",263:{name:"Thresholding",description:e=>({1:"No dithering or halftoning",2:"Ordered dither or halfton",3:"Randomized dither"})[e]||"Unknown"},264:"CellWidth",265:"CellLength",266:{name:"FillOrder",description:e=>({1:"Normal",2:"Reversed"})[e]||"Unknown"},269:"DocumentName",270:"ImageDescription",271:"Make",272:"Model",273:"StripOffsets",274:{name:"Orientation",description:e=>e===1?"top-left":e===2?"top-right":e===3?"bottom-right":e===4?"bottom-left":e===5?"left-top":e===6?"right-top":e===7?"right-bottom":e===8?"left-bottom":"Undefined"},277:"SamplesPerPixel",278:"RowsPerStrip",279:"StripByteCounts",280:"MinSampleValue",281:"MaxSampleValue",282:{name:"XResolution",description:Ce.XResolution},283:{name:"YResolution",description:Ce.YResolution},284:"PlanarConfiguration",285:"PageName",286:{name:"XPosition",description:e=>""+Math.round(e[0]/e[1])},287:{name:"YPosition",description:e=>""+Math.round(e[0]/e[1])},290:{name:"GrayResponseUnit",description:e=>({1:"0.1",2:"0.001",3:"0.0001",4:"1e-05",5:"1e-06"})[e]||"Unknown"},296:{name:"ResolutionUnit",description:Ce.ResolutionUnit},297:"PageNumber",301:"TransferFunction",305:"Software",306:"DateTime",315:"Artist",316:"HostComputer",317:"Predictor",318:{name:"WhitePoint",description:e=>e.map(t=>`${t[0]}/${t[1]}`).join(", ")},319:{name:"PrimaryChromaticities",description:e=>e.map(t=>`${t[0]}/${t[1]}`).join(", ")},321:"HalftoneHints",322:"TileWidth",323:"TileLength",330:"A100DataOffset",332:{name:"InkSet",description:e=>({1:"CMYK",2:"Not CMYK"})[e]||"Unknown"},337:"TargetPrinter",338:{name:"ExtraSamples",description:e=>({0:"Unspecified",1:"Associated Alpha",2:"Unassociated Alpha"})[e]||"Unknown"},339:{name:"SampleFormat",description:e=>{const t={1:"Unsigned",2:"Signed",3:"Float",4:"Undefined",5:"Complex int",6:"Complex float"};return Array.isArray(e)?e.map(i=>t[i]||"Unknown").join(", "):"Unknown"}},513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",529:{name:"YCbCrCoefficients",description:e=>e.map(t=>""+t[0]/t[1]).join("/")},530:"YCbCrSubSampling",531:{name:"YCbCrPositioning",description:e=>e===1?"centered":e===2?"co-sited":"undefined "+e},532:{name:"ReferenceBlackWhite",description:e=>e.map(t=>""+t[0]/t[1]).join(", ")},700:"ApplicationNotes",18246:"Rating",18249:"RatingPercent",33432:{name:"Copyright",description:e=>e.join("; ")},33550:"PixelScale",33723:"IPTC-NAA",33920:"IntergraphMatrix",33922:"ModelTiePoint",34118:"SEMInfo",34264:"ModelTransform",34377:"PhotoshopSettings",34665:"Exif IFD Pointer",34675:"ICC_Profile",34735:"GeoTiffDirectory",34736:"GeoTiffDoubleParams",34737:"GeoTiffAsciiParams",34853:"GPS Info IFD Pointer",40091:{name:"XPTitle",description:Dr},40092:{name:"XPComment",description:Dr},40093:{name:"XPAuthor",description:Dr},40094:{name:"XPKeywords",description:Dr},40095:{name:"XPSubject",description:Dr},42112:"GDALMetadata",42113:"GDALNoData",50341:"PrintIM",50707:"DNGBackwardVersion",50708:"UniqueCameraModel",50709:"LocalizedCameraModel",50721:"ColorMatrix1",50722:"ColorMatrix2",50723:"CameraCalibration1",50724:"CameraCalibration2",50725:"ReductionMatrix1",50726:"ReductionMatrix2",50727:"AnalogBalance",50728:"AsShotNeutral",50729:"AsShotWhiteXY",50730:"BaselineExposure",50731:"BaselineNoise",50732:"BaselineSharpness",50734:"LinearResponseLimit",50735:"CameraSerialNumber",50736:"DNGLensInfo",50739:"ShadowScale",50741:{name:"MakerNoteSafety",description:e=>({0:"Unsafe",1:"Safe"})[e]||"Unknown"},50778:{name:"CalibrationIlluminant1",description:Ce.LightSource},50779:{name:"CalibrationIlluminant2",description:Ce.LightSource},50781:"RawDataUniqueID",50827:"OriginalRawFileName",50828:"OriginalRawFileData",50831:"AsShotICCProfile",50832:"AsShotPreProfileMatrix",50833:"CurrentICCProfile",50834:"CurrentPreProfileMatrix",50879:"ColorimetricReference",50885:"SRawType",50898:"PanasonicTitle",50899:"PanasonicTitle2",50931:"CameraCalibrationSig",50932:"ProfileCalibrationSig",50933:"ProfileIFD",50934:"AsShotProfileName",50936:"ProfileName",50937:"ProfileHueSatMapDims",50938:"ProfileHueSatMapData1",50939:"ProfileHueSatMapData2",50940:"ProfileToneCurve",50941:{name:"ProfileEmbedPolicy",description:e=>({0:"Allow Copying",1:"Embed if Used",2:"Never Embed",3:"No Restrictions"})[e]||"Unknown"},50942:"ProfileCopyright",50964:"ForwardMatrix1",50965:"ForwardMatrix2",50966:"PreviewApplicationName",50967:"PreviewApplicationVersion",50968:"PreviewSettingsName",50969:"PreviewSettingsDigest",50970:{name:"PreviewColorSpace",description:e=>({1:"Gray Gamma 2.2",2:"sRGB",3:"Adobe RGB",4:"ProPhoto RGB"})[e]||"Unknown"},50971:"PreviewDateTime",50972:"RawImageDigest",50973:"OriginalRawFileDigest",50981:"ProfileLookTableDims",50982:"ProfileLookTableData",51043:"TimeCodes",51044:"FrameRate",51058:"TStop",51081:"ReelName",51089:"OriginalDefaultFinalSize",51090:"OriginalBestQualitySize",51091:"OriginalDefaultCropSize",51105:"CameraLabel",51107:{name:"ProfileHueSatMapEncoding",description:e=>({0:"Linear",1:"sRGB"})[e]||"Unknown"},51108:{name:"ProfileLookTableEncoding",description:e=>({0:"Linear",1:"sRGB"})[e]||"Unknown"},51109:"BaselineExposureOffset",51110:{name:"DefaultBlackRender",description:e=>({0:"Auto",1:"None"})[e]||"Unknown"},51111:"NewRawImageDigest",51112:"RawToPreviewGain"};function Dr(e){return new TextDecoder("utf-16").decode(new Uint8Array(e)).replace(/\u0000+$/,"")}const Dy={33434:{name:"ExposureTime",description:Ce.ExposureTime},33437:{name:"FNumber",description:Ce.FNumber},34850:{name:"ExposureProgram",description:Ce.ExposureProgram},34852:"SpectralSensitivity",34855:"ISOSpeedRatings",34856:{name:"OECF",description:()=>"[Raw OECF table data]"},34858:"TimeZoneOffset",34859:"SelfTimerMode",34864:{name:"SensitivityType",description:e=>({1:"Standard Output Sensitivity",2:"Recommended Exposure Index",3:"ISO Speed",4:"Standard Output Sensitivity and Recommended Exposure Index",5:"Standard Output Sensitivity and ISO Speed",6:"Recommended Exposure Index and ISO Speed",7:"Standard Output Sensitivity, Recommended Exposure Index and ISO Speed"})[e]||"Unknown"},34865:"StandardOutputSensitivity",34866:"RecommendedExposureIndex",34867:"ISOSpeed",34868:"ISOSpeedLatitudeyyy",34869:"ISOSpeedLatitudezzz",36864:{name:"ExifVersion",description:e=>$e(e)},36867:"DateTimeOriginal",36868:"DateTimeDigitized",36873:"GooglePlusUploadCode",36880:"OffsetTime",36881:"OffsetTimeOriginal",36882:"OffsetTimeDigitized",37121:{name:"ComponentsConfiguration",description:Ce.ComponentsConfiguration},37122:"CompressedBitsPerPixel",37377:{name:"ShutterSpeedValue",description:Ce.ShutterSpeedValue},37378:{name:"ApertureValue",description:Ce.ApertureValue},37379:"BrightnessValue",37380:"ExposureBiasValue",37381:{name:"MaxApertureValue",description:e=>Math.pow(Math.sqrt(2),e[0]/e[1]).toFixed(2)},37382:{name:"SubjectDistance",description:e=>e[0]/e[1]+" m"},37383:{name:"MeteringMode",description:Ce.MeteringMode},37384:{name:"LightSource",description:Ce.LightSource},37385:{name:"Flash",description:e=>e===0?"Flash did not fire":e===1?"Flash fired":e===5?"Strobe return light not detected":e===7?"Strobe return light detected":e===9?"Flash fired, compulsory flash mode":e===13?"Flash fired, compulsory flash mode, return light not detected":e===15?"Flash fired, compulsory flash mode, return light detected":e===16?"Flash did not fire, compulsory flash mode":e===24?"Flash did not fire, auto mode":e===25?"Flash fired, auto mode":e===29?"Flash fired, auto mode, return light not detected":e===31?"Flash fired, auto mode, return light detected":e===32?"No flash function":e===65?"Flash fired, red-eye reduction mode":e===69?"Flash fired, red-eye reduction mode, return light not detected":e===71?"Flash fired, red-eye reduction mode, return light detected":e===73?"Flash fired, compulsory flash mode, red-eye reduction mode":e===77?"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected":e===79?"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected":e===89?"Flash fired, auto mode, red-eye reduction mode":e===93?"Flash fired, auto mode, return light not detected, red-eye reduction mode":e===95?"Flash fired, auto mode, return light detected, red-eye reduction mode":"Unknown"},37386:{name:"FocalLength",description:Ce.FocalLength},37393:"ImageNumber",37394:{name:"SecurityClassification",description:e=>({C:"Confidential",R:"Restricted",S:"Secret",T:"Top Secret",U:"Unclassified"})[e]||"Unknown"},37395:"ImageHistory",37396:{name:"SubjectArea",description:e=>e.length===2?`Location; X: ${e[0]}, Y: ${e[1]}`:e.length===3?`Circle; X: ${e[0]}, Y: ${e[1]}, diameter: ${e[2]}`:e.length===4?`Rectangle; X: ${e[0]}, Y: ${e[1]}, width: ${e[2]}, height: ${e[3]}`:"Unknown"},37500:{name:"MakerNote",description:()=>"[Raw maker note data]"},37510:{name:"UserComment",description:Eo},37520:"SubSecTime",37521:"SubSecTimeOriginal",37522:"SubSecTimeDigitized",37724:"ImageSourceData",37888:{name:"AmbientTemperature",description:e=>e[0]/e[1]+" °C"},37889:{name:"Humidity",description:e=>e[0]/e[1]+" %"},37890:{name:"Pressure",description:e=>e[0]/e[1]+" hPa"},37891:{name:"WaterDepth",description:e=>e[0]/e[1]+" m"},37892:{name:"Acceleration",description:e=>e[0]/e[1]+" mGal"},37893:{name:"CameraElevationAngle",description:e=>e[0]/e[1]+" °"},40960:{name:"FlashpixVersion",description:e=>e.map(t=>String.fromCharCode(t)).join("")},40961:{name:"ColorSpace",description:Ce.ColorSpace},40962:"PixelXDimension",40963:"PixelYDimension",40964:"RelatedSoundFile",40965:"Interoperability IFD Pointer",41483:"FlashEnergy",41484:{name:"SpatialFrequencyResponse",description:()=>"[Raw SFR table data]"},41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:{name:"FocalPlaneResolutionUnit",description:Ce.FocalPlaneResolutionUnit},41492:{name:"SubjectLocation",description:([e,t])=>`X: ${e}, Y: ${t}`},41493:"ExposureIndex",41495:{name:"SensingMethod",description:e=>e===1?"Undefined":e===2?"One-chip color area sensor":e===3?"Two-chip color area sensor":e===4?"Three-chip color area sensor":e===5?"Color sequential area sensor":e===7?"Trilinear sensor":e===8?"Color sequential linear sensor":"Unknown"},41728:{name:"FileSource",description:e=>e===3?"DSC":"Unknown"},41729:{name:"SceneType",description:e=>e===1?"A directly photographed image":"Unknown"},41730:{name:"CFAPattern",description:()=>"[Raw CFA pattern table data]"},41985:{name:"CustomRendered",description:Ce.CustomRendered},41986:{name:"ExposureMode",description:Ce.ExposureMode},41987:{name:"WhiteBalance",description:Ce.WhiteBalance},41988:{name:"DigitalZoomRatio",description:e=>e[0]===0?"Digital zoom was not used":""+e[0]/e[1]},41989:{name:"FocalLengthIn35mmFilm",description:e=>e===0?"Unknown":e},41990:{name:"SceneCaptureType",description:Ce.SceneCaptureType},41991:{name:"GainControl",description:e=>e===0?"None":e===1?"Low gain up":e===2?"High gain up":e===3?"Low gain down":e===4?"High gain down":"Unknown"},41992:{name:"Contrast",description:Ce.Contrast},41993:{name:"Saturation",description:Ce.Saturation},41994:{name:"Sharpness",description:Ce.Sharpness},41995:{name:"DeviceSettingDescription",description:()=>"[Raw device settings table data]"},41996:{name:"SubjectDistanceRange",description:e=>e===1?"Macro":e===2?"Close view":e===3?"Distant view":"Unknown"},42016:"ImageUniqueID",42032:"CameraOwnerName",42033:"BodySerialNumber",42034:{name:"LensSpecification",description:e=>{const t=parseFloat((e[0][0]/e[0][1]).toFixed(5)),i=parseFloat((e[1][0]/e[1][1]).toFixed(5)),s=`${t}-${i} mm`;if(e[3][1]===0)return`${s} f/?`;const u=1/(e[2][1]/e[2][1]/(e[3][0]/e[3][1]));return`${s} f/${parseFloat(u.toFixed(5))}`}},42035:"LensMake",42036:"LensModel",42037:"LensSerialNumber",42080:{name:"CompositeImage",description:e=>({1:"Not a Composite Image",2:"General Composite Image",3:"Composite Image Captured While Shooting"})[e]||"Unknown"},42081:"SourceImageNumberOfCompositeImage",42082:"SourceExposureTimesOfCompositeImage",42240:"Gamma",59932:"Padding",59933:"OffsetSchema",65e3:"OwnerName",65001:"SerialNumber",65002:"Lens",65100:"RawFile",65101:"Converter",65102:"WhiteBalance",65105:"Exposure",65106:"Shadows",65107:"Brightness",65108:"Contrast",65109:"Saturation",65110:"Sharpness",65111:"Smoothness",65112:"MoireFilter"},Gy={0:{name:"GPSVersionID",description:e=>e[0]===2&&e[1]===2&&e[2]===0&&e[3]===0?"Version 2.2":"Unknown"},1:{name:"GPSLatitudeRef",description:e=>{const t=e.join("");return t==="N"?"North latitude":t==="S"?"South latitude":"Unknown"}},2:{name:"GPSLatitude",description:Vi},3:{name:"GPSLongitudeRef",description:e=>{const t=e.join("");return t==="E"?"East longitude":t==="W"?"West longitude":"Unknown"}},4:{name:"GPSLongitude",description:Vi},5:{name:"GPSAltitudeRef",description:e=>e===0?"Sea level":e===1?"Sea level reference (negative value)":"Unknown"},6:{name:"GPSAltitude",description:e=>e[0]/e[1]+" m"},7:{name:"GPSTimeStamp",description:e=>e.map(([t,i])=>{const s=t/i;return/^\d(\.|$)/.test(`${s}`)?`0${s}`:s}).join(":")},8:"GPSSatellites",9:{name:"GPSStatus",description:e=>{const t=e.join("");return t==="A"?"Measurement in progress":t==="V"?"Measurement Interoperability":"Unknown"}},10:{name:"GPSMeasureMode",description:e=>{const t=e.join("");return t==="2"?"2-dimensional measurement":t==="3"?"3-dimensional measurement":"Unknown"}},11:"GPSDOP",12:{name:"GPSSpeedRef",description:e=>{const t=e.join("");return t==="K"?"Kilometers per hour":t==="M"?"Miles per hour":t==="N"?"Knots":"Unknown"}},13:"GPSSpeed",14:{name:"GPSTrackRef",description:e=>{const t=e.join("");return t==="T"?"True direction":t==="M"?"Magnetic direction":"Unknown"}},15:"GPSTrack",16:{name:"GPSImgDirectionRef",description:e=>{const t=e.join("");return t==="T"?"True direction":t==="M"?"Magnetic direction":"Unknown"}},17:"GPSImgDirection",18:"GPSMapDatum",19:{name:"GPSDestLatitudeRef",description:e=>{const t=e.join("");return t==="N"?"North latitude":t==="S"?"South latitude":"Unknown"}},20:{name:"GPSDestLatitude",description:e=>e[0][0]/e[0][1]+e[1][0]/e[1][1]/60+e[2][0]/e[2][1]/3600},21:{name:"GPSDestLongitudeRef",description:e=>{const t=e.join("");return t==="E"?"East longitude":t==="W"?"West longitude":"Unknown"}},22:{name:"GPSDestLongitude",description:e=>e[0][0]/e[0][1]+e[1][0]/e[1][1]/60+e[2][0]/e[2][1]/3600},23:{name:"GPSDestBearingRef",description:e=>{const t=e.join("");return t==="T"?"True direction":t==="M"?"Magnetic direction":"Unknown"}},24:"GPSDestBearing",25:{name:"GPSDestDistanceRef",description:e=>{const t=e.join("");return t==="K"?"Kilometers":t==="M"?"Miles":t==="N"?"Knots":"Unknown"}},26:"GPSDestDistance",27:{name:"GPSProcessingMethod",description:Eo},28:{name:"GPSAreaInformation",description:Eo},29:"GPSDateStamp",30:{name:"GPSDifferential",description:e=>e===0?"Measurement without differential correction":e===1?"Differential correction applied":"Unknown"},31:"GPSHPositioningError"},By={1:"InteroperabilityIndex",2:{name:"InteroperabilityVersion",description:e=>$e(e)},4096:"RelatedImageFileFormat",4097:"RelatedImageWidth",4098:"RelatedImageHeight"},Uy={45056:{name:"MPFVersion",description:e=>$e(e)},45057:"NumberOfImages",45058:"MPEntry",45059:"ImageUIDList",45060:"TotalFrames"},Yy={4:{name:"ShotInfo",description:e=>e}},wl=Re({},sf,Dy),Jo="0th",of="1st",af="exif",uf="gps",lf="interoperability",cf="mpf",ff="canon",xn={[Jo]:wl,[of]:sf,[af]:wl,[uf]:Gy,[lf]:By,[cf]:Uy,[ff]:Yy},hf={1:1,2:1,3:2,4:4,5:8,7:1,9:4,10:8,13:4},bo={BYTE:1,ASCII:2,SHORT:3,LONG:4,RATIONAL:5,UNDEFINED:7,SLONG:9,SRATIONAL:10,IFD:13},fe={getAsciiValue:Xy,getByteAt:gf,getAsciiAt:zy,getShortAt:qy,getLongAt:ts,getRationalAt:Hy,getUndefinedAt:Zy,getSlongAt:Co,getSrationalAt:Wy,getIfdPointerAt:jy,typeSizes:hf,tagTypes:bo,getTypeSize:Jy};function Xy(e){return e.map(t=>String.fromCharCode(t))}function gf(e,t){return e.getUint8(t)}function zy(e,t){return e.getUint8(t)}function qy(e,t,i){return e.getUint16(t,i===jn.LITTLE_ENDIAN)}function ts(e,t,i){return e.getUint32(t,i===jn.LITTLE_ENDIAN)}function Hy(e,t,i){return[ts(e,t,i),ts(e,t+4,i)]}function Zy(e,t){return gf(e,t)}function Co(e,t,i){return e.getInt32(t,i===jn.LITTLE_ENDIAN)}function Wy(e,t,i){return[Co(e,t,i),Co(e,t+4,i)]}function jy(e,t,i){return ts(e,t,i)}function Jy(e){if(bo[e]===void 0)throw new Error("No such type found.");return hf[bo[e]]}const Ky={1:fe.getByteAt,2:fe.getAsciiAt,3:fe.getShortAt,4:fe.getLongAt,5:fe.getRationalAt,7:fe.getUndefinedAt,9:fe.getSlongAt,10:fe.getSrationalAt,13:fe.getIfdPointerAt};function df(e,t,i){return t+fe.getLongAt(e,t+4,i)}function Jn(e,t,i,s,u,l){const h=fe.getTypeSize("SHORT"),f=12,m={},p=Qy(e,s,u);s+=h;for(let y=0;ye.byteLength);y++){const _=$y(e,t,i,s,u,l);_!==void 0&&(m[_.name]={id:_.id,value:_.value,description:_.description},_.name==="MakerNote"&&(m[_.name].__offset=_.__offset)),s+=f}if(sdecodeURIComponent(escape(t)))}catch{return e}}function bl(e){return e instanceof Array?e.join(", "):e}const Cl="Exif IFD Pointer",Ll="GPS Info IFD Pointer",Pl="Interoperability IFD Pointer",mf={read:rv};function rv(e,t,i){const s=jn.getByteOrder(e,t);let u=iv(e,t,s,i);return u=sv(u,e,t,s,i),u=ov(u,e,t,s,i),u=av(u,e,t,s,i),{tags:u,byteOrder:s}}function iv(e,t,i,s){return Jn(e,Jo,t,df(e,t,i),i,s)}function sv(e,t,i,s,u){return e[Cl]!==void 0?Re(e,Jn(t,af,i,i+e[Cl].value,s,u)):e}function ov(e,t,i,s,u){return e[Ll]!==void 0?Re(e,Jn(t,uf,i,i+e[Ll].value,s,u)):e}function av(e,t,i,s,u){return e[Pl]!==void 0?Re(e,Jn(t,lf,i,i+e[Pl].value,s,u)):e}const uv={read:lv},cr=16;function lv(e,t,i){const s=jn.getByteOrder(e,t),u=Jn(e,cf,t,df(e,t,s),s,i);return cv(e,t,u,s)}function cv(e,t,i,s){if(!i.MPEntry)return i;const u=[];for(let l=0;l>31&1,e>>30&1,e>>29&1],i=[];return t[0]&&i.push("Dependent Parent Image"),t[1]&&i.push("Dependent Child Image"),t[2]&&i.push("Representative Image"),{value:t,description:i.join(", ")||"None"}}function hv(e){const t=e>>24&7;return{value:t,description:t===0?"JPEG":"Unknown"}}function gv(e){const t=e&16777215;return{value:t,description:{196608:"Baseline MP Primary Image",65537:"Large Thumbnail (VGA equivalent)",65538:"Large Thumbnail (Full HD equivalent)",131073:"Multi-Frame Image (Panorama)",131074:"Multi-Frame Image (Disparity)",131075:"Multi-Frame Image (Multi-Angle)",0:"Undefined"}[t]||"Unknown"}}function dv(e,t,i,s){return mv(e)?0:Hr(t.value,e*cr+8,fe.getTypeSize("LONG"),i)+s}function mv(e){return e===0}const pv={read:yv};function yv(e,t){const i=vv(e,t),s=Iv(e,t,i);return{"Bits Per Sample":_v(e,t,i),"Image Height":xv(e,t,i),"Image Width":Ev(e,t,i),"Color Components":s,Subsampling:s&&Sv(e,t,s.value,i)}}function vv(e,t){return fe.getShortAt(e,t)}function _v(e,t,i){if(2+1>i)return;const l=fe.getByteAt(e,t+2);return{value:l,description:""+l}}function xv(e,t,i){if(3+2>i)return;const l=fe.getShortAt(e,t+3);return{value:l,description:`${l}px`}}function Ev(e,t,i){if(5+2>i)return;const l=fe.getShortAt(e,t+5);return{value:l,description:`${l}px`}}function Iv(e,t,i){if(7+1>i)return;const l=fe.getByteAt(e,t+7);return{value:l,description:""+l}}function Sv(e,t,i,s){if(8+3*i>s)return;const h=[];for(let f=0;f1?kv(h)+Nv(h):""}}function kv(e){const t={1:"Y",2:"Cb",3:"Cr",4:"I",5:"Q"};return e.map(i=>t[i[0]]).join("")}function Nv(e){const t={17:"4:4:4 (1 1)",18:"4:4:0 (1 2)",20:"4:4:1 (1 4)",33:"4:2:2 (2 1)",34:"4:2:0 (2 2)",36:"4:2:1 (2 4)",65:"4:1:1 (4 1)",66:"4:1:0 (4 2)"};return e.length===0||e[0][1]===void 0||t[e[0][1]]===void 0?"":t[e[0][1]]}const wv={read:Tv};function Tv(e,t){const i=bv(e,t),s=Mv(e,t,i),u=Rv(e,t,i),l={"JFIF Version":Cv(e,t,i),"Resolution Unit":Lv(e,t,i),XResolution:Av(e,t,i),YResolution:Ov(e,t,i),"JFIF Thumbnail Width":s,"JFIF Thumbnail Height":u};if(s!==void 0&&u!==void 0){const h=Fv(e,t,3*s.value*u.value,i);h&&(l["JFIF Thumbnail"]=h)}for(const h in l)l[h]===void 0&&delete l[h];return l}function bv(e,t){return fe.getShortAt(e,t)}function Cv(e,t,i){if(7+2>i)return;const l=fe.getByteAt(e,t+7),h=fe.getByteAt(e,t+7+1);return{value:l*256+h,description:l+"."+h}}function Lv(e,t,i){if(9+1>i)return;const l=fe.getByteAt(e,t+9);return{value:l,description:Pv(l)}}function Pv(e){return e===0?"None":e===1?"inches":e===2?"cm":"Unknown"}function Av(e,t,i){if(10+2>i)return;const l=fe.getShortAt(e,t+10);return{value:l,description:""+l}}function Ov(e,t,i){if(12+2>i)return;const l=fe.getShortAt(e,t+12);return{value:l,description:""+l}}function Mv(e,t,i){if(14+1>i)return;const l=fe.getByteAt(e,t+14);return{value:l,description:`${l}px`}}function Rv(e,t,i){if(15+1>i)return;const l=fe.getByteAt(e,t+15);return{value:l,description:`${l}px`}}function Fv(e,t,i,s){return i===0||16+i>s?void 0:{value:e.buffer.slice(t+16,t+16+i),description:""}}const En={iptc:{256:{name:"Model Version",description:e=>((e[0]((e[0]((e[0]((e[0]((e[0]((e[0]$e(e)==="01"?"Additional Language":"Unknown"},522:"Urgency",524:{name:"Subject Reference",repeatable:!0,description:e=>{const t=$e(e).split(":");return t[2]+(t[3]?"/"+t[3]:"")+(t[4]?"/"+t[4]:"")}},527:"Category",532:{name:"Supplemental Category",repeatable:!0},534:"Fixture Identifier",537:{name:"Keywords",repeatable:!0},538:{name:"Content Location Code",repeatable:!0},539:{name:"Content Location Name",repeatable:!0},542:"Release Date",547:"Release Time",549:"Expiration Date",550:"Expiration Time",552:"Special Instructions",554:{name:"Action Advised",description:e=>{const t=$e(e);return t==="01"?"Object Kill":t==="02"?"Object Replace":t==="03"?"Object Append":t==="04"?"Object Reference":"Unknown"}},557:{name:"Reference Service",repeatable:!0},559:{name:"Reference Date",repeatable:!0},562:{name:"Reference Number",repeatable:!0},567:{name:"Date Created",description:js},572:{name:"Time Created",description:Js},574:{name:"Digital Creation Date",description:js},575:{name:"Digital Creation Time",description:Js},577:"Originating Program",582:"Program Version",587:{name:"Object Cycle",description:e=>{const t=$e(e);return t==="a"?"morning":t==="p"?"evening":t==="b"?"both":"Unknown"}},592:{name:"By-line",repeatable:!0},597:{name:"By-line Title",repeatable:!0},602:"City",604:"Sub-location",607:"Province/State",612:"Country/Primary Location Code",613:"Country/Primary Location Name",615:"Original Transmission Reference",617:"Headline",622:"Credit",627:"Source",628:"Copyright Notice",630:{name:"Contact",repeatable:!0},632:"Caption/Abstract",634:{name:"Writer/Editor",repeatable:!0},637:{name:"Rasterized Caption",description:e=>e},642:"Image Type",643:{name:"Image Orientation",description:e=>{const t=$e(e);return t==="P"?"Portrait":t==="L"?"Landscape":t==="S"?"Square":"Unknown"}},647:"Language Identifier",662:{name:"Audio Type",description:e=>{const t=$e(e),i=t.charAt(0),s=t.charAt(1);let u="";return i==="1"?u+="Mono":i==="2"&&(u+="Stereo"),s==="A"?u+=", actuality":s==="C"?u+=", question and answer session":s==="M"?u+=", music, transmitted by itself":s==="Q"?u+=", response to a question":s==="R"?u+=", raw sound":s==="S"?u+=", scener":s==="V"?u+=", voicer":s==="W"&&(u+=", wrap"),u!==""?u:t}},663:{name:"Audio Sampling Rate",description:e=>parseInt($e(e),10)+" Hz"},664:{name:"Audio Sampling Resolution",description:e=>{const t=parseInt($e(e),10);return t+(t===1?" bit":" bits")}},665:{name:"Audio Duration",description:e=>{const t=$e(e);return t.length>=6?t.substr(0,2)+":"+t.substr(2,2)+":"+t.substr(4,2):t}},666:"Audio Outcue",698:"Short Document ID",699:"Unique Document ID",700:"Owner ID",712:{name:e=>e.length===2?"ObjectData Preview File Format":"Record 2 destination",description:e=>{if(e.length===2){const t=(e[0]{const i={"00":{"00":"1"},"01":{"01":"1","02":"2","03":"3","04":"4"},"02":{"04":"4"},"03":{"01":"5.0","02":"6.0"},"04":{"01":"1.40"},"05":{"01":"2"},"06":{"01":"1"},11:{"01":"1.02"},20:{"01":"3.1","02":"4.0","03":"5.0","04":"5.5"},21:{"02":"2.0"}},s=$e(e);if(t["ObjectData Preview File Format"]){const u=$e(t["ObjectData Preview File Format"].value);if(i[u]&&i[u][s])return i[u][s]}return s}},714:"ObjectData Preview Data",1802:{name:"Size Mode",description:e=>e[0].toString()},1812:{name:"Max Subfile Size",description:e=>{let t=0;for(let i=0;i{let t=0;for(let i=0;i{let t=0;for(let i=0;i=8?t.substr(0,4)+"-"+t.substr(4,2)+"-"+t.substr(6,2):t}function Js(e){const t=$e(e);let i=t;return t.length>=6&&(i=t.substr(0,2)+":"+t.substr(2,2)+":"+t.substr(4,2),t.length===11&&(i+=t.substr(6,1)+t.substr(7,2)+":"+t.substr(9,2))),i}function Al(e){const t=$e(e);return t==="\x1B%G"?"UTF-8":t==="\x1B%5"?"Windows-1252":t==="\x1B%/G"?"UTF-8 Level 1":t==="\x1B%/H"?"UTF-8 Level 2":t==="\x1B%/I"?"UTF-8 Level 3":t==="\x1B/A"?"ISO-8859-1":t==="\x1B/B"?"ISO-8859-2":t==="\x1B/C"?"ISO-8859-3":t==="\x1B/D"?"ISO-8859-4":t==="\x1B/@"?"ISO-8859-5":t==="\x1B/G"?"ISO-8859-6":t==="\x1B/F"?"ISO-8859-7":t==="\x1B/H"?"ISO-8859-8":"Unknown"}const Dv={get:Gv};function Gv(){if(typeof TextDecoderString.fromCharCode(u)).join("");return Yv(s)}function Yv(e){try{return decodeURIComponent(escape(e))}catch{return e}}const Xv=943868237,Zr=4,Di=2,zv=1,qv=2,yf=4,Hv=Zr+Di+qv+yf,Zv=1028,vf=5,Lo={read:Wv};function Wv(e,t,i){try{if(Array.isArray(e))return Ol(new DataView(Uint8Array.from(e).buffer),{size:e.length},0,i);const{naaBlock:s,dataOffset:u}=jv(e,t);return Ol(e,s,u,i)}catch{return{}}}function jv(e,t){for(;t+HvCe.ResolutionUnit(parseInt(e,10)),"tiff:XResolution":e=>sr(Ce.XResolution,e),"tiff:YResolution":e=>sr(Ce.YResolution,e),"exif:ApertureValue":e=>sr(Ce.ApertureValue,e),"exif:GPSLatitude":Ml,"exif:GPSLongitude":Ml,"exif:FNumber":e=>sr(Ce.FNumber,e),"exif:FocalLength":e=>sr(Ce.FocalLength,e),"exif:FocalPlaneResolutionUnit":e=>Ce.FocalPlaneResolutionUnit(parseInt(e,10)),"exif:ColorSpace":e=>Ce.ColorSpace(l1(e)),"exif:ComponentsConfiguration"(e,t){if(/^\d, \d, \d, \d$/.test(t)){const i=t.split(", ").map(s=>s.charCodeAt(0));return Ce.ComponentsConfiguration(i)}return t},"exif:Contrast":e=>Ce.Contrast(parseInt(e,10)),"exif:CustomRendered":e=>Ce.CustomRendered(parseInt(e,10)),"exif:ExposureMode":e=>Ce.ExposureMode(parseInt(e,10)),"exif:ExposureProgram":e=>Ce.ExposureProgram(parseInt(e,10)),"exif:ExposureTime"(e){return _f(e)?Ce.ExposureTime(e.split("/").map(t=>parseInt(t,10))):e},"exif:MeteringMode":e=>Ce.MeteringMode(parseInt(e,10)),"exif:Saturation":e=>Ce.Saturation(parseInt(e,10)),"exif:SceneCaptureType":e=>Ce.SceneCaptureType(parseInt(e,10)),"exif:Sharpness":e=>Ce.Sharpness(parseInt(e,10)),"exif:ShutterSpeedValue":e=>sr(Ce.ShutterSpeedValue,e),"exif:WhiteBalance":e=>Ce.WhiteBalance(parseInt(e,10))};function sr(e,t){return _f(t)?e(t.split("/")):t}function l1(e){return e.substring(0,2)==="0x"?parseInt(e.substring(2),16):parseInt(e,10)}function _f(e){return/^-?\d+\/-?\d+$/.test(e)}function Ml(e){const[t,i]=e.split(",");if(t!==void 0&&i!==void 0){const s=parseFloat(t),u=parseFloat(i),l=i.charAt(i.length-1);if(!Number.isNaN(s)&&!Number.isNaN(u))return""+(s+u/60)+l}return e}const c1={get:f1};function f1(){if(typeof DOMParser1&&i.push(Po(e,t.slice(1))),i}function Po(e,t){const i=t.reduce((l,h)=>l+h.length,0),s=new Uint8Array(i);let u=0;for(let l=0;l).+$/,"$1")}function xf(e){for(let t=0;t{if(x1(i)){const s=E1(i);t[i.nodeName]!==void 0?(Array.isArray(t[i.nodeName])||(t[i.nodeName]=[t[i.nodeName]]),t[i.nodeName].push(s)):t[i.nodeName]=s}}),t}function x1(e){return e.nodeName&&e.nodeName!=="#text"}function E1(e){return{attributes:I1(e),value:Ef(e)}}function I1(e){const t={};for(let i=0;i{Re(t,Ko(u.attributes)),typeof u.value=="object"&&Re(t,Sf(u.value))})}return t}function Ko(e){const t={};for(const i in e)try{S1(i)&&(t[us(i)]={value:e[i],attributes:{},description:cn(e[i],i)})}catch{}return t}function S1(e){return e!=="rdf:parseType"&&!as(e)}function as(e){return e.split(":")[0]==="xmlns"}function us(e){return/^MicrosoftPhoto(_\d+_)?:Rating$/i.test(e)?"RatingPercent":e.split(":")[1]}function cn(e,t=void 0){if(Array.isArray(e)){const i=k1(e);return t&&typeof Ti[t]=="function"?Ti[t](e,i):i}if(typeof e=="object")return N1(e);try{return t&&typeof Ti[t]=="function"?Ti[t](e):decodeURIComponent(escape(e))}catch{return e}}function k1(e){return e.map(t=>t.value!==void 0?cn(t.value):cn(t)).join(", ")}function N1(e){const t=[];for(const i in e)t.push(`${w1(i)}: ${cn(e[i].value)}`);return t.join("; ")}function w1(e){return e==="CiAdrCity"?"CreatorCity":e==="CiAdrCtry"?"CreatorCountry":e==="CiAdrExtadr"?"CreatorAddress":e==="CiAdrPcode"?"CreatorPostalCode":e==="CiAdrRegion"?"CreatorRegion":e==="CiEmailWork"?"CreatorWorkEmail":e==="CiTelWork"?"CreatorWorkPhone":e==="CiUrlWork"?"CreatorWorkUrl":e}function Sf(e){const t={};for(const i in e)try{as(i)||(t[us(i)]=T1(e[i],i))}catch{}return t}function T1(e,t){return C1(e)?L1(e,t):b1(e)?{value:"",attributes:{},description:""}:kf(e)?Nf(e,t):wf(e)?Tf(e,t):bf(e)?Cf(e,t):O1(e)?M1(e,t):Qo(e,t)}function b1(e){return e.attributes["rdf:parseType"]==="Resource"&&typeof e.value=="string"&&e.value.trim()===""}function C1(e){return Array.isArray(e)}function L1(e,t){return Qo(e[e.length-1],t)}function kf(e){return e.attributes["rdf:parseType"]==="Resource"&&e.value["rdf:value"]!==void 0||e.value["rdf:Description"]!==void 0&&e.value["rdf:Description"].value["rdf:value"]!==void 0}function Nf(e,t){const i=Qr(e);e.value["rdf:Description"]!==void 0&&(e=e.value["rdf:Description"]),Re(i,Qr(e),P1(e));const s=A1(e);return{value:s,attributes:i,description:cn(s,t)}}function Qr(e){const t={};for(const i in e.attributes)i!=="rdf:parseType"&&i!=="rdf:resource"&&!as(i)&&(t[us(i)]=e.attributes[i]);return t}function P1(e){const t={};for(const i in e.value)i!=="rdf:value"&&!as(i)&&(t[us(i)]=e.value[i].value);return t}function A1(e){return Pf(e.value["rdf:value"])||e.value["rdf:value"].value}function wf(e){return e.attributes["rdf:parseType"]==="Resource"||e.value["rdf:Description"]!==void 0&&e.value["rdf:Description"].value["rdf:value"]===void 0}function Tf(e,t){const i={value:{},attributes:{}};return e.value["rdf:Description"]!==void 0&&(Re(i.value,Ko(e.value["rdf:Description"].attributes)),Re(i.attributes,Qr(e)),e=e.value["rdf:Description"]),Re(i.value,Sf(e.value)),i.description=cn(i.value,t),i}function bf(e){return Object.keys(e.value).length===0&&e.attributes["xml:lang"]===void 0&&e.attributes["rdf:resource"]===void 0}function Cf(e,t){const i=Ko(e.attributes);return{value:i,attributes:{},description:cn(i,t)}}function O1(e){return Lf(e.value)!==void 0}function Lf(e){return e["rdf:Bag"]||e["rdf:Seq"]||e["rdf:Alt"]}function M1(e,t){let i=Lf(e.value).value["rdf:li"];const s=Qr(e),u=[];return i===void 0?i=[]:Array.isArray(i)||(i=[i]),i.forEach(l=>{u.push(R1(l))}),{value:u,attributes:s,description:cn(u,t)}}function R1(e){return kf(e)?Nf(e):wf(e)?Tf(e).value:bf(e)?Cf(e).value:Qo(e)}function Qo(e,t){const i=Pf(e)||If(e.value);return{value:i,attributes:Qr(e),description:cn(i,t)}}function Pf(e){return e.attributes&&e.attributes["rdf:resource"]}const on={CLOSED_SUBPATH_LENGTH:0,CLOSED_SUBPATH_BEZIER_LINKED:1,CLOSED_SUBPATH_BEZIER_UNLINKED:2,OPEN_SUBPATH_LENGTH:3,OPEN_SUBPATH_BEZIER_LINKED:4,OPEN_SUBPATH_BEZIER_UNLINKED:5,FILL_RULE:6,CLIPBOARD:7,INITIAL_FILL_RULE:8},Af=24,Ks={2e3:{name:"PathInformation",description:F1},2999:{name:"ClippingPathName",description(e){const[,t]=Xc(e,0);return t}}};function F1(e){const i={},s=[];for(let u=0;u[fe.getShortAt(e,t)]},[on.CLOSED_SUBPATH_BEZIER_LINKED]:{description:"Closed subpath Bezier knot, linked",path:Ci},[on.CLOSED_SUBPATH_BEZIER_UNLINKED]:{description:"Closed subpath Bezier knot, unlinked",path:Ci},[on.OPEN_SUBPATH_LENGTH]:{description:"Open subpath length",path:(e,t)=>[fe.getShortAt(e,t)]},[on.OPEN_SUBPATH_BEZIER_LINKED]:{description:"Open subpath Bezier knot, linked",path:Ci},[on.OPEN_SUBPATH_BEZIER_UNLINKED]:{description:"Open subpath Bezier knot, unlinked",path:Ci},[on.FILL_RULE]:{description:"Path fill rule",path:()=>[]},[on.INITIAL_FILL_RULE]:{description:"Initial fill rule",path:(e,t)=>[fe.getShortAt(e,t)]},[on.CLIPBOARD]:{description:"Clipboard",path:G1}};function Ci(e,t){const s=[];for(let u=0;u>>31?-1:1,l=(s&2130706432)>>>32-i,h=s&parseInt(Hc("1",32-i),2);return u*H0(l.toString(2)+"."+q0(h.toString(2),32-i,"0"),2)}const B1={read:X1},Of="8BIM",U1=2,Y1=4,Fl=Of.length;function X1(e,t){const i=sl(new Uint8Array(e).buffer),s={};let u=0;for(;u"}s[f||Ks[h].name]=_}else t&&(s[`undefined-${h}`]=_)}u+=p+p%2}return s}function z1(e,t){const[i,s]=Xc(e,t);return{tagName:s,tagNameSize:1+i+(i%2===0?1:0)}}const Dl={desc:{name:"ICC Description"},cprt:{name:"ICC Copyright"},dmdd:{name:"ICC Device Model Description"},vued:{name:"ICC Viewing Conditions Description"},dmnd:{name:"ICC Device Manufacturer for Display"},tech:{name:"Technology"}},Gl={4:{name:"Preferred CMM type",value:(e,t)=>Le(e,t,4),description:e=>e!==null?$s(e):""},8:{name:"Profile Version",value:(e,t)=>e.getUint8(t).toString(10)+"."+(e.getUint8(t+1)>>4).toString(10)+"."+(e.getUint8(t+1)%16).toString(10)},12:{name:"Profile/Device class",value:(e,t)=>Le(e,t,4),description:e=>{switch(e.toLowerCase()){case"scnr":return"Input Device profile";case"mntr":return"Display Device profile";case"prtr":return"Output Device profile";case"link":return"DeviceLink profile";case"abst":return"Abstract profile";case"spac":return"ColorSpace profile";case"nmcl":return"NamedColor profile";case"cenc":return"ColorEncodingSpace profile";case"mid ":return"MultiplexIdentification profile";case"mlnk":return"MultiplexLink profile";case"mvis":return"MultiplexVisualization profile";default:return e}}},16:{name:"Color Space",value:(e,t)=>Le(e,t,4)},20:{name:"Connection Space",value:(e,t)=>Le(e,t,4)},24:{name:"ICC Profile Date",value:(e,t)=>q1(e,t).toISOString()},36:{name:"ICC Signature",value:(e,t)=>H1(e.buffer.slice(t,t+4))},40:{name:"Primary Platform",value:(e,t)=>Le(e,t,4),description:e=>$s(e)},48:{name:"Device Manufacturer",value:(e,t)=>Le(e,t,4),description:e=>$s(e)},52:{name:"Device Model Number",value:(e,t)=>Le(e,t,4)},64:{name:"Rendering Intent",value:(e,t)=>e.getUint32(t),description:e=>{switch(e){case 0:return"Perceptual";case 1:return"Relative Colorimetric";case 2:return"Saturation";case 3:return"Absolute Colorimetric";default:return e}}},80:{name:"Profile Creator",value:(e,t)=>Le(e,t,4)}};function q1(e,t){const i=e.getUint16(t),s=e.getUint16(t+2)-1,u=e.getUint16(t+4),l=e.getUint16(t+6),h=e.getUint16(t+8),f=e.getUint16(t+10);return new Date(Date.UTC(i,s,u,l,h,f))}function H1(e){return String.fromCharCode.apply(null,new Uint8Array(e))}function $s(e){switch(e.toLowerCase()){case"appl":return"Apple";case"adbe":return"Adobe";case"msft":return"Microsoft";case"sunw":return"Sun Microsystems";case"sgi":return"Silicon Graphics";case"tgnt":return"Taligent";default:return e}}const Bl={read:e_},Z1=84,W1=128,j1="acsp",J1="desc",K1="mluc",Q1="text",$1="sig ",V1=12;function e_(e,t,i){return i&&t[0].compressionMethod!==$i?t_(e,t):r_(e,t)}function t_(e,t){if(!n_(t[0].compressionMethod))return{};const i=new DataView(e.buffer.slice(t[0].offset,t[0].offset+t[0].length));return Wc(i,t[0].compressionMethod,"utf-8","dataview").then(Mf).catch(()=>({}))}function n_(e){return e===Zc}function r_(e,t){try{const i=t.reduce((h,f)=>h+f.length,0),s=new Uint8Array(i);let u=0;const l=i_(e);for(let h=1;hy.chunkNumber===h);if(!f)throw new Error(`ICC chunk ${h} not found`);const m=l.slice(f.offset,f.offset+f.length),p=new Uint8Array(m);s.set(p,u),u+=p.length}return Mf(new DataView(s.buffer))}catch{return{}}}function i_(e){return Array.isArray(e)?new DataView(Uint8Array.from(e).buffer).buffer:e.buffer}function s_(e){return e.lengtht.length)return s;const I=Le(e,y,4);if(I===J1){const T=e.getUint32(y+8);if(T>_)return s;const w=Li(t.slice(y+12,y+T+11));Gr(s,p,w)}else if(I===K1){const T=e.getUint32(y+8),w=e.getUint32(y+12);let z=y+16;const Y=[];for(let Z=0;Ze.byteLength)return;const u=fe.getLongAt(e,t);return{value:u,description:`${u}px`}}function d_(e,t){if(t+4+4>e.byteLength)return;const u=fe.getLongAt(e,t+4);return{value:u,description:`${u}px`}}function m_(e,t){if(t+8+1>e.byteLength)return;const u=fe.getByteAt(e,t+8);return{value:u,description:`${u}`}}function p_(e,t){const u={0:"Grayscale",2:"RGB",3:"Palette",4:"Grayscale with Alpha",6:"RGB with Alpha"};if(t+9+1>e.byteLength)return;const l=fe.getByteAt(e,t+9);return{value:l,description:u[l]||"Unknown"}}function y_(e,t){if(t+10+1>e.byteLength)return;const u=fe.getByteAt(e,t+10);return{value:u,description:u===0?"Deflate/Inflate":"Unknown"}}function v_(e,t){if(t+11+1>e.byteLength)return;const u=fe.getByteAt(e,t+11);return{value:u,description:u===0?"Adaptive":"Unknown"}}function __(e,t){const u={0:"Noninterlaced",1:"Adam7 Interlace"};if(t+12+1>e.byteLength)return;const l=fe.getByteAt(e,t+12);return{value:l,description:u[l]||"Unknown"}}const x_={read:N_},Ao="STATE_KEYWORD",Oo="STATE_COMPRESSION",Mo="STATE_LANG",E_="STATE_TRANSLATED_KEYWORD",Ro="STATE_TEXT",I_=1,S_=1,k_=6;function N_(e,t,i,s){const u={},l=[];for(let h=0;h{try{if(ol.USE_EXIF&&Yl(_,I))return{__exif:mf.read(zl(I),k_,s).tags};if(ol.USE_IPTC&&Xl(_,I))return{__iptc:Lo.read(zl(I),0,s)};if(_&&!Yl(_,I)&&!Xl(_,I))return{[_]:{value:I,description:T}}}catch{}return{}}));else{const{name:_,value:I,description:T}=y;_&&(u[_]={value:I,description:T})}}return{readTags:u,readTagsPromise:l.length>0?Promise.all(l):void 0}}function w_(e,t,i,s,u){const l=[],h=[];let f,m=Ao,p=$i;for(let _=0;_Vs(_,s,h,l)).catch(()=>Vs("".split(""),s,h,l)):Vs(y,s,h,l)}function T_({type:e,dataView:t,offset:i}){if(e===Zn){if(t.getUint8(i)===S_)return t.getUint8(i+1)}else if(e===is)return t.getUint8(i);return $i}function Ul(e,t){return t===Ao&&[Zn,is].includes(e)?Oo:t===Oo?e===Zn?Mo:Ro:t===Mo?E_:Ro}function b_(e){return e===Wo||e===is?"latin1":"utf-8"}function Vs(e,t,i,s){const u=L_(e);return{name:C_(t,i,s),value:u,description:t===Zn?P_(e):u}}function C_(e,t,i){const s=vr(i);if(e===Wo||t.length===0)return s;const u=vr(t);return`${s} (${u})`}function L_(e){return e instanceof DataView?Le(e,0,e.byteLength):e}function P_(e){return pf.decode("UTF-8",e)}function Yl(e,t){return e.toLowerCase()==="raw profile type exif"&&t.substring(1,5)==="exif"}function Xl(e,t){return e.toLowerCase()==="raw profile type iptc"&&t.substring(1,5)==="iptc"}function zl(e){const t=e.match(/\n(exif|iptc)\n\s*\d+\n([\s\S]*)$/);return A_(t[2].replace(/\n/g,""))}function A_(e){const t=new DataView(new ArrayBuffer(e.length/2));for(let i=0;ie.byteLength)return;const s=Le(e,3,3);return{value:s,description:s}}function j_(e){if(6+2>e.byteLength)return;const s=e.getUint16(6,!0);return{value:s,description:`${s}px`}}function J_(e){if(8+2>e.byteLength)return;const s=e.getUint16(8,!0);return{value:s,description:`${s}px`}}function K_(e){if(10+1>e.byteLength)return;const u=(e.getUint8(10)&128)>>>7;return{value:u,description:u===1?"Yes":"No"}}function Q_(e){if(10+1>e.byteLength)return;const u=((e.getUint8(10)&112)>>>4)+1;return{value:u,description:`${u} ${u===1?"bit":"bits"}`}}function $_(e){if(10+1>e.byteLength)return;const u=(e.getUint8(10)&7)+1;return{value:u,description:`${u} ${u===1?"bit":"bits"}`}}const V_=[6,7,99],ex={get:tx};function tx(e,t,i){if(nx(t)){t.type="image/jpeg";const s=i+t.JPEGInterchangeFormat.value;t.image=e.buffer.slice(s,s+t.JPEGInterchangeFormatLength.value),zc(t,"base64",function(){return qc(this.image)})}return t}function nx(e){return e&&(e.Compression===void 0||V_.includes(e.Compression.value))&&e.JPEGInterchangeFormat&&e.JPEGInterchangeFormat.value&&e.JPEGInterchangeFormatLength&&e.JPEGInterchangeFormatLength.value}function Rf(e){this.name="MetadataMissingError",this.message=e||"No Exif data",this.stack=new Error().stack}Rf.prototype=new Error;const Ff={MetadataMissingError:Rf},rx={load:ix,loadView:Df,errors:Ff};function ix(e,t={}){return sx(e)?(t.async=!0,ox(e,t).then(i=>eo(i,t))):gx(e)?(t.async=!0,dx(e).then(i=>eo(i,t))):eo(e,t)}function sx(e){return typeof e=="string"}function ox(e,t){return/^\w+:\/\//.test(e)?typeof fetch=0&&(i.headers={range:`bytes=0-${t-1}`}),fetch(e,i).then(s=>s.arrayBuffer())}function ux(e,{length:t}={}){return new Promise((i,s)=>{const u={};Number.isInteger(t)&&t>=0&&(u.headers={range:`bytes=0-${t-1}`}),lx(e)(e,u,h=>{if(h.statusCode>=200&&h.statusCodef.push(Buffer.from(m))),h.on("error",m=>s(m)),h.on("end",()=>i(Buffer.concat(f)))}else s(`Could not fetch file: ${h.statusCode} ${h.statusMessage}`),h.resume()}).on("error",h=>s(h))})}function lx(e){return/^https:\/\//.test(e)?__non_webpack_require__("https").get:__non_webpack_require__("http").get}function cx(e){return/^data:[^;,]*(;base64)?,/.test(e)}function fx(e,{length:t}={}){return new Promise((i,s)=>{const u=hx();u.open(e,(l,h)=>{l?s(l):u.stat(e,(f,m)=>{if(f)s(f);else{const p=Math.min(m.size,t!==void 0?t:m.size),y=Buffer.alloc(p),_={buffer:y,length:p};u.read(h,_,I=>{I?s(I):u.close(h,T=>{T&&console.warn(`Could not close file ${e}:`,T),i(y)})})}})})})}function hx(){try{return __non_webpack_require__("fs")}catch{return}}function gx(e){return typeof window{const s=new FileReader;s.onload=u=>t(u.target.result),s.onerror=()=>i(s.error),s.readAsArrayBuffer(e)})}function eo(e,t){return mx(e)&&(e=new Uint8Array(e).buffer),Df(px(e),t)}function mx(e){try{return Buffer.isBuffer(e)}catch{return!1}}function px(e){try{return new DataView(e)}catch{return new Yc(e)}}function Df(e,{expanded:t=!1,async:i=!1,includeUnknown:s=!1}={expanded:!1,async:!1,includeUnknown:!1}){let u=!1,l={};const h=[],{fileType:f,fileDataOffset:m,jfifDataOffset:p,tiffHeaderOffset:y,iptcDataOffset:_,xmpChunks:I,iccChunks:T,mpfDataOffset:w,pngHeaderOffset:z,pngTextChunks:Y,pngChunkOffsets:Z,vp8xChunkOffset:S,gifHeaderOffset:b}=Ry.parseAppMarkers(e,i);if(yx(m)){u=!0;const G=pv.read(e,m);t?l.file=G:l=Re({},l,G)}if(vx(p)){u=!0;const G=wv.read(e,p);t?l.jfif=G:l=Re({},l,G)}if(_x(y)){u=!0;const{tags:G,byteOrder:E}=mf.read(e,y,s);if(G.Thumbnail&&(l.Thumbnail=G.Thumbnail,delete G.Thumbnail),t?(l.exif=G,xx(l)):l=Re({},l,G),G["IPTC-NAA"]&&!Hl(_)){const v=Lo.read(G["IPTC-NAA"].value,0,s);t?l.iptc=v:l=Re({},l,v)}if(G.ApplicationNotes&&!Zl(I)){const v=Rl.read(vr(G.ApplicationNotes.value));t?l.xmp=v:(delete v._raw,l=Re({},l,v))}if(G.ImageSourceData){const v=B1.read(G.PhotoshopSettings.value,s);t?l.photoshop=v:l=Re({},l,v)}if(G.ICC_Profile&&!Wl(T)){const v=Bl.read(G.ICC_Profile.value,[{offset:0,length:G.ICC_Profile.value.length,chunkNumber:1,chunksTotal:1}]);t?l.icc=v:l=Re({},l,v)}if(Ex(G)){const v=a_.read(e,y,G.MakerNote.__offset,E,s);t?l.makerNotes=v:l=Re({},l,v)}G.MakerNote&&delete G.MakerNote.__offset}if(Hl(_)){u=!0;const G=Lo.read(e,_,s);t?l.iptc=G:l=Re({},l,G)}if(Zl(I)){u=!0;const G=Rl.read(e,I);t?l.xmp=G:(delete G._raw,l=Re({},l,G))}if(Wl(T)){u=!0;const G=Bl.read(e,T,i);G instanceof Promise?h.push(G.then(U)):U(G)}if(Ix(w)){u=!0;const G=uv.read(e,w,s);t?l.mpf=G:l=Re({},l,G)}if(Sx(z)){u=!0;const G=f_.read(e,z);t?(l.png=l.png?Re({},l.png,G):G,l.pngFile=G):l=Re({},l,G)}if(kx(Y)){u=!0;const{readTags:G,readTagsPromise:E}=x_.read(e,Y,i,s);X(G),E&&h.push(E.then(v=>v.forEach(X)))}if(Nx(Z)){u=!0;const G=O_.read(e,Z);t?l.png=l.png?Re({},l.png,G):G:l=Re({},l,G)}if(wx(S)){u=!0;const G=B_.read(e,S);t?l.riff=l.riff?Re({},l.riff,G):G:l=Re({},l,G)}if(Tx(b)){u=!0;const G=H_.read(e,b);t?l.gif=l.gif?Re({},l.gif,G):G:l=Re({},l,G)}const R=ex.get(e,l.Thumbnail,y);if(R?(u=!0,l.Thumbnail=R):delete l.Thumbnail,f&&(t?(l.file||(l.file={}),l.file.FileType=f):l.FileType=f,u=!0),!u)throw new Ff.MetadataMissingError;if(i)return Promise.all(h).then(()=>l);return l;function U(G){t?l.icc=G:l=Re({},l,G)}function X(G){if(t){for(const E of["exif","iptc"]){const v=`__${E}`;G[v]&&(l[E]=l[E]?Re({},l.exif,G[v]):G[v],delete G[v])}l.png=l.png?Re({},l.png,G):G,l.pngText=l.pngText?Re({},l.png,G):G}else l=Re({},l,G.__exif?G.__exif:{},G.__iptc?G.__iptc:{},G),delete l.__exif,delete l.__iptc}}function yx(e){return e!==void 0}function vx(e){return e!==void 0}function _x(e){return e!==void 0}function xx(e){if(e.exif){if(e.exif.GPSLatitude&&e.exif.GPSLatitudeRef)try{e.gps=e.gps||{},e.gps.Latitude=Vi(e.exif.GPSLatitude.value),e.exif.GPSLatitudeRef.value.join("")==="S"&&(e.gps.Latitude=-e.gps.Latitude)}catch{}if(e.exif.GPSLongitude&&e.exif.GPSLongitudeRef)try{e.gps=e.gps||{},e.gps.Longitude=Vi(e.exif.GPSLongitude.value),e.exif.GPSLongitudeRef.value.join("")==="W"&&(e.gps.Longitude=-e.gps.Longitude)}catch{}if(e.exif.GPSAltitude&&e.exif.GPSAltitudeRef)try{e.gps=e.gps||{},e.gps.Altitude=e.exif.GPSAltitude.value[0]/e.exif.GPSAltitude.value[1],e.exif.GPSAltitudeRef.value===1&&(e.gps.Altitude=-e.gps.Altitude)}catch{}}}function Hl(e){return e!==void 0}function Zl(e){return Array.isArray(e)&&e.length>0}function Wl(e){return Array.isArray(e)&&e.length>0}function Ex(e){return e.Make&&e.Make.value&&Array.isArray(e.Make.value)&&e.Make.value[0]==="Canon"&&e.MakerNote&&e.MakerNote.__offset}function Ix(e){return e!==void 0}function Sx(e){return e!==void 0}function kx(e){return e!==void 0}function Nx(e){return e!==void 0}function wx(e){return e!==void 0}function Tx(e){return e!==void 0}var Bn={},en={},Gf={exports:{}},Bf={},Uf={exports:{}},Yf={};(function(e){function t(v,k,C,L,P,M,A){try{var B=v[M](A),F=B.value}catch(q){return void C(q)}B.done?k(F):Promise.resolve(F).then(L,P)}function i(v){return function(){var k=this,C=arguments;return new Promise(function(L,P){var M=v.apply(k,C);function A(F){t(M,L,P,A,B,"next",F)}function B(F){t(M,L,P,A,B,"throw",F)}A(void 0)})}}function s(v,k){return v(k={exports:{}},k.exports),k.exports}Object.defineProperty(e,"__esModule",{value:!0});var u=s(function(v){var k=function(C){var L=Object.prototype,P=L.hasOwnProperty,M=typeof Symbol=="function"?Symbol:{},A=M.iterator||"@@iterator",B=M.asyncIterator||"@@asyncIterator",F=M.toStringTag||"@@toStringTag";function q(ne,ie,re){return Object.defineProperty(ne,ie,{value:re,enumerable:!0,configurable:!0,writable:!0}),ne[ie]}try{q({},"")}catch{q=function(ie,re,Oe){return ie[re]=Oe}}function ee(ne,ie,re,Oe){var Ie=Object.create((ie&&ie.prototype instanceof J?ie:J).prototype),qe=new Te(Oe||[]);return Ie._invoke=function(pt,ke,Fe){var Qe="suspendedStart";return function(mn,ve){if(Qe==="executing")throw new Error("Generator is already running");if(Qe==="completed"){if(mn==="throw")throw ve;return{value:void 0,done:!0}}for(Fe.method=mn,Fe.arg=ve;;){var Rt=Fe.delegate;if(Rt){var Ae=le(Rt,Fe);if(Ae){if(Ae===se)continue;return Ae}}if(Fe.method==="next")Fe.sent=Fe._sent=Fe.arg;else if(Fe.method==="throw"){if(Qe==="suspendedStart")throw Qe="completed",Fe.arg;Fe.dispatchException(Fe.arg)}else Fe.method==="return"&&Fe.abrupt("return",Fe.arg);Qe="executing";var _e=W(pt,ke,Fe);if(_e.type==="normal"){if(Qe=Fe.done?"completed":"suspendedYield",_e.arg===se)continue;return{value:_e.arg,done:Fe.done}}_e.type==="throw"&&(Qe="completed",Fe.method="throw",Fe.arg=_e.arg)}}}(ne,re,qe),Ie}function W(ne,ie,re){try{return{type:"normal",arg:ne.call(ie,re)}}catch(Oe){return{type:"throw",arg:Oe}}}C.wrap=ee;var se={};function J(){}function $(){}function te(){}var ae={};q(ae,A,function(){return this});var oe=Object.getPrototypeOf,me=oe&&oe(oe(ye([])));me&&me!==L&&P.call(me,A)&&(ae=me);var H=te.prototype=J.prototype=Object.create(ae);function Pe(ne){["next","throw","return"].forEach(function(ie){q(ne,ie,function(re){return this._invoke(ie,re)})})}function ce(ne,ie){var re;this._invoke=function(Oe,Ie){function qe(){return new ie(function(pt,ke){(function Fe(Qe,mn,ve,Rt){var Ae=W(ne[Qe],ne,mn);if(Ae.type!=="throw"){var _e=Ae.arg,wn=_e.value;return wn&&typeof wn=="object"&&P.call(wn,"__await")?ie.resolve(wn.__await).then(function(rt){Fe("next",rt,ve,Rt)},function(rt){Fe("throw",rt,ve,Rt)}):ie.resolve(wn).then(function(rt){_e.value=rt,ve(_e)},function(rt){return Fe("throw",rt,ve,Rt)})}Rt(Ae.arg)})(Oe,Ie,pt,ke)})}return re=re?re.then(qe,qe):qe()}}function le(ne,ie){var re=ne.iterator[ie.method];if(re===void 0){if(ie.delegate=null,ie.method==="throw"){if(ne.iterator.return&&(ie.method="return",ie.arg=void 0,le(ne,ie),ie.method==="throw"))return se;ie.method="throw",ie.arg=new TypeError("The iterator does not provide a 'throw' method")}return se}var Oe=W(re,ne.iterator,ie.arg);if(Oe.type==="throw")return ie.method="throw",ie.arg=Oe.arg,ie.delegate=null,se;var Ie=Oe.arg;return Ie?Ie.done?(ie[ne.resultName]=Ie.value,ie.next=ne.nextLoc,ie.method!=="return"&&(ie.method="next",ie.arg=void 0),ie.delegate=null,se):Ie:(ie.method="throw",ie.arg=new TypeError("iterator result is not an object"),ie.delegate=null,se)}function D(ne){var ie={tryLoc:ne[0]};1 in ne&&(ie.catchLoc=ne[1]),2 in ne&&(ie.finallyLoc=ne[2],ie.afterLoc=ne[3]),this.tryEntries.push(ie)}function Se(ne){var ie=ne.completion||{};ie.type="normal",delete ie.arg,ne.completion=ie}function Te(ne){this.tryEntries=[{tryLoc:"root"}],ne.forEach(D,this),this.reset(!0)}function ye(ne){if(ne){var ie=ne[A];if(ie)return ie.call(ne);if(typeof ne.next=="function")return ne;if(!isNaN(ne.length)){var re=-1,Oe=function Ie(){for(;++re=0;--Oe){var Ie=this.tryEntries[Oe],qe=Ie.completion;if(Ie.tryLoc==="root")return re("end");if(Ie.tryLoc=0;--re){var Oe=this.tryEntries[re];if(Oe.tryLoc=0;--ie){var re=this.tryEntries[ie];if(re.finallyLoc===ne)return this.complete(re.completion,re.afterLoc),Se(re),se}},catch:function(ne){for(var ie=this.tryEntries.length-1;ie>=0;--ie){var re=this.tryEntries[ie];if(re.tryLoc===ne){var Oe=re.completion;if(Oe.type==="throw"){var Ie=Oe.arg;Se(re)}return Ie}}throw new Error("illegal catch attempt")},delegateYield:function(ne,ie,re){return this.delegate={iterator:ye(ne),resultName:ie,nextLoc:re},this.method==="next"&&(this.arg=void 0),se}},C}(v.exports);try{regeneratorRuntime=k}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=k:Function("r","regeneratorRuntime = r")(k)}});function l(v){return h.apply(this,arguments)}function h(){return(h=i(u.mark(function v(k){var C,L,P,M;return u.wrap(function(A){for(;;)switch(A.prev=A.next){case 0:return C=_(k),L=C.url,P=C.init,A.next=3,fetch(L,P);case 3:if((M=A.sent).ok){A.next=6;break}throw new Error(M.statusText);case 6:if(M.status!==204){A.next=8;break}return A.abrupt("return");case 8:return A.abrupt("return",M.json());case 9:case"end":return A.stop()}},v)}))).apply(this,arguments)}function f(v,k){var C=function(L){var P=Object.keys(L).filter(function(M){return M.toLowerCase()==="content-type"}).map(function(M){return L[M]})[0];return typeof P=="string"?P:"application/x-www-form-urlencoded"}(k).toLowerCase();return C.startsWith("application/x-www-form-urlencoded")?m(v):C.startsWith("application/json")?function(L){return JSON.stringify(L)}(v):String(v)}function m(v){var k=new URLSearchParams;for(var C in"f"in v||k.append("f","json"),v)k.append(C,v[C].toString());return k}var p,y={GET:function(v){var k=v.signal,C=v.headers,L=C===void 0?{}:C,P=v.params;return{url:v.url+"?"+m(P===void 0?{}:P).toString(),init:{signal:k,headers:L,method:"GET"}}},POST:function(v){var k=v.params,C=v.headers,L=C===void 0?{}:C;return{url:v.url,init:{signal:v.signal,headers:L,method:"POST",body:f(k===void 0?{}:k,L)}}},DELETE:function(v){var k=v.signal,C=v.params,L=v.headers,P=L===void 0?{}:L;return{url:v.url+"?"+m(C===void 0?{}:C).toString(),init:{signal:k,headers:P,method:"DELETE"}}}},_=function(v){var k,C=y[(k=v.method)!=null?k:"GET"];if(!C)throw new Error('Unsupported HTTP method "'+v.method+'"');return C(v)};function I(v){return!!v&&v.constructor===Object}function T(v){try{new URL(v)}catch{return!1}return!0}function w(v){return T(v)}function z(v){return!!Array.isArray(v)&&(v.length===4||v.length===6)}function Y(v){return v instanceof Date?v:new Date(v)}function Z(v){return typeof v=="string"||typeof v=="number"||v instanceof Date}function S(v){return!isNaN(Y(v).getTime())}function b(v){return Y(v).toISOString()}function R(v){if(Z(v))return S(v);if(v.start||v.end){if(v.start&&v.end)return S(v.start)&&S(v.end);if(v.start)return S(v.start);if(v.end)return S(v.end)}return!1}function U(v){return!(!Array.isArray(v)&&typeof v!="string")&&v.length!==0}function X(v){return Array.isArray(v)?v.length!==0&&v.every(function(P){return X(P)}):typeof v!="string"?(L=(k=v).order,typeof(C=k.property)=="string"&&C.length!==0&&(!L||L==="asc"||L==="desc")):v.length!==0;var k,C,L}function G(v){return(v.order==="desc"?"-":"")+v.property}function E(v){return!(!function(k){return typeof k=="string"&&k.length!==0}(v)&&!function(k){return!!I(k)&&Object.keys(k).length!==0}(v))}(p=e.EFilterLang||(e.EFilterLang={})).CQL2_TEXT="cql2-text",p.CQL2_JSON="cql2-json",p.CQL_TEXT="cql-text",p.CQL_JSON="cql-json",e.Service=function(){function v(P){this._baseUrl=this._parseBaseUrl(P.baseUrl)}var k,C,L=v.prototype;return L.getConformance=function(){var P=i(u.mark(function M(A){var B;return u.wrap(function(F){for(;;)switch(F.prev=F.next){case 0:return A===void 0&&(A={}),B=this.baseUrl+"/conformance",F.next=4,l({url:B,params:A.params});case 4:return F.abrupt("return",F.sent);case 6:case"end":return F.stop()}},M,this)}));return function(M){return P.apply(this,arguments)}}(),L._parseBaseUrl=function(P){return P.endsWith("/")&&(P=P.substring(0,P.lastIndexOf("/"))),P},k=v,(C=[{key:"baseUrl",get:function(){return this._baseUrl}}])&&function(P,M){for(var A=0;A=0;--ae){var oe=this.tryEntries[ae],me=oe.completion;if(oe.tryLoc==="root")return te("end");if(oe.tryLoc=0;--te){var ae=this.tryEntries[te];if(ae.tryLoc=0;--$){var te=this.tryEntries[$];if(te.finallyLoc===J)return this.complete(te.completion,te.afterLoc),q(te),X}},catch:function(J){for(var $=this.tryEntries.length-1;$>=0;--$){var te=this.tryEntries[$];if(te.tryLoc===J){var ae=te.completion;if(ae.type==="throw"){var oe=ae.arg;q(te)}return oe}}throw new Error("illegal catch attempt")},delegateYield:function(J,$,te){return this.delegate={iterator:W(J),resultName:$,nextLoc:te},this.method==="next"&&(this.arg=void 0),X}},I}(y.exports);try{regeneratorRuntime=_}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=_:Function("r","regeneratorRuntime = r")(_)}}),f=function(y){var _,I;function T(){return y.apply(this,arguments)||this}I=y,(_=T).prototype=Object.create(I.prototype),_.prototype.constructor=_,u(_,I);var w=T.prototype;return w.getCollections=function(){var z=s(h.mark(function Y(Z){var S;return h.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return Z===void 0&&(Z={}),S=this.baseUrl+"/collections",b.next=4,t.request({url:S,params:Z.params,signal:Z.signal});case 4:return b.abrupt("return",b.sent);case 6:case"end":return b.stop()}},Y,this)}));return function(Y){return z.apply(this,arguments)}}(),w.getCollection=function(){var z=s(h.mark(function Y(Z,S){var b;return h.wrap(function(R){for(;;)switch(R.prev=R.next){case 0:return S===void 0&&(S={}),b=this.baseUrl+"/collections/"+Z,R.next=4,t.request({url:b,params:S.params,signal:S.signal});case 4:return R.abrupt("return",R.sent);case 6:case"end":return R.stop()}},Y,this)}));return function(Y,Z){return z.apply(this,arguments)}}(),w.getQueryables=function(){var z=s(h.mark(function Y(Z,S){var b;return h.wrap(function(R){for(;;)switch(R.prev=R.next){case 0:return S===void 0&&(S={}),b=this.baseUrl+"/collections/"+Z+"/queryables",R.next=4,t.request({url:b,params:S.params,signal:S.signal});case 4:return R.abrupt("return",R.sent);case 6:case"end":return R.stop()}},Y,this)}));return function(Y,Z){return z.apply(this,arguments)}}(),w.getFeatures=function(){var z=s(h.mark(function Y(Z,S){var b,R;return h.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:return S===void 0&&(S={}),b=p(S),R=this.baseUrl+"/collections/"+Z+"/items",U.next=5,t.request({url:R,params:b,signal:S.signal});case 5:return U.abrupt("return",U.sent);case 7:case"end":return U.stop()}},Y,this)}));return function(Y,Z){return z.apply(this,arguments)}}(),w.searchFeatures=function(){var z=s(h.mark(function Y(Z,S){var b,R;return h.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:return S===void 0&&(S={}),b=p(S),R=this.baseUrl+"/collections/"+Z+"/search",U.next=5,t.request({url:R,params:b,signal:S.signal,method:"POST",headers:{"content-type":"application/json"}});case 5:return U.abrupt("return",U.sent);case 7:case"end":return U.stop()}},Y,this)}));return function(Y,Z){return z.apply(this,arguments)}}(),w.getFeature=function(){var z=s(h.mark(function Y(Z,S,b){var R,U;return h.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return b===void 0&&(b={}),R=m(b),U=this.baseUrl+"/collections/"+Z+"/items/"+S,X.next=5,t.request({url:U,params:R,signal:b.signal});case 5:return X.abrupt("return",X.sent);case 7:case"end":return X.stop()}},Y,this)}));return function(Y,Z,S){return z.apply(this,arguments)}}(),T}(t.Service);function m(y){var _=Object.assign({},y.params);return y.crs&&(_.crs=t.stringifyCrs(y.crs)),_}function p(y){var _=Object.assign({},y.params);if(y.crs&&(_.crs=t.stringifyBboxCrs(y.crs)),y.bbox&&(_.bbox=t.stringifyBbox(y.bbox),y.bboxCrs&&(_["bbox-crs"]=t.stringifyBboxCrs(y.bboxCrs))),y.datetime&&(_.datetime=t.stringifyDatetime(y.datetime)),y.properties&&(_.properties=t.stringifyProperties(y.properties)),y.sortby&&(_.sortby=t.stringifySortBy(y.sortby)),y.filter){var I=t.stringifyFilter({filter:y.filter,filterCrs:y.filterCrs,filterLang:y.filterLang}),T=I.filterCrs,w=I.filterLang;_.filter=I.filter,w&&(_["filter-lang"]=w),T&&(_["filter-crs"]=T)}return"limit"in y&&(_.limit=y.limit),_}Object.defineProperty(e,"FilterLang",{enumerable:!0,get:function(){return t.EFilterLang}}),e.FeatureService=f})(Bf);Gf.exports=Bf;var Cx=Gf.exports,Ut=un&&un.__awaiter||function(e,t,i,s){function u(l){return l instanceof i?l:new i(function(h){h(l)})}return new(i||(i=Promise))(function(l,h){function f(y){try{p(s.next(y))}catch(_){h(_)}}function m(y){try{p(s.throw(y))}catch(_){h(_)}}function p(y){y.done?l(y.value):u(y.value).then(f,m)}p((s=s.apply(e,t||[])).next())})},Xn=un&&un.__await||function(e){return this instanceof Xn?(this.v=e,this):new Xn(e)},Lx=un&&un.__asyncGenerator||function(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=i.apply(e,t||[]),u,l=[];return u=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),f("next"),f("throw"),f("return",h),u[Symbol.asyncIterator]=function(){return this},u;function h(T){return function(w){return Promise.resolve(w).then(T,_)}}function f(T,w){s[T]&&(u[T]=function(z){return new Promise(function(Y,Z){l.push([T,z,Y,Z])>1||m(T,z)})},w&&(u[T]=w(u[T])))}function m(T,w){try{p(s[T](w))}catch(z){I(l[0][3],z)}}function p(T){T.value instanceof Xn?Promise.resolve(T.value.v).then(y,_):I(l[0][2],T)}function y(T){m("next",T)}function _(T){m("throw",T)}function I(T,w){T(w),l.shift(),l.length&&m(l[0][0],l[0][1])}};Object.defineProperty(en,"__esModule",{value:!0});en.AuthorizedPanoramax=en.PanoramaxXYZ=en.Panoramax=en.REPORT_REASONS=void 0;const Px=Cx;en.REPORT_REASONS=["blur_missing","blur_excess","inappropriate","privacy","picture_low_quality","mislocated","copyright","other"];class Yt{constructor(t="https://panoramax.openstreetmap.fr/",i=1e4){t.endsWith("/")||(t+="/"),t.endsWith("api/")||(t+="api/"),this.host=t,this.timeoutAfterMs=i,new URL(t)}static isId(t){return t.match(Yt.idFormat)!==null}fetchJson(t,i){return Ut(this,void 0,void 0,function*(){const u=yield(yield this.fetch(t,i)).text();return JSON.parse(u)})}fetch(t,i){return Ut(this,void 0,void 0,function*(){var s;i??(i={}),(s=i.signal)!==null&&s!==void 0||(i.signal=AbortSignal.timeout(this.timeoutAfterMs)),t.startsWith("/")&&(t=this.host+t.slice(1));const u=yield fetch(t,i);if(!u.ok)throw new Error(u.status+" "+u.statusText+": "+(yield u.text()));return u})}sequences(){return Lx(this,arguments,function*(){var i,s;const u=new Px.FeatureService({baseUrl:this.host}),l=yield Xn(u.getCollections());for(const f of l.collections)yield yield Xn(f);let h=l.links.find(f=>f.rel==="next");for(;h;){const f=yield Xn(this.fetchJson(h.href));for(const m of(i=f==null?void 0:f.collections)!==null&&i!==void 0?i:[])yield yield Xn(m);h=(s=f==null?void 0:f.links)===null||s===void 0?void 0:s.find(m=>m.rel==="next")}})}url(...t){return this.host+t.join("/")+"/"}generateToken(t){return Ut(this,void 0,void 0,function*(){return this.fetchJson(this.url("auth","tokens","generate")+"?description="+encodeURIComponent(t),{method:"POST"})})}imageInfo(t,i){return Ut(this,void 0,void 0,function*(){var s;if(!Yt.isId(t))throw"Invalid imageId: "+t;if(i&&!Yt.isId(i))throw"Invalid sequenceId: "+i;let u;i?u=yield this.fetchJson(this.url("collections",i,"items",t)):u=(s=yield this.search({ids:[t]}))===null||s===void 0?void 0:s[0];const l=u.assets;return u.assets.sd=this.makeAbsolute(l.sd),u.assets.hd=this.makeAbsolute(l.hd),u.assets.thumb=this.makeAbsolute(l.thumb),u})}makeAbsolute(t){if(t.href.startsWith("/")){const i=new URL(this.host),s=i.protocol+"//"+i.host+"/"+t.href;return Object.assign(Object.assign({},t),{href:s})}return t}login(t){return new Xf(this.host,t,this.timeoutAfterMs)}report(t){return this.fetchJson(this.url("reports"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}search(t){return Ut(this,void 0,void 0,function*(){const i=[];if(t.bbox&&i.push("bbox="+t.bbox.join(",")),t.place&&(i.push("place_position="+t.place[0]+","+t.place[1]),t.place_distance&&(Array.isArray(t.place_distance)?i.push("place_distance="+t.place_distance.join("-")):i.push("place_distance=0-"+t.place_distance)),t.place_fov_tolerance&&i.push("place_fov_tolerance="+t.place_fov_tolerance),t.bbox))throw"Invalid combination: either use 'place' OR 'bbox' but not both";if(t.ids){for(const h of t.ids)if(!Yt.isId(h))throw"Invalid id in `ids`-list: "+h;i.push("ids="+t.ids.join(","))}if(t.collections){for(const h of t.collections)if(!Yt.isId(h))throw"Invalid id in `collections`-list: "+h;i.push("collections="+t.collections.join(","))}t.limit&&i.push("limit="+t.limit),t.datetime&&i.push("datetime="+t.datetime);let s;t.intersects&&(s={intersects:t.intersects});const u=this.url("search")+"?"+i.join("&");let l;return s?l=yield this.fetchJson(u,{headers:{"request:type":"application/json"},body:JSON.stringify(s)}):l=yield this.fetchJson(u),l.features})}createViewLink(t){var i;const s=new URL(this.host).host;if(t.imageId&&!Yt.isId(t.imageId))throw"Invalid imageId: "+t.imageId;let u="https://"+s+"/#";const l=[];let h=t.focus;return t.imageId&&(h??(h="pic"),l.push("pic="+t.imageId)),t.location&&(h??(h="map"),l.push("map="+((i=t.zoom)!==null&&i!==void 0?i:15)+"/"+t.location.lat+"/"+t.location.lon)),h&&l.push("focus="+h),u+l.join("&")}}en.Panoramax=Yt;Yt.idFormat=/[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}/;class Ax extends Yt{constructor(t="https://api.panoramax.xyz/api/"){super(t)}}en.PanoramaxXYZ=Ax;class Xf extends Yt{constructor(t,i,s){super(t,s),this._bearerToken=i}createAuthHeader(){return{Authorization:"Bearer "+this._bearerToken}}fetch(t){const i=Object.create(null,{fetch:{get:()=>super.fetch}});return Ut(this,arguments,void 0,function*(s,u=void 0){return u??(u={}),u.headers=Object.assign(Object.assign({},u.headers),this.createAuthHeader()),i.fetch.call(this,s,u)})}fetchJson(t,i){const s=Object.create(null,{fetchJson:{get:()=>super.fetchJson}});return Ut(this,void 0,void 0,function*(){return i??(i={}),i.headers=Object.assign(Object.assign({},i.headers),this.createAuthHeader()),s.fetchJson.call(this,t,i)})}createCollection(t){return Ut(this,void 0,void 0,function*(){return this.fetchJson(this.url("collections"),{method:"POST",body:JSON.stringify({title:t})})})}mySequences(){return Ut(this,void 0,void 0,function*(){return(yield this.fetchJson(this.url("users","me","collection"))).links.filter(i=>i.rel==="child")})}addImage(t,i,s){return Ut(this,void 0,void 0,function*(){return new Promise((u,l)=>{var h,f;const m=new FormData;m.append("isBlurred",s!=null&&s.isBlurred?"true":"false"),(s==null?void 0:s.indexInSequence)!==void 0&&m.append("position",""+s.indexInSequence),s!=null&&s.lat&&m.append("override_latitude",""+s.lat),s!=null&&s.lon&&m.append("override_longitude",""+s.lon),s!=null&&s.datetime&&m.append("override_capture_time",""+s.datetime);for(const _ in(h=s==null?void 0:s.exifOverride)!==null&&h!==void 0?h:{}){const I=(f=s==null?void 0:s.exifOverride)===null||f===void 0?void 0:f[_];I&&m.append("override_Exif.Image."+_,I)}m.append("picture",t);const p=new XMLHttpRequest;(s==null?void 0:s.onProgress)!==void 0&&p.upload.addEventListener("progress",_=>{const I=s.onProgress;I&&I(_)}),p.onload=function(){p.status>=200&&p.status{t=zt(zt({},t),gr(I)),i(1,u=hr(t,s)),"color"in I&&i(0,l=I.color)},[l,u,h,f,m,p,y,_]}class Rx extends _r{constructor(t){super(),xr(this,t,Mx,Ox,Wn,{color:0})}}const je=class je extends G0{constructor(){super(...arguments);ge(this,"defaultKeyPrefixes",["panoramax","image"]);ge(this,"name","panoramax")}sourceIcon(){return Rx}visitUrl(i,s){const u="https://"+new URL(i.url).host;return new Bn.Panoramax(u).createViewLink({imageId:i==null?void 0:i.id,location:s})}addKnownMeta(i,s){je.knownMeta[i.id]={data:Promise.resolve({data:i,url:s}),time:new Date}}async getInfoFromMapComplete(i){const s=await je.defaultPanoramax.imageInfo(i);return{url:je.defaultPanoramax.host,data:s}}async getInfoFromXYZ(i){return{data:await je.xyz.imageInfo(i),url:je.xyz.host}}static extractHref(i,s,u){var l,h;if(i.href.startsWith("/")){const f=((h=(l=s.links)==null?void 0:l.find(p=>p.type==="root"))==null?void 0:h.href)??u,m=new URL(f);return m.protocol+"//"+m.host+i.href}return i.href}featureToImage(i){var f;const s=i==null?void 0:i.data;if(!s)return;const[u,l]=$t.centerpointCoordinates(s),h=je.defaultPanoramax.host;return{id:s.id,url:je.extractHref(s.assets.sd,s,i.url??h),url_hd:je.extractHref(s.assets.hd,s,i.url??h),host:(f=s.links.find(m=>m.rel==="root"))==null?void 0:f.href,lon:u,lat:l,license:je.licenseFromImagedata(i.data),key:"panoramax",provider:this,status:s.properties["geovisio:status"],rotation:Number(s.properties["view:azimuth"]),isSpherical:s.properties.exif["Xmp.GPano.ProjectionType"]==="equirectangular",date:new Date(s.properties.datetime)}}async getInfoForUncached(i){try{return await this.getInfoFromMapComplete(i)}catch(s){console.debug(s)}try{return await this.getInfoFromXYZ(i)}catch(s){console.debug(s)}}async getInfoFor(i){if(!i.match(/^[a-zA-Z0-9-]+$/))return;const s=je.knownMeta[i];if(s&&new Date().getTime()-s.time.getTime()f.name)).at(-1),l=(h=i.links.find(f=>f.rel==="license"))==null?void 0:h.href;return{artist:u,date:new Date(i.properties.datetime),licenseUrl:l,licenseShortName:i.properties.license??i.properties["geovisio:license"]??l}}async getInfo(i){const s=await this.getInfoFor(i);return this.featureToImage(s)}getRelevantUrls(i,s){const u=$l.fromPromise(super.getRelevantUrlsFor(i,s));function l(h){return h===void 0?!0:h==null?void 0:h.some(f=>(f==null?void 0:f.status)!==void 0&&(f==null?void 0:f.status)!=="ready"&&(f==null?void 0:f.status)!=="broken"&&(f==null?void 0:f.status)!=="hidden")}return Ha.chronic(2500,()=>l(u.data)).addCallback(async()=>{const h=await super.getRelevantUrlsFor(i,s);return u.set(h),!l(h)}),Ha.listStabilized(u)}async DownloadAttribution(i){if(i.license)return i.license;const s=await this.getInfoFor(i.id);return je.licenseFromImagedata(s.data)}apiUrls(){return[Br.panoramax,{url:"https://panoramax.xyz",description:"The federation instance of Panoramax, which knows all panoramax-servers and can query all servers",selfhostable:!0,openData:!0,sourceAvailable:!0,moreInfo:["https://wiki.openstreetmap.org/wiki/Panoramax"],trigger:["always"],category:"core"}]}static getPanoramaxInstance(i){return i=new URL(i).host,new URL(this.defaultPanoramax.host).host===i?this.defaultPanoramax:new URL(this.xyz.host).host===i?this.xyz:new Bn.Panoramax(i)}async getPanoramaInfo(i){const s=await je.xyz.imageInfo(i.id),u=(s.assets.sd??s.assets.thumb??s.assets.hd).href,l=s.properties["view:azimuth"],h=Number(s.properties.exif["Xmp.GPano.PosePitchDegrees"]);return{type:"Feature",geometry:s.geometry,properties:{url:u,northOffset:l,pitchOffset:h,provider:this,imageMeta:s}}}static async checkSequencePermissions(){const i=je.defaultPanoramax,s=await i.mySequences(),u={[Br.panoramax.testsequence]:"owner-only"},l=[];for(const h of s){const f=u[h.id]??"anyone";if(h["geovisio:visibility"]===f)continue;await i.changeSequenceProperties(h.id,{visibility:f});const m=`Changed panoramax sequence ${h.id} to be publicly visible`;console.log(m),zn.runningFromConsole||alert(m),l.push(h.id)}return l}};ge(je,"singleton",new je),ge(je,"xyz",new Bn.PanoramaxXYZ),ge(je,"defaultPanoramax",new Bn.AuthorizedPanoramax(Br.panoramax.url,Br.panoramax.token,3e3)),ge(je,"isDirectLink",/https:\/\/panoramax.mapcomplete.org\/api\/pictures\/([0-9a-f-]+)\/(hd)|(sd)|(thumb).jpg/),ge(je,"knownMeta",{});let Fo=je;class Do{constructor(t,i,s){ge(this,"panoramax");ge(this,"maxFileSizeInMegabytes",100*1e3*1e3);ge(this,"_targetSequence");ge(this,"host");this._targetSequence=s,this.host=t,this.panoramax=new Bn.AuthorizedPanoramax(t,i)}static async getMeta(t){const i=await rx.load(t);return Do.getMetaFromTags(i)}static getMetaFromTags(t){var h,f,m,p,y,_,I,T,w,z;let i=new Date().toISOString(),s,u;if(((h=t.ProjectionType)==null?void 0:h.value)==="cylindrical")throw"Unsupported image format: cylindrical images (panorama images) are currently not supported";if((f=t==null?void 0:t.GPSLatitude)!=null&&f.value&&((m=t==null?void 0:t.GPSLongitude)!=null&&m.value)){const[[Y],[Z],[S,b]]=(p=t==null?void 0:t.GPSLatitude)==null?void 0:p.value,[[R],[U],[X,G]]=(y=t==null?void 0:t.GPSLongitude)==null?void 0:y.value,E=Y+Z/60+S/(3600*b),v=R+U/60+X/(3600*G);typeof E=="number"&&!isNaN(E)&&typeof v=="number"&&!isNaN(v)&&!(E===0&&v===0)&&(s=E,u=v,((I=(_=t==null?void 0:t.GPSLatitudeRef)==null?void 0:_.value)==null?void 0:I[0])==="S"&&(s*=-1),((w=(T=t==null?void 0:t.GPSLongitudeRef)==null?void 0:T.value)==null?void 0:w[0])==="W"&&(u*=-1))}const l=(z=t.DateTime.value[0]??t.DateTimeOriginal.value[0]??t.GPSDateStamp??t.CreateDate??t["Date Created"])==null?void 0:z.split(" ");if(l){const[Y,Z]=l,S=new Date(Y.replaceAll(":","-")+"T"+Z);S.getFullYear()===1970?console.log("Datetime from picture is probably invalid:",S,"using 'now' instead"):i=S.toISOString()}return{datetime:i,lon:u,lat:s}}async uploadImage(t,i,s,u=!1,l,h,f){var z;let[m,p]=i??[void 0,void 0];f??(f=new Date().toISOString());try{const Y=await Do.getMeta(t);m=Y.lon??m,p=Y.lat??p,f=Y.datetime??f}catch(Y){console.warn("Could not read EXIF-tags due to",Y)}const y=this.panoramax;h??(h=((z=this._targetSequence)==null?void 0:z.data)??Br.panoramax.sequence);const _=(await y.mySequences()).find(Y=>Y.id===h),I={lon:m,lat:p,datetime:f,isBlurred:u,onProgress:void 0,indexInSequence:_["stats:items"].count+1,exifOverride:{Artist:s}};l&&(I.onProgress=Y=>{if(Y.lengthComputable){const Z=Y.loaded/Y.total*100;l.set(Math.round(Z))}},l.set(0));const T=await y.addImage(t,h,I);Fo.singleton.addKnownMeta(T);let w=T.assets.hd.href;return w.startsWith("http")||(w=this.host+w),l.set(void 0),{key:"panoramax",value:T.id,absoluteUrl:w}}}const Fx=e=>({}),jl=e=>({});function Dx(e){let t,i;const s=e[4].default,u=fn(s,e,e[5],null);return{c(){t=Sn("div"),u&&u.c(),j(t,"class",e[2])},m(l,h){qt(l,t,h),u&&u.m(t,null),i=!0},p(l,h){u&&u.p&&(!i||h&32)&&hn(u,s,l,l[5],i?dn(s,l[5],h,null):gn(l[5]),null),(!i||h&4)&&j(t,"class",l[2])},i(l){i||(tt(u,l),i=!0)},o(l){ot(u,l),i=!1},d(l){l&&Ht(t),u&&u.d(l)}}}function Gx(e){let t,i,s;const u=e[4].header,l=fn(u,e,e[5],jl);return{c(){t=Sn("span"),l&&l.c(),j(t,"slot","header"),j(t,"class",i=e[1]?"w-full":"w-full p-2 text-base")},m(h,f){qt(h,t,f),l&&l.m(t,null),s=!0},p(h,f){l&&l.p&&(!s||f&32)&&hn(l,u,h,h[5],s?dn(u,h[5],f,Fx):gn(h[5]),jl),(!s||f&2&&i!==(i=h[1]?"w-full":"w-full p-2 text-base"))&&j(t,"class",i)},i(h){s||(tt(l,h),s=!0)},o(h){ot(l,h),s=!1},d(h){h&&Ht(t),l&&l.d(h)}}}function Bx(e){let t,i;return t=new Sg({props:{open:e[0],paddingDefault:"p-0",inactiveClass:"text-black",defaultClass:e[3],$$slots:{header:[Gx],default:[Dx]},$$scope:{ctx:e}}}),{c(){Go(t.$$.fragment)},m(s,u){Bo(t,s,u),i=!0},p(s,u){const l={};u&1&&(l.open=s[0]),u&8&&(l.defaultClass=s[3]),u&38&&(l.$$scope={dirty:u,ctx:s}),t.$set(l)},i(s){i||(tt(t.$$.fragment,s),i=!0)},o(s){ot(t.$$.fragment,s),i=!1},d(s){Yo(t,s)}}}function Ux(e){let t,i;return t=new gg({props:{$$slots:{default:[Bx]},$$scope:{ctx:e}}}),{c(){Go(t.$$.fragment)},m(s,u){Bo(t,s,u),i=!0},p(s,[u]){const l={};u&47&&(l.$$scope={dirty:u,ctx:s}),t.$set(l)},i(s){i||(tt(t.$$.fragment,s),i=!0)},o(s){ot(t.$$.fragment,s),i=!1},d(s){Yo(t,s)}}}function Yx(e,t,i){let{$$slots:s={},$$scope:u}=t,{expanded:l=!1}=t,{noBorder:h=!1}=t,{contentClass:f=h?"normal-background":"low-interaction rounded-b p-2 border-x-2 border-b-2 border-dashed border-low-interaction"}=t,m;return h&&(m="unstyled w-full flex-grow"),e.$$set=p=>{"expanded"in p&&i(0,l=p.expanded),"noBorder"in p&&i(1,h=p.noBorder),"contentClass"in p&&i(2,f=p.contentClass),"$$scope"in p&&i(5,u=p.$$scope)},[l,h,f,m,s,u]}class iE extends _r{constructor(t){super(),xr(this,t,Yx,Ux,Wn,{expanded:0,noBorder:1,contentClass:2})}}export{iE as A,Yn as B,nE as C,rx as E,$t as G,G0 as I,Do as P,Be as T,Kx as a,tE as b,un as c,tc as d,Bn as e,ag as f,oc as g,Rd as h,Fo as i,eE as j,Sg as k,gg as l,sg as m,ug as n,og as o,lg as p,Jx as s,v0 as u};
//# sourceMappingURL=AccordionSingle-de293e2e.js.map