(function(i,a){typeof exports=="object"&&typeof module<"u"?a(exports):typeof define=="function"&&define.amd?define(["exports"],a):(i=typeof globalThis<"u"?globalThis:i||self,a(i.tilebeltWgs84={}))})(this,function(i){"use strict";const a=n=>n/360+.5,y=n=>-n/180+.5,u=n=>{const t=Math.floor(n);return[2<{const[o,s]=u(e),c=a(n),l=y(t),f=c*o,h=l*s;return[f,h,e]},W=(n,t,e)=>{const o=T(n,t,e);return[Math.floor(o[0]),Math.floor(o[1]),o[2]]},g=([n,t,e],[o,s,c])=>n===o&&t===s&&e===c,k=(n,t)=>n.some(e=>g(t,e)),z=n=>{if(n[2]===0)return[n[0]%2?[0,0,0]:[1,0,0]];const t=n[0]-n[0]%2,e=n[1]-n[1]%2;return[[t,e,n[2]],[t+1,e,n[2]],[t,e+1,n[2]],[t+1,e+1,n[2]]].filter(o=>!g(o,n))},m=([n,t,e])=>{if(e!==0)return[Math.floor(n/2),Math.floor(t/2),e-1]},H=([n,t,e])=>{const o=e+1,s=Math.floor(n)*2,c=Math.floor(t)*2;return[[s,c,o],[s+1,c,o],[s,c+1,o],[s+1,c+1,o]]},O=n=>{let t="",e=n;for(;e;){const[o,s]=e;t=(o%2?s%2?3:1:s%2?2:0)+t,e=m(e)}return t},q=n=>{const t=n.length-1,[e,o]=u(t);let s=0,c=0;for(let l=0;l<=t;l++){const f=e/(2<{const e=T(n[0],n[3],t),o=T(n[2],n[1],t),s=[];for(let c=Math.floor(e[0]);c{const[o,s]=u(e),c=360/o,l=180/s,f=n/o,h=t/s,r=f*360-180,d=-h*180+90;return[r,d-l,r+c,d]},L=n=>{const t=M(n);return{type:"Polygon",coordinates:[[[t[0],t[3]],[t[0],t[1]],[t[2],t[1]],[t[2],t[3]],[t[0],t[3]]]]}},S=(n,t)=>!(n[2]t[2]||n[3]t[3]),P=(n,t)=>{if(S(n,t))return[Math.max(n[0],t[0]),Math.max(n[1],t[1]),Math.min(n[2],t[2]),Math.min(n[3],t[3])]};i.bboxToTiles=E,i.bboxesIntersect=S,i.getChildren=H,i.getExtent=u,i.getParent=m,i.getSiblings=z,i.hasTile=k,i.intersectBboxes=P,i.normalizeLat=y,i.normalizeLng=a,i.pointToTile=W,i.pointToTileFraction=T,i.quadkeyToTile=q,i.tileToBBox=M,i.tileToGeoJSON=L,i.tileToQuadkey=O,i.tilesEqual=g,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});