@maptiler/client 1.0.2 → 1.1.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.
Files changed (120) hide show
  1. package/.github/workflows/npm-publish.yml +0 -1
  2. package/dist/maptiler-client.cjs +465 -21
  3. package/dist/maptiler-client.cjs.map +1 -1
  4. package/dist/maptiler-client.d.ts +395 -2
  5. package/dist/maptiler-client.min.mjs +1 -1
  6. package/dist/maptiler-client.mjs +461 -22
  7. package/dist/maptiler-client.mjs.map +1 -1
  8. package/dist/maptiler-client.umd.js +465 -21
  9. package/dist/maptiler-client.umd.js.map +1 -1
  10. package/dist/maptiler-client.umd.min.js +1 -1
  11. package/docs/assets/custom.css +118 -0
  12. package/docs/assets/highlight.css +10 -10
  13. package/docs/assets/main.js +56 -52
  14. package/docs/assets/search.js +1 -1
  15. package/docs/assets/style.css +23 -0
  16. package/docs/classes/{ClientConfig.html → config.ClientConfig.html} +34 -24
  17. package/docs/classes/{ServiceError.html → services_ServiceError.ServiceError.html} +26 -16
  18. package/docs/functions/language.getAutoLanguageGeocoding.html +60 -0
  19. package/docs/functions/services_simplify.default.html +65 -0
  20. package/docs/images/maptiler-logo-256.png +0 -0
  21. package/docs/index.html +118 -57
  22. package/docs/modules/config.html +71 -0
  23. package/docs/modules/language.html +71 -0
  24. package/docs/modules/services_ServiceError.html +61 -0
  25. package/docs/modules/services_coordinates.html +84 -0
  26. package/docs/modules/services_data.html +66 -0
  27. package/docs/modules/services_geocoding.html +76 -0
  28. package/docs/modules/services_geolocation.html +68 -0
  29. package/docs/modules/services_simplify.html +61 -0
  30. package/docs/modules/services_staticMaps.html +74 -0
  31. package/docs/modules.html +23 -83
  32. package/docs/types/config.FetchFunction.html +71 -0
  33. package/docs/types/language.LanguageGeocodingString.html +58 -0
  34. package/docs/types/services_coordinates.CoordinateExport.html +71 -0
  35. package/docs/types/services_coordinates.CoordinateGrid.html +69 -0
  36. package/docs/types/services_coordinates.CoordinateId.html +71 -0
  37. package/docs/types/services_coordinates.CoordinateSearch.html +93 -0
  38. package/docs/types/services_coordinates.CoordinateSearchResult.html +75 -0
  39. package/docs/types/services_coordinates.CoordinateTransformResult.html +76 -0
  40. package/docs/types/services_coordinates.CoordinateTransformation.html +89 -0
  41. package/docs/types/services_coordinates.CoordinatesSearchOptions.html +83 -0
  42. package/docs/types/services_coordinates.CoordinatesTransformOptions.html +85 -0
  43. package/docs/types/services_coordinates.XYZ.html +73 -0
  44. package/docs/types/services_data.GetDataOptions.html +64 -0
  45. package/docs/types/services_geocoding.Coordinates.html +60 -0
  46. package/docs/types/services_geocoding.FeatureHierarchy.html +71 -0
  47. package/docs/types/services_geocoding.GeocodingFeature.html +60 -0
  48. package/docs/types/services_geocoding.GeocodingOptions.html +79 -0
  49. package/docs/types/services_geocoding.GeocodingSearchResult.html +77 -0
  50. package/docs/types/services_geocoding.ReverseGeocodingOptions.html +71 -0
  51. package/docs/types/services_geolocation.GeolocationInfoOptions.html +65 -0
  52. package/docs/types/services_geolocation.GeolocationResult.html +128 -0
  53. package/docs/types/services_staticMaps.AutomaticStaticMapOptions.html +61 -0
  54. package/docs/types/services_staticMaps.BoundedStaticMapOptions.html +61 -0
  55. package/docs/types/services_staticMaps.CenteredStaticMapOptions.html +61 -0
  56. package/docs/types/{StaticMapBaseOptions.html → services_staticMaps.StaticMapBaseOptions.html} +26 -45
  57. package/docs/types/services_staticMaps.StaticMapMarker.html +61 -0
  58. package/docs/variables/config.config.html +58 -0
  59. package/docs/variables/{LanguageGeocoding.html → language.LanguageGeocoding.html} +20 -42
  60. package/docs/variables/services_coordinates.coordinates.html +110 -0
  61. package/docs/variables/services_data.data.html +80 -0
  62. package/docs/variables/{geocoding.html → services_geocoding.geocoding.html} +35 -53
  63. package/docs/variables/services_geolocation.geolocation.html +79 -0
  64. package/docs/variables/services_staticMaps.staticMaps.html +128 -0
  65. package/docsmd/README.md +143 -36
  66. package/docsmd/assets/custom.css +118 -0
  67. package/docsmd/classes/ClientConfig.md +5 -5
  68. package/docsmd/classes/MapStyleVariant.md +217 -0
  69. package/docsmd/classes/ReferenceMapStyle.md +169 -0
  70. package/docsmd/classes/ServiceError.md +3 -3
  71. package/examples/test-browser-umd.html +1 -1
  72. package/images/maptiler-logo-256.png +0 -0
  73. package/package.json +5 -5
  74. package/readme.md +65 -5
  75. package/src/index.ts +17 -0
  76. package/src/mapstyle.ts +841 -0
  77. package/src/services/staticMaps.ts +5 -4
  78. package/tsconfig.json +0 -1
  79. package/typedoc.css +118 -0
  80. package/typedoc.json +7 -3
  81. package/docs/types/AutomaticStaticMapOptions.html +0 -80
  82. package/docs/types/BoundedStaticMapOptions.html +0 -80
  83. package/docs/types/CenteredStaticMapOptions.html +0 -80
  84. package/docs/types/CoordinateExport.html +0 -85
  85. package/docs/types/CoordinateGrid.html +0 -83
  86. package/docs/types/CoordinateId.html +0 -85
  87. package/docs/types/CoordinateSearch.html +0 -107
  88. package/docs/types/CoordinateSearchResult.html +0 -89
  89. package/docs/types/CoordinateTransformResult.html +0 -90
  90. package/docs/types/CoordinateTransformation.html +0 -103
  91. package/docs/types/Coordinates.html +0 -78
  92. package/docs/types/CoordinatesSearchOptions.html +0 -97
  93. package/docs/types/CoordinatesTransformOptions.html +0 -99
  94. package/docs/types/FeatureHierarchy.html +0 -89
  95. package/docs/types/FetchFunction.html +0 -93
  96. package/docs/types/GeocodingFeature.html +0 -78
  97. package/docs/types/GeocodingOptions.html +0 -97
  98. package/docs/types/GeocodingSearchResult.html +0 -95
  99. package/docs/types/GeolocationInfoOptions.html +0 -87
  100. package/docs/types/GeolocationResult.html +0 -150
  101. package/docs/types/GetDataOptions.html +0 -87
  102. package/docs/types/LanguageGeocodingString.html +0 -80
  103. package/docs/types/ReverseGeocodingOptions.html +0 -89
  104. package/docs/types/StaticMapMarker.html +0 -80
  105. package/docs/types/XYZ.html +0 -87
  106. package/docs/variables/config.html +0 -80
  107. package/docs/variables/coordinates-1.html +0 -124
  108. package/docs/variables/data.html +0 -103
  109. package/docs/variables/geolocation.html +0 -101
  110. package/docs/variables/staticMaps.html +0 -147
  111. package/docsmd/images/JS-logo.svg +0 -4
  112. package/docsmd/images/TS-logo.svg +0 -6
  113. package/docsmd/images/maptiler-client-logo.afdesign +0 -0
  114. package/docsmd/images/maptiler-client-logo.svg +0 -75
  115. package/docsmd/images/maptiler-logo.svg +0 -23
  116. package/docsmd/images/screenshots/static-bounded-europe-1024.png +0 -0
  117. package/docsmd/images/screenshots/static-bounded-europe-2048.png +0 -0
  118. package/docsmd/images/screenshots/static-bounded-portugal-1024x2048.png +0 -0
  119. package/docsmd/images/screenshots/static-bounded-portugal-2048x2048.png +0 -0
  120. package/docsmd/images/screenshots/static-with-path.png +0 -0
