@maptiler/client 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/maptiler-client.cjs +28 -0
- package/dist/maptiler-client.cjs.map +1 -1
- package/dist/maptiler-client.d.ts +81 -9
- package/dist/maptiler-client.min.mjs +1 -1
- package/dist/maptiler-client.mjs +28 -0
- package/dist/maptiler-client.mjs.map +1 -1
- package/dist/maptiler-client.umd.js +28 -0
- package/dist/maptiler-client.umd.js.map +1 -1
- package/dist/maptiler-client.umd.min.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/config.ClientConfig.html +9 -9
- package/docs/classes/services_ServiceError.ServiceError.html +7 -7
- package/docs/functions/language.getAutoLanguageGeocoding.html +5 -5
- package/docs/functions/services_simplify.default.html +5 -5
- package/docs/index.html +16 -10
- package/docs/modules/config.html +5 -5
- package/docs/modules/language.html +5 -5
- package/docs/modules/services_ServiceError.html +5 -5
- package/docs/modules/services_coordinates.html +5 -5
- package/docs/modules/services_data.html +5 -5
- package/docs/modules/services_geocoding.html +5 -5
- package/docs/modules/services_geolocation.html +5 -5
- package/docs/modules/services_simplify.html +5 -5
- package/docs/modules/services_staticMaps.html +5 -5
- package/docs/modules.html +4 -4
- package/docs/types/config.FetchFunction.html +5 -5
- package/docs/types/language.LanguageGeocodingString.html +5 -5
- package/docs/types/services_coordinates.CoordinateExport.html +5 -5
- package/docs/types/services_coordinates.CoordinateGrid.html +5 -5
- package/docs/types/services_coordinates.CoordinateId.html +5 -5
- package/docs/types/services_coordinates.CoordinateSearch.html +5 -5
- package/docs/types/services_coordinates.CoordinateSearchResult.html +5 -5
- package/docs/types/services_coordinates.CoordinateTransformResult.html +5 -5
- package/docs/types/services_coordinates.CoordinateTransformation.html +5 -5
- package/docs/types/services_coordinates.CoordinatesSearchOptions.html +5 -5
- package/docs/types/services_coordinates.CoordinatesTransformOptions.html +5 -5
- package/docs/types/services_coordinates.XYZ.html +5 -5
- package/docs/types/services_data.GetDataOptions.html +5 -5
- package/docs/types/services_geocoding.ByIdGeocodingOptions.html +5 -5
- package/docs/types/services_geocoding.CommonForwardAndReverseGeocodingOptions.html +6 -6
- package/docs/types/services_geocoding.Coordinates.html +5 -5
- package/docs/types/services_geocoding.FeatureHierarchy.html +6 -17
- package/docs/types/services_geocoding.GeocodingFeature.html +6 -6
- package/docs/types/services_geocoding.GeocodingOptions.html +5 -5
- package/docs/types/services_geocoding.GeocodingSearchResult.html +5 -5
- package/docs/types/services_geocoding.LanguageGeocodingOptions.html +5 -5
- package/docs/types/services_geocoding.ReverseGeocodingOptions.html +5 -5
- package/docs/types/services_geolocation.GeolocationInfoOptions.html +5 -5
- package/docs/types/services_geolocation.GeolocationResult.html +5 -5
- package/docs/types/services_staticMaps.AutomaticStaticMapOptions.html +5 -5
- package/docs/types/services_staticMaps.BoundedStaticMapOptions.html +5 -5
- package/docs/types/services_staticMaps.CenteredStaticMapOptions.html +5 -5
- package/docs/types/services_staticMaps.StaticMapBaseOptions.html +5 -5
- package/docs/types/services_staticMaps.StaticMapMarker.html +5 -5
- package/docs/variables/config.config.html +5 -5
- package/docs/variables/language.LanguageGeocoding.html +5 -5
- package/docs/variables/services_coordinates.coordinates.html +5 -5
- package/docs/variables/services_data.data.html +5 -5
- package/docs/variables/services_geocoding.geocoding.html +5 -5
- package/docs/variables/services_geolocation.geolocation.html +5 -5
- package/docs/variables/services_staticMaps.staticMaps.html +5 -5
- package/docsmd/README.md +46 -52
- package/docsmd/classes/ClientConfig.md +5 -5
- package/docsmd/classes/MapStyleVariant.md +13 -13
- package/docsmd/classes/ReferenceMapStyle.md +9 -9
- package/docsmd/classes/ServiceError.md +3 -3
- package/examples/test-node.js +9 -9
- package/package.json +1 -1
- package/readme.md +8 -4
- package/src/mapstyle.ts +49 -0
- package/src/services/geocoding.ts +96 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(u,L){typeof exports=="object"&&typeof module<"u"?L(exports):typeof define=="function"&&define.amd?define(["exports"],L):(u=typeof globalThis<"u"?globalThis:u||self,L(u.maptilerClient={}))})(this,function(u){"use strict";function L(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}class C{constructor(){this._apiKey="",this._fetch=L()}set apiKey(e){this._apiKey=e}get apiKey(){return this._apiKey}set fetch(e){this._fetch=e}get fetch(){return this._fetch}}const y=new C,R={AUTO:"auto",ALBANIAN:"sq",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HUNGARIAN:"hu",ICELANDIC:"is",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALTESE:"mt",NORWEGIAN:"no",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},x=new Set(Object.values(R));function B(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const n=Array.from(new Set(navigator.languages.map(e=>e.split("-")[0]))).filter(e=>x.has(e));return n.length?n[0]:R.ENGLISH}var W=(n,e,t)=>new Promise((i,r)=>{var s=o=>{try{c(t.next(o))}catch(l){r(l)}},a=o=>{try{c(t.throw(o))}catch(l){r(l)}},c=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);c((t=t.apply(n,e)).next())});function S(n){return W(this,arguments,function*(e,t={}){if(y.fetch===null)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");if(new URL(e).searchParams.get("key").trim()==="")throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return y.fetch(e,t)})}const g={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(g);class A extends Error{constructor(e,t=""){super(`Call to enpoint ${e.url} failed with the status code ${e.status}. ${t}`),this.res=e}}var I=(n,e,t)=>new Promise((i,r)=>{var s=o=>{try{c(t.next(o))}catch(l){r(l)}},a=o=>{try{c(t.throw(o))}catch(l){r(l)}},c=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);c((t=t.apply(n,e)).next())});const T={400:"Query too long / Invalid parameters",403:"Key is missing, invalid or restricted"};function K(n,e){if(e.language==null)return;const t=Array.from(new Set((Array.isArray(e.language)?e.language:[e.language]).map(i=>i===R.AUTO?B():i))).join(",");n.set("language",t)}function O(n,e){var t;n.set("key",(t=e.apiKey)!=null?t:y.apiKey),e.limit!=null&&n.set("limit",String(e.limit)),e.types!=null&&n.set("types",e.types.join(",")),K(n,e)}function j(n,e){O(n,e),e.bbox!=null&&n.set("bbox",e.bbox.join(",")),e.proximity!=null&&n.set("proximity",e.proximity.join(",")),e.country!=null&&n.set("country",e.country.join(",")),e.fuzzyMatch!=null&&n.set("fuzzyMatch",e.fuzzyMatch?"true":"false"),e.autocomplete!=null&&n.set("autocomplete",e.autocomplete?"true":"false")}function z(n){return I(this,arguments,function*(e,t={}){var i;if(typeof e!="string"||e.trim().length===0)throw new Error("The query must be a non-empty string");const r=new URL(`geocoding/${encodeURIComponent(e)}.json`,g.maptilerApiURL),{searchParams:s}=r;j(s,t);const a=r.toString(),c=yield S(a);if(!c.ok)throw new A(c,(i=T[c.status])!=null?i:"");return yield c.json()})}function _(n){return I(this,arguments,function*(e,t={}){var i;if(!Array.isArray(e)||e.length<2)throw new Error("The position must be an array of form [lng, lat].");const r=new URL(`geocoding/${e[0]},${e[1]}.json`,g.maptilerApiURL);O(r.searchParams,t);const s=r.toString(),a=yield S(s);if(!a.ok)throw new A(a,(i=T[a.status])!=null?i:"");return yield a.json()})}function q(n){return I(this,arguments,function*(e,t={}){var i;const r=new URL(`geocoding/${e}.json`,g.maptilerApiURL);K(r.searchParams,t);const s=r.toString(),a=yield S(s);if(!a.ok)throw new A(a,(i=T[a.status])!=null?i:"");return yield a.json()})}function Y(n){return I(this,arguments,function*(e,t={}){var i;if(!e.length)return[];const r=e.map(f=>encodeURIComponent(f)).join(";"),s=new URL(`geocoding/${r}.json`,g.maptilerApiURL),{searchParams:a}=s;j(a,t);const c=s.toString(),o=yield S(c);if(!o.ok)throw new A(o,(i=T[o.status])!=null?i:"");const l=yield o.json();return e.length===1?[l]:l})}const Z={forward:z,reverse:_,byId:q,batch:Y,language:R};var J=(n,e,t)=>new Promise((i,r)=>{var s=o=>{try{c(t.next(o))}catch(l){r(l)}},a=o=>{try{c(t.throw(o))}catch(l){r(l)}},c=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);c((t=t.apply(n,e)).next())});const H={403:"Key is missing, invalid or restricted"};function Q(){return J(this,arguments,function*(n={}){var e;const t=new URL("geolocation/ip.json",g.maptilerApiURL);t.searchParams.set("key",(e=n.apiKey)!=null?e:y.apiKey);const i=t.toString(),r=yield S(i);if(!r.ok)throw new A(r,r.status in H?H[r.status]:"");return yield r.json()})}const X={info:Q};var V=(n,e,t)=>new Promise((i,r)=>{var s=o=>{try{c(t.next(o))}catch(l){r(l)}},a=o=>{try{c(t.throw(o))}catch(l){r(l)}},c=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);c((t=t.apply(n,e)).next())});const U={403:"Key is missing, invalid or restricted"};function ee(n){return V(this,arguments,function*(e,t={}){var i;if(typeof e!="string"||e.trim().length===0)throw new Error("The query must be a non-empty string");const r=new URL(`coordinates/search/${e}.json`,g.maptilerApiURL);r.searchParams.set("key",(i=t.apiKey)!=null?i:y.apiKey),"limit"in t&&r.searchParams.set("limit",t.limit.toString()),"transformations"in t&&r.searchParams.set("transformations",t.transformations.toString()),"exports"in t&&r.searchParams.set("exports",t.exports.toString());const s=r.toString(),a=yield S(s);if(!a.ok)throw new A(a,a.status in U?U[a.status]:"");return yield a.json()})}function te(n){return V(this,arguments,function*(e,t={}){var i;const r=(Array.isArray(e[0])?e:[e]).map(o=>`${o[0]},${o[1]}`).join(";"),s=new URL(`coordinates/transform/${r}.json`,g.maptilerApiURL);s.searchParams.set("key",(i=t.apiKey)!=null?i:y.apiKey),"sourceCrs"in t&&s.searchParams.set("s_srs",t.sourceCrs.toString()),"targetCrs"in t&&s.searchParams.set("t_srs",t.targetCrs.toString()),"operations"in t&&s.searchParams.set("ops",(Array.isArray(t.operations)?t.operations:[t.operations]).join("|"));const a=s.toString(),c=yield S(a);if(!c.ok)throw new A(c,c.status in U?U[c.status]:"");return yield c.json()})}const ne={search:ee,transform:te};var ie=(n,e,t)=>new Promise((i,r)=>{var s=o=>{try{c(t.next(o))}catch(l){r(l)}},a=o=>{try{c(t.throw(o))}catch(l){r(l)}},c=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);c((t=t.apply(n,e)).next())});const G={403:"Key is missing, invalid or restricted"};function re(n){return ie(this,arguments,function*(e,t={}){var i;if(typeof e!="string"||e.trim().length===0)throw new Error("The data ID must be a non-empty string");const r=new URL(`data/${encodeURIComponent(e)}/features.json`,g.maptilerApiURL);r.searchParams.set("key",(i=t.apiKey)!=null?i:y.apiKey);const s=r.toString(),a=yield S(s);if(!a.ok)throw new A(a,a.status in G?G[a.status]:"");return yield a.json()})}const ae={get:re};function M(n){const e=/^maptiler:\/\/(.*)/;let t;const i=n.trim();let r;return i.startsWith("http://")||i.startsWith("https://")?r=i:(t=e.exec(i))!==null?r=`https://api.maptiler.com/maps/${t[1]}/style.json`:r=`https://api.maptiler.com/maps/${i}/style.json`,r}class k{constructor(e,t,i,r,s,a){this.name=e,this.variantType=t,this.id=i,this.referenceStyle=r,this.description=s,this.imageURL=a}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(e){return this.referenceStyle.hasVariant(e)}getVariant(e){return this.referenceStyle.getVariant(e)}getVariants(){return this.referenceStyle.getVariants().filter(e=>e!==this)}getImageURL(){return this.imageURL}getExpandedStyleURL(){return M(this.getId())}}class ${constructor(e,t){this.name=e,this.id=t,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(e){this.variants[e.getType()]=e,this.orderedVariants.push(e)}hasVariant(e){return e in this.variants}getVariant(e){return e in this.variants?this.variants[e]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0]}}const D=[{referenceStyleID:"STREETS",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"streets-v2-night",name:"Night",variantType:"NIGHT",description:"",imageURL:""},{id:"streets-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"outdoor-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"winter-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID",name:"Hybrid",description:"",variants:[{id:"hybrid",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"BASIC",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"TOPO",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"topo-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"topo-v2-shiny",name:"Shiny",variantType:"SHINY",description:"",imageURL:""},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]},{referenceStyleID:"VOYAGER",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER",name:"Toner",description:"",variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",description:"",imageURL:""},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:""},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]}];function se(n){return new Proxy(n,{get(e,t,i){return e.hasVariant(t)?e.getVariant(t):t.toString().toUpperCase()===t?n.getDefaultVariant():Reflect.get(e,t,i)}})}function oe(){const n={};for(let e=0;e<D.length;e+=1){const t=D[e],i=se(new $(t.name,t.referenceStyleID));for(let r=0;r<t.variants.length;r+=1){const s=t.variants[r],a=new k(s.name,s.variantType,s.id,i,s.description,s.imageURL);i.addVariant(a)}n[t.referenceStyleID]=i}return n}function E(n){if(!n)return F[D[0].referenceStyleID].getDefaultVariant().getId();if(typeof n=="string"||n instanceof String)return n.trim().toLowerCase();if(n instanceof k)return n.getId();if(n instanceof $)return n.getDefaultVariant().getId()}const F=oe();function ce(n,e,t){let i=e[0],r=e[1],s=t[0]-i,a=t[1]-r;if(s!==0||a!==0){const c=((n[0]-i)*s+(n[1]-r)*a)/(s*s+a*a);c>1?(i=t[0],r=t[1]):c>0&&(i+=s*c,r+=a*c)}return s=n[0]-i,a=n[1]-r,s*s+a*a}function P(n,e,t,i,r){let s=i,a;for(let c=e+1;c<t;c++){const o=ce(n[c],n[e],n[t]);o>s&&(a=c,s=o)}s>i&&(a-e>1&&P(n,e,a,i,r),r.push(n[a]),t-a>1&&P(n,a,t,i,r))}function le(n,e){const t=n.length-1,i=[n[0]];return P(n,0,t,e,i),i.push(n[t]),i}function pe(n,e){if(n.length<=2)return n;const t=e!==void 0?e*e:1;return le(n,t)}function w(n,e=!0){let t=`${n[0]},${n[1]}`;return n.length===3&&e&&(t+=`,${n[2]}`),t}function N(n,e=3e3){let t=n.map(s=>s.join(",")).join("|"),i=5e-6;const r=1e-5;for(;t.length>e;)t=pe(n,i).map(s=>`${s[0]},${s[1]}`).join("|"),i+=r;return t}function me(n,e,t={}){var i,r,s,a,c;const o=E(t.style),l=t.hiDPI?"@2x":"",f=(i=t.format)!=null?i:"png";let d=~~((r=t.width)!=null?r:1024),m=~~((s=t.height)!=null?s:1024);t.hiDPI&&(d=~~(d/2),m=~~(m/2));const p=new URL(`maps/${encodeURIComponent(o)}/static/${n[0]},${n[1]},${e}/${d}x${m}${l}.${f}`,g.maptilerApiURL);if("attribution"in t&&p.searchParams.set("attribution",t.attribution.toString()),"markers"in t){let h="";const v="markerIcon"in t;v&&(h+=`icon:${t.markerIcon}|`),v&&"markerAnchor"in t&&(h+=`anchor:${t.markerAnchor}|`),v&&t.hiDPI&&(h+="scale:2|");const b=Array.isArray(t.markers[0])?t.markers:[t.markers];h+=b.map(ge=>w(ge,!v)).join("|"),p.searchParams.set("markers",h)}if("path"in t){let h="";if(h+=`fill:${(a=t.pathFillColor)!=null?a:"none"}|`,"pathStrokeColor"in t&&(h+=`stroke:${t.pathStrokeColor}|`),"pathWidth"in t){const v=t.pathWidth/(t.hiDPI?2:1);h+=`width:${v.toString()}|`}h+=N(t.path),p.searchParams.set("path",h)}return p.searchParams.set("key",(c=t.apiKey)!=null?c:y.apiKey),p.toString()}function he(n,e={}){var t,i,r,s,a;const c=E(e.style),o=e.hiDPI?"@2x":"",l=(t=e.format)!=null?t:"png";let f=~~((i=e.width)!=null?i:1024),d=~~((r=e.height)!=null?r:1024);e.hiDPI&&(f=~~(f/2),d=~~(d/2));const m=new URL(`maps/${encodeURIComponent(c)}/static/${n[0]},${n[1]},${n[2]},${n[3]}/${f}x${d}${o}.${l}`,g.maptilerApiURL);if("attribution"in e&&m.searchParams.set("attribution",e.attribution.toString()),"padding"in e&&m.searchParams.set("padding",e.padding.toString()),"markers"in e){let p="";const h="markerIcon"in e;h&&(p+=`icon:${e.markerIcon}|`),h&&"markerAnchor"in e&&(p+=`anchor:${e.markerAnchor}|`),h&&e.hiDPI&&(p+="scale:2|");const v=Array.isArray(e.markers[0])?e.markers:[e.markers];p+=v.map(b=>w(b,!h)).join("|"),m.searchParams.set("markers",p)}if("path"in e){let p="";if(p+=`fill:${(s=e.pathFillColor)!=null?s:"none"}|`,"pathStrokeColor"in e&&(p+=`stroke:${e.pathStrokeColor}|`),"pathWidth"in e){const h=e.pathWidth/(e.hiDPI?2:1);p+=`width:${h.toString()}|`}p+=N(e.path),m.searchParams.set("path",p)}return m.searchParams.set("key",(a=e.apiKey)!=null?a:y.apiKey),m.toString()}function ue(n={}){var e,t,i,r,s;if(!("markers"in n)&&!("path"in n))throw new Error("Automatic static maps require markers and/or path to be created.");const a=E(n.style),c=n.hiDPI?"@2x":"",o=(e=n.format)!=null?e:"png";let l=~~((t=n.width)!=null?t:1024),f=~~((i=n.height)!=null?i:1024);n.hiDPI&&(l=~~(l/2),f=~~(f/2));const d=new URL(`maps/${encodeURIComponent(a)}/static/auto/${l}x${f}${c}.${o}`,g.maptilerApiURL);if("attribution"in n&&d.searchParams.set("attribution",n.attribution.toString()),"padding"in n&&d.searchParams.set("padding",n.padding.toString()),"markers"in n){let m="";const p="markerIcon"in n;p&&(m+=`icon:${n.markerIcon}|`),p&&"markerAnchor"in n&&(m+=`anchor:${n.markerAnchor}|`),p&&n.hiDPI&&(m+="scale:2|");const h=Array.isArray(n.markers[0])?n.markers:[n.markers];m+=h.map(v=>w(v,!p)).join("|"),d.searchParams.set("markers",m)}if("path"in n){let m="";if(m+=`fill:${(r=n.pathFillColor)!=null?r:"none"}|`,"pathStrokeColor"in n&&(m+=`stroke:${n.pathStrokeColor}|`),"pathWidth"in n){const p=n.pathWidth/(n.hiDPI?2:1);m+=`width:${p.toString()}|`}m+=N(n.path),d.searchParams.set("path",m)}return d.searchParams.set("key",(s=n.apiKey)!=null?s:y.apiKey),d.toString()}const de={centered:me,bounded:he,automatic:ue};u.ClientConfig=C,u.LanguageGeocoding=R,u.MapStyle=F,u.MapStyleVariant=k,u.ReferenceMapStyle=$,u.ServiceError=A,u.config=y,u.coordinates=ne,u.data=ae,u.expandMapStyle=M,u.geocoding=Z,u.geolocation=X,u.mapStylePresetList=D,u.staticMaps=de,Object.defineProperty(u,"__esModule",{value:!0})});
|
|
1
|
+
(function(u,R){typeof exports=="object"&&typeof module<"u"?R(exports):typeof define=="function"&&define.amd?define(["exports"],R):(u=typeof globalThis<"u"?globalThis:u||self,R(u.maptilerClient={}))})(this,function(u){"use strict";function R(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}class C{constructor(){this._apiKey="",this._fetch=R()}set apiKey(e){this._apiKey=e}get apiKey(){return this._apiKey}set fetch(e){this._fetch=e}get fetch(){return this._fetch}}const y=new C,S={AUTO:"auto",ALBANIAN:"sq",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HUNGARIAN:"hu",ICELANDIC:"is",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALTESE:"mt",NORWEGIAN:"no",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},x=new Set(Object.values(S));function B(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const n=Array.from(new Set(navigator.languages.map(e=>e.split("-")[0]))).filter(e=>x.has(e));return n.length?n[0]:S.ENGLISH}var W=(n,e,t)=>new Promise((i,r)=>{var s=o=>{try{c(t.next(o))}catch(l){r(l)}},a=o=>{try{c(t.throw(o))}catch(l){r(l)}},c=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);c((t=t.apply(n,e)).next())});function L(n){return W(this,arguments,function*(e,t={}){if(y.fetch===null)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");if(new URL(e).searchParams.get("key").trim()==="")throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return y.fetch(e,t)})}const g={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(g);class A extends Error{constructor(e,t=""){super(`Call to enpoint ${e.url} failed with the status code ${e.status}. ${t}`),this.res=e}}var I=(n,e,t)=>new Promise((i,r)=>{var s=o=>{try{c(t.next(o))}catch(l){r(l)}},a=o=>{try{c(t.throw(o))}catch(l){r(l)}},c=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);c((t=t.apply(n,e)).next())});const T={400:"Query too long / Invalid parameters",403:"Key is missing, invalid or restricted"};function K(n,e){if(e.language==null)return;const t=Array.from(new Set((Array.isArray(e.language)?e.language:[e.language]).map(i=>i===S.AUTO?B():i))).join(",");n.set("language",t)}function O(n,e){var t;n.set("key",(t=e.apiKey)!=null?t:y.apiKey),e.limit!=null&&n.set("limit",String(e.limit)),e.types!=null&&n.set("types",e.types.join(",")),K(n,e)}function j(n,e){O(n,e),e.bbox!=null&&n.set("bbox",e.bbox.join(",")),e.proximity!=null&&n.set("proximity",e.proximity.join(",")),e.country!=null&&n.set("country",e.country.join(",")),e.fuzzyMatch!=null&&n.set("fuzzyMatch",e.fuzzyMatch?"true":"false"),e.autocomplete!=null&&n.set("autocomplete",e.autocomplete?"true":"false")}function z(n){return I(this,arguments,function*(e,t={}){var i;if(typeof e!="string"||e.trim().length===0)throw new Error("The query must be a non-empty string");const r=new URL(`geocoding/${encodeURIComponent(e)}.json`,g.maptilerApiURL),{searchParams:s}=r;j(s,t);const a=r.toString(),c=yield L(a);if(!c.ok)throw new A(c,(i=T[c.status])!=null?i:"");return yield c.json()})}function _(n){return I(this,arguments,function*(e,t={}){var i;if(!Array.isArray(e)||e.length<2)throw new Error("The position must be an array of form [lng, lat].");const r=new URL(`geocoding/${e[0]},${e[1]}.json`,g.maptilerApiURL);O(r.searchParams,t);const s=r.toString(),a=yield L(s);if(!a.ok)throw new A(a,(i=T[a.status])!=null?i:"");return yield a.json()})}function q(n){return I(this,arguments,function*(e,t={}){var i;const r=new URL(`geocoding/${e}.json`,g.maptilerApiURL);K(r.searchParams,t);const s=r.toString(),a=yield L(s);if(!a.ok)throw new A(a,(i=T[a.status])!=null?i:"");return yield a.json()})}function Y(n){return I(this,arguments,function*(e,t={}){var i;if(!e.length)return[];const r=e.map(f=>encodeURIComponent(f)).join(";"),s=new URL(`geocoding/${r}.json`,g.maptilerApiURL),{searchParams:a}=s;j(a,t);const c=s.toString(),o=yield L(c);if(!o.ok)throw new A(o,(i=T[o.status])!=null?i:"");const l=yield o.json();return e.length===1?[l]:l})}const Z={forward:z,reverse:_,byId:q,batch:Y,language:S};var J=(n,e,t)=>new Promise((i,r)=>{var s=o=>{try{c(t.next(o))}catch(l){r(l)}},a=o=>{try{c(t.throw(o))}catch(l){r(l)}},c=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);c((t=t.apply(n,e)).next())});const H={403:"Key is missing, invalid or restricted"};function Q(){return J(this,arguments,function*(n={}){var e;const t=new URL("geolocation/ip.json",g.maptilerApiURL);t.searchParams.set("key",(e=n.apiKey)!=null?e:y.apiKey);const i=t.toString(),r=yield L(i);if(!r.ok)throw new A(r,r.status in H?H[r.status]:"");return yield r.json()})}const X={info:Q};var V=(n,e,t)=>new Promise((i,r)=>{var s=o=>{try{c(t.next(o))}catch(l){r(l)}},a=o=>{try{c(t.throw(o))}catch(l){r(l)}},c=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);c((t=t.apply(n,e)).next())});const U={403:"Key is missing, invalid or restricted"};function ee(n){return V(this,arguments,function*(e,t={}){var i;if(typeof e!="string"||e.trim().length===0)throw new Error("The query must be a non-empty string");const r=new URL(`coordinates/search/${e}.json`,g.maptilerApiURL);r.searchParams.set("key",(i=t.apiKey)!=null?i:y.apiKey),"limit"in t&&r.searchParams.set("limit",t.limit.toString()),"transformations"in t&&r.searchParams.set("transformations",t.transformations.toString()),"exports"in t&&r.searchParams.set("exports",t.exports.toString());const s=r.toString(),a=yield L(s);if(!a.ok)throw new A(a,a.status in U?U[a.status]:"");return yield a.json()})}function te(n){return V(this,arguments,function*(e,t={}){var i;const r=(Array.isArray(e[0])?e:[e]).map(o=>`${o[0]},${o[1]}`).join(";"),s=new URL(`coordinates/transform/${r}.json`,g.maptilerApiURL);s.searchParams.set("key",(i=t.apiKey)!=null?i:y.apiKey),"sourceCrs"in t&&s.searchParams.set("s_srs",t.sourceCrs.toString()),"targetCrs"in t&&s.searchParams.set("t_srs",t.targetCrs.toString()),"operations"in t&&s.searchParams.set("ops",(Array.isArray(t.operations)?t.operations:[t.operations]).join("|"));const a=s.toString(),c=yield L(a);if(!c.ok)throw new A(c,c.status in U?U[c.status]:"");return yield c.json()})}const ne={search:ee,transform:te};var ie=(n,e,t)=>new Promise((i,r)=>{var s=o=>{try{c(t.next(o))}catch(l){r(l)}},a=o=>{try{c(t.throw(o))}catch(l){r(l)}},c=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);c((t=t.apply(n,e)).next())});const G={403:"Key is missing, invalid or restricted"};function re(n){return ie(this,arguments,function*(e,t={}){var i;if(typeof e!="string"||e.trim().length===0)throw new Error("The data ID must be a non-empty string");const r=new URL(`data/${encodeURIComponent(e)}/features.json`,g.maptilerApiURL);r.searchParams.set("key",(i=t.apiKey)!=null?i:y.apiKey);const s=r.toString(),a=yield L(s);if(!a.ok)throw new A(a,a.status in G?G[a.status]:"");return yield a.json()})}const ae={get:re};function M(n){const e=/^maptiler:\/\/(.*)/;let t;const i=n.trim();let r;return i.startsWith("http://")||i.startsWith("https://")?r=i:(t=e.exec(i))!==null?r=`https://api.maptiler.com/maps/${t[1]}/style.json`:r=`https://api.maptiler.com/maps/${i}/style.json`,r}class k{constructor(e,t,i,r,s,a){this.name=e,this.variantType=t,this.id=i,this.referenceStyle=r,this.description=s,this.imageURL=a}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(e){return this.referenceStyle.hasVariant(e)}getVariant(e){return this.referenceStyle.getVariant(e)}getVariants(){return this.referenceStyle.getVariants().filter(e=>e!==this)}getImageURL(){return this.imageURL}getExpandedStyleURL(){return M(this.getId())}}class ${constructor(e,t){this.name=e,this.id=t,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(e){this.variants[e.getType()]=e,this.orderedVariants.push(e)}hasVariant(e){return e in this.variants}getVariant(e){return e in this.variants?this.variants[e]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0]}}const D=[{referenceStyleID:"STREETS",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"streets-v2-night",name:"Night",variantType:"NIGHT",description:"",imageURL:""},{id:"streets-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"outdoor-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"winter-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID",name:"Hybrid",description:"",variants:[{id:"hybrid",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"BASIC",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"TOPO",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"topo-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"topo-v2-shiny",name:"Shiny",variantType:"SHINY",description:"",imageURL:""},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]},{referenceStyleID:"VOYAGER",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER",name:"Toner",description:"",variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",description:"",imageURL:""},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:""},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BACKDROP",name:"Backdrop",description:"",variants:[{id:"backdrop",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"backdrop-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"backdrop-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]}];function se(n){return new Proxy(n,{get(e,t,i){return e.hasVariant(t)?e.getVariant(t):t.toString().toUpperCase()===t?n.getDefaultVariant():Reflect.get(e,t,i)}})}function oe(){const n={};for(let e=0;e<D.length;e+=1){const t=D[e],i=se(new $(t.name,t.referenceStyleID));for(let r=0;r<t.variants.length;r+=1){const s=t.variants[r],a=new k(s.name,s.variantType,s.id,i,s.description,s.imageURL);i.addVariant(a)}n[t.referenceStyleID]=i}return n}function E(n){if(!n)return F[D[0].referenceStyleID].getDefaultVariant().getId();if(typeof n=="string"||n instanceof String)return n.trim().toLowerCase();if(n instanceof k)return n.getId();if(n instanceof $)return n.getDefaultVariant().getId()}const F=oe();function ce(n,e,t){let i=e[0],r=e[1],s=t[0]-i,a=t[1]-r;if(s!==0||a!==0){const c=((n[0]-i)*s+(n[1]-r)*a)/(s*s+a*a);c>1?(i=t[0],r=t[1]):c>0&&(i+=s*c,r+=a*c)}return s=n[0]-i,a=n[1]-r,s*s+a*a}function P(n,e,t,i,r){let s=i,a;for(let c=e+1;c<t;c++){const o=ce(n[c],n[e],n[t]);o>s&&(a=c,s=o)}s>i&&(a-e>1&&P(n,e,a,i,r),r.push(n[a]),t-a>1&&P(n,a,t,i,r))}function le(n,e){const t=n.length-1,i=[n[0]];return P(n,0,t,e,i),i.push(n[t]),i}function pe(n,e){if(n.length<=2)return n;const t=e!==void 0?e*e:1;return le(n,t)}function w(n,e=!0){let t=`${n[0]},${n[1]}`;return n.length===3&&e&&(t+=`,${n[2]}`),t}function N(n,e=3e3){let t=n.map(s=>s.join(",")).join("|"),i=5e-6;const r=1e-5;for(;t.length>e;)t=pe(n,i).map(s=>`${s[0]},${s[1]}`).join("|"),i+=r;return t}function me(n,e,t={}){var i,r,s,a,c;const o=E(t.style),l=t.hiDPI?"@2x":"",f=(i=t.format)!=null?i:"png";let d=~~((r=t.width)!=null?r:1024),m=~~((s=t.height)!=null?s:1024);t.hiDPI&&(d=~~(d/2),m=~~(m/2));const p=new URL(`maps/${encodeURIComponent(o)}/static/${n[0]},${n[1]},${e}/${d}x${m}${l}.${f}`,g.maptilerApiURL);if("attribution"in t&&p.searchParams.set("attribution",t.attribution.toString()),"markers"in t){let h="";const v="markerIcon"in t;v&&(h+=`icon:${t.markerIcon}|`),v&&"markerAnchor"in t&&(h+=`anchor:${t.markerAnchor}|`),v&&t.hiDPI&&(h+="scale:2|");const b=Array.isArray(t.markers[0])?t.markers:[t.markers];h+=b.map(ge=>w(ge,!v)).join("|"),p.searchParams.set("markers",h)}if("path"in t){let h="";if(h+=`fill:${(a=t.pathFillColor)!=null?a:"none"}|`,"pathStrokeColor"in t&&(h+=`stroke:${t.pathStrokeColor}|`),"pathWidth"in t){const v=t.pathWidth/(t.hiDPI?2:1);h+=`width:${v.toString()}|`}h+=N(t.path),p.searchParams.set("path",h)}return p.searchParams.set("key",(c=t.apiKey)!=null?c:y.apiKey),p.toString()}function he(n,e={}){var t,i,r,s,a;const c=E(e.style),o=e.hiDPI?"@2x":"",l=(t=e.format)!=null?t:"png";let f=~~((i=e.width)!=null?i:1024),d=~~((r=e.height)!=null?r:1024);e.hiDPI&&(f=~~(f/2),d=~~(d/2));const m=new URL(`maps/${encodeURIComponent(c)}/static/${n[0]},${n[1]},${n[2]},${n[3]}/${f}x${d}${o}.${l}`,g.maptilerApiURL);if("attribution"in e&&m.searchParams.set("attribution",e.attribution.toString()),"padding"in e&&m.searchParams.set("padding",e.padding.toString()),"markers"in e){let p="";const h="markerIcon"in e;h&&(p+=`icon:${e.markerIcon}|`),h&&"markerAnchor"in e&&(p+=`anchor:${e.markerAnchor}|`),h&&e.hiDPI&&(p+="scale:2|");const v=Array.isArray(e.markers[0])?e.markers:[e.markers];p+=v.map(b=>w(b,!h)).join("|"),m.searchParams.set("markers",p)}if("path"in e){let p="";if(p+=`fill:${(s=e.pathFillColor)!=null?s:"none"}|`,"pathStrokeColor"in e&&(p+=`stroke:${e.pathStrokeColor}|`),"pathWidth"in e){const h=e.pathWidth/(e.hiDPI?2:1);p+=`width:${h.toString()}|`}p+=N(e.path),m.searchParams.set("path",p)}return m.searchParams.set("key",(a=e.apiKey)!=null?a:y.apiKey),m.toString()}function ue(n={}){var e,t,i,r,s;if(!("markers"in n)&&!("path"in n))throw new Error("Automatic static maps require markers and/or path to be created.");const a=E(n.style),c=n.hiDPI?"@2x":"",o=(e=n.format)!=null?e:"png";let l=~~((t=n.width)!=null?t:1024),f=~~((i=n.height)!=null?i:1024);n.hiDPI&&(l=~~(l/2),f=~~(f/2));const d=new URL(`maps/${encodeURIComponent(a)}/static/auto/${l}x${f}${c}.${o}`,g.maptilerApiURL);if("attribution"in n&&d.searchParams.set("attribution",n.attribution.toString()),"padding"in n&&d.searchParams.set("padding",n.padding.toString()),"markers"in n){let m="";const p="markerIcon"in n;p&&(m+=`icon:${n.markerIcon}|`),p&&"markerAnchor"in n&&(m+=`anchor:${n.markerAnchor}|`),p&&n.hiDPI&&(m+="scale:2|");const h=Array.isArray(n.markers[0])?n.markers:[n.markers];m+=h.map(v=>w(v,!p)).join("|"),d.searchParams.set("markers",m)}if("path"in n){let m="";if(m+=`fill:${(r=n.pathFillColor)!=null?r:"none"}|`,"pathStrokeColor"in n&&(m+=`stroke:${n.pathStrokeColor}|`),"pathWidth"in n){const p=n.pathWidth/(n.hiDPI?2:1);m+=`width:${p.toString()}|`}m+=N(n.path),d.searchParams.set("path",m)}return d.searchParams.set("key",(s=n.apiKey)!=null?s:y.apiKey),d.toString()}const de={centered:me,bounded:he,automatic:ue};u.ClientConfig=C,u.LanguageGeocoding=S,u.MapStyle=F,u.MapStyleVariant=k,u.ReferenceMapStyle=$,u.ServiceError=A,u.config=y,u.coordinates=ne,u.data=ae,u.expandMapStyle=M,u.geocoding=Z,u.geolocation=X,u.mapStylePresetList=D,u.staticMaps=de,Object.defineProperty(u,"__esModule",{value:!0})});
|