@yappkit/front-module-map 0.1.1 → 0.1.2

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.
@@ -1,113 +0,0 @@
1
- import { getDefaultExportFromCjs as l } from "../_commonjsHelpers.js";
2
- import { immutable as y } from "./browser-client.js";
3
- import { createServiceFactory_1 as g, validator as b, pick_1 as f } from "./create-service-factory.js";
4
- import { stringifyBooleans as v } from "./stringify-booleans.js";
5
- function O(r, o) {
6
- for (var i = 0; i < o.length; i++) {
7
- const t = o[i];
8
- if (typeof t != "string" && !Array.isArray(t)) {
9
- for (const a in t)
10
- if (a !== "default" && !(a in r)) {
11
- const s = Object.getOwnPropertyDescriptor(t, a);
12
- s && Object.defineProperty(r, a, s.get ? s : {
13
- enumerable: !0,
14
- get: () => t[a]
15
- });
16
- }
17
- }
18
- }
19
- return Object.freeze(Object.defineProperty(r, Symbol.toStringTag, { value: "Module" }));
20
- }
21
- var c = y, e = b, n = f, m = v, x = g, u = {}, p = [
22
- "country",
23
- "region",
24
- "postcode",
25
- "district",
26
- "place",
27
- "locality",
28
- "neighborhood",
29
- "address",
30
- "poi",
31
- "poi.landmark"
32
- ];
33
- u.forwardGeocode = function(r) {
34
- e.assertShape({
35
- query: e.required(e.string),
36
- mode: e.oneOf("mapbox.places", "mapbox.places-permanent"),
37
- countries: e.arrayOf(e.string),
38
- proximity: e.oneOf(e.coordinates, "ip"),
39
- types: e.arrayOf(e.oneOf(p)),
40
- autocomplete: e.boolean,
41
- bbox: e.arrayOf(e.number),
42
- limit: e.number,
43
- language: e.arrayOf(e.string),
44
- routing: e.boolean,
45
- fuzzyMatch: e.boolean,
46
- worldview: e.string
47
- })(r), r.mode = r.mode || "mapbox.places";
48
- var o = m(
49
- c(
50
- { country: r.countries },
51
- n(r, [
52
- "proximity",
53
- "types",
54
- "autocomplete",
55
- "bbox",
56
- "limit",
57
- "language",
58
- "routing",
59
- "fuzzyMatch",
60
- "worldview"
61
- ])
62
- )
63
- );
64
- return this.client.createRequest({
65
- method: "GET",
66
- path: "/geocoding/v5/:mode/:query.json",
67
- params: n(r, ["mode", "query"]),
68
- query: o
69
- });
70
- };
71
- u.reverseGeocode = function(r) {
72
- e.assertShape({
73
- query: e.required(e.coordinates),
74
- mode: e.oneOf("mapbox.places", "mapbox.places-permanent"),
75
- countries: e.arrayOf(e.string),
76
- types: e.arrayOf(e.oneOf(p)),
77
- bbox: e.arrayOf(e.number),
78
- limit: e.number,
79
- language: e.arrayOf(e.string),
80
- reverseMode: e.oneOf("distance", "score"),
81
- routing: e.boolean,
82
- worldview: e.string
83
- })(r), r.mode = r.mode || "mapbox.places";
84
- var o = m(
85
- c(
86
- { country: r.countries },
87
- n(r, [
88
- "country",
89
- "types",
90
- "bbox",
91
- "limit",
92
- "language",
93
- "reverseMode",
94
- "routing",
95
- "worldview"
96
- ])
97
- )
98
- );
99
- return this.client.createRequest({
100
- method: "GET",
101
- path: "/geocoding/v5/:mode/:query.json",
102
- params: n(r, ["mode", "query"]),
103
- query: o
104
- });
105
- };
106
- var d = x(u);
107
- const q = /* @__PURE__ */ l(d), S = /* @__PURE__ */ O({
108
- __proto__: null,
109
- default: q
110
- }, [d]);
111
- export {
112
- S as geocoding
113
- };
@@ -1,82 +0,0 @@
1
- import { getDefaultExportFromCjs as m } from "../_commonjsHelpers.js";
2
- import { createServiceFactory_1 as d, validator as c } from "./create-service-factory.js";
3
- import { objectClean_1 as p } from "./object-clean.js";
4
- import { stringifyBooleans as v } from "./stringify-booleans.js";
5
- function h(e, a) {
6
- for (var s = 0; s < a.length; s++) {
7
- const t = a[s];
8
- if (typeof t != "string" && !Array.isArray(t)) {
9
- for (const o in t)
10
- if (o !== "default" && !(o in e)) {
11
- const i = Object.getOwnPropertyDescriptor(t, o);
12
- i && Object.defineProperty(e, o, i.get ? i : {
13
- enumerable: !0,
14
- get: () => t[o]
15
- });
16
- }
17
- }
18
- }
19
- return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
20
- }
21
- var r = c, y = p, b = v, f = d, u = {};
22
- u.getContours = function(e) {
23
- if (r.assertShape({
24
- profile: r.oneOf("driving", "driving-traffic", "walking", "cycling"),
25
- coordinates: r.coordinates,
26
- minutes: r.arrayOf(r.number),
27
- meters: r.arrayOf(r.number),
28
- colors: r.arrayOf(r.string),
29
- polygons: r.boolean,
30
- denoise: r.number,
31
- generalize: r.number
32
- })(e), e.profile = e.profile || "driving", e.minutes !== void 0 && e.meters !== void 0)
33
- throw new Error("minutes and meters can't be specified at the same time");
34
- var a = e.minutes ? e.minutes : e.meters, s = e.minutes ? "minutes" : "meters", t = a.length;
35
- if (t < 1 || t > 4)
36
- throw new Error(
37
- s + " must contain between 1 and 4 contour values"
38
- );
39
- if (e.colors !== void 0 && a !== void 0 && e.colors.length !== t)
40
- throw new Error(
41
- "colors should have the same number of entries as " + s
42
- );
43
- if (e.minutes !== void 0 && !e.minutes.every(function(n) {
44
- return n <= 60;
45
- }))
46
- throw new Error("minutes must be less than 60");
47
- var o = 1e5;
48
- if (e.meters !== void 0 && !e.meters.every(function(n) {
49
- return n <= o;
50
- }))
51
- throw new Error("meters must be less than " + o);
52
- if (e.generalize && e.generalize < 0)
53
- throw new Error("generalize tolerance must be a positive number");
54
- e.colors && (e.colors = e.colors.map(function(n) {
55
- return n[0] === "#" ? n.substring(1) : n;
56
- }));
57
- var i = b({
58
- contours_minutes: e.minutes ? e.minutes.join(",") : null,
59
- contours_meters: e.meters ? e.meters.join(",") : null,
60
- contours_colors: e.colors ? e.colors.join(",") : null,
61
- polygons: e.polygons,
62
- denoise: e.denoise,
63
- generalize: e.generalize
64
- });
65
- return this.client.createRequest({
66
- method: "GET",
67
- path: "/isochrone/v1/mapbox/:profile/:coordinates",
68
- params: {
69
- profile: e.profile,
70
- coordinates: e.coordinates.join(",")
71
- },
72
- query: y(i)
73
- });
74
- };
75
- var l = f(u);
76
- const w = /* @__PURE__ */ m(l), z = /* @__PURE__ */ h({
77
- __proto__: null,
78
- default: w
79
- }, [l]);
80
- export {
81
- z as isochrone
82
- };
@@ -1,110 +0,0 @@
1
- import { getDefaultExportFromCjs as l } from "../_commonjsHelpers.js";
2
- import { createServiceFactory_1 as u, validator as c } from "./create-service-factory.js";
3
- import { objectClean_1 as m } from "./object-clean.js";
4
- import { urlUtils as y } from "./browser-client.js";
5
- import { stringifyBooleans as d } from "./stringify-booleans.js";
6
- function f(i, o) {
7
- for (var t = 0; t < o.length; t++) {
8
- const n = o[t];
9
- if (typeof n != "string" && !Array.isArray(n)) {
10
- for (const e in n)
11
- if (e !== "default" && !(e in i)) {
12
- const r = Object.getOwnPropertyDescriptor(n, e);
13
- r && Object.defineProperty(i, e, r.get ? r : {
14
- enumerable: !0,
15
- get: () => n[e]
16
- });
17
- }
18
- }
19
- }
20
- return Object.freeze(Object.defineProperty(i, Symbol.toStringTag, { value: "Module" }));
21
- }
22
- var a = c, h = u, g = m, v = y, w = d, s = {};
23
- s.getMatch = function(i) {
24
- a.assertShape({
25
- points: a.required(
26
- a.arrayOf(
27
- a.shape({
28
- coordinates: a.required(a.coordinates),
29
- approach: a.oneOf("unrestricted", "curb"),
30
- radius: a.range([0, 50]),
31
- isWaypoint: a.boolean,
32
- waypointName: a.string,
33
- timestamp: a.date
34
- })
35
- )
36
- ),
37
- profile: a.oneOf("driving-traffic", "driving", "walking", "cycling"),
38
- annotations: a.arrayOf(a.oneOf("duration", "distance", "speed")),
39
- geometries: a.oneOf("geojson", "polyline", "polyline6"),
40
- language: a.string,
41
- overview: a.oneOf("full", "simplified", "false"),
42
- steps: a.boolean,
43
- tidy: a.boolean
44
- })(i);
45
- var o = i.points.length;
46
- if (o < 2 || o > 100)
47
- throw new Error("points must include between 2 and 100 MapMatchingPoints");
48
- i.profile = i.profile || "driving";
49
- var t = {
50
- coordinates: [],
51
- approach: [],
52
- radius: [],
53
- isWaypoint: [],
54
- waypointName: [],
55
- timestamp: []
56
- };
57
- i.points.forEach(function(e) {
58
- t.coordinates.push(e.coordinates[0] + "," + e.coordinates[1]), e.hasOwnProperty("isWaypoint") && e.isWaypoint != null ? t.isWaypoint.push(e.isWaypoint) : t.isWaypoint.push(!0), e.hasOwnProperty("timestamp") && e.timestamp != null ? t.timestamp.push(Number(new Date(e.timestamp))) : t.timestamp.push(""), ["approach", "radius", "waypointName"].forEach(function(r) {
59
- e.hasOwnProperty(r) && e[r] != null ? t[r].push(e[r]) : t[r].push("");
60
- });
61
- }), ["coordinates", "approach", "radius", "waypointName", "timestamp"].forEach(
62
- function(e) {
63
- t[e].every(function(r) {
64
- return r === "";
65
- }) ? delete t[e] : t[e] = t[e].join(";");
66
- }
67
- ), t.isWaypoint[0] = !0, t.isWaypoint[t.isWaypoint.length - 1] = !0, t.isWaypoint.every(function(e) {
68
- return e === !0;
69
- }) ? delete t.isWaypoint : t.isWaypoint = t.isWaypoint.map(function(e, r) {
70
- return e === !0 ? r : "";
71
- }).filter(function(e) {
72
- return e === 0 || !!e;
73
- }).join(";");
74
- var n = w(
75
- g({
76
- annotations: i.annotations,
77
- geometries: i.geometries,
78
- language: i.language,
79
- overview: i.overview,
80
- steps: i.steps,
81
- tidy: i.tidy,
82
- approaches: t.approach,
83
- radiuses: t.radius,
84
- waypoints: t.isWaypoint,
85
- timestamps: t.timestamp,
86
- waypoint_names: t.waypointName,
87
- coordinates: t.coordinates
88
- })
89
- );
90
- return this.client.createRequest({
91
- method: "POST",
92
- path: "/matching/v5/mapbox/:profile",
93
- params: {
94
- profile: i.profile
95
- },
96
- body: v.appendQueryObject("", n).substring(1),
97
- // need to remove the char`?`
98
- headers: {
99
- "content-type": "application/x-www-form-urlencoded"
100
- }
101
- });
102
- };
103
- var p = h(s);
104
- const O = /* @__PURE__ */ l(p), N = /* @__PURE__ */ f({
105
- __proto__: null,
106
- default: O
107
- }, [p]);
108
- export {
109
- N as mapMatching
110
- };
@@ -1,72 +0,0 @@
1
- import { getDefaultExportFromCjs as c } from "../_commonjsHelpers.js";
2
- import { createServiceFactory_1 as u, validator as l } from "./create-service-factory.js";
3
- import { objectClean_1 as d } from "./object-clean.js";
4
- function f(r, n) {
5
- for (var a = 0; a < n.length; a++) {
6
- const o = n[a];
7
- if (typeof o != "string" && !Array.isArray(o)) {
8
- for (const t in o)
9
- if (t !== "default" && !(t in r)) {
10
- const i = Object.getOwnPropertyDescriptor(o, t);
11
- i && Object.defineProperty(r, t, i.get ? i : {
12
- enumerable: !0,
13
- get: () => o[t]
14
- });
15
- }
16
- }
17
- }
18
- return Object.freeze(Object.defineProperty(r, Symbol.toStringTag, { value: "Module" }));
19
- }
20
- var e = l, h = u, y = d, s = {};
21
- s.getMatrix = function(r) {
22
- e.assertShape({
23
- points: e.required(
24
- e.arrayOf(
25
- e.shape({
26
- coordinates: e.required(e.coordinates),
27
- approach: e.oneOf("unrestricted", "curb")
28
- })
29
- )
30
- ),
31
- profile: e.oneOf("driving-traffic", "driving", "walking", "cycling"),
32
- annotations: e.arrayOf(e.oneOf("duration", "distance")),
33
- sources: e.oneOfType(e.equal("all"), e.arrayOf(e.number)),
34
- destinations: e.oneOfType(e.equal("all"), e.arrayOf(e.number))
35
- })(r);
36
- var n = r.points.length;
37
- if (n < 2 || n > 100)
38
- throw new Error("points must include between 2 and 100 MatrixPoints");
39
- r.profile = r.profile || "driving";
40
- var a = {
41
- coordinates: [],
42
- approach: []
43
- };
44
- r.points.forEach(function(t) {
45
- a.coordinates.push(t.coordinates[0] + "," + t.coordinates[1]), t.hasOwnProperty("approach") && t.approach != null ? a.approach.push(t.approach) : a.approach.push("");
46
- }), a.approach.every(function(t) {
47
- return t === "";
48
- }) ? delete a.approach : a.approach = a.approach.join(";");
49
- var o = {
50
- sources: Array.isArray(r.sources) ? r.sources.join(";") : r.sources,
51
- destinations: Array.isArray(r.destinations) ? r.destinations.join(";") : r.destinations,
52
- approaches: a.approach,
53
- annotations: r.annotations && r.annotations.join(",")
54
- };
55
- return this.client.createRequest({
56
- method: "GET",
57
- path: "/directions-matrix/v1/mapbox/:profile/:coordinates",
58
- params: {
59
- profile: r.profile,
60
- coordinates: a.coordinates.join(";")
61
- },
62
- query: y(o)
63
- });
64
- };
65
- var p = h(s);
66
- const m = /* @__PURE__ */ c(p), b = /* @__PURE__ */ f({
67
- __proto__: null,
68
- default: m
69
- }, [p]);
70
- export {
71
- b as matrix
72
- };
@@ -1,11 +0,0 @@
1
- import { pick_1 as t } from "./create-service-factory.js";
2
- var e = t;
3
- function o(n) {
4
- return e(n, function(c, r) {
5
- return r != null;
6
- });
7
- }
8
- var u = o;
9
- export {
10
- u as objectClean_1
11
- };
@@ -1,106 +0,0 @@
1
- import { getDefaultExportFromCjs as d } from "../_commonjsHelpers.js";
2
- import { createServiceFactory_1 as f, validator as c } from "./create-service-factory.js";
3
- import { objectClean_1 as l } from "./object-clean.js";
4
- import { stringifyBooleans as p } from "./stringify-booleans.js";
5
- function m(i, t) {
6
- for (var n = 0; n < t.length; n++) {
7
- const a = t[n];
8
- if (typeof a != "string" && !Array.isArray(a)) {
9
- for (const r in a)
10
- if (r !== "default" && !(r in i)) {
11
- const o = Object.getOwnPropertyDescriptor(a, r);
12
- o && Object.defineProperty(i, r, o.get ? o : {
13
- enumerable: !0,
14
- get: () => a[r]
15
- });
16
- }
17
- }
18
- }
19
- return Object.freeze(Object.defineProperty(i, Symbol.toStringTag, { value: "Module" }));
20
- }
21
- var e = c, b = f, h = l, g = p, s = {};
22
- s.getOptimization = function(i) {
23
- e.assertShape({
24
- profile: e.oneOf("driving", "driving-traffic", "walking", "cycling"),
25
- waypoints: e.required(
26
- e.arrayOf(
27
- e.shape({
28
- coordinates: e.required(e.coordinates),
29
- approach: e.oneOf("unrestricted", "curb"),
30
- bearing: e.arrayOf(e.range([0, 360])),
31
- radius: e.oneOfType(e.number, e.equal("unlimited"))
32
- })
33
- )
34
- ),
35
- annotations: e.arrayOf(e.oneOf("duration", "distance", "speed")),
36
- geometries: e.oneOf("geojson", "polyline", "polyline6"),
37
- language: e.string,
38
- overview: e.oneOf("simplified", "full", "false"),
39
- roundtrip: e.boolean,
40
- steps: e.boolean,
41
- source: e.oneOf("any", "first"),
42
- destination: e.oneOf("any", "last"),
43
- distributions: e.arrayOf(
44
- e.shape({
45
- pickup: e.number,
46
- dropoff: e.number
47
- })
48
- )
49
- })(i);
50
- var t = {
51
- coordinates: [],
52
- approach: [],
53
- bearing: [],
54
- radius: [],
55
- distributions: []
56
- }, n = i.waypoints.length;
57
- if (n < 2)
58
- throw new Error(
59
- "waypoints must include at least 2 OptimizationWaypoints"
60
- );
61
- i.waypoints.forEach(function(r) {
62
- t.coordinates.push(
63
- r.coordinates[0] + "," + r.coordinates[1]
64
- ), ["bearing"].forEach(function(o) {
65
- r.hasOwnProperty(o) && r[o] != null && (r[o] = r[o].join(","));
66
- }), ["approach", "bearing", "radius"].forEach(function(o) {
67
- r.hasOwnProperty(o) && r[o] != null ? t[o].push(r[o]) : t[o].push("");
68
- });
69
- }), i.distributions && i.distributions.forEach(function(r) {
70
- t.distributions.push(r.pickup + "," + r.dropoff);
71
- }), ["approach", "bearing", "radius", "distributions"].forEach(function(r) {
72
- t[r].every(function(o) {
73
- return o === "";
74
- }) ? delete t[r] : t[r] = t[r].join(";");
75
- });
76
- var a = g({
77
- geometries: i.geometries,
78
- language: i.language,
79
- overview: i.overview,
80
- roundtrip: i.roundtrip,
81
- steps: i.steps,
82
- source: i.source,
83
- destination: i.destination,
84
- distributions: t.distributions,
85
- approaches: t.approach,
86
- bearings: t.bearing,
87
- radiuses: t.radius
88
- });
89
- return this.client.createRequest({
90
- method: "GET",
91
- path: "/optimized-trips/v1/mapbox/:profile/:coordinates",
92
- params: {
93
- profile: i.profile || "driving",
94
- coordinates: t.coordinates.join(";")
95
- },
96
- query: h(a)
97
- });
98
- };
99
- var u = b(s);
100
- const v = /* @__PURE__ */ d(u), E = /* @__PURE__ */ m({
101
- __proto__: null,
102
- default: v
103
- }, [u]);
104
- export {
105
- E as optimization
106
- };
@@ -1,197 +0,0 @@
1
- import { getDefaultExportFromCjs as C } from "../_commonjsHelpers.js";
2
- import { createServiceFactory_1 as S, validator as x, pick_1 as _ } from "./create-service-factory.js";
3
- function k(e, n) {
4
- for (var s = 0; s < n.length; s++) {
5
- const d = n[s];
6
- if (typeof d != "string" && !Array.isArray(d)) {
7
- for (const l in d)
8
- if (l !== "default" && !(l in e)) {
9
- const t = Object.getOwnPropertyDescriptor(d, l);
10
- t && Object.defineProperty(e, l, t.get ? t : {
11
- enumerable: !0,
12
- get: () => d[l]
13
- });
14
- }
15
- }
16
- }
17
- return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
18
- }
19
- var g = { exports: {} };
20
- (function(e) {
21
- var n = {};
22
- function s(t) {
23
- return Math.floor(Math.abs(t) + 0.5) * (t >= 0 ? 1 : -1);
24
- }
25
- function d(t, i, a) {
26
- t = s(t * a), i = s(i * a);
27
- var o = (t - i) * 2;
28
- o < 0 && (o = -o - 1);
29
- for (var u = ""; o >= 32; )
30
- u += String.fromCharCode((32 | o & 31) + 63), o /= 32;
31
- return u += String.fromCharCode((o | 0) + 63), u;
32
- }
33
- n.decode = function(t, i) {
34
- for (var a = 0, o = 0, u = 0, y = [], p = 0, f = 0, c = null, b, v, O = Math.pow(10, Number.isInteger(i) ? i : 5); a < t.length; ) {
35
- c = null, p = 1, f = 0;
36
- do
37
- c = t.charCodeAt(a++) - 63, f += (c & 31) * p, p *= 32;
38
- while (c >= 32);
39
- b = f & 1 ? (-f - 1) / 2 : f / 2, p = 1, f = 0;
40
- do
41
- c = t.charCodeAt(a++) - 63, f += (c & 31) * p, p *= 32;
42
- while (c >= 32);
43
- v = f & 1 ? (-f - 1) / 2 : f / 2, o += b, u += v, y.push([o / O, u / O]);
44
- }
45
- return y;
46
- }, n.encode = function(t, i) {
47
- if (!t.length)
48
- return "";
49
- for (var a = Math.pow(10, Number.isInteger(i) ? i : 5), o = d(t[0][0], 0, a) + d(t[0][1], 0, a), u = 1; u < t.length; u++) {
50
- var y = t[u], p = t[u - 1];
51
- o += d(y[0], p[0], a), o += d(y[1], p[1], a);
52
- }
53
- return o;
54
- };
55
- function l(t) {
56
- for (var i = [], a = 0; a < t.length; a++) {
57
- var o = t[a].slice();
58
- i.push([o[1], o[0]]);
59
- }
60
- return i;
61
- }
62
- n.fromGeoJSON = function(t, i) {
63
- if (t && t.type === "Feature" && (t = t.geometry), !t || t.type !== "LineString")
64
- throw new Error("Input must be a GeoJSON LineString");
65
- return n.encode(l(t.coordinates), i);
66
- }, n.toGeoJSON = function(t, i) {
67
- var a = n.decode(t, i);
68
- return {
69
- type: "LineString",
70
- coordinates: l(a)
71
- };
72
- }, e.exports && (e.exports = n);
73
- })(g);
74
- var q = g.exports, E = q, r = x, N = S, I = _, m = {};
75
- m.getStaticImage = function(e) {
76
- r.assertShape({
77
- ownerId: r.required(r.string),
78
- styleId: r.required(r.string),
79
- width: r.required(r.range([1, 1280])),
80
- height: r.required(r.range([1, 1280])),
81
- position: r.required(
82
- r.oneOfType(
83
- r.oneOf("auto"),
84
- r.strictShape({
85
- coordinates: r.required(r.coordinates),
86
- zoom: r.required(r.range([0, 20])),
87
- bearing: r.range([0, 360]),
88
- pitch: r.range([0, 60])
89
- }),
90
- r.strictShape({ bbox: r.required(r.arrayOf(r.number)) })
91
- )
92
- ),
93
- padding: r.string,
94
- overlays: r.arrayOf(r.plainObject),
95
- highRes: r.boolean,
96
- before_layer: r.string,
97
- addlayer: r.plainObject,
98
- setfilter: r.plainArray,
99
- layer_id: r.string,
100
- attribution: r.boolean,
101
- logo: r.boolean
102
- })(e);
103
- var n = (e.overlays || []).map(function(i) {
104
- return i.marker ? M(i.marker) : i.path ? z(i.path) : A(i.geoJson);
105
- }).join(","), s = J(e.position), d = e.width + "x" + e.height;
106
- e.highRes && (d += "@2x");
107
- var l = [n, s, d].filter(Boolean).join("/"), t = {};
108
- if (e.attribution !== void 0 && (t.attribution = String(e.attribution)), e.logo !== void 0 && (t.logo = String(e.logo)), e.before_layer !== void 0 && (t.before_layer = e.before_layer), e.addlayer !== void 0 && (t.addlayer = JSON.stringify(e.addlayer)), e.setfilter !== void 0 && (t.setfilter = JSON.stringify(e.setfilter)), e.layer_id !== void 0 && (t.layer_id = e.layer_id), e.padding !== void 0 && (t.padding = e.padding), e.setfilter !== void 0 && e.layer_id === void 0)
109
- throw new Error("Must include layer_id in setfilter request");
110
- if ((e.setfilter !== void 0 || e.addlayer !== void 0) && e.position === "auto" && e.overlays === void 0)
111
- throw new Error(
112
- "Auto extent cannot be used with style parameters and no overlay"
113
- );
114
- if (e.addlayer !== void 0 && e.setfilter !== void 0)
115
- throw new Error(
116
- "addlayer and setfilter cannot be used in the same request"
117
- );
118
- if (e.padding !== void 0 && e.position !== "auto" && e.position.bbox === void 0)
119
- throw new Error(
120
- "Padding can only be used with auto or bbox as the position."
121
- );
122
- if (e.position.bbox !== void 0 && e.position.bbox.length !== 4)
123
- throw new Error("bbox must be four coordinates");
124
- return this.client.createRequest({
125
- method: "GET",
126
- path: "/styles/v1/:ownerId/:styleId/static/" + l,
127
- params: I(e, ["ownerId", "styleId"]),
128
- query: t,
129
- encoding: "binary"
130
- });
131
- };
132
- function J(e) {
133
- return e === "auto" ? "auto" : e.bbox ? JSON.stringify(e.bbox) : e.coordinates.concat([
134
- e.zoom,
135
- e.pitch && !e.bearing ? 0 : e.bearing,
136
- // if pitch is set, but bearing is not, bearing must be 0
137
- e.pitch === 0 ? void 0 : e.pitch
138
- ]).filter(function(n) {
139
- return n === 0 || n;
140
- }).join(",");
141
- }
142
- function M(e) {
143
- return e.url ? j(e) : P(e);
144
- }
145
- function P(e) {
146
- r.assertShape({
147
- coordinates: r.required(r.coordinates),
148
- size: r.oneOf("large", "small"),
149
- label: r.string,
150
- color: r.string
151
- })(e);
152
- var n = e.size === "large" ? "pin-l" : "pin-s";
153
- return e.label && (n += "-" + String(e.label).toLowerCase()), e.color && (n += "+" + h(e.color)), n += "(" + e.coordinates.join(",") + ")", n;
154
- }
155
- function j(e) {
156
- r.assertShape({
157
- coordinates: r.required(r.coordinates),
158
- url: r.required(r.string)
159
- })(e);
160
- var n = "url-" + encodeURIComponent(e.url);
161
- return n += "(" + e.coordinates.join(",") + ")", n;
162
- }
163
- function z(e) {
164
- if (r.assertShape({
165
- coordinates: r.required(r.arrayOf(r.coordinates)),
166
- strokeWidth: r.number,
167
- strokeColor: r.string,
168
- strokeOpacity: r.number,
169
- fillColor: r.string,
170
- fillOpacity: r.number
171
- })(e), e.strokeOpacity !== void 0 && e.strokeColor === void 0)
172
- throw new Error("strokeOpacity requires strokeColor");
173
- if (e.fillColor !== void 0 && e.strokeColor === void 0)
174
- throw new Error("fillColor requires strokeColor");
175
- if (e.fillOpacity !== void 0 && e.fillColor === void 0)
176
- throw new Error("fillOpacity requires fillColor");
177
- var n = "path";
178
- e.strokeWidth && (n += "-" + e.strokeWidth), e.strokeColor && (n += "+" + h(e.strokeColor)), e.strokeOpacity && (n += "-" + e.strokeOpacity), e.fillColor && (n += "+" + h(e.fillColor)), e.fillOpacity && (n += "-" + e.fillOpacity);
179
- var s = e.coordinates.map(function(l) {
180
- return [l[1], l[0]];
181
- }), d = E.encode(s);
182
- return n += "(" + encodeURIComponent(d) + ")", n;
183
- }
184
- function A(e) {
185
- return r.assert(r.required(r.plainObject))(e), "geojson(" + encodeURIComponent(JSON.stringify(e)) + ")";
186
- }
187
- function h(e) {
188
- return e.replace(/^#/, "");
189
- }
190
- var w = N(m);
191
- const R = /* @__PURE__ */ C(w), L = /* @__PURE__ */ k({
192
- __proto__: null,
193
- default: R
194
- }, [w]);
195
- export {
196
- L as _static
197
- };