@@ -524,6 +524,399 @@ declare const data: {
524
524
  get: typeof get;
525
525
  };
526
526
 
527
+ /**
528
+ * Type for object containing style details
529
+ */
530
+ type MapStylePreset = {
531
+ referenceStyleID: string;
532
+ name: string;
533
+ description: string;
534
+ variants: Array<{
535
+ id: string;
536
+ name: string;
537
+ variantType: string;
538
+ description: string;
539
+ imageURL: string;
540
+ }>;
541
+ };
542
+ /**
543
+ * An instance of MapStyleVariant contains information about a style to use that belong to a reference style
544
+ */
545
+ declare class MapStyleVariant {
546
+ /**
547
+ * Human-friendly name
548
+ */
549
+ private name;
550
+ /**
551
+ * Variant name the variant is addressed to from its reference style: `MapStyle.REFERNCE_STYLE_NAME.VARIANT_TYPE`
552
+ */
553
+ private variantType;
554
+ /**
555
+ * MapTiler Cloud id
556
+ */
557
+ private id;
558
+ /**
559
+ * Reference map style, used to retrieve sibling variants
560
+ */
561
+ private referenceStyle;
562
+ /**
563
+ * Human-friendly description
564
+ */
565
+ private description;
566
+ /**
567
+ * URL to an image describing the style variant
568
+ */
569
+ private imageURL;
570
+ constructor(
571
+ /**
572
+ * Human-friendly name
573
+ */
574
+ name: string,
575
+ /**
576
+ * Variant name the variant is addressed to from its reference style: `MapStyle.REFERNCE_STYLE_NAME.VARIANT_TYPE`
577
+ */
578
+ variantType: string,
579
+ /**
580
+ * MapTiler Cloud id
581
+ */
582
+ id: string,
583
+ /**
584
+ * Reference map style, used to retrieve sibling variants
585
+ */
586
+ referenceStyle: ReferenceMapStyle,
587
+ /**
588
+ * Human-friendly description
589
+ */
590
+ description: string,
591
+ /**
592
+ * URL to an image describing the style variant
593
+ */
594
+ imageURL: string);
595
+ /**
596
+ * Get the human-friendly name
597
+ * @returns
598
+ */
599
+ getName(): string;
600
+ getFullName(): string;
601
+ /**
602
+ * Get the variant type (eg. "DEFAULT", "DARK", "PASTEL", etc.)
603
+ * @returns
604
+ */
605
+ getType(): string;
606
+ /**
607
+ * Get the MapTiler Cloud id
608
+ * @returns
609
+ */
610
+ getId(): string;
611
+ /**
612
+ * Get the human-friendly description
613
+ */
614
+ getDescription(): string;
615
+ /**
616
+ * Get the reference style this variant belongs to
617
+ * @returns
618
+ */
619
+ getReferenceStyle(): ReferenceMapStyle;
620
+ /**
621
+ * Check if a variant of a given type exists for _this_ variants
622
+ * (eg. if this is a "DARK", then we can check if there is a "LIGHT" variant of it)
623
+ * @param variantType
624
+ * @returns
625
+ */
626
+ hasVariant(variantType: string): boolean;
627
+ /**
628
+ * Retrieve the variant of a given type. If not found, will return the "DEFAULT" variant.
629
+ * (eg. _this_ "DARK" variant does not have any "PASTEL" variant, then the "DEFAULT" is returned)
630
+ * @param variantType
631
+ * @returns
632
+ */
633
+ getVariant(variantType: string): MapStyleVariant;
634
+ /**
635
+ * Get all the variants for _this_ variants, except _this_ current one
636
+ * @returns
637
+ */
638
+ getVariants(): Array<MapStyleVariant>;
639
+ /**
640
+ * Get the image URL that represent _this_ variant
641
+ * @returns
642
+ */
643
+ getImageURL(): string;
644
+ }
645
+ /**
646
+ * An instance of reference style contains a list of StyleVariants ordered by relevance
647
+ */
648
+ declare class ReferenceMapStyle {
649
+ /**
650
+ * Human-friendly name of this reference style
651
+ */
652
+ private name;
653
+ /**
654
+ * ID of this reference style
655
+ */
656
+ private id;
657
+ /**
658
+ * Variants that belong to this reference style, key being the reference type
659
+ */
660
+ private variants;
661
+ /**
662
+ * Variants that belong to this reference style, ordered by relevance
663
+ */
664
+ private orderedVariants;
665
+ constructor(
666
+ /**
667
+ * Human-friendly name of this reference style
668
+ */
669
+ name: string,
670
+ /**
671
+ * ID of this reference style
672
+ */
673
+ id: string);
674
+ /**
675
+ * Get the human-friendly name of this reference style
676
+ * @returns
677
+ */
678
+ getName(): string;
679
+ /**
680
+ * Get the id of _this_ reference style
681
+ * @returns
682
+ */
683
+ getId(): string;
684
+ /**
685
+ * Add a variant to _this_ reference style
686
+ * @param v
687
+ */
688
+ addVariant(v: MapStyleVariant): void;
689
+ /**
690
+ * Check if a given variant type exists for this reference style
691
+ * @param variantType
692
+ * @returns
693
+ */
694
+ hasVariant(variantType: string): boolean;
695
+ /**
696
+ * Get a given variant. If the given type of variant does not exist for this reference style,
697
+ * then the most relevant default variant is returned instead
698
+ * @param variantType
699
+ * @returns
700
+ */
701
+ getVariant(variantType: string): MapStyleVariant;
702
+ /**
703
+ * Get the list of variants for this reference style
704
+ * @returns
705
+ */
706
+ getVariants(): Array<MapStyleVariant>;
707
+ /**
708
+ * Get the defualt variant for this reference style
709
+ * @returns
710
+ */
711
+ getDefaultVariant(): MapStyleVariant;
712
+ }
713
+ /**
714
+ * All the styles and variants maintained by MapTiler.
715
+ */
716
+ type MapStyleType = {
717
+ /**
718
+ * Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings
719
+ */
720
+ STREETS: ReferenceMapStyle & {
721
+ /**
722
+ * Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings.
723
+ */
724
+ DEFAULT: MapStyleVariant;
725
+ /**
726
+ * Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings, in dark mode.
727
+ */
728
+ DARK: MapStyleVariant;
729
+ /**
730
+ * Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings, in light mode.
731
+ */
732
+ LIGHT: MapStyleVariant;
733
+ /**
734
+ * Suitable for navigation, with high level of detail on urban areas, plenty of POIs and 3D buildings, with a pastel color palette.
735
+ */
736
+ PASTEL: MapStyleVariant;
737
+ };
738
+ /**
739
+ * Suitable for outdoor activities. With elevation isolines and hillshading.
740
+ */
741
+ OUTDOOR: ReferenceMapStyle & {
742
+ /**
743
+ * Suitable for outdoor activities. With elevation isolines and hillshading.
744
+ */
745
+ DEFAULT: MapStyleVariant;
746
+ };
747
+ /**
748
+ * Suitabe for winter outdoor activities. With ski tracks, elevation isolines and hillshading.
749
+ */
750
+ WINTER: ReferenceMapStyle & {
751
+ /**
752
+ * Suitabe for winter outdoor activities. With ski tracks, elevation isolines and hillshading.
753
+ */
754
+ DEFAULT: MapStyleVariant;
755
+ };
756
+ /**
757
+ * High resolution imagery only, without any label.
758
+ */
759
+ SATELLITE: ReferenceMapStyle & {
760
+ /**
761
+ * High resolution imagery only, without any label.
762
+ */
763
+ DEFAULT: MapStyleVariant;
764
+ };
765
+ /**
766
+ * High resolution imagery with labels, political borders and roads.
767
+ */
768
+ HYBRID: ReferenceMapStyle & {
769
+ /**
770
+ * High resolution imagery with labels, political borders and roads.
771
+ */
772
+ DEFAULT: MapStyleVariant;
773
+ };
774
+ /**
775
+ * A minimalist street-oriented style without POI
776
+ */
777
+ BASIC: ReferenceMapStyle & {
778
+ /**
779
+ * A minimalist street-oriented style without POI
780
+ */
781
+ DEFAULT: MapStyleVariant;
782
+ /**
783
+ * A minimalist street-oriented style without POI, in dark mode
784
+ */
785
+ DARK: MapStyleVariant;
786
+ /**
787
+ * A minimalist street-oriented style without POI, in light mode
788
+ */
789
+ LIGHT: MapStyleVariant;
790
+ };
791
+ /**
792
+ * A bright street-oriented style, a nice alternative to `streets`
793
+ */
794
+ BRIGHT: ReferenceMapStyle & {
795
+ /**
796
+ * A bright street-oriented style, a nice alternative to `streets`
797
+ */
798
+ DEFAULT: MapStyleVariant;
799
+ /**
800
+ * A bright street-oriented style, a nice alternative to `streets`, in dark mode
801
+ */
802
+ DARK: MapStyleVariant;
803
+ /**
804
+ * A bright street-oriented style, a nice alternative to `streets`, in light mode
805
+ */
806
+ LIGHT: MapStyleVariant;
807
+ /**
808
+ * A bright street-oriented style, a nice alternative to `streets`, with a soft pastel color palette
809
+ */
810
+ PASTEL: MapStyleVariant;
811
+ };
812
+ /**
813
+ * Classic OpenStreetMap style
814
+ */
815
+ OPENSTREETMAP: ReferenceMapStyle & {
816
+ DEFAULT: MapStyleVariant;
817
+ };
818
+ /**
819
+ * A nice high-contrast, yet less saturated alternative to the `outdoor` style, with hillshading, 3D buildings and fairly high street details
820
+ */
821
+ TOPO: ReferenceMapStyle & {
822
+ /**
823
+ * A nice high-contrast, yet less saturated alternative to the `outdoor` style, with hillshading, 3D buildings and fairly high street details
824
+ */
825
+ DEFAULT: MapStyleVariant;
826
+ /**
827
+ * A nice high-contrast, and high saturation alternative to the `outdoor` style, with hillshading, 3D buildings and fairly high street details
828
+ */
829
+ SHINY: MapStyleVariant;
830
+ /**
831
+ * A nice low-contrast, alternative to the `outdoor` style, with hillshading, 3D buildings and fairly high street details, using a soft pastel color palette
832
+ */
833
+ PASTEL: MapStyleVariant;
834
+ /**
835
+ * A nice very high-contrast, yet less saturated alternative to the `outdoor` style, with hillshading, 3D buildings and fairly high street details
836
+ */
837
+ TOPOGRAPHIQUE: MapStyleVariant;
838
+ };
839
+ /**
840
+ * A nice alternative to `streets` with a soft color palette
841
+ */
842
+ VOYAGER: ReferenceMapStyle & {
843
+ /**
844
+ * A nice alternative to `streets` with a soft color palette
845
+ */
846
+ DEFAULT: MapStyleVariant;
847
+ /**
848
+ * A nice alternative to `streets`, in very dark mode
849
+ */
850
+ DARK: MapStyleVariant;
851
+ /**
852
+ * A nice alternative to `streets`, in light mode
853
+ */
854
+ LIGHT: MapStyleVariant;
855
+ /**
856
+ * A nice alternative to `streets` with a soft sepia color palette and vintage look
857
+ */
858
+ VINTAGE: MapStyleVariant;
859
+ };
860
+ /**
861
+ * A bold very high contrast black and white (no gray!) style for the city
862
+ */
863
+ TONER: ReferenceMapStyle & {
864
+ /**
865
+ * A bold very high contrast black and white (no gray!) style for the city
866
+ */
867
+ DEFAULT: MapStyleVariant;
868
+ /**
869
+ * A bold very high contrast black and white (no gray!) style for the city, without any label
870
+ */
871
+ BACKGROUND: MapStyleVariant;
872
+ /**
873
+ * A bold very high contrast, yet faded, style for the city
874
+ */
875
+ LITE: MapStyleVariant;
876
+ /**
877
+ * A bold very high contrast black and white (no gray!) style for the city, with no building, only roads!
878
+ */
879
+ LINES: MapStyleVariant;
880
+ };
881
+ /**
882
+ * Minimalist style, perfect for data visualization
883
+ */
884
+ STAGE: ReferenceMapStyle & {
885
+ /**
886
+ * Minimalist style, perfect for data visualization
887
+ */
888
+ DEFAULT: MapStyleVariant;
889
+ /**
890
+ * Minimalist style, perfect for data visualization in dark mode
891
+ */
892
+ DARK: MapStyleVariant;
893
+ /**
894
+ * Minimalist style, perfect for data visualization in light mode
895
+ */
896
+ LIGHT: MapStyleVariant;
897
+ };
898
+ /**
899
+ * Explore deep see trenches and mountains, with isolines and depth labels
900
+ */
901
+ OCEAN: ReferenceMapStyle & {
902
+ /**
903
+ * Explore deep see trenches and mountains, with isolines and depth labels
904
+ */
905
+ DEFAULT: MapStyleVariant;
906
+ };
907
+ };
908
+ declare const mapStylePresetList: Array<MapStylePreset>;
909
+ declare function styleToStyle(style: string | ReferenceMapStyle | MapStyleVariant | null | undefined): string;
910
+ /**
911
+ * Contains all the reference map style created by MapTiler team as well as all the variants.
912
+ * For example, `MapStyle.STREETS` and the variants:
913
+ * - `MapStyle.STREETS.DARK`
914
+ * - `MapStyle.STREETS.LIGHT`
915
+ * - `MapStyle.STREETS.PASTEL`
916
+ *
917
+ */
918
+ declare const MapStyle: MapStyleType;
919
+
527
920
  /**
528
921
  * Base set of options that can be provided to all the types of static maps
529
922
  */
@@ -536,7 +929,7 @@ type StaticMapBaseOptions = {
536
929
  * Style of the map (not full style URL). Example: "winter", "streets-v2".
537
930
  * Default: `"streets-v2"`
538
931
  */
539
- style?: string;
932
+ style?: string | ReferenceMapStyle | MapStyleVariant;
540
933
  /**
541
934
  * Double the size of the static map image to support hiDPI/Retina monitors.
542
935
  * Default: `false`
@@ -699,4 +1092,4 @@ declare class ServiceError extends Error {
699
1092
  constructor(res: Response, customMessage?: string);
700
1093
  }
701
1094
 
702
- export { AutomaticStaticMapOptions, BoundedStaticMapOptions, CenteredStaticMapOptions, ClientConfig, CoordinateExport, CoordinateGrid, CoordinateId, CoordinateSearch, CoordinateSearchResult, CoordinateTransformResult, CoordinateTransformation, Coordinates, CoordinatesSearchOptions, CoordinatesTransformOptions, FeatureHierarchy, FetchFunction, GeocodingFeature, GeocodingOptions, GeocodingSearchResult, GeolocationInfoOptions, GeolocationResult, GetDataOptions, LanguageGeocoding, LanguageGeocodingString, ReverseGeocodingOptions, ServiceError, StaticMapBaseOptions, StaticMapMarker, XYZ, config, coordinates, data, geocoding, geolocation, staticMaps };
1095
+ export { AutomaticStaticMapOptions, BoundedStaticMapOptions, CenteredStaticMapOptions, ClientConfig, CoordinateExport, CoordinateGrid, CoordinateId, CoordinateSearch, CoordinateSearchResult, CoordinateTransformResult, CoordinateTransformation, Coordinates, CoordinatesSearchOptions, CoordinatesTransformOptions, FeatureHierarchy, FetchFunction, GeocodingFeature, GeocodingOptions, GeocodingSearchResult, GeolocationInfoOptions, GeolocationResult, GetDataOptions, LanguageGeocoding, LanguageGeocodingString, MapStyle, MapStylePreset, MapStyleType, MapStyleVariant, ReferenceMapStyle, ReverseGeocodingOptions, ServiceError, StaticMapBaseOptions, StaticMapMarker, XYZ, config, coordinates, data, geocoding, geolocation, mapStylePresetList, staticMaps, styleToStyle };
@@ -1 +1 @@
1
- function j(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}class E{constructor(){this._apiKey="",this._fetch=j()}set apiKey(e){this._apiKey=e}get apiKey(){return this._apiKey}set fetch(e){this._fetch=e}get fetch(){return this._fetch}}const g=new E,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"},T=new Set(Object.values(S));function L(){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=>T.has(e));return n.length?n[0]:S.ENGLISH}var O=(n,e,t)=>new Promise((s,r)=>{var o=i=>{try{c(t.next(i))}catch(l){r(l)}},a=i=>{try{c(t.throw(i))}catch(l){r(l)}},c=i=>i.done?s(i.value):Promise.resolve(i.value).then(o,a);c((t=t.apply(n,e)).next())});function k(n){return O(this,arguments,function*(e,t={}){if(g.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 g.fetch(e,t)})}const f={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(f);class I extends Error{constructor(e,t=""){super(`Call to enpoint ${e.url} failed with the status code ${e.status}. ${t}`),this.res=e}}var U=(n,e,t)=>new Promise((s,r)=>{var o=i=>{try{c(t.next(i))}catch(l){r(l)}},a=i=>{try{c(t.throw(i))}catch(l){r(l)}},c=i=>i.done?s(i.value):Promise.resolve(i.value).then(o,a);c((t=t.apply(n,e)).next())});const w={400:"Query too long / Invalid parameters",403:"Key is missing, invalid or restricted"};function H(n){return U(this,arguments,function*(e,t={}){var s;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`,f.maptilerApiURL);if(r.searchParams.set("key",(s=t.apiKey)!=null?s:g.apiKey),"bbox"in t&&r.searchParams.set("bbox",t.bbox.join(",")),"proximity"in t&&r.searchParams.set("proximity",t.proximity.join(",")),"language"in t){const c=Array.from(new Set((Array.isArray(t.language)?t.language:[t.language]).map(i=>i===S.AUTO?L():i))).join(",");r.searchParams.set("language",c)}const o=r.toString(),a=yield k(o);if(!a.ok)throw new I(a,a.status in w?w[a.status]:"");return yield a.json()})}function D(n){return U(this,arguments,function*(e,t={}){var s;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`,f.maptilerApiURL);if(r.searchParams.set("key",(s=t.apiKey)!=null?s:g.apiKey),"language"in t){const c=Array.from(new Set((Array.isArray(t.language)?t.language:[t.language]).map(i=>i===S.AUTO?L():i))).join(",");r.searchParams.set("language",c)}const o=r.toString(),a=yield k(o);if(!a.ok)throw new I(a,a.status in w?w[a.status]:"");return yield a.json()})}const G={forward:H,reverse:D,language:S};var M=(n,e,t)=>new Promise((s,r)=>{var o=i=>{try{c(t.next(i))}catch(l){r(l)}},a=i=>{try{c(t.throw(i))}catch(l){r(l)}},c=i=>i.done?s(i.value):Promise.resolve(i.value).then(o,a);c((t=t.apply(n,e)).next())});const C={403:"Key is missing, invalid or restricted"};function _(){return M(this,arguments,function*(n={}){var e;const t=new URL("geolocation/ip.json",f.maptilerApiURL);t.searchParams.set("key",(e=n.apiKey)!=null?e:g.apiKey);const s=t.toString(),r=yield k(s);if(!r.ok)throw new I(r,r.status in C?C[r.status]:"");return yield r.json()})}const B={info:_};var K=(n,e,t)=>new Promise((s,r)=>{var o=i=>{try{c(t.next(i))}catch(l){r(l)}},a=i=>{try{c(t.throw(i))}catch(l){r(l)}},c=i=>i.done?s(i.value):Promise.resolve(i.value).then(o,a);c((t=t.apply(n,e)).next())});const $={403:"Key is missing, invalid or restricted"};function W(n){return K(this,arguments,function*(e,t={}){var s;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`,f.maptilerApiURL);r.searchParams.set("key",(s=t.apiKey)!=null?s:g.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 o=r.toString(),a=yield k(o);if(!a.ok)throw new I(a,a.status in $?$[a.status]:"");return yield a.json()})}function F(n){return K(this,arguments,function*(e,t={}){var s;const r=(Array.isArray(e[0])?e:[e]).map(i=>`${i[0]},${i[1]}`).join(";"),o=new URL(`coordinates/transform/${r}.json`,f.maptilerApiURL);o.searchParams.set("key",(s=t.apiKey)!=null?s:g.apiKey),"sourceCrs"in t&&o.searchParams.set("s_srs",t.sourceCrs.toString()),"targetCrs"in t&&o.searchParams.set("t_srs",t.targetCrs.toString()),"operations"in t&&o.searchParams.set("ops",(Array.isArray(t.operations)?t.operations:[t.operations]).join("|"));const a=o.toString(),c=yield k(a);if(!c.ok)throw new I(c,c.status in $?$[c.status]:"");return yield c.json()})}const q={search:W,transform:F};var z=(n,e,t)=>new Promise((s,r)=>{var o=i=>{try{c(t.next(i))}catch(l){r(l)}},a=i=>{try{c(t.throw(i))}catch(l){r(l)}},c=i=>i.done?s(i.value):Promise.resolve(i.value).then(o,a);c((t=t.apply(n,e)).next())});const b={403:"Key is missing, invalid or restricted"};function J(n){return z(this,arguments,function*(e,t={}){var s;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`,f.maptilerApiURL);r.searchParams.set("key",(s=t.apiKey)!=null?s:g.apiKey);const o=r.toString(),a=yield k(o);if(!a.ok)throw new I(a,a.status in b?b[a.status]:"");return yield a.json()})}const V={get:J};function Z(n,e,t){let s=e[0],r=e[1],o=t[0]-s,a=t[1]-r;if(o!==0||a!==0){const c=((n[0]-s)*o+(n[1]-r)*a)/(o*o+a*a);c>1?(s=t[0],r=t[1]):c>0&&(s+=o*c,r+=a*c)}return o=n[0]-s,a=n[1]-r,o*o+a*a}function N(n,e,t,s,r){let o=s,a;for(let c=e+1;c<t;c++){const i=Z(n[c],n[e],n[t]);i>o&&(a=c,o=i)}o>s&&(a-e>1&&N(n,e,a,s,r),r.push(n[a]),t-a>1&&N(n,a,t,s,r))}function Q(n,e){const t=n.length-1,s=[n[0]];return N(n,0,t,e,s),s.push(n[t]),s}function X(n,e){if(n.length<=2)return n;const t=e!==void 0?e*e:1;return Q(n,t)}function R(n,e=!0){let t=`${n[0]},${n[1]}`;return n.length===3&&e&&(t+=`,${n[2]}`),t}function v(n,e=3e3){let t=n.map(o=>o.join(",")).join("|"),s=5e-6;const r=1e-5;for(;t.length>e;)t=X(n,s).map(o=>`${o[0]},${o[1]}`).join("|"),s+=r;return t}function Y(n,e,t={}){var s,r,o,a,c,i;const l=(s=t.style)!=null?s:f.mapStyle,d=t.hiDPI?"@2x":"",A=(r=t.format)!=null?r:"png";let p=~~((o=t.width)!=null?o:1024),u=~~((a=t.height)!=null?a:1024);t.hiDPI&&(p=~~(p/2),u=~~(u/2));const h=new URL(`maps/${encodeURIComponent(l)}/static/${n[0]},${n[1]},${e}/${p}x${u}${d}.${A}`,f.maptilerApiURL);if("attribution"in t&&h.searchParams.set("attribution",t.attribution.toString()),"markers"in t){let m="";const y="markerIcon"in t;y&&(m+=`icon:${t.markerIcon}|`),y&&"markerAnchor"in t&&(m+=`anchor:${t.markerAnchor}|`),y&&t.hiDPI&&(m+="scale:2|");const P=Array.isArray(t.markers[0])?t.markers:[t.markers];m+=P.map(x=>R(x,!y)).join("|"),h.searchParams.set("markers",m)}if("path"in t){let m="";if(m+=`fill:${(c=t.pathFillColor)!=null?c:"none"}|`,"pathStrokeColor"in t&&(m+=`stroke:${t.pathStrokeColor}|`),"pathWidth"in t){const y=t.pathWidth/(t.hiDPI?2:1);m+=`width:${y.toString()}|`}m+=v(t.path),h.searchParams.set("path",m)}return h.searchParams.set("key",(i=t.apiKey)!=null?i:g.apiKey),h.toString()}function tt(n,e={}){var t,s,r,o,a,c;const i=(t=e.style)!=null?t:f.mapStyle,l=e.hiDPI?"@2x":"",d=(s=e.format)!=null?s:"png";let A=~~((r=e.width)!=null?r:1024),p=~~((o=e.height)!=null?o:1024);e.hiDPI&&(A=~~(A/2),p=~~(p/2));const u=new URL(`maps/${encodeURIComponent(i)}/static/${n[0]},${n[1]},${n[2]},${n[3]}/${A}x${p}${l}.${d}`,f.maptilerApiURL);if("attribution"in e&&u.searchParams.set("attribution",e.attribution.toString()),"padding"in e&&u.searchParams.set("padding",e.padding.toString()),"markers"in e){let h="";const m="markerIcon"in e;m&&(h+=`icon:${e.markerIcon}|`),m&&"markerAnchor"in e&&(h+=`anchor:${e.markerAnchor}|`),m&&e.hiDPI&&(h+="scale:2|");const y=Array.isArray(e.markers[0])?e.markers:[e.markers];h+=y.map(P=>R(P,!m)).join("|"),u.searchParams.set("markers",h)}if("path"in e){let h="";if(h+=`fill:${(a=e.pathFillColor)!=null?a:"none"}|`,"pathStrokeColor"in e&&(h+=`stroke:${e.pathStrokeColor}|`),"pathWidth"in e){const m=e.pathWidth/(e.hiDPI?2:1);h+=`width:${m.toString()}|`}h+=v(e.path),u.searchParams.set("path",h)}return u.searchParams.set("key",(c=e.apiKey)!=null?c:g.apiKey),u.toString()}function et(n={}){var e,t,s,r,o,a;if(!("markers"in n)&&!("path"in n))throw new Error("Automatic static maps require markers and/or path to be created.");const c=(e=n.style)!=null?e:f.mapStyle,i=n.hiDPI?"@2x":"",l=(t=n.format)!=null?t:"png";let d=~~((s=n.width)!=null?s:1024),A=~~((r=n.height)!=null?r:1024);n.hiDPI&&(d=~~(d/2),A=~~(A/2));const p=new URL(`maps/${encodeURIComponent(c)}/static/auto/${d}x${A}${i}.${l}`,f.maptilerApiURL);if("attribution"in n&&p.searchParams.set("attribution",n.attribution.toString()),"padding"in n&&p.searchParams.set("padding",n.padding.toString()),"markers"in n){let u="";const h="markerIcon"in n;h&&(u+=`icon:${n.markerIcon}|`),h&&"markerAnchor"in n&&(u+=`anchor:${n.markerAnchor}|`),h&&n.hiDPI&&(u+="scale:2|");const m=Array.isArray(n.markers[0])?n.markers:[n.markers];u+=m.map(y=>R(y,!h)).join("|"),p.searchParams.set("markers",u)}if("path"in n){let u="";if(u+=`fill:${(o=n.pathFillColor)!=null?o:"none"}|`,"pathStrokeColor"in n&&(u+=`stroke:${n.pathStrokeColor}|`),"pathWidth"in n){const h=n.pathWidth/(n.hiDPI?2:1);u+=`width:${h.toString()}|`}u+=v(n.path),p.searchParams.set("path",u)}return p.searchParams.set("key",(a=n.apiKey)!=null?a:g.apiKey),p.toString()}const nt={centered:Y,bounded:tt,automatic:et};export{E as ClientConfig,S as LanguageGeocoding,I as ServiceError,g as config,q as coordinates,V as data,G as geocoding,B as geolocation,nt as staticMaps};
1
+ function V(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}class ${constructor(){this._apiKey="",this._fetch=V()}set apiKey(t){this._apiKey=t}get apiKey(){return this._apiKey}set fetch(t){this._fetch=t}get fetch(){return this._fetch}}const u=new $,A={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"},j=new Set(Object.values(A));function N(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const r=Array.from(new Set(navigator.languages.map(t=>t.split("-")[0]))).filter(t=>j.has(t));return r.length?r[0]:A.ENGLISH}var G=(r,t,e)=>new Promise((i,n)=>{var s=o=>{try{c(e.next(o))}catch(l){n(l)}},a=o=>{try{c(e.throw(o))}catch(l){n(l)}},c=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);c((e=e.apply(r,t)).next())});function S(r){return G(this,arguments,function*(t,e={}){if(u.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(t).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 u.fetch(t,e)})}const y={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(y);class v extends Error{constructor(t,e=""){super(`Call to enpoint ${t.url} failed with the status code ${t.status}. ${e}`),this.res=t}}var b=(r,t,e)=>new Promise((i,n)=>{var s=o=>{try{c(e.next(o))}catch(l){n(l)}},a=o=>{try{c(e.throw(o))}catch(l){n(l)}},c=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);c((e=e.apply(r,t)).next())});const I={400:"Query too long / Invalid parameters",403:"Key is missing, invalid or restricted"};function F(r){return b(this,arguments,function*(t,e={}){var i;if(typeof t!="string"||t.trim().length===0)throw new Error("The query must be a non-empty string");const n=new URL(`geocoding/${encodeURIComponent(t)}.json`,y.maptilerApiURL);if(n.searchParams.set("key",(i=e.apiKey)!=null?i:u.apiKey),"bbox"in e&&n.searchParams.set("bbox",e.bbox.join(",")),"proximity"in e&&n.searchParams.set("proximity",e.proximity.join(",")),"language"in e){const c=Array.from(new Set((Array.isArray(e.language)?e.language:[e.language]).map(o=>o===A.AUTO?N():o))).join(",");n.searchParams.set("language",c)}const s=n.toString(),a=yield S(s);if(!a.ok)throw new v(a,a.status in I?I[a.status]:"");return yield a.json()})}function B(r){return b(this,arguments,function*(t,e={}){var i;if(!Array.isArray(t)||t.length<2)throw new Error("The position must be an array of form [lng, lat].");const n=new URL(`geocoding/${t[0]},${t[1]}.json`,y.maptilerApiURL);if(n.searchParams.set("key",(i=e.apiKey)!=null?i:u.apiKey),"language"in e){const c=Array.from(new Set((Array.isArray(e.language)?e.language:[e.language]).map(o=>o===A.AUTO?N():o))).join(",");n.searchParams.set("language",c)}const s=n.toString(),a=yield S(s);if(!a.ok)throw new v(a,a.status in I?I[a.status]:"");return yield a.json()})}const M={forward:F,reverse:B,language:A};var W=(r,t,e)=>new Promise((i,n)=>{var s=o=>{try{c(e.next(o))}catch(l){n(l)}},a=o=>{try{c(e.throw(o))}catch(l){n(l)}},c=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);c((e=e.apply(r,t)).next())});const C={403:"Key is missing, invalid or restricted"};function _(){return W(this,arguments,function*(r={}){var t;const e=new URL("geolocation/ip.json",y.maptilerApiURL);e.searchParams.set("key",(t=r.apiKey)!=null?t:u.apiKey);const i=e.toString(),n=yield S(i);if(!n.ok)throw new v(n,n.status in C?C[n.status]:"");return yield n.json()})}const q={info:_};var K=(r,t,e)=>new Promise((i,n)=>{var s=o=>{try{c(e.next(o))}catch(l){n(l)}},a=o=>{try{c(e.throw(o))}catch(l){n(l)}},c=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);c((e=e.apply(r,t)).next())});const L={403:"Key is missing, invalid or restricted"};function Y(r){return K(this,arguments,function*(t,e={}){var i;if(typeof t!="string"||t.trim().length===0)throw new Error("The query must be a non-empty string");const n=new URL(`coordinates/search/${t}.json`,y.maptilerApiURL);n.searchParams.set("key",(i=e.apiKey)!=null?i:u.apiKey),"limit"in e&&n.searchParams.set("limit",e.limit.toString()),"transformations"in e&&n.searchParams.set("transformations",e.transformations.toString()),"exports"in e&&n.searchParams.set("exports",e.exports.toString());const s=n.toString(),a=yield S(s);if(!a.ok)throw new v(a,a.status in L?L[a.status]:"");return yield a.json()})}function z(r){return K(this,arguments,function*(t,e={}){var i;const n=(Array.isArray(t[0])?t:[t]).map(o=>`${o[0]},${o[1]}`).join(";"),s=new URL(`coordinates/transform/${n}.json`,y.maptilerApiURL);s.searchParams.set("key",(i=e.apiKey)!=null?i:u.apiKey),"sourceCrs"in e&&s.searchParams.set("s_srs",e.sourceCrs.toString()),"targetCrs"in e&&s.searchParams.set("t_srs",e.targetCrs.toString()),"operations"in e&&s.searchParams.set("ops",(Array.isArray(e.operations)?e.operations:[e.operations]).join("|"));const a=s.toString(),c=yield S(a);if(!c.ok)throw new v(c,c.status in L?L[c.status]:"");return yield c.json()})}const J={search:Y,transform:z};var Z=(r,t,e)=>new Promise((i,n)=>{var s=o=>{try{c(e.next(o))}catch(l){n(l)}},a=o=>{try{c(e.throw(o))}catch(l){n(l)}},c=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);c((e=e.apply(r,t)).next())});const O={403:"Key is missing, invalid or restricted"};function Q(r){return Z(this,arguments,function*(t,e={}){var i;if(typeof t!="string"||t.trim().length===0)throw new Error("The data ID must be a non-empty string");const n=new URL(`data/${encodeURIComponent(t)}/features.json`,y.maptilerApiURL);n.searchParams.set("key",(i=e.apiKey)!=null?i:u.apiKey);const s=n.toString(),a=yield S(s);if(!a.ok)throw new v(a,a.status in O?O[a.status]:"");return yield a.json()})}const X={get:Q};class k{constructor(t,e,i,n,s,a){this.name=t,this.variantType=e,this.id=i,this.referenceStyle=n,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(t){return this.referenceStyle.hasVariant(t)}getVariant(t){return this.referenceStyle.getVariant(t)}getVariants(){return this.referenceStyle.getVariants().filter(t=>t!==this)}getImageURL(){return this.imageURL}}class D{constructor(t,e){this.name=t,this.id=e,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(t){this.variants[t.getType()]=t,this.orderedVariants.push(t)}hasVariant(t){return t in this.variants}getVariant(t){return t in this.variants?this.variants[t]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0]}}const R=[{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-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Winter",variantType:"DEFAULT",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-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:"STAGE",name:"Stage",description:"",variants:[{id:"stage",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"stage-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"stage-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]}];function ee(r){return new Proxy(r,{get(t,e,i){return t.hasVariant(e)?t.getVariant(e):e.toString().toUpperCase()===e?r.getDefaultVariant():Reflect.get(t,e,i)}})}function te(){const r={};for(let t=0;t<R.length;t+=1){const e=R[t],i=ee(new D(e.name,e.referenceStyleID));for(let n=0;n<e.variants.length;n+=1){const s=e.variants[n],a=new k(s.name,s.variantType,s.id,i,s.description,s.imageURL);i.addVariant(a)}r[e.referenceStyleID]=i}return r}function T(r){if(!r)return H[R[0].referenceStyleID].getDefaultVariant().getId();if(typeof r=="string"||r instanceof String)return r.trim().toLowerCase();if(r instanceof k)return r.getId();if(r instanceof D)return r.getDefaultVariant().getId()}const H=te();function re(r,t,e){let i=t[0],n=t[1],s=e[0]-i,a=e[1]-n;if(s!==0||a!==0){const c=((r[0]-i)*s+(r[1]-n)*a)/(s*s+a*a);c>1?(i=e[0],n=e[1]):c>0&&(i+=s*c,n+=a*c)}return s=r[0]-i,a=r[1]-n,s*s+a*a}function E(r,t,e,i,n){let s=i,a;for(let c=t+1;c<e;c++){const o=re(r[c],r[t],r[e]);o>s&&(a=c,s=o)}s>i&&(a-t>1&&E(r,t,a,i,n),n.push(r[a]),e-a>1&&E(r,a,e,i,n))}function ne(r,t){const e=r.length-1,i=[r[0]];return E(r,0,e,t,i),i.push(r[e]),i}function ae(r,t){if(r.length<=2)return r;const e=t!==void 0?t*t:1;return ne(r,e)}function P(r,t=!0){let e=`${r[0]},${r[1]}`;return r.length===3&&t&&(e+=`,${r[2]}`),e}function w(r,t=3e3){let e=r.map(s=>s.join(",")).join("|"),i=5e-6;const n=1e-5;for(;e.length>t;)e=ae(r,i).map(s=>`${s[0]},${s[1]}`).join("|"),i+=n;return e}function ie(r,t,e={}){var i,n,s,a,c;const o=T(e.style),l=e.hiDPI?"@2x":"",f=(i=e.format)!=null?i:"png";let g=~~((n=e.width)!=null?n:1024),m=~~((s=e.height)!=null?s:1024);e.hiDPI&&(g=~~(g/2),m=~~(m/2));const p=new URL(`maps/${encodeURIComponent(o)}/static/${r[0]},${r[1]},${t}/${g}x${m}${l}.${f}`,y.maptilerApiURL);if("attribution"in e&&p.searchParams.set("attribution",e.attribution.toString()),"markers"in e){let h="";const d="markerIcon"in e;d&&(h+=`icon:${e.markerIcon}|`),d&&"markerAnchor"in e&&(h+=`anchor:${e.markerAnchor}|`),d&&e.hiDPI&&(h+="scale:2|");const U=Array.isArray(e.markers[0])?e.markers:[e.markers];h+=U.map(x=>P(x,!d)).join("|"),p.searchParams.set("markers",h)}if("path"in e){let h="";if(h+=`fill:${(a=e.pathFillColor)!=null?a:"none"}|`,"pathStrokeColor"in e&&(h+=`stroke:${e.pathStrokeColor}|`),"pathWidth"in e){const d=e.pathWidth/(e.hiDPI?2:1);h+=`width:${d.toString()}|`}h+=w(e.path),p.searchParams.set("path",h)}return p.searchParams.set("key",(c=e.apiKey)!=null?c:u.apiKey),p.toString()}function se(r,t={}){var e,i,n,s,a;const c=T(t.style),o=t.hiDPI?"@2x":"",l=(e=t.format)!=null?e:"png";let f=~~((i=t.width)!=null?i:1024),g=~~((n=t.height)!=null?n:1024);t.hiDPI&&(f=~~(f/2),g=~~(g/2));const m=new URL(`maps/${encodeURIComponent(c)}/static/${r[0]},${r[1]},${r[2]},${r[3]}/${f}x${g}${o}.${l}`,y.maptilerApiURL);if("attribution"in t&&m.searchParams.set("attribution",t.attribution.toString()),"padding"in t&&m.searchParams.set("padding",t.padding.toString()),"markers"in t){let p="";const h="markerIcon"in t;h&&(p+=`icon:${t.markerIcon}|`),h&&"markerAnchor"in t&&(p+=`anchor:${t.markerAnchor}|`),h&&t.hiDPI&&(p+="scale:2|");const d=Array.isArray(t.markers[0])?t.markers:[t.markers];p+=d.map(U=>P(U,!h)).join("|"),m.searchParams.set("markers",p)}if("path"in t){let p="";if(p+=`fill:${(s=t.pathFillColor)!=null?s:"none"}|`,"pathStrokeColor"in t&&(p+=`stroke:${t.pathStrokeColor}|`),"pathWidth"in t){const h=t.pathWidth/(t.hiDPI?2:1);p+=`width:${h.toString()}|`}p+=w(t.path),m.searchParams.set("path",p)}return m.searchParams.set("key",(a=t.apiKey)!=null?a:u.apiKey),m.toString()}function oe(r={}){var t,e,i,n,s;if(!("markers"in r)&&!("path"in r))throw new Error("Automatic static maps require markers and/or path to be created.");const a=T(r.style),c=r.hiDPI?"@2x":"",o=(t=r.format)!=null?t:"png";let l=~~((e=r.width)!=null?e:1024),f=~~((i=r.height)!=null?i:1024);r.hiDPI&&(l=~~(l/2),f=~~(f/2));const g=new URL(`maps/${encodeURIComponent(a)}/static/auto/${l}x${f}${c}.${o}`,y.maptilerApiURL);if("attribution"in r&&g.searchParams.set("attribution",r.attribution.toString()),"padding"in r&&g.searchParams.set("padding",r.padding.toString()),"markers"in r){let m="";const p="markerIcon"in r;p&&(m+=`icon:${r.markerIcon}|`),p&&"markerAnchor"in r&&(m+=`anchor:${r.markerAnchor}|`),p&&r.hiDPI&&(m+="scale:2|");const h=Array.isArray(r.markers[0])?r.markers:[r.markers];m+=h.map(d=>P(d,!p)).join("|"),g.searchParams.set("markers",m)}if("path"in r){let m="";if(m+=`fill:${(n=r.pathFillColor)!=null?n:"none"}|`,"pathStrokeColor"in r&&(m+=`stroke:${r.pathStrokeColor}|`),"pathWidth"in r){const p=r.pathWidth/(r.hiDPI?2:1);m+=`width:${p.toString()}|`}m+=w(r.path),g.searchParams.set("path",m)}return g.searchParams.set("key",(s=r.apiKey)!=null?s:u.apiKey),g.toString()}const ce={centered:ie,bounded:se,automatic:oe};export{$ as ClientConfig,A as LanguageGeocoding,H as MapStyle,k as MapStyleVariant,D as ReferenceMapStyle,v as ServiceError,u as config,J as coordinates,X as data,M as geocoding,q as geolocation,R as mapStylePresetList,ce as staticMaps,T as styleToStyle};