@mapbox/mapbox-gl-style-spec 13.24.0-beta.1 → 13.25.0-beta.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.
package/dist/index.es.js CHANGED
@@ -62,7 +62,7 @@ var $root = {
62
62
  },
63
63
  fog: {
64
64
  type: "fog",
65
- doc: "A global effect that fades layers and markers based on their distance to the camera. The fog can be used to approximate the effect of atmosphere on distant objects and enhance the depth perception of the map when used with terrain or 3D features."
65
+ doc: "A global effect that fades layers and markers based on their distance to the camera. The fog can be used to approximate the effect of atmosphere on distant objects and enhance the depth perception of the map when used with terrain or 3D features. Note: fog is renamed to atmosphere in the Android and iOS SDKs and planned to be changed in GL-JS v.3.0.0."
66
66
  },
67
67
  sources: {
68
68
  required: true,
@@ -95,7 +95,7 @@ var $root = {
95
95
  },
96
96
  projection: {
97
97
  type: "projection",
98
- doc: "The projection the map should be rendered in. Supported projections are Albers, Equal Earth, Equirectangular (WGS84), Lambert conformal conic, Mercator, Natural Earth, and Winkel Tripel. Terrain, fog, sky and CustomLayerInterface are not supported for projections other than mercator.",
98
+ doc: "The projection the map should be rendered in. Supported projections are Albers, Equal Earth, Equirectangular (WGS84), Lambert conformal conic, Mercator, Natural Earth, Globe, and Winkel Tripel. Terrain, fog, sky and CustomLayerInterface are not supported for projections other than mercator.",
99
99
  example: {
100
100
  name: "albers",
101
101
  center: [
@@ -2636,7 +2636,7 @@ var function_stop = {
2636
2636
  length: 2,
2637
2637
  doc: "Zoom level and value pair."
2638
2638
  };
2639
- var expression = {
2639
+ var expression$1 = {
2640
2640
  type: "array",
2641
2641
  value: "*",
2642
2642
  minimum: 1,
@@ -3741,7 +3741,9 @@ var fog = {
3741
3741
  ],
3742
3742
  "sdk-support": {
3743
3743
  "basic functionality": {
3744
- js: "2.3.0"
3744
+ js: "2.3.0",
3745
+ android: "10.6.0",
3746
+ ios: "10.6.0"
3745
3747
  }
3746
3748
  }
3747
3749
  },
@@ -3756,17 +3758,83 @@ var fog = {
3756
3758
  ]
3757
3759
  },
3758
3760
  transition: true,
3759
- doc: "The color of the fog. Using opacity is recommended only for smoothly transitioning fog on/off as anything less than 100% opacity results in more tiles loaded and drawn.",
3761
+ doc: "The color of the atmosphere region immediately below the horizon and within the `range` and above the horizon and within `horizon-blend`. Using opacity is recommended only for smoothly transitioning fog on/off as anything less than 100% opacity results in more tiles loaded and drawn.",
3760
3762
  "sdk-support": {
3761
3763
  "basic functionality": {
3762
- js: "2.3.0"
3764
+ js: "2.3.0",
3765
+ android: "10.6.0",
3766
+ ios: "10.6.0"
3767
+ }
3768
+ }
3769
+ },
3770
+ "high-color": {
3771
+ type: "color",
3772
+ "property-type": "data-constant",
3773
+ "default": "#245cdf",
3774
+ expression: {
3775
+ interpolated: true,
3776
+ parameters: [
3777
+ "zoom"
3778
+ ]
3779
+ },
3780
+ transition: true,
3781
+ doc: "The color of the atmosphere region above the horizon, `high-color` extends further above the horizon than the `color` property and its spread can be controlled with `horizon-blend`. The opacity can be set to `0` to remove the high atmosphere color contribution.",
3782
+ "sdk-support": {
3783
+ "basic functionality": {
3784
+ js: "2.9.0",
3785
+ android: "10.6.0",
3786
+ ios: "10.6.0"
3787
+ }
3788
+ }
3789
+ },
3790
+ "space-color": {
3791
+ type: "color",
3792
+ "property-type": "data-constant",
3793
+ "default": [
3794
+ "interpolate",
3795
+ [
3796
+ "linear"
3797
+ ],
3798
+ [
3799
+ "zoom"
3800
+ ],
3801
+ 4,
3802
+ "#010b19",
3803
+ 7,
3804
+ "#367ab9"
3805
+ ],
3806
+ expression: {
3807
+ interpolated: true,
3808
+ parameters: [
3809
+ "zoom"
3810
+ ]
3811
+ },
3812
+ transition: true,
3813
+ doc: "The color of the region above the horizon and after the end of the `horizon-blend` contribution. The opacity can be set to `0` to have a transparent background.",
3814
+ "sdk-support": {
3815
+ "basic functionality": {
3816
+ js: "2.9.0",
3817
+ android: "10.6.0",
3818
+ ios: "10.6.0"
3763
3819
  }
3764
3820
  }
3765
3821
  },
3766
3822
  "horizon-blend": {
3767
3823
  type: "number",
3768
3824
  "property-type": "data-constant",
3769
- "default": 0.1,
3825
+ "default": [
3826
+ "interpolate",
3827
+ [
3828
+ "linear"
3829
+ ],
3830
+ [
3831
+ "zoom"
3832
+ ],
3833
+ 4,
3834
+ 0.2,
3835
+ 7,
3836
+ 0.1
3837
+ ],
3770
3838
  minimum: 0,
3771
3839
  maximum: 1,
3772
3840
  expression: {
@@ -3776,10 +3844,46 @@ var fog = {
3776
3844
  ]
3777
3845
  },
3778
3846
  transition: true,
3779
- doc: "Horizon blend applies a smooth fade from the color of the fog to the color of the sky. A value of zero leaves a sharp transition from fog to sky. Increasing the value blends the color of fog into increasingly high angles of the sky.",
3847
+ doc: "Horizon blend applies a smooth fade from the color of the atmosphere to the color of space. A value of zero leaves a sharp transition from atmosphere to space. Increasing the value blends the color of atmosphere into increasingly high angles of the sky.",
3780
3848
  "sdk-support": {
3781
3849
  "basic functionality": {
3782
- js: "2.3.0"
3850
+ js: "2.3.0",
3851
+ android: "10.6.0",
3852
+ ios: "10.6.0"
3853
+ }
3854
+ }
3855
+ },
3856
+ "star-intensity": {
3857
+ type: "number",
3858
+ "property-type": "data-constant",
3859
+ "default": [
3860
+ "interpolate",
3861
+ [
3862
+ "linear"
3863
+ ],
3864
+ [
3865
+ "zoom"
3866
+ ],
3867
+ 5,
3868
+ 0.35,
3869
+ 6,
3870
+ 0
3871
+ ],
3872
+ minimum: 0,
3873
+ maximum: 1,
3874
+ expression: {
3875
+ interpolated: true,
3876
+ parameters: [
3877
+ "zoom"
3878
+ ]
3879
+ },
3880
+ transition: true,
3881
+ doc: "A value controlling the star intensity where `0` will show no stars and `1` will show stars at their maximum intensity.",
3882
+ "sdk-support": {
3883
+ "basic functionality": {
3884
+ js: "2.9.0",
3885
+ android: "10.6.0",
3886
+ ios: "10.6.0"
3783
3887
  }
3784
3888
  }
3785
3889
  }
@@ -3916,6 +4020,9 @@ var projection = {
3916
4020
  },
3917
4021
  winkelTripel: {
3918
4022
  doc: "A Winkel Tripel projection."
4023
+ },
4024
+ globe: {
4025
+ doc: "A globe projection."
3919
4026
  }
3920
4027
  },
3921
4028
  "default": "mercator",
@@ -3932,6 +4039,14 @@ var projection = {
3932
4039
  length: 2,
3933
4040
  value: "number",
3934
4041
  "property-type": "data-constant",
4042
+ minimum: [
4043
+ -180,
4044
+ -90
4045
+ ],
4046
+ maximum: [
4047
+ 180,
4048
+ 90
4049
+ ],
3935
4050
  transition: false,
3936
4051
  doc: "The reference longitude and latitude of the projection. `center` takes the form of [lng, lat]. This property is only configurable for conic projections (Albers and Lambert Conformal Conic). All other projections are centered on [0, 0].",
3937
4052
  example: [
@@ -3957,6 +4072,14 @@ var projection = {
3957
4072
  length: 2,
3958
4073
  value: "number",
3959
4074
  "property-type": "data-constant",
4075
+ minimum: [
4076
+ -90,
4077
+ -90
4078
+ ],
4079
+ maximum: [
4080
+ 90,
4081
+ 90
4082
+ ],
3960
4083
  transition: false,
3961
4084
  doc: "The standard parallels of the projection, denoting the desired latitude range with minimal distortion. `parallels` takes the form of [lat0, lat1]. This property is only configurable for conic projections (Albers and Lambert Conformal Conic).",
3962
4085
  example: [
@@ -4005,6 +4128,9 @@ var terrain = {
4005
4128
  },
4006
4129
  transition: true,
4007
4130
  doc: "Exaggerates the elevation of the terrain by multiplying the data from the DEM with this value.",
4131
+ requires: [
4132
+ "source"
4133
+ ],
4008
4134
  "sdk-support": {
4009
4135
  "basic functionality": {
4010
4136
  js: "2.0.0",
@@ -4572,6 +4698,35 @@ var paint_line = {
4572
4698
  ]
4573
4699
  },
4574
4700
  "property-type": "color-ramp"
4701
+ },
4702
+ "line-trim-offset": {
4703
+ type: "array",
4704
+ value: "number",
4705
+ doc: "The line part between [trim-start, trim-end] will be marked as transparent to make a route vanishing effect. The line trim-off offset is based on the whole line gradient range [0.0, 1.0]. If either 'trim-start' or 'trim-end' offset is out of valid range, the default range will be set.",
4706
+ length: 2,
4707
+ "default": [
4708
+ 0,
4709
+ 0
4710
+ ],
4711
+ transition: false,
4712
+ requires: [
4713
+ "line-gradient",
4714
+ {
4715
+ source: "geojson",
4716
+ has: {
4717
+ lineMetrics: true
4718
+ }
4719
+ }
4720
+ ],
4721
+ "sdk-support": {
4722
+ "basic functionality": {
4723
+ js: "2.3.0",
4724
+ android: "10.5.0",
4725
+ ios: "10.5.0",
4726
+ macos: "10.5.0"
4727
+ }
4728
+ },
4729
+ "property-type": "constant"
4575
4730
  }
4576
4731
  };
4577
4732
  var paint_circle = {
@@ -6317,7 +6472,7 @@ var v8 = {
6317
6472
  }
6318
6473
  },
6319
6474
  function_stop: function_stop,
6320
- expression: expression,
6475
+ expression: expression$1,
6321
6476
  expression_name: expression_name,
6322
6477
  fog: fog,
6323
6478
  light: light,
@@ -6691,6 +6846,8 @@ var jsonStringifyPrettyCompact = function stringify(passedObj, options) {
6691
6846
  })(passedObj, "", 0);
6692
6847
  };
6693
6848
 
6849
+ var stringifyPretty = jsonStringifyPrettyCompact;
6850
+
6694
6851
  function sortKeysBy(obj, reference) {
6695
6852
  const result = {};
6696
6853
  for (const key in reference) {
@@ -6705,12 +6862,12 @@ function sortKeysBy(obj, reference) {
6705
6862
  }
6706
6863
  return result;
6707
6864
  }
6708
- function format(style, space = 2) {
6865
+ function format$1(style, space = 2) {
6709
6866
  style = sortKeysBy(style, v8.$root);
6710
6867
  if (style.layers) {
6711
6868
  style.layers = style.layers.map(layer => sortKeysBy(layer, v8.layer));
6712
6869
  }
6713
- return jsonStringifyPrettyCompact(style, { indent: space });
6870
+ return stringifyPretty(style, { indent: space });
6714
6871
  }
6715
6872
 
6716
6873
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -7378,7 +7535,7 @@ exports.encode = exports.stringify = encode;
7378
7535
  var parse = urlParse;
7379
7536
  var resolve = urlResolve;
7380
7537
  var resolveObject = urlResolveObject;
7381
- var format$1 = urlFormat;
7538
+ var format = urlFormat;
7382
7539
 
7383
7540
  var Url_1 = Url;
7384
7541
 
@@ -8085,7 +8242,7 @@ var url = {
8085
8242
  parse: parse,
8086
8243
  resolve: resolve,
8087
8244
  resolveObject: resolveObject,
8088
- format: format$1,
8245
+ format: format,
8089
8246
  Url: Url_1
8090
8247
  };
8091
8248
 
@@ -8166,7 +8323,7 @@ function resolveConstant(style, value) {
8166
8323
  return value;
8167
8324
  }
8168
8325
  }
8169
- function isFunction(value) {
8326
+ function isFunction$1(value) {
8170
8327
  return Array.isArray(value.stops);
8171
8328
  }
8172
8329
  function renameProperty(obj, from, to) {
@@ -8208,7 +8365,7 @@ function migrateToV8 (style) {
8208
8365
  layout: true
8209
8366
  }, property => {
8210
8367
  const value = resolveConstant(style, property.value);
8211
- if (isFunction(value)) {
8368
+ if (isFunction$1(value)) {
8212
8369
  value.stops.forEach(stop => {
8213
8370
  stop[1] = resolveConstant(style, stop[1]);
8214
8371
  });
@@ -8299,13 +8456,14 @@ function extend (output, ...inputs) {
8299
8456
  return output;
8300
8457
  }
8301
8458
 
8302
- class ParsingError extends Error {
8459
+ class ParsingError$1 extends Error {
8303
8460
  constructor(key, message) {
8304
8461
  super(message);
8305
8462
  this.message = message;
8306
8463
  this.key = key;
8307
8464
  }
8308
8465
  }
8466
+ var ParsingError$2 = ParsingError$1;
8309
8467
 
8310
8468
  class Scope {
8311
8469
  constructor(parent, bindings = []) {
@@ -8333,6 +8491,7 @@ class Scope {
8333
8491
  return this.parent ? this.parent.has(name) : false;
8334
8492
  }
8335
8493
  }
8494
+ var Scope$1 = Scope;
8336
8495
 
8337
8496
  const NullType = { kind: 'null' };
8338
8497
  const NumberType = { kind: 'number' };
@@ -8345,16 +8504,16 @@ const ErrorType = { kind: 'error' };
8345
8504
  const CollatorType = { kind: 'collator' };
8346
8505
  const FormattedType = { kind: 'formatted' };
8347
8506
  const ResolvedImageType = { kind: 'resolvedImage' };
8348
- function array(itemType, N) {
8507
+ function array$1(itemType, N) {
8349
8508
  return {
8350
8509
  kind: 'array',
8351
8510
  itemType,
8352
8511
  N
8353
8512
  };
8354
8513
  }
8355
- function toString(type) {
8514
+ function toString$1(type) {
8356
8515
  if (type.kind === 'array') {
8357
- const itemType = toString(type.itemType);
8516
+ const itemType = toString$1(type.itemType);
8358
8517
  return typeof type.N === 'number' ? `array<${ itemType }, ${ type.N }>` : type.itemType.kind === 'value' ? 'array' : `array<${ itemType }>`;
8359
8518
  } else {
8360
8519
  return type.kind;
@@ -8368,7 +8527,7 @@ const valueMemberTypes = [
8368
8527
  ColorType,
8369
8528
  FormattedType,
8370
8529
  ObjectType,
8371
- array(ValueType),
8530
+ array$1(ValueType),
8372
8531
  ResolvedImageType
8373
8532
  ];
8374
8533
  function checkSubtype(expected, t) {
@@ -8387,7 +8546,7 @@ function checkSubtype(expected, t) {
8387
8546
  }
8388
8547
  }
8389
8548
  }
8390
- return `Expected ${ toString(expected) } but found ${ toString(t) } instead.`;
8549
+ return `Expected ${ toString$1(expected) } but found ${ toString$1(t) } instead.`;
8391
8550
  }
8392
8551
  function isValidType(provided, allowedTypes) {
8393
8552
  return allowedTypes.some(t => t.kind === provided.kind);
@@ -8651,12 +8810,36 @@ class Color {
8651
8810
  a
8652
8811
  ];
8653
8812
  }
8813
+ toArray01() {
8814
+ const {r, g, b, a} = this;
8815
+ return a === 0 ? [
8816
+ 0,
8817
+ 0,
8818
+ 0,
8819
+ 0
8820
+ ] : [
8821
+ r / a,
8822
+ g / a,
8823
+ b / a,
8824
+ a
8825
+ ];
8826
+ }
8827
+ toArray01PremultipliedAlpha() {
8828
+ const {r, g, b, a} = this;
8829
+ return [
8830
+ r,
8831
+ g,
8832
+ b,
8833
+ a
8834
+ ];
8835
+ }
8654
8836
  }
8655
8837
  Color.black = new Color(0, 0, 0, 1);
8656
8838
  Color.white = new Color(1, 1, 1, 1);
8657
8839
  Color.transparent = new Color(0, 0, 0, 0);
8658
8840
  Color.red = new Color(1, 0, 0, 1);
8659
8841
  Color.blue = new Color(0, 0, 1, 1);
8842
+ var Color$1 = Color;
8660
8843
 
8661
8844
  class Collator {
8662
8845
  constructor(caseSensitive, diacriticSensitive, locale) {
@@ -8798,7 +8981,7 @@ function isValue(mixed) {
8798
8981
  return true;
8799
8982
  } else if (typeof mixed === 'number') {
8800
8983
  return true;
8801
- } else if (mixed instanceof Color) {
8984
+ } else if (mixed instanceof Color$1) {
8802
8985
  return true;
8803
8986
  } else if (mixed instanceof Collator) {
8804
8987
  return true;
@@ -8833,7 +9016,7 @@ function typeOf(value) {
8833
9016
  return BooleanType;
8834
9017
  } else if (typeof value === 'number') {
8835
9018
  return NumberType;
8836
- } else if (value instanceof Color) {
9019
+ } else if (value instanceof Color$1) {
8837
9020
  return ColorType;
8838
9021
  } else if (value instanceof Collator) {
8839
9022
  return CollatorType;
@@ -8855,18 +9038,18 @@ function typeOf(value) {
8855
9038
  break;
8856
9039
  }
8857
9040
  }
8858
- return array(itemType || ValueType, length);
9041
+ return array$1(itemType || ValueType, length);
8859
9042
  } else {
8860
9043
  return ObjectType;
8861
9044
  }
8862
9045
  }
8863
- function toString$1(value) {
9046
+ function toString(value) {
8864
9047
  const type = typeof value;
8865
9048
  if (value === null) {
8866
9049
  return '';
8867
9050
  } else if (type === 'string' || type === 'number' || type === 'boolean') {
8868
9051
  return String(value);
8869
- } else if (value instanceof Color || value instanceof Formatted || value instanceof ResolvedImage) {
9052
+ } else if (value instanceof Color$1 || value instanceof Formatted || value instanceof ResolvedImage) {
8870
9053
  return value.toString();
8871
9054
  } else {
8872
9055
  return JSON.stringify(value);
@@ -8905,7 +9088,7 @@ class Literal {
8905
9088
  'literal',
8906
9089
  this.value
8907
9090
  ];
8908
- } else if (this.value instanceof Color) {
9091
+ } else if (this.value instanceof Color$1) {
8909
9092
  return ['rgba'].concat(this.value.toArray());
8910
9093
  } else if (this.value instanceof Formatted) {
8911
9094
  return this.value.serialize();
@@ -8914,6 +9097,7 @@ class Literal {
8914
9097
  }
8915
9098
  }
8916
9099
  }
9100
+ var Literal$1 = Literal;
8917
9101
 
8918
9102
  class RuntimeError {
8919
9103
  constructor(message) {
@@ -8924,8 +9108,9 @@ class RuntimeError {
8924
9108
  return this.message;
8925
9109
  }
8926
9110
  }
9111
+ var RuntimeError$1 = RuntimeError;
8927
9112
 
8928
- const types = {
9113
+ const types$1 = {
8929
9114
  string: StringType,
8930
9115
  number: NumberType,
8931
9116
  boolean: BooleanType,
@@ -8946,9 +9131,9 @@ class Assertion {
8946
9131
  let itemType;
8947
9132
  if (args.length > 2) {
8948
9133
  const type = args[1];
8949
- if (typeof type !== 'string' || !(type in types) || type === 'object')
9134
+ if (typeof type !== 'string' || !(type in types$1) || type === 'object')
8950
9135
  return context.error('The item type argument of "array" must be one of string, number, boolean', 1);
8951
- itemType = types[type];
9136
+ itemType = types$1[type];
8952
9137
  i++;
8953
9138
  } else {
8954
9139
  itemType = ValueType;
@@ -8961,9 +9146,9 @@ class Assertion {
8961
9146
  N = args[2];
8962
9147
  i++;
8963
9148
  }
8964
- type = array(itemType, N);
9149
+ type = array$1(itemType, N);
8965
9150
  } else {
8966
- type = types[name];
9151
+ type = types$1[name];
8967
9152
  }
8968
9153
  const parsed = [];
8969
9154
  for (; i < args.length; i++) {
@@ -8981,7 +9166,7 @@ class Assertion {
8981
9166
  if (!error) {
8982
9167
  return value;
8983
9168
  } else if (i === this.args.length - 1) {
8984
- throw new RuntimeError(`Expected value to be of type ${ toString(this.type) }, but found ${ toString(typeOf(value)) } instead.`);
9169
+ throw new RuntimeError$1(`Expected value to be of type ${ toString$1(this.type) }, but found ${ toString$1(typeOf(value)) } instead.`);
8985
9170
  }
8986
9171
  }
8987
9172
  return null;
@@ -9008,6 +9193,7 @@ class Assertion {
9008
9193
  return serialized.concat(this.args.map(arg => arg.serialize()));
9009
9194
  }
9010
9195
  }
9196
+ var Assertion$1 = Assertion;
9011
9197
 
9012
9198
  class FormatExpression {
9013
9199
  constructor(sections) {
@@ -9036,7 +9222,7 @@ class FormatExpression {
9036
9222
  }
9037
9223
  let font = null;
9038
9224
  if (arg['text-font']) {
9039
- font = context.parse(arg['text-font'], 1, array(StringType));
9225
+ font = context.parse(arg['text-font'], 1, array$1(StringType));
9040
9226
  if (!font)
9041
9227
  return null;
9042
9228
  }
@@ -9074,7 +9260,7 @@ class FormatExpression {
9074
9260
  if (typeOf(evaluatedContent) === ResolvedImageType) {
9075
9261
  return new FormattedSection('', evaluatedContent, null, null, null);
9076
9262
  }
9077
- return new FormattedSection(toString$1(evaluatedContent), null, section.scale ? section.scale.evaluate(ctx) : null, section.font ? section.font.evaluate(ctx).join(',') : null, section.textColor ? section.textColor.evaluate(ctx) : null);
9263
+ return new FormattedSection(toString(evaluatedContent), null, section.scale ? section.scale.evaluate(ctx) : null, section.font ? section.font.evaluate(ctx).join(',') : null, section.textColor ? section.textColor.evaluate(ctx) : null);
9078
9264
  };
9079
9265
  return new Formatted(this.sections.map(evaluateSection));
9080
9266
  }
@@ -9150,7 +9336,7 @@ class ImageExpression {
9150
9336
  }
9151
9337
  }
9152
9338
 
9153
- const types$1 = {
9339
+ const types = {
9154
9340
  'to-boolean': BooleanType,
9155
9341
  'to-color': ColorType,
9156
9342
  'to-number': NumberType,
@@ -9167,7 +9353,7 @@ class Coercion {
9167
9353
  const name = args[0];
9168
9354
  if ((name === 'to-boolean' || name === 'to-string') && args.length !== 2)
9169
9355
  return context.error(`Expected one argument.`);
9170
- const type = types$1[name];
9356
+ const type = types[name];
9171
9357
  const parsed = [];
9172
9358
  for (let i = 1; i < args.length; i++) {
9173
9359
  const input = context.parse(args[i], i, ValueType);
@@ -9186,7 +9372,7 @@ class Coercion {
9186
9372
  for (const arg of this.args) {
9187
9373
  input = arg.evaluate(ctx);
9188
9374
  error = null;
9189
- if (input instanceof Color) {
9375
+ if (input instanceof Color$1) {
9190
9376
  return input;
9191
9377
  } else if (typeof input === 'string') {
9192
9378
  const c = ctx.parseColor(input);
@@ -9199,11 +9385,11 @@ class Coercion {
9199
9385
  error = validateRGBA(input[0], input[1], input[2], input[3]);
9200
9386
  }
9201
9387
  if (!error) {
9202
- return new Color(input[0] / 255, input[1] / 255, input[2] / 255, input[3]);
9388
+ return new Color$1(input[0] / 255, input[1] / 255, input[2] / 255, input[3]);
9203
9389
  }
9204
9390
  }
9205
9391
  }
9206
- throw new RuntimeError(error || `Could not parse color from value '${ typeof input === 'string' ? input : String(JSON.stringify(input)) }'`);
9392
+ throw new RuntimeError$1(error || `Could not parse color from value '${ typeof input === 'string' ? input : String(JSON.stringify(input)) }'`);
9207
9393
  } else if (this.type.kind === 'number') {
9208
9394
  let value = null;
9209
9395
  for (const arg of this.args) {
@@ -9215,13 +9401,13 @@ class Coercion {
9215
9401
  continue;
9216
9402
  return num;
9217
9403
  }
9218
- throw new RuntimeError(`Could not convert ${ JSON.stringify(value) } to number.`);
9404
+ throw new RuntimeError$1(`Could not convert ${ JSON.stringify(value) } to number.`);
9219
9405
  } else if (this.type.kind === 'formatted') {
9220
- return Formatted.fromString(toString$1(this.args[0].evaluate(ctx)));
9406
+ return Formatted.fromString(toString(this.args[0].evaluate(ctx)));
9221
9407
  } else if (this.type.kind === 'resolvedImage') {
9222
- return ResolvedImage.fromString(toString$1(this.args[0].evaluate(ctx)));
9408
+ return ResolvedImage.fromString(toString(this.args[0].evaluate(ctx)));
9223
9409
  } else {
9224
- return toString$1(this.args[0].evaluate(ctx));
9410
+ return toString(this.args[0].evaluate(ctx));
9225
9411
  }
9226
9412
  }
9227
9413
  eachChild(fn) {
@@ -9249,6 +9435,7 @@ class Coercion {
9249
9435
  return serialized;
9250
9436
  }
9251
9437
  }
9438
+ var Coercion$1 = Coercion;
9252
9439
 
9253
9440
  const geometryTypes = [
9254
9441
  'Unknown',
@@ -9300,11 +9487,12 @@ class EvaluationContext {
9300
9487
  parseColor(input) {
9301
9488
  let cached = this._parseColorCache[input];
9302
9489
  if (!cached) {
9303
- cached = this._parseColorCache[input] = Color.parse(input);
9490
+ cached = this._parseColorCache[input] = Color$1.parse(input);
9304
9491
  }
9305
9492
  return cached;
9306
9493
  }
9307
9494
  }
9495
+ var EvaluationContext$1 = EvaluationContext;
9308
9496
 
9309
9497
  class CompoundExpression {
9310
9498
  constructor(name, type, evaluate, args) {
@@ -9339,7 +9527,7 @@ class CompoundExpression {
9339
9527
  const overloads = availableOverloads.filter(([signature]) => !Array.isArray(signature) || signature.length === args.length - 1);
9340
9528
  let signatureContext = null;
9341
9529
  for (const [params, evaluate] of overloads) {
9342
- signatureContext = new ParsingContext(context.registry, context.path, null, context.scope);
9530
+ signatureContext = new ParsingContext$1(context.registry, context.path, null, context.scope);
9343
9531
  const parsedArgs = [];
9344
9532
  let argParseFailed = false;
9345
9533
  for (let i = 1; i < args.length; i++) {
@@ -9380,7 +9568,7 @@ class CompoundExpression {
9380
9568
  const parsed = context.parse(args[i], 1 + actualTypes.length);
9381
9569
  if (!parsed)
9382
9570
  return null;
9383
- actualTypes.push(toString(parsed.type));
9571
+ actualTypes.push(toString$1(parsed.type));
9384
9572
  }
9385
9573
  context.error(`Expected arguments of type ${ signatures }, but found (${ actualTypes.join(', ') }) instead.`);
9386
9574
  }
@@ -9395,11 +9583,12 @@ class CompoundExpression {
9395
9583
  }
9396
9584
  function stringifySignature(signature) {
9397
9585
  if (Array.isArray(signature)) {
9398
- return `(${ signature.map(toString).join(', ') })`;
9586
+ return `(${ signature.map(toString$1).join(', ') })`;
9399
9587
  } else {
9400
- return `(${ toString(signature.type) }...)`;
9588
+ return `(${ toString$1(signature.type) }...)`;
9401
9589
  }
9402
9590
  }
9591
+ var CompoundExpression$1 = CompoundExpression;
9403
9592
 
9404
9593
  class CollatorExpression {
9405
9594
  constructor(caseSensitive, diacriticSensitive, locale) {
@@ -9796,9 +9985,10 @@ class Within {
9796
9985
  ];
9797
9986
  }
9798
9987
  }
9988
+ var Within$1 = Within;
9799
9989
 
9800
9990
  function isFeatureConstant(e) {
9801
- if (e instanceof CompoundExpression) {
9991
+ if (e instanceof CompoundExpression$1) {
9802
9992
  if (e.name === 'get' && e.args.length === 1) {
9803
9993
  return false;
9804
9994
  } else if (e.name === 'feature-state') {
@@ -9811,7 +10001,7 @@ function isFeatureConstant(e) {
9811
10001
  return false;
9812
10002
  }
9813
10003
  }
9814
- if (e instanceof Within) {
10004
+ if (e instanceof Within$1) {
9815
10005
  return false;
9816
10006
  }
9817
10007
  let result = true;
@@ -9823,7 +10013,7 @@ function isFeatureConstant(e) {
9823
10013
  return result;
9824
10014
  }
9825
10015
  function isStateConstant(e) {
9826
- if (e instanceof CompoundExpression) {
10016
+ if (e instanceof CompoundExpression$1) {
9827
10017
  if (e.name === 'feature-state') {
9828
10018
  return false;
9829
10019
  }
@@ -9837,7 +10027,7 @@ function isStateConstant(e) {
9837
10027
  return result;
9838
10028
  }
9839
10029
  function isGlobalPropertyConstant(e, properties) {
9840
- if (e instanceof CompoundExpression && properties.indexOf(e.name) >= 0) {
10030
+ if (e instanceof CompoundExpression$1 && properties.indexOf(e.name) >= 0) {
9841
10031
  return false;
9842
10032
  }
9843
10033
  let result = true;
@@ -9879,9 +10069,10 @@ class Var {
9879
10069
  ];
9880
10070
  }
9881
10071
  }
10072
+ var Var$1 = Var;
9882
10073
 
9883
10074
  class ParsingContext {
9884
- constructor(registry, path = [], expectedType, scope = new Scope(), errors = []) {
10075
+ constructor(registry, path = [], expectedType, scope = new Scope$1(), errors = []) {
9885
10076
  this.registry = registry;
9886
10077
  this.path = path;
9887
10078
  this.key = path.map(part => `[${ part }]`).join('');
@@ -9904,9 +10095,9 @@ class ParsingContext {
9904
10095
  }
9905
10096
  function annotate(parsed, type, typeAnnotation) {
9906
10097
  if (typeAnnotation === 'assert') {
9907
- return new Assertion(type, [parsed]);
10098
+ return new Assertion$1(type, [parsed]);
9908
10099
  } else if (typeAnnotation === 'coerce') {
9909
- return new Coercion(type, [parsed]);
10100
+ return new Coercion$1(type, [parsed]);
9910
10101
  } else {
9911
10102
  return parsed;
9912
10103
  }
@@ -9936,10 +10127,10 @@ class ParsingContext {
9936
10127
  return null;
9937
10128
  }
9938
10129
  }
9939
- if (!(parsed instanceof Literal) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
9940
- const ec = new EvaluationContext();
10130
+ if (!(parsed instanceof Literal$1) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
10131
+ const ec = new EvaluationContext$1();
9941
10132
  try {
9942
- parsed = new Literal(parsed.type, parsed.evaluate(ec));
10133
+ parsed = new Literal$1(parsed.type, parsed.evaluate(ec));
9943
10134
  } catch (e) {
9944
10135
  this.error(e.message);
9945
10136
  return null;
@@ -9963,7 +10154,7 @@ class ParsingContext {
9963
10154
  }
9964
10155
  error(error, ...keys) {
9965
10156
  const key = `${ this.key }${ keys.map(k => `[${ k }]`).join('') }`;
9966
- this.errors.push(new ParsingError(key, error));
10157
+ this.errors.push(new ParsingError$2(key, error));
9967
10158
  }
9968
10159
  checkSubtype(expected, t) {
9969
10160
  const error = checkSubtype(expected, t);
@@ -9972,23 +10163,24 @@ class ParsingContext {
9972
10163
  return error;
9973
10164
  }
9974
10165
  }
10166
+ var ParsingContext$1 = ParsingContext;
9975
10167
  function isConstant(expression) {
9976
- if (expression instanceof Var) {
10168
+ if (expression instanceof Var$1) {
9977
10169
  return isConstant(expression.boundExpression);
9978
- } else if (expression instanceof CompoundExpression && expression.name === 'error') {
10170
+ } else if (expression instanceof CompoundExpression$1 && expression.name === 'error') {
9979
10171
  return false;
9980
10172
  } else if (expression instanceof CollatorExpression) {
9981
10173
  return false;
9982
- } else if (expression instanceof Within) {
10174
+ } else if (expression instanceof Within$1) {
9983
10175
  return false;
9984
10176
  }
9985
- const isTypeAnnotation = expression instanceof Coercion || expression instanceof Assertion;
10177
+ const isTypeAnnotation = expression instanceof Coercion$1 || expression instanceof Assertion$1;
9986
10178
  let childrenConstant = true;
9987
10179
  expression.eachChild(child => {
9988
10180
  if (isTypeAnnotation) {
9989
10181
  childrenConstant = childrenConstant && isConstant(child);
9990
10182
  } else {
9991
- childrenConstant = childrenConstant && child instanceof Literal;
10183
+ childrenConstant = childrenConstant && child instanceof Literal$1;
9992
10184
  }
9993
10185
  });
9994
10186
  if (!childrenConstant) {
@@ -10024,7 +10216,7 @@ function findStopLessThanOrEqualTo(stops, input) {
10024
10216
  } else if (currentValue > input) {
10025
10217
  upperIndex = currentIndex - 1;
10026
10218
  } else {
10027
- throw new RuntimeError('Input is not a number.');
10219
+ throw new RuntimeError$1('Input is not a number.');
10028
10220
  }
10029
10221
  }
10030
10222
  return 0;
@@ -10118,6 +10310,7 @@ class Step {
10118
10310
  return serialized;
10119
10311
  }
10120
10312
  }
10313
+ var Step$1 = Step;
10121
10314
 
10122
10315
  /*
10123
10316
  * Copyright (C) 2008 Apple Inc. All Rights Reserved.
@@ -10228,9 +10421,9 @@ function number(a, b, t) {
10228
10421
  return a * (1 - t) + b * t;
10229
10422
  }
10230
10423
  function color(from, to, t) {
10231
- return new Color(number(from.r, to.r, t), number(from.g, to.g, t), number(from.b, to.b, t), number(from.a, to.a, t));
10424
+ return new Color$1(number(from.r, to.r, t), number(from.g, to.g, t), number(from.b, to.b, t), number(from.a, to.a, t));
10232
10425
  }
10233
- function array$1(from, to, t) {
10426
+ function array(from, to, t) {
10234
10427
  return from.map((d, i) => {
10235
10428
  return number(d, to[i], t);
10236
10429
  });
@@ -10240,7 +10433,7 @@ var interpolate = /*#__PURE__*/Object.freeze({
10240
10433
  __proto__: null,
10241
10434
  number: number,
10242
10435
  color: color,
10243
- array: array$1
10436
+ array: array
10244
10437
  });
10245
10438
 
10246
10439
  const Xn = 0.95047, Yn = 1, Zn = 1.08883, t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * t1 * t1, t3 = t1 * t1 * t1, deg2rad = Math.PI / 180, rad2deg = 180 / Math.PI;
@@ -10271,7 +10464,7 @@ function labToRgb(labColor) {
10271
10464
  y = Yn * lab2xyz(y);
10272
10465
  x = Xn * lab2xyz(x);
10273
10466
  z = Zn * lab2xyz(z);
10274
- return new Color(xyz2rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z), xyz2rgb(-0.969266 * x + 1.8760108 * y + 0.041556 * z), xyz2rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z), labColor.alpha);
10467
+ return new Color$1(xyz2rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z), xyz2rgb(-0.969266 * x + 1.8760108 * y + 0.041556 * z), xyz2rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z), labColor.alpha);
10275
10468
  }
10276
10469
  function interpolateLab(from, to, t) {
10277
10470
  return {
@@ -10419,7 +10612,7 @@ class Interpolate {
10419
10612
  ]);
10420
10613
  }
10421
10614
  if (outputType.kind !== 'number' && outputType.kind !== 'color' && !(outputType.kind === 'array' && outputType.itemType.kind === 'number' && typeof outputType.N === 'number')) {
10422
- return context.error(`Type ${ toString(outputType) } is not interpolatable.`);
10615
+ return context.error(`Type ${ toString$1(outputType) } is not interpolatable.`);
10423
10616
  }
10424
10617
  return new Interpolate(outputType, operator, interpolation, input, stops);
10425
10618
  }
@@ -10498,6 +10691,7 @@ function exponentialInterpolation(input, base, lowerValue, upperValue) {
10498
10691
  return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);
10499
10692
  }
10500
10693
  }
10694
+ var Interpolate$1 = Interpolate;
10501
10695
 
10502
10696
  class Coalesce {
10503
10697
  constructor(type, args) {
@@ -10559,6 +10753,7 @@ class Coalesce {
10559
10753
  return serialized;
10560
10754
  }
10561
10755
  }
10756
+ var Coalesce$1 = Coalesce;
10562
10757
 
10563
10758
  class Let {
10564
10759
  constructor(bindings, result) {
@@ -10612,6 +10807,7 @@ class Let {
10612
10807
  return serialized;
10613
10808
  }
10614
10809
  }
10810
+ var Let$1 = Let;
10615
10811
 
10616
10812
  class At {
10617
10813
  constructor(type, index, input) {
@@ -10623,7 +10819,7 @@ class At {
10623
10819
  if (args.length !== 3)
10624
10820
  return context.error(`Expected 2 arguments, but found ${ args.length - 1 } instead.`);
10625
10821
  const index = context.parse(args[1], 1, NumberType);
10626
- const input = context.parse(args[2], 2, array(context.expectedType || ValueType));
10822
+ const input = context.parse(args[2], 2, array$1(context.expectedType || ValueType));
10627
10823
  if (!index || !input)
10628
10824
  return null;
10629
10825
  const t = input.type;
@@ -10633,13 +10829,13 @@ class At {
10633
10829
  const index = this.index.evaluate(ctx);
10634
10830
  const array = this.input.evaluate(ctx);
10635
10831
  if (index < 0) {
10636
- throw new RuntimeError(`Array index out of bounds: ${ index } < 0.`);
10832
+ throw new RuntimeError$1(`Array index out of bounds: ${ index } < 0.`);
10637
10833
  }
10638
10834
  if (index >= array.length) {
10639
- throw new RuntimeError(`Array index out of bounds: ${ index } > ${ array.length - 1 }.`);
10835
+ throw new RuntimeError$1(`Array index out of bounds: ${ index } > ${ array.length - 1 }.`);
10640
10836
  }
10641
10837
  if (index !== Math.floor(index)) {
10642
- throw new RuntimeError(`Array index must be an integer, but found ${ index } instead.`);
10838
+ throw new RuntimeError$1(`Array index must be an integer, but found ${ index } instead.`);
10643
10839
  }
10644
10840
  return array[index];
10645
10841
  }
@@ -10658,6 +10854,7 @@ class At {
10658
10854
  ];
10659
10855
  }
10660
10856
  }
10857
+ var At$1 = At;
10661
10858
 
10662
10859
  class In {
10663
10860
  constructor(needle, haystack) {
@@ -10680,7 +10877,7 @@ class In {
10680
10877
  NullType,
10681
10878
  ValueType
10682
10879
  ])) {
10683
- return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(needle.type) } instead`);
10880
+ return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(needle.type) } instead`);
10684
10881
  }
10685
10882
  return new In(needle, haystack);
10686
10883
  }
@@ -10695,13 +10892,13 @@ class In {
10695
10892
  'number',
10696
10893
  'null'
10697
10894
  ])) {
10698
- throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(typeOf(needle)) } instead.`);
10895
+ throw new RuntimeError$1(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
10699
10896
  }
10700
10897
  if (!isValidNativeType(haystack, [
10701
10898
  'string',
10702
10899
  'array'
10703
10900
  ])) {
10704
- throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString(typeOf(haystack)) } instead.`);
10901
+ throw new RuntimeError$1(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
10705
10902
  }
10706
10903
  return haystack.indexOf(needle) >= 0;
10707
10904
  }
@@ -10720,6 +10917,7 @@ class In {
10720
10917
  ];
10721
10918
  }
10722
10919
  }
10920
+ var In$1 = In;
10723
10921
 
10724
10922
  class IndexOf {
10725
10923
  constructor(needle, haystack, fromIndex) {
@@ -10743,7 +10941,7 @@ class IndexOf {
10743
10941
  NullType,
10744
10942
  ValueType
10745
10943
  ])) {
10746
- return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(needle.type) } instead`);
10944
+ return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(needle.type) } instead`);
10747
10945
  }
10748
10946
  if (args.length === 4) {
10749
10947
  const fromIndex = context.parse(args[3], 3, NumberType);
@@ -10763,13 +10961,13 @@ class IndexOf {
10763
10961
  'number',
10764
10962
  'null'
10765
10963
  ])) {
10766
- throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${ toString(typeOf(needle)) } instead.`);
10964
+ throw new RuntimeError$1(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);
10767
10965
  }
10768
10966
  if (!isValidNativeType(haystack, [
10769
10967
  'string',
10770
10968
  'array'
10771
10969
  ])) {
10772
- throw new RuntimeError(`Expected second argument to be of type array or string, but found ${ toString(typeOf(haystack)) } instead.`);
10970
+ throw new RuntimeError$1(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);
10773
10971
  }
10774
10972
  if (this.fromIndex) {
10775
10973
  const fromIndex = this.fromIndex.evaluate(ctx);
@@ -10804,6 +11002,7 @@ class IndexOf {
10804
11002
  ];
10805
11003
  }
10806
11004
  }
11005
+ var IndexOf$1 = IndexOf;
10807
11006
 
10808
11007
  class Match {
10809
11008
  constructor(inputType, outputType, input, cases, outputs, otherwise) {
@@ -10916,6 +11115,7 @@ class Match {
10916
11115
  return serialized;
10917
11116
  }
10918
11117
  }
11118
+ var Match$1 = Match;
10919
11119
 
10920
11120
  class Case {
10921
11121
  constructor(type, branches, otherwise) {
@@ -10977,6 +11177,7 @@ class Case {
10977
11177
  return serialized;
10978
11178
  }
10979
11179
  }
11180
+ var Case$1 = Case;
10980
11181
 
10981
11182
  class Slice {
10982
11183
  constructor(type, input, beginIndex, endIndex) {
@@ -10994,11 +11195,11 @@ class Slice {
10994
11195
  if (!input || !beginIndex)
10995
11196
  return null;
10996
11197
  if (!isValidType(input.type, [
10997
- array(ValueType),
11198
+ array$1(ValueType),
10998
11199
  StringType,
10999
11200
  ValueType
11000
11201
  ])) {
11001
- return context.error(`Expected first argument to be of type array or string, but found ${ toString(input.type) } instead`);
11202
+ return context.error(`Expected first argument to be of type array or string, but found ${ toString$1(input.type) } instead`);
11002
11203
  }
11003
11204
  if (args.length === 4) {
11004
11205
  const endIndex = context.parse(args[3], 3, NumberType);
@@ -11016,7 +11217,7 @@ class Slice {
11016
11217
  'string',
11017
11218
  'array'
11018
11219
  ])) {
11019
- throw new RuntimeError(`Expected first argument to be of type array or string, but found ${ toString(typeOf(input)) } instead.`);
11220
+ throw new RuntimeError$1(`Expected first argument to be of type array or string, but found ${ toString$1(typeOf(input)) } instead.`);
11020
11221
  }
11021
11222
  if (this.endIndex) {
11022
11223
  const endIndex = this.endIndex.evaluate(ctx);
@@ -11051,6 +11252,7 @@ class Slice {
11051
11252
  ];
11052
11253
  }
11053
11254
  }
11255
+ var Slice$1 = Slice;
11054
11256
 
11055
11257
  function isComparableType(op, type) {
11056
11258
  if (op === '==' || op === '!=') {
@@ -11113,22 +11315,22 @@ function makeComparison(op, compareBasic, compareWithCollator) {
11113
11315
  if (!lhs)
11114
11316
  return null;
11115
11317
  if (!isComparableType(op, lhs.type)) {
11116
- return context.concat(1).error(`"${ op }" comparisons are not supported for type '${ toString(lhs.type) }'.`);
11318
+ return context.concat(1).error(`"${ op }" comparisons are not supported for type '${ toString$1(lhs.type) }'.`);
11117
11319
  }
11118
11320
  let rhs = context.parse(args[2], 2, ValueType);
11119
11321
  if (!rhs)
11120
11322
  return null;
11121
11323
  if (!isComparableType(op, rhs.type)) {
11122
- return context.concat(2).error(`"${ op }" comparisons are not supported for type '${ toString(rhs.type) }'.`);
11324
+ return context.concat(2).error(`"${ op }" comparisons are not supported for type '${ toString$1(rhs.type) }'.`);
11123
11325
  }
11124
11326
  if (lhs.type.kind !== rhs.type.kind && lhs.type.kind !== 'value' && rhs.type.kind !== 'value') {
11125
- return context.error(`Cannot compare types '${ toString(lhs.type) }' and '${ toString(rhs.type) }'.`);
11327
+ return context.error(`Cannot compare types '${ toString$1(lhs.type) }' and '${ toString$1(rhs.type) }'.`);
11126
11328
  }
11127
11329
  if (isOrderComparison) {
11128
11330
  if (lhs.type.kind === 'value' && rhs.type.kind !== 'value') {
11129
- lhs = new Assertion(rhs.type, [lhs]);
11331
+ lhs = new Assertion$1(rhs.type, [lhs]);
11130
11332
  } else if (lhs.type.kind !== 'value' && rhs.type.kind === 'value') {
11131
- rhs = new Assertion(lhs.type, [rhs]);
11333
+ rhs = new Assertion$1(lhs.type, [rhs]);
11132
11334
  }
11133
11335
  }
11134
11336
  let collator = null;
@@ -11149,7 +11351,7 @@ function makeComparison(op, compareBasic, compareWithCollator) {
11149
11351
  const lt = typeOf(lhs);
11150
11352
  const rt = typeOf(rhs);
11151
11353
  if (lt.kind !== rt.kind || !(lt.kind === 'string' || lt.kind === 'number')) {
11152
- throw new RuntimeError(`Expected arguments for "${ op }" to be (string, string) or (number, number), but found (${ lt.kind }, ${ rt.kind }) instead.`);
11354
+ throw new RuntimeError$1(`Expected arguments for "${ op }" to be (string, string) or (number, number), but found (${ lt.kind }, ${ rt.kind }) instead.`);
11153
11355
  }
11154
11356
  }
11155
11357
  if (this.collator && !isOrderComparison && this.hasUntypedArgument) {
@@ -11291,7 +11493,7 @@ class Length {
11291
11493
  if (!input)
11292
11494
  return null;
11293
11495
  if (input.type.kind !== 'array' && input.type.kind !== 'string' && input.type.kind !== 'value')
11294
- return context.error(`Expected argument of type string or array, but found ${ toString(input.type) } instead.`);
11496
+ return context.error(`Expected argument of type string or array, but found ${ toString$1(input.type) } instead.`);
11295
11497
  return new Length(input);
11296
11498
  }
11297
11499
  evaluate(ctx) {
@@ -11301,7 +11503,7 @@ class Length {
11301
11503
  } else if (Array.isArray(input)) {
11302
11504
  return input.length;
11303
11505
  } else {
11304
- throw new RuntimeError(`Expected value to be of type string or array, but found ${ toString(typeOf(input)) } instead.`);
11506
+ throw new RuntimeError$1(`Expected value to be of type string or array, but found ${ toString$1(typeOf(input)) } instead.`);
11305
11507
  }
11306
11508
  }
11307
11509
  eachChild(fn) {
@@ -11318,6 +11520,7 @@ class Length {
11318
11520
  return serialized;
11319
11521
  }
11320
11522
  }
11523
+ var Length$1 = Length;
11321
11524
 
11322
11525
  const expressions = {
11323
11526
  '==': Equals,
@@ -11326,35 +11529,35 @@ const expressions = {
11326
11529
  '<': LessThan,
11327
11530
  '>=': GreaterThanOrEqual,
11328
11531
  '<=': LessThanOrEqual,
11329
- 'array': Assertion,
11330
- 'at': At,
11331
- 'boolean': Assertion,
11332
- 'case': Case,
11333
- 'coalesce': Coalesce,
11532
+ 'array': Assertion$1,
11533
+ 'at': At$1,
11534
+ 'boolean': Assertion$1,
11535
+ 'case': Case$1,
11536
+ 'coalesce': Coalesce$1,
11334
11537
  'collator': CollatorExpression,
11335
11538
  'format': FormatExpression,
11336
11539
  'image': ImageExpression,
11337
- 'in': In,
11338
- 'index-of': IndexOf,
11339
- 'interpolate': Interpolate,
11340
- 'interpolate-hcl': Interpolate,
11341
- 'interpolate-lab': Interpolate,
11342
- 'length': Length,
11343
- 'let': Let,
11344
- 'literal': Literal,
11345
- 'match': Match,
11346
- 'number': Assertion,
11540
+ 'in': In$1,
11541
+ 'index-of': IndexOf$1,
11542
+ 'interpolate': Interpolate$1,
11543
+ 'interpolate-hcl': Interpolate$1,
11544
+ 'interpolate-lab': Interpolate$1,
11545
+ 'length': Length$1,
11546
+ 'let': Let$1,
11547
+ 'literal': Literal$1,
11548
+ 'match': Match$1,
11549
+ 'number': Assertion$1,
11347
11550
  'number-format': NumberFormat,
11348
- 'object': Assertion,
11349
- 'slice': Slice,
11350
- 'step': Step,
11351
- 'string': Assertion,
11352
- 'to-boolean': Coercion,
11353
- 'to-color': Coercion,
11354
- 'to-number': Coercion,
11355
- 'to-string': Coercion,
11356
- 'var': Var,
11357
- 'within': Within
11551
+ 'object': Assertion$1,
11552
+ 'slice': Slice$1,
11553
+ 'step': Step$1,
11554
+ 'string': Assertion$1,
11555
+ 'to-boolean': Coercion$1,
11556
+ 'to-color': Coercion$1,
11557
+ 'to-number': Coercion$1,
11558
+ 'to-string': Coercion$1,
11559
+ 'var': Var$1,
11560
+ 'within': Within$1
11358
11561
  };
11359
11562
  function rgba(ctx, [r, g, b, a]) {
11360
11563
  r = r.evaluate(ctx);
@@ -11363,8 +11566,8 @@ function rgba(ctx, [r, g, b, a]) {
11363
11566
  const alpha = a ? a.evaluate(ctx) : 1;
11364
11567
  const error = validateRGBA(r, g, b, alpha);
11365
11568
  if (error)
11366
- throw new RuntimeError(error);
11367
- return new Color(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);
11569
+ throw new RuntimeError$1(error);
11570
+ return new Color$1(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);
11368
11571
  }
11369
11572
  function has(key, obj) {
11370
11573
  return key in obj;
@@ -11388,21 +11591,21 @@ function binarySearch(v, a, i, j) {
11388
11591
  function varargs(type) {
11389
11592
  return { type };
11390
11593
  }
11391
- CompoundExpression.register(expressions, {
11594
+ CompoundExpression$1.register(expressions, {
11392
11595
  'error': [
11393
11596
  ErrorType,
11394
11597
  [StringType],
11395
11598
  (ctx, [v]) => {
11396
- throw new RuntimeError(v.evaluate(ctx));
11599
+ throw new RuntimeError$1(v.evaluate(ctx));
11397
11600
  }
11398
11601
  ],
11399
11602
  'typeof': [
11400
11603
  StringType,
11401
11604
  [ValueType],
11402
- (ctx, [v]) => toString(typeOf(v.evaluate(ctx)))
11605
+ (ctx, [v]) => toString$1(typeOf(v.evaluate(ctx)))
11403
11606
  ],
11404
11607
  'to-rgba': [
11405
- array(NumberType, 4),
11608
+ array$1(NumberType, 4),
11406
11609
  [ColorType],
11407
11610
  (ctx, [v]) => {
11408
11611
  return v.evaluate(ctx).toArray();
@@ -11788,19 +11991,19 @@ CompoundExpression.register(expressions, {
11788
11991
  ],
11789
11992
  'filter-type-in': [
11790
11993
  BooleanType,
11791
- [array(StringType)],
11994
+ [array$1(StringType)],
11792
11995
  (ctx, [v]) => v.value.indexOf(ctx.geometryType()) >= 0
11793
11996
  ],
11794
11997
  'filter-id-in': [
11795
11998
  BooleanType,
11796
- [array(ValueType)],
11999
+ [array$1(ValueType)],
11797
12000
  (ctx, [v]) => v.value.indexOf(ctx.id()) >= 0
11798
12001
  ],
11799
12002
  'filter-in-small': [
11800
12003
  BooleanType,
11801
12004
  [
11802
12005
  StringType,
11803
- array(ValueType)
12006
+ array$1(ValueType)
11804
12007
  ],
11805
12008
  (ctx, [k, v]) => v.value.indexOf(ctx.properties()[k.value]) >= 0
11806
12009
  ],
@@ -11808,7 +12011,7 @@ CompoundExpression.register(expressions, {
11808
12011
  BooleanType,
11809
12012
  [
11810
12013
  StringType,
11811
- array(ValueType)
12014
+ array$1(ValueType)
11812
12015
  ],
11813
12016
  (ctx, [k, v]) => binarySearch(ctx.properties()[k.value], v.value, 0, v.value.length - 1)
11814
12017
  ],
@@ -11885,7 +12088,7 @@ CompoundExpression.register(expressions, {
11885
12088
  'concat': [
11886
12089
  StringType,
11887
12090
  varargs(ValueType),
11888
- (ctx, args) => args.map(arg => toString$1(arg.evaluate(ctx))).join('')
12091
+ (ctx, args) => args.map(arg => toString(arg.evaluate(ctx))).join('')
11889
12092
  ],
11890
12093
  'resolved-locale': [
11891
12094
  StringType,
@@ -11893,6 +12096,7 @@ CompoundExpression.register(expressions, {
11893
12096
  (ctx, [collator]) => collator.evaluate(ctx).resolvedLocale()
11894
12097
  ]
11895
12098
  });
12099
+ var definitions = expressions;
11896
12100
 
11897
12101
  function success(value) {
11898
12102
  return {
@@ -11933,7 +12137,7 @@ function getType(val) {
11933
12137
  }
11934
12138
  }
11935
12139
 
11936
- function isFunction$1(value) {
12140
+ function isFunction(value) {
11937
12141
  return typeof value === 'object' && value !== null && !Array.isArray(value);
11938
12142
  }
11939
12143
  function identityFunction(x) {
@@ -11951,14 +12155,14 @@ function createFunction(parameters, propertySpec) {
11951
12155
  parameters.stops = parameters.stops.map(stop => {
11952
12156
  return [
11953
12157
  stop[0],
11954
- Color.parse(stop[1])
12158
+ Color$1.parse(stop[1])
11955
12159
  ];
11956
12160
  });
11957
12161
  }
11958
12162
  if (parameters.default) {
11959
- parameters.default = Color.parse(parameters.default);
12163
+ parameters.default = Color$1.parse(parameters.default);
11960
12164
  } else {
11961
- parameters.default = Color.parse(propertySpec.default);
12165
+ parameters.default = Color$1.parse(propertySpec.default);
11962
12166
  }
11963
12167
  }
11964
12168
  if (parameters.colorSpace && parameters.colorSpace !== 'rgb' && !colorSpaces[parameters.colorSpace]) {
@@ -12015,7 +12219,7 @@ function createFunction(parameters, propertySpec) {
12015
12219
  return {
12016
12220
  kind: 'composite',
12017
12221
  interpolationType,
12018
- interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
12222
+ interpolationFactor: Interpolate$1.interpolationFactor.bind(undefined, interpolationType),
12019
12223
  zoomStops: featureFunctionStops.map(s => s[0]),
12020
12224
  evaluate({zoom}, properties) {
12021
12225
  return evaluateExponentialFunction({
@@ -12032,7 +12236,7 @@ function createFunction(parameters, propertySpec) {
12032
12236
  return {
12033
12237
  kind: 'camera',
12034
12238
  interpolationType,
12035
- interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
12239
+ interpolationFactor: Interpolate$1.interpolationFactor.bind(undefined, interpolationType),
12036
12240
  zoomStops: parameters.stops.map(s => s[0]),
12037
12241
  evaluate: ({zoom}) => innerFun(parameters, propertySpec, zoom, hashedStops, categoricalKeyType)
12038
12242
  };
@@ -12042,14 +12246,14 @@ function createFunction(parameters, propertySpec) {
12042
12246
  evaluate(_, feature) {
12043
12247
  const value = feature && feature.properties ? feature.properties[parameters.property] : undefined;
12044
12248
  if (value === undefined) {
12045
- return coalesce(parameters.default, propertySpec.default);
12249
+ return coalesce$1(parameters.default, propertySpec.default);
12046
12250
  }
12047
12251
  return innerFun(parameters, propertySpec, value, hashedStops, categoricalKeyType);
12048
12252
  }
12049
12253
  };
12050
12254
  }
12051
12255
  }
12052
- function coalesce(a, b, c) {
12256
+ function coalesce$1(a, b, c) {
12053
12257
  if (a !== undefined)
12054
12258
  return a;
12055
12259
  if (b !== undefined)
@@ -12059,11 +12263,11 @@ function coalesce(a, b, c) {
12059
12263
  }
12060
12264
  function evaluateCategoricalFunction(parameters, propertySpec, input, hashedStops, keyType) {
12061
12265
  const evaluated = typeof input === keyType ? hashedStops[input] : undefined;
12062
- return coalesce(evaluated, parameters.default, propertySpec.default);
12266
+ return coalesce$1(evaluated, parameters.default, propertySpec.default);
12063
12267
  }
12064
12268
  function evaluateIntervalFunction(parameters, propertySpec, input) {
12065
12269
  if (getType(input) !== 'number')
12066
- return coalesce(parameters.default, propertySpec.default);
12270
+ return coalesce$1(parameters.default, propertySpec.default);
12067
12271
  const n = parameters.stops.length;
12068
12272
  if (n === 1)
12069
12273
  return parameters.stops[0][1];
@@ -12077,7 +12281,7 @@ function evaluateIntervalFunction(parameters, propertySpec, input) {
12077
12281
  function evaluateExponentialFunction(parameters, propertySpec, input) {
12078
12282
  const base = parameters.base !== undefined ? parameters.base : 1;
12079
12283
  if (getType(input) !== 'number')
12080
- return coalesce(parameters.default, propertySpec.default);
12284
+ return coalesce$1(parameters.default, propertySpec.default);
12081
12285
  const n = parameters.stops.length;
12082
12286
  if (n === 1)
12083
12287
  return parameters.stops[0][1];
@@ -12110,7 +12314,7 @@ function evaluateExponentialFunction(parameters, propertySpec, input) {
12110
12314
  }
12111
12315
  function evaluateIdentityFunction(parameters, propertySpec, input) {
12112
12316
  if (propertySpec.type === 'color') {
12113
- input = Color.parse(input);
12317
+ input = Color$1.parse(input);
12114
12318
  } else if (propertySpec.type === 'formatted') {
12115
12319
  input = Formatted.fromString(input.toString());
12116
12320
  } else if (propertySpec.type === 'resolvedImage') {
@@ -12118,7 +12322,7 @@ function evaluateIdentityFunction(parameters, propertySpec, input) {
12118
12322
  } else if (getType(input) !== propertySpec.type && (propertySpec.type !== 'enum' || !propertySpec.values[input])) {
12119
12323
  input = undefined;
12120
12324
  }
12121
- return coalesce(input, parameters.default, propertySpec.default);
12325
+ return coalesce$1(input, parameters.default, propertySpec.default);
12122
12326
  }
12123
12327
  function interpolationFactor(input, base, lowerValue, upperValue) {
12124
12328
  const difference = upperValue - lowerValue;
@@ -12136,7 +12340,7 @@ class StyleExpression {
12136
12340
  constructor(expression, propertySpec) {
12137
12341
  this.expression = expression;
12138
12342
  this._warningHistory = {};
12139
- this._evaluator = new EvaluationContext();
12343
+ this._evaluator = new EvaluationContext$1();
12140
12344
  this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
12141
12345
  this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;
12142
12346
  }
@@ -12166,7 +12370,7 @@ class StyleExpression {
12166
12370
  return this._defaultValue;
12167
12371
  }
12168
12372
  if (this._enumValues && !(val in this._enumValues)) {
12169
- throw new RuntimeError(`Expected value to be one of ${ Object.keys(this._enumValues).map(v => JSON.stringify(v)).join(', ') }, but found ${ JSON.stringify(val) } instead.`);
12373
+ throw new RuntimeError$1(`Expected value to be one of ${ Object.keys(this._enumValues).map(v => JSON.stringify(v)).join(', ') }, but found ${ JSON.stringify(val) } instead.`);
12170
12374
  }
12171
12375
  return val;
12172
12376
  } catch (e) {
@@ -12181,10 +12385,10 @@ class StyleExpression {
12181
12385
  }
12182
12386
  }
12183
12387
  function isExpression(expression) {
12184
- return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in expressions;
12388
+ return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in definitions;
12185
12389
  }
12186
12390
  function createExpression(expression, propertySpec) {
12187
- const parser = new ParsingContext(expressions, [], propertySpec ? getExpectedType(propertySpec) : undefined);
12391
+ const parser = new ParsingContext$1(definitions, [], propertySpec ? getExpectedType(propertySpec) : undefined);
12188
12392
  const parsed = parser.parse(expression, undefined, undefined, undefined, propertySpec && propertySpec.type === 'string' ? { typeAnnotation: 'coerce' } : undefined);
12189
12393
  if (!parsed) {
12190
12394
  return error(parser.errors);
@@ -12220,7 +12424,7 @@ class ZoomDependentExpression {
12220
12424
  }
12221
12425
  interpolationFactor(input, lower, upper) {
12222
12426
  if (this.interpolationType) {
12223
- return Interpolate.interpolationFactor(this.interpolationType, input, lower, upper);
12427
+ return Interpolate$1.interpolationFactor(this.interpolationType, input, lower, upper);
12224
12428
  } else {
12225
12429
  return 0;
12226
12430
  }
@@ -12234,7 +12438,7 @@ function createPropertyExpression(expression, propertySpec) {
12234
12438
  const parsed = expression.value.expression;
12235
12439
  const isFeatureConstant$1 = isFeatureConstant(parsed);
12236
12440
  if (!isFeatureConstant$1 && !supportsPropertyExpression(propertySpec)) {
12237
- return error([new ParsingError('', 'data expressions not supported')]);
12441
+ return error([new ParsingError$2('', 'data expressions not supported')]);
12238
12442
  }
12239
12443
  const isZoomConstant = isGlobalPropertyConstant(parsed, [
12240
12444
  'zoom',
@@ -12242,20 +12446,20 @@ function createPropertyExpression(expression, propertySpec) {
12242
12446
  'distance-from-center'
12243
12447
  ]);
12244
12448
  if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {
12245
- return error([new ParsingError('', 'zoom expressions not supported')]);
12449
+ return error([new ParsingError$2('', 'zoom expressions not supported')]);
12246
12450
  }
12247
12451
  const zoomCurve = findZoomCurve(parsed);
12248
12452
  if (!zoomCurve && !isZoomConstant) {
12249
- return error([new ParsingError('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);
12250
- } else if (zoomCurve instanceof ParsingError) {
12453
+ return error([new ParsingError$2('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);
12454
+ } else if (zoomCurve instanceof ParsingError$2) {
12251
12455
  return error([zoomCurve]);
12252
- } else if (zoomCurve instanceof Interpolate && !supportsInterpolation(propertySpec)) {
12253
- return error([new ParsingError('', '"interpolate" expressions cannot be used with this property')]);
12456
+ } else if (zoomCurve instanceof Interpolate$1 && !supportsInterpolation(propertySpec)) {
12457
+ return error([new ParsingError$2('', '"interpolate" expressions cannot be used with this property')]);
12254
12458
  }
12255
12459
  if (!zoomCurve) {
12256
12460
  return success(isFeatureConstant$1 ? new ZoomConstantExpression('constant', expression.value) : new ZoomConstantExpression('source', expression.value));
12257
12461
  }
12258
- const interpolationType = zoomCurve instanceof Interpolate ? zoomCurve.interpolation : undefined;
12462
+ const interpolationType = zoomCurve instanceof Interpolate$1 ? zoomCurve.interpolation : undefined;
12259
12463
  return success(isFeatureConstant$1 ? new ZoomDependentExpression('camera', expression.value, zoomCurve.labels, interpolationType) : new ZoomDependentExpression('composite', expression.value, zoomCurve.labels, interpolationType));
12260
12464
  }
12261
12465
  class StylePropertyFunction {
@@ -12275,7 +12479,7 @@ class StylePropertyFunction {
12275
12479
  }
12276
12480
  }
12277
12481
  function normalizePropertyExpression(value, specification) {
12278
- if (isFunction$1(value)) {
12482
+ if (isFunction(value)) {
12279
12483
  return new StylePropertyFunction(value, specification);
12280
12484
  } else if (isExpression(value)) {
12281
12485
  const expression = createPropertyExpression(value, specification);
@@ -12286,7 +12490,7 @@ function normalizePropertyExpression(value, specification) {
12286
12490
  } else {
12287
12491
  let constant = value;
12288
12492
  if (typeof value === 'string' && specification.type === 'color') {
12289
- constant = Color.parse(value);
12493
+ constant = Color$1.parse(value);
12290
12494
  }
12291
12495
  return {
12292
12496
  kind: 'constant',
@@ -12296,29 +12500,29 @@ function normalizePropertyExpression(value, specification) {
12296
12500
  }
12297
12501
  function findZoomCurve(expression) {
12298
12502
  let result = null;
12299
- if (expression instanceof Let) {
12503
+ if (expression instanceof Let$1) {
12300
12504
  result = findZoomCurve(expression.result);
12301
- } else if (expression instanceof Coalesce) {
12505
+ } else if (expression instanceof Coalesce$1) {
12302
12506
  for (const arg of expression.args) {
12303
12507
  result = findZoomCurve(arg);
12304
12508
  if (result) {
12305
12509
  break;
12306
12510
  }
12307
12511
  }
12308
- } else if ((expression instanceof Step || expression instanceof Interpolate) && expression.input instanceof CompoundExpression && expression.input.name === 'zoom') {
12512
+ } else if ((expression instanceof Step$1 || expression instanceof Interpolate$1) && expression.input instanceof CompoundExpression$1 && expression.input.name === 'zoom') {
12309
12513
  result = expression;
12310
12514
  }
12311
- if (result instanceof ParsingError) {
12515
+ if (result instanceof ParsingError$2) {
12312
12516
  return result;
12313
12517
  }
12314
12518
  expression.eachChild(child => {
12315
12519
  const childResult = findZoomCurve(child);
12316
- if (childResult instanceof ParsingError) {
12520
+ if (childResult instanceof ParsingError$2) {
12317
12521
  result = childResult;
12318
12522
  } else if (!result && childResult) {
12319
- result = new ParsingError('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.');
12523
+ result = new ParsingError$2('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.');
12320
12524
  } else if (result && childResult && result !== childResult) {
12321
- result = new ParsingError('', 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.');
12525
+ result = new ParsingError$2('', 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.');
12322
12526
  }
12323
12527
  });
12324
12528
  return result;
@@ -12334,15 +12538,15 @@ function getExpectedType(spec) {
12334
12538
  resolvedImage: ResolvedImageType
12335
12539
  };
12336
12540
  if (spec.type === 'array') {
12337
- return array(types[spec.value] || ValueType, spec.length);
12541
+ return array$1(types[spec.value] || ValueType, spec.length);
12338
12542
  }
12339
12543
  return types[spec.type];
12340
12544
  }
12341
12545
  function getDefaultValue(spec) {
12342
- if (spec.type === 'color' && isFunction$1(spec.default)) {
12343
- return new Color(0, 0, 0, 0);
12546
+ if (spec.type === 'color' && (isFunction(spec.default) || Array.isArray(spec.default))) {
12547
+ return new Color$1(0, 0, 0, 0);
12344
12548
  } else if (spec.type === 'color') {
12345
- return Color.parse(spec.default) || null;
12549
+ return Color$1.parse(spec.default) || null;
12346
12550
  } else if (spec.default === undefined) {
12347
12551
  return null;
12348
12552
  } else {
@@ -12471,14 +12675,14 @@ function convertZoomAndPropertyFunction(parameters, propertySpec, stops) {
12471
12675
  return expression;
12472
12676
  }
12473
12677
  }
12474
- function coalesce$1(a, b) {
12678
+ function coalesce(a, b) {
12475
12679
  if (a !== undefined)
12476
12680
  return a;
12477
12681
  if (b !== undefined)
12478
12682
  return b;
12479
12683
  }
12480
12684
  function getFallback(parameters, propertySpec) {
12481
- const defaultValue = convertLiteral(coalesce$1(parameters.default, propertySpec.default));
12685
+ const defaultValue = convertLiteral(coalesce(parameters.default, propertySpec.default));
12482
12686
  if (defaultValue === undefined && propertySpec.type === 'resolvedImage') {
12483
12687
  return '';
12484
12688
  }
@@ -12712,7 +12916,7 @@ function createFilter(filter, layerType = 'fill') {
12712
12916
  };
12713
12917
  }
12714
12918
  if (!isExpressionFilter(filter)) {
12715
- filter = convertFilter(filter);
12919
+ filter = convertFilter$1(filter);
12716
12920
  }
12717
12921
  const filterExp = filter;
12718
12922
  let staticFilter = true;
@@ -12857,16 +13061,16 @@ function geometryNeeded(filter) {
12857
13061
  }
12858
13062
  return false;
12859
13063
  }
12860
- function convertFilter(filter) {
13064
+ function convertFilter$1(filter) {
12861
13065
  if (!filter)
12862
13066
  return true;
12863
13067
  const op = filter[0];
12864
13068
  if (filter.length <= 1)
12865
13069
  return op !== 'any';
12866
- const converted = op === '==' ? convertComparisonOp(filter[1], filter[2], '==') : op === '!=' ? convertNegation(convertComparisonOp(filter[1], filter[2], '==')) : op === '<' || op === '>' || op === '<=' || op === '>=' ? convertComparisonOp(filter[1], filter[2], op) : op === 'any' ? convertDisjunctionOp(filter.slice(1)) : op === 'all' ? ['all'].concat(filter.slice(1).map(convertFilter)) : op === 'none' ? ['all'].concat(filter.slice(1).map(convertFilter).map(convertNegation)) : op === 'in' ? convertInOp(filter[1], filter.slice(2)) : op === '!in' ? convertNegation(convertInOp(filter[1], filter.slice(2))) : op === 'has' ? convertHasOp(filter[1]) : op === '!has' ? convertNegation(convertHasOp(filter[1])) : op === 'within' ? filter : true;
13070
+ const converted = op === '==' ? convertComparisonOp$1(filter[1], filter[2], '==') : op === '!=' ? convertNegation(convertComparisonOp$1(filter[1], filter[2], '==')) : op === '<' || op === '>' || op === '<=' || op === '>=' ? convertComparisonOp$1(filter[1], filter[2], op) : op === 'any' ? convertDisjunctionOp(filter.slice(1)) : op === 'all' ? ['all'].concat(filter.slice(1).map(convertFilter$1)) : op === 'none' ? ['all'].concat(filter.slice(1).map(convertFilter$1).map(convertNegation)) : op === 'in' ? convertInOp$1(filter[1], filter.slice(2)) : op === '!in' ? convertNegation(convertInOp$1(filter[1], filter.slice(2))) : op === 'has' ? convertHasOp$1(filter[1]) : op === '!has' ? convertNegation(convertHasOp$1(filter[1])) : op === 'within' ? filter : true;
12867
13071
  return converted;
12868
13072
  }
12869
- function convertComparisonOp(property, value, op) {
13073
+ function convertComparisonOp$1(property, value, op) {
12870
13074
  switch (property) {
12871
13075
  case '$type':
12872
13076
  return [
@@ -12887,9 +13091,9 @@ function convertComparisonOp(property, value, op) {
12887
13091
  }
12888
13092
  }
12889
13093
  function convertDisjunctionOp(filters) {
12890
- return ['any'].concat(filters.map(convertFilter));
13094
+ return ['any'].concat(filters.map(convertFilter$1));
12891
13095
  }
12892
- function convertInOp(property, values) {
13096
+ function convertInOp$1(property, values) {
12893
13097
  if (values.length === 0) {
12894
13098
  return false;
12895
13099
  }
@@ -12932,7 +13136,7 @@ function convertInOp(property, values) {
12932
13136
  }
12933
13137
  }
12934
13138
  }
12935
- function convertHasOp(property) {
13139
+ function convertHasOp$1(property) {
12936
13140
  switch (property) {
12937
13141
  case '$type':
12938
13142
  return true;
@@ -12952,7 +13156,7 @@ function convertNegation(filter) {
12952
13156
  ];
12953
13157
  }
12954
13158
 
12955
- function convertFilter$1(filter) {
13159
+ function convertFilter(filter) {
12956
13160
  return _convertFilter(filter, {});
12957
13161
  }
12958
13162
  function _convertFilter(filter, expectedTypes) {
@@ -12967,7 +13171,7 @@ function _convertFilter(filter, expectedTypes) {
12967
13171
  let converted;
12968
13172
  if (op === '==' || op === '!=' || op === '<' || op === '>' || op === '<=' || op === '>=') {
12969
13173
  const [, property, value] = filter;
12970
- converted = convertComparisonOp$1(property, value, op, expectedTypes);
13174
+ converted = convertComparisonOp(property, value, op, expectedTypes);
12971
13175
  } else if (op === 'any') {
12972
13176
  const children = filter.slice(1).map(f => {
12973
13177
  const types = {};
@@ -12990,15 +13194,15 @@ function _convertFilter(filter, expectedTypes) {
12990
13194
  _convertFilter(['any'].concat(filter.slice(1)), {})
12991
13195
  ];
12992
13196
  } else if (op === 'in') {
12993
- converted = convertInOp$1(filter[1], filter.slice(2));
13197
+ converted = convertInOp(filter[1], filter.slice(2));
12994
13198
  } else if (op === '!in') {
12995
- converted = convertInOp$1(filter[1], filter.slice(2), true);
13199
+ converted = convertInOp(filter[1], filter.slice(2), true);
12996
13200
  } else if (op === 'has') {
12997
- converted = convertHasOp$1(filter[1]);
13201
+ converted = convertHasOp(filter[1]);
12998
13202
  } else if (op === '!has') {
12999
13203
  converted = [
13000
13204
  '!',
13001
- convertHasOp$1(filter[1])
13205
+ convertHasOp(filter[1])
13002
13206
  ];
13003
13207
  } else {
13004
13208
  converted = true;
@@ -13027,7 +13231,7 @@ function runtimeTypeChecks(expectedTypes) {
13027
13231
  return conditions[0];
13028
13232
  return ['all'].concat(conditions);
13029
13233
  }
13030
- function convertComparisonOp$1(property, value, op, expectedTypes) {
13234
+ function convertComparisonOp(property, value, op, expectedTypes) {
13031
13235
  let get;
13032
13236
  if (property === '$type') {
13033
13237
  return [
@@ -13083,7 +13287,7 @@ function convertComparisonOp$1(property, value, op, expectedTypes) {
13083
13287
  value
13084
13288
  ];
13085
13289
  }
13086
- function convertInOp$1(property, values, negate = false) {
13290
+ function convertInOp(property, values, negate = false) {
13087
13291
  if (values.length === 0)
13088
13292
  return negate;
13089
13293
  let get;
@@ -13121,7 +13325,7 @@ function convertInOp$1(property, values, negate = false) {
13121
13325
  v
13122
13326
  ]));
13123
13327
  }
13124
- function convertHasOp$1(property) {
13328
+ function convertHasOp(property) {
13125
13329
  if (property === '$type') {
13126
13330
  return true;
13127
13331
  } else if (property === '$id') {
@@ -13142,7 +13346,7 @@ function migrateToExpressions (style) {
13142
13346
  const converted = [];
13143
13347
  eachLayer(style, layer => {
13144
13348
  if (layer.filter) {
13145
- layer.filter = convertFilter$1(layer.filter);
13349
+ layer.filter = convertFilter(layer.filter);
13146
13350
  }
13147
13351
  });
13148
13352
  eachProperty(style, {
@@ -13669,7 +13873,7 @@ class ValidationError {
13669
13873
  }
13670
13874
  }
13671
13875
 
13672
- class ParsingError$1 {
13876
+ class ParsingError {
13673
13877
  constructor(error) {
13674
13878
  this.error = error;
13675
13879
  this.message = error.message;
@@ -14020,7 +14224,7 @@ function disallowedFilterParameters(e, options) {
14020
14224
  return [];
14021
14225
  }
14022
14226
  const errors = [];
14023
- if (e instanceof CompoundExpression) {
14227
+ if (e instanceof CompoundExpression$1) {
14024
14228
  if (disallowedParameters.has(e.name)) {
14025
14229
  return [new ValidationError(options.key, options.value, `["${ e.name }"] expression is not supported in a filter for a ${ options.object.type } layer with id: ${ options.object.id }`)];
14026
14230
  }
@@ -14202,7 +14406,7 @@ function validateProperty(options, propertyType) {
14202
14406
  if (propertyKey === 'text-field' && style && !style.glyphs) {
14203
14407
  errors.push(new ValidationError(key, value, 'use of "text-field" requires a style "glyphs" property'));
14204
14408
  }
14205
- if (propertyKey === 'text-font' && isFunction$1(deepUnbundle(value)) && unbundle(value.type) === 'identity') {
14409
+ if (propertyKey === 'text-font' && isFunction(deepUnbundle(value)) && unbundle(value.type) === 'identity') {
14206
14410
  errors.push(new ValidationError(key, value, '"text-font" does not support identity functions'));
14207
14411
  }
14208
14412
  }
@@ -14289,6 +14493,8 @@ function validateLayer(options) {
14289
14493
  errors.push(new ValidationError(key, layer.source, 'raster-dem source can only be used with layer type \'hillshade\'.'));
14290
14494
  } else if (type === 'line' && layer.paint && layer.paint['line-gradient'] && (sourceType !== 'geojson' || !source.lineMetrics)) {
14291
14495
  errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`));
14496
+ } else if (type === 'line' && layer.paint && layer.paint['line-trim-offset'] && !layer.paint['line-gradient']) {
14497
+ errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-trim-offset, which requires line-gradient enabled.`));
14292
14498
  }
14293
14499
  }
14294
14500
  }
@@ -14662,7 +14868,7 @@ function validate(options) {
14662
14868
  const value = options.value;
14663
14869
  const valueSpec = options.valueSpec;
14664
14870
  const styleSpec = options.styleSpec;
14665
- if (valueSpec.expression && isFunction$1(unbundle(value))) {
14871
+ if (valueSpec.expression && isFunction(unbundle(value))) {
14666
14872
  return validateFunction(options);
14667
14873
  } else if (valueSpec.expression && isExpression(deepUnbundle(value))) {
14668
14874
  return validateExpression(options);
@@ -14689,7 +14895,7 @@ function validateGlyphsURL (options) {
14689
14895
  return errors;
14690
14896
  }
14691
14897
 
14692
- function validateStyle(style, styleSpec = v8) {
14898
+ function validateStyle$1(style, styleSpec = v8) {
14693
14899
  const errors = validate({
14694
14900
  key: '',
14695
14901
  value: style,
@@ -15366,25 +15572,27 @@ exports.parse = function () { return parser.parse.apply(parser, arguments); };
15366
15572
  }
15367
15573
  });
15368
15574
 
15575
+ var jsonlint$1 = jsonlint;
15576
+
15369
15577
  function readStyle(style) {
15370
15578
  if (style instanceof String || typeof style === 'string' || style instanceof Buffer) {
15371
15579
  try {
15372
- return jsonlint.parse(style.toString());
15580
+ return jsonlint$1.parse(style.toString());
15373
15581
  } catch (e) {
15374
- throw new ParsingError$1(e);
15582
+ throw new ParsingError(e);
15375
15583
  }
15376
15584
  }
15377
15585
  return style;
15378
15586
  }
15379
15587
 
15380
- function validateStyle$1(style, styleSpec = v8) {
15588
+ function validateStyle(style, styleSpec = v8) {
15381
15589
  let s = style;
15382
15590
  try {
15383
15591
  s = readStyle(s);
15384
15592
  } catch (e) {
15385
15593
  return [e];
15386
15594
  }
15387
- return validateStyle(s, styleSpec);
15595
+ return validateStyle$1(s, styleSpec);
15388
15596
  }
15389
15597
 
15390
15598
  const SUPPORTED_SPEC_VERSION = 8;
@@ -15493,14 +15701,14 @@ function validateMapboxApiSupported(style) {
15493
15701
  } catch (e) {
15494
15702
  return [e];
15495
15703
  }
15496
- let errors = validateStyle(s, v8).concat(getRootErrors(s, Object.keys(v8.$root)));
15704
+ let errors = validateStyle$1(s, v8).concat(getRootErrors(s, Object.keys(v8.$root)));
15497
15705
  if (s.sources) {
15498
15706
  errors = errors.concat(getSourcesErrors(s.sources));
15499
15707
  }
15500
15708
  return errors;
15501
15709
  }
15502
15710
 
15503
- const expression$1 = {
15711
+ const expression = {
15504
15712
  StyleExpression,
15505
15713
  isExpression,
15506
15714
  isExpressionFilter,
@@ -15514,7 +15722,7 @@ const expression$1 = {
15514
15722
  const styleFunction = {
15515
15723
  convertFunction,
15516
15724
  createFunction,
15517
- isFunction: isFunction$1
15725
+ isFunction
15518
15726
  };
15519
15727
  const visit = {
15520
15728
  eachSource,
@@ -15522,5 +15730,5 @@ const visit = {
15522
15730
  eachProperty
15523
15731
  };
15524
15732
 
15525
- export { Color, ParsingError$1 as ParsingError, ValidationError, composite, convertFilter$1 as convertFilter, derefLayers, diffStyles as diff, expression$1 as expression, createFilter as featureFilter, format, styleFunction as function, v8 as latest, migrate, v8, validateStyle$1 as validate, validateMapboxApiSupported, visit };
15733
+ export { Color$1 as Color, ParsingError, ValidationError, composite, convertFilter, derefLayers, diffStyles as diff, expression, createFilter as featureFilter, format$1 as format, styleFunction as function, v8 as latest, migrate, v8, validateStyle as validate, validateMapboxApiSupported, visit };
15526
15734
  //# sourceMappingURL=index.es.js.